From da927fcd088ba4f2f1aad31194fd01def2390be1 Mon Sep 17 00:00:00 2001 From: Sander van Harmelen Date: Fri, 29 Jan 2016 18:41:14 +0100 Subject: [PATCH 01/15] Make the Chef `attributes` param also accept a raw JSON string See the updated docs for more details and examples, but in short this enables the `attributes` param from the Chef provisioner to accept a raw JSON string. Fixes #3074 Fixes #3572 --- .../chef/linux_provisioner_test.go | 28 ++++++++++++++++++- .../provisioners/chef/resource_provisioner.go | 23 ++++++++++++--- .../chef/resource_provisioner_test.go | 1 - .../chef/windows_provisioner_test.go | 27 +++++++++++++++++- .../docs/provisioners/chef.html.markdown | 20 ++++++++----- 5 files changed, 85 insertions(+), 14 deletions(-) diff --git a/builtin/provisioners/chef/linux_provisioner_test.go b/builtin/provisioners/chef/linux_provisioner_test.go index 89fae2b3f0..02b58c910d 100644 --- a/builtin/provisioners/chef/linux_provisioner_test.go +++ b/builtin/provisioners/chef/linux_provisioner_test.go @@ -236,7 +236,33 @@ func TestResourceProvider_linuxCreateConfigFiles(t *testing.T) { }, }, - "Attributes": { + "String Attributes": { + Config: testConfig(t, map[string]interface{}{ + "attributes": `{"key1":{"subkey1":{"subkey2a":["val1","val2","val3"],` + + `"subkey2b":{"subkey3":"value3"}}},"key2":"value2"}`, + "node_name": "nodename1", + "prevent_sudo": true, + "run_list": []interface{}{"cookbook::recipe"}, + "secret_key_path": "test-fixtures/encrypted_data_bag_secret", + "server_url": "https://chef.local", + "validation_client_name": "validator", + "validation_key_path": "test-fixtures/validator.pem", + }), + + Commands: map[string]bool{ + "mkdir -p " + linuxConfDir: true, + }, + + Uploads: map[string]string{ + linuxConfDir + "/client.rb": defaultLinuxClientConf, + linuxConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE", + linuxConfDir + "/validation.pem": "VALIDATOR-PEM-FILE", + linuxConfDir + "/first-boot.json": `{"key1":{"subkey1":{"subkey2a":["val1","val2","val3"],` + + `"subkey2b":{"subkey3":"value3"}}},"key2":"value2","run_list":["cookbook::recipe"]}`, + }, + }, + + "Map Attributes": { Config: testConfig(t, map[string]interface{}{ "attributes": []map[string]interface{}{ map[string]interface{}{ diff --git a/builtin/provisioners/chef/resource_provisioner.go b/builtin/provisioners/chef/resource_provisioner.go index 34c6a5f1f0..54d9f48cf8 100644 --- a/builtin/provisioners/chef/resource_provisioner.go +++ b/builtin/provisioners/chef/resource_provisioner.go @@ -222,6 +222,12 @@ func (r *ResourceProvisioner) Validate(c *terraform.ResourceConfig) (ws []string ws = append(ws, "secret_key_path is deprecated, please use "+ "secret_key instead and load the key contents via file()") } + if attrs, ok := c.Config["attributes"]; ok { + if _, ok := attrs.(string); !ok { + ws = append(ws, "using map style attribute values is deprecated, "+ + " please use a single raw JSON string instead") + } + } return ws, es } @@ -280,9 +286,18 @@ func (r *ResourceProvisioner) decodeConfig(c *terraform.ResourceConfig) (*Provis } if attrs, ok := c.Config["attributes"]; ok { - p.Attributes, err = rawToJSON(attrs) - if err != nil { - return nil, fmt.Errorf("Error parsing the attributes: %v", err) + switch attrs := attrs.(type) { + case string: + var m map[string]interface{} + if err := json.Unmarshal([]byte(attrs), &m); err != nil { + return nil, fmt.Errorf("Error parsing the attributes: %v", err) + } + p.Attributes = m + default: + p.Attributes, err = rawToJSON(attrs) + if err != nil { + return nil, fmt.Errorf("Error parsing the attributes: %v", err) + } } } @@ -306,7 +321,7 @@ func rawToJSON(raw interface{}) (interface{}, error) { return s[0], nil default: - return raw, nil + return s, nil } } diff --git a/builtin/provisioners/chef/resource_provisioner_test.go b/builtin/provisioners/chef/resource_provisioner_test.go index 40625196a7..f06d97f846 100644 --- a/builtin/provisioners/chef/resource_provisioner_test.go +++ b/builtin/provisioners/chef/resource_provisioner_test.go @@ -16,7 +16,6 @@ func TestResourceProvisioner_impl(t *testing.T) { func TestResourceProvider_Validate_good(t *testing.T) { c := testConfig(t, map[string]interface{}{ - "attributes": []interface{}{"key1 { subkey1 = value1 }"}, "environment": "_default", "node_name": "nodename1", "run_list": []interface{}{"cookbook::recipe"}, diff --git a/builtin/provisioners/chef/windows_provisioner_test.go b/builtin/provisioners/chef/windows_provisioner_test.go index 13604d6c92..5067057950 100644 --- a/builtin/provisioners/chef/windows_provisioner_test.go +++ b/builtin/provisioners/chef/windows_provisioner_test.go @@ -153,7 +153,32 @@ func TestResourceProvider_windowsCreateConfigFiles(t *testing.T) { }, }, - "Attributes": { + "String Attributes": { + Config: testConfig(t, map[string]interface{}{ + "attributes": `{"key1":{"subkey1":{"subkey2a":["val1","val2","val3"],` + + `"subkey2b":{"subkey3":"value3"}}},"key2":"value2"}`, + "node_name": "nodename1", + "run_list": []interface{}{"cookbook::recipe"}, + "secret_key_path": "test-fixtures/encrypted_data_bag_secret", + "server_url": "https://chef.local", + "validation_client_name": "validator", + "validation_key_path": "test-fixtures/validator.pem", + }), + + Commands: map[string]bool{ + fmt.Sprintf("cmd /c if not exist %q mkdir %q", windowsConfDir, windowsConfDir): true, + }, + + Uploads: map[string]string{ + windowsConfDir + "/client.rb": defaultWindowsClientConf, + windowsConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE", + windowsConfDir + "/validation.pem": "VALIDATOR-PEM-FILE", + windowsConfDir + "/first-boot.json": `{"key1":{"subkey1":{"subkey2a":["val1","val2","val3"],` + + `"subkey2b":{"subkey3":"value3"}}},"key2":"value2","run_list":["cookbook::recipe"]}`, + }, + }, + + "Map Attributes": { Config: testConfig(t, map[string]interface{}{ "attributes": []map[string]interface{}{ map[string]interface{}{ diff --git a/website/source/docs/provisioners/chef.html.markdown b/website/source/docs/provisioners/chef.html.markdown index e4b89f23f4..41ec869ce1 100644 --- a/website/source/docs/provisioners/chef.html.markdown +++ b/website/source/docs/provisioners/chef.html.markdown @@ -25,14 +25,19 @@ available on the target machine. resource "aws_instance" "web" { ... provisioner "chef" { - attributes { - "key" = "value" - "app" { - "cluster1" { - "nodes" = ["webserver1", "webserver2"] + attributes = < Date: Wed, 3 Feb 2016 00:33:42 -0800 Subject: [PATCH 02/15] fix ec2 classic security group changing --- builtin/providers/aws/resource_aws_db_instance.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/providers/aws/resource_aws_db_instance.go b/builtin/providers/aws/resource_aws_db_instance.go index 523c89c251..e0cb1776a1 100644 --- a/builtin/providers/aws/resource_aws_db_instance.go +++ b/builtin/providers/aws/resource_aws_db_instance.go @@ -775,7 +775,7 @@ func resourceAwsDbInstanceUpdate(d *schema.ResourceData, meta interface{}) error requestUpdate = true } - if d.HasChange("vpc_security_group_ids") { + if d.HasChange("security_group_names") { if attr := d.Get("security_group_names").(*schema.Set); attr.Len() > 0 { var s []*string for _, v := range attr.List() { From 53a42eaa0f7b20e7e28f6541865dd31f4b2b98a4 Mon Sep 17 00:00:00 2001 From: clint shryock Date: Tue, 2 Feb 2016 12:37:06 -0600 Subject: [PATCH 03/15] provider/aws: Add a regression test for Route53 records This is a follow up on #4892 with tests that demonstrate creating a record and a zone, then destroying said record, and confirming that a new plan is generated, using the ExpectNonEmptyPlan flag This simulates the bug reported in #4641 by mimicking the state file that one would have if they created a record with Terraform v0.6.6, which is to say a weight = 0 for a default value. When upgrading, there would be an expected plan change to get that to -1. To mimic the statefile we apply the record and then in a follow up step change the attributes directly. We then try to delete the record. I tested this by grabbing the source of aws_resource_route53.go from Terraform v0.6.9 and running the included test, which fails. The test will pass with #4892 , because we no longer reconstruct what the record should be based on the state (instead finding via the API and elimination/matching) --- .../aws/resource_aws_route53_record.go | 2 +- .../aws/resource_aws_route53_record_test.go | 58 +++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/builtin/providers/aws/resource_aws_route53_record.go b/builtin/providers/aws/resource_aws_route53_record.go index 2678385c1f..7fa9aae126 100644 --- a/builtin/providers/aws/resource_aws_route53_record.go +++ b/builtin/providers/aws/resource_aws_route53_record.go @@ -355,7 +355,7 @@ func resourceAwsRoute53RecordDelete(d *schema.ResourceData, meta interface{}) er } } - // Create the new records + // Change batch for deleting changeBatch := &route53.ChangeBatch{ Comment: aws.String("Deleted by Terraform"), Changes: []*route53.Change{ diff --git a/builtin/providers/aws/resource_aws_route53_record_test.go b/builtin/providers/aws/resource_aws_route53_record_test.go index f07215df51..65df31729a 100644 --- a/builtin/providers/aws/resource_aws_route53_record_test.go +++ b/builtin/providers/aws/resource_aws_route53_record_test.go @@ -258,6 +258,58 @@ func TestAccAWSRoute53Record_TypeChange(t *testing.T) { }) } +// Test record deletion out of band and make sure we render a new plan +// Part of regression test(s) for https://github.com/hashicorp/terraform/pull/4892 +func TestAccAWSRoute53Record_planUpdate(t *testing.T) { + var zone route53.GetHostedZoneOutput + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckRoute53RecordDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccRoute53RecordConfig, + Check: resource.ComposeTestCheckFunc( + testAccCheckRoute53RecordExists("aws_route53_record.default"), + testAccCheckRoute53ZoneExists("aws_route53_zone.main", &zone), + ), + }, + resource.TestStep{ + Config: testAccRoute53RecordConfig, + Check: resource.ComposeTestCheckFunc( + testAccCheckRoute53DeleteRecord("aws_route53_record.default", &zone), + ), + ExpectNonEmptyPlan: true, + }, + resource.TestStep{ + Config: testAccRoute53RecordNoConfig, + Check: resource.ComposeTestCheckFunc( + testAccCheckRoute53ZoneExists("aws_route53_zone.main", &zone), + ), + }, + }, + }) +} + +func testAccCheckRoute53DeleteRecord(n string, zone *route53.GetHostedZoneOutput) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.ID == "" { + return fmt.Errorf("No hosted zone ID is set") + } + + // Manually set the weight to 0 to replicate a record created in Terraform + // pre-0.6.9 + rs.Primary.Attributes["weight"] = "0" + + return nil + } +} + func testAccCheckRoute53RecordDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).r53conn for _, rs := range s.RootModule().Resources { @@ -354,6 +406,12 @@ resource "aws_route53_record" "default" { } ` +const testAccRoute53RecordNoConfig = ` +resource "aws_route53_zone" "main" { + name = "notexample.com" +} +` + const testAccRoute53RecordConfigSuffix = ` resource "aws_route53_zone" "main" { name = "notexample.com" From 79e2642dabdedcb987cd08e2cf8ba1696795e5ec Mon Sep 17 00:00:00 2001 From: Sander van Harmelen Date: Thu, 4 Feb 2016 15:31:24 +0100 Subject: [PATCH 04/15] Fix issue #4881 This fixes issue #4881 by adding an option to fetch the Chef SSL certificates. --- .../provisioners/chef/resource_provisioner.go | 98 ++++++++++++------- .../chef/resource_provisioner_test.go | 73 ++++++++++++++ .../docs/provisioners/chef.html.markdown | 6 +- 3 files changed, 139 insertions(+), 38 deletions(-) diff --git a/builtin/provisioners/chef/resource_provisioner.go b/builtin/provisioners/chef/resource_provisioner.go index 54d9f48cf8..14afaad669 100644 --- a/builtin/provisioners/chef/resource_provisioner.go +++ b/builtin/provisioners/chef/resource_provisioner.go @@ -24,16 +24,18 @@ import ( ) const ( - clienrb = "client.rb" - defaultEnv = "_default" - firstBoot = "first-boot.json" - logfileDir = "logfiles" - linuxChefCmd = "chef-client" - linuxConfDir = "/etc/chef" - secretKey = "encrypted_data_bag_secret" - validationKey = "validation.pem" - windowsChefCmd = "cmd /c chef-client" - windowsConfDir = "C:/chef" + clienrb = "client.rb" + defaultEnv = "_default" + firstBoot = "first-boot.json" + logfileDir = "logfiles" + linuxChefCmd = "chef-client" + linuxKnifeCmd = "knife" + linuxConfDir = "/etc/chef" + secretKey = "encrypted_data_bag_secret" + validationKey = "validation.pem" + windowsChefCmd = "cmd /c chef-client" + windowsKnifeCmd = "cmd /c knife" + windowsConfDir = "C:/chef" ) const clientConf = ` @@ -74,34 +76,36 @@ ENV['no_proxy'] = "{{ join .NOProxy "," }}" // Provisioner represents a specificly configured chef provisioner type Provisioner struct { - Attributes interface{} `mapstructure:"attributes"` - ClientOptions []string `mapstructure:"client_options"` - DisableReporting bool `mapstructure:"disable_reporting"` - Environment string `mapstructure:"environment"` - LogToFile bool `mapstructure:"log_to_file"` - UsePolicyfile bool `mapstructure:"use_policyfile"` - PolicyGroup string `mapstructure:"policy_group"` - PolicyName string `mapstructure:"policy_name"` - HTTPProxy string `mapstructure:"http_proxy"` - HTTPSProxy string `mapstructure:"https_proxy"` - NOProxy []string `mapstructure:"no_proxy"` - NodeName string `mapstructure:"node_name"` - OhaiHints []string `mapstructure:"ohai_hints"` - OSType string `mapstructure:"os_type"` - PreventSudo bool `mapstructure:"prevent_sudo"` - RunList []string `mapstructure:"run_list"` - SecretKey string `mapstructure:"secret_key"` - ServerURL string `mapstructure:"server_url"` - SkipInstall bool `mapstructure:"skip_install"` - SSLVerifyMode string `mapstructure:"ssl_verify_mode"` - ValidationClientName string `mapstructure:"validation_client_name"` - ValidationKey string `mapstructure:"validation_key"` - Version string `mapstructure:"version"` + Attributes interface{} `mapstructure:"attributes"` + ClientOptions []string `mapstructure:"client_options"` + DisableReporting bool `mapstructure:"disable_reporting"` + Environment string `mapstructure:"environment"` + FetchChefCertificates bool `mapstructure:"fetch_chef_certificates"` + LogToFile bool `mapstructure:"log_to_file"` + UsePolicyfile bool `mapstructure:"use_policyfile"` + PolicyGroup string `mapstructure:"policy_group"` + PolicyName string `mapstructure:"policy_name"` + HTTPProxy string `mapstructure:"http_proxy"` + HTTPSProxy string `mapstructure:"https_proxy"` + NOProxy []string `mapstructure:"no_proxy"` + NodeName string `mapstructure:"node_name"` + OhaiHints []string `mapstructure:"ohai_hints"` + OSType string `mapstructure:"os_type"` + PreventSudo bool `mapstructure:"prevent_sudo"` + RunList []string `mapstructure:"run_list"` + SecretKey string `mapstructure:"secret_key"` + ServerURL string `mapstructure:"server_url"` + SkipInstall bool `mapstructure:"skip_install"` + SSLVerifyMode string `mapstructure:"ssl_verify_mode"` + ValidationClientName string `mapstructure:"validation_client_name"` + ValidationKey string `mapstructure:"validation_key"` + Version string `mapstructure:"version"` - installChefClient func(terraform.UIOutput, communicator.Communicator) error - createConfigFiles func(terraform.UIOutput, communicator.Communicator) error - runChefClient func(terraform.UIOutput, communicator.Communicator) error - useSudo bool + installChefClient func(terraform.UIOutput, communicator.Communicator) error + createConfigFiles func(terraform.UIOutput, communicator.Communicator) error + fetchChefCertificates func(terraform.UIOutput, communicator.Communicator) error + runChefClient func(terraform.UIOutput, communicator.Communicator) error + useSudo bool // Deprecated Fields SecretKeyPath string `mapstructure:"secret_key_path"` @@ -138,11 +142,13 @@ func (r *ResourceProvisioner) Apply( case "linux": p.installChefClient = p.linuxInstallChefClient p.createConfigFiles = p.linuxCreateConfigFiles + p.fetchChefCertificates = p.fetchChefCertificatesFunc(linuxChefCmd, linuxConfDir) p.runChefClient = p.runChefClientFunc(linuxChefCmd, linuxConfDir) p.useSudo = !p.PreventSudo && s.Ephemeral.ConnInfo["user"] != "root" case "windows": p.installChefClient = p.windowsInstallChefClient p.createConfigFiles = p.windowsCreateConfigFiles + p.fetchChefCertificates = p.fetchChefCertificatesFunc(windowsChefCmd, windowsConfDir) p.runChefClient = p.runChefClientFunc(windowsChefCmd, windowsConfDir) p.useSudo = false default: @@ -176,6 +182,13 @@ func (r *ResourceProvisioner) Apply( return err } + if p.FetchChefCertificates { + o.Output("Fetch Chef certificates...") + if err := p.fetchChefCertificates(o, comm); err != nil { + return err + } + } + o.Output("Starting initial Chef-Client run...") if err := p.runChefClient(o, comm); err != nil { return err @@ -343,6 +356,17 @@ func retryFunc(timeout time.Duration, f func() error) error { } } +func (p *Provisioner) fetchChefCertificatesFunc( + knifeCmd string, + confDir string) func(terraform.UIOutput, communicator.Communicator) error { + return func(o terraform.UIOutput, comm communicator.Communicator) error { + clientrb := path.Join(confDir, clienrb) + cmd := fmt.Sprintf("%s ssl fetch -c %s", knifeCmd, clientrb) + + return p.runCommand(o, comm, cmd) + } +} + func (p *Provisioner) runChefClientFunc( chefCmd string, confDir string) func(terraform.UIOutput, communicator.Communicator) error { diff --git a/builtin/provisioners/chef/resource_provisioner_test.go b/builtin/provisioners/chef/resource_provisioner_test.go index f06d97f846..d3f9684dae 100644 --- a/builtin/provisioners/chef/resource_provisioner_test.go +++ b/builtin/provisioners/chef/resource_provisioner_test.go @@ -148,3 +148,76 @@ func TestResourceProvider_runChefClient(t *testing.T) { } } } + +func TestResourceProvider_fetchChefCertificates(t *testing.T) { + cases := map[string]struct { + Config *terraform.ResourceConfig + KnifeCmd string + ConfDir string + Commands map[string]bool + }{ + "Sudo": { + Config: testConfig(t, map[string]interface{}{ + "fetch_chef_certificates": true, + "node_name": "nodename1", + "run_list": []interface{}{"cookbook::recipe"}, + "server_url": "https://chef.local", + "validation_client_name": "validator", + "validation_key_path": "test-fixtures/validator.pem", + }), + + KnifeCmd: linuxKnifeCmd, + + ConfDir: linuxConfDir, + + Commands: map[string]bool{ + fmt.Sprintf(`sudo %s ssl fetch -c %s`, + linuxKnifeCmd, + path.Join(linuxConfDir, "client.rb")): true, + }, + }, + + "NoSudo": { + Config: testConfig(t, map[string]interface{}{ + "fetch_chef_certificates": true, + "node_name": "nodename1", + "prevent_sudo": true, + "run_list": []interface{}{"cookbook::recipe"}, + "server_url": "https://chef.local", + "validation_client_name": "validator", + "validation_key_path": "test-fixtures/validator.pem", + }), + + KnifeCmd: windowsKnifeCmd, + + ConfDir: windowsConfDir, + + Commands: map[string]bool{ + fmt.Sprintf(`%s ssl fetch -c %s`, + windowsKnifeCmd, + path.Join(windowsConfDir, "client.rb")): true, + }, + }, + } + + r := new(ResourceProvisioner) + o := new(terraform.MockUIOutput) + c := new(communicator.MockCommunicator) + + for k, tc := range cases { + c.Commands = tc.Commands + + p, err := r.decodeConfig(tc.Config) + if err != nil { + t.Fatalf("Error: %v", err) + } + + p.fetchChefCertificates = p.fetchChefCertificatesFunc(tc.KnifeCmd, tc.ConfDir) + p.useSudo = !p.PreventSudo + + err = p.fetchChefCertificates(o, c) + if err != nil { + t.Fatalf("Test %q failed: %v", k, err) + } + } +} diff --git a/website/source/docs/provisioners/chef.html.markdown b/website/source/docs/provisioners/chef.html.markdown index 41ec869ce1..9e5a8b9a93 100644 --- a/website/source/docs/provisioners/chef.html.markdown +++ b/website/source/docs/provisioners/chef.html.markdown @@ -59,7 +59,7 @@ The following arguments are supported: interpolation function](/docs/configuration/interpolation.html#file_path_). * `client_options (array)` - (Optional) A list of optional Chef Client configuration - options. See the Chef Client [documentation](https://docs.chef.io/config_rb_client.html) for all available options. + options. See the [Chef Client ](https://docs.chef.io/config_rb_client.html) documentation for all available options. * `disable_reporting (boolean)` - (Optional) If true the Chef Client will not try to send reporting data (used by Chef Reporting) to the Chef Server (defaults false) @@ -67,6 +67,10 @@ The following arguments are supported: * `environment (string)` - (Optional) The Chef environment the new node will be joining (defaults `_default`). +* `fetch_chef_certificates (boolean)` (Optional) If true the SSL certificates configured + on your Chef server will be fetched and trusted. See the knife [ssl_fetch](https://docs.chef.io/knife_ssl_fetch.html) + documentation for more details. + * `log_to_file (boolean)` - (Optional) If true, the output of the initial Chef Client run will be logged to a local file instead of the console. The file will be created in a subdirectory called `logfiles` created in your current directory. The filename will be From ac0cbd400efdb052cde4ae35aeaa756cdee77dfb Mon Sep 17 00:00:00 2001 From: Sander van Harmelen Date: Tue, 9 Feb 2016 11:11:46 +0100 Subject: [PATCH 05/15] Add `attributes_json` param for consistency Add `attributes_json` param for both consistency and easier management of deprecating the old `attributes` param. --- .../chef/linux_provisioner_test.go | 54 +++++++++---------- .../provisioners/chef/resource_provisioner.go | 32 ++++++----- .../chef/windows_provisioner_test.go | 52 +++++++++--------- .../docs/provisioners/chef.html.markdown | 7 +-- 4 files changed, 72 insertions(+), 73 deletions(-) diff --git a/builtin/provisioners/chef/linux_provisioner_test.go b/builtin/provisioners/chef/linux_provisioner_test.go index 02b58c910d..ec72f7debf 100644 --- a/builtin/provisioners/chef/linux_provisioner_test.go +++ b/builtin/provisioners/chef/linux_provisioner_test.go @@ -236,33 +236,7 @@ func TestResourceProvider_linuxCreateConfigFiles(t *testing.T) { }, }, - "String Attributes": { - Config: testConfig(t, map[string]interface{}{ - "attributes": `{"key1":{"subkey1":{"subkey2a":["val1","val2","val3"],` + - `"subkey2b":{"subkey3":"value3"}}},"key2":"value2"}`, - "node_name": "nodename1", - "prevent_sudo": true, - "run_list": []interface{}{"cookbook::recipe"}, - "secret_key_path": "test-fixtures/encrypted_data_bag_secret", - "server_url": "https://chef.local", - "validation_client_name": "validator", - "validation_key_path": "test-fixtures/validator.pem", - }), - - Commands: map[string]bool{ - "mkdir -p " + linuxConfDir: true, - }, - - Uploads: map[string]string{ - linuxConfDir + "/client.rb": defaultLinuxClientConf, - linuxConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE", - linuxConfDir + "/validation.pem": "VALIDATOR-PEM-FILE", - linuxConfDir + "/first-boot.json": `{"key1":{"subkey1":{"subkey2a":["val1","val2","val3"],` + - `"subkey2b":{"subkey3":"value3"}}},"key2":"value2","run_list":["cookbook::recipe"]}`, - }, - }, - - "Map Attributes": { + "Attributes": { Config: testConfig(t, map[string]interface{}{ "attributes": []map[string]interface{}{ map[string]interface{}{ @@ -306,6 +280,32 @@ func TestResourceProvider_linuxCreateConfigFiles(t *testing.T) { `"subkey2b":{"subkey3":"value3"}}},"key2":"value2","run_list":["cookbook::recipe"]}`, }, }, + + "Attributes JSON": { + Config: testConfig(t, map[string]interface{}{ + "attributes_json": `{"key1":{"subkey1":{"subkey2a":["val1","val2","val3"],` + + `"subkey2b":{"subkey3":"value3"}}},"key2":"value2"}`, + "node_name": "nodename1", + "prevent_sudo": true, + "run_list": []interface{}{"cookbook::recipe"}, + "secret_key_path": "test-fixtures/encrypted_data_bag_secret", + "server_url": "https://chef.local", + "validation_client_name": "validator", + "validation_key_path": "test-fixtures/validator.pem", + }), + + Commands: map[string]bool{ + "mkdir -p " + linuxConfDir: true, + }, + + Uploads: map[string]string{ + linuxConfDir + "/client.rb": defaultLinuxClientConf, + linuxConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE", + linuxConfDir + "/validation.pem": "VALIDATOR-PEM-FILE", + linuxConfDir + "/first-boot.json": `{"key1":{"subkey1":{"subkey2a":["val1","val2","val3"],` + + `"subkey2b":{"subkey3":"value3"}}},"key2":"value2","run_list":["cookbook::recipe"]}`, + }, + }, } r := new(ResourceProvisioner) diff --git a/builtin/provisioners/chef/resource_provisioner.go b/builtin/provisioners/chef/resource_provisioner.go index 14afaad669..085603948f 100644 --- a/builtin/provisioners/chef/resource_provisioner.go +++ b/builtin/provisioners/chef/resource_provisioner.go @@ -77,6 +77,7 @@ ENV['no_proxy'] = "{{ join .NOProxy "," }}" // Provisioner represents a specificly configured chef provisioner type Provisioner struct { Attributes interface{} `mapstructure:"attributes"` + AttributesJSON string `mapstructure:"attributes_json"` ClientOptions []string `mapstructure:"client_options"` DisableReporting bool `mapstructure:"disable_reporting"` Environment string `mapstructure:"environment"` @@ -235,11 +236,9 @@ func (r *ResourceProvisioner) Validate(c *terraform.ResourceConfig) (ws []string ws = append(ws, "secret_key_path is deprecated, please use "+ "secret_key instead and load the key contents via file()") } - if attrs, ok := c.Config["attributes"]; ok { - if _, ok := attrs.(string); !ok { - ws = append(ws, "using map style attribute values is deprecated, "+ - " please use a single raw JSON string instead") - } + if _, ok := c.Config["attributes"]; ok { + ws = append(ws, "using map style attribute values is deprecated, "+ + " please use a single raw JSON string instead") } return ws, es @@ -299,21 +298,20 @@ func (r *ResourceProvisioner) decodeConfig(c *terraform.ResourceConfig) (*Provis } if attrs, ok := c.Config["attributes"]; ok { - switch attrs := attrs.(type) { - case string: - var m map[string]interface{} - if err := json.Unmarshal([]byte(attrs), &m); err != nil { - return nil, fmt.Errorf("Error parsing the attributes: %v", err) - } - p.Attributes = m - default: - p.Attributes, err = rawToJSON(attrs) - if err != nil { - return nil, fmt.Errorf("Error parsing the attributes: %v", err) - } + p.Attributes, err = rawToJSON(attrs) + if err != nil { + return nil, fmt.Errorf("Error parsing the attributes: %v", err) } } + if attrs, ok := c.Config["attributes_json"]; ok { + var m map[string]interface{} + if err := json.Unmarshal([]byte(attrs.(string)), &m); err != nil { + return nil, fmt.Errorf("Error parsing the attributes: %v", err) + } + p.Attributes = m + } + return p, nil } diff --git a/builtin/provisioners/chef/windows_provisioner_test.go b/builtin/provisioners/chef/windows_provisioner_test.go index 5067057950..8dd0dee28e 100644 --- a/builtin/provisioners/chef/windows_provisioner_test.go +++ b/builtin/provisioners/chef/windows_provisioner_test.go @@ -153,32 +153,7 @@ func TestResourceProvider_windowsCreateConfigFiles(t *testing.T) { }, }, - "String Attributes": { - Config: testConfig(t, map[string]interface{}{ - "attributes": `{"key1":{"subkey1":{"subkey2a":["val1","val2","val3"],` + - `"subkey2b":{"subkey3":"value3"}}},"key2":"value2"}`, - "node_name": "nodename1", - "run_list": []interface{}{"cookbook::recipe"}, - "secret_key_path": "test-fixtures/encrypted_data_bag_secret", - "server_url": "https://chef.local", - "validation_client_name": "validator", - "validation_key_path": "test-fixtures/validator.pem", - }), - - Commands: map[string]bool{ - fmt.Sprintf("cmd /c if not exist %q mkdir %q", windowsConfDir, windowsConfDir): true, - }, - - Uploads: map[string]string{ - windowsConfDir + "/client.rb": defaultWindowsClientConf, - windowsConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE", - windowsConfDir + "/validation.pem": "VALIDATOR-PEM-FILE", - windowsConfDir + "/first-boot.json": `{"key1":{"subkey1":{"subkey2a":["val1","val2","val3"],` + - `"subkey2b":{"subkey3":"value3"}}},"key2":"value2","run_list":["cookbook::recipe"]}`, - }, - }, - - "Map Attributes": { + "Attributes": { Config: testConfig(t, map[string]interface{}{ "attributes": []map[string]interface{}{ map[string]interface{}{ @@ -221,6 +196,31 @@ func TestResourceProvider_windowsCreateConfigFiles(t *testing.T) { `"subkey2b":{"subkey3":"value3"}}},"key2":"value2","run_list":["cookbook::recipe"]}`, }, }, + + "Attributes JSON": { + Config: testConfig(t, map[string]interface{}{ + "attributes_json": `{"key1":{"subkey1":{"subkey2a":["val1","val2","val3"],` + + `"subkey2b":{"subkey3":"value3"}}},"key2":"value2"}`, + "node_name": "nodename1", + "run_list": []interface{}{"cookbook::recipe"}, + "secret_key_path": "test-fixtures/encrypted_data_bag_secret", + "server_url": "https://chef.local", + "validation_client_name": "validator", + "validation_key_path": "test-fixtures/validator.pem", + }), + + Commands: map[string]bool{ + fmt.Sprintf("cmd /c if not exist %q mkdir %q", windowsConfDir, windowsConfDir): true, + }, + + Uploads: map[string]string{ + windowsConfDir + "/client.rb": defaultWindowsClientConf, + windowsConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE", + windowsConfDir + "/validation.pem": "VALIDATOR-PEM-FILE", + windowsConfDir + "/first-boot.json": `{"key1":{"subkey1":{"subkey2a":["val1","val2","val3"],` + + `"subkey2b":{"subkey3":"value3"}}},"key2":"value2","run_list":["cookbook::recipe"]}`, + }, + }, } r := new(ResourceProvisioner) diff --git a/website/source/docs/provisioners/chef.html.markdown b/website/source/docs/provisioners/chef.html.markdown index 9e5a8b9a93..9345272697 100644 --- a/website/source/docs/provisioners/chef.html.markdown +++ b/website/source/docs/provisioners/chef.html.markdown @@ -25,7 +25,7 @@ available on the target machine. resource "aws_instance" "web" { ... provisioner "chef" { - attributes = < Date: Tue, 9 Feb 2016 17:41:03 -0800 Subject: [PATCH 06/15] Fix a typo in openstack network example OpenStack port uses "fixed_ip" property to specify Fixed IP addresses, but network example incorrectly uses "fixed_ipS" key. --- .../providers/openstack/r/networking_network_v2.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/source/docs/providers/openstack/r/networking_network_v2.html.markdown b/website/source/docs/providers/openstack/r/networking_network_v2.html.markdown index ce4f46db8f..27c3b48682 100644 --- a/website/source/docs/providers/openstack/r/networking_network_v2.html.markdown +++ b/website/source/docs/providers/openstack/r/networking_network_v2.html.markdown @@ -42,7 +42,7 @@ resource "openstack_networking_port_v2" "port_1" { admin_state_up = "true" security_groups = ["${openstack_compute_secgroup_v2.secgroup_1.id}"] - fixed_ips { + fixed_ip { "subnet_id" = "008ba151-0b8c-4a67-98b5-0d2b87666062" "ip_address" = "172.24.4.2" } From 8209b405265985583f9d8830068f92af7c1779ea Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Wed, 10 Feb 2016 10:45:16 -0600 Subject: [PATCH 07/15] vendor: Recapture deps w/ latest godep The original contents of `vendor` were inadvertently captured with an older version of `godep`. Here, we recapture dependencies by running the following: ``` godep restore -v cat Godeps/Godeps.json | jq -r '.Deps[].ImportPath' | xargs godep update -v ``` The newer godep makes the following changes as it captures dependencies: * Skips test files * Copies `LICENSE` / `PATENTS` files There is also an additional diff in `golang.org/x/sys/unix` that looks very similar to the diff between `master..c65f27f` in that repo, so I'm guessing that dependency was accidentally captured from master instead of the commit saved to `Godeps.json`. All in all, these changes should all be "more correct" and result in smaller diffs for any future updates made to dependencies. --- .../src/github.com/Azure/go-autorest/LICENSE | 191 + .../src/golang.org/x/crypto/LICENSE | 27 + .../src/golang.org/x/crypto/PATENTS | 22 + .../_workspace/src/gopkg.in/check.v1/LICENSE | 25 + .../github.com/Azure/azure-sdk-for-go/LICENSE | 202 + .../core/http/cgi/child_test.go | 131 - .../core/http/cgi/host_test.go | 461 -- .../core/http/cgi/matryoshka_test.go | 228 - .../core/http/cgi/plan9_test.go | 18 - .../core/http/cgi/posix_test.go | 21 - .../core/http/cgi/testdata/test.cgi | 91 - .../core/http/chunked_test.go | 159 - .../azure-sdk-for-go/core/http/client_test.go | 1038 --- .../azure-sdk-for-go/core/http/cookie_test.go | 380 -- .../core/http/cookiejar/jar_test.go | 1267 ---- .../core/http/cookiejar/punycode_test.go | 161 - .../core/http/example_test.go | 88 - .../azure-sdk-for-go/core/http/export_test.go | 72 - .../core/http/fcgi/fcgi_test.go | 150 - .../core/http/filetransport_test.go | 65 - .../azure-sdk-for-go/core/http/fs_test.go | 858 --- .../azure-sdk-for-go/core/http/header_test.go | 212 - .../core/http/httptest/example_test.go | 50 - .../core/http/httptest/recorder_test.go | 90 - .../core/http/httptest/server_test.go | 52 - .../core/http/httputil/chunked_test.go | 159 - .../core/http/httputil/dump_test.go | 263 - .../core/http/httputil/reverseproxy_test.go | 213 - .../azure-sdk-for-go/core/http/lex_test.go | 31 - .../azure-sdk-for-go/core/http/npn_test.go | 118 - .../azure-sdk-for-go/core/http/proxy_test.go | 81 - .../azure-sdk-for-go/core/http/range_test.go | 79 - .../core/http/readrequest_test.go | 331 - .../core/http/request_test.go | 610 -- .../core/http/requestwrite_test.go | 565 -- .../core/http/response_test.go | 645 -- .../core/http/responsewrite_test.go | 226 - .../azure-sdk-for-go/core/http/serve_test.go | 2848 --------- .../azure-sdk-for-go/core/http/sniff_test.go | 171 - .../azure-sdk-for-go/core/http/testdata/file | 1 - .../core/http/testdata/index.html | 1 - .../core/http/testdata/style.css | 1 - .../core/http/transfer_test.go | 64 - .../core/http/transport_test.go | 2173 ------- .../azure-sdk-for-go/core/http/z_last_test.go | 97 - .../azure-sdk-for-go/core/tls/conn_test.go | 106 - .../core/tls/handshake_client_test.go | 3050 --------- .../core/tls/handshake_messages_test.go | 246 - .../core/tls/handshake_server_test.go | 3796 ----------- .../azure-sdk-for-go/core/tls/prf_test.go | 126 - .../azure-sdk-for-go/core/tls/tls_test.go | 107 - .../management/errors_test.go | 30 - .../storageservice/entities_test.go | 31 - .../virtualmachine/entities_test.go | 299 - .../virtualmachine/resourceextensions_test.go | 27 - .../virtualmachineimage/entities_test.go | 110 - .../management/vmutils/examples_test.go | 53 - .../management/vmutils/extensions_test.go | 42 - .../management/vmutils/integration_test.go | 455 -- .../management/vmutils/vmutils_test.go | 440 -- .../azure-sdk-for-go/storage/blob_test.go | 715 --- .../azure-sdk-for-go/storage/client_test.go | 156 - .../azure-sdk-for-go/storage/file_test.go | 63 - .../azure-sdk-for-go/storage/queue_test.go | 132 - .../azure-sdk-for-go/storage/util_test.go | 69 - .../DreamItGetIT/statuscake/client_test.go | 236 - .../DreamItGetIT/statuscake/tests_test.go | 327 - .../github.com/apparentlymart/go-cidr/LICENSE | 19 + .../apparentlymart/go-cidr/cidr/cidr_test.go | 238 - .../apparentlymart/go-rundeck-api/LICENSE | 21 + .../go-rundeck-api/rundeck/job_test.go | 113 - .../github.com/armon/circbuf/circbuf_test.go | 198 - .../github.com/armon/go-radix/radix_test.go | 319 - vendor/github.com/aws/aws-sdk-go/LICENSE.txt | 202 + vendor/github.com/aws/aws-sdk-go/NOTICE.txt | 3 + .../aws/aws-sdk-go/aws/awsutil/copy_test.go | 233 - .../aws/aws-sdk-go/aws/awsutil/equal_test.go | 29 - .../aws-sdk-go/aws/awsutil/path_value_test.go | 142 - .../aws/aws-sdk-go/aws/config_test.go | 86 - .../aws/aws-sdk-go/aws/convert_types_test.go | 437 -- .../aws/corehandlers/handlers_test.go | 113 - .../aws/corehandlers/param_validator_test.go | 129 - .../aws/credentials/chain_provider_test.go | 154 - .../aws/credentials/credentials_test.go | 73 - .../ec2rolecreds/ec2_role_provider_test.go | 159 - .../aws/credentials/env_provider_test.go | 70 - .../shared_credentials_provider_test.go | 116 - .../aws/credentials/static_provider_test.go | 34 - .../stscreds/assume_role_provider_test.go | 56 - .../aws-sdk-go/aws/ec2metadata/api_test.go | 101 - .../aws/ec2metadata/service_test.go | 79 - .../aws-sdk-go/aws/request/handlers_test.go | 47 - .../aws/request/request_pagination_test.go | 455 -- .../aws-sdk-go/aws/request/request_test.go | 261 - .../aws-sdk-go/aws/session/session_test.go | 20 - .../aws/aws-sdk-go/aws/types_test.go | 56 - .../private/endpoints/endpoints_test.go | 41 - .../protocol/ec2query/build_bench_test.go | 85 - .../private/protocol/ec2query/build_test.go | 983 --- .../protocol/ec2query/unmarshal_test.go | 1056 --- .../protocol/json/jsonutil/build_test.go | 100 - .../protocol/jsonrpc/build_bench_test.go | 71 - .../private/protocol/jsonrpc/build_test.go | 1152 ---- .../protocol/jsonrpc/unmarshal_test.go | 812 --- .../private/protocol/query/build_test.go | 1999 ------ .../private/protocol/query/unmarshal_test.go | 1746 ----- .../protocol/restjson/build_bench_test.go | 356 -- .../private/protocol/restjson/build_test.go | 2371 ------- .../protocol/restjson/unmarshal_test.go | 1321 ---- .../protocol/restxml/build_bench_test.go | 246 - .../private/protocol/restxml/build_test.go | 3338 ---------- .../protocol/restxml/unmarshal_test.go | 1498 ----- .../private/signer/v4/functional_test.go | 77 - .../private/signer/v4/header_rules_test.go | 57 - .../aws-sdk-go/private/signer/v4/v4_test.go | 255 - .../aws-sdk-go/private/waiter/waiter_test.go | 401 -- .../service/autoscaling/examples_test.go | 1207 ---- .../service/cloudformation/examples_test.go | 465 -- .../service/cloudtrail/examples_test.go | 296 - .../service/cloudwatch/examples_test.go | 337 - .../service/cloudwatchlogs/examples_test.go | 566 -- .../service/codecommit/examples_test.go | 238 - .../service/codedeploy/examples_test.go | 787 --- .../service/directoryservice/examples_test.go | 532 -- .../service/dynamodb/customizations_test.go | 106 - .../dynamodbattribute/converter_test.go | 488 -- .../dynamodbattribute/examples_test.go | 79 - .../service/dynamodb/examples_test.go | 1336 ---- .../service/ec2/customizations_test.go | 35 - .../aws-sdk-go/service/ec2/examples_test.go | 5695 ----------------- .../aws-sdk-go/service/ecr/examples_test.go | 376 -- .../aws-sdk-go/service/ecs/examples_test.go | 791 --- .../aws-sdk-go/service/efs/examples_test.go | 254 - .../service/elasticache/examples_test.go | 943 --- .../elasticsearchservice/examples_test.go | 262 - .../aws-sdk-go/service/elb/examples_test.go | 722 --- .../service/firehose/examples_test.go | 249 - .../service/glacier/customizations_test.go | 77 - .../service/glacier/examples_test.go | 706 -- .../service/glacier/treehash_test.go | 28 - .../aws-sdk-go/service/iam/examples_test.go | 2366 ------- .../service/kinesis/examples_test.go | 337 - .../service/lambda/examples_test.go | 539 -- .../service/opsworks/examples_test.go | 1890 ------ .../aws-sdk-go/service/rds/examples_test.go | 2340 ------- .../service/redshift/examples_test.go | 1497 ----- .../service/route53/customizations_test.go | 22 - .../service/route53/examples_test.go | 1080 ---- .../service/s3/bucket_location_test.go | 78 - .../service/s3/customizations_test.go | 105 - .../aws-sdk-go/service/s3/examples_test.go | 1599 ----- .../service/s3/host_style_bucket_test.go | 75 - .../service/s3/s3manager/download_test.go | 309 - .../service/s3/s3manager/shared_test.go | 4 - .../service/s3/s3manager/upload_test.go | 482 -- .../aws/aws-sdk-go/service/s3/sse_test.go | 79 - .../service/s3/statusok_error_test.go | 130 - .../service/s3/unmarshal_error_test.go | 165 - .../aws-sdk-go/service/sns/examples_test.go | 542 -- .../aws/aws-sdk-go/service/sqs/api_test.go | 30 - .../aws-sdk-go/service/sqs/checksums_test.go | 207 - .../aws-sdk-go/service/sqs/examples_test.go | 433 -- .../src/github.com/akrennmair/gopcap/LICENSE | 27 + .../bgentry/speakeasy/LICENSE_WINDOWS | 201 + .../src/github.com/boltdb/bolt/LICENSE | 20 + .../src/github.com/cheggaaa/pb/LICENSE | 12 + .../src/github.com/codegangsta/cli/LICENSE | 21 + .../src/github.com/coreos/gexpect/LICENCE | 7 + .../github.com/cpuguy83/go-md2man/LICENSE.md | 21 + .../src/github.com/gogo/protobuf/LICENSE | 36 + .../src/github.com/golang/glog/LICENSE | 191 + .../src/github.com/golang/protobuf/LICENSE | 31 + .../src/github.com/google/btree/LICENSE | 202 + .../inconshreveable/mousetrap/LICENSE} | 11 +- .../github.com/jonboulle/clockwork/LICENSE | 201 + .../github.com/kballard/go-shellquote/LICENSE | 19 + .../_workspace/src/github.com/kr/pty/License | 23 + .../src/github.com/olekukonko/ts/LICENCE | 19 + .../src/github.com/prometheus/procfs/LICENSE | 201 + .../src/github.com/prometheus/procfs/NOTICE | 7 + .../russross/blackfriday/LICENSE.txt | 29 + .../shurcooL/sanitized_anchor_name/LICENSE | 19 + .../src/github.com/spf13/cobra/LICENSE.txt | 174 + .../spf13/cobra/cobra/cmd/licenses.go | 1133 ++++ .../src/github.com/spf13/pflag/LICENSE | 28 + .../src/github.com/ugorji/go/LICENSE | 22 + .../github.com/ugorji/go/codec/cbor_test.go | 205 - .../github.com/ugorji/go/codec/codec_test.go | 1185 ---- .../ugorji/go/codec/codecgen_test.go | 24 - .../github.com/ugorji/go/codec/helper_test.go | 242 - .../src/github.com/ugorji/go/codec/py_test.go | 30 - .../github.com/ugorji/go/codec/values_test.go | 203 - .../src/github.com/xiang90/probing/LICENSE | 22 + .../_workspace/src/golang.org/x/net/LICENSE | 27 + .../_workspace/src/golang.org/x/net/PATENTS | 22 + .../golang.org/x/net/context/context_test.go | 575 -- .../x/net/context/ctxhttp/ctxhttp_test.go | 176 - .../x/net/context/withtimeout_test.go | 26 - .../src/google.golang.org/grpc/LICENSE | 28 + .../src/google.golang.org/grpc/PATENTS | 22 + vendor/github.com/coreos/etcd/LICENSE | 202 + vendor/github.com/coreos/etcd/NOTICE | 5 + .../coreos/etcd/client/client_test.go | 896 --- .../etcd/client/fake_transport_go14_test.go | 41 - .../coreos/etcd/client/fake_transport_test.go | 42 - .../coreos/etcd/client/keys_bench_test.go | 87 - .../coreos/etcd/client/keys_test.go | 1407 ---- .../coreos/etcd/client/members_test.go | 599 -- .../github.com/coreos/etcd/client/srv_test.go | 102 - .../coreos/etcd/pkg/pathutil/path_test.go | 38 - .../coreos/etcd/pkg/types/id_test.go | 95 - .../coreos/etcd/pkg/types/set_test.go | 186 - .../coreos/etcd/pkg/types/slice_test.go | 30 - .../coreos/etcd/pkg/types/urls_test.go | 169 - .../etcd/pkg/types/urlsmap_go15_test.go | 40 - .../coreos/etcd/pkg/types/urlsmap_test.go | 99 - .../github.com/cyberdelia/heroku-go/LICENSE | 19 + .../digitalocean/godo/account_test.go | 59 - .../digitalocean/godo/action_test.go | 136 - .../digitalocean/godo/domains_test.go | 340 - .../digitalocean/godo/droplet_actions_test.go | 666 -- .../digitalocean/godo/droplets_test.go | 428 -- .../digitalocean/godo/errors_test.go | 11 - .../godo/floating_ips_actions_test.go | 167 - .../digitalocean/godo/floating_ips_test.go | 149 - .../github.com/digitalocean/godo/godo_test.go | 455 -- .../digitalocean/godo/image_actions_test.go | 62 - .../digitalocean/godo/images_test.go | 262 - .../github.com/digitalocean/godo/keys_test.go | 265 - .../digitalocean/godo/links_test.go | 176 - .../digitalocean/godo/regions_test.go | 91 - .../digitalocean/godo/sizes_test.go | 96 - .../digitalocean/godo/timestamp_test.go | 176 - .../digitalocean/godo/util/droplet_test.go | 26 - .../dylanmei/iso8601/duration_test.go | 81 - .../dylanmei/winrmtest/wsman_test.go | 220 - .../fsouza/go-dockerclient/auth_test.go | 91 - .../fsouza/go-dockerclient/build_test.go | 154 - .../fsouza/go-dockerclient/change_test.go | 24 - .../fsouza/go-dockerclient/client_test.go | 502 -- .../fsouza/go-dockerclient/container_test.go | 2263 ------- .../fsouza/go-dockerclient/env_test.go | 351 - .../fsouza/go-dockerclient/event_test.go | 132 - .../fsouza/go-dockerclient/example_test.go | 168 - .../fsouza/go-dockerclient/exec_test.go | 262 - .../github.com/Sirupsen/logrus/entry_test.go | 77 - .../Sirupsen/logrus/formatter_bench_test.go | 98 - .../github.com/Sirupsen/logrus/hook_test.go | 122 - .../Sirupsen/logrus/json_formatter_test.go | 120 - .../github.com/Sirupsen/logrus/logrus_test.go | 301 - .../Sirupsen/logrus/text_formatter_test.go | 61 - .../docker/docker/opts/envfile_test.go | 142 - .../docker/docker/opts/hosts_test.go | 164 - .../github.com/docker/docker/opts/ip_test.go | 54 - .../docker/docker/opts/opts_test.go | 301 - .../docker/docker/pkg/archive/archive_test.go | 1248 ---- .../docker/pkg/archive/archive_unix_test.go | 60 - .../pkg/archive/archive_windows_test.go | 87 - .../docker/pkg/archive/changes_posix_test.go | 127 - .../docker/docker/pkg/archive/changes_test.go | 527 -- .../docker/docker/pkg/archive/copy_test.go | 974 --- .../docker/docker/pkg/archive/diff_test.go | 370 -- .../docker/docker/pkg/archive/utils_test.go | 166 - .../docker/docker/pkg/archive/wrap_test.go | 98 - .../docker/pkg/fileutils/fileutils_test.go | 573 -- .../docker/docker/pkg/homedir/homedir_test.go | 24 - .../docker/pkg/idtools/idtools_unix_test.go | 243 - .../docker/pkg/ioutils/bytespipe_test.go | 158 - .../docker/docker/pkg/ioutils/fmt_test.go | 17 - .../docker/pkg/ioutils/multireader_test.go | 149 - .../docker/docker/pkg/ioutils/readers_test.go | 94 - .../docker/docker/pkg/ioutils/writers_test.go | 65 - .../docker/pkg/longpath/longpath_test.go | 22 - .../docker/docker/pkg/pools/pools_test.go | 162 - .../docker/docker/pkg/stdcopy/stdcopy_test.go | 261 - .../docker/docker/pkg/system/chtimes_test.go | 94 - .../docker/pkg/system/chtimes_unix_test.go | 91 - .../docker/pkg/system/chtimes_windows_test.go | 86 - .../docker/pkg/system/lstat_unix_test.go | 30 - .../docker/pkg/system/meminfo_unix_test.go | 40 - .../docker/pkg/system/stat_unix_test.go | 39 - .../docker/pkg/system/utimes_unix_test.go | 68 - .../docker/go-units/duration_test.go | 81 - .../github.com/docker/go-units/size_test.go | 160 - .../github.com/docker/go-units/ulimit_test.go | 74 - .../gorilla/context/context_test.go | 161 - .../github.com/gorilla/mux/bench_test.go | 21 - .../github.com/gorilla/mux/mux_test.go | 1358 ---- .../github.com/gorilla/mux/old_test.go | 714 --- .../runc/libcontainer/user/user_test.go | 472 -- .../golang.org/x/net/context/context_test.go | 575 -- .../x/net/context/withtimeout_test.go | 26 - .../golang.org/x/sys/unix/creds_test.go | 121 - .../golang.org/x/sys/unix/export_test.go | 9 - .../golang.org/x/sys/unix/mmap_unix_test.go | 23 - .../golang.org/x/sys/unix/syscall_bsd_test.go | 42 - .../x/sys/unix/syscall_freebsd_test.go | 20 - .../golang.org/x/sys/unix/syscall_test.go | 50 - .../x/sys/unix/syscall_unix_test.go | 318 - .../fsouza/go-dockerclient/image_test.go | 1018 --- .../go-dockerclient/integration_test.go | 94 - .../fsouza/go-dockerclient/misc_test.go | 159 - .../fsouza/go-dockerclient/network_test.go | 173 - .../go-dockerclient/testing/server_test.go | 2103 ------ .../fsouza/go-dockerclient/volume_test.go | 142 - vendor/github.com/go-chef/chef/acl_test.go | 102 - vendor/github.com/go-chef/chef/client_test.go | 102 - .../github.com/go-chef/chef/cookbook_test.go | 139 - .../github.com/go-chef/chef/databag_test.go | 164 - .../go-chef/chef/environment_test.go | 158 - vendor/github.com/go-chef/chef/http_test.go | 571 -- vendor/github.com/go-chef/chef/node_test.go | 122 - vendor/github.com/go-chef/chef/reader_test.go | 46 - vendor/github.com/go-chef/chef/role_test.go | 192 - .../github.com/go-chef/chef/run_list_test.go | 28 - .../github.com/go-chef/chef/sandbox_test.go | 96 - vendor/github.com/go-chef/chef/search_test.go | 89 - vendor/github.com/go-ini/ini/ini_test.go | 574 -- vendor/github.com/go-ini/ini/struct_test.go | 239 - .../github.com/go-ini/ini/testdata/conf.ini | 2 - .../github.com/google/go-querystring/LICENSE | 27 + .../go-querystring/query/encode_test.go | 301 - vendor/github.com/hashicorp/atlas-go/LICENSE | 353 + .../atlas-go/archive/archive_test.go | 554 -- .../hashicorp/atlas-go/archive/vcs_test.go | 260 - .../hashicorp/atlas-go/v1/application_test.go | 118 - .../hashicorp/atlas-go/v1/artifact_test.go | 167 - .../hashicorp/atlas-go/v1/atlas_test.go | 453 -- .../atlas-go/v1/authentication_test.go | 30 - .../atlas-go/v1/build_config_test.go | 95 - .../hashicorp/atlas-go/v1/client_test.go | 268 - .../hashicorp/atlas-go/v1/terraform_test.go | 57 - .../hashicorp/atlas-go/v1/util_test.go | 57 - vendor/github.com/hashicorp/consul/LICENSE | 354 + .../hashicorp/consul/api/acl_test.go | 128 - .../hashicorp/consul/api/agent_test.go | 568 -- .../hashicorp/consul/api/api_test.go | 288 - .../hashicorp/consul/api/catalog_test.go | 279 - .../hashicorp/consul/api/coordinate_test.go | 54 - .../hashicorp/consul/api/event_test.go | 49 - .../hashicorp/consul/api/health_test.go | 125 - .../hashicorp/consul/api/kv_test.go | 447 -- .../hashicorp/consul/api/lock_test.go | 560 -- .../consul/api/prepared_query_test.go | 123 - .../hashicorp/consul/api/semaphore_test.go | 518 -- .../hashicorp/consul/api/session_test.go | 314 - .../hashicorp/consul/api/status_test.go | 37 - .../hashicorp/consul/website/LICENSE.md | 10 + .../hashicorp/errwrap/errwrap_test.go | 94 - .../go-checkpoint/checkpoint_test.go | 201 - .../hashicorp/go-getter/Vagrantfile | 18 - .../go-getter/decompress_bzip2_test.go | 32 - .../go-getter/decompress_gzip_test.go | 32 - .../go-getter/decompress_tbz2_test.go | 56 - .../go-getter/decompress_tgz_test.go | 56 - .../go-getter/decompress_zip_test.go | 56 - .../go-getter/detect_bitbucket_test.go | 67 - .../hashicorp/go-getter/detect_file_test.go | 88 - .../hashicorp/go-getter/detect_github_test.go | 55 - .../hashicorp/go-getter/detect_s3_test.go | 84 - .../hashicorp/go-getter/detect_test.go | 51 - .../go-getter/folder_storage_test.go | 48 - .../hashicorp/go-getter/get_file_test.go | 150 - .../hashicorp/go-getter/get_git_test.go | 231 - .../hashicorp/go-getter/get_hg_test.go | 98 - .../hashicorp/go-getter/get_http_test.go | 184 - .../hashicorp/go-getter/get_s3_test.go | 108 - .../hashicorp/go-getter/get_test.go | 245 - .../go-getter/helper/url/url_test.go | 88 - .../hashicorp/go-getter/module_test.go | 83 - .../hashicorp/go-getter/source_test.go | 39 - .../hashicorp/go-multierror/append_test.go | 64 - .../hashicorp/go-multierror/flatten_test.go | 48 - .../hashicorp/go-multierror/format_test.go | 23 - .../go-multierror/multierror_test.go | 70 - .../hashicorp/go-multierror/prefix_test.go | 33 - .../hashicorp/go-retryablehttp/client_test.go | 342 - .../hashicorp/go-version/constraint_test.go | 103 - .../go-version/version_collection_test.go | 46 - .../hashicorp/go-version/version_test.go | 208 - .../github.com/hashicorp/hcl/decoder_test.go | 664 -- .../hashicorp/hcl/hcl/ast/ast_test.go | 200 - .../hashicorp/hcl/hcl/parser/error_test.go | 9 - .../hashicorp/hcl/hcl/parser/parser_test.go | 323 - .../hashicorp/hcl/hcl/printer/printer_test.go | 143 - .../hcl/hcl/printer/testdata/comment.golden | 36 - .../hcl/hcl/printer/testdata/comment.input | 37 - .../printer/testdata/comment_aligned.golden | 25 - .../printer/testdata/comment_aligned.input | 21 - .../testdata/comment_standalone.golden | 16 - .../printer/testdata/comment_standalone.input | 16 - .../hcl/printer/testdata/complexhcl.golden | 54 - .../hcl/hcl/printer/testdata/complexhcl.input | 53 - .../hcl/hcl/printer/testdata/list.golden | 27 - .../hcl/hcl/printer/testdata/list.input | 21 - .../hashicorp/hcl/hcl/scanner/scanner_test.go | 535 -- .../hashicorp/hcl/hcl/strconv/quote_test.go | 93 - .../hashicorp/hcl/hcl/token/token_test.go | 63 - vendor/github.com/hashicorp/hcl/hcl_test.go | 19 - .../hashicorp/hcl/json/parser/parser_test.go | 338 - .../hcl/json/scanner/scanner_test.go | 363 -- .../hashicorp/hcl/json/token/token_test.go | 34 - vendor/github.com/hashicorp/hcl/lex_test.go | 37 - .../logutils/level_benchmark_test.go | 37 - .../hashicorp/logutils/level_test.go | 94 - vendor/github.com/hashicorp/serf/LICENSE | 354 + .../hashicorp/serf/coordinate/client_test.go | 109 - .../serf/coordinate/coordinate_test.go | 260 - .../serf/coordinate/performance_test.go | 182 - .../hashicorp/serf/ops-misc/debian/copyright | 2 + .../hashicorp/serf/website/LICENSE.md | 10 + .../github.com/hashicorp/yamux/bench_test.go | 81 - .../github.com/hashicorp/yamux/const_test.go | 72 - .../hashicorp/yamux/session_test.go | 1153 ---- .../github.com/hashicorp/yamux/util_test.go | 50 - .../github.com/hmrc/vmware-govcd/api_test.go | 3 - .../hmrc/vmware-govcd/api_vca_test.go | 749 --- .../hmrc/vmware-govcd/api_vcd_test.go | 208 - .../hmrc/vmware-govcd/catalog_test.go | 68 - .../hmrc/vmware-govcd/catalogitem_test.go | 55 - .../hmrc/vmware-govcd/edgegateway_test.go | 409 -- .../github.com/hmrc/vmware-govcd/org_test.go | 55 - .../hmrc/vmware-govcd/orgvdcnetwork_test.go | 64 - .../github.com/hmrc/vmware-govcd/task_test.go | 35 - .../github.com/hmrc/vmware-govcd/vapp_test.go | 692 -- .../hmrc/vmware-govcd/vapptemplate_test.go | 183 - .../github.com/hmrc/vmware-govcd/vdc_test.go | 178 - .../github.com/imdario/mergo/issue17_test.go | 25 - vendor/github.com/imdario/mergo/mergo_test.go | 502 -- .../imdario/mergo/testdata/license.yml | 3 - .../imdario/mergo/testdata/thing.yml | 5 - .../jmespath/go-jmespath/api_test.go | 32 - .../jmespath/go-jmespath/compliance_test.go | 123 - .../jmespath/go-jmespath/interpreter_test.go | 213 - .../jmespath/go-jmespath/lexer_test.go | 161 - .../jmespath/go-jmespath/parser_test.go | 136 - .../jmespath/go-jmespath/util_test.go | 73 - .../github.com/kardianos/osext/osext_test.go | 203 - vendor/github.com/lib/pq/bench_test.go | 435 -- vendor/github.com/lib/pq/conn_test.go | 1433 ----- vendor/github.com/lib/pq/copy_test.go | 465 -- vendor/github.com/lib/pq/encode_test.go | 719 --- .../github.com/lib/pq/hstore/hstore_test.go | 148 - vendor/github.com/lib/pq/notify_test.go | 574 -- vendor/github.com/lib/pq/ssl_test.go | 226 - vendor/github.com/lib/pq/url_test.go | 54 - .../go-artifactory/LICENSE} | 11 +- .../src/artifactory.v401/api_test.go | 1 - .../src/artifactory.v401/archive_test.go | 1 - .../src/artifactory.v401/artifact_test.go | 1 - .../src/artifactory.v401/bintray_test.go | 1 - .../src/artifactory.v401/build_test.go | 1 - .../src/artifactory.v401/client_test.go | 38 - .../src/artifactory.v401/compliance_test.go | 1 - .../src/artifactory.v401/groups_test.go | 158 - .../src/artifactory.v401/http_test.go | 1 - .../src/artifactory.v401/mimetypes_test.go | 1 - .../permissions_targets_test.go | 99 - .../src/artifactory.v401/repos_test.go | 1 - .../src/artifactory.v401/responses_test.go | 1 - .../src/artifactory.v401/search_test.go | 1 - .../src/artifactory.v401/security_test.go | 1 - .../src/artifactory.v401/storage_test.go | 1 - .../src/artifactory.v401/system_test.go | 1 - .../src/artifactory.v401/users_test.go | 188 - .../src/artifactory.v401/version_test.go | 1 - vendor/github.com/masterzen/simplexml/LICENSE | 202 + .../masterzen/simplexml/dom/dom_test.go | 105 - vendor/github.com/masterzen/winrm/LICENSE | 202 + .../masterzen/winrm/soap/header_test.go | 48 - .../masterzen/winrm/soap/namespaces_test.go | 37 - .../masterzen/winrm/winrm/client_test.go | 51 - .../masterzen/winrm/winrm/command_test.go | 164 - .../masterzen/winrm/winrm/endpoint_test.go | 15 - .../masterzen/winrm/winrm/fixture_test.go | 87 - .../masterzen/winrm/winrm/http_test.go | 63 - .../masterzen/winrm/winrm/parameters_test.go | 19 - .../masterzen/winrm/winrm/powershell_test.go | 10 - .../masterzen/winrm/winrm/request_test.go | 143 - .../masterzen/winrm/winrm/response_test.go | 70 - .../masterzen/winrm/winrm/shell_test.go | 40 - .../github.com/masterzen/xmlpath/all_test.go | 536 -- vendor/github.com/mitchellh/cli/cli_test.go | 443 -- .../mitchellh/cli/command_mock_test.go | 9 - .../mitchellh/cli/ui_colored_test.go | 74 - .../mitchellh/cli/ui_concurrent_test.go | 9 - .../github.com/mitchellh/cli/ui_mock_test.go | 9 - vendor/github.com/mitchellh/cli/ui_test.go | 162 - .../mitchellh/cli/ui_writer_test.go | 37 - .../mitchellh/colorstring/colorstring_test.go | 185 - .../copystructure/copier_time_test.go | 17 - .../copystructure_examples_test.go | 22 - .../copystructure/copystructure_test.go | 194 - .../mitchellh/go-homedir/homedir_test.go | 112 - .../go-linereader/linereader_test.go | 48 - .../mapstructure/decode_hooks_test.go | 229 - .../mapstructure_benchmark_test.go | 279 - .../mapstructure/mapstructure_bugs_test.go | 47 - .../mapstructure_examples_test.go | 203 - .../mapstructure/mapstructure_test.go | 999 --- vendor/github.com/mitchellh/packer/LICENSE | 373 ++ .../mitchellh/packer/common/uuid/uuid_test.go | 12 - .../packer/post-processor/compress/LICENSE | 21 + .../mitchellh/panicwrap/panicwrap_test.go | 325 - .../mitchellh/prefixedio/reader_test.go | 96 - .../mitchellh/reflectwalk/reflectwalk_test.go | 377 -- vendor/github.com/nesv/go-dynect/LICENSE.md | 21 + .../nesv/go-dynect/dynect/client_test.go | 114 - .../nu7hatch/gouuid/example_test.go | 33 - .../github.com/nu7hatch/gouuid/uuid_test.go | 135 - .../packer-community/winrmcp/LICENSE | 22 + .../winrmcp/winrmcp/endpoint_test.go | 81 - vendor/github.com/pborman/uuid/json_test.go | 32 - vendor/github.com/pborman/uuid/seq_test.go | 66 - vendor/github.com/pborman/uuid/sql_test.go | 58 - vendor/github.com/pborman/uuid/uuid_test.go | 390 -- .../github.com/pearkes/cloudflare/api_test.go | 101 - .../pearkes/cloudflare/record_test.go | 409 -- .../github.com/pearkes/dnsimple/api_test.go | 83 - .../pearkes/dnsimple/domain_test.go | 102 - .../pearkes/dnsimple/record_test.go | 116 - vendor/github.com/pearkes/mailgun/api_test.go | 92 - .../github.com/pearkes/mailgun/domain_test.go | 109 - .../blockstorage/v1/snapshots_test.go | 70 - .../openstack/blockstorage/v1/volumes_test.go | 63 - .../blockstorage/v1/volumetypes_test.go | 49 - .../acceptance/openstack/client_test.go | 40 - .../compute/v2/bootfromvolume_test.go | 55 - .../openstack/compute/v2/compute_test.go | 104 - .../openstack/compute/v2/extension_test.go | 47 - .../openstack/compute/v2/flavors_test.go | 57 - .../openstack/compute/v2/floatingip_test.go | 168 - .../openstack/compute/v2/images_test.go | 37 - .../openstack/compute/v2/keypairs_test.go | 74 - .../openstack/compute/v2/network_test.go | 78 - .../openstack/compute/v2/secdefrules_test.go | 72 - .../openstack/compute/v2/secgroup_test.go | 177 - .../openstack/compute/v2/servergroup_test.go | 143 - .../openstack/compute/v2/servers_test.go | 484 -- .../compute/v2/tenantnetworks_test.go | 109 - .../openstack/compute/v2/volumeattach_test.go | 125 - .../openstack/db/v1/database_test.go | 45 - .../acceptance/openstack/db/v1/flavor_test.go | 31 - .../openstack/db/v1/instance_test.go | 138 - .../acceptance/openstack/db/v1/user_test.go | 70 - .../openstack/identity/v2/extension_test.go | 46 - .../openstack/identity/v2/identity_test.go | 47 - .../openstack/identity/v2/role_test.go | 58 - .../openstack/identity/v2/tenant_test.go | 32 - .../openstack/identity/v2/token_test.go | 54 - .../openstack/identity/v2/user_test.go | 127 - .../openstack/identity/v3/endpoint_test.go | 111 - .../openstack/identity/v3/identity_test.go | 39 - .../openstack/identity/v3/service_test.go | 36 - .../openstack/identity/v3/token_test.go | 42 - .../networking/v2/apiversion_test.go | 51 - .../openstack/networking/v2/extension_test.go | 45 - .../v2/extensions/fwaas/firewall_test.go | 116 - .../v2/extensions/fwaas/policy_test.go | 107 - .../v2/extensions/fwaas/rule_test.go | 84 - .../networking/v2/extensions/layer3_test.go | 300 - .../v2/extensions/lbaas/member_test.go | 95 - .../v2/extensions/lbaas/monitor_test.go | 77 - .../v2/extensions/lbaas/pool_test.go | 98 - .../v2/extensions/lbaas/vip_test.go | 101 - .../networking/v2/extensions/provider_test.go | 68 - .../networking/v2/extensions/security_test.go | 171 - .../openstack/networking/v2/network_test.go | 68 - .../openstack/networking/v2/port_test.go | 117 - .../openstack/networking/v2/subnet_test.go | 86 - .../objectstorage/v1/accounts_test.go | 50 - .../objectstorage/v1/containers_test.go | 137 - .../objectstorage/v1/objects_test.go | 119 - .../orchestration/v1/buildinfo_test.go | 20 - .../orchestration/v1/stackevents_test.go | 68 - .../orchestration/v1/stackresources_test.go | 62 - .../openstack/orchestration/v1/stacks_test.go | 153 - .../orchestration/v1/stacktemplates_test.go | 75 - .../blockstorage/v1/snapshot_test.go | 82 - .../rackspace/blockstorage/v1/volume_test.go | 71 - .../blockstorage/v1/volume_type_test.go | 46 - .../acceptance/rackspace/cdn/v1/base_test.go | 32 - .../rackspace/cdn/v1/flavor_test.go | 47 - .../rackspace/cdn/v1/service_test.go | 93 - .../rackspace/cdn/v1/serviceasset_test.go | 32 - .../acceptance/rackspace/client_test.go | 28 - .../compute/v2/bootfromvolume_test.go | 49 - .../rackspace/compute/v2/compute_test.go | 60 - .../rackspace/compute/v2/flavors_test.go | 61 - .../rackspace/compute/v2/images_test.go | 63 - .../rackspace/compute/v2/keypairs_test.go | 87 - .../rackspace/compute/v2/networks_test.go | 53 - .../rackspace/compute/v2/servers_test.go | 217 - .../compute/v2/virtualinterfaces_test.go | 53 - .../rackspace/compute/v2/volumeattach_test.go | 130 - .../acceptance/rackspace/db/v1/backup_test.go | 84 - .../rackspace/db/v1/config_group_test.go | 93 - .../rackspace/db/v1/database_test.go | 54 - .../acceptance/rackspace/db/v1/flavor_test.go | 32 - .../rackspace/db/v1/instance_test.go | 169 - .../rackspace/db/v1/replica_test.go | 33 - .../acceptance/rackspace/db/v1/user_test.go | 125 - .../rackspace/identity/v2/extension_test.go | 54 - .../rackspace/identity/v2/identity_test.go | 50 - .../rackspace/identity/v2/role_test.go | 59 - .../rackspace/identity/v2/tenant_test.go | 37 - .../rackspace/identity/v2/tokens_test.go | 61 - .../rackspace/identity/v2/user_test.go | 93 - .../acceptance/rackspace/lb/v1/acl_test.go | 94 - .../acceptance/rackspace/lb/v1/lb_test.go | 214 - .../rackspace/lb/v1/monitor_test.go | 60 - .../acceptance/rackspace/lb/v1/node_test.go | 175 - .../rackspace/lb/v1/session_test.go | 47 - .../rackspace/lb/v1/throttle_test.go | 53 - .../acceptance/rackspace/lb/v1/vip_test.go | 83 - .../rackspace/networking/v2/network_test.go | 65 - .../rackspace/networking/v2/port_test.go | 116 - .../rackspace/networking/v2/security_test.go | 165 - .../rackspace/networking/v2/subnet_test.go | 84 - .../objectstorage/v1/accounts_test.go | 38 - .../rackspace/objectstorage/v1/bulk_test.go | 23 - .../objectstorage/v1/cdncontainers_test.go | 66 - .../objectstorage/v1/cdnobjects_test.go | 50 - .../objectstorage/v1/containers_test.go | 90 - .../objectstorage/v1/objects_test.go | 124 - .../orchestration/v1/buildinfo_test.go | 20 - .../orchestration/v1/stackevents_test.go | 70 - .../orchestration/v1/stackresources_test.go | 64 - .../rackspace/orchestration/v1/stacks_test.go | 154 - .../orchestration/v1/stacktemplates_test.go | 77 - .../rackconnect/v3/cloudnetworks_test.go | 36 - .../rackspace/rackconnect/v3/lbpools_test.go | 71 - .../rackconnect/v3/publicips_test.go | 45 - .../gophercloud/endpoint_search_test.go | 19 - .../v1/apiversions/requests_test.go | 145 - .../blockstorage/v1/apiversions/urls_test.go | 26 - .../v1/snapshots/requests_test.go | 104 - .../blockstorage/v1/snapshots/urls_test.go | 50 - .../blockstorage/v1/volumes/requests_test.go | 123 - .../blockstorage/v1/volumes/urls_test.go | 44 - .../v1/volumetypes/requests_test.go | 118 - .../blockstorage/v1/volumetypes/urls_test.go | 38 - .../openstack/cdn/v1/base/requests_test.go | 43 - .../openstack/cdn/v1/flavors/requests_test.go | 89 - .../cdn/v1/serviceassets/requests_test.go | 18 - .../cdn/v1/services/requests_test.go | 358 -- .../gophercloud/openstack/client_test.go | 161 - .../common/extensions/requests_test.go | 38 - .../openstack/common/extensions/urls_test.go | 26 - .../bootfromvolume/requests_test.go | 53 - .../v2/extensions/bootfromvolume/urls_test.go | 16 - .../extensions/defsecrules/requests_test.go | 100 - .../compute/v2/extensions/delegate_test.go | 96 - .../v2/extensions/diskconfig/requests_test.go | 89 - .../v2/extensions/diskconfig/results_test.go | 68 - .../v2/extensions/floatingip/requests_test.go | 123 - .../v2/extensions/floatingip/urls_test.go | 60 - .../v2/extensions/keypairs/requests_test.go | 71 - .../v2/extensions/keypairs/urls_test.go | 40 - .../v2/extensions/networks/requests_test.go | 37 - .../v2/extensions/networks/urls_test.go | 25 - .../schedulerhints/requests_test.go | 130 - .../v2/extensions/secgroups/requests_test.go | 248 - .../extensions/servergroups/requests_test.go | 59 - .../v2/extensions/servergroups/urls_test.go | 42 - .../v2/extensions/startstop/requests_test.go | 30 - .../tenantnetworks/requests_test.go | 37 - .../v2/extensions/tenantnetworks/urls_test.go | 25 - .../extensions/volumeattach/requests_test.go | 94 - .../v2/extensions/volumeattach/urls_test.go | 46 - .../compute/v2/flavors/requests_test.go | 129 - .../openstack/compute/v2/flavors/urls_test.go | 26 - .../compute/v2/images/requests_test.go | 191 - .../openstack/compute/v2/images/urls_test.go | 26 - .../compute/v2/servers/requests_test.go | 373 -- .../openstack/compute/v2/servers/urls_test.go | 68 - .../db/v1/configurations/requests_test.go | 236 - .../db/v1/databases/requests_test.go | 66 - .../db/v1/datastores/requests_test.go | 78 - .../openstack/db/v1/flavors/requests_test.go | 91 - .../db/v1/instances/requests_test.go | 133 - .../openstack/db/v1/users/requests_test.go | 84 - .../openstack/endpoint_location_test.go | 228 - .../extensions/admin/roles/requests_test.go | 64 - .../identity/v2/extensions/delegate_test.go | 38 - .../identity/v2/tenants/requests_test.go | 29 - .../identity/v2/tokens/requests_test.go | 152 - .../identity/v2/users/requests_test.go | 165 - .../identity/v3/endpoints/requests_test.go | 226 - .../identity/v3/endpoints/urls_test.go | 23 - .../identity/v3/roles/requests_test.go | 104 - .../openstack/identity/v3/roles/urls_test.go | 15 - .../identity/v3/services/requests_test.go | 209 - .../identity/v3/services/urls_test.go | 23 - .../identity/v3/tokens/requests_test.go | 514 -- .../openstack/identity/v3/tokens/urls_test.go | 21 - .../v2/apiversions/requests_test.go | 182 - .../networking/v2/apiversions/urls_test.go | 26 - .../networking/v2/extensions/delegate_test.go | 105 - .../v2/extensions/external/results_test.go | 254 - .../fwaas/firewalls/requests_test.go | 246 - .../fwaas/policies/requests_test.go | 279 - .../extensions/fwaas/rules/requests_test.go | 328 - .../layer3/floatingips/requests_test.go | 355 - .../layer3/routers/requests_test.go | 405 -- .../extensions/lbaas/members/requests_test.go | 243 - .../lbaas/monitors/requests_test.go | 312 - .../extensions/lbaas/pools/requests_test.go | 318 - .../v2/extensions/lbaas/vips/requests_test.go | 336 - .../v2/extensions/provider/results_test.go | 253 - .../security/groups/requests_test.go | 213 - .../security/rules/requests_test.go | 243 - .../networking/v2/networks/requests_test.go | 276 - .../networking/v2/networks/urls_test.go | 38 - .../networking/v2/ports/requests_test.go | 321 - .../networking/v2/ports/urls_test.go | 44 - .../networking/v2/subnets/requests_test.go | 362 -- .../networking/v2/subnets/results_test.go | 54 - .../networking/v2/subnets/urls_test.go | 44 - .../v1/accounts/requests_test.go | 32 - .../objectstorage/v1/accounts/urls_test.go | 26 - .../v1/containers/requests_test.go | 117 - .../objectstorage/v1/containers/urls_test.go | 43 - .../objectstorage/v1/objects/requests_test.go | 165 - .../objectstorage/v1/objects/urls_test.go | 56 - .../v1/apiversions/requests_test.go | 89 - .../v1/buildinfo/requests_test.go | 20 - .../v1/stackevents/requests_test.go | 71 - .../v1/stackresources/requests_test.go | 111 - .../v1/stacks/environment_test.go | 184 - .../orchestration/v1/stacks/requests_test.go | 358 -- .../orchestration/v1/stacks/template_test.go | 148 - .../orchestration/v1/stacks/utils_test.go | 94 - .../v1/stacktemplates/requests_test.go | 57 - .../openstack/utils/choose_version_test.go | 118 - .../gophercloud/pagination/linked_test.go | 120 - .../gophercloud/pagination/marker_test.go | 126 - .../gophercloud/pagination/pagination_test.go | 13 - .../gophercloud/pagination/single_test.go | 84 - .../rackspace/gophercloud/params_test.go | 165 - .../gophercloud/provider_client_test.go | 35 - .../v1/snapshots/delegate_test.go | 97 - .../blockstorage/v1/volumes/delegate_test.go | 107 - .../v1/volumetypes/delegate_test.go | 64 - .../rackspace/cdn/v1/base/delegate_test.go | 44 - .../rackspace/cdn/v1/flavors/delegate_test.go | 90 - .../cdn/v1/serviceassets/delegate_test.go | 19 - .../cdn/v1/services/delegate_test.go | 359 -- .../gophercloud/rackspace/client_test.go | 38 - .../v2/bootfromvolume/delegate_test.go | 54 - .../compute/v2/flavors/delegate_test.go | 62 - .../compute/v2/images/delegate_test.go | 62 - .../compute/v2/keypairs/delegate_test.go | 72 - .../compute/v2/networks/requests_test.go | 156 - .../compute/v2/networks/urls_test.go | 38 - .../compute/v2/servers/delegate_test.go | 182 - .../compute/v2/servers/requests_test.go | 59 - .../v2/virtualinterfaces/requests_test.go | 165 - .../compute/v2/virtualinterfaces/urls_test.go | 32 - .../compute/v2/volumeattach/delegate_test.go | 95 - .../rackspace/db/v1/backups/requests_test.go | 131 - .../db/v1/configurations/delegate_test.go | 237 - .../db/v1/databases/delegate_test.go | 71 - .../db/v1/datastores/delegate_test.go | 79 - .../rackspace/db/v1/flavors/delegate_test.go | 95 - .../db/v1/instances/delegate_test.go | 107 - .../db/v1/instances/requests_test.go | 246 - .../rackspace/db/v1/users/delegate_test.go | 48 - .../rackspace/db/v1/users/requests_test.go | 156 - .../identity/v2/extensions/delegate_test.go | 39 - .../identity/v2/roles/delegate_test.go | 66 - .../identity/v2/tenants/delegate_test.go | 28 - .../identity/v2/tokens/delegate_test.go | 36 - .../identity/v2/users/delegate_test.go | 111 - .../rackspace/lb/v1/acl/requests_test.go | 91 - .../rackspace/lb/v1/lbs/requests_test.go | 438 -- .../rackspace/lb/v1/monitors/requests_test.go | 75 - .../rackspace/lb/v1/nodes/requests_test.go | 243 - .../rackspace/lb/v1/sessions/requests_test.go | 44 - .../rackspace/lb/v1/ssl/requests_test.go | 167 - .../rackspace/lb/v1/throttle/requests_test.go | 44 - .../rackspace/lb/v1/vips/requests_test.go | 87 - .../networking/v2/networks/delegate_test.go | 285 - .../networking/v2/ports/delegate_test.go | 322 - .../v2/security/groups/delegate_test.go | 206 - .../v2/security/rules/delegate_test.go | 236 - .../networking/v2/subnets/delegate_test.go | 363 -- .../v1/accounts/delegate_test.go | 32 - .../objectstorage/v1/bulk/requests_test.go | 36 - .../objectstorage/v1/bulk/urls_test.go | 26 - .../v1/cdncontainers/delegate_test.go | 50 - .../v1/cdncontainers/requests_test.go | 29 - .../v1/cdncontainers/urls_test.go | 20 - .../v1/cdnobjects/delegate_test.go | 19 - .../v1/containers/delegate_test.go | 91 - .../objectstorage/v1/objects/delegate_test.go | 127 - .../v1/buildinfo/delegate_test.go | 21 - .../v1/stackevents/delegate_test.go | 72 - .../v1/stackresources/delegate_test.go | 108 - .../orchestration/v1/stacks/delegate_test.go | 870 --- .../v1/stacktemplates/delegate_test.go | 47 - .../v3/cloudnetworks/requests_test.go | 87 - .../rackconnect/v3/lbpools/requests_test.go | 876 --- .../rackconnect/v3/publicips/requests_test.go | 378 -- .../gophercloud/service_client_test.go | 14 - .../rackspace/gophercloud/util_test.go | 85 - .../satori/go.uuid/benchmarks_test.go | 121 - vendor/github.com/satori/go.uuid/uuid_test.go | 508 -- .../github.com/soniah/dnsmadeeasy/api_test.go | 79 - .../soniah/dnsmadeeasy/record_test.go | 173 - .../sthulb/mime/multipart/example_test.go | 53 - .../sthulb/mime/multipart/formdata_test.go | 90 - .../sthulb/mime/multipart/multipart_test.go | 813 --- .../mime/multipart/testdata/nested-mime | 29 - .../sthulb/mime/multipart/writer_test.go | 152 - .../github.com/tent/http-link-go/link_test.go | 67 - .../github.com/vmware/govmomi/client_test.go | 138 - .../govmomi/govc/flags/optional_bool_test.go | 63 - .../vmware/govmomi/govc/flags/version_test.go | 63 - .../govmomi/govc/host/esxcli/command_test.go | 124 - .../govmomi/govc/host/esxcli/response_test.go | 105 - .../vmware/govmomi/govc/main_test.go | 38 - .../vmware/govmomi/list/path_test.go | 93 - .../object/cluster_compute_resource_test.go | 20 - .../govmomi/object/compute_resource_test.go | 20 - .../vmware/govmomi/object/datacenter_test.go | 20 - .../distributed_virtual_portgroup_test.go | 23 - .../vmware/govmomi/object/network_test.go | 23 - .../govmomi/object/search_index_test.go | 155 - .../object/virtual_device_list_test.go | 848 --- .../govmomi/object/virtual_machine_test.go | 20 - .../github.com/vmware/govmomi/ovf/env_test.go | 57 - .../github.com/vmware/govmomi/ovf/ovf_test.go | 85 - .../vmware/govmomi/session/keep_alive_test.go | 280 - .../vmware/govmomi/session/manager_test.go | 106 - .../govmomi/test/functional/issue_242_test.go | 104 - .../vmware/govmomi/units/size_test.go | 145 - .../vmware/govmomi/vim25/client_test.go | 97 - .../govmomi/vim25/methods/fault_test.go | 62 - .../vmware/govmomi/vim25/mo/retrieve_test.go | 144 - .../vmware/govmomi/vim25/mo/type_info_test.go | 37 - .../govmomi/vim25/progress/aggregator_test.go | 81 - .../govmomi/vim25/progress/common_test.go | 43 - .../govmomi/vim25/progress/prefix_test.go | 40 - .../govmomi/vim25/progress/reader_test.go | 90 - .../govmomi/vim25/progress/scale_test.go | 45 - .../vmware/govmomi/vim25/progress/tee_test.go | 46 - .../vmware/govmomi/vim25/retry_test.go | 86 - .../vmware/govmomi/vim25/soap/client_test.go | 43 - .../vmware/govmomi/vim25/soap/soap_test.go | 55 - .../vmware/govmomi/vim25/types/base_test.go | 65 - .../govmomi/vim25/types/registry_test.go | 43 - .../vmware/govmomi/vim25/types/types_test.go | 92 - .../vmware/govmomi/vim25/xml/atom_test.go | 56 - .../vmware/govmomi/vim25/xml/example_test.go | 151 - .../vmware/govmomi/vim25/xml/extras_test.go | 222 - .../vmware/govmomi/vim25/xml/marshal_test.go | 1266 ---- .../vmware/govmomi/vim25/xml/read_test.go | 762 --- .../vmware/govmomi/vim25/xml/xml_test.go | 726 --- vendor/github.com/xanzy/go-cloudstack/LICENSE | 201 + vendor/github.com/ziutek/mymysql/LICENSE | 24 + .../github.com/ziutek/mymysql/autorc/LICENSE | 24 + .../ziutek/mymysql/mysql/types_test.go | 100 - .../ziutek/mymysql/native/bind_test.go | 386 -- .../ziutek/mymysql/native/native_test.go | 1218 ---- .../ziutek/mymysql/thrsafe/thrsafe_test.go | 136 - vendor/golang.org/x/crypto/LICENSE | 27 + vendor/golang.org/x/crypto/PATENTS | 22 + .../x/crypto/curve25519/curve25519_test.go | 29 - .../x/crypto/ssh/agent/client_test.go | 287 - .../x/crypto/ssh/agent/keyring_test.go | 78 - .../x/crypto/ssh/agent/server_test.go | 77 - .../x/crypto/ssh/agent/testdata_test.go | 64 - .../golang.org/x/crypto/ssh/benchmark_test.go | 122 - vendor/golang.org/x/crypto/ssh/buffer_test.go | 87 - vendor/golang.org/x/crypto/ssh/certs_test.go | 216 - vendor/golang.org/x/crypto/ssh/cipher_test.go | 127 - .../x/crypto/ssh/client_auth_test.go | 393 -- vendor/golang.org/x/crypto/ssh/client_test.go | 39 - .../golang.org/x/crypto/ssh/example_test.go | 211 - .../golang.org/x/crypto/ssh/handshake_test.go | 415 -- vendor/golang.org/x/crypto/ssh/kex_test.go | 50 - vendor/golang.org/x/crypto/ssh/keys_test.go | 437 -- .../golang.org/x/crypto/ssh/mempipe_test.go | 110 - .../golang.org/x/crypto/ssh/messages_test.go | 254 - vendor/golang.org/x/crypto/ssh/mux_test.go | 525 -- .../golang.org/x/crypto/ssh/session_test.go | 774 --- vendor/golang.org/x/crypto/ssh/tcpip_test.go | 20 - .../x/crypto/ssh/terminal/terminal_test.go | 269 - .../x/crypto/ssh/test/agent_unix_test.go | 59 - .../golang.org/x/crypto/ssh/test/cert_test.go | 47 - .../x/crypto/ssh/test/forward_unix_test.go | 160 - .../x/crypto/ssh/test/session_test.go | 340 - .../x/crypto/ssh/test/tcpip_test.go | 46 - .../x/crypto/ssh/test/test_unix_test.go | 261 - .../x/crypto/ssh/test/testdata_test.go | 64 - .../golang.org/x/crypto/ssh/testdata/doc.go | 8 - .../golang.org/x/crypto/ssh/testdata/keys.go | 43 - .../golang.org/x/crypto/ssh/testdata_test.go | 63 - .../golang.org/x/crypto/ssh/transport_test.go | 109 - vendor/golang.org/x/net/LICENSE | 27 + vendor/golang.org/x/net/PATENTS | 22 + .../golang.org/x/net/context/context_test.go | 575 -- .../x/net/context/ctxhttp/ctxhttp_test.go | 176 - .../x/net/context/withtimeout_test.go | 26 - .../clientcredentials_test.go | 96 - vendor/golang.org/x/oauth2/example_test.go | 45 - .../x/oauth2/google/example_test.go | 150 - .../golang.org/x/oauth2/google/google_test.go | 67 - vendor/golang.org/x/oauth2/google/sdk_test.go | 46 - .../oauth2/google/testdata/gcloud/credentials | 122 - .../oauth2/google/testdata/gcloud/properties | 2 - .../x/oauth2/internal/oauth2_test.go | 62 - .../x/oauth2/internal/token_test.go | 36 - .../x/oauth2/internal/transport_test.go | 38 - .../golang.org/x/oauth2/jwt/example_test.go | 31 - vendor/golang.org/x/oauth2/jwt/jwt_test.go | 134 - vendor/golang.org/x/oauth2/oauth2_test.go | 471 -- vendor/golang.org/x/oauth2/token_test.go | 72 - vendor/golang.org/x/oauth2/transport_test.go | 108 - vendor/golang.org/x/sys/unix/.gitignore | 1 - vendor/golang.org/x/sys/unix/asm.s | 2 - vendor/golang.org/x/sys/unix/asm_darwin_386.s | 2 - .../golang.org/x/sys/unix/asm_darwin_amd64.s | 7 +- vendor/golang.org/x/sys/unix/asm_darwin_arm.s | 30 - .../golang.org/x/sys/unix/asm_darwin_arm64.s | 30 - .../golang.org/x/sys/unix/asm_dragonfly_386.s | 2 - .../x/sys/unix/asm_dragonfly_amd64.s | 2 - .../golang.org/x/sys/unix/asm_freebsd_386.s | 2 - .../golang.org/x/sys/unix/asm_freebsd_amd64.s | 2 - .../golang.org/x/sys/unix/asm_freebsd_arm.s | 2 - vendor/golang.org/x/sys/unix/asm_linux_386.s | 2 - .../golang.org/x/sys/unix/asm_linux_amd64.s | 2 - vendor/golang.org/x/sys/unix/asm_linux_arm.s | 2 - .../golang.org/x/sys/unix/asm_linux_arm64.s | 24 - .../golang.org/x/sys/unix/asm_linux_ppc64x.s | 28 - vendor/golang.org/x/sys/unix/asm_netbsd_386.s | 2 - .../golang.org/x/sys/unix/asm_netbsd_amd64.s | 2 - vendor/golang.org/x/sys/unix/asm_netbsd_arm.s | 2 - .../golang.org/x/sys/unix/asm_openbsd_386.s | 2 - .../golang.org/x/sys/unix/asm_openbsd_amd64.s | 2 - .../golang.org/x/sys/unix/asm_solaris_amd64.s | 19 +- vendor/golang.org/x/sys/unix/bpf_bsd.go | 170 + vendor/golang.org/x/sys/unix/constants.go | 13 - vendor/golang.org/x/sys/unix/creds_test.go | 121 - vendor/golang.org/x/sys/unix/export_test.go | 9 - vendor/golang.org/x/sys/unix/gccgo.go | 46 - vendor/golang.org/x/sys/unix/gccgo_c.c | 41 - .../x/sys/unix/gccgo_linux_amd64.go | 20 - vendor/golang.org/x/sys/unix/lsf_linux.go | 79 + vendor/golang.org/x/sys/unix/mkall.sh | 53 +- vendor/golang.org/x/sys/unix/mkerrors.sh | 54 +- vendor/golang.org/x/sys/unix/mksyscall.pl | 16 +- .../x/sys/unix/mksyscall_solaris.pl | 48 +- .../golang.org/x/sys/unix/mksysctl_openbsd.pl | 7 - .../golang.org/x/sys/unix/mksysnum_darwin.pl | 7 - .../x/sys/unix/mksysnum_dragonfly.pl | 7 - .../golang.org/x/sys/unix/mksysnum_freebsd.pl | 7 - .../golang.org/x/sys/unix/mksysnum_linux.pl | 24 +- .../golang.org/x/sys/unix/mksysnum_netbsd.pl | 7 - .../golang.org/x/sys/unix/mksysnum_openbsd.pl | 7 - .../golang.org/x/sys/unix/mmap_unix_test.go | 23 - vendor/golang.org/x/sys/unix/netlink_linux.go | 178 + vendor/golang.org/x/sys/unix/route_bsd.go | 224 + vendor/golang.org/x/sys/unix/route_darwin.go | 61 + .../golang.org/x/sys/unix/route_dragonfly.go | 72 + vendor/golang.org/x/sys/unix/route_freebsd.go | 78 + .../x/sys/unix/route_freebsd_32bit.go | 24 + .../x/sys/unix/route_freebsd_64bit.go | 14 + vendor/golang.org/x/sys/unix/route_netbsd.go | 35 + vendor/golang.org/x/sys/unix/route_openbsd.go | 35 + vendor/golang.org/x/sys/unix/so_solaris.go | 261 + vendor/golang.org/x/sys/unix/sockcmsg_unix.go | 6 +- vendor/golang.org/x/sys/unix/str.go | 6 +- vendor/golang.org/x/sys/unix/syscall.go | 2 +- vendor/golang.org/x/sys/unix/syscall_bsd.go | 92 +- .../golang.org/x/sys/unix/syscall_bsd_test.go | 42 - .../golang.org/x/sys/unix/syscall_darwin.go | 4 +- .../x/sys/unix/syscall_darwin_386.go | 6 - .../x/sys/unix/syscall_darwin_amd64.go | 8 - .../x/sys/unix/syscall_darwin_arm.go | 73 - .../x/sys/unix/syscall_darwin_arm64.go | 79 - .../x/sys/unix/syscall_dragonfly.go | 13 +- .../x/sys/unix/syscall_dragonfly_386.go | 2 - .../x/sys/unix/syscall_dragonfly_amd64.go | 2 - .../golang.org/x/sys/unix/syscall_freebsd.go | 254 +- .../x/sys/unix/syscall_freebsd_386.go | 2 - .../x/sys/unix/syscall_freebsd_amd64.go | 2 - .../x/sys/unix/syscall_freebsd_arm.go | 2 - .../x/sys/unix/syscall_freebsd_test.go | 20 - vendor/golang.org/x/sys/unix/syscall_linux.go | 143 +- .../x/sys/unix/syscall_linux_386.go | 32 +- .../x/sys/unix/syscall_linux_amd64.go | 36 +- .../x/sys/unix/syscall_linux_arm.go | 37 +- .../x/sys/unix/syscall_linux_arm64.go | 150 - .../x/sys/unix/syscall_linux_ppc64x.go | 96 - .../golang.org/x/sys/unix/syscall_netbsd.go | 14 +- .../x/sys/unix/syscall_netbsd_386.go | 2 - .../x/sys/unix/syscall_netbsd_amd64.go | 2 - .../x/sys/unix/syscall_netbsd_arm.go | 2 - .../golang.org/x/sys/unix/syscall_openbsd.go | 13 +- .../x/sys/unix/syscall_openbsd_386.go | 2 - .../x/sys/unix/syscall_openbsd_amd64.go | 2 - .../golang.org/x/sys/unix/syscall_solaris.go | 247 +- .../x/sys/unix/syscall_solaris_amd64.go | 4 +- vendor/golang.org/x/sys/unix/syscall_test.go | 50 - vendor/golang.org/x/sys/unix/syscall_unix.go | 24 - .../x/sys/unix/syscall_unix_test.go | 318 - vendor/golang.org/x/sys/unix/types_darwin.go | 7 - vendor/golang.org/x/sys/unix/types_freebsd.go | 11 - vendor/golang.org/x/sys/unix/types_linux.go | 134 +- vendor/golang.org/x/sys/unix/types_solaris.go | 38 - .../x/sys/unix/zerrors_darwin_386.go | 197 +- .../x/sys/unix/zerrors_darwin_amd64.go | 15 +- .../x/sys/unix/zerrors_darwin_arm.go | 1293 ---- .../x/sys/unix/zerrors_darwin_arm64.go | 1576 ----- .../x/sys/unix/zerrors_dragonfly_386.go | 2 - .../x/sys/unix/zerrors_dragonfly_amd64.go | 2 - .../x/sys/unix/zerrors_freebsd_386.go | 26 - .../x/sys/unix/zerrors_freebsd_amd64.go | 30 - .../x/sys/unix/zerrors_freebsd_arm.go | 18 +- .../x/sys/unix/zerrors_linux_386.go | 279 +- .../x/sys/unix/zerrors_linux_amd64.go | 279 +- .../x/sys/unix/zerrors_linux_arm.go | 182 - .../x/sys/unix/zerrors_linux_arm64.go | 1896 ------ .../x/sys/unix/zerrors_linux_ppc64.go | 1969 ------ .../x/sys/unix/zerrors_linux_ppc64le.go | 1968 ------ .../x/sys/unix/zerrors_netbsd_386.go | 2 - .../x/sys/unix/zerrors_netbsd_amd64.go | 2 - .../x/sys/unix/zerrors_netbsd_arm.go | 2 - .../x/sys/unix/zerrors_openbsd_386.go | 2 - .../x/sys/unix/zerrors_openbsd_amd64.go | 2 - .../x/sys/unix/zerrors_solaris_amd64.go | 28 +- .../x/sys/unix/zsyscall_darwin_386.go | 219 +- .../x/sys/unix/zsyscall_darwin_amd64.go | 235 +- .../x/sys/unix/zsyscall_darwin_arm.go | 1426 ----- .../x/sys/unix/zsyscall_darwin_arm64.go | 1426 ----- .../x/sys/unix/zsyscall_dragonfly_386.go | 277 +- .../x/sys/unix/zsyscall_dragonfly_amd64.go | 277 +- .../x/sys/unix/zsyscall_freebsd_386.go | 520 +- .../x/sys/unix/zsyscall_freebsd_amd64.go | 520 +- .../x/sys/unix/zsyscall_freebsd_arm.go | 520 +- .../x/sys/unix/zsyscall_linux_386.go | 613 +- .../x/sys/unix/zsyscall_linux_amd64.go | 647 +- .../x/sys/unix/zsyscall_linux_arm.go | 621 +- .../x/sys/unix/zsyscall_linux_arm64.go | 1750 ----- .../x/sys/unix/zsyscall_linux_ppc64.go | 1792 ------ .../x/sys/unix/zsyscall_linux_ppc64le.go | 1792 ------ .../x/sys/unix/zsyscall_netbsd_386.go | 265 +- .../x/sys/unix/zsyscall_netbsd_amd64.go | 265 +- .../x/sys/unix/zsyscall_netbsd_arm.go | 265 +- .../x/sys/unix/zsyscall_openbsd_386.go | 275 +- .../x/sys/unix/zsyscall_openbsd_amd64.go | 275 +- .../x/sys/unix/zsyscall_solaris_amd64.go | 1003 +-- .../x/sys/unix/zsysnum_darwin_386.go | 80 +- .../x/sys/unix/zsysnum_darwin_amd64.go | 80 +- .../x/sys/unix/zsysnum_darwin_arm.go | 358 -- .../x/sys/unix/zsysnum_darwin_arm64.go | 398 -- .../x/sys/unix/zsysnum_dragonfly_386.go | 2 - .../x/sys/unix/zsysnum_dragonfly_amd64.go | 2 - .../x/sys/unix/zsysnum_freebsd_386.go | 5 +- .../x/sys/unix/zsysnum_freebsd_amd64.go | 5 +- .../x/sys/unix/zsysnum_freebsd_arm.go | 5 +- .../x/sys/unix/zsysnum_linux_386.go | 10 - .../x/sys/unix/zsysnum_linux_amd64.go | 11 - .../x/sys/unix/zsysnum_linux_arm.go | 2 - .../x/sys/unix/zsysnum_linux_arm64.go | 272 - .../x/sys/unix/zsysnum_linux_ppc64.go | 360 -- .../x/sys/unix/zsysnum_linux_ppc64le.go | 353 - .../x/sys/unix/zsysnum_netbsd_386.go | 2 - .../x/sys/unix/zsysnum_netbsd_amd64.go | 2 - .../x/sys/unix/zsysnum_netbsd_arm.go | 2 - .../x/sys/unix/zsysnum_openbsd_386.go | 2 - .../x/sys/unix/zsysnum_openbsd_amd64.go | 2 - .../x/sys/unix/zsysnum_solaris_amd64.go | 2 - .../x/sys/unix/ztypes_darwin_386.go | 3 +- .../x/sys/unix/ztypes_darwin_amd64.go | 12 +- .../x/sys/unix/ztypes_darwin_arm.go | 449 -- .../x/sys/unix/ztypes_darwin_arm64.go | 457 -- .../x/sys/unix/ztypes_dragonfly_386.go | 2 - .../x/sys/unix/ztypes_dragonfly_amd64.go | 2 - .../x/sys/unix/ztypes_freebsd_386.go | 10 - .../x/sys/unix/ztypes_freebsd_amd64.go | 10 - .../x/sys/unix/ztypes_freebsd_arm.go | 2 - .../golang.org/x/sys/unix/ztypes_linux_386.go | 126 +- .../x/sys/unix/ztypes_linux_amd64.go | 128 +- .../golang.org/x/sys/unix/ztypes_linux_arm.go | 124 +- .../x/sys/unix/ztypes_linux_arm64.go | 595 -- .../x/sys/unix/ztypes_linux_ppc64.go | 605 -- .../x/sys/unix/ztypes_linux_ppc64le.go | 605 -- .../x/sys/unix/ztypes_netbsd_386.go | 2 - .../x/sys/unix/ztypes_netbsd_amd64.go | 2 - .../x/sys/unix/ztypes_netbsd_arm.go | 2 - .../x/sys/unix/ztypes_openbsd_386.go | 2 - .../x/sys/unix/ztypes_openbsd_amd64.go | 2 - .../x/sys/unix/ztypes_solaris_amd64.go | 57 - vendor/google.golang.org/api/LICENSE | 27 + .../api/gensupport/buffer_test.go | 296 - .../api/gensupport/json_test.go | 367 -- .../api/gensupport/media_test.go | 142 - .../api/gensupport/resumable_test.go | 219 - .../api/gensupport/util_test.go | 25 - .../api/googleapi/googleapi_test.go | 380 -- .../api/googleapi/types_test.go | 44 - vendor/google.golang.org/cloud/LICENSE | 202 + 1105 files changed, 10715 insertions(+), 221037 deletions(-) create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/github.com/Azure/go-autorest/LICENSE create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/golang.org/x/crypto/LICENSE create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/golang.org/x/crypto/PATENTS create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/gopkg.in/check.v1/LICENSE create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/LICENSE delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/child_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/host_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/matryoshka_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/plan9_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/posix_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/testdata/test.cgi delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/chunked_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/client_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/cookie_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/cookiejar/jar_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/cookiejar/punycode_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/example_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/export_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/fcgi/fcgi_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/filetransport_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/fs_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/header_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/httptest/example_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/httptest/recorder_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/httptest/server_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/httputil/chunked_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/httputil/dump_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/httputil/reverseproxy_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/lex_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/npn_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/proxy_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/range_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/readrequest_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/request_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/requestwrite_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/response_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/responsewrite_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/serve_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/sniff_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/testdata/file delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/testdata/index.html delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/testdata/style.css delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/transfer_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/transport_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/http/z_last_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/tls/conn_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/tls/handshake_client_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/tls/handshake_messages_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/tls/handshake_server_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/tls/prf_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/core/tls/tls_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/errors_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/entities_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/resourceextensions_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/entities_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/examples_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/extensions_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/integration_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/vmutils_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/blob_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/client_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/file_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/queue_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/storage/util_test.go delete mode 100644 vendor/github.com/DreamItGetIT/statuscake/client_test.go delete mode 100644 vendor/github.com/DreamItGetIT/statuscake/tests_test.go create mode 100644 vendor/github.com/apparentlymart/go-cidr/LICENSE delete mode 100644 vendor/github.com/apparentlymart/go-cidr/cidr/cidr_test.go create mode 100644 vendor/github.com/apparentlymart/go-rundeck-api/LICENSE delete mode 100644 vendor/github.com/apparentlymart/go-rundeck-api/rundeck/job_test.go delete mode 100644 vendor/github.com/armon/circbuf/circbuf_test.go delete mode 100644 vendor/github.com/armon/go-radix/radix_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/LICENSE.txt create mode 100644 vendor/github.com/aws/aws-sdk-go/NOTICE.txt delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/config_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/convert_types_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/types_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_bench_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/build_bench_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/build_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/unmarshal_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/build_bench_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/build_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/unmarshal_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_bench_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/unmarshal_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/signer/v4/functional_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/signer/v4/header_rules_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/signer/v4/v4_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/waiter/waiter_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/autoscaling/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudformation/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudtrail/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudwatch/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/codecommit/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/codedeploy/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/directoryservice/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/customizations_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/converter_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/ec2/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/ecr/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/ecs/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/efs/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/elasticache/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/elb/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/firehose/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/glacier/customizations_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/glacier/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/glacier/treehash_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/iam/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/kinesis/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/lambda/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/opsworks/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/rds/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/redshift/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/route53/customizations_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/route53/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/customizations_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/download_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/shared_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/sse_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/sns/examples_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/sqs/api_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/sqs/checksums_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/sqs/examples_test.go create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/akrennmair/gopcap/LICENSE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/bgentry/speakeasy/LICENSE_WINDOWS create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/boltdb/bolt/LICENSE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/cheggaaa/pb/LICENSE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/codegangsta/cli/LICENSE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/coreos/gexpect/LICENCE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/cpuguy83/go-md2man/LICENSE.md create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/LICENSE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/golang/glog/LICENSE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/golang/protobuf/LICENSE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/google/btree/LICENSE rename vendor/github.com/{vmware/govmomi/object/datastore_test.go => coreos/etcd/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/LICENSE} (69%) create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/jonboulle/clockwork/LICENSE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/kballard/go-shellquote/LICENSE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/kr/pty/License create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/olekukonko/ts/LICENCE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/prometheus/procfs/LICENSE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/prometheus/procfs/NOTICE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/russross/blackfriday/LICENSE.txt create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/shurcooL/sanitized_anchor_name/LICENSE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/cobra/LICENSE.txt create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/cobra/cobra/cmd/licenses.go create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/pflag/LICENSE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/LICENSE delete mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/cbor_test.go delete mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/codec_test.go delete mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/codecgen_test.go delete mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_test.go delete mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/py_test.go delete mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/values_test.go create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/xiang90/probing/LICENSE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/LICENSE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/PATENTS delete mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context/context_test.go delete mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context/ctxhttp/ctxhttp_test.go delete mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context/withtimeout_test.go create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/google.golang.org/grpc/LICENSE create mode 100644 vendor/github.com/coreos/etcd/Godeps/_workspace/src/google.golang.org/grpc/PATENTS create mode 100644 vendor/github.com/coreos/etcd/LICENSE create mode 100644 vendor/github.com/coreos/etcd/NOTICE delete mode 100644 vendor/github.com/coreos/etcd/client/client_test.go delete mode 100644 vendor/github.com/coreos/etcd/client/fake_transport_go14_test.go delete mode 100644 vendor/github.com/coreos/etcd/client/fake_transport_test.go delete mode 100644 vendor/github.com/coreos/etcd/client/keys_bench_test.go delete mode 100644 vendor/github.com/coreos/etcd/client/keys_test.go delete mode 100644 vendor/github.com/coreos/etcd/client/members_test.go delete mode 100644 vendor/github.com/coreos/etcd/client/srv_test.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/pathutil/path_test.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/types/id_test.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/types/set_test.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/types/slice_test.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/types/urls_test.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/types/urlsmap_go15_test.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/types/urlsmap_test.go create mode 100644 vendor/github.com/cyberdelia/heroku-go/LICENSE delete mode 100644 vendor/github.com/digitalocean/godo/account_test.go delete mode 100644 vendor/github.com/digitalocean/godo/action_test.go delete mode 100644 vendor/github.com/digitalocean/godo/domains_test.go delete mode 100644 vendor/github.com/digitalocean/godo/droplet_actions_test.go delete mode 100644 vendor/github.com/digitalocean/godo/droplets_test.go delete mode 100644 vendor/github.com/digitalocean/godo/errors_test.go delete mode 100644 vendor/github.com/digitalocean/godo/floating_ips_actions_test.go delete mode 100644 vendor/github.com/digitalocean/godo/floating_ips_test.go delete mode 100644 vendor/github.com/digitalocean/godo/godo_test.go delete mode 100644 vendor/github.com/digitalocean/godo/image_actions_test.go delete mode 100644 vendor/github.com/digitalocean/godo/images_test.go delete mode 100644 vendor/github.com/digitalocean/godo/keys_test.go delete mode 100644 vendor/github.com/digitalocean/godo/links_test.go delete mode 100644 vendor/github.com/digitalocean/godo/regions_test.go delete mode 100644 vendor/github.com/digitalocean/godo/sizes_test.go delete mode 100644 vendor/github.com/digitalocean/godo/timestamp_test.go delete mode 100644 vendor/github.com/digitalocean/godo/util/droplet_test.go delete mode 100644 vendor/github.com/dylanmei/iso8601/duration_test.go delete mode 100644 vendor/github.com/dylanmei/winrmtest/wsman_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/auth_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/build_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/change_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/client_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/container_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/env_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/event_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/example_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/exec_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/entry_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/formatter_bench_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/hook_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/json_formatter_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/logrus_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/text_formatter_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/envfile_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/hosts_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/ip_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/opts_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/archive_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/archive_unix_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/archive_windows_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/changes_posix_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/changes_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/copy_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/diff_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/utils_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/wrap_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/fileutils/fileutils_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/homedir/homedir_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/idtools/idtools_unix_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/bytespipe_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/fmt_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/multireader_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/readers_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/writers_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/longpath/longpath_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/pools/pools_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/stdcopy/stdcopy_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/chtimes_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/chtimes_unix_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/chtimes_windows_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/lstat_unix_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/meminfo_unix_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_unix_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/utimes_unix_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/go-units/duration_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/go-units/size_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/go-units/ulimit_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/context/context_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/bench_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/mux_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/old_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user/user_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/net/context/context_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/net/context/withtimeout_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/creds_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/export_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/mmap_unix_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/syscall_bsd_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/syscall_freebsd_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/syscall_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/syscall_unix_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/image_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/integration_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/misc_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/network_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/testing/server_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/volume_test.go delete mode 100644 vendor/github.com/go-chef/chef/acl_test.go delete mode 100644 vendor/github.com/go-chef/chef/client_test.go delete mode 100644 vendor/github.com/go-chef/chef/cookbook_test.go delete mode 100644 vendor/github.com/go-chef/chef/databag_test.go delete mode 100644 vendor/github.com/go-chef/chef/environment_test.go delete mode 100644 vendor/github.com/go-chef/chef/http_test.go delete mode 100644 vendor/github.com/go-chef/chef/node_test.go delete mode 100644 vendor/github.com/go-chef/chef/reader_test.go delete mode 100644 vendor/github.com/go-chef/chef/role_test.go delete mode 100644 vendor/github.com/go-chef/chef/run_list_test.go delete mode 100644 vendor/github.com/go-chef/chef/sandbox_test.go delete mode 100644 vendor/github.com/go-chef/chef/search_test.go delete mode 100644 vendor/github.com/go-ini/ini/ini_test.go delete mode 100644 vendor/github.com/go-ini/ini/struct_test.go delete mode 100644 vendor/github.com/go-ini/ini/testdata/conf.ini create mode 100644 vendor/github.com/google/go-querystring/LICENSE delete mode 100644 vendor/github.com/google/go-querystring/query/encode_test.go create mode 100644 vendor/github.com/hashicorp/atlas-go/LICENSE delete mode 100644 vendor/github.com/hashicorp/atlas-go/archive/archive_test.go delete mode 100644 vendor/github.com/hashicorp/atlas-go/archive/vcs_test.go delete mode 100644 vendor/github.com/hashicorp/atlas-go/v1/application_test.go delete mode 100644 vendor/github.com/hashicorp/atlas-go/v1/artifact_test.go delete mode 100644 vendor/github.com/hashicorp/atlas-go/v1/atlas_test.go delete mode 100644 vendor/github.com/hashicorp/atlas-go/v1/authentication_test.go delete mode 100644 vendor/github.com/hashicorp/atlas-go/v1/build_config_test.go delete mode 100644 vendor/github.com/hashicorp/atlas-go/v1/client_test.go delete mode 100644 vendor/github.com/hashicorp/atlas-go/v1/terraform_test.go delete mode 100644 vendor/github.com/hashicorp/atlas-go/v1/util_test.go create mode 100644 vendor/github.com/hashicorp/consul/LICENSE delete mode 100644 vendor/github.com/hashicorp/consul/api/acl_test.go delete mode 100644 vendor/github.com/hashicorp/consul/api/agent_test.go delete mode 100644 vendor/github.com/hashicorp/consul/api/api_test.go delete mode 100644 vendor/github.com/hashicorp/consul/api/catalog_test.go delete mode 100644 vendor/github.com/hashicorp/consul/api/coordinate_test.go delete mode 100644 vendor/github.com/hashicorp/consul/api/event_test.go delete mode 100644 vendor/github.com/hashicorp/consul/api/health_test.go delete mode 100644 vendor/github.com/hashicorp/consul/api/kv_test.go delete mode 100644 vendor/github.com/hashicorp/consul/api/lock_test.go delete mode 100644 vendor/github.com/hashicorp/consul/api/prepared_query_test.go delete mode 100644 vendor/github.com/hashicorp/consul/api/semaphore_test.go delete mode 100644 vendor/github.com/hashicorp/consul/api/session_test.go delete mode 100644 vendor/github.com/hashicorp/consul/api/status_test.go create mode 100644 vendor/github.com/hashicorp/consul/website/LICENSE.md delete mode 100644 vendor/github.com/hashicorp/errwrap/errwrap_test.go delete mode 100644 vendor/github.com/hashicorp/go-checkpoint/checkpoint_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/Vagrantfile delete mode 100644 vendor/github.com/hashicorp/go-getter/decompress_bzip2_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/decompress_gzip_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/decompress_tbz2_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/decompress_tgz_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/decompress_zip_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/detect_bitbucket_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/detect_file_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/detect_github_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/detect_s3_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/detect_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/folder_storage_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/get_file_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/get_git_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/get_hg_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/get_http_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/get_s3_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/get_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/helper/url/url_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/module_test.go delete mode 100644 vendor/github.com/hashicorp/go-getter/source_test.go delete mode 100644 vendor/github.com/hashicorp/go-multierror/append_test.go delete mode 100644 vendor/github.com/hashicorp/go-multierror/flatten_test.go delete mode 100644 vendor/github.com/hashicorp/go-multierror/format_test.go delete mode 100644 vendor/github.com/hashicorp/go-multierror/multierror_test.go delete mode 100644 vendor/github.com/hashicorp/go-multierror/prefix_test.go delete mode 100644 vendor/github.com/hashicorp/go-retryablehttp/client_test.go delete mode 100644 vendor/github.com/hashicorp/go-version/constraint_test.go delete mode 100644 vendor/github.com/hashicorp/go-version/version_collection_test.go delete mode 100644 vendor/github.com/hashicorp/go-version/version_test.go delete mode 100644 vendor/github.com/hashicorp/hcl/decoder_test.go delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/ast/ast_test.go delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/error_test.go delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/parser_test.go delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/printer_test.go delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.golden delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.input delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.golden delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.input delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.golden delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.input delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/complexhcl.golden delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/complexhcl.input delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list.golden delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list.input delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/scanner/scanner_test.go delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/strconv/quote_test.go delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/token/token_test.go delete mode 100644 vendor/github.com/hashicorp/hcl/hcl_test.go delete mode 100644 vendor/github.com/hashicorp/hcl/json/parser/parser_test.go delete mode 100644 vendor/github.com/hashicorp/hcl/json/scanner/scanner_test.go delete mode 100644 vendor/github.com/hashicorp/hcl/json/token/token_test.go delete mode 100644 vendor/github.com/hashicorp/hcl/lex_test.go delete mode 100644 vendor/github.com/hashicorp/logutils/level_benchmark_test.go delete mode 100644 vendor/github.com/hashicorp/logutils/level_test.go create mode 100644 vendor/github.com/hashicorp/serf/LICENSE delete mode 100644 vendor/github.com/hashicorp/serf/coordinate/client_test.go delete mode 100644 vendor/github.com/hashicorp/serf/coordinate/coordinate_test.go delete mode 100644 vendor/github.com/hashicorp/serf/coordinate/performance_test.go create mode 100644 vendor/github.com/hashicorp/serf/ops-misc/debian/copyright create mode 100644 vendor/github.com/hashicorp/serf/website/LICENSE.md delete mode 100644 vendor/github.com/hashicorp/yamux/bench_test.go delete mode 100644 vendor/github.com/hashicorp/yamux/const_test.go delete mode 100644 vendor/github.com/hashicorp/yamux/session_test.go delete mode 100644 vendor/github.com/hashicorp/yamux/util_test.go delete mode 100644 vendor/github.com/hmrc/vmware-govcd/api_test.go delete mode 100644 vendor/github.com/hmrc/vmware-govcd/api_vca_test.go delete mode 100644 vendor/github.com/hmrc/vmware-govcd/api_vcd_test.go delete mode 100644 vendor/github.com/hmrc/vmware-govcd/catalog_test.go delete mode 100644 vendor/github.com/hmrc/vmware-govcd/catalogitem_test.go delete mode 100644 vendor/github.com/hmrc/vmware-govcd/edgegateway_test.go delete mode 100644 vendor/github.com/hmrc/vmware-govcd/org_test.go delete mode 100644 vendor/github.com/hmrc/vmware-govcd/orgvdcnetwork_test.go delete mode 100644 vendor/github.com/hmrc/vmware-govcd/task_test.go delete mode 100644 vendor/github.com/hmrc/vmware-govcd/vapp_test.go delete mode 100644 vendor/github.com/hmrc/vmware-govcd/vapptemplate_test.go delete mode 100644 vendor/github.com/hmrc/vmware-govcd/vdc_test.go delete mode 100644 vendor/github.com/imdario/mergo/issue17_test.go delete mode 100644 vendor/github.com/imdario/mergo/mergo_test.go delete mode 100644 vendor/github.com/imdario/mergo/testdata/license.yml delete mode 100644 vendor/github.com/imdario/mergo/testdata/thing.yml delete mode 100644 vendor/github.com/jmespath/go-jmespath/api_test.go delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance_test.go delete mode 100644 vendor/github.com/jmespath/go-jmespath/interpreter_test.go delete mode 100644 vendor/github.com/jmespath/go-jmespath/lexer_test.go delete mode 100644 vendor/github.com/jmespath/go-jmespath/parser_test.go delete mode 100644 vendor/github.com/jmespath/go-jmespath/util_test.go delete mode 100644 vendor/github.com/kardianos/osext/osext_test.go delete mode 100644 vendor/github.com/lib/pq/bench_test.go delete mode 100644 vendor/github.com/lib/pq/conn_test.go delete mode 100644 vendor/github.com/lib/pq/copy_test.go delete mode 100644 vendor/github.com/lib/pq/encode_test.go delete mode 100644 vendor/github.com/lib/pq/hstore/hstore_test.go delete mode 100644 vendor/github.com/lib/pq/notify_test.go delete mode 100644 vendor/github.com/lib/pq/ssl_test.go delete mode 100644 vendor/github.com/lib/pq/url_test.go rename vendor/github.com/{vmware/govmomi/object/folder_test.go => lusis/go-artifactory/LICENSE} (77%) delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/api_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/archive_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/artifact_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/bintray_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/build_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/client_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/compliance_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/groups_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/http_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/mimetypes_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/permissions_targets_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/repos_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/responses_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/search_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/security_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/storage_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/system_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/users_test.go delete mode 100644 vendor/github.com/lusis/go-artifactory/src/artifactory.v401/version_test.go create mode 100644 vendor/github.com/masterzen/simplexml/LICENSE delete mode 100644 vendor/github.com/masterzen/simplexml/dom/dom_test.go create mode 100644 vendor/github.com/masterzen/winrm/LICENSE delete mode 100644 vendor/github.com/masterzen/winrm/soap/header_test.go delete mode 100644 vendor/github.com/masterzen/winrm/soap/namespaces_test.go delete mode 100644 vendor/github.com/masterzen/winrm/winrm/client_test.go delete mode 100644 vendor/github.com/masterzen/winrm/winrm/command_test.go delete mode 100644 vendor/github.com/masterzen/winrm/winrm/endpoint_test.go delete mode 100644 vendor/github.com/masterzen/winrm/winrm/fixture_test.go delete mode 100644 vendor/github.com/masterzen/winrm/winrm/http_test.go delete mode 100644 vendor/github.com/masterzen/winrm/winrm/parameters_test.go delete mode 100644 vendor/github.com/masterzen/winrm/winrm/powershell_test.go delete mode 100644 vendor/github.com/masterzen/winrm/winrm/request_test.go delete mode 100644 vendor/github.com/masterzen/winrm/winrm/response_test.go delete mode 100644 vendor/github.com/masterzen/winrm/winrm/shell_test.go delete mode 100644 vendor/github.com/masterzen/xmlpath/all_test.go delete mode 100644 vendor/github.com/mitchellh/cli/cli_test.go delete mode 100644 vendor/github.com/mitchellh/cli/command_mock_test.go delete mode 100644 vendor/github.com/mitchellh/cli/ui_colored_test.go delete mode 100644 vendor/github.com/mitchellh/cli/ui_concurrent_test.go delete mode 100644 vendor/github.com/mitchellh/cli/ui_mock_test.go delete mode 100644 vendor/github.com/mitchellh/cli/ui_test.go delete mode 100644 vendor/github.com/mitchellh/cli/ui_writer_test.go delete mode 100644 vendor/github.com/mitchellh/colorstring/colorstring_test.go delete mode 100644 vendor/github.com/mitchellh/copystructure/copier_time_test.go delete mode 100644 vendor/github.com/mitchellh/copystructure/copystructure_examples_test.go delete mode 100644 vendor/github.com/mitchellh/copystructure/copystructure_test.go delete mode 100644 vendor/github.com/mitchellh/go-homedir/homedir_test.go delete mode 100644 vendor/github.com/mitchellh/go-linereader/linereader_test.go delete mode 100644 vendor/github.com/mitchellh/mapstructure/decode_hooks_test.go delete mode 100644 vendor/github.com/mitchellh/mapstructure/mapstructure_benchmark_test.go delete mode 100644 vendor/github.com/mitchellh/mapstructure/mapstructure_bugs_test.go delete mode 100644 vendor/github.com/mitchellh/mapstructure/mapstructure_examples_test.go delete mode 100644 vendor/github.com/mitchellh/mapstructure/mapstructure_test.go create mode 100644 vendor/github.com/mitchellh/packer/LICENSE delete mode 100644 vendor/github.com/mitchellh/packer/common/uuid/uuid_test.go create mode 100644 vendor/github.com/mitchellh/packer/post-processor/compress/LICENSE delete mode 100644 vendor/github.com/mitchellh/panicwrap/panicwrap_test.go delete mode 100644 vendor/github.com/mitchellh/prefixedio/reader_test.go delete mode 100644 vendor/github.com/mitchellh/reflectwalk/reflectwalk_test.go create mode 100644 vendor/github.com/nesv/go-dynect/LICENSE.md delete mode 100644 vendor/github.com/nesv/go-dynect/dynect/client_test.go delete mode 100644 vendor/github.com/nu7hatch/gouuid/example_test.go delete mode 100644 vendor/github.com/nu7hatch/gouuid/uuid_test.go create mode 100644 vendor/github.com/packer-community/winrmcp/LICENSE delete mode 100644 vendor/github.com/packer-community/winrmcp/winrmcp/endpoint_test.go delete mode 100644 vendor/github.com/pborman/uuid/json_test.go delete mode 100644 vendor/github.com/pborman/uuid/seq_test.go delete mode 100644 vendor/github.com/pborman/uuid/sql_test.go delete mode 100644 vendor/github.com/pborman/uuid/uuid_test.go delete mode 100644 vendor/github.com/pearkes/cloudflare/api_test.go delete mode 100644 vendor/github.com/pearkes/cloudflare/record_test.go delete mode 100644 vendor/github.com/pearkes/dnsimple/api_test.go delete mode 100644 vendor/github.com/pearkes/dnsimple/domain_test.go delete mode 100644 vendor/github.com/pearkes/dnsimple/record_test.go delete mode 100644 vendor/github.com/pearkes/mailgun/api_test.go delete mode 100644 vendor/github.com/pearkes/mailgun/domain_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/blockstorage/v1/snapshots_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/blockstorage/v1/volumes_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/blockstorage/v1/volumetypes_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/client_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/bootfromvolume_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/compute_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/extension_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/flavors_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/floatingip_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/images_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/keypairs_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/network_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/secdefrules_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/secgroup_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/servergroup_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/servers_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/tenantnetworks_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/volumeattach_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/db/v1/database_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/db/v1/flavor_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/db/v1/instance_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/db/v1/user_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/extension_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/identity_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/role_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/tenant_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/token_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/user_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v3/endpoint_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v3/identity_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v3/service_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v3/token_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/apiversion_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extension_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/fwaas/firewall_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/fwaas/policy_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/fwaas/rule_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/layer3_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/lbaas/member_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/lbaas/monitor_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/lbaas/pool_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/lbaas/vip_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/provider_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/security_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/network_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/port_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/subnet_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/objectstorage/v1/accounts_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/objectstorage/v1/containers_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/objectstorage/v1/objects_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/buildinfo_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/stackevents_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/stackresources_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/stacks_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/stacktemplates_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/blockstorage/v1/snapshot_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/blockstorage/v1/volume_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/blockstorage/v1/volume_type_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/cdn/v1/base_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/cdn/v1/flavor_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/cdn/v1/service_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/cdn/v1/serviceasset_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/client_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/bootfromvolume_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/compute_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/flavors_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/images_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/keypairs_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/networks_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/servers_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/virtualinterfaces_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/volumeattach_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/backup_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/config_group_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/database_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/flavor_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/instance_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/replica_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/user_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/extension_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/identity_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/role_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/tenant_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/tokens_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/user_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/acl_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/lb_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/monitor_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/node_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/session_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/throttle_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/vip_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/networking/v2/network_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/networking/v2/port_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/networking/v2/security_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/networking/v2/subnet_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/accounts_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/bulk_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/cdncontainers_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/cdnobjects_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/containers_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/objects_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/buildinfo_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/stackevents_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/stackresources_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/stacks_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/stacktemplates_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/rackconnect/v3/cloudnetworks_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/rackconnect/v3/lbpools_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/acceptance/rackspace/rackconnect/v3/publicips_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/endpoint_search_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/apiversions/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/apiversions/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/snapshots/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/snapshots/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumetypes/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumetypes/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/cdn/v1/base/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/cdn/v1/flavors/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/cdn/v1/serviceassets/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/cdn/v1/services/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/client_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/common/extensions/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/common/extensions/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/defsecrules/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/diskconfig/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/diskconfig/results_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/floatingip/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/floatingip/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/keypairs/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/keypairs/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/networks/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/networks/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/schedulerhints/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/secgroups/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/servergroups/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/servergroups/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/startstop/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/tenantnetworks/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/tenantnetworks/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/volumeattach/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/volumeattach/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/flavors/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/flavors/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/images/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/images/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/servers/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/compute/v2/servers/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/db/v1/configurations/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/db/v1/databases/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/db/v1/datastores/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/db/v1/flavors/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/db/v1/instances/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/db/v1/users/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/endpoint_location_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/identity/v2/extensions/admin/roles/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/identity/v2/extensions/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/identity/v2/tenants/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/identity/v2/tokens/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/identity/v2/users/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/identity/v3/endpoints/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/identity/v3/endpoints/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/identity/v3/roles/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/identity/v3/roles/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/identity/v3/services/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/identity/v3/services/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/apiversions/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/apiversions/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/external/results_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/firewalls/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/policies/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/rules/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/floatingips/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/routers/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/members/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/monitors/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/pools/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/vips/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/provider/results_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/groups/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/rules/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/networks/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/networks/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/ports/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/ports/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/subnets/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/subnets/results_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/networking/v2/subnets/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/accounts/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/accounts/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/apiversions/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/buildinfo/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stackevents/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stackresources/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks/environment_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks/template_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks/utils_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacktemplates/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/openstack/utils/choose_version_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/pagination/linked_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/pagination/marker_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/pagination/pagination_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/pagination/single_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/params_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/provider_client_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/blockstorage/v1/snapshots/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/blockstorage/v1/volumes/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/blockstorage/v1/volumetypes/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/cdn/v1/base/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/cdn/v1/flavors/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/cdn/v1/serviceassets/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/cdn/v1/services/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/client_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/bootfromvolume/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/flavors/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/images/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/keypairs/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/networks/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/networks/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/servers/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/servers/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/virtualinterfaces/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/virtualinterfaces/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/volumeattach/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/db/v1/backups/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/db/v1/configurations/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/db/v1/databases/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/db/v1/datastores/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/db/v1/flavors/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/db/v1/instances/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/db/v1/instances/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/db/v1/users/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/db/v1/users/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/extensions/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/roles/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/tenants/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/tokens/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/users/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/acl/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/lbs/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/monitors/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/nodes/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/sessions/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/ssl/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/throttle/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/vips/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/networks/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/ports/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/security/groups/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/security/rules/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/subnets/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/accounts/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/bulk/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/bulk/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdncontainers/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdncontainers/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdncontainers/urls_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdnobjects/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/containers/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/objects/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/buildinfo/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stackevents/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stackresources/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stacks/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stacktemplates/delegate_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/rackconnect/v3/cloudnetworks/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/rackconnect/v3/lbpools/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/rackspace/rackconnect/v3/publicips/requests_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/service_client_test.go delete mode 100644 vendor/github.com/rackspace/gophercloud/util_test.go delete mode 100644 vendor/github.com/satori/go.uuid/benchmarks_test.go delete mode 100644 vendor/github.com/satori/go.uuid/uuid_test.go delete mode 100644 vendor/github.com/soniah/dnsmadeeasy/api_test.go delete mode 100644 vendor/github.com/soniah/dnsmadeeasy/record_test.go delete mode 100644 vendor/github.com/sthulb/mime/multipart/example_test.go delete mode 100644 vendor/github.com/sthulb/mime/multipart/formdata_test.go delete mode 100644 vendor/github.com/sthulb/mime/multipart/multipart_test.go delete mode 100644 vendor/github.com/sthulb/mime/multipart/testdata/nested-mime delete mode 100644 vendor/github.com/sthulb/mime/multipart/writer_test.go delete mode 100644 vendor/github.com/tent/http-link-go/link_test.go delete mode 100644 vendor/github.com/vmware/govmomi/client_test.go delete mode 100644 vendor/github.com/vmware/govmomi/govc/flags/optional_bool_test.go delete mode 100644 vendor/github.com/vmware/govmomi/govc/flags/version_test.go delete mode 100644 vendor/github.com/vmware/govmomi/govc/host/esxcli/command_test.go delete mode 100644 vendor/github.com/vmware/govmomi/govc/host/esxcli/response_test.go delete mode 100644 vendor/github.com/vmware/govmomi/govc/main_test.go delete mode 100644 vendor/github.com/vmware/govmomi/list/path_test.go delete mode 100644 vendor/github.com/vmware/govmomi/object/cluster_compute_resource_test.go delete mode 100644 vendor/github.com/vmware/govmomi/object/compute_resource_test.go delete mode 100644 vendor/github.com/vmware/govmomi/object/datacenter_test.go delete mode 100644 vendor/github.com/vmware/govmomi/object/distributed_virtual_portgroup_test.go delete mode 100644 vendor/github.com/vmware/govmomi/object/network_test.go delete mode 100644 vendor/github.com/vmware/govmomi/object/search_index_test.go delete mode 100644 vendor/github.com/vmware/govmomi/object/virtual_device_list_test.go delete mode 100644 vendor/github.com/vmware/govmomi/object/virtual_machine_test.go delete mode 100644 vendor/github.com/vmware/govmomi/ovf/env_test.go delete mode 100644 vendor/github.com/vmware/govmomi/ovf/ovf_test.go delete mode 100644 vendor/github.com/vmware/govmomi/session/keep_alive_test.go delete mode 100644 vendor/github.com/vmware/govmomi/session/manager_test.go delete mode 100644 vendor/github.com/vmware/govmomi/test/functional/issue_242_test.go delete mode 100644 vendor/github.com/vmware/govmomi/units/size_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/client_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/methods/fault_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/mo/retrieve_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/mo/type_info_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/progress/aggregator_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/progress/common_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/progress/prefix_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/progress/reader_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/progress/scale_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/progress/tee_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/retry_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/soap/client_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/soap/soap_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/types/base_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/types/registry_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/types/types_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/xml/atom_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/xml/example_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/xml/extras_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/xml/marshal_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/xml/read_test.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/xml/xml_test.go create mode 100644 vendor/github.com/xanzy/go-cloudstack/LICENSE create mode 100644 vendor/github.com/ziutek/mymysql/LICENSE create mode 100644 vendor/github.com/ziutek/mymysql/autorc/LICENSE delete mode 100644 vendor/github.com/ziutek/mymysql/mysql/types_test.go delete mode 100644 vendor/github.com/ziutek/mymysql/native/bind_test.go delete mode 100644 vendor/github.com/ziutek/mymysql/native/native_test.go delete mode 100644 vendor/github.com/ziutek/mymysql/thrsafe/thrsafe_test.go create mode 100644 vendor/golang.org/x/crypto/LICENSE create mode 100644 vendor/golang.org/x/crypto/PATENTS delete mode 100644 vendor/golang.org/x/crypto/curve25519/curve25519_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/agent/client_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/agent/keyring_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/agent/server_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/agent/testdata_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/benchmark_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/buffer_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/certs_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/cipher_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/client_auth_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/client_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/example_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/handshake_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/kex_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/keys_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/mempipe_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/messages_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/mux_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/session_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/tcpip_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/terminal/terminal_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/test/agent_unix_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/test/cert_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/test/forward_unix_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/test/session_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/test/tcpip_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/test/test_unix_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/test/testdata_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/testdata/doc.go delete mode 100644 vendor/golang.org/x/crypto/ssh/testdata/keys.go delete mode 100644 vendor/golang.org/x/crypto/ssh/testdata_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/transport_test.go create mode 100644 vendor/golang.org/x/net/LICENSE create mode 100644 vendor/golang.org/x/net/PATENTS delete mode 100644 vendor/golang.org/x/net/context/context_test.go delete mode 100644 vendor/golang.org/x/net/context/ctxhttp/ctxhttp_test.go delete mode 100644 vendor/golang.org/x/net/context/withtimeout_test.go delete mode 100644 vendor/golang.org/x/oauth2/clientcredentials/clientcredentials_test.go delete mode 100644 vendor/golang.org/x/oauth2/example_test.go delete mode 100644 vendor/golang.org/x/oauth2/google/example_test.go delete mode 100644 vendor/golang.org/x/oauth2/google/google_test.go delete mode 100644 vendor/golang.org/x/oauth2/google/sdk_test.go delete mode 100644 vendor/golang.org/x/oauth2/google/testdata/gcloud/credentials delete mode 100644 vendor/golang.org/x/oauth2/google/testdata/gcloud/properties delete mode 100644 vendor/golang.org/x/oauth2/internal/oauth2_test.go delete mode 100644 vendor/golang.org/x/oauth2/internal/token_test.go delete mode 100644 vendor/golang.org/x/oauth2/internal/transport_test.go delete mode 100644 vendor/golang.org/x/oauth2/jwt/example_test.go delete mode 100644 vendor/golang.org/x/oauth2/jwt/jwt_test.go delete mode 100644 vendor/golang.org/x/oauth2/oauth2_test.go delete mode 100644 vendor/golang.org/x/oauth2/token_test.go delete mode 100644 vendor/golang.org/x/oauth2/transport_test.go delete mode 100644 vendor/golang.org/x/sys/unix/.gitignore delete mode 100644 vendor/golang.org/x/sys/unix/asm_darwin_arm.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_darwin_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s create mode 100644 vendor/golang.org/x/sys/unix/bpf_bsd.go delete mode 100644 vendor/golang.org/x/sys/unix/constants.go delete mode 100644 vendor/golang.org/x/sys/unix/creds_test.go delete mode 100644 vendor/golang.org/x/sys/unix/export_test.go delete mode 100644 vendor/golang.org/x/sys/unix/gccgo.go delete mode 100644 vendor/golang.org/x/sys/unix/gccgo_c.c delete mode 100644 vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go create mode 100644 vendor/golang.org/x/sys/unix/lsf_linux.go mode change 100755 => 100644 vendor/golang.org/x/sys/unix/mkall.sh mode change 100755 => 100644 vendor/golang.org/x/sys/unix/mkerrors.sh mode change 100755 => 100644 vendor/golang.org/x/sys/unix/mksyscall.pl mode change 100755 => 100644 vendor/golang.org/x/sys/unix/mksyscall_solaris.pl mode change 100755 => 100644 vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl mode change 100755 => 100644 vendor/golang.org/x/sys/unix/mksysnum_darwin.pl mode change 100755 => 100644 vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl mode change 100755 => 100644 vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl mode change 100755 => 100644 vendor/golang.org/x/sys/unix/mksysnum_linux.pl mode change 100755 => 100644 vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl mode change 100755 => 100644 vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl delete mode 100644 vendor/golang.org/x/sys/unix/mmap_unix_test.go create mode 100644 vendor/golang.org/x/sys/unix/netlink_linux.go create mode 100644 vendor/golang.org/x/sys/unix/route_bsd.go create mode 100644 vendor/golang.org/x/sys/unix/route_darwin.go create mode 100644 vendor/golang.org/x/sys/unix/route_dragonfly.go create mode 100644 vendor/golang.org/x/sys/unix/route_freebsd.go create mode 100644 vendor/golang.org/x/sys/unix/route_freebsd_32bit.go create mode 100644 vendor/golang.org/x/sys/unix/route_freebsd_64bit.go create mode 100644 vendor/golang.org/x/sys/unix/route_netbsd.go create mode 100644 vendor/golang.org/x/sys/unix/route_openbsd.go create mode 100644 vendor/golang.org/x/sys/unix/so_solaris.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_bsd_test.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_test.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_test.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_unix_test.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go create mode 100644 vendor/google.golang.org/api/LICENSE delete mode 100644 vendor/google.golang.org/api/gensupport/buffer_test.go delete mode 100644 vendor/google.golang.org/api/gensupport/json_test.go delete mode 100644 vendor/google.golang.org/api/gensupport/media_test.go delete mode 100644 vendor/google.golang.org/api/gensupport/resumable_test.go delete mode 100644 vendor/google.golang.org/api/gensupport/util_test.go delete mode 100644 vendor/google.golang.org/api/googleapi/googleapi_test.go delete mode 100644 vendor/google.golang.org/api/googleapi/types_test.go create mode 100644 vendor/google.golang.org/cloud/LICENSE diff --git a/vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/github.com/Azure/go-autorest/LICENSE b/vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/github.com/Azure/go-autorest/LICENSE new file mode 100644 index 0000000000..b9d6a27ea9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/github.com/Azure/go-autorest/LICENSE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2015 Microsoft Corporation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/golang.org/x/crypto/LICENSE b/vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/golang.org/x/crypto/LICENSE new file mode 100644 index 0000000000..6a66aea5ea --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/golang.org/x/crypto/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/golang.org/x/crypto/PATENTS b/vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/golang.org/x/crypto/PATENTS new file mode 100644 index 0000000000..733099041f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/golang.org/x/crypto/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/gopkg.in/check.v1/LICENSE b/vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/gopkg.in/check.v1/LICENSE new file mode 100644 index 0000000000..545cf2d331 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/gopkg.in/check.v1/LICENSE @@ -0,0 +1,25 @@ +Gocheck - A rich testing framework for Go + +Copyright (c) 2010-2013 Gustavo Niemeyer + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/LICENSE b/vendor/github.com/Azure/azure-sdk-for-go/LICENSE new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/child_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/child_test.go deleted file mode 100644 index 075d8411bc..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/child_test.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Tests for CGI (the child process perspective) - -package cgi - -import ( - "testing" -) - -func TestRequest(t *testing.T) { - env := map[string]string{ - "SERVER_PROTOCOL": "HTTP/1.1", - "REQUEST_METHOD": "GET", - "HTTP_HOST": "example.com", - "HTTP_REFERER": "elsewhere", - "HTTP_USER_AGENT": "goclient", - "HTTP_FOO_BAR": "baz", - "REQUEST_URI": "/path?a=b", - "CONTENT_LENGTH": "123", - "CONTENT_TYPE": "text/xml", - "REMOTE_ADDR": "5.6.7.8", - } - req, err := RequestFromMap(env) - if err != nil { - t.Fatalf("RequestFromMap: %v", err) - } - if g, e := req.UserAgent(), "goclient"; e != g { - t.Errorf("expected UserAgent %q; got %q", e, g) - } - if g, e := req.Method, "GET"; e != g { - t.Errorf("expected Method %q; got %q", e, g) - } - if g, e := req.Header.Get("Content-Type"), "text/xml"; e != g { - t.Errorf("expected Content-Type %q; got %q", e, g) - } - if g, e := req.ContentLength, int64(123); e != g { - t.Errorf("expected ContentLength %d; got %d", e, g) - } - if g, e := req.Referer(), "elsewhere"; e != g { - t.Errorf("expected Referer %q; got %q", e, g) - } - if req.Header == nil { - t.Fatalf("unexpected nil Header") - } - if g, e := req.Header.Get("Foo-Bar"), "baz"; e != g { - t.Errorf("expected Foo-Bar %q; got %q", e, g) - } - if g, e := req.URL.String(), "http://example.com/path?a=b"; e != g { - t.Errorf("expected URL %q; got %q", e, g) - } - if g, e := req.FormValue("a"), "b"; e != g { - t.Errorf("expected FormValue(a) %q; got %q", e, g) - } - if req.Trailer == nil { - t.Errorf("unexpected nil Trailer") - } - if req.TLS != nil { - t.Errorf("expected nil TLS") - } - if e, g := "5.6.7.8:0", req.RemoteAddr; e != g { - t.Errorf("RemoteAddr: got %q; want %q", g, e) - } -} - -func TestRequestWithTLS(t *testing.T) { - env := map[string]string{ - "SERVER_PROTOCOL": "HTTP/1.1", - "REQUEST_METHOD": "GET", - "HTTP_HOST": "example.com", - "HTTP_REFERER": "elsewhere", - "REQUEST_URI": "/path?a=b", - "CONTENT_TYPE": "text/xml", - "HTTPS": "1", - "REMOTE_ADDR": "5.6.7.8", - } - req, err := RequestFromMap(env) - if err != nil { - t.Fatalf("RequestFromMap: %v", err) - } - if g, e := req.URL.String(), "https://example.com/path?a=b"; e != g { - t.Errorf("expected URL %q; got %q", e, g) - } - if req.TLS == nil { - t.Errorf("expected non-nil TLS") - } -} - -func TestRequestWithoutHost(t *testing.T) { - env := map[string]string{ - "SERVER_PROTOCOL": "HTTP/1.1", - "HTTP_HOST": "", - "REQUEST_METHOD": "GET", - "REQUEST_URI": "/path?a=b", - "CONTENT_LENGTH": "123", - } - req, err := RequestFromMap(env) - if err != nil { - t.Fatalf("RequestFromMap: %v", err) - } - if req.URL == nil { - t.Fatalf("unexpected nil URL") - } - if g, e := req.URL.String(), "/path?a=b"; e != g { - t.Errorf("URL = %q; want %q", g, e) - } -} - -func TestRequestWithoutRequestURI(t *testing.T) { - env := map[string]string{ - "SERVER_PROTOCOL": "HTTP/1.1", - "HTTP_HOST": "example.com", - "REQUEST_METHOD": "GET", - "SCRIPT_NAME": "/dir/scriptname", - "PATH_INFO": "/p1/p2", - "QUERY_STRING": "a=1&b=2", - "CONTENT_LENGTH": "123", - } - req, err := RequestFromMap(env) - if err != nil { - t.Fatalf("RequestFromMap: %v", err) - } - if req.URL == nil { - t.Fatalf("unexpected nil URL") - } - if g, e := req.URL.String(), "http://example.com/dir/scriptname/p1/p2?a=1&b=2"; e != g { - t.Errorf("URL = %q; want %q", g, e) - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/host_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/host_test.go deleted file mode 100644 index 8c16e6897f..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/host_test.go +++ /dev/null @@ -1,461 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Tests for package cgi - -package cgi - -import ( - "bufio" - "fmt" - "io" - "net" - "net/http" - "net/http/httptest" - "os" - "os/exec" - "path/filepath" - "runtime" - "strconv" - "strings" - "testing" - "time" -) - -func newRequest(httpreq string) *http.Request { - buf := bufio.NewReader(strings.NewReader(httpreq)) - req, err := http.ReadRequest(buf) - if err != nil { - panic("cgi: bogus http request in test: " + httpreq) - } - req.RemoteAddr = "1.2.3.4" - return req -} - -func runCgiTest(t *testing.T, h *Handler, httpreq string, expectedMap map[string]string) *httptest.ResponseRecorder { - rw := httptest.NewRecorder() - req := newRequest(httpreq) - h.ServeHTTP(rw, req) - - // Make a map to hold the test map that the CGI returns. - m := make(map[string]string) - m["_body"] = rw.Body.String() - linesRead := 0 -readlines: - for { - line, err := rw.Body.ReadString('\n') - switch { - case err == io.EOF: - break readlines - case err != nil: - t.Fatalf("unexpected error reading from CGI: %v", err) - } - linesRead++ - trimmedLine := strings.TrimRight(line, "\r\n") - split := strings.SplitN(trimmedLine, "=", 2) - if len(split) != 2 { - t.Fatalf("Unexpected %d parts from invalid line number %v: %q; existing map=%v", - len(split), linesRead, line, m) - } - m[split[0]] = split[1] - } - - for key, expected := range expectedMap { - got := m[key] - if key == "cwd" { - // For Windows. golang.org/issue/4645. - fi1, _ := os.Stat(got) - fi2, _ := os.Stat(expected) - if os.SameFile(fi1, fi2) { - got = expected - } - } - if got != expected { - t.Errorf("for key %q got %q; expected %q", key, got, expected) - } - } - return rw -} - -var cgiTested, cgiWorks bool - -func check(t *testing.T) { - if !cgiTested { - cgiTested = true - cgiWorks = exec.Command("./testdata/test.cgi").Run() == nil - } - if !cgiWorks { - // No Perl on Windows, needed by test.cgi - // TODO: make the child process be Go, not Perl. - t.Skip("Skipping test: test.cgi failed.") - } -} - -func TestCGIBasicGet(t *testing.T) { - check(t) - h := &Handler{ - Path: "testdata/test.cgi", - Root: "/test.cgi", - } - expectedMap := map[string]string{ - "test": "Hello CGI", - "param-a": "b", - "param-foo": "bar", - "env-GATEWAY_INTERFACE": "CGI/1.1", - "env-HTTP_HOST": "example.com", - "env-PATH_INFO": "", - "env-QUERY_STRING": "foo=bar&a=b", - "env-REMOTE_ADDR": "1.2.3.4", - "env-REMOTE_HOST": "1.2.3.4", - "env-REQUEST_METHOD": "GET", - "env-REQUEST_URI": "/test.cgi?foo=bar&a=b", - "env-SCRIPT_FILENAME": "testdata/test.cgi", - "env-SCRIPT_NAME": "/test.cgi", - "env-SERVER_NAME": "example.com", - "env-SERVER_PORT": "80", - "env-SERVER_SOFTWARE": "go", - } - replay := runCgiTest(t, h, "GET /test.cgi?foo=bar&a=b HTTP/1.0\nHost: example.com\n\n", expectedMap) - - if expected, got := "text/html", replay.Header().Get("Content-Type"); got != expected { - t.Errorf("got a Content-Type of %q; expected %q", got, expected) - } - if expected, got := "X-Test-Value", replay.Header().Get("X-Test-Header"); got != expected { - t.Errorf("got a X-Test-Header of %q; expected %q", got, expected) - } -} - -func TestCGIBasicGetAbsPath(t *testing.T) { - check(t) - pwd, err := os.Getwd() - if err != nil { - t.Fatalf("getwd error: %v", err) - } - h := &Handler{ - Path: pwd + "/testdata/test.cgi", - Root: "/test.cgi", - } - expectedMap := map[string]string{ - "env-REQUEST_URI": "/test.cgi?foo=bar&a=b", - "env-SCRIPT_FILENAME": pwd + "/testdata/test.cgi", - "env-SCRIPT_NAME": "/test.cgi", - } - runCgiTest(t, h, "GET /test.cgi?foo=bar&a=b HTTP/1.0\nHost: example.com\n\n", expectedMap) -} - -func TestPathInfo(t *testing.T) { - check(t) - h := &Handler{ - Path: "testdata/test.cgi", - Root: "/test.cgi", - } - expectedMap := map[string]string{ - "param-a": "b", - "env-PATH_INFO": "/extrapath", - "env-QUERY_STRING": "a=b", - "env-REQUEST_URI": "/test.cgi/extrapath?a=b", - "env-SCRIPT_FILENAME": "testdata/test.cgi", - "env-SCRIPT_NAME": "/test.cgi", - } - runCgiTest(t, h, "GET /test.cgi/extrapath?a=b HTTP/1.0\nHost: example.com\n\n", expectedMap) -} - -func TestPathInfoDirRoot(t *testing.T) { - check(t) - h := &Handler{ - Path: "testdata/test.cgi", - Root: "/myscript/", - } - expectedMap := map[string]string{ - "env-PATH_INFO": "bar", - "env-QUERY_STRING": "a=b", - "env-REQUEST_URI": "/myscript/bar?a=b", - "env-SCRIPT_FILENAME": "testdata/test.cgi", - "env-SCRIPT_NAME": "/myscript/", - } - runCgiTest(t, h, "GET /myscript/bar?a=b HTTP/1.0\nHost: example.com\n\n", expectedMap) -} - -func TestDupHeaders(t *testing.T) { - check(t) - h := &Handler{ - Path: "testdata/test.cgi", - } - expectedMap := map[string]string{ - "env-REQUEST_URI": "/myscript/bar?a=b", - "env-SCRIPT_FILENAME": "testdata/test.cgi", - "env-HTTP_COOKIE": "nom=NOM; yum=YUM", - "env-HTTP_X_FOO": "val1, val2", - } - runCgiTest(t, h, "GET /myscript/bar?a=b HTTP/1.0\n"+ - "Cookie: nom=NOM\n"+ - "Cookie: yum=YUM\n"+ - "X-Foo: val1\n"+ - "X-Foo: val2\n"+ - "Host: example.com\n\n", - expectedMap) -} - -func TestPathInfoNoRoot(t *testing.T) { - check(t) - h := &Handler{ - Path: "testdata/test.cgi", - Root: "", - } - expectedMap := map[string]string{ - "env-PATH_INFO": "/bar", - "env-QUERY_STRING": "a=b", - "env-REQUEST_URI": "/bar?a=b", - "env-SCRIPT_FILENAME": "testdata/test.cgi", - "env-SCRIPT_NAME": "/", - } - runCgiTest(t, h, "GET /bar?a=b HTTP/1.0\nHost: example.com\n\n", expectedMap) -} - -func TestCGIBasicPost(t *testing.T) { - check(t) - postReq := `POST /test.cgi?a=b HTTP/1.0 -Host: example.com -Content-Type: application/x-www-form-urlencoded -Content-Length: 15 - -postfoo=postbar` - h := &Handler{ - Path: "testdata/test.cgi", - Root: "/test.cgi", - } - expectedMap := map[string]string{ - "test": "Hello CGI", - "param-postfoo": "postbar", - "env-REQUEST_METHOD": "POST", - "env-CONTENT_LENGTH": "15", - "env-REQUEST_URI": "/test.cgi?a=b", - } - runCgiTest(t, h, postReq, expectedMap) -} - -func chunk(s string) string { - return fmt.Sprintf("%x\r\n%s\r\n", len(s), s) -} - -// The CGI spec doesn't allow chunked requests. -func TestCGIPostChunked(t *testing.T) { - check(t) - postReq := `POST /test.cgi?a=b HTTP/1.1 -Host: example.com -Content-Type: application/x-www-form-urlencoded -Transfer-Encoding: chunked - -` + chunk("postfoo") + chunk("=") + chunk("postbar") + chunk("") - - h := &Handler{ - Path: "testdata/test.cgi", - Root: "/test.cgi", - } - expectedMap := map[string]string{} - resp := runCgiTest(t, h, postReq, expectedMap) - if got, expected := resp.Code, http.StatusBadRequest; got != expected { - t.Fatalf("Expected %v response code from chunked request body; got %d", - expected, got) - } -} - -func TestRedirect(t *testing.T) { - check(t) - h := &Handler{ - Path: "testdata/test.cgi", - Root: "/test.cgi", - } - rec := runCgiTest(t, h, "GET /test.cgi?loc=http://foo.com/ HTTP/1.0\nHost: example.com\n\n", nil) - if e, g := 302, rec.Code; e != g { - t.Errorf("expected status code %d; got %d", e, g) - } - if e, g := "http://foo.com/", rec.Header().Get("Location"); e != g { - t.Errorf("expected Location header of %q; got %q", e, g) - } -} - -func TestInternalRedirect(t *testing.T) { - check(t) - baseHandler := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { - fmt.Fprintf(rw, "basepath=%s\n", req.URL.Path) - fmt.Fprintf(rw, "remoteaddr=%s\n", req.RemoteAddr) - }) - h := &Handler{ - Path: "testdata/test.cgi", - Root: "/test.cgi", - PathLocationHandler: baseHandler, - } - expectedMap := map[string]string{ - "basepath": "/foo", - "remoteaddr": "1.2.3.4", - } - runCgiTest(t, h, "GET /test.cgi?loc=/foo HTTP/1.0\nHost: example.com\n\n", expectedMap) -} - -// TestCopyError tests that we kill the process if there's an error copying -// its output. (for example, from the client having gone away) -func TestCopyError(t *testing.T) { - check(t) - if runtime.GOOS == "windows" { - t.Skipf("skipping test on %q", runtime.GOOS) - } - h := &Handler{ - Path: "testdata/test.cgi", - Root: "/test.cgi", - } - ts := httptest.NewServer(h) - defer ts.Close() - - conn, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatal(err) - } - req, _ := http.NewRequest("GET", "http://example.com/test.cgi?bigresponse=1", nil) - err = req.Write(conn) - if err != nil { - t.Fatalf("Write: %v", err) - } - - res, err := http.ReadResponse(bufio.NewReader(conn), req) - if err != nil { - t.Fatalf("ReadResponse: %v", err) - } - - pidstr := res.Header.Get("X-CGI-Pid") - if pidstr == "" { - t.Fatalf("expected an X-CGI-Pid header in response") - } - pid, err := strconv.Atoi(pidstr) - if err != nil { - t.Fatalf("invalid X-CGI-Pid value") - } - - var buf [5000]byte - n, err := io.ReadFull(res.Body, buf[:]) - if err != nil { - t.Fatalf("ReadFull: %d bytes, %v", n, err) - } - - childRunning := func() bool { - return isProcessRunning(t, pid) - } - - if !childRunning() { - t.Fatalf("pre-conn.Close, expected child to be running") - } - conn.Close() - - tries := 0 - for tries < 25 && childRunning() { - time.Sleep(50 * time.Millisecond * time.Duration(tries)) - tries++ - } - if childRunning() { - t.Fatalf("post-conn.Close, expected child to be gone") - } -} - -func TestDirUnix(t *testing.T) { - check(t) - if runtime.GOOS == "windows" { - t.Skipf("skipping test on %q", runtime.GOOS) - } - cwd, _ := os.Getwd() - h := &Handler{ - Path: "testdata/test.cgi", - Root: "/test.cgi", - Dir: cwd, - } - expectedMap := map[string]string{ - "cwd": cwd, - } - runCgiTest(t, h, "GET /test.cgi HTTP/1.0\nHost: example.com\n\n", expectedMap) - - cwd, _ = os.Getwd() - cwd = filepath.Join(cwd, "testdata") - h = &Handler{ - Path: "testdata/test.cgi", - Root: "/test.cgi", - } - expectedMap = map[string]string{ - "cwd": cwd, - } - runCgiTest(t, h, "GET /test.cgi HTTP/1.0\nHost: example.com\n\n", expectedMap) -} - -func TestDirWindows(t *testing.T) { - if runtime.GOOS != "windows" { - t.Skip("Skipping windows specific test.") - } - - cgifile, _ := filepath.Abs("testdata/test.cgi") - - var perl string - var err error - perl, err = exec.LookPath("perl") - if err != nil { - t.Skip("Skipping test: perl not found.") - } - perl, _ = filepath.Abs(perl) - - cwd, _ := os.Getwd() - h := &Handler{ - Path: perl, - Root: "/test.cgi", - Dir: cwd, - Args: []string{cgifile}, - Env: []string{"SCRIPT_FILENAME=" + cgifile}, - } - expectedMap := map[string]string{ - "cwd": cwd, - } - runCgiTest(t, h, "GET /test.cgi HTTP/1.0\nHost: example.com\n\n", expectedMap) - - // If not specify Dir on windows, working directory should be - // base directory of perl. - cwd, _ = filepath.Split(perl) - if cwd != "" && cwd[len(cwd)-1] == filepath.Separator { - cwd = cwd[:len(cwd)-1] - } - h = &Handler{ - Path: perl, - Root: "/test.cgi", - Args: []string{cgifile}, - Env: []string{"SCRIPT_FILENAME=" + cgifile}, - } - expectedMap = map[string]string{ - "cwd": cwd, - } - runCgiTest(t, h, "GET /test.cgi HTTP/1.0\nHost: example.com\n\n", expectedMap) -} - -func TestEnvOverride(t *testing.T) { - cgifile, _ := filepath.Abs("testdata/test.cgi") - - var perl string - var err error - perl, err = exec.LookPath("perl") - if err != nil { - t.Skipf("Skipping test: perl not found.") - } - perl, _ = filepath.Abs(perl) - - cwd, _ := os.Getwd() - h := &Handler{ - Path: perl, - Root: "/test.cgi", - Dir: cwd, - Args: []string{cgifile}, - Env: []string{ - "SCRIPT_FILENAME=" + cgifile, - "REQUEST_URI=/foo/bar"}, - } - expectedMap := map[string]string{ - "cwd": cwd, - "env-SCRIPT_FILENAME": cgifile, - "env-REQUEST_URI": "/foo/bar", - } - runCgiTest(t, h, "GET /test.cgi HTTP/1.0\nHost: example.com\n\n", expectedMap) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/matryoshka_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/matryoshka_test.go deleted file mode 100644 index 18c4803e71..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/matryoshka_test.go +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Tests a Go CGI program running under a Go CGI host process. -// Further, the two programs are the same binary, just checking -// their environment to figure out what mode to run in. - -package cgi - -import ( - "bytes" - "errors" - "fmt" - "io" - "net/http" - "net/http/httptest" - "os" - "runtime" - "testing" - "time" -) - -// This test is a CGI host (testing host.go) that runs its own binary -// as a child process testing the other half of CGI (child.go). -func TestHostingOurselves(t *testing.T) { - if runtime.GOOS == "nacl" { - t.Skip("skipping on nacl") - } - - h := &Handler{ - Path: os.Args[0], - Root: "/test.go", - Args: []string{"-test.run=TestBeChildCGIProcess"}, - } - expectedMap := map[string]string{ - "test": "Hello CGI-in-CGI", - "param-a": "b", - "param-foo": "bar", - "env-GATEWAY_INTERFACE": "CGI/1.1", - "env-HTTP_HOST": "example.com", - "env-PATH_INFO": "", - "env-QUERY_STRING": "foo=bar&a=b", - "env-REMOTE_ADDR": "1.2.3.4", - "env-REMOTE_HOST": "1.2.3.4", - "env-REQUEST_METHOD": "GET", - "env-REQUEST_URI": "/test.go?foo=bar&a=b", - "env-SCRIPT_FILENAME": os.Args[0], - "env-SCRIPT_NAME": "/test.go", - "env-SERVER_NAME": "example.com", - "env-SERVER_PORT": "80", - "env-SERVER_SOFTWARE": "go", - } - replay := runCgiTest(t, h, "GET /test.go?foo=bar&a=b HTTP/1.0\nHost: example.com\n\n", expectedMap) - - if expected, got := "text/html; charset=utf-8", replay.Header().Get("Content-Type"); got != expected { - t.Errorf("got a Content-Type of %q; expected %q", got, expected) - } - if expected, got := "X-Test-Value", replay.Header().Get("X-Test-Header"); got != expected { - t.Errorf("got a X-Test-Header of %q; expected %q", got, expected) - } -} - -type customWriterRecorder struct { - w io.Writer - *httptest.ResponseRecorder -} - -func (r *customWriterRecorder) Write(p []byte) (n int, err error) { - return r.w.Write(p) -} - -type limitWriter struct { - w io.Writer - n int -} - -func (w *limitWriter) Write(p []byte) (n int, err error) { - if len(p) > w.n { - p = p[:w.n] - } - if len(p) > 0 { - n, err = w.w.Write(p) - w.n -= n - } - if w.n == 0 { - err = errors.New("past write limit") - } - return -} - -// If there's an error copying the child's output to the parent, test -// that we kill the child. -func TestKillChildAfterCopyError(t *testing.T) { - if runtime.GOOS == "nacl" { - t.Skip("skipping on nacl") - } - - defer func() { testHookStartProcess = nil }() - proc := make(chan *os.Process, 1) - testHookStartProcess = func(p *os.Process) { - proc <- p - } - - h := &Handler{ - Path: os.Args[0], - Root: "/test.go", - Args: []string{"-test.run=TestBeChildCGIProcess"}, - } - req, _ := http.NewRequest("GET", "http://example.com/test.cgi?write-forever=1", nil) - rec := httptest.NewRecorder() - var out bytes.Buffer - const writeLen = 50 << 10 - rw := &customWriterRecorder{&limitWriter{&out, writeLen}, rec} - - donec := make(chan bool, 1) - go func() { - h.ServeHTTP(rw, req) - donec <- true - }() - - select { - case <-donec: - if out.Len() != writeLen || out.Bytes()[0] != 'a' { - t.Errorf("unexpected output: %q", out.Bytes()) - } - case <-time.After(5 * time.Second): - t.Errorf("timeout. ServeHTTP hung and didn't kill the child process?") - select { - case p := <-proc: - p.Kill() - t.Logf("killed process") - default: - t.Logf("didn't kill process") - } - } -} - -// Test that a child handler writing only headers works. -// golang.org/issue/7196 -func TestChildOnlyHeaders(t *testing.T) { - if runtime.GOOS == "nacl" { - t.Skip("skipping on nacl") - } - - h := &Handler{ - Path: os.Args[0], - Root: "/test.go", - Args: []string{"-test.run=TestBeChildCGIProcess"}, - } - expectedMap := map[string]string{ - "_body": "", - } - replay := runCgiTest(t, h, "GET /test.go?no-body=1 HTTP/1.0\nHost: example.com\n\n", expectedMap) - if expected, got := "X-Test-Value", replay.Header().Get("X-Test-Header"); got != expected { - t.Errorf("got a X-Test-Header of %q; expected %q", got, expected) - } -} - -// golang.org/issue/7198 -func Test500WithNoHeaders(t *testing.T) { want500Test(t, "/immediate-disconnect") } -func Test500WithNoContentType(t *testing.T) { want500Test(t, "/no-content-type") } -func Test500WithEmptyHeaders(t *testing.T) { want500Test(t, "/empty-headers") } - -func want500Test(t *testing.T, path string) { - h := &Handler{ - Path: os.Args[0], - Root: "/test.go", - Args: []string{"-test.run=TestBeChildCGIProcess"}, - } - expectedMap := map[string]string{ - "_body": "", - } - replay := runCgiTest(t, h, "GET "+path+" HTTP/1.0\nHost: example.com\n\n", expectedMap) - if replay.Code != 500 { - t.Errorf("Got code %d; want 500", replay.Code) - } -} - -type neverEnding byte - -func (b neverEnding) Read(p []byte) (n int, err error) { - for i := range p { - p[i] = byte(b) - } - return len(p), nil -} - -// Note: not actually a test. -func TestBeChildCGIProcess(t *testing.T) { - if os.Getenv("REQUEST_METHOD") == "" { - // Not in a CGI environment; skipping test. - return - } - switch os.Getenv("REQUEST_URI") { - case "/immediate-disconnect": - os.Exit(0) - case "/no-content-type": - fmt.Printf("Content-Length: 6\n\nHello\n") - os.Exit(0) - case "/empty-headers": - fmt.Printf("\nHello") - os.Exit(0) - } - Serve(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { - rw.Header().Set("X-Test-Header", "X-Test-Value") - req.ParseForm() - if req.FormValue("no-body") == "1" { - return - } - if req.FormValue("write-forever") == "1" { - io.Copy(rw, neverEnding('a')) - for { - time.Sleep(5 * time.Second) // hang forever, until killed - } - } - fmt.Fprintf(rw, "test=Hello CGI-in-CGI\n") - for k, vv := range req.Form { - for _, v := range vv { - fmt.Fprintf(rw, "param-%s=%s\n", k, v) - } - } - for _, kv := range os.Environ() { - fmt.Fprintf(rw, "env-%s\n", kv) - } - })) - os.Exit(0) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/plan9_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/plan9_test.go deleted file mode 100644 index c8235831b0..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/plan9_test.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build plan9 - -package cgi - -import ( - "os" - "strconv" - "testing" -) - -func isProcessRunning(t *testing.T, pid int) bool { - _, err := os.Stat("/proc/" + strconv.Itoa(pid)) - return err == nil -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/posix_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/posix_test.go deleted file mode 100644 index 5ff9e7d5eb..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/posix_test.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !plan9 - -package cgi - -import ( - "os" - "syscall" - "testing" -) - -func isProcessRunning(t *testing.T, pid int) bool { - p, err := os.FindProcess(pid) - if err != nil { - return false - } - return p.Signal(syscall.Signal(0)) == nil -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/testdata/test.cgi b/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/testdata/test.cgi deleted file mode 100644 index 3214df6f00..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cgi/testdata/test.cgi +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/perl -# Copyright 2011 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. -# -# Test script run as a child process under cgi_test.go - -use strict; -use Cwd; - -binmode STDOUT; - -my $q = MiniCGI->new; -my $params = $q->Vars; - -if ($params->{"loc"}) { - print "Location: $params->{loc}\r\n\r\n"; - exit(0); -} - -print "Content-Type: text/html\r\n"; -print "X-CGI-Pid: $$\r\n"; -print "X-Test-Header: X-Test-Value\r\n"; -print "\r\n"; - -if ($params->{"bigresponse"}) { - # 17 MB, for OS X: golang.org/issue/4958 - for (1..(17 * 1024)) { - print "A" x 1024, "\r\n"; - } - exit 0; -} - -print "test=Hello CGI\r\n"; - -foreach my $k (sort keys %$params) { - print "param-$k=$params->{$k}\r\n"; -} - -foreach my $k (sort keys %ENV) { - my $clean_env = $ENV{$k}; - $clean_env =~ s/[\n\r]//g; - print "env-$k=$clean_env\r\n"; -} - -# NOTE: msys perl returns /c/go/src/... not C:\go\.... -my $dir = getcwd(); -if ($^O eq 'MSWin32' || $^O eq 'msys') { - if ($dir =~ /^.:/) { - $dir =~ s!/!\\!g; - } else { - my $cmd = $ENV{'COMSPEC'} || 'c:\\windows\\system32\\cmd.exe'; - $cmd =~ s!\\!/!g; - $dir = `$cmd /c cd`; - chomp $dir; - } -} -print "cwd=$dir\r\n"; - -# A minimal version of CGI.pm, for people without the perl-modules -# package installed. (CGI.pm used to be part of the Perl core, but -# some distros now bundle perl-base and perl-modules separately...) -package MiniCGI; - -sub new { - my $class = shift; - return bless {}, $class; -} - -sub Vars { - my $self = shift; - my $pairs; - if ($ENV{CONTENT_LENGTH}) { - $pairs = do { local $/; }; - } else { - $pairs = $ENV{QUERY_STRING}; - } - my $vars = {}; - foreach my $kv (split(/&/, $pairs)) { - my ($k, $v) = split(/=/, $kv, 2); - $vars->{_urldecode($k)} = _urldecode($v); - } - return $vars; -} - -sub _urldecode { - my $v = shift; - $v =~ tr/+/ /; - $v =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; - return $v; -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/chunked_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/chunked_test.go deleted file mode 100644 index 34544790af..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/chunked_test.go +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This code is duplicated in net/http and net/http/httputil. -// Please make any changes in both files. - -package http - -import ( - "bufio" - "bytes" - "fmt" - "io" - "io/ioutil" - "strings" - "testing" -) - -func TestChunk(t *testing.T) { - var b bytes.Buffer - - w := newChunkedWriter(&b) - const chunk1 = "hello, " - const chunk2 = "world! 0123456789abcdef" - w.Write([]byte(chunk1)) - w.Write([]byte(chunk2)) - w.Close() - - if g, e := b.String(), "7\r\nhello, \r\n17\r\nworld! 0123456789abcdef\r\n0\r\n"; g != e { - t.Fatalf("chunk writer wrote %q; want %q", g, e) - } - - r := newChunkedReader(&b) - data, err := ioutil.ReadAll(r) - if err != nil { - t.Logf(`data: "%s"`, data) - t.Fatalf("ReadAll from reader: %v", err) - } - if g, e := string(data), chunk1+chunk2; g != e { - t.Errorf("chunk reader read %q; want %q", g, e) - } -} - -func TestChunkReadMultiple(t *testing.T) { - // Bunch of small chunks, all read together. - { - var b bytes.Buffer - w := newChunkedWriter(&b) - w.Write([]byte("foo")) - w.Write([]byte("bar")) - w.Close() - - r := newChunkedReader(&b) - buf := make([]byte, 10) - n, err := r.Read(buf) - if n != 6 || err != io.EOF { - t.Errorf("Read = %d, %v; want 6, EOF", n, err) - } - buf = buf[:n] - if string(buf) != "foobar" { - t.Errorf("Read = %q; want %q", buf, "foobar") - } - } - - // One big chunk followed by a little chunk, but the small bufio.Reader size - // should prevent the second chunk header from being read. - { - var b bytes.Buffer - w := newChunkedWriter(&b) - // fillBufChunk is 11 bytes + 3 bytes header + 2 bytes footer = 16 bytes, - // the same as the bufio ReaderSize below (the minimum), so even - // though we're going to try to Read with a buffer larger enough to also - // receive "foo", the second chunk header won't be read yet. - const fillBufChunk = "0123456789a" - const shortChunk = "foo" - w.Write([]byte(fillBufChunk)) - w.Write([]byte(shortChunk)) - w.Close() - - r := newChunkedReader(bufio.NewReaderSize(&b, 16)) - buf := make([]byte, len(fillBufChunk)+len(shortChunk)) - n, err := r.Read(buf) - if n != len(fillBufChunk) || err != nil { - t.Errorf("Read = %d, %v; want %d, nil", n, err, len(fillBufChunk)) - } - buf = buf[:n] - if string(buf) != fillBufChunk { - t.Errorf("Read = %q; want %q", buf, fillBufChunk) - } - - n, err = r.Read(buf) - if n != len(shortChunk) || err != io.EOF { - t.Errorf("Read = %d, %v; want %d, EOF", n, err, len(shortChunk)) - } - } - - // And test that we see an EOF chunk, even though our buffer is already full: - { - r := newChunkedReader(bufio.NewReader(strings.NewReader("3\r\nfoo\r\n0\r\n"))) - buf := make([]byte, 3) - n, err := r.Read(buf) - if n != 3 || err != io.EOF { - t.Errorf("Read = %d, %v; want 3, EOF", n, err) - } - if string(buf) != "foo" { - t.Errorf("buf = %q; want foo", buf) - } - } -} - -func TestChunkReaderAllocs(t *testing.T) { - if testing.Short() { - t.Skip("skipping in short mode") - } - var buf bytes.Buffer - w := newChunkedWriter(&buf) - a, b, c := []byte("aaaaaa"), []byte("bbbbbbbbbbbb"), []byte("cccccccccccccccccccccccc") - w.Write(a) - w.Write(b) - w.Write(c) - w.Close() - - readBuf := make([]byte, len(a)+len(b)+len(c)+1) - byter := bytes.NewReader(buf.Bytes()) - bufr := bufio.NewReader(byter) - mallocs := testing.AllocsPerRun(100, func() { - byter.Seek(0, 0) - bufr.Reset(byter) - r := newChunkedReader(bufr) - n, err := io.ReadFull(r, readBuf) - if n != len(readBuf)-1 { - t.Fatalf("read %d bytes; want %d", n, len(readBuf)-1) - } - if err != io.ErrUnexpectedEOF { - t.Fatalf("read error = %v; want ErrUnexpectedEOF", err) - } - }) - if mallocs > 1.5 { - t.Errorf("mallocs = %v; want 1", mallocs) - } -} - -func TestParseHexUint(t *testing.T) { - for i := uint64(0); i <= 1234; i++ { - line := []byte(fmt.Sprintf("%x", i)) - got, err := parseHexUint(line) - if err != nil { - t.Fatalf("on %d: %v", i, err) - } - if got != i { - t.Errorf("for input %q = %d; want %d", line, got, i) - } - } - _, err := parseHexUint([]byte("bogus")) - if err == nil { - t.Error("expected error on bogus input") - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/client_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/client_test.go deleted file mode 100644 index 6392c1baf3..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/client_test.go +++ /dev/null @@ -1,1038 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Tests for client.go - -package http_test - -import ( - "bytes" - "crypto/tls" - "crypto/x509" - "encoding/base64" - "errors" - "fmt" - "io" - "io/ioutil" - "log" - "net" - . "net/http" - "net/http/httptest" - "net/url" - "reflect" - "sort" - "strconv" - "strings" - "sync" - "testing" - "time" -) - -var robotsTxtHandler = HandlerFunc(func(w ResponseWriter, r *Request) { - w.Header().Set("Last-Modified", "sometime") - fmt.Fprintf(w, "User-agent: go\nDisallow: /something/") -}) - -// pedanticReadAll works like ioutil.ReadAll but additionally -// verifies that r obeys the documented io.Reader contract. -func pedanticReadAll(r io.Reader) (b []byte, err error) { - var bufa [64]byte - buf := bufa[:] - for { - n, err := r.Read(buf) - if n == 0 && err == nil { - return nil, fmt.Errorf("Read: n=0 with err=nil") - } - b = append(b, buf[:n]...) - if err == io.EOF { - n, err := r.Read(buf) - if n != 0 || err != io.EOF { - return nil, fmt.Errorf("Read: n=%d err=%#v after EOF", n, err) - } - return b, nil - } - if err != nil { - return b, err - } - } -} - -type chanWriter chan string - -func (w chanWriter) Write(p []byte) (n int, err error) { - w <- string(p) - return len(p), nil -} - -func TestClient(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(robotsTxtHandler) - defer ts.Close() - - r, err := Get(ts.URL) - var b []byte - if err == nil { - b, err = pedanticReadAll(r.Body) - r.Body.Close() - } - if err != nil { - t.Error(err) - } else if s := string(b); !strings.HasPrefix(s, "User-agent:") { - t.Errorf("Incorrect page body (did not begin with User-agent): %q", s) - } -} - -func TestClientHead(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(robotsTxtHandler) - defer ts.Close() - - r, err := Head(ts.URL) - if err != nil { - t.Fatal(err) - } - if _, ok := r.Header["Last-Modified"]; !ok { - t.Error("Last-Modified header not found.") - } -} - -type recordingTransport struct { - req *Request -} - -func (t *recordingTransport) RoundTrip(req *Request) (resp *Response, err error) { - t.req = req - return nil, errors.New("dummy impl") -} - -func TestGetRequestFormat(t *testing.T) { - defer afterTest(t) - tr := &recordingTransport{} - client := &Client{Transport: tr} - url := "http://dummy.faketld/" - client.Get(url) // Note: doesn't hit network - if tr.req.Method != "GET" { - t.Errorf("expected method %q; got %q", "GET", tr.req.Method) - } - if tr.req.URL.String() != url { - t.Errorf("expected URL %q; got %q", url, tr.req.URL.String()) - } - if tr.req.Header == nil { - t.Errorf("expected non-nil request Header") - } -} - -func TestPostRequestFormat(t *testing.T) { - defer afterTest(t) - tr := &recordingTransport{} - client := &Client{Transport: tr} - - url := "http://dummy.faketld/" - json := `{"key":"value"}` - b := strings.NewReader(json) - client.Post(url, "application/json", b) // Note: doesn't hit network - - if tr.req.Method != "POST" { - t.Errorf("got method %q, want %q", tr.req.Method, "POST") - } - if tr.req.URL.String() != url { - t.Errorf("got URL %q, want %q", tr.req.URL.String(), url) - } - if tr.req.Header == nil { - t.Fatalf("expected non-nil request Header") - } - if tr.req.Close { - t.Error("got Close true, want false") - } - if g, e := tr.req.ContentLength, int64(len(json)); g != e { - t.Errorf("got ContentLength %d, want %d", g, e) - } -} - -func TestPostFormRequestFormat(t *testing.T) { - defer afterTest(t) - tr := &recordingTransport{} - client := &Client{Transport: tr} - - urlStr := "http://dummy.faketld/" - form := make(url.Values) - form.Set("foo", "bar") - form.Add("foo", "bar2") - form.Set("bar", "baz") - client.PostForm(urlStr, form) // Note: doesn't hit network - - if tr.req.Method != "POST" { - t.Errorf("got method %q, want %q", tr.req.Method, "POST") - } - if tr.req.URL.String() != urlStr { - t.Errorf("got URL %q, want %q", tr.req.URL.String(), urlStr) - } - if tr.req.Header == nil { - t.Fatalf("expected non-nil request Header") - } - if g, e := tr.req.Header.Get("Content-Type"), "application/x-www-form-urlencoded"; g != e { - t.Errorf("got Content-Type %q, want %q", g, e) - } - if tr.req.Close { - t.Error("got Close true, want false") - } - // Depending on map iteration, body can be either of these. - expectedBody := "foo=bar&foo=bar2&bar=baz" - expectedBody1 := "bar=baz&foo=bar&foo=bar2" - if g, e := tr.req.ContentLength, int64(len(expectedBody)); g != e { - t.Errorf("got ContentLength %d, want %d", g, e) - } - bodyb, err := ioutil.ReadAll(tr.req.Body) - if err != nil { - t.Fatalf("ReadAll on req.Body: %v", err) - } - if g := string(bodyb); g != expectedBody && g != expectedBody1 { - t.Errorf("got body %q, want %q or %q", g, expectedBody, expectedBody1) - } -} - -func TestClientRedirects(t *testing.T) { - defer afterTest(t) - var ts *httptest.Server - ts = httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - n, _ := strconv.Atoi(r.FormValue("n")) - // Test Referer header. (7 is arbitrary position to test at) - if n == 7 { - if g, e := r.Referer(), ts.URL+"/?n=6"; e != g { - t.Errorf("on request ?n=7, expected referer of %q; got %q", e, g) - } - } - if n < 15 { - Redirect(w, r, fmt.Sprintf("/?n=%d", n+1), StatusFound) - return - } - fmt.Fprintf(w, "n=%d", n) - })) - defer ts.Close() - - c := &Client{} - _, err := c.Get(ts.URL) - if e, g := "Get /?n=10: stopped after 10 redirects", fmt.Sprintf("%v", err); e != g { - t.Errorf("with default client Get, expected error %q, got %q", e, g) - } - - // HEAD request should also have the ability to follow redirects. - _, err = c.Head(ts.URL) - if e, g := "Head /?n=10: stopped after 10 redirects", fmt.Sprintf("%v", err); e != g { - t.Errorf("with default client Head, expected error %q, got %q", e, g) - } - - // Do should also follow redirects. - greq, _ := NewRequest("GET", ts.URL, nil) - _, err = c.Do(greq) - if e, g := "Get /?n=10: stopped after 10 redirects", fmt.Sprintf("%v", err); e != g { - t.Errorf("with default client Do, expected error %q, got %q", e, g) - } - - var checkErr error - var lastVia []*Request - c = &Client{CheckRedirect: func(_ *Request, via []*Request) error { - lastVia = via - return checkErr - }} - res, err := c.Get(ts.URL) - if err != nil { - t.Fatalf("Get error: %v", err) - } - res.Body.Close() - finalUrl := res.Request.URL.String() - if e, g := "", fmt.Sprintf("%v", err); e != g { - t.Errorf("with custom client, expected error %q, got %q", e, g) - } - if !strings.HasSuffix(finalUrl, "/?n=15") { - t.Errorf("expected final url to end in /?n=15; got url %q", finalUrl) - } - if e, g := 15, len(lastVia); e != g { - t.Errorf("expected lastVia to have contained %d elements; got %d", e, g) - } - - checkErr = errors.New("no redirects allowed") - res, err = c.Get(ts.URL) - if urlError, ok := err.(*url.Error); !ok || urlError.Err != checkErr { - t.Errorf("with redirects forbidden, expected a *url.Error with our 'no redirects allowed' error inside; got %#v (%q)", err, err) - } - if res == nil { - t.Fatalf("Expected a non-nil Response on CheckRedirect failure (http://golang.org/issue/3795)") - } - res.Body.Close() - if res.Header.Get("Location") == "" { - t.Errorf("no Location header in Response") - } -} - -func TestPostRedirects(t *testing.T) { - defer afterTest(t) - var log struct { - sync.Mutex - bytes.Buffer - } - var ts *httptest.Server - ts = httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - log.Lock() - fmt.Fprintf(&log.Buffer, "%s %s ", r.Method, r.RequestURI) - log.Unlock() - if v := r.URL.Query().Get("code"); v != "" { - code, _ := strconv.Atoi(v) - if code/100 == 3 { - w.Header().Set("Location", ts.URL) - } - w.WriteHeader(code) - } - })) - defer ts.Close() - tests := []struct { - suffix string - want int // response code - }{ - {"/", 200}, - {"/?code=301", 301}, - {"/?code=302", 200}, - {"/?code=303", 200}, - {"/?code=404", 404}, - } - for _, tt := range tests { - res, err := Post(ts.URL+tt.suffix, "text/plain", strings.NewReader("Some content")) - if err != nil { - t.Fatal(err) - } - if res.StatusCode != tt.want { - t.Errorf("POST %s: status code = %d; want %d", tt.suffix, res.StatusCode, tt.want) - } - } - log.Lock() - got := log.String() - log.Unlock() - want := "POST / POST /?code=301 POST /?code=302 GET / POST /?code=303 GET / POST /?code=404 " - if got != want { - t.Errorf("Log differs.\n Got: %q\nWant: %q", got, want) - } -} - -var expectedCookies = []*Cookie{ - {Name: "ChocolateChip", Value: "tasty"}, - {Name: "First", Value: "Hit"}, - {Name: "Second", Value: "Hit"}, -} - -var echoCookiesRedirectHandler = HandlerFunc(func(w ResponseWriter, r *Request) { - for _, cookie := range r.Cookies() { - SetCookie(w, cookie) - } - if r.URL.Path == "/" { - SetCookie(w, expectedCookies[1]) - Redirect(w, r, "/second", StatusMovedPermanently) - } else { - SetCookie(w, expectedCookies[2]) - w.Write([]byte("hello")) - } -}) - -func TestClientSendsCookieFromJar(t *testing.T) { - tr := &recordingTransport{} - client := &Client{Transport: tr} - client.Jar = &TestJar{perURL: make(map[string][]*Cookie)} - us := "http://dummy.faketld/" - u, _ := url.Parse(us) - client.Jar.SetCookies(u, expectedCookies) - - client.Get(us) // Note: doesn't hit network - matchReturnedCookies(t, expectedCookies, tr.req.Cookies()) - - client.Head(us) // Note: doesn't hit network - matchReturnedCookies(t, expectedCookies, tr.req.Cookies()) - - client.Post(us, "text/plain", strings.NewReader("body")) // Note: doesn't hit network - matchReturnedCookies(t, expectedCookies, tr.req.Cookies()) - - client.PostForm(us, url.Values{}) // Note: doesn't hit network - matchReturnedCookies(t, expectedCookies, tr.req.Cookies()) - - req, _ := NewRequest("GET", us, nil) - client.Do(req) // Note: doesn't hit network - matchReturnedCookies(t, expectedCookies, tr.req.Cookies()) - - req, _ = NewRequest("POST", us, nil) - client.Do(req) // Note: doesn't hit network - matchReturnedCookies(t, expectedCookies, tr.req.Cookies()) -} - -// Just enough correctness for our redirect tests. Uses the URL.Host as the -// scope of all cookies. -type TestJar struct { - m sync.Mutex - perURL map[string][]*Cookie -} - -func (j *TestJar) SetCookies(u *url.URL, cookies []*Cookie) { - j.m.Lock() - defer j.m.Unlock() - if j.perURL == nil { - j.perURL = make(map[string][]*Cookie) - } - j.perURL[u.Host] = cookies -} - -func (j *TestJar) Cookies(u *url.URL) []*Cookie { - j.m.Lock() - defer j.m.Unlock() - return j.perURL[u.Host] -} - -func TestRedirectCookiesJar(t *testing.T) { - defer afterTest(t) - var ts *httptest.Server - ts = httptest.NewServer(echoCookiesRedirectHandler) - defer ts.Close() - c := &Client{ - Jar: new(TestJar), - } - u, _ := url.Parse(ts.URL) - c.Jar.SetCookies(u, []*Cookie{expectedCookies[0]}) - resp, err := c.Get(ts.URL) - if err != nil { - t.Fatalf("Get: %v", err) - } - resp.Body.Close() - matchReturnedCookies(t, expectedCookies, resp.Cookies()) -} - -func matchReturnedCookies(t *testing.T, expected, given []*Cookie) { - if len(given) != len(expected) { - t.Logf("Received cookies: %v", given) - t.Errorf("Expected %d cookies, got %d", len(expected), len(given)) - } - for _, ec := range expected { - foundC := false - for _, c := range given { - if ec.Name == c.Name && ec.Value == c.Value { - foundC = true - break - } - } - if !foundC { - t.Errorf("Missing cookie %v", ec) - } - } -} - -func TestJarCalls(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - pathSuffix := r.RequestURI[1:] - if r.RequestURI == "/nosetcookie" { - return // dont set cookies for this path - } - SetCookie(w, &Cookie{Name: "name" + pathSuffix, Value: "val" + pathSuffix}) - if r.RequestURI == "/" { - Redirect(w, r, "http://secondhost.fake/secondpath", 302) - } - })) - defer ts.Close() - jar := new(RecordingJar) - c := &Client{ - Jar: jar, - Transport: &Transport{ - Dial: func(_ string, _ string) (net.Conn, error) { - return net.Dial("tcp", ts.Listener.Addr().String()) - }, - }, - } - _, err := c.Get("http://firsthost.fake/") - if err != nil { - t.Fatal(err) - } - _, err = c.Get("http://firsthost.fake/nosetcookie") - if err != nil { - t.Fatal(err) - } - got := jar.log.String() - want := `Cookies("http://firsthost.fake/") -SetCookie("http://firsthost.fake/", [name=val]) -Cookies("http://secondhost.fake/secondpath") -SetCookie("http://secondhost.fake/secondpath", [namesecondpath=valsecondpath]) -Cookies("http://firsthost.fake/nosetcookie") -` - if got != want { - t.Errorf("Got Jar calls:\n%s\nWant:\n%s", got, want) - } -} - -// RecordingJar keeps a log of calls made to it, without -// tracking any cookies. -type RecordingJar struct { - mu sync.Mutex - log bytes.Buffer -} - -func (j *RecordingJar) SetCookies(u *url.URL, cookies []*Cookie) { - j.logf("SetCookie(%q, %v)\n", u, cookies) -} - -func (j *RecordingJar) Cookies(u *url.URL) []*Cookie { - j.logf("Cookies(%q)\n", u) - return nil -} - -func (j *RecordingJar) logf(format string, args ...interface{}) { - j.mu.Lock() - defer j.mu.Unlock() - fmt.Fprintf(&j.log, format, args...) -} - -func TestStreamingGet(t *testing.T) { - defer afterTest(t) - say := make(chan string) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - w.(Flusher).Flush() - for str := range say { - w.Write([]byte(str)) - w.(Flusher).Flush() - } - })) - defer ts.Close() - - c := &Client{} - res, err := c.Get(ts.URL) - if err != nil { - t.Fatal(err) - } - var buf [10]byte - for _, str := range []string{"i", "am", "also", "known", "as", "comet"} { - say <- str - n, err := io.ReadFull(res.Body, buf[0:len(str)]) - if err != nil { - t.Fatalf("ReadFull on %q: %v", str, err) - } - if n != len(str) { - t.Fatalf("Receiving %q, only read %d bytes", str, n) - } - got := string(buf[0:n]) - if got != str { - t.Fatalf("Expected %q, got %q", str, got) - } - } - close(say) - _, err = io.ReadFull(res.Body, buf[0:1]) - if err != io.EOF { - t.Fatalf("at end expected EOF, got %v", err) - } -} - -type writeCountingConn struct { - net.Conn - count *int -} - -func (c *writeCountingConn) Write(p []byte) (int, error) { - *c.count++ - return c.Conn.Write(p) -} - -// TestClientWrites verifies that client requests are buffered and we -// don't send a TCP packet per line of the http request + body. -func TestClientWrites(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - })) - defer ts.Close() - - writes := 0 - dialer := func(netz string, addr string) (net.Conn, error) { - c, err := net.Dial(netz, addr) - if err == nil { - c = &writeCountingConn{c, &writes} - } - return c, err - } - c := &Client{Transport: &Transport{Dial: dialer}} - - _, err := c.Get(ts.URL) - if err != nil { - t.Fatal(err) - } - if writes != 1 { - t.Errorf("Get request did %d Write calls, want 1", writes) - } - - writes = 0 - _, err = c.PostForm(ts.URL, url.Values{"foo": {"bar"}}) - if err != nil { - t.Fatal(err) - } - if writes != 1 { - t.Errorf("Post request did %d Write calls, want 1", writes) - } -} - -func TestClientInsecureTransport(t *testing.T) { - defer afterTest(t) - ts := httptest.NewTLSServer(HandlerFunc(func(w ResponseWriter, r *Request) { - w.Write([]byte("Hello")) - })) - errc := make(chanWriter, 10) // but only expecting 1 - ts.Config.ErrorLog = log.New(errc, "", 0) - defer ts.Close() - - // TODO(bradfitz): add tests for skipping hostname checks too? - // would require a new cert for testing, and probably - // redundant with these tests. - for _, insecure := range []bool{true, false} { - tr := &Transport{ - TLSClientConfig: &tls.Config{ - InsecureSkipVerify: insecure, - }, - } - defer tr.CloseIdleConnections() - c := &Client{Transport: tr} - res, err := c.Get(ts.URL) - if (err == nil) != insecure { - t.Errorf("insecure=%v: got unexpected err=%v", insecure, err) - } - if res != nil { - res.Body.Close() - } - } - - select { - case v := <-errc: - if !strings.Contains(v, "TLS handshake error") { - t.Errorf("expected an error log message containing 'TLS handshake error'; got %q", v) - } - case <-time.After(5 * time.Second): - t.Errorf("timeout waiting for logged error") - } - -} - -func TestClientErrorWithRequestURI(t *testing.T) { - defer afterTest(t) - req, _ := NewRequest("GET", "http://localhost:1234/", nil) - req.RequestURI = "/this/field/is/illegal/and/should/error/" - _, err := DefaultClient.Do(req) - if err == nil { - t.Fatalf("expected an error") - } - if !strings.Contains(err.Error(), "RequestURI") { - t.Errorf("wanted error mentioning RequestURI; got error: %v", err) - } -} - -func newTLSTransport(t *testing.T, ts *httptest.Server) *Transport { - certs := x509.NewCertPool() - for _, c := range ts.TLS.Certificates { - roots, err := x509.ParseCertificates(c.Certificate[len(c.Certificate)-1]) - if err != nil { - t.Fatalf("error parsing server's root cert: %v", err) - } - for _, root := range roots { - certs.AddCert(root) - } - } - return &Transport{ - TLSClientConfig: &tls.Config{RootCAs: certs}, - } -} - -func TestClientWithCorrectTLSServerName(t *testing.T) { - defer afterTest(t) - ts := httptest.NewTLSServer(HandlerFunc(func(w ResponseWriter, r *Request) { - if r.TLS.ServerName != "127.0.0.1" { - t.Errorf("expected client to set ServerName 127.0.0.1, got: %q", r.TLS.ServerName) - } - })) - defer ts.Close() - - c := &Client{Transport: newTLSTransport(t, ts)} - if _, err := c.Get(ts.URL); err != nil { - t.Fatalf("expected successful TLS connection, got error: %v", err) - } -} - -func TestClientWithIncorrectTLSServerName(t *testing.T) { - defer afterTest(t) - ts := httptest.NewTLSServer(HandlerFunc(func(w ResponseWriter, r *Request) {})) - defer ts.Close() - errc := make(chanWriter, 10) // but only expecting 1 - ts.Config.ErrorLog = log.New(errc, "", 0) - - trans := newTLSTransport(t, ts) - trans.TLSClientConfig.ServerName = "badserver" - c := &Client{Transport: trans} - _, err := c.Get(ts.URL) - if err == nil { - t.Fatalf("expected an error") - } - if !strings.Contains(err.Error(), "127.0.0.1") || !strings.Contains(err.Error(), "badserver") { - t.Errorf("wanted error mentioning 127.0.0.1 and badserver; got error: %v", err) - } - select { - case v := <-errc: - if !strings.Contains(v, "TLS handshake error") { - t.Errorf("expected an error log message containing 'TLS handshake error'; got %q", v) - } - case <-time.After(5 * time.Second): - t.Errorf("timeout waiting for logged error") - } -} - -// Test for golang.org/issue/5829; the Transport should respect TLSClientConfig.ServerName -// when not empty. -// -// tls.Config.ServerName (non-empty, set to "example.com") takes -// precedence over "some-other-host.tld" which previously incorrectly -// took precedence. We don't actually connect to (or even resolve) -// "some-other-host.tld", though, because of the Transport.Dial hook. -// -// The httptest.Server has a cert with "example.com" as its name. -func TestTransportUsesTLSConfigServerName(t *testing.T) { - defer afterTest(t) - ts := httptest.NewTLSServer(HandlerFunc(func(w ResponseWriter, r *Request) { - w.Write([]byte("Hello")) - })) - defer ts.Close() - - tr := newTLSTransport(t, ts) - tr.TLSClientConfig.ServerName = "example.com" // one of httptest's Server cert names - tr.Dial = func(netw, addr string) (net.Conn, error) { - return net.Dial(netw, ts.Listener.Addr().String()) - } - defer tr.CloseIdleConnections() - c := &Client{Transport: tr} - res, err := c.Get("https://some-other-host.tld/") - if err != nil { - t.Fatal(err) - } - res.Body.Close() -} - -func TestResponseSetsTLSConnectionState(t *testing.T) { - defer afterTest(t) - ts := httptest.NewTLSServer(HandlerFunc(func(w ResponseWriter, r *Request) { - w.Write([]byte("Hello")) - })) - defer ts.Close() - - tr := newTLSTransport(t, ts) - tr.TLSClientConfig.CipherSuites = []uint16{tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA} - tr.Dial = func(netw, addr string) (net.Conn, error) { - return net.Dial(netw, ts.Listener.Addr().String()) - } - defer tr.CloseIdleConnections() - c := &Client{Transport: tr} - res, err := c.Get("https://example.com/") - if err != nil { - t.Fatal(err) - } - defer res.Body.Close() - if res.TLS == nil { - t.Fatal("Response didn't set TLS Connection State.") - } - if got, want := res.TLS.CipherSuite, tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA; got != want { - t.Errorf("TLS Cipher Suite = %d; want %d", got, want) - } -} - -// Verify Response.ContentLength is populated. http://golang.org/issue/4126 -func TestClientHeadContentLength(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - if v := r.FormValue("cl"); v != "" { - w.Header().Set("Content-Length", v) - } - })) - defer ts.Close() - tests := []struct { - suffix string - want int64 - }{ - {"/?cl=1234", 1234}, - {"/?cl=0", 0}, - {"", -1}, - } - for _, tt := range tests { - req, _ := NewRequest("HEAD", ts.URL+tt.suffix, nil) - res, err := DefaultClient.Do(req) - if err != nil { - t.Fatal(err) - } - if res.ContentLength != tt.want { - t.Errorf("Content-Length = %d; want %d", res.ContentLength, tt.want) - } - bs, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatal(err) - } - if len(bs) != 0 { - t.Errorf("Unexpected content: %q", bs) - } - } -} - -func TestEmptyPasswordAuth(t *testing.T) { - defer afterTest(t) - gopher := "gopher" - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - auth := r.Header.Get("Authorization") - if strings.HasPrefix(auth, "Basic ") { - encoded := auth[6:] - decoded, err := base64.StdEncoding.DecodeString(encoded) - if err != nil { - t.Fatal(err) - } - expected := gopher + ":" - s := string(decoded) - if expected != s { - t.Errorf("Invalid Authorization header. Got %q, wanted %q", s, expected) - } - } else { - t.Errorf("Invalid auth %q", auth) - } - })) - defer ts.Close() - c := &Client{} - req, err := NewRequest("GET", ts.URL, nil) - if err != nil { - t.Fatal(err) - } - req.URL.User = url.User(gopher) - resp, err := c.Do(req) - if err != nil { - t.Fatal(err) - } - defer resp.Body.Close() -} - -func TestBasicAuth(t *testing.T) { - defer afterTest(t) - tr := &recordingTransport{} - client := &Client{Transport: tr} - - url := "http://My%20User:My%20Pass@dummy.faketld/" - expected := "My User:My Pass" - client.Get(url) - - if tr.req.Method != "GET" { - t.Errorf("got method %q, want %q", tr.req.Method, "GET") - } - if tr.req.URL.String() != url { - t.Errorf("got URL %q, want %q", tr.req.URL.String(), url) - } - if tr.req.Header == nil { - t.Fatalf("expected non-nil request Header") - } - auth := tr.req.Header.Get("Authorization") - if strings.HasPrefix(auth, "Basic ") { - encoded := auth[6:] - decoded, err := base64.StdEncoding.DecodeString(encoded) - if err != nil { - t.Fatal(err) - } - s := string(decoded) - if expected != s { - t.Errorf("Invalid Authorization header. Got %q, wanted %q", s, expected) - } - } else { - t.Errorf("Invalid auth %q", auth) - } -} - -func TestClientTimeout(t *testing.T) { - if testing.Short() { - t.Skip("skipping in short mode") - } - defer afterTest(t) - sawRoot := make(chan bool, 1) - sawSlow := make(chan bool, 1) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - if r.URL.Path == "/" { - sawRoot <- true - Redirect(w, r, "/slow", StatusFound) - return - } - if r.URL.Path == "/slow" { - w.Write([]byte("Hello")) - w.(Flusher).Flush() - sawSlow <- true - time.Sleep(2 * time.Second) - return - } - })) - defer ts.Close() - const timeout = 500 * time.Millisecond - c := &Client{ - Timeout: timeout, - } - - res, err := c.Get(ts.URL) - if err != nil { - t.Fatal(err) - } - - select { - case <-sawRoot: - // good. - default: - t.Fatal("handler never got / request") - } - - select { - case <-sawSlow: - // good. - default: - t.Fatal("handler never got /slow request") - } - - errc := make(chan error, 1) - go func() { - _, err := ioutil.ReadAll(res.Body) - errc <- err - res.Body.Close() - }() - - const failTime = timeout * 2 - select { - case err := <-errc: - if err == nil { - t.Error("expected error from ReadAll") - } - // Expected error. - case <-time.After(failTime): - t.Errorf("timeout after %v waiting for timeout of %v", failTime, timeout) - } -} - -func TestClientRedirectEatsBody(t *testing.T) { - defer afterTest(t) - saw := make(chan string, 2) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - saw <- r.RemoteAddr - if r.URL.Path == "/" { - Redirect(w, r, "/foo", StatusFound) // which includes a body - } - })) - defer ts.Close() - - res, err := Get(ts.URL) - if err != nil { - t.Fatal(err) - } - _, err = ioutil.ReadAll(res.Body) - if err != nil { - t.Fatal(err) - } - res.Body.Close() - - var first string - select { - case first = <-saw: - default: - t.Fatal("server didn't see a request") - } - - var second string - select { - case second = <-saw: - default: - t.Fatal("server didn't see a second request") - } - - if first != second { - t.Fatal("server saw different client ports before & after the redirect") - } -} - -// eofReaderFunc is an io.Reader that runs itself, and then returns io.EOF. -type eofReaderFunc func() - -func (f eofReaderFunc) Read(p []byte) (n int, err error) { - f() - return 0, io.EOF -} - -func TestClientTrailers(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - w.Header().Set("Connection", "close") - w.Header().Set("Trailer", "Server-Trailer-A, Server-Trailer-B") - w.Header().Add("Trailer", "Server-Trailer-C") - - var decl []string - for k := range r.Trailer { - decl = append(decl, k) - } - sort.Strings(decl) - - slurp, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Errorf("Server reading request body: %v", err) - } - if string(slurp) != "foo" { - t.Errorf("Server read request body %q; want foo", slurp) - } - if r.Trailer == nil { - io.WriteString(w, "nil Trailer") - } else { - fmt.Fprintf(w, "decl: %v, vals: %s, %s", - decl, - r.Trailer.Get("Client-Trailer-A"), - r.Trailer.Get("Client-Trailer-B")) - } - - // TODO: golang.org/issue/7759: there's no way yet for - // the server to set trailers without hijacking, so do - // that for now, just to test the client. Later, in - // Go 1.4, it should be implicit that any mutations - // to w.Header() after the initial write are the - // trailers to be sent, if and only if they were - // previously declared with w.Header().Set("Trailer", - // ..keys..) - w.(Flusher).Flush() - conn, buf, _ := w.(Hijacker).Hijack() - t := Header{} - t.Set("Server-Trailer-A", "valuea") - t.Set("Server-Trailer-C", "valuec") // skipping B - buf.WriteString("0\r\n") // eof - t.Write(buf) - buf.WriteString("\r\n") // end of trailers - buf.Flush() - conn.Close() - })) - defer ts.Close() - - var req *Request - req, _ = NewRequest("POST", ts.URL, io.MultiReader( - eofReaderFunc(func() { - req.Trailer["Client-Trailer-A"] = []string{"valuea"} - }), - strings.NewReader("foo"), - eofReaderFunc(func() { - req.Trailer["Client-Trailer-B"] = []string{"valueb"} - }), - )) - req.Trailer = Header{ - "Client-Trailer-A": nil, // to be set later - "Client-Trailer-B": nil, // to be set later - } - req.ContentLength = -1 - res, err := DefaultClient.Do(req) - if err != nil { - t.Fatal(err) - } - if err := wantBody(res, err, "decl: [Client-Trailer-A Client-Trailer-B], vals: valuea, valueb"); err != nil { - t.Error(err) - } - want := Header{ - "Server-Trailer-A": []string{"valuea"}, - "Server-Trailer-B": nil, - "Server-Trailer-C": []string{"valuec"}, - } - if !reflect.DeepEqual(res.Trailer, want) { - t.Errorf("Response trailers = %#v; want %#v", res.Trailer, want) - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cookie_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/cookie_test.go deleted file mode 100644 index f78f37299f..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cookie_test.go +++ /dev/null @@ -1,380 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http - -import ( - "bytes" - "encoding/json" - "fmt" - "log" - "os" - "reflect" - "strings" - "testing" - "time" -) - -var writeSetCookiesTests = []struct { - Cookie *Cookie - Raw string -}{ - { - &Cookie{Name: "cookie-1", Value: "v$1"}, - "cookie-1=v$1", - }, - { - &Cookie{Name: "cookie-2", Value: "two", MaxAge: 3600}, - "cookie-2=two; Max-Age=3600", - }, - { - &Cookie{Name: "cookie-3", Value: "three", Domain: ".example.com"}, - "cookie-3=three; Domain=example.com", - }, - { - &Cookie{Name: "cookie-4", Value: "four", Path: "/restricted/"}, - "cookie-4=four; Path=/restricted/", - }, - { - &Cookie{Name: "cookie-5", Value: "five", Domain: "wrong;bad.abc"}, - "cookie-5=five", - }, - { - &Cookie{Name: "cookie-6", Value: "six", Domain: "bad-.abc"}, - "cookie-6=six", - }, - { - &Cookie{Name: "cookie-7", Value: "seven", Domain: "127.0.0.1"}, - "cookie-7=seven; Domain=127.0.0.1", - }, - { - &Cookie{Name: "cookie-8", Value: "eight", Domain: "::1"}, - "cookie-8=eight", - }, - // The "special" cookies have values containing commas or spaces which - // are disallowed by RFC 6265 but are common in the wild. - { - &Cookie{Name: "special-1", Value: "a z"}, - `special-1=a z`, - }, - { - &Cookie{Name: "special-2", Value: " z"}, - `special-2=" z"`, - }, - { - &Cookie{Name: "special-3", Value: "a "}, - `special-3="a "`, - }, - { - &Cookie{Name: "special-4", Value: " "}, - `special-4=" "`, - }, - { - &Cookie{Name: "special-5", Value: "a,z"}, - `special-5=a,z`, - }, - { - &Cookie{Name: "special-6", Value: ",z"}, - `special-6=",z"`, - }, - { - &Cookie{Name: "special-7", Value: "a,"}, - `special-7="a,"`, - }, - { - &Cookie{Name: "special-8", Value: ","}, - `special-8=","`, - }, - { - &Cookie{Name: "empty-value", Value: ""}, - `empty-value=`, - }, -} - -func TestWriteSetCookies(t *testing.T) { - defer log.SetOutput(os.Stderr) - var logbuf bytes.Buffer - log.SetOutput(&logbuf) - - for i, tt := range writeSetCookiesTests { - if g, e := tt.Cookie.String(), tt.Raw; g != e { - t.Errorf("Test %d, expecting:\n%s\nGot:\n%s\n", i, e, g) - continue - } - } - - if got, sub := logbuf.String(), "dropping domain attribute"; !strings.Contains(got, sub) { - t.Errorf("Expected substring %q in log output. Got:\n%s", sub, got) - } -} - -type headerOnlyResponseWriter Header - -func (ho headerOnlyResponseWriter) Header() Header { - return Header(ho) -} - -func (ho headerOnlyResponseWriter) Write([]byte) (int, error) { - panic("NOIMPL") -} - -func (ho headerOnlyResponseWriter) WriteHeader(int) { - panic("NOIMPL") -} - -func TestSetCookie(t *testing.T) { - m := make(Header) - SetCookie(headerOnlyResponseWriter(m), &Cookie{Name: "cookie-1", Value: "one", Path: "/restricted/"}) - SetCookie(headerOnlyResponseWriter(m), &Cookie{Name: "cookie-2", Value: "two", MaxAge: 3600}) - if l := len(m["Set-Cookie"]); l != 2 { - t.Fatalf("expected %d cookies, got %d", 2, l) - } - if g, e := m["Set-Cookie"][0], "cookie-1=one; Path=/restricted/"; g != e { - t.Errorf("cookie #1: want %q, got %q", e, g) - } - if g, e := m["Set-Cookie"][1], "cookie-2=two; Max-Age=3600"; g != e { - t.Errorf("cookie #2: want %q, got %q", e, g) - } -} - -var addCookieTests = []struct { - Cookies []*Cookie - Raw string -}{ - { - []*Cookie{}, - "", - }, - { - []*Cookie{{Name: "cookie-1", Value: "v$1"}}, - "cookie-1=v$1", - }, - { - []*Cookie{ - {Name: "cookie-1", Value: "v$1"}, - {Name: "cookie-2", Value: "v$2"}, - {Name: "cookie-3", Value: "v$3"}, - }, - "cookie-1=v$1; cookie-2=v$2; cookie-3=v$3", - }, -} - -func TestAddCookie(t *testing.T) { - for i, tt := range addCookieTests { - req, _ := NewRequest("GET", "http://example.com/", nil) - for _, c := range tt.Cookies { - req.AddCookie(c) - } - if g := req.Header.Get("Cookie"); g != tt.Raw { - t.Errorf("Test %d:\nwant: %s\n got: %s\n", i, tt.Raw, g) - continue - } - } -} - -var readSetCookiesTests = []struct { - Header Header - Cookies []*Cookie -}{ - { - Header{"Set-Cookie": {"Cookie-1=v$1"}}, - []*Cookie{{Name: "Cookie-1", Value: "v$1", Raw: "Cookie-1=v$1"}}, - }, - { - Header{"Set-Cookie": {"NID=99=YsDT5i3E-CXax-; expires=Wed, 23-Nov-2011 01:05:03 GMT; path=/; domain=.google.ch; HttpOnly"}}, - []*Cookie{{ - Name: "NID", - Value: "99=YsDT5i3E-CXax-", - Path: "/", - Domain: ".google.ch", - HttpOnly: true, - Expires: time.Date(2011, 11, 23, 1, 5, 3, 0, time.UTC), - RawExpires: "Wed, 23-Nov-2011 01:05:03 GMT", - Raw: "NID=99=YsDT5i3E-CXax-; expires=Wed, 23-Nov-2011 01:05:03 GMT; path=/; domain=.google.ch; HttpOnly", - }}, - }, - { - Header{"Set-Cookie": {".ASPXAUTH=7E3AA; expires=Wed, 07-Mar-2012 14:25:06 GMT; path=/; HttpOnly"}}, - []*Cookie{{ - Name: ".ASPXAUTH", - Value: "7E3AA", - Path: "/", - Expires: time.Date(2012, 3, 7, 14, 25, 6, 0, time.UTC), - RawExpires: "Wed, 07-Mar-2012 14:25:06 GMT", - HttpOnly: true, - Raw: ".ASPXAUTH=7E3AA; expires=Wed, 07-Mar-2012 14:25:06 GMT; path=/; HttpOnly", - }}, - }, - { - Header{"Set-Cookie": {"ASP.NET_SessionId=foo; path=/; HttpOnly"}}, - []*Cookie{{ - Name: "ASP.NET_SessionId", - Value: "foo", - Path: "/", - HttpOnly: true, - Raw: "ASP.NET_SessionId=foo; path=/; HttpOnly", - }}, - }, - // Make sure we can properly read back the Set-Cookie headers we create - // for values containing spaces or commas: - { - Header{"Set-Cookie": {`special-1=a z`}}, - []*Cookie{{Name: "special-1", Value: "a z", Raw: `special-1=a z`}}, - }, - { - Header{"Set-Cookie": {`special-2=" z"`}}, - []*Cookie{{Name: "special-2", Value: " z", Raw: `special-2=" z"`}}, - }, - { - Header{"Set-Cookie": {`special-3="a "`}}, - []*Cookie{{Name: "special-3", Value: "a ", Raw: `special-3="a "`}}, - }, - { - Header{"Set-Cookie": {`special-4=" "`}}, - []*Cookie{{Name: "special-4", Value: " ", Raw: `special-4=" "`}}, - }, - { - Header{"Set-Cookie": {`special-5=a,z`}}, - []*Cookie{{Name: "special-5", Value: "a,z", Raw: `special-5=a,z`}}, - }, - { - Header{"Set-Cookie": {`special-6=",z"`}}, - []*Cookie{{Name: "special-6", Value: ",z", Raw: `special-6=",z"`}}, - }, - { - Header{"Set-Cookie": {`special-7=a,`}}, - []*Cookie{{Name: "special-7", Value: "a,", Raw: `special-7=a,`}}, - }, - { - Header{"Set-Cookie": {`special-8=","`}}, - []*Cookie{{Name: "special-8", Value: ",", Raw: `special-8=","`}}, - }, - - // TODO(bradfitz): users have reported seeing this in the - // wild, but do browsers handle it? RFC 6265 just says "don't - // do that" (section 3) and then never mentions header folding - // again. - // Header{"Set-Cookie": {"ASP.NET_SessionId=foo; path=/; HttpOnly, .ASPXAUTH=7E3AA; expires=Wed, 07-Mar-2012 14:25:06 GMT; path=/; HttpOnly"}}, -} - -func toJSON(v interface{}) string { - b, err := json.Marshal(v) - if err != nil { - return fmt.Sprintf("%#v", v) - } - return string(b) -} - -func TestReadSetCookies(t *testing.T) { - for i, tt := range readSetCookiesTests { - for n := 0; n < 2; n++ { // to verify readSetCookies doesn't mutate its input - c := readSetCookies(tt.Header) - if !reflect.DeepEqual(c, tt.Cookies) { - t.Errorf("#%d readSetCookies: have\n%s\nwant\n%s\n", i, toJSON(c), toJSON(tt.Cookies)) - continue - } - } - } -} - -var readCookiesTests = []struct { - Header Header - Filter string - Cookies []*Cookie -}{ - { - Header{"Cookie": {"Cookie-1=v$1", "c2=v2"}}, - "", - []*Cookie{ - {Name: "Cookie-1", Value: "v$1"}, - {Name: "c2", Value: "v2"}, - }, - }, - { - Header{"Cookie": {"Cookie-1=v$1", "c2=v2"}}, - "c2", - []*Cookie{ - {Name: "c2", Value: "v2"}, - }, - }, - { - Header{"Cookie": {"Cookie-1=v$1; c2=v2"}}, - "", - []*Cookie{ - {Name: "Cookie-1", Value: "v$1"}, - {Name: "c2", Value: "v2"}, - }, - }, - { - Header{"Cookie": {"Cookie-1=v$1; c2=v2"}}, - "c2", - []*Cookie{ - {Name: "c2", Value: "v2"}, - }, - }, -} - -func TestReadCookies(t *testing.T) { - for i, tt := range readCookiesTests { - for n := 0; n < 2; n++ { // to verify readCookies doesn't mutate its input - c := readCookies(tt.Header, tt.Filter) - if !reflect.DeepEqual(c, tt.Cookies) { - t.Errorf("#%d readCookies:\nhave: %s\nwant: %s\n", i, toJSON(c), toJSON(tt.Cookies)) - continue - } - } - } -} - -func TestCookieSanitizeValue(t *testing.T) { - defer log.SetOutput(os.Stderr) - var logbuf bytes.Buffer - log.SetOutput(&logbuf) - - tests := []struct { - in, want string - }{ - {"foo", "foo"}, - {"foo;bar", "foobar"}, - {"foo\\bar", "foobar"}, - {"foo\"bar", "foobar"}, - {"\x00\x7e\x7f\x80", "\x7e"}, - {`"withquotes"`, "withquotes"}, - {"a z", "a z"}, - {" z", `" z"`}, - {"a ", `"a "`}, - } - for _, tt := range tests { - if got := sanitizeCookieValue(tt.in); got != tt.want { - t.Errorf("sanitizeCookieValue(%q) = %q; want %q", tt.in, got, tt.want) - } - } - - if got, sub := logbuf.String(), "dropping invalid bytes"; !strings.Contains(got, sub) { - t.Errorf("Expected substring %q in log output. Got:\n%s", sub, got) - } -} - -func TestCookieSanitizePath(t *testing.T) { - defer log.SetOutput(os.Stderr) - var logbuf bytes.Buffer - log.SetOutput(&logbuf) - - tests := []struct { - in, want string - }{ - {"/path", "/path"}, - {"/path with space/", "/path with space/"}, - {"/just;no;semicolon\x00orstuff/", "/justnosemicolonorstuff/"}, - } - for _, tt := range tests { - if got := sanitizeCookiePath(tt.in); got != tt.want { - t.Errorf("sanitizeCookiePath(%q) = %q; want %q", tt.in, got, tt.want) - } - } - - if got, sub := logbuf.String(), "dropping invalid bytes"; !strings.Contains(got, sub) { - t.Errorf("Expected substring %q in log output. Got:\n%s", sub, got) - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cookiejar/jar_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/cookiejar/jar_test.go deleted file mode 100644 index 3aa601586e..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cookiejar/jar_test.go +++ /dev/null @@ -1,1267 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cookiejar - -import ( - "fmt" - "net/http" - "net/url" - "sort" - "strings" - "testing" - "time" -) - -// tNow is the synthetic current time used as now during testing. -var tNow = time.Date(2013, 1, 1, 12, 0, 0, 0, time.UTC) - -// testPSL implements PublicSuffixList with just two rules: "co.uk" -// and the default rule "*". -type testPSL struct{} - -func (testPSL) String() string { - return "testPSL" -} -func (testPSL) PublicSuffix(d string) string { - if d == "co.uk" || strings.HasSuffix(d, ".co.uk") { - return "co.uk" - } - return d[strings.LastIndex(d, ".")+1:] -} - -// newTestJar creates an empty Jar with testPSL as the public suffix list. -func newTestJar() *Jar { - jar, err := New(&Options{PublicSuffixList: testPSL{}}) - if err != nil { - panic(err) - } - return jar -} - -var hasDotSuffixTests = [...]struct { - s, suffix string -}{ - {"", ""}, - {"", "."}, - {"", "x"}, - {".", ""}, - {".", "."}, - {".", ".."}, - {".", "x"}, - {".", "x."}, - {".", ".x"}, - {".", ".x."}, - {"x", ""}, - {"x", "."}, - {"x", ".."}, - {"x", "x"}, - {"x", "x."}, - {"x", ".x"}, - {"x", ".x."}, - {".x", ""}, - {".x", "."}, - {".x", ".."}, - {".x", "x"}, - {".x", "x."}, - {".x", ".x"}, - {".x", ".x."}, - {"x.", ""}, - {"x.", "."}, - {"x.", ".."}, - {"x.", "x"}, - {"x.", "x."}, - {"x.", ".x"}, - {"x.", ".x."}, - {"com", ""}, - {"com", "m"}, - {"com", "om"}, - {"com", "com"}, - {"com", ".com"}, - {"com", "x.com"}, - {"com", "xcom"}, - {"com", "xorg"}, - {"com", "org"}, - {"com", "rg"}, - {"foo.com", ""}, - {"foo.com", "m"}, - {"foo.com", "om"}, - {"foo.com", "com"}, - {"foo.com", ".com"}, - {"foo.com", "o.com"}, - {"foo.com", "oo.com"}, - {"foo.com", "foo.com"}, - {"foo.com", ".foo.com"}, - {"foo.com", "x.foo.com"}, - {"foo.com", "xfoo.com"}, - {"foo.com", "xfoo.org"}, - {"foo.com", "foo.org"}, - {"foo.com", "oo.org"}, - {"foo.com", "o.org"}, - {"foo.com", ".org"}, - {"foo.com", "org"}, - {"foo.com", "rg"}, -} - -func TestHasDotSuffix(t *testing.T) { - for _, tc := range hasDotSuffixTests { - got := hasDotSuffix(tc.s, tc.suffix) - want := strings.HasSuffix(tc.s, "."+tc.suffix) - if got != want { - t.Errorf("s=%q, suffix=%q: got %v, want %v", tc.s, tc.suffix, got, want) - } - } -} - -var canonicalHostTests = map[string]string{ - "www.example.com": "www.example.com", - "WWW.EXAMPLE.COM": "www.example.com", - "wWw.eXAmple.CoM": "www.example.com", - "www.example.com:80": "www.example.com", - "192.168.0.10": "192.168.0.10", - "192.168.0.5:8080": "192.168.0.5", - "2001:4860:0:2001::68": "2001:4860:0:2001::68", - "[2001:4860:0:::68]:8080": "2001:4860:0:::68", - "www.bücher.de": "www.xn--bcher-kva.de", - "www.example.com.": "www.example.com", - "[bad.unmatched.bracket:": "error", -} - -func TestCanonicalHost(t *testing.T) { - for h, want := range canonicalHostTests { - got, err := canonicalHost(h) - if want == "error" { - if err == nil { - t.Errorf("%q: got nil error, want non-nil", h) - } - continue - } - if err != nil { - t.Errorf("%q: %v", h, err) - continue - } - if got != want { - t.Errorf("%q: got %q, want %q", h, got, want) - continue - } - } -} - -var hasPortTests = map[string]bool{ - "www.example.com": false, - "www.example.com:80": true, - "127.0.0.1": false, - "127.0.0.1:8080": true, - "2001:4860:0:2001::68": false, - "[2001::0:::68]:80": true, -} - -func TestHasPort(t *testing.T) { - for host, want := range hasPortTests { - if got := hasPort(host); got != want { - t.Errorf("%q: got %t, want %t", host, got, want) - } - } -} - -var jarKeyTests = map[string]string{ - "foo.www.example.com": "example.com", - "www.example.com": "example.com", - "example.com": "example.com", - "com": "com", - "foo.www.bbc.co.uk": "bbc.co.uk", - "www.bbc.co.uk": "bbc.co.uk", - "bbc.co.uk": "bbc.co.uk", - "co.uk": "co.uk", - "uk": "uk", - "192.168.0.5": "192.168.0.5", -} - -func TestJarKey(t *testing.T) { - for host, want := range jarKeyTests { - if got := jarKey(host, testPSL{}); got != want { - t.Errorf("%q: got %q, want %q", host, got, want) - } - } -} - -var jarKeyNilPSLTests = map[string]string{ - "foo.www.example.com": "example.com", - "www.example.com": "example.com", - "example.com": "example.com", - "com": "com", - "foo.www.bbc.co.uk": "co.uk", - "www.bbc.co.uk": "co.uk", - "bbc.co.uk": "co.uk", - "co.uk": "co.uk", - "uk": "uk", - "192.168.0.5": "192.168.0.5", -} - -func TestJarKeyNilPSL(t *testing.T) { - for host, want := range jarKeyNilPSLTests { - if got := jarKey(host, nil); got != want { - t.Errorf("%q: got %q, want %q", host, got, want) - } - } -} - -var isIPTests = map[string]bool{ - "127.0.0.1": true, - "1.2.3.4": true, - "2001:4860:0:2001::68": true, - "example.com": false, - "1.1.1.300": false, - "www.foo.bar.net": false, - "123.foo.bar.net": false, -} - -func TestIsIP(t *testing.T) { - for host, want := range isIPTests { - if got := isIP(host); got != want { - t.Errorf("%q: got %t, want %t", host, got, want) - } - } -} - -var defaultPathTests = map[string]string{ - "/": "/", - "/abc": "/", - "/abc/": "/abc", - "/abc/xyz": "/abc", - "/abc/xyz/": "/abc/xyz", - "/a/b/c.html": "/a/b", - "": "/", - "strange": "/", - "//": "/", - "/a//b": "/a/", - "/a/./b": "/a/.", - "/a/../b": "/a/..", -} - -func TestDefaultPath(t *testing.T) { - for path, want := range defaultPathTests { - if got := defaultPath(path); got != want { - t.Errorf("%q: got %q, want %q", path, got, want) - } - } -} - -var domainAndTypeTests = [...]struct { - host string // host Set-Cookie header was received from - domain string // domain attribute in Set-Cookie header - wantDomain string // expected domain of cookie - wantHostOnly bool // expected host-cookie flag - wantErr error // expected error -}{ - {"www.example.com", "", "www.example.com", true, nil}, - {"127.0.0.1", "", "127.0.0.1", true, nil}, - {"2001:4860:0:2001::68", "", "2001:4860:0:2001::68", true, nil}, - {"www.example.com", "example.com", "example.com", false, nil}, - {"www.example.com", ".example.com", "example.com", false, nil}, - {"www.example.com", "www.example.com", "www.example.com", false, nil}, - {"www.example.com", ".www.example.com", "www.example.com", false, nil}, - {"foo.sso.example.com", "sso.example.com", "sso.example.com", false, nil}, - {"bar.co.uk", "bar.co.uk", "bar.co.uk", false, nil}, - {"foo.bar.co.uk", ".bar.co.uk", "bar.co.uk", false, nil}, - {"127.0.0.1", "127.0.0.1", "", false, errNoHostname}, - {"2001:4860:0:2001::68", "2001:4860:0:2001::68", "2001:4860:0:2001::68", false, errNoHostname}, - {"www.example.com", ".", "", false, errMalformedDomain}, - {"www.example.com", "..", "", false, errMalformedDomain}, - {"www.example.com", "other.com", "", false, errIllegalDomain}, - {"www.example.com", "com", "", false, errIllegalDomain}, - {"www.example.com", ".com", "", false, errIllegalDomain}, - {"foo.bar.co.uk", ".co.uk", "", false, errIllegalDomain}, - {"127.www.0.0.1", "127.0.0.1", "", false, errIllegalDomain}, - {"com", "", "com", true, nil}, - {"com", "com", "com", true, nil}, - {"com", ".com", "com", true, nil}, - {"co.uk", "", "co.uk", true, nil}, - {"co.uk", "co.uk", "co.uk", true, nil}, - {"co.uk", ".co.uk", "co.uk", true, nil}, -} - -func TestDomainAndType(t *testing.T) { - jar := newTestJar() - for _, tc := range domainAndTypeTests { - domain, hostOnly, err := jar.domainAndType(tc.host, tc.domain) - if err != tc.wantErr { - t.Errorf("%q/%q: got %q error, want %q", - tc.host, tc.domain, err, tc.wantErr) - continue - } - if err != nil { - continue - } - if domain != tc.wantDomain || hostOnly != tc.wantHostOnly { - t.Errorf("%q/%q: got %q/%t want %q/%t", - tc.host, tc.domain, domain, hostOnly, - tc.wantDomain, tc.wantHostOnly) - } - } -} - -// expiresIn creates an expires attribute delta seconds from tNow. -func expiresIn(delta int) string { - t := tNow.Add(time.Duration(delta) * time.Second) - return "expires=" + t.Format(time.RFC1123) -} - -// mustParseURL parses s to an URL and panics on error. -func mustParseURL(s string) *url.URL { - u, err := url.Parse(s) - if err != nil || u.Scheme == "" || u.Host == "" { - panic(fmt.Sprintf("Unable to parse URL %s.", s)) - } - return u -} - -// jarTest encapsulates the following actions on a jar: -// 1. Perform SetCookies with fromURL and the cookies from setCookies. -// (Done at time tNow + 0 ms.) -// 2. Check that the entries in the jar matches content. -// (Done at time tNow + 1001 ms.) -// 3. For each query in tests: Check that Cookies with toURL yields the -// cookies in want. -// (Query n done at tNow + (n+2)*1001 ms.) -type jarTest struct { - description string // The description of what this test is supposed to test - fromURL string // The full URL of the request from which Set-Cookie headers where received - setCookies []string // All the cookies received from fromURL - content string // The whole (non-expired) content of the jar - queries []query // Queries to test the Jar.Cookies method -} - -// query contains one test of the cookies returned from Jar.Cookies. -type query struct { - toURL string // the URL in the Cookies call - want string // the expected list of cookies (order matters) -} - -// run runs the jarTest. -func (test jarTest) run(t *testing.T, jar *Jar) { - now := tNow - - // Populate jar with cookies. - setCookies := make([]*http.Cookie, len(test.setCookies)) - for i, cs := range test.setCookies { - cookies := (&http.Response{Header: http.Header{"Set-Cookie": {cs}}}).Cookies() - if len(cookies) != 1 { - panic(fmt.Sprintf("Wrong cookie line %q: %#v", cs, cookies)) - } - setCookies[i] = cookies[0] - } - jar.setCookies(mustParseURL(test.fromURL), setCookies, now) - now = now.Add(1001 * time.Millisecond) - - // Serialize non-expired entries in the form "name1=val1 name2=val2". - var cs []string - for _, submap := range jar.entries { - for _, cookie := range submap { - if !cookie.Expires.After(now) { - continue - } - cs = append(cs, cookie.Name+"="+cookie.Value) - } - } - sort.Strings(cs) - got := strings.Join(cs, " ") - - // Make sure jar content matches our expectations. - if got != test.content { - t.Errorf("Test %q Content\ngot %q\nwant %q", - test.description, got, test.content) - } - - // Test different calls to Cookies. - for i, query := range test.queries { - now = now.Add(1001 * time.Millisecond) - var s []string - for _, c := range jar.cookies(mustParseURL(query.toURL), now) { - s = append(s, c.Name+"="+c.Value) - } - if got := strings.Join(s, " "); got != query.want { - t.Errorf("Test %q #%d\ngot %q\nwant %q", test.description, i, got, query.want) - } - } -} - -// basicsTests contains fundamental tests. Each jarTest has to be performed on -// a fresh, empty Jar. -var basicsTests = [...]jarTest{ - { - "Retrieval of a plain host cookie.", - "http://www.host.test/", - []string{"A=a"}, - "A=a", - []query{ - {"http://www.host.test", "A=a"}, - {"http://www.host.test/", "A=a"}, - {"http://www.host.test/some/path", "A=a"}, - {"https://www.host.test", "A=a"}, - {"https://www.host.test/", "A=a"}, - {"https://www.host.test/some/path", "A=a"}, - {"ftp://www.host.test", ""}, - {"ftp://www.host.test/", ""}, - {"ftp://www.host.test/some/path", ""}, - {"http://www.other.org", ""}, - {"http://sibling.host.test", ""}, - {"http://deep.www.host.test", ""}, - }, - }, - { - "Secure cookies are not returned to http.", - "http://www.host.test/", - []string{"A=a; secure"}, - "A=a", - []query{ - {"http://www.host.test", ""}, - {"http://www.host.test/", ""}, - {"http://www.host.test/some/path", ""}, - {"https://www.host.test", "A=a"}, - {"https://www.host.test/", "A=a"}, - {"https://www.host.test/some/path", "A=a"}, - }, - }, - { - "Explicit path.", - "http://www.host.test/", - []string{"A=a; path=/some/path"}, - "A=a", - []query{ - {"http://www.host.test", ""}, - {"http://www.host.test/", ""}, - {"http://www.host.test/some", ""}, - {"http://www.host.test/some/", ""}, - {"http://www.host.test/some/path", "A=a"}, - {"http://www.host.test/some/paths", ""}, - {"http://www.host.test/some/path/foo", "A=a"}, - {"http://www.host.test/some/path/foo/", "A=a"}, - }, - }, - { - "Implicit path #1: path is a directory.", - "http://www.host.test/some/path/", - []string{"A=a"}, - "A=a", - []query{ - {"http://www.host.test", ""}, - {"http://www.host.test/", ""}, - {"http://www.host.test/some", ""}, - {"http://www.host.test/some/", ""}, - {"http://www.host.test/some/path", "A=a"}, - {"http://www.host.test/some/paths", ""}, - {"http://www.host.test/some/path/foo", "A=a"}, - {"http://www.host.test/some/path/foo/", "A=a"}, - }, - }, - { - "Implicit path #2: path is not a directory.", - "http://www.host.test/some/path/index.html", - []string{"A=a"}, - "A=a", - []query{ - {"http://www.host.test", ""}, - {"http://www.host.test/", ""}, - {"http://www.host.test/some", ""}, - {"http://www.host.test/some/", ""}, - {"http://www.host.test/some/path", "A=a"}, - {"http://www.host.test/some/paths", ""}, - {"http://www.host.test/some/path/foo", "A=a"}, - {"http://www.host.test/some/path/foo/", "A=a"}, - }, - }, - { - "Implicit path #3: no path in URL at all.", - "http://www.host.test", - []string{"A=a"}, - "A=a", - []query{ - {"http://www.host.test", "A=a"}, - {"http://www.host.test/", "A=a"}, - {"http://www.host.test/some/path", "A=a"}, - }, - }, - { - "Cookies are sorted by path length.", - "http://www.host.test/", - []string{ - "A=a; path=/foo/bar", - "B=b; path=/foo/bar/baz/qux", - "C=c; path=/foo/bar/baz", - "D=d; path=/foo"}, - "A=a B=b C=c D=d", - []query{ - {"http://www.host.test/foo/bar/baz/qux", "B=b C=c A=a D=d"}, - {"http://www.host.test/foo/bar/baz/", "C=c A=a D=d"}, - {"http://www.host.test/foo/bar", "A=a D=d"}, - }, - }, - { - "Creation time determines sorting on same length paths.", - "http://www.host.test/", - []string{ - "A=a; path=/foo/bar", - "X=x; path=/foo/bar", - "Y=y; path=/foo/bar/baz/qux", - "B=b; path=/foo/bar/baz/qux", - "C=c; path=/foo/bar/baz", - "W=w; path=/foo/bar/baz", - "Z=z; path=/foo", - "D=d; path=/foo"}, - "A=a B=b C=c D=d W=w X=x Y=y Z=z", - []query{ - {"http://www.host.test/foo/bar/baz/qux", "Y=y B=b C=c W=w A=a X=x Z=z D=d"}, - {"http://www.host.test/foo/bar/baz/", "C=c W=w A=a X=x Z=z D=d"}, - {"http://www.host.test/foo/bar", "A=a X=x Z=z D=d"}, - }, - }, - { - "Sorting of same-name cookies.", - "http://www.host.test/", - []string{ - "A=1; path=/", - "A=2; path=/path", - "A=3; path=/quux", - "A=4; path=/path/foo", - "A=5; domain=.host.test; path=/path", - "A=6; domain=.host.test; path=/quux", - "A=7; domain=.host.test; path=/path/foo", - }, - "A=1 A=2 A=3 A=4 A=5 A=6 A=7", - []query{ - {"http://www.host.test/path", "A=2 A=5 A=1"}, - {"http://www.host.test/path/foo", "A=4 A=7 A=2 A=5 A=1"}, - }, - }, - { - "Disallow domain cookie on public suffix.", - "http://www.bbc.co.uk", - []string{ - "a=1", - "b=2; domain=co.uk", - }, - "a=1", - []query{{"http://www.bbc.co.uk", "a=1"}}, - }, - { - "Host cookie on IP.", - "http://192.168.0.10", - []string{"a=1"}, - "a=1", - []query{{"http://192.168.0.10", "a=1"}}, - }, - { - "Port is ignored #1.", - "http://www.host.test/", - []string{"a=1"}, - "a=1", - []query{ - {"http://www.host.test", "a=1"}, - {"http://www.host.test:8080/", "a=1"}, - }, - }, - { - "Port is ignored #2.", - "http://www.host.test:8080/", - []string{"a=1"}, - "a=1", - []query{ - {"http://www.host.test", "a=1"}, - {"http://www.host.test:8080/", "a=1"}, - {"http://www.host.test:1234/", "a=1"}, - }, - }, -} - -func TestBasics(t *testing.T) { - for _, test := range basicsTests { - jar := newTestJar() - test.run(t, jar) - } -} - -// updateAndDeleteTests contains jarTests which must be performed on the same -// Jar. -var updateAndDeleteTests = [...]jarTest{ - { - "Set initial cookies.", - "http://www.host.test", - []string{ - "a=1", - "b=2; secure", - "c=3; httponly", - "d=4; secure; httponly"}, - "a=1 b=2 c=3 d=4", - []query{ - {"http://www.host.test", "a=1 c=3"}, - {"https://www.host.test", "a=1 b=2 c=3 d=4"}, - }, - }, - { - "Update value via http.", - "http://www.host.test", - []string{ - "a=w", - "b=x; secure", - "c=y; httponly", - "d=z; secure; httponly"}, - "a=w b=x c=y d=z", - []query{ - {"http://www.host.test", "a=w c=y"}, - {"https://www.host.test", "a=w b=x c=y d=z"}, - }, - }, - { - "Clear Secure flag from a http.", - "http://www.host.test/", - []string{ - "b=xx", - "d=zz; httponly"}, - "a=w b=xx c=y d=zz", - []query{{"http://www.host.test", "a=w b=xx c=y d=zz"}}, - }, - { - "Delete all.", - "http://www.host.test/", - []string{ - "a=1; max-Age=-1", // delete via MaxAge - "b=2; " + expiresIn(-10), // delete via Expires - "c=2; max-age=-1; " + expiresIn(-10), // delete via both - "d=4; max-age=-1; " + expiresIn(10)}, // MaxAge takes precedence - "", - []query{{"http://www.host.test", ""}}, - }, - { - "Refill #1.", - "http://www.host.test", - []string{ - "A=1", - "A=2; path=/foo", - "A=3; domain=.host.test", - "A=4; path=/foo; domain=.host.test"}, - "A=1 A=2 A=3 A=4", - []query{{"http://www.host.test/foo", "A=2 A=4 A=1 A=3"}}, - }, - { - "Refill #2.", - "http://www.google.com", - []string{ - "A=6", - "A=7; path=/foo", - "A=8; domain=.google.com", - "A=9; path=/foo; domain=.google.com"}, - "A=1 A=2 A=3 A=4 A=6 A=7 A=8 A=9", - []query{ - {"http://www.host.test/foo", "A=2 A=4 A=1 A=3"}, - {"http://www.google.com/foo", "A=7 A=9 A=6 A=8"}, - }, - }, - { - "Delete A7.", - "http://www.google.com", - []string{"A=; path=/foo; max-age=-1"}, - "A=1 A=2 A=3 A=4 A=6 A=8 A=9", - []query{ - {"http://www.host.test/foo", "A=2 A=4 A=1 A=3"}, - {"http://www.google.com/foo", "A=9 A=6 A=8"}, - }, - }, - { - "Delete A4.", - "http://www.host.test", - []string{"A=; path=/foo; domain=host.test; max-age=-1"}, - "A=1 A=2 A=3 A=6 A=8 A=9", - []query{ - {"http://www.host.test/foo", "A=2 A=1 A=3"}, - {"http://www.google.com/foo", "A=9 A=6 A=8"}, - }, - }, - { - "Delete A6.", - "http://www.google.com", - []string{"A=; max-age=-1"}, - "A=1 A=2 A=3 A=8 A=9", - []query{ - {"http://www.host.test/foo", "A=2 A=1 A=3"}, - {"http://www.google.com/foo", "A=9 A=8"}, - }, - }, - { - "Delete A3.", - "http://www.host.test", - []string{"A=; domain=host.test; max-age=-1"}, - "A=1 A=2 A=8 A=9", - []query{ - {"http://www.host.test/foo", "A=2 A=1"}, - {"http://www.google.com/foo", "A=9 A=8"}, - }, - }, - { - "No cross-domain delete.", - "http://www.host.test", - []string{ - "A=; domain=google.com; max-age=-1", - "A=; path=/foo; domain=google.com; max-age=-1"}, - "A=1 A=2 A=8 A=9", - []query{ - {"http://www.host.test/foo", "A=2 A=1"}, - {"http://www.google.com/foo", "A=9 A=8"}, - }, - }, - { - "Delete A8 and A9.", - "http://www.google.com", - []string{ - "A=; domain=google.com; max-age=-1", - "A=; path=/foo; domain=google.com; max-age=-1"}, - "A=1 A=2", - []query{ - {"http://www.host.test/foo", "A=2 A=1"}, - {"http://www.google.com/foo", ""}, - }, - }, -} - -func TestUpdateAndDelete(t *testing.T) { - jar := newTestJar() - for _, test := range updateAndDeleteTests { - test.run(t, jar) - } -} - -func TestExpiration(t *testing.T) { - jar := newTestJar() - jarTest{ - "Expiration.", - "http://www.host.test", - []string{ - "a=1", - "b=2; max-age=3", - "c=3; " + expiresIn(3), - "d=4; max-age=5", - "e=5; " + expiresIn(5), - "f=6; max-age=100", - }, - "a=1 b=2 c=3 d=4 e=5 f=6", // executed at t0 + 1001 ms - []query{ - {"http://www.host.test", "a=1 b=2 c=3 d=4 e=5 f=6"}, // t0 + 2002 ms - {"http://www.host.test", "a=1 d=4 e=5 f=6"}, // t0 + 3003 ms - {"http://www.host.test", "a=1 d=4 e=5 f=6"}, // t0 + 4004 ms - {"http://www.host.test", "a=1 f=6"}, // t0 + 5005 ms - {"http://www.host.test", "a=1 f=6"}, // t0 + 6006 ms - }, - }.run(t, jar) -} - -// -// Tests derived from Chromium's cookie_store_unittest.h. -// - -// See http://src.chromium.org/viewvc/chrome/trunk/src/net/cookies/cookie_store_unittest.h?revision=159685&content-type=text/plain -// Some of the original tests are in a bad condition (e.g. -// DomainWithTrailingDotTest) or are not RFC 6265 conforming (e.g. -// TestNonDottedAndTLD #1 and #6) and have not been ported. - -// chromiumBasicsTests contains fundamental tests. Each jarTest has to be -// performed on a fresh, empty Jar. -var chromiumBasicsTests = [...]jarTest{ - { - "DomainWithTrailingDotTest.", - "http://www.google.com/", - []string{ - "a=1; domain=.www.google.com.", - "b=2; domain=.www.google.com.."}, - "", - []query{ - {"http://www.google.com", ""}, - }, - }, - { - "ValidSubdomainTest #1.", - "http://a.b.c.d.com", - []string{ - "a=1; domain=.a.b.c.d.com", - "b=2; domain=.b.c.d.com", - "c=3; domain=.c.d.com", - "d=4; domain=.d.com"}, - "a=1 b=2 c=3 d=4", - []query{ - {"http://a.b.c.d.com", "a=1 b=2 c=3 d=4"}, - {"http://b.c.d.com", "b=2 c=3 d=4"}, - {"http://c.d.com", "c=3 d=4"}, - {"http://d.com", "d=4"}, - }, - }, - { - "ValidSubdomainTest #2.", - "http://a.b.c.d.com", - []string{ - "a=1; domain=.a.b.c.d.com", - "b=2; domain=.b.c.d.com", - "c=3; domain=.c.d.com", - "d=4; domain=.d.com", - "X=bcd; domain=.b.c.d.com", - "X=cd; domain=.c.d.com"}, - "X=bcd X=cd a=1 b=2 c=3 d=4", - []query{ - {"http://b.c.d.com", "b=2 c=3 d=4 X=bcd X=cd"}, - {"http://c.d.com", "c=3 d=4 X=cd"}, - }, - }, - { - "InvalidDomainTest #1.", - "http://foo.bar.com", - []string{ - "a=1; domain=.yo.foo.bar.com", - "b=2; domain=.foo.com", - "c=3; domain=.bar.foo.com", - "d=4; domain=.foo.bar.com.net", - "e=5; domain=ar.com", - "f=6; domain=.", - "g=7; domain=/", - "h=8; domain=http://foo.bar.com", - "i=9; domain=..foo.bar.com", - "j=10; domain=..bar.com", - "k=11; domain=.foo.bar.com?blah", - "l=12; domain=.foo.bar.com/blah", - "m=12; domain=.foo.bar.com:80", - "n=14; domain=.foo.bar.com:", - "o=15; domain=.foo.bar.com#sup", - }, - "", // Jar is empty. - []query{{"http://foo.bar.com", ""}}, - }, - { - "InvalidDomainTest #2.", - "http://foo.com.com", - []string{"a=1; domain=.foo.com.com.com"}, - "", - []query{{"http://foo.bar.com", ""}}, - }, - { - "DomainWithoutLeadingDotTest #1.", - "http://manage.hosted.filefront.com", - []string{"a=1; domain=filefront.com"}, - "a=1", - []query{{"http://www.filefront.com", "a=1"}}, - }, - { - "DomainWithoutLeadingDotTest #2.", - "http://www.google.com", - []string{"a=1; domain=www.google.com"}, - "a=1", - []query{ - {"http://www.google.com", "a=1"}, - {"http://sub.www.google.com", "a=1"}, - {"http://something-else.com", ""}, - }, - }, - { - "CaseInsensitiveDomainTest.", - "http://www.google.com", - []string{ - "a=1; domain=.GOOGLE.COM", - "b=2; domain=.www.gOOgLE.coM"}, - "a=1 b=2", - []query{{"http://www.google.com", "a=1 b=2"}}, - }, - { - "TestIpAddress #1.", - "http://1.2.3.4/foo", - []string{"a=1; path=/"}, - "a=1", - []query{{"http://1.2.3.4/foo", "a=1"}}, - }, - { - "TestIpAddress #2.", - "http://1.2.3.4/foo", - []string{ - "a=1; domain=.1.2.3.4", - "b=2; domain=.3.4"}, - "", - []query{{"http://1.2.3.4/foo", ""}}, - }, - { - "TestIpAddress #3.", - "http://1.2.3.4/foo", - []string{"a=1; domain=1.2.3.4"}, - "", - []query{{"http://1.2.3.4/foo", ""}}, - }, - { - "TestNonDottedAndTLD #2.", - "http://com./index.html", - []string{"a=1"}, - "a=1", - []query{ - {"http://com./index.html", "a=1"}, - {"http://no-cookies.com./index.html", ""}, - }, - }, - { - "TestNonDottedAndTLD #3.", - "http://a.b", - []string{ - "a=1; domain=.b", - "b=2; domain=b"}, - "", - []query{{"http://bar.foo", ""}}, - }, - { - "TestNonDottedAndTLD #4.", - "http://google.com", - []string{ - "a=1; domain=.com", - "b=2; domain=com"}, - "", - []query{{"http://google.com", ""}}, - }, - { - "TestNonDottedAndTLD #5.", - "http://google.co.uk", - []string{ - "a=1; domain=.co.uk", - "b=2; domain=.uk"}, - "", - []query{ - {"http://google.co.uk", ""}, - {"http://else.co.com", ""}, - {"http://else.uk", ""}, - }, - }, - { - "TestHostEndsWithDot.", - "http://www.google.com", - []string{ - "a=1", - "b=2; domain=.www.google.com."}, - "a=1", - []query{{"http://www.google.com", "a=1"}}, - }, - { - "PathTest", - "http://www.google.izzle", - []string{"a=1; path=/wee"}, - "a=1", - []query{ - {"http://www.google.izzle/wee", "a=1"}, - {"http://www.google.izzle/wee/", "a=1"}, - {"http://www.google.izzle/wee/war", "a=1"}, - {"http://www.google.izzle/wee/war/more/more", "a=1"}, - {"http://www.google.izzle/weehee", ""}, - {"http://www.google.izzle/", ""}, - }, - }, -} - -func TestChromiumBasics(t *testing.T) { - for _, test := range chromiumBasicsTests { - jar := newTestJar() - test.run(t, jar) - } -} - -// chromiumDomainTests contains jarTests which must be executed all on the -// same Jar. -var chromiumDomainTests = [...]jarTest{ - { - "Fill #1.", - "http://www.google.izzle", - []string{"A=B"}, - "A=B", - []query{{"http://www.google.izzle", "A=B"}}, - }, - { - "Fill #2.", - "http://www.google.izzle", - []string{"C=D; domain=.google.izzle"}, - "A=B C=D", - []query{{"http://www.google.izzle", "A=B C=D"}}, - }, - { - "Verify A is a host cookie and not accessible from subdomain.", - "http://unused.nil", - []string{}, - "A=B C=D", - []query{{"http://foo.www.google.izzle", "C=D"}}, - }, - { - "Verify domain cookies are found on proper domain.", - "http://www.google.izzle", - []string{"E=F; domain=.www.google.izzle"}, - "A=B C=D E=F", - []query{{"http://www.google.izzle", "A=B C=D E=F"}}, - }, - { - "Leading dots in domain attributes are optional.", - "http://www.google.izzle", - []string{"G=H; domain=www.google.izzle"}, - "A=B C=D E=F G=H", - []query{{"http://www.google.izzle", "A=B C=D E=F G=H"}}, - }, - { - "Verify domain enforcement works #1.", - "http://www.google.izzle", - []string{"K=L; domain=.bar.www.google.izzle"}, - "A=B C=D E=F G=H", - []query{{"http://bar.www.google.izzle", "C=D E=F G=H"}}, - }, - { - "Verify domain enforcement works #2.", - "http://unused.nil", - []string{}, - "A=B C=D E=F G=H", - []query{{"http://www.google.izzle", "A=B C=D E=F G=H"}}, - }, -} - -func TestChromiumDomain(t *testing.T) { - jar := newTestJar() - for _, test := range chromiumDomainTests { - test.run(t, jar) - } - -} - -// chromiumDeletionTests must be performed all on the same Jar. -var chromiumDeletionTests = [...]jarTest{ - { - "Create session cookie a1.", - "http://www.google.com", - []string{"a=1"}, - "a=1", - []query{{"http://www.google.com", "a=1"}}, - }, - { - "Delete sc a1 via MaxAge.", - "http://www.google.com", - []string{"a=1; max-age=-1"}, - "", - []query{{"http://www.google.com", ""}}, - }, - { - "Create session cookie b2.", - "http://www.google.com", - []string{"b=2"}, - "b=2", - []query{{"http://www.google.com", "b=2"}}, - }, - { - "Delete sc b2 via Expires.", - "http://www.google.com", - []string{"b=2; " + expiresIn(-10)}, - "", - []query{{"http://www.google.com", ""}}, - }, - { - "Create persistent cookie c3.", - "http://www.google.com", - []string{"c=3; max-age=3600"}, - "c=3", - []query{{"http://www.google.com", "c=3"}}, - }, - { - "Delete pc c3 via MaxAge.", - "http://www.google.com", - []string{"c=3; max-age=-1"}, - "", - []query{{"http://www.google.com", ""}}, - }, - { - "Create persistent cookie d4.", - "http://www.google.com", - []string{"d=4; max-age=3600"}, - "d=4", - []query{{"http://www.google.com", "d=4"}}, - }, - { - "Delete pc d4 via Expires.", - "http://www.google.com", - []string{"d=4; " + expiresIn(-10)}, - "", - []query{{"http://www.google.com", ""}}, - }, -} - -func TestChromiumDeletion(t *testing.T) { - jar := newTestJar() - for _, test := range chromiumDeletionTests { - test.run(t, jar) - } -} - -// domainHandlingTests tests and documents the rules for domain handling. -// Each test must be performed on an empty new Jar. -var domainHandlingTests = [...]jarTest{ - { - "Host cookie", - "http://www.host.test", - []string{"a=1"}, - "a=1", - []query{ - {"http://www.host.test", "a=1"}, - {"http://host.test", ""}, - {"http://bar.host.test", ""}, - {"http://foo.www.host.test", ""}, - {"http://other.test", ""}, - {"http://test", ""}, - }, - }, - { - "Domain cookie #1", - "http://www.host.test", - []string{"a=1; domain=host.test"}, - "a=1", - []query{ - {"http://www.host.test", "a=1"}, - {"http://host.test", "a=1"}, - {"http://bar.host.test", "a=1"}, - {"http://foo.www.host.test", "a=1"}, - {"http://other.test", ""}, - {"http://test", ""}, - }, - }, - { - "Domain cookie #2", - "http://www.host.test", - []string{"a=1; domain=.host.test"}, - "a=1", - []query{ - {"http://www.host.test", "a=1"}, - {"http://host.test", "a=1"}, - {"http://bar.host.test", "a=1"}, - {"http://foo.www.host.test", "a=1"}, - {"http://other.test", ""}, - {"http://test", ""}, - }, - }, - { - "Host cookie on IDNA domain #1", - "http://www.bücher.test", - []string{"a=1"}, - "a=1", - []query{ - {"http://www.bücher.test", "a=1"}, - {"http://www.xn--bcher-kva.test", "a=1"}, - {"http://bücher.test", ""}, - {"http://xn--bcher-kva.test", ""}, - {"http://bar.bücher.test", ""}, - {"http://bar.xn--bcher-kva.test", ""}, - {"http://foo.www.bücher.test", ""}, - {"http://foo.www.xn--bcher-kva.test", ""}, - {"http://other.test", ""}, - {"http://test", ""}, - }, - }, - { - "Host cookie on IDNA domain #2", - "http://www.xn--bcher-kva.test", - []string{"a=1"}, - "a=1", - []query{ - {"http://www.bücher.test", "a=1"}, - {"http://www.xn--bcher-kva.test", "a=1"}, - {"http://bücher.test", ""}, - {"http://xn--bcher-kva.test", ""}, - {"http://bar.bücher.test", ""}, - {"http://bar.xn--bcher-kva.test", ""}, - {"http://foo.www.bücher.test", ""}, - {"http://foo.www.xn--bcher-kva.test", ""}, - {"http://other.test", ""}, - {"http://test", ""}, - }, - }, - { - "Domain cookie on IDNA domain #1", - "http://www.bücher.test", - []string{"a=1; domain=xn--bcher-kva.test"}, - "a=1", - []query{ - {"http://www.bücher.test", "a=1"}, - {"http://www.xn--bcher-kva.test", "a=1"}, - {"http://bücher.test", "a=1"}, - {"http://xn--bcher-kva.test", "a=1"}, - {"http://bar.bücher.test", "a=1"}, - {"http://bar.xn--bcher-kva.test", "a=1"}, - {"http://foo.www.bücher.test", "a=1"}, - {"http://foo.www.xn--bcher-kva.test", "a=1"}, - {"http://other.test", ""}, - {"http://test", ""}, - }, - }, - { - "Domain cookie on IDNA domain #2", - "http://www.xn--bcher-kva.test", - []string{"a=1; domain=xn--bcher-kva.test"}, - "a=1", - []query{ - {"http://www.bücher.test", "a=1"}, - {"http://www.xn--bcher-kva.test", "a=1"}, - {"http://bücher.test", "a=1"}, - {"http://xn--bcher-kva.test", "a=1"}, - {"http://bar.bücher.test", "a=1"}, - {"http://bar.xn--bcher-kva.test", "a=1"}, - {"http://foo.www.bücher.test", "a=1"}, - {"http://foo.www.xn--bcher-kva.test", "a=1"}, - {"http://other.test", ""}, - {"http://test", ""}, - }, - }, - { - "Host cookie on TLD.", - "http://com", - []string{"a=1"}, - "a=1", - []query{ - {"http://com", "a=1"}, - {"http://any.com", ""}, - {"http://any.test", ""}, - }, - }, - { - "Domain cookie on TLD becomes a host cookie.", - "http://com", - []string{"a=1; domain=com"}, - "a=1", - []query{ - {"http://com", "a=1"}, - {"http://any.com", ""}, - {"http://any.test", ""}, - }, - }, - { - "Host cookie on public suffix.", - "http://co.uk", - []string{"a=1"}, - "a=1", - []query{ - {"http://co.uk", "a=1"}, - {"http://uk", ""}, - {"http://some.co.uk", ""}, - {"http://foo.some.co.uk", ""}, - {"http://any.uk", ""}, - }, - }, - { - "Domain cookie on public suffix is ignored.", - "http://some.co.uk", - []string{"a=1; domain=co.uk"}, - "", - []query{ - {"http://co.uk", ""}, - {"http://uk", ""}, - {"http://some.co.uk", ""}, - {"http://foo.some.co.uk", ""}, - {"http://any.uk", ""}, - }, - }, -} - -func TestDomainHandling(t *testing.T) { - for _, test := range domainHandlingTests { - jar := newTestJar() - test.run(t, jar) - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cookiejar/punycode_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/cookiejar/punycode_test.go deleted file mode 100644 index 0301de14e4..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/cookiejar/punycode_test.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cookiejar - -import ( - "testing" -) - -var punycodeTestCases = [...]struct { - s, encoded string -}{ - {"", ""}, - {"-", "--"}, - {"-a", "-a-"}, - {"-a-", "-a--"}, - {"a", "a-"}, - {"a-", "a--"}, - {"a-b", "a-b-"}, - {"books", "books-"}, - {"bücher", "bcher-kva"}, - {"Hello世界", "Hello-ck1hg65u"}, - {"ü", "tda"}, - {"üý", "tdac"}, - - // The test cases below come from RFC 3492 section 7.1 with Errata 3026. - { - // (A) Arabic (Egyptian). - "\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644" + - "\u0645\u0648\u0634\u0639\u0631\u0628\u064A\u061F", - "egbpdaj6bu4bxfgehfvwxn", - }, - { - // (B) Chinese (simplified). - "\u4ED6\u4EEC\u4E3A\u4EC0\u4E48\u4E0D\u8BF4\u4E2D\u6587", - "ihqwcrb4cv8a8dqg056pqjye", - }, - { - // (C) Chinese (traditional). - "\u4ED6\u5011\u7232\u4EC0\u9EBD\u4E0D\u8AAA\u4E2D\u6587", - "ihqwctvzc91f659drss3x8bo0yb", - }, - { - // (D) Czech. - "\u0050\u0072\u006F\u010D\u0070\u0072\u006F\u0073\u0074" + - "\u011B\u006E\u0065\u006D\u006C\u0075\u0076\u00ED\u010D" + - "\u0065\u0073\u006B\u0079", - "Proprostnemluvesky-uyb24dma41a", - }, - { - // (E) Hebrew. - "\u05DC\u05DE\u05D4\u05D4\u05DD\u05E4\u05E9\u05D5\u05D8" + - "\u05DC\u05D0\u05DE\u05D3\u05D1\u05E8\u05D9\u05DD\u05E2" + - "\u05D1\u05E8\u05D9\u05EA", - "4dbcagdahymbxekheh6e0a7fei0b", - }, - { - // (F) Hindi (Devanagari). - "\u092F\u0939\u0932\u094B\u0917\u0939\u093F\u0928\u094D" + - "\u0926\u0940\u0915\u094D\u092F\u094B\u0902\u0928\u0939" + - "\u0940\u0902\u092C\u094B\u0932\u0938\u0915\u0924\u0947" + - "\u0939\u0948\u0902", - "i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd", - }, - { - // (G) Japanese (kanji and hiragana). - "\u306A\u305C\u307F\u3093\u306A\u65E5\u672C\u8A9E\u3092" + - "\u8A71\u3057\u3066\u304F\u308C\u306A\u3044\u306E\u304B", - "n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa", - }, - { - // (H) Korean (Hangul syllables). - "\uC138\uACC4\uC758\uBAA8\uB4E0\uC0AC\uB78C\uB4E4\uC774" + - "\uD55C\uAD6D\uC5B4\uB97C\uC774\uD574\uD55C\uB2E4\uBA74" + - "\uC5BC\uB9C8\uB098\uC88B\uC744\uAE4C", - "989aomsvi5e83db1d2a355cv1e0vak1dwrv93d5xbh15a0dt30a5j" + - "psd879ccm6fea98c", - }, - { - // (I) Russian (Cyrillic). - "\u043F\u043E\u0447\u0435\u043C\u0443\u0436\u0435\u043E" + - "\u043D\u0438\u043D\u0435\u0433\u043E\u0432\u043E\u0440" + - "\u044F\u0442\u043F\u043E\u0440\u0443\u0441\u0441\u043A" + - "\u0438", - "b1abfaaepdrnnbgefbadotcwatmq2g4l", - }, - { - // (J) Spanish. - "\u0050\u006F\u0072\u0071\u0075\u00E9\u006E\u006F\u0070" + - "\u0075\u0065\u0064\u0065\u006E\u0073\u0069\u006D\u0070" + - "\u006C\u0065\u006D\u0065\u006E\u0074\u0065\u0068\u0061" + - "\u0062\u006C\u0061\u0072\u0065\u006E\u0045\u0073\u0070" + - "\u0061\u00F1\u006F\u006C", - "PorqunopuedensimplementehablarenEspaol-fmd56a", - }, - { - // (K) Vietnamese. - "\u0054\u1EA1\u0069\u0073\u0061\u006F\u0068\u1ECD\u006B" + - "\u0068\u00F4\u006E\u0067\u0074\u0068\u1EC3\u0063\u0068" + - "\u1EC9\u006E\u00F3\u0069\u0074\u0069\u1EBF\u006E\u0067" + - "\u0056\u0069\u1EC7\u0074", - "TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g", - }, - { - // (L) 3B. - "\u0033\u5E74\u0042\u7D44\u91D1\u516B\u5148\u751F", - "3B-ww4c5e180e575a65lsy2b", - }, - { - // (M) -with-SUPER-MONKEYS. - "\u5B89\u5BA4\u5948\u7F8E\u6075\u002D\u0077\u0069\u0074" + - "\u0068\u002D\u0053\u0055\u0050\u0045\u0052\u002D\u004D" + - "\u004F\u004E\u004B\u0045\u0059\u0053", - "-with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n", - }, - { - // (N) Hello-Another-Way-. - "\u0048\u0065\u006C\u006C\u006F\u002D\u0041\u006E\u006F" + - "\u0074\u0068\u0065\u0072\u002D\u0057\u0061\u0079\u002D" + - "\u305D\u308C\u305E\u308C\u306E\u5834\u6240", - "Hello-Another-Way--fc4qua05auwb3674vfr0b", - }, - { - // (O) 2. - "\u3072\u3068\u3064\u5C4B\u6839\u306E\u4E0B\u0032", - "2-u9tlzr9756bt3uc0v", - }, - { - // (P) MajiKoi5 - "\u004D\u0061\u006A\u0069\u3067\u004B\u006F\u0069\u3059" + - "\u308B\u0035\u79D2\u524D", - "MajiKoi5-783gue6qz075azm5e", - }, - { - // (Q) de - "\u30D1\u30D5\u30A3\u30FC\u0064\u0065\u30EB\u30F3\u30D0", - "de-jg4avhby1noc0d", - }, - { - // (R) - "\u305D\u306E\u30B9\u30D4\u30FC\u30C9\u3067", - "d9juau41awczczp", - }, - { - // (S) -> $1.00 <- - "\u002D\u003E\u0020\u0024\u0031\u002E\u0030\u0030\u0020" + - "\u003C\u002D", - "-> $1.00 <--", - }, -} - -func TestPunycode(t *testing.T) { - for _, tc := range punycodeTestCases { - if got, err := encode("", tc.s); err != nil { - t.Errorf(`encode("", %q): %v`, tc.s, err) - } else if got != tc.encoded { - t.Errorf(`encode("", %q): got %q, want %q`, tc.s, got, tc.encoded) - } - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/example_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/example_test.go deleted file mode 100644 index 88b97d9e3d..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/example_test.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http_test - -import ( - "fmt" - "io/ioutil" - "log" - "net/http" -) - -func ExampleHijacker() { - http.HandleFunc("/hijack", func(w http.ResponseWriter, r *http.Request) { - hj, ok := w.(http.Hijacker) - if !ok { - http.Error(w, "webserver doesn't support hijacking", http.StatusInternalServerError) - return - } - conn, bufrw, err := hj.Hijack() - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - // Don't forget to close the connection: - defer conn.Close() - bufrw.WriteString("Now we're speaking raw TCP. Say hi: ") - bufrw.Flush() - s, err := bufrw.ReadString('\n') - if err != nil { - log.Printf("error reading string: %v", err) - return - } - fmt.Fprintf(bufrw, "You said: %q\nBye.\n", s) - bufrw.Flush() - }) -} - -func ExampleGet() { - res, err := http.Get("http://www.google.com/robots.txt") - if err != nil { - log.Fatal(err) - } - robots, err := ioutil.ReadAll(res.Body) - res.Body.Close() - if err != nil { - log.Fatal(err) - } - fmt.Printf("%s", robots) -} - -func ExampleFileServer() { - // Simple static webserver: - log.Fatal(http.ListenAndServe(":8080", http.FileServer(http.Dir("/usr/share/doc")))) -} - -func ExampleFileServer_stripPrefix() { - // To serve a directory on disk (/tmp) under an alternate URL - // path (/tmpfiles/), use StripPrefix to modify the request - // URL's path before the FileServer sees it: - http.Handle("/tmpfiles/", http.StripPrefix("/tmpfiles/", http.FileServer(http.Dir("/tmp")))) -} - -func ExampleStripPrefix() { - // To serve a directory on disk (/tmp) under an alternate URL - // path (/tmpfiles/), use StripPrefix to modify the request - // URL's path before the FileServer sees it: - http.Handle("/tmpfiles/", http.StripPrefix("/tmpfiles/", http.FileServer(http.Dir("/tmp")))) -} - -type apiHandler struct{} - -func (apiHandler) ServeHTTP(http.ResponseWriter, *http.Request) {} - -func ExampleServeMux_Handle() { - mux := http.NewServeMux() - mux.Handle("/api/", apiHandler{}) - mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { - // The "/" pattern matches everything, so we need to check - // that we're at the root here. - if req.URL.Path != "/" { - http.NotFound(w, req) - return - } - fmt.Fprintf(w, "Welcome to the home page!") - }) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/export_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/export_test.go deleted file mode 100644 index 960563b240..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/export_test.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Bridge package to expose http internals to tests in the http_test -// package. - -package http - -import ( - "net" - "time" -) - -func NewLoggingConn(baseName string, c net.Conn) net.Conn { - return newLoggingConn(baseName, c) -} - -var ExportAppendTime = appendTime - -func (t *Transport) NumPendingRequestsForTesting() int { - t.reqMu.Lock() - defer t.reqMu.Unlock() - return len(t.reqCanceler) -} - -func (t *Transport) IdleConnKeysForTesting() (keys []string) { - keys = make([]string, 0) - t.idleMu.Lock() - defer t.idleMu.Unlock() - if t.idleConn == nil { - return - } - for key := range t.idleConn { - keys = append(keys, key.String()) - } - return -} - -func (t *Transport) IdleConnCountForTesting(cacheKey string) int { - t.idleMu.Lock() - defer t.idleMu.Unlock() - if t.idleConn == nil { - return 0 - } - for k, conns := range t.idleConn { - if k.String() == cacheKey { - return len(conns) - } - } - return 0 -} - -func (t *Transport) IdleConnChMapSizeForTesting() int { - t.idleMu.Lock() - defer t.idleMu.Unlock() - return len(t.idleConnCh) -} - -func NewTestTimeoutHandler(handler Handler, ch <-chan time.Time) Handler { - f := func() <-chan time.Time { - return ch - } - return &timeoutHandler{handler, f, ""} -} - -func ResetCachedEnvironment() { - httpProxyEnv.reset() - noProxyEnv.reset() -} - -var DefaultUserAgent = defaultUserAgent diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/fcgi/fcgi_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/fcgi/fcgi_test.go deleted file mode 100644 index 6c7e1a9ce8..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/fcgi/fcgi_test.go +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fcgi - -import ( - "bytes" - "errors" - "io" - "testing" -) - -var sizeTests = []struct { - size uint32 - bytes []byte -}{ - {0, []byte{0x00}}, - {127, []byte{0x7F}}, - {128, []byte{0x80, 0x00, 0x00, 0x80}}, - {1000, []byte{0x80, 0x00, 0x03, 0xE8}}, - {33554431, []byte{0x81, 0xFF, 0xFF, 0xFF}}, -} - -func TestSize(t *testing.T) { - b := make([]byte, 4) - for i, test := range sizeTests { - n := encodeSize(b, test.size) - if !bytes.Equal(b[:n], test.bytes) { - t.Errorf("%d expected %x, encoded %x", i, test.bytes, b) - } - size, n := readSize(test.bytes) - if size != test.size { - t.Errorf("%d expected %d, read %d", i, test.size, size) - } - if len(test.bytes) != n { - t.Errorf("%d did not consume all the bytes", i) - } - } -} - -var streamTests = []struct { - desc string - recType recType - reqId uint16 - content []byte - raw []byte -}{ - {"single record", typeStdout, 1, nil, - []byte{1, byte(typeStdout), 0, 1, 0, 0, 0, 0}, - }, - // this data will have to be split into two records - {"two records", typeStdin, 300, make([]byte, 66000), - bytes.Join([][]byte{ - // header for the first record - {1, byte(typeStdin), 0x01, 0x2C, 0xFF, 0xFF, 1, 0}, - make([]byte, 65536), - // header for the second - {1, byte(typeStdin), 0x01, 0x2C, 0x01, 0xD1, 7, 0}, - make([]byte, 472), - // header for the empty record - {1, byte(typeStdin), 0x01, 0x2C, 0, 0, 0, 0}, - }, - nil), - }, -} - -type nilCloser struct { - io.ReadWriter -} - -func (c *nilCloser) Close() error { return nil } - -func TestStreams(t *testing.T) { - var rec record -outer: - for _, test := range streamTests { - buf := bytes.NewBuffer(test.raw) - var content []byte - for buf.Len() > 0 { - if err := rec.read(buf); err != nil { - t.Errorf("%s: error reading record: %v", test.desc, err) - continue outer - } - content = append(content, rec.content()...) - } - if rec.h.Type != test.recType { - t.Errorf("%s: got type %d expected %d", test.desc, rec.h.Type, test.recType) - continue - } - if rec.h.Id != test.reqId { - t.Errorf("%s: got request ID %d expected %d", test.desc, rec.h.Id, test.reqId) - continue - } - if !bytes.Equal(content, test.content) { - t.Errorf("%s: read wrong content", test.desc) - continue - } - buf.Reset() - c := newConn(&nilCloser{buf}) - w := newWriter(c, test.recType, test.reqId) - if _, err := w.Write(test.content); err != nil { - t.Errorf("%s: error writing record: %v", test.desc, err) - continue - } - if err := w.Close(); err != nil { - t.Errorf("%s: error closing stream: %v", test.desc, err) - continue - } - if !bytes.Equal(buf.Bytes(), test.raw) { - t.Errorf("%s: wrote wrong content", test.desc) - } - } -} - -type writeOnlyConn struct { - buf []byte -} - -func (c *writeOnlyConn) Write(p []byte) (int, error) { - c.buf = append(c.buf, p...) - return len(p), nil -} - -func (c *writeOnlyConn) Read(p []byte) (int, error) { - return 0, errors.New("conn is write-only") -} - -func (c *writeOnlyConn) Close() error { - return nil -} - -func TestGetValues(t *testing.T) { - var rec record - rec.h.Type = typeGetValues - - wc := new(writeOnlyConn) - c := newChild(wc, nil) - err := c.handleRecord(&rec) - if err != nil { - t.Fatalf("handleRecord: %v", err) - } - - const want = "\x01\n\x00\x00\x00\x12\x06\x00" + - "\x0f\x01FCGI_MPXS_CONNS1" + - "\x00\x00\x00\x00\x00\x00\x01\n\x00\x00\x00\x00\x00\x00" - if got := string(wc.buf); got != want { - t.Errorf(" got: %q\nwant: %q\n", got, want) - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/filetransport_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/filetransport_test.go deleted file mode 100644 index 6f1a537e2e..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/filetransport_test.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http - -import ( - "io/ioutil" - "os" - "path/filepath" - "testing" -) - -func checker(t *testing.T) func(string, error) { - return func(call string, err error) { - if err == nil { - return - } - t.Fatalf("%s: %v", call, err) - } -} - -func TestFileTransport(t *testing.T) { - check := checker(t) - - dname, err := ioutil.TempDir("", "") - check("TempDir", err) - fname := filepath.Join(dname, "foo.txt") - err = ioutil.WriteFile(fname, []byte("Bar"), 0644) - check("WriteFile", err) - defer os.Remove(dname) - defer os.Remove(fname) - - tr := &Transport{} - tr.RegisterProtocol("file", NewFileTransport(Dir(dname))) - c := &Client{Transport: tr} - - fooURLs := []string{"file:///foo.txt", "file://../foo.txt"} - for _, urlstr := range fooURLs { - res, err := c.Get(urlstr) - check("Get "+urlstr, err) - if res.StatusCode != 200 { - t.Errorf("for %s, StatusCode = %d, want 200", urlstr, res.StatusCode) - } - if res.ContentLength != -1 { - t.Errorf("for %s, ContentLength = %d, want -1", urlstr, res.ContentLength) - } - if res.Body == nil { - t.Fatalf("for %s, nil Body", urlstr) - } - slurp, err := ioutil.ReadAll(res.Body) - check("ReadAll "+urlstr, err) - if string(slurp) != "Bar" { - t.Errorf("for %s, got content %q, want %q", urlstr, string(slurp), "Bar") - } - } - - const badURL = "file://../no-exist.txt" - res, err := c.Get(badURL) - check("Get "+badURL, err) - if res.StatusCode != 404 { - t.Errorf("for %s, StatusCode = %d, want 404", badURL, res.StatusCode) - } - res.Body.Close() -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/fs_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/fs_test.go deleted file mode 100644 index f968565f9b..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/fs_test.go +++ /dev/null @@ -1,858 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http_test - -import ( - "bytes" - "errors" - "fmt" - "io" - "io/ioutil" - "mime" - "mime/multipart" - "net" - . "net/http" - "net/http/httptest" - "net/url" - "os" - "os/exec" - "path" - "path/filepath" - "reflect" - "regexp" - "runtime" - "strconv" - "strings" - "testing" - "time" -) - -const ( - testFile = "testdata/file" - testFileLen = 11 -) - -type wantRange struct { - start, end int64 // range [start,end) -} - -var itoa = strconv.Itoa - -var ServeFileRangeTests = []struct { - r string - code int - ranges []wantRange -}{ - {r: "", code: StatusOK}, - {r: "bytes=0-4", code: StatusPartialContent, ranges: []wantRange{{0, 5}}}, - {r: "bytes=2-", code: StatusPartialContent, ranges: []wantRange{{2, testFileLen}}}, - {r: "bytes=-5", code: StatusPartialContent, ranges: []wantRange{{testFileLen - 5, testFileLen}}}, - {r: "bytes=3-7", code: StatusPartialContent, ranges: []wantRange{{3, 8}}}, - {r: "bytes=20-", code: StatusRequestedRangeNotSatisfiable}, - {r: "bytes=0-0,-2", code: StatusPartialContent, ranges: []wantRange{{0, 1}, {testFileLen - 2, testFileLen}}}, - {r: "bytes=0-1,5-8", code: StatusPartialContent, ranges: []wantRange{{0, 2}, {5, 9}}}, - {r: "bytes=0-1,5-", code: StatusPartialContent, ranges: []wantRange{{0, 2}, {5, testFileLen}}}, - {r: "bytes=5-1000", code: StatusPartialContent, ranges: []wantRange{{5, testFileLen}}}, - {r: "bytes=0-,1-,2-,3-,4-", code: StatusOK}, // ignore wasteful range request - {r: "bytes=0-" + itoa(testFileLen-2), code: StatusPartialContent, ranges: []wantRange{{0, testFileLen - 1}}}, - {r: "bytes=0-" + itoa(testFileLen-1), code: StatusPartialContent, ranges: []wantRange{{0, testFileLen}}}, - {r: "bytes=0-" + itoa(testFileLen), code: StatusPartialContent, ranges: []wantRange{{0, testFileLen}}}, -} - -func TestServeFile(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - ServeFile(w, r, "testdata/file") - })) - defer ts.Close() - - var err error - - file, err := ioutil.ReadFile(testFile) - if err != nil { - t.Fatal("reading file:", err) - } - - // set up the Request (re-used for all tests) - var req Request - req.Header = make(Header) - if req.URL, err = url.Parse(ts.URL); err != nil { - t.Fatal("ParseURL:", err) - } - req.Method = "GET" - - // straight GET - _, body := getBody(t, "straight get", req) - if !bytes.Equal(body, file) { - t.Fatalf("body mismatch: got %q, want %q", body, file) - } - - // Range tests -Cases: - for _, rt := range ServeFileRangeTests { - if rt.r != "" { - req.Header.Set("Range", rt.r) - } - resp, body := getBody(t, fmt.Sprintf("range test %q", rt.r), req) - if resp.StatusCode != rt.code { - t.Errorf("range=%q: StatusCode=%d, want %d", rt.r, resp.StatusCode, rt.code) - } - if rt.code == StatusRequestedRangeNotSatisfiable { - continue - } - wantContentRange := "" - if len(rt.ranges) == 1 { - rng := rt.ranges[0] - wantContentRange = fmt.Sprintf("bytes %d-%d/%d", rng.start, rng.end-1, testFileLen) - } - cr := resp.Header.Get("Content-Range") - if cr != wantContentRange { - t.Errorf("range=%q: Content-Range = %q, want %q", rt.r, cr, wantContentRange) - } - ct := resp.Header.Get("Content-Type") - if len(rt.ranges) == 1 { - rng := rt.ranges[0] - wantBody := file[rng.start:rng.end] - if !bytes.Equal(body, wantBody) { - t.Errorf("range=%q: body = %q, want %q", rt.r, body, wantBody) - } - if strings.HasPrefix(ct, "multipart/byteranges") { - t.Errorf("range=%q content-type = %q; unexpected multipart/byteranges", rt.r, ct) - } - } - if len(rt.ranges) > 1 { - typ, params, err := mime.ParseMediaType(ct) - if err != nil { - t.Errorf("range=%q content-type = %q; %v", rt.r, ct, err) - continue - } - if typ != "multipart/byteranges" { - t.Errorf("range=%q content-type = %q; want multipart/byteranges", rt.r, typ) - continue - } - if params["boundary"] == "" { - t.Errorf("range=%q content-type = %q; lacks boundary", rt.r, ct) - continue - } - if g, w := resp.ContentLength, int64(len(body)); g != w { - t.Errorf("range=%q Content-Length = %d; want %d", rt.r, g, w) - continue - } - mr := multipart.NewReader(bytes.NewReader(body), params["boundary"]) - for ri, rng := range rt.ranges { - part, err := mr.NextPart() - if err != nil { - t.Errorf("range=%q, reading part index %d: %v", rt.r, ri, err) - continue Cases - } - wantContentRange = fmt.Sprintf("bytes %d-%d/%d", rng.start, rng.end-1, testFileLen) - if g, w := part.Header.Get("Content-Range"), wantContentRange; g != w { - t.Errorf("range=%q: part Content-Range = %q; want %q", rt.r, g, w) - } - body, err := ioutil.ReadAll(part) - if err != nil { - t.Errorf("range=%q, reading part index %d body: %v", rt.r, ri, err) - continue Cases - } - wantBody := file[rng.start:rng.end] - if !bytes.Equal(body, wantBody) { - t.Errorf("range=%q: body = %q, want %q", rt.r, body, wantBody) - } - } - _, err = mr.NextPart() - if err != io.EOF { - t.Errorf("range=%q; expected final error io.EOF; got %v", rt.r, err) - } - } - } -} - -var fsRedirectTestData = []struct { - original, redirect string -}{ - {"/test/index.html", "/test/"}, - {"/test/testdata", "/test/testdata/"}, - {"/test/testdata/file/", "/test/testdata/file"}, -} - -func TestFSRedirect(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(StripPrefix("/test", FileServer(Dir(".")))) - defer ts.Close() - - for _, data := range fsRedirectTestData { - res, err := Get(ts.URL + data.original) - if err != nil { - t.Fatal(err) - } - res.Body.Close() - if g, e := res.Request.URL.Path, data.redirect; g != e { - t.Errorf("redirect from %s: got %s, want %s", data.original, g, e) - } - } -} - -type testFileSystem struct { - open func(name string) (File, error) -} - -func (fs *testFileSystem) Open(name string) (File, error) { - return fs.open(name) -} - -func TestFileServerCleans(t *testing.T) { - defer afterTest(t) - ch := make(chan string, 1) - fs := FileServer(&testFileSystem{func(name string) (File, error) { - ch <- name - return nil, errors.New("file does not exist") - }}) - tests := []struct { - reqPath, openArg string - }{ - {"/foo.txt", "/foo.txt"}, - {"//foo.txt", "/foo.txt"}, - {"/../foo.txt", "/foo.txt"}, - } - req, _ := NewRequest("GET", "http://example.com", nil) - for n, test := range tests { - rec := httptest.NewRecorder() - req.URL.Path = test.reqPath - fs.ServeHTTP(rec, req) - if got := <-ch; got != test.openArg { - t.Errorf("test %d: got %q, want %q", n, got, test.openArg) - } - } -} - -func TestFileServerEscapesNames(t *testing.T) { - defer afterTest(t) - const dirListPrefix = "
\n"
-	const dirListSuffix = "\n
\n" - tests := []struct { - name, escaped string - }{ - {`simple_name`, `simple_name`}, - {`"'<>&`, `"'<>&`}, - {`?foo=bar#baz`, `?foo=bar#baz`}, - {`?foo`, `<combo>?foo`}, - } - - // We put each test file in its own directory in the fakeFS so we can look at it in isolation. - fs := make(fakeFS) - for i, test := range tests { - testFile := &fakeFileInfo{basename: test.name} - fs[fmt.Sprintf("/%d", i)] = &fakeFileInfo{ - dir: true, - modtime: time.Unix(1000000000, 0).UTC(), - ents: []*fakeFileInfo{testFile}, - } - fs[fmt.Sprintf("/%d/%s", i, test.name)] = testFile - } - - ts := httptest.NewServer(FileServer(&fs)) - defer ts.Close() - for i, test := range tests { - url := fmt.Sprintf("%s/%d", ts.URL, i) - res, err := Get(url) - if err != nil { - t.Fatalf("test %q: Get: %v", test.name, err) - } - b, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatalf("test %q: read Body: %v", test.name, err) - } - s := string(b) - if !strings.HasPrefix(s, dirListPrefix) || !strings.HasSuffix(s, dirListSuffix) { - t.Errorf("test %q: listing dir, full output is %q, want prefix %q and suffix %q", test.name, s, dirListPrefix, dirListSuffix) - } - if trimmed := strings.TrimSuffix(strings.TrimPrefix(s, dirListPrefix), dirListSuffix); trimmed != test.escaped { - t.Errorf("test %q: listing dir, filename escaped to %q, want %q", test.name, trimmed, test.escaped) - } - res.Body.Close() - } -} - -func mustRemoveAll(dir string) { - err := os.RemoveAll(dir) - if err != nil { - panic(err) - } -} - -func TestFileServerImplicitLeadingSlash(t *testing.T) { - defer afterTest(t) - tempDir, err := ioutil.TempDir("", "") - if err != nil { - t.Fatalf("TempDir: %v", err) - } - defer mustRemoveAll(tempDir) - if err := ioutil.WriteFile(filepath.Join(tempDir, "foo.txt"), []byte("Hello world"), 0644); err != nil { - t.Fatalf("WriteFile: %v", err) - } - ts := httptest.NewServer(StripPrefix("/bar/", FileServer(Dir(tempDir)))) - defer ts.Close() - get := func(suffix string) string { - res, err := Get(ts.URL + suffix) - if err != nil { - t.Fatalf("Get %s: %v", suffix, err) - } - b, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatalf("ReadAll %s: %v", suffix, err) - } - res.Body.Close() - return string(b) - } - if s := get("/bar/"); !strings.Contains(s, ">foo.txt<") { - t.Logf("expected a directory listing with foo.txt, got %q", s) - } - if s := get("/bar/foo.txt"); s != "Hello world" { - t.Logf("expected %q, got %q", "Hello world", s) - } -} - -func TestDirJoin(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("skipping test on windows") - } - wfi, err := os.Stat("/etc/hosts") - if err != nil { - t.Skip("skipping test; no /etc/hosts file") - } - test := func(d Dir, name string) { - f, err := d.Open(name) - if err != nil { - t.Fatalf("open of %s: %v", name, err) - } - defer f.Close() - gfi, err := f.Stat() - if err != nil { - t.Fatalf("stat of %s: %v", name, err) - } - if !os.SameFile(gfi, wfi) { - t.Errorf("%s got different file", name) - } - } - test(Dir("/etc/"), "/hosts") - test(Dir("/etc/"), "hosts") - test(Dir("/etc/"), "../../../../hosts") - test(Dir("/etc"), "/hosts") - test(Dir("/etc"), "hosts") - test(Dir("/etc"), "../../../../hosts") - - // Not really directories, but since we use this trick in - // ServeFile, test it: - test(Dir("/etc/hosts"), "") - test(Dir("/etc/hosts"), "/") - test(Dir("/etc/hosts"), "../") -} - -func TestEmptyDirOpenCWD(t *testing.T) { - test := func(d Dir) { - name := "fs_test.go" - f, err := d.Open(name) - if err != nil { - t.Fatalf("open of %s: %v", name, err) - } - defer f.Close() - } - test(Dir("")) - test(Dir(".")) - test(Dir("./")) -} - -func TestServeFileContentType(t *testing.T) { - defer afterTest(t) - const ctype = "icecream/chocolate" - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - switch r.FormValue("override") { - case "1": - w.Header().Set("Content-Type", ctype) - case "2": - // Explicitly inhibit sniffing. - w.Header()["Content-Type"] = []string{} - } - ServeFile(w, r, "testdata/file") - })) - defer ts.Close() - get := func(override string, want []string) { - resp, err := Get(ts.URL + "?override=" + override) - if err != nil { - t.Fatal(err) - } - if h := resp.Header["Content-Type"]; !reflect.DeepEqual(h, want) { - t.Errorf("Content-Type mismatch: got %v, want %v", h, want) - } - resp.Body.Close() - } - get("0", []string{"text/plain; charset=utf-8"}) - get("1", []string{ctype}) - get("2", nil) -} - -func TestServeFileMimeType(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - ServeFile(w, r, "testdata/style.css") - })) - defer ts.Close() - resp, err := Get(ts.URL) - if err != nil { - t.Fatal(err) - } - resp.Body.Close() - want := "text/css; charset=utf-8" - if h := resp.Header.Get("Content-Type"); h != want { - t.Errorf("Content-Type mismatch: got %q, want %q", h, want) - } -} - -func TestServeFileFromCWD(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - ServeFile(w, r, "fs_test.go") - })) - defer ts.Close() - r, err := Get(ts.URL) - if err != nil { - t.Fatal(err) - } - r.Body.Close() - if r.StatusCode != 200 { - t.Fatalf("expected 200 OK, got %s", r.Status) - } -} - -func TestServeFileWithContentEncoding(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - w.Header().Set("Content-Encoding", "foo") - ServeFile(w, r, "testdata/file") - })) - defer ts.Close() - resp, err := Get(ts.URL) - if err != nil { - t.Fatal(err) - } - resp.Body.Close() - if g, e := resp.ContentLength, int64(-1); g != e { - t.Errorf("Content-Length mismatch: got %d, want %d", g, e) - } -} - -func TestServeIndexHtml(t *testing.T) { - defer afterTest(t) - const want = "index.html says hello\n" - ts := httptest.NewServer(FileServer(Dir("."))) - defer ts.Close() - - for _, path := range []string{"/testdata/", "/testdata/index.html"} { - res, err := Get(ts.URL + path) - if err != nil { - t.Fatal(err) - } - b, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatal("reading Body:", err) - } - if s := string(b); s != want { - t.Errorf("for path %q got %q, want %q", path, s, want) - } - res.Body.Close() - } -} - -func TestFileServerZeroByte(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(FileServer(Dir("."))) - defer ts.Close() - - res, err := Get(ts.URL + "/..\x00") - if err != nil { - t.Fatal(err) - } - b, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatal("reading Body:", err) - } - if res.StatusCode == 200 { - t.Errorf("got status 200; want an error. Body is:\n%s", string(b)) - } -} - -type fakeFileInfo struct { - dir bool - basename string - modtime time.Time - ents []*fakeFileInfo - contents string -} - -func (f *fakeFileInfo) Name() string { return f.basename } -func (f *fakeFileInfo) Sys() interface{} { return nil } -func (f *fakeFileInfo) ModTime() time.Time { return f.modtime } -func (f *fakeFileInfo) IsDir() bool { return f.dir } -func (f *fakeFileInfo) Size() int64 { return int64(len(f.contents)) } -func (f *fakeFileInfo) Mode() os.FileMode { - if f.dir { - return 0755 | os.ModeDir - } - return 0644 -} - -type fakeFile struct { - io.ReadSeeker - fi *fakeFileInfo - path string // as opened - entpos int -} - -func (f *fakeFile) Close() error { return nil } -func (f *fakeFile) Stat() (os.FileInfo, error) { return f.fi, nil } -func (f *fakeFile) Readdir(count int) ([]os.FileInfo, error) { - if !f.fi.dir { - return nil, os.ErrInvalid - } - var fis []os.FileInfo - - limit := f.entpos + count - if count <= 0 || limit > len(f.fi.ents) { - limit = len(f.fi.ents) - } - for ; f.entpos < limit; f.entpos++ { - fis = append(fis, f.fi.ents[f.entpos]) - } - - if len(fis) == 0 && count > 0 { - return fis, io.EOF - } else { - return fis, nil - } -} - -type fakeFS map[string]*fakeFileInfo - -func (fs fakeFS) Open(name string) (File, error) { - name = path.Clean(name) - f, ok := fs[name] - if !ok { - return nil, os.ErrNotExist - } - return &fakeFile{ReadSeeker: strings.NewReader(f.contents), fi: f, path: name}, nil -} - -func TestDirectoryIfNotModified(t *testing.T) { - defer afterTest(t) - const indexContents = "I am a fake index.html file" - fileMod := time.Unix(1000000000, 0).UTC() - fileModStr := fileMod.Format(TimeFormat) - dirMod := time.Unix(123, 0).UTC() - indexFile := &fakeFileInfo{ - basename: "index.html", - modtime: fileMod, - contents: indexContents, - } - fs := fakeFS{ - "/": &fakeFileInfo{ - dir: true, - modtime: dirMod, - ents: []*fakeFileInfo{indexFile}, - }, - "/index.html": indexFile, - } - - ts := httptest.NewServer(FileServer(fs)) - defer ts.Close() - - res, err := Get(ts.URL) - if err != nil { - t.Fatal(err) - } - b, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatal(err) - } - if string(b) != indexContents { - t.Fatalf("Got body %q; want %q", b, indexContents) - } - res.Body.Close() - - lastMod := res.Header.Get("Last-Modified") - if lastMod != fileModStr { - t.Fatalf("initial Last-Modified = %q; want %q", lastMod, fileModStr) - } - - req, _ := NewRequest("GET", ts.URL, nil) - req.Header.Set("If-Modified-Since", lastMod) - - res, err = DefaultClient.Do(req) - if err != nil { - t.Fatal(err) - } - if res.StatusCode != 304 { - t.Fatalf("Code after If-Modified-Since request = %v; want 304", res.StatusCode) - } - res.Body.Close() - - // Advance the index.html file's modtime, but not the directory's. - indexFile.modtime = indexFile.modtime.Add(1 * time.Hour) - - res, err = DefaultClient.Do(req) - if err != nil { - t.Fatal(err) - } - if res.StatusCode != 200 { - t.Fatalf("Code after second If-Modified-Since request = %v; want 200; res is %#v", res.StatusCode, res) - } - res.Body.Close() -} - -func mustStat(t *testing.T, fileName string) os.FileInfo { - fi, err := os.Stat(fileName) - if err != nil { - t.Fatal(err) - } - return fi -} - -func TestServeContent(t *testing.T) { - defer afterTest(t) - type serveParam struct { - name string - modtime time.Time - content io.ReadSeeker - contentType string - etag string - } - servec := make(chan serveParam, 1) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - p := <-servec - if p.etag != "" { - w.Header().Set("ETag", p.etag) - } - if p.contentType != "" { - w.Header().Set("Content-Type", p.contentType) - } - ServeContent(w, r, p.name, p.modtime, p.content) - })) - defer ts.Close() - - type testCase struct { - // One of file or content must be set: - file string - content io.ReadSeeker - - modtime time.Time - serveETag string // optional - serveContentType string // optional - reqHeader map[string]string - wantLastMod string - wantContentType string - wantStatus int - } - htmlModTime := mustStat(t, "testdata/index.html").ModTime() - tests := map[string]testCase{ - "no_last_modified": { - file: "testdata/style.css", - wantContentType: "text/css; charset=utf-8", - wantStatus: 200, - }, - "with_last_modified": { - file: "testdata/index.html", - wantContentType: "text/html; charset=utf-8", - modtime: htmlModTime, - wantLastMod: htmlModTime.UTC().Format(TimeFormat), - wantStatus: 200, - }, - "not_modified_modtime": { - file: "testdata/style.css", - modtime: htmlModTime, - reqHeader: map[string]string{ - "If-Modified-Since": htmlModTime.UTC().Format(TimeFormat), - }, - wantStatus: 304, - }, - "not_modified_modtime_with_contenttype": { - file: "testdata/style.css", - serveContentType: "text/css", // explicit content type - modtime: htmlModTime, - reqHeader: map[string]string{ - "If-Modified-Since": htmlModTime.UTC().Format(TimeFormat), - }, - wantStatus: 304, - }, - "not_modified_etag": { - file: "testdata/style.css", - serveETag: `"foo"`, - reqHeader: map[string]string{ - "If-None-Match": `"foo"`, - }, - wantStatus: 304, - }, - "not_modified_etag_no_seek": { - content: panicOnSeek{nil}, // should never be called - serveETag: `"foo"`, - reqHeader: map[string]string{ - "If-None-Match": `"foo"`, - }, - wantStatus: 304, - }, - "range_good": { - file: "testdata/style.css", - serveETag: `"A"`, - reqHeader: map[string]string{ - "Range": "bytes=0-4", - }, - wantStatus: StatusPartialContent, - wantContentType: "text/css; charset=utf-8", - }, - // An If-Range resource for entity "A", but entity "B" is now current. - // The Range request should be ignored. - "range_no_match": { - file: "testdata/style.css", - serveETag: `"A"`, - reqHeader: map[string]string{ - "Range": "bytes=0-4", - "If-Range": `"B"`, - }, - wantStatus: 200, - wantContentType: "text/css; charset=utf-8", - }, - } - for testName, tt := range tests { - var content io.ReadSeeker - if tt.file != "" { - f, err := os.Open(tt.file) - if err != nil { - t.Fatalf("test %q: %v", testName, err) - } - defer f.Close() - content = f - } else { - content = tt.content - } - - servec <- serveParam{ - name: filepath.Base(tt.file), - content: content, - modtime: tt.modtime, - etag: tt.serveETag, - contentType: tt.serveContentType, - } - req, err := NewRequest("GET", ts.URL, nil) - if err != nil { - t.Fatal(err) - } - for k, v := range tt.reqHeader { - req.Header.Set(k, v) - } - res, err := DefaultClient.Do(req) - if err != nil { - t.Fatal(err) - } - io.Copy(ioutil.Discard, res.Body) - res.Body.Close() - if res.StatusCode != tt.wantStatus { - t.Errorf("test %q: status = %d; want %d", testName, res.StatusCode, tt.wantStatus) - } - if g, e := res.Header.Get("Content-Type"), tt.wantContentType; g != e { - t.Errorf("test %q: content-type = %q, want %q", testName, g, e) - } - if g, e := res.Header.Get("Last-Modified"), tt.wantLastMod; g != e { - t.Errorf("test %q: last-modified = %q, want %q", testName, g, e) - } - } -} - -// verifies that sendfile is being used on Linux -func TestLinuxSendfile(t *testing.T) { - defer afterTest(t) - if runtime.GOOS != "linux" { - t.Skip("skipping; linux-only test") - } - if _, err := exec.LookPath("strace"); err != nil { - t.Skip("skipping; strace not found in path") - } - - ln, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - t.Fatal(err) - } - lnf, err := ln.(*net.TCPListener).File() - if err != nil { - t.Fatal(err) - } - defer ln.Close() - - var buf bytes.Buffer - child := exec.Command("strace", "-f", "-q", "-e", "trace=sendfile,sendfile64", os.Args[0], "-test.run=TestLinuxSendfileChild") - child.ExtraFiles = append(child.ExtraFiles, lnf) - child.Env = append([]string{"GO_WANT_HELPER_PROCESS=1"}, os.Environ()...) - child.Stdout = &buf - child.Stderr = &buf - if err := child.Start(); err != nil { - t.Skipf("skipping; failed to start straced child: %v", err) - } - - res, err := Get(fmt.Sprintf("http://%s/", ln.Addr())) - if err != nil { - t.Fatalf("http client error: %v", err) - } - _, err = io.Copy(ioutil.Discard, res.Body) - if err != nil { - t.Fatalf("client body read error: %v", err) - } - res.Body.Close() - - // Force child to exit cleanly. - Get(fmt.Sprintf("http://%s/quit", ln.Addr())) - child.Wait() - - rx := regexp.MustCompile(`sendfile(64)?\(\d+,\s*\d+,\s*NULL,\s*\d+\)\s*=\s*\d+\s*\n`) - rxResume := regexp.MustCompile(`<\.\.\. sendfile(64)? resumed> \)\s*=\s*\d+\s*\n`) - out := buf.String() - if !rx.MatchString(out) && !rxResume.MatchString(out) { - t.Errorf("no sendfile system call found in:\n%s", out) - } -} - -func getBody(t *testing.T, testName string, req Request) (*Response, []byte) { - r, err := DefaultClient.Do(&req) - if err != nil { - t.Fatalf("%s: for URL %q, send error: %v", testName, req.URL.String(), err) - } - b, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("%s: for URL %q, reading body: %v", testName, req.URL.String(), err) - } - return r, b -} - -// TestLinuxSendfileChild isn't a real test. It's used as a helper process -// for TestLinuxSendfile. -func TestLinuxSendfileChild(*testing.T) { - if os.Getenv("GO_WANT_HELPER_PROCESS") != "1" { - return - } - defer os.Exit(0) - fd3 := os.NewFile(3, "ephemeral-port-listener") - ln, err := net.FileListener(fd3) - if err != nil { - panic(err) - } - mux := NewServeMux() - mux.Handle("/", FileServer(Dir("testdata"))) - mux.HandleFunc("/quit", func(ResponseWriter, *Request) { - os.Exit(0) - }) - s := &Server{Handler: mux} - err = s.Serve(ln) - if err != nil { - panic(err) - } -} - -type panicOnSeek struct{ io.ReadSeeker } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/header_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/header_test.go deleted file mode 100644 index 9dcd591fa0..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/header_test.go +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http - -import ( - "bytes" - "runtime" - "testing" - "time" -) - -var headerWriteTests = []struct { - h Header - exclude map[string]bool - expected string -}{ - {Header{}, nil, ""}, - { - Header{ - "Content-Type": {"text/html; charset=UTF-8"}, - "Content-Length": {"0"}, - }, - nil, - "Content-Length: 0\r\nContent-Type: text/html; charset=UTF-8\r\n", - }, - { - Header{ - "Content-Length": {"0", "1", "2"}, - }, - nil, - "Content-Length: 0\r\nContent-Length: 1\r\nContent-Length: 2\r\n", - }, - { - Header{ - "Expires": {"-1"}, - "Content-Length": {"0"}, - "Content-Encoding": {"gzip"}, - }, - map[string]bool{"Content-Length": true}, - "Content-Encoding: gzip\r\nExpires: -1\r\n", - }, - { - Header{ - "Expires": {"-1"}, - "Content-Length": {"0", "1", "2"}, - "Content-Encoding": {"gzip"}, - }, - map[string]bool{"Content-Length": true}, - "Content-Encoding: gzip\r\nExpires: -1\r\n", - }, - { - Header{ - "Expires": {"-1"}, - "Content-Length": {"0"}, - "Content-Encoding": {"gzip"}, - }, - map[string]bool{"Content-Length": true, "Expires": true, "Content-Encoding": true}, - "", - }, - { - Header{ - "Nil": nil, - "Empty": {}, - "Blank": {""}, - "Double-Blank": {"", ""}, - }, - nil, - "Blank: \r\nDouble-Blank: \r\nDouble-Blank: \r\n", - }, - // Tests header sorting when over the insertion sort threshold side: - { - Header{ - "k1": {"1a", "1b"}, - "k2": {"2a", "2b"}, - "k3": {"3a", "3b"}, - "k4": {"4a", "4b"}, - "k5": {"5a", "5b"}, - "k6": {"6a", "6b"}, - "k7": {"7a", "7b"}, - "k8": {"8a", "8b"}, - "k9": {"9a", "9b"}, - }, - map[string]bool{"k5": true}, - "k1: 1a\r\nk1: 1b\r\nk2: 2a\r\nk2: 2b\r\nk3: 3a\r\nk3: 3b\r\n" + - "k4: 4a\r\nk4: 4b\r\nk6: 6a\r\nk6: 6b\r\n" + - "k7: 7a\r\nk7: 7b\r\nk8: 8a\r\nk8: 8b\r\nk9: 9a\r\nk9: 9b\r\n", - }, -} - -func TestHeaderWrite(t *testing.T) { - var buf bytes.Buffer - for i, test := range headerWriteTests { - test.h.WriteSubset(&buf, test.exclude) - if buf.String() != test.expected { - t.Errorf("#%d:\n got: %q\nwant: %q", i, buf.String(), test.expected) - } - buf.Reset() - } -} - -var parseTimeTests = []struct { - h Header - err bool -}{ - {Header{"Date": {""}}, true}, - {Header{"Date": {"invalid"}}, true}, - {Header{"Date": {"1994-11-06T08:49:37Z00:00"}}, true}, - {Header{"Date": {"Sun, 06 Nov 1994 08:49:37 GMT"}}, false}, - {Header{"Date": {"Sunday, 06-Nov-94 08:49:37 GMT"}}, false}, - {Header{"Date": {"Sun Nov 6 08:49:37 1994"}}, false}, -} - -func TestParseTime(t *testing.T) { - expect := time.Date(1994, 11, 6, 8, 49, 37, 0, time.UTC) - for i, test := range parseTimeTests { - d, err := ParseTime(test.h.Get("Date")) - if err != nil { - if !test.err { - t.Errorf("#%d:\n got err: %v", i, err) - } - continue - } - if test.err { - t.Errorf("#%d:\n should err", i) - continue - } - if !expect.Equal(d) { - t.Errorf("#%d:\n got: %v\nwant: %v", i, d, expect) - } - } -} - -type hasTokenTest struct { - header string - token string - want bool -} - -var hasTokenTests = []hasTokenTest{ - {"", "", false}, - {"", "foo", false}, - {"foo", "foo", true}, - {"foo ", "foo", true}, - {" foo", "foo", true}, - {" foo ", "foo", true}, - {"foo,bar", "foo", true}, - {"bar,foo", "foo", true}, - {"bar, foo", "foo", true}, - {"bar,foo, baz", "foo", true}, - {"bar, foo,baz", "foo", true}, - {"bar,foo, baz", "foo", true}, - {"bar, foo, baz", "foo", true}, - {"FOO", "foo", true}, - {"FOO ", "foo", true}, - {" FOO", "foo", true}, - {" FOO ", "foo", true}, - {"FOO,BAR", "foo", true}, - {"BAR,FOO", "foo", true}, - {"BAR, FOO", "foo", true}, - {"BAR,FOO, baz", "foo", true}, - {"BAR, FOO,BAZ", "foo", true}, - {"BAR,FOO, BAZ", "foo", true}, - {"BAR, FOO, BAZ", "foo", true}, - {"foobar", "foo", false}, - {"barfoo ", "foo", false}, -} - -func TestHasToken(t *testing.T) { - for _, tt := range hasTokenTests { - if hasToken(tt.header, tt.token) != tt.want { - t.Errorf("hasToken(%q, %q) = %v; want %v", tt.header, tt.token, !tt.want, tt.want) - } - } -} - -var testHeader = Header{ - "Content-Length": {"123"}, - "Content-Type": {"text/plain"}, - "Date": {"some date at some time Z"}, - "Server": {DefaultUserAgent}, -} - -var buf bytes.Buffer - -func BenchmarkHeaderWriteSubset(b *testing.B) { - b.ReportAllocs() - for i := 0; i < b.N; i++ { - buf.Reset() - testHeader.WriteSubset(&buf, nil) - } -} - -func TestHeaderWriteSubsetAllocs(t *testing.T) { - if testing.Short() { - t.Skip("skipping alloc test in short mode") - } - if raceEnabled { - t.Skip("skipping test under race detector") - } - if runtime.GOMAXPROCS(0) > 1 { - t.Skip("skipping; GOMAXPROCS>1") - } - n := testing.AllocsPerRun(100, func() { - buf.Reset() - testHeader.WriteSubset(&buf, nil) - }) - if n > 0 { - t.Errorf("allocs = %g; want 0", n) - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/httptest/example_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/httptest/example_test.go deleted file mode 100644 index 42a0ec953b..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/httptest/example_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package httptest_test - -import ( - "fmt" - "io/ioutil" - "log" - "net/http" - "net/http/httptest" -) - -func ExampleResponseRecorder() { - handler := func(w http.ResponseWriter, r *http.Request) { - http.Error(w, "something failed", http.StatusInternalServerError) - } - - req, err := http.NewRequest("GET", "http://example.com/foo", nil) - if err != nil { - log.Fatal(err) - } - - w := httptest.NewRecorder() - handler(w, req) - - fmt.Printf("%d - %s", w.Code, w.Body.String()) - // Output: 500 - something failed -} - -func ExampleServer() { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintln(w, "Hello, client") - })) - defer ts.Close() - - res, err := http.Get(ts.URL) - if err != nil { - log.Fatal(err) - } - greeting, err := ioutil.ReadAll(res.Body) - res.Body.Close() - if err != nil { - log.Fatal(err) - } - - fmt.Printf("%s", greeting) - // Output: Hello, client -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/httptest/recorder_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/httptest/recorder_test.go deleted file mode 100644 index 2b563260c7..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/httptest/recorder_test.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package httptest - -import ( - "fmt" - "net/http" - "testing" -) - -func TestRecorder(t *testing.T) { - type checkFunc func(*ResponseRecorder) error - check := func(fns ...checkFunc) []checkFunc { return fns } - - hasStatus := func(wantCode int) checkFunc { - return func(rec *ResponseRecorder) error { - if rec.Code != wantCode { - return fmt.Errorf("Status = %d; want %d", rec.Code, wantCode) - } - return nil - } - } - hasContents := func(want string) checkFunc { - return func(rec *ResponseRecorder) error { - if rec.Body.String() != want { - return fmt.Errorf("wrote = %q; want %q", rec.Body.String(), want) - } - return nil - } - } - hasFlush := func(want bool) checkFunc { - return func(rec *ResponseRecorder) error { - if rec.Flushed != want { - return fmt.Errorf("Flushed = %v; want %v", rec.Flushed, want) - } - return nil - } - } - - tests := []struct { - name string - h func(w http.ResponseWriter, r *http.Request) - checks []checkFunc - }{ - { - "200 default", - func(w http.ResponseWriter, r *http.Request) {}, - check(hasStatus(200), hasContents("")), - }, - { - "first code only", - func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(201) - w.WriteHeader(202) - w.Write([]byte("hi")) - }, - check(hasStatus(201), hasContents("hi")), - }, - { - "write sends 200", - func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("hi first")) - w.WriteHeader(201) - w.WriteHeader(202) - }, - check(hasStatus(200), hasContents("hi first"), hasFlush(false)), - }, - { - "flush", - func(w http.ResponseWriter, r *http.Request) { - w.(http.Flusher).Flush() // also sends a 200 - w.WriteHeader(201) - }, - check(hasStatus(200), hasFlush(true)), - }, - } - r, _ := http.NewRequest("GET", "http://foo.com/", nil) - for _, tt := range tests { - h := http.HandlerFunc(tt.h) - rec := NewRecorder() - h.ServeHTTP(rec, r) - for _, check := range tt.checks { - if err := check(rec); err != nil { - t.Errorf("%s: %v", tt.name, err) - } - } - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/httptest/server_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/httptest/server_test.go deleted file mode 100644 index 501cc8a999..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/httptest/server_test.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package httptest - -import ( - "io/ioutil" - "net/http" - "testing" - "time" -) - -func TestServer(t *testing.T) { - ts := NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("hello")) - })) - defer ts.Close() - res, err := http.Get(ts.URL) - if err != nil { - t.Fatal(err) - } - got, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatal(err) - } - if string(got) != "hello" { - t.Errorf("got %q, want hello", string(got)) - } -} - -func TestIssue7264(t *testing.T) { - for i := 0; i < 1000; i++ { - func() { - inHandler := make(chan bool, 1) - ts := NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - inHandler <- true - })) - defer ts.Close() - tr := &http.Transport{ - ResponseHeaderTimeout: time.Nanosecond, - } - defer tr.CloseIdleConnections() - c := &http.Client{Transport: tr} - res, err := c.Get(ts.URL) - <-inHandler - if err == nil { - res.Body.Close() - } - }() - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/httputil/chunked_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/httputil/chunked_test.go deleted file mode 100644 index a7a5774688..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/httputil/chunked_test.go +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This code is duplicated in net/http and net/http/httputil. -// Please make any changes in both files. - -package httputil - -import ( - "bufio" - "bytes" - "fmt" - "io" - "io/ioutil" - "strings" - "testing" -) - -func TestChunk(t *testing.T) { - var b bytes.Buffer - - w := newChunkedWriter(&b) - const chunk1 = "hello, " - const chunk2 = "world! 0123456789abcdef" - w.Write([]byte(chunk1)) - w.Write([]byte(chunk2)) - w.Close() - - if g, e := b.String(), "7\r\nhello, \r\n17\r\nworld! 0123456789abcdef\r\n0\r\n"; g != e { - t.Fatalf("chunk writer wrote %q; want %q", g, e) - } - - r := newChunkedReader(&b) - data, err := ioutil.ReadAll(r) - if err != nil { - t.Logf(`data: "%s"`, data) - t.Fatalf("ReadAll from reader: %v", err) - } - if g, e := string(data), chunk1+chunk2; g != e { - t.Errorf("chunk reader read %q; want %q", g, e) - } -} - -func TestChunkReadMultiple(t *testing.T) { - // Bunch of small chunks, all read together. - { - var b bytes.Buffer - w := newChunkedWriter(&b) - w.Write([]byte("foo")) - w.Write([]byte("bar")) - w.Close() - - r := newChunkedReader(&b) - buf := make([]byte, 10) - n, err := r.Read(buf) - if n != 6 || err != io.EOF { - t.Errorf("Read = %d, %v; want 6, EOF", n, err) - } - buf = buf[:n] - if string(buf) != "foobar" { - t.Errorf("Read = %q; want %q", buf, "foobar") - } - } - - // One big chunk followed by a little chunk, but the small bufio.Reader size - // should prevent the second chunk header from being read. - { - var b bytes.Buffer - w := newChunkedWriter(&b) - // fillBufChunk is 11 bytes + 3 bytes header + 2 bytes footer = 16 bytes, - // the same as the bufio ReaderSize below (the minimum), so even - // though we're going to try to Read with a buffer larger enough to also - // receive "foo", the second chunk header won't be read yet. - const fillBufChunk = "0123456789a" - const shortChunk = "foo" - w.Write([]byte(fillBufChunk)) - w.Write([]byte(shortChunk)) - w.Close() - - r := newChunkedReader(bufio.NewReaderSize(&b, 16)) - buf := make([]byte, len(fillBufChunk)+len(shortChunk)) - n, err := r.Read(buf) - if n != len(fillBufChunk) || err != nil { - t.Errorf("Read = %d, %v; want %d, nil", n, err, len(fillBufChunk)) - } - buf = buf[:n] - if string(buf) != fillBufChunk { - t.Errorf("Read = %q; want %q", buf, fillBufChunk) - } - - n, err = r.Read(buf) - if n != len(shortChunk) || err != io.EOF { - t.Errorf("Read = %d, %v; want %d, EOF", n, err, len(shortChunk)) - } - } - - // And test that we see an EOF chunk, even though our buffer is already full: - { - r := newChunkedReader(bufio.NewReader(strings.NewReader("3\r\nfoo\r\n0\r\n"))) - buf := make([]byte, 3) - n, err := r.Read(buf) - if n != 3 || err != io.EOF { - t.Errorf("Read = %d, %v; want 3, EOF", n, err) - } - if string(buf) != "foo" { - t.Errorf("buf = %q; want foo", buf) - } - } -} - -func TestChunkReaderAllocs(t *testing.T) { - if testing.Short() { - t.Skip("skipping in short mode") - } - var buf bytes.Buffer - w := newChunkedWriter(&buf) - a, b, c := []byte("aaaaaa"), []byte("bbbbbbbbbbbb"), []byte("cccccccccccccccccccccccc") - w.Write(a) - w.Write(b) - w.Write(c) - w.Close() - - readBuf := make([]byte, len(a)+len(b)+len(c)+1) - byter := bytes.NewReader(buf.Bytes()) - bufr := bufio.NewReader(byter) - mallocs := testing.AllocsPerRun(100, func() { - byter.Seek(0, 0) - bufr.Reset(byter) - r := newChunkedReader(bufr) - n, err := io.ReadFull(r, readBuf) - if n != len(readBuf)-1 { - t.Fatalf("read %d bytes; want %d", n, len(readBuf)-1) - } - if err != io.ErrUnexpectedEOF { - t.Fatalf("read error = %v; want ErrUnexpectedEOF", err) - } - }) - if mallocs > 1.5 { - t.Errorf("mallocs = %v; want 1", mallocs) - } -} - -func TestParseHexUint(t *testing.T) { - for i := uint64(0); i <= 1234; i++ { - line := []byte(fmt.Sprintf("%x", i)) - got, err := parseHexUint(line) - if err != nil { - t.Fatalf("on %d: %v", i, err) - } - if got != i { - t.Errorf("for input %q = %d; want %d", line, got, i) - } - } - _, err := parseHexUint([]byte("bogus")) - if err == nil { - t.Error("expected error on bogus input") - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/httputil/dump_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/httputil/dump_test.go deleted file mode 100644 index e1ffb3935a..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/httputil/dump_test.go +++ /dev/null @@ -1,263 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package httputil - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "runtime" - "strings" - "testing" -) - -type dumpTest struct { - Req http.Request - Body interface{} // optional []byte or func() io.ReadCloser to populate Req.Body - - WantDump string - WantDumpOut string - NoBody bool // if true, set DumpRequest{,Out} body to false -} - -var dumpTests = []dumpTest{ - - // HTTP/1.1 => chunked coding; body; empty trailer - { - Req: http.Request{ - Method: "GET", - URL: &url.URL{ - Scheme: "http", - Host: "www.google.com", - Path: "/search", - }, - ProtoMajor: 1, - ProtoMinor: 1, - TransferEncoding: []string{"chunked"}, - }, - - Body: []byte("abcdef"), - - WantDump: "GET /search HTTP/1.1\r\n" + - "Host: www.google.com\r\n" + - "Transfer-Encoding: chunked\r\n\r\n" + - chunk("abcdef") + chunk(""), - }, - - // Verify that DumpRequest preserves the HTTP version number, doesn't add a Host, - // and doesn't add a User-Agent. - { - Req: http.Request{ - Method: "GET", - URL: mustParseURL("/foo"), - ProtoMajor: 1, - ProtoMinor: 0, - Header: http.Header{ - "X-Foo": []string{"X-Bar"}, - }, - }, - - WantDump: "GET /foo HTTP/1.0\r\n" + - "X-Foo: X-Bar\r\n\r\n", - }, - - { - Req: *mustNewRequest("GET", "http://example.com/foo", nil), - - WantDumpOut: "GET /foo HTTP/1.1\r\n" + - "Host: example.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "Accept-Encoding: gzip\r\n\r\n", - }, - - // Test that an https URL doesn't try to do an SSL negotiation - // with a bytes.Buffer and hang with all goroutines not - // runnable. - { - Req: *mustNewRequest("GET", "https://example.com/foo", nil), - - WantDumpOut: "GET /foo HTTP/1.1\r\n" + - "Host: example.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "Accept-Encoding: gzip\r\n\r\n", - }, - - // Request with Body, but Dump requested without it. - { - Req: http.Request{ - Method: "POST", - URL: &url.URL{ - Scheme: "http", - Host: "post.tld", - Path: "/", - }, - ContentLength: 6, - ProtoMajor: 1, - ProtoMinor: 1, - }, - - Body: []byte("abcdef"), - - WantDumpOut: "POST / HTTP/1.1\r\n" + - "Host: post.tld\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "Content-Length: 6\r\n" + - "Accept-Encoding: gzip\r\n\r\n", - - NoBody: true, - }, -} - -func TestDumpRequest(t *testing.T) { - numg0 := runtime.NumGoroutine() - for i, tt := range dumpTests { - setBody := func() { - if tt.Body == nil { - return - } - switch b := tt.Body.(type) { - case []byte: - tt.Req.Body = ioutil.NopCloser(bytes.NewReader(b)) - case func() io.ReadCloser: - tt.Req.Body = b() - } - } - setBody() - if tt.Req.Header == nil { - tt.Req.Header = make(http.Header) - } - - if tt.WantDump != "" { - setBody() - dump, err := DumpRequest(&tt.Req, !tt.NoBody) - if err != nil { - t.Errorf("DumpRequest #%d: %s", i, err) - continue - } - if string(dump) != tt.WantDump { - t.Errorf("DumpRequest %d, expecting:\n%s\nGot:\n%s\n", i, tt.WantDump, string(dump)) - continue - } - } - - if tt.WantDumpOut != "" { - setBody() - dump, err := DumpRequestOut(&tt.Req, !tt.NoBody) - if err != nil { - t.Errorf("DumpRequestOut #%d: %s", i, err) - continue - } - if string(dump) != tt.WantDumpOut { - t.Errorf("DumpRequestOut %d, expecting:\n%s\nGot:\n%s\n", i, tt.WantDumpOut, string(dump)) - continue - } - } - } - if dg := runtime.NumGoroutine() - numg0; dg > 4 { - t.Errorf("Unexpectedly large number of new goroutines: %d new", dg) - } -} - -func chunk(s string) string { - return fmt.Sprintf("%x\r\n%s\r\n", len(s), s) -} - -func mustParseURL(s string) *url.URL { - u, err := url.Parse(s) - if err != nil { - panic(fmt.Sprintf("Error parsing URL %q: %v", s, err)) - } - return u -} - -func mustNewRequest(method, url string, body io.Reader) *http.Request { - req, err := http.NewRequest(method, url, body) - if err != nil { - panic(fmt.Sprintf("NewRequest(%q, %q, %p) err = %v", method, url, body, err)) - } - return req -} - -var dumpResTests = []struct { - res *http.Response - body bool - want string -}{ - { - res: &http.Response{ - Status: "200 OK", - StatusCode: 200, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - ContentLength: 50, - Header: http.Header{ - "Foo": []string{"Bar"}, - }, - Body: ioutil.NopCloser(strings.NewReader("foo")), // shouldn't be used - }, - body: false, // to verify we see 50, not empty or 3. - want: `HTTP/1.1 200 OK -Content-Length: 50 -Foo: Bar`, - }, - - { - res: &http.Response{ - Status: "200 OK", - StatusCode: 200, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - ContentLength: 3, - Body: ioutil.NopCloser(strings.NewReader("foo")), - }, - body: true, - want: `HTTP/1.1 200 OK -Content-Length: 3 - -foo`, - }, - - { - res: &http.Response{ - Status: "200 OK", - StatusCode: 200, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - ContentLength: -1, - Body: ioutil.NopCloser(strings.NewReader("foo")), - TransferEncoding: []string{"chunked"}, - }, - body: true, - want: `HTTP/1.1 200 OK -Transfer-Encoding: chunked - -3 -foo -0`, - }, -} - -func TestDumpResponse(t *testing.T) { - for i, tt := range dumpResTests { - gotb, err := DumpResponse(tt.res, tt.body) - if err != nil { - t.Errorf("%d. DumpResponse = %v", i, err) - continue - } - got := string(gotb) - got = strings.TrimSpace(got) - got = strings.Replace(got, "\r", "", -1) - - if got != tt.want { - t.Errorf("%d.\nDumpResponse got:\n%s\n\nWant:\n%s\n", i, got, tt.want) - } - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/httputil/reverseproxy_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/httputil/reverseproxy_test.go deleted file mode 100644 index e9539b44b6..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/httputil/reverseproxy_test.go +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Reverse proxy tests. - -package httputil - -import ( - "io/ioutil" - "net/http" - "net/http/httptest" - "net/url" - "strings" - "testing" - "time" -) - -const fakeHopHeader = "X-Fake-Hop-Header-For-Test" - -func init() { - hopHeaders = append(hopHeaders, fakeHopHeader) -} - -func TestReverseProxy(t *testing.T) { - const backendResponse = "I am the backend" - const backendStatus = 404 - backend := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if len(r.TransferEncoding) > 0 { - t.Errorf("backend got unexpected TransferEncoding: %v", r.TransferEncoding) - } - if r.Header.Get("X-Forwarded-For") == "" { - t.Errorf("didn't get X-Forwarded-For header") - } - if c := r.Header.Get("Connection"); c != "" { - t.Errorf("handler got Connection header value %q", c) - } - if c := r.Header.Get("Upgrade"); c != "" { - t.Errorf("handler got Upgrade header value %q", c) - } - if g, e := r.Host, "some-name"; g != e { - t.Errorf("backend got Host header %q, want %q", g, e) - } - w.Header().Set("X-Foo", "bar") - w.Header().Set("Upgrade", "foo") - w.Header().Set(fakeHopHeader, "foo") - w.Header().Add("X-Multi-Value", "foo") - w.Header().Add("X-Multi-Value", "bar") - http.SetCookie(w, &http.Cookie{Name: "flavor", Value: "chocolateChip"}) - w.WriteHeader(backendStatus) - w.Write([]byte(backendResponse)) - })) - defer backend.Close() - backendURL, err := url.Parse(backend.URL) - if err != nil { - t.Fatal(err) - } - proxyHandler := NewSingleHostReverseProxy(backendURL) - frontend := httptest.NewServer(proxyHandler) - defer frontend.Close() - - getReq, _ := http.NewRequest("GET", frontend.URL, nil) - getReq.Host = "some-name" - getReq.Header.Set("Connection", "close") - getReq.Header.Set("Upgrade", "foo") - getReq.Close = true - res, err := http.DefaultClient.Do(getReq) - if err != nil { - t.Fatalf("Get: %v", err) - } - if g, e := res.StatusCode, backendStatus; g != e { - t.Errorf("got res.StatusCode %d; expected %d", g, e) - } - if g, e := res.Header.Get("X-Foo"), "bar"; g != e { - t.Errorf("got X-Foo %q; expected %q", g, e) - } - if c := res.Header.Get(fakeHopHeader); c != "" { - t.Errorf("got %s header value %q", fakeHopHeader, c) - } - if g, e := len(res.Header["X-Multi-Value"]), 2; g != e { - t.Errorf("got %d X-Multi-Value header values; expected %d", g, e) - } - if g, e := len(res.Header["Set-Cookie"]), 1; g != e { - t.Fatalf("got %d SetCookies, want %d", g, e) - } - if cookie := res.Cookies()[0]; cookie.Name != "flavor" { - t.Errorf("unexpected cookie %q", cookie.Name) - } - bodyBytes, _ := ioutil.ReadAll(res.Body) - if g, e := string(bodyBytes), backendResponse; g != e { - t.Errorf("got body %q; expected %q", g, e) - } -} - -func TestXForwardedFor(t *testing.T) { - const prevForwardedFor = "client ip" - const backendResponse = "I am the backend" - const backendStatus = 404 - backend := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.Header.Get("X-Forwarded-For") == "" { - t.Errorf("didn't get X-Forwarded-For header") - } - if !strings.Contains(r.Header.Get("X-Forwarded-For"), prevForwardedFor) { - t.Errorf("X-Forwarded-For didn't contain prior data") - } - w.WriteHeader(backendStatus) - w.Write([]byte(backendResponse)) - })) - defer backend.Close() - backendURL, err := url.Parse(backend.URL) - if err != nil { - t.Fatal(err) - } - proxyHandler := NewSingleHostReverseProxy(backendURL) - frontend := httptest.NewServer(proxyHandler) - defer frontend.Close() - - getReq, _ := http.NewRequest("GET", frontend.URL, nil) - getReq.Host = "some-name" - getReq.Header.Set("Connection", "close") - getReq.Header.Set("X-Forwarded-For", prevForwardedFor) - getReq.Close = true - res, err := http.DefaultClient.Do(getReq) - if err != nil { - t.Fatalf("Get: %v", err) - } - if g, e := res.StatusCode, backendStatus; g != e { - t.Errorf("got res.StatusCode %d; expected %d", g, e) - } - bodyBytes, _ := ioutil.ReadAll(res.Body) - if g, e := string(bodyBytes), backendResponse; g != e { - t.Errorf("got body %q; expected %q", g, e) - } -} - -var proxyQueryTests = []struct { - baseSuffix string // suffix to add to backend URL - reqSuffix string // suffix to add to frontend's request URL - want string // what backend should see for final request URL (without ?) -}{ - {"", "", ""}, - {"?sta=tic", "?us=er", "sta=tic&us=er"}, - {"", "?us=er", "us=er"}, - {"?sta=tic", "", "sta=tic"}, -} - -func TestReverseProxyQuery(t *testing.T) { - backend := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("X-Got-Query", r.URL.RawQuery) - w.Write([]byte("hi")) - })) - defer backend.Close() - - for i, tt := range proxyQueryTests { - backendURL, err := url.Parse(backend.URL + tt.baseSuffix) - if err != nil { - t.Fatal(err) - } - frontend := httptest.NewServer(NewSingleHostReverseProxy(backendURL)) - req, _ := http.NewRequest("GET", frontend.URL+tt.reqSuffix, nil) - req.Close = true - res, err := http.DefaultClient.Do(req) - if err != nil { - t.Fatalf("%d. Get: %v", i, err) - } - if g, e := res.Header.Get("X-Got-Query"), tt.want; g != e { - t.Errorf("%d. got query %q; expected %q", i, g, e) - } - res.Body.Close() - frontend.Close() - } -} - -func TestReverseProxyFlushInterval(t *testing.T) { - const expected = "hi" - backend := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte(expected)) - })) - defer backend.Close() - - backendURL, err := url.Parse(backend.URL) - if err != nil { - t.Fatal(err) - } - - proxyHandler := NewSingleHostReverseProxy(backendURL) - proxyHandler.FlushInterval = time.Microsecond - - done := make(chan bool) - onExitFlushLoop = func() { done <- true } - defer func() { onExitFlushLoop = nil }() - - frontend := httptest.NewServer(proxyHandler) - defer frontend.Close() - - req, _ := http.NewRequest("GET", frontend.URL, nil) - req.Close = true - res, err := http.DefaultClient.Do(req) - if err != nil { - t.Fatalf("Get: %v", err) - } - defer res.Body.Close() - if bodyBytes, _ := ioutil.ReadAll(res.Body); string(bodyBytes) != expected { - t.Errorf("got body %q; expected %q", bodyBytes, expected) - } - - select { - case <-done: - // OK - case <-time.After(5 * time.Second): - t.Error("maxLatencyWriter flushLoop() never exited") - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/lex_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/lex_test.go deleted file mode 100644 index 6d9d294f70..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/lex_test.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http - -import ( - "testing" -) - -func isChar(c rune) bool { return c <= 127 } - -func isCtl(c rune) bool { return c <= 31 || c == 127 } - -func isSeparator(c rune) bool { - switch c { - case '(', ')', '<', '>', '@', ',', ';', ':', '\\', '"', '/', '[', ']', '?', '=', '{', '}', ' ', '\t': - return true - } - return false -} - -func TestIsToken(t *testing.T) { - for i := 0; i <= 130; i++ { - r := rune(i) - expected := isChar(r) && !isCtl(r) && !isSeparator(r) - if isToken(r) != expected { - t.Errorf("isToken(0x%x) = %v", r, !expected) - } - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/npn_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/npn_test.go deleted file mode 100644 index 98b8930d06..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/npn_test.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http_test - -import ( - "bufio" - "crypto/tls" - "fmt" - "io" - "io/ioutil" - . "net/http" - "net/http/httptest" - "strings" - "testing" -) - -func TestNextProtoUpgrade(t *testing.T) { - ts := httptest.NewUnstartedServer(HandlerFunc(func(w ResponseWriter, r *Request) { - fmt.Fprintf(w, "path=%s,proto=", r.URL.Path) - if r.TLS != nil { - w.Write([]byte(r.TLS.NegotiatedProtocol)) - } - if r.RemoteAddr == "" { - t.Error("request with no RemoteAddr") - } - if r.Body == nil { - t.Errorf("request with nil Body") - } - })) - ts.TLS = &tls.Config{ - NextProtos: []string{"unhandled-proto", "tls-0.9"}, - } - ts.Config.TLSNextProto = map[string]func(*Server, *tls.Conn, Handler){ - "tls-0.9": handleTLSProtocol09, - } - ts.StartTLS() - defer ts.Close() - - tr := newTLSTransport(t, ts) - defer tr.CloseIdleConnections() - c := &Client{Transport: tr} - - // Normal request, without NPN. - { - res, err := c.Get(ts.URL) - if err != nil { - t.Fatal(err) - } - body, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatal(err) - } - if want := "path=/,proto="; string(body) != want { - t.Errorf("plain request = %q; want %q", body, want) - } - } - - // Request to an advertised but unhandled NPN protocol. - // Server will hang up. - { - tr.CloseIdleConnections() - tr.TLSClientConfig.NextProtos = []string{"unhandled-proto"} - _, err := c.Get(ts.URL) - if err == nil { - t.Errorf("expected error on unhandled-proto request") - } - } - - // Request using the "tls-0.9" protocol, which we register here. - // It is HTTP/0.9 over TLS. - { - tlsConfig := newTLSTransport(t, ts).TLSClientConfig - tlsConfig.NextProtos = []string{"tls-0.9"} - conn, err := tls.Dial("tcp", ts.Listener.Addr().String(), tlsConfig) - if err != nil { - t.Fatal(err) - } - conn.Write([]byte("GET /foo\n")) - body, err := ioutil.ReadAll(conn) - if err != nil { - t.Fatal(err) - } - if want := "path=/foo,proto=tls-0.9"; string(body) != want { - t.Errorf("plain request = %q; want %q", body, want) - } - } -} - -// handleTLSProtocol09 implements the HTTP/0.9 protocol over TLS, for the -// TestNextProtoUpgrade test. -func handleTLSProtocol09(srv *Server, conn *tls.Conn, h Handler) { - br := bufio.NewReader(conn) - line, err := br.ReadString('\n') - if err != nil { - return - } - line = strings.TrimSpace(line) - path := strings.TrimPrefix(line, "GET ") - if path == line { - return - } - req, _ := NewRequest("GET", path, nil) - req.Proto = "HTTP/0.9" - req.ProtoMajor = 0 - req.ProtoMinor = 9 - rw := &http09Writer{conn, make(Header)} - h.ServeHTTP(rw, req) -} - -type http09Writer struct { - io.Writer - h Header -} - -func (w http09Writer) Header() Header { return w.h } -func (w http09Writer) WriteHeader(int) {} // no headers diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/proxy_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/proxy_test.go deleted file mode 100644 index b6aed3792b..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/proxy_test.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http - -import ( - "net/url" - "os" - "testing" -) - -// TODO(mattn): -// test ProxyAuth - -var UseProxyTests = []struct { - host string - match bool -}{ - // Never proxy localhost: - {"localhost:80", false}, - {"127.0.0.1", false}, - {"127.0.0.2", false}, - {"[::1]", false}, - {"[::2]", true}, // not a loopback address - - {"barbaz.net", false}, // match as .barbaz.net - {"foobar.com", false}, // have a port but match - {"foofoobar.com", true}, // not match as a part of foobar.com - {"baz.com", true}, // not match as a part of barbaz.com - {"localhost.net", true}, // not match as suffix of address - {"local.localhost", true}, // not match as prefix as address - {"barbarbaz.net", true}, // not match because NO_PROXY have a '.' - {"www.foobar.com", false}, // match because NO_PROXY includes "foobar.com" -} - -func TestUseProxy(t *testing.T) { - ResetProxyEnv() - os.Setenv("NO_PROXY", "foobar.com, .barbaz.net") - for _, test := range UseProxyTests { - if useProxy(test.host+":80") != test.match { - t.Errorf("useProxy(%v) = %v, want %v", test.host, !test.match, test.match) - } - } -} - -var cacheKeysTests = []struct { - proxy string - scheme string - addr string - key string -}{ - {"", "http", "foo.com", "|http|foo.com"}, - {"", "https", "foo.com", "|https|foo.com"}, - {"http://foo.com", "http", "foo.com", "http://foo.com|http|"}, - {"http://foo.com", "https", "foo.com", "http://foo.com|https|foo.com"}, -} - -func TestCacheKeys(t *testing.T) { - for _, tt := range cacheKeysTests { - var proxy *url.URL - if tt.proxy != "" { - u, err := url.Parse(tt.proxy) - if err != nil { - t.Fatal(err) - } - proxy = u - } - cm := connectMethod{proxy, tt.scheme, tt.addr} - if got := cm.key().String(); got != tt.key { - t.Fatalf("{%q, %q, %q} cache key = %q; want %q", tt.proxy, tt.scheme, tt.addr, got, tt.key) - } - } -} - -func ResetProxyEnv() { - for _, v := range []string{"HTTP_PROXY", "http_proxy", "NO_PROXY", "no_proxy"} { - os.Setenv(v, "") - } - ResetCachedEnvironment() -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/range_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/range_test.go deleted file mode 100644 index ef911af7b0..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/range_test.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http - -import ( - "testing" -) - -var ParseRangeTests = []struct { - s string - length int64 - r []httpRange -}{ - {"", 0, nil}, - {"", 1000, nil}, - {"foo", 0, nil}, - {"bytes=", 0, nil}, - {"bytes=7", 10, nil}, - {"bytes= 7 ", 10, nil}, - {"bytes=1-", 0, nil}, - {"bytes=5-4", 10, nil}, - {"bytes=0-2,5-4", 10, nil}, - {"bytes=2-5,4-3", 10, nil}, - {"bytes=--5,4--3", 10, nil}, - {"bytes=A-", 10, nil}, - {"bytes=A- ", 10, nil}, - {"bytes=A-Z", 10, nil}, - {"bytes= -Z", 10, nil}, - {"bytes=5-Z", 10, nil}, - {"bytes=Ran-dom, garbage", 10, nil}, - {"bytes=0x01-0x02", 10, nil}, - {"bytes= ", 10, nil}, - {"bytes= , , , ", 10, nil}, - - {"bytes=0-9", 10, []httpRange{{0, 10}}}, - {"bytes=0-", 10, []httpRange{{0, 10}}}, - {"bytes=5-", 10, []httpRange{{5, 5}}}, - {"bytes=0-20", 10, []httpRange{{0, 10}}}, - {"bytes=15-,0-5", 10, nil}, - {"bytes=1-2,5-", 10, []httpRange{{1, 2}, {5, 5}}}, - {"bytes=-2 , 7-", 11, []httpRange{{9, 2}, {7, 4}}}, - {"bytes=0-0 ,2-2, 7-", 11, []httpRange{{0, 1}, {2, 1}, {7, 4}}}, - {"bytes=-5", 10, []httpRange{{5, 5}}}, - {"bytes=-15", 10, []httpRange{{0, 10}}}, - {"bytes=0-499", 10000, []httpRange{{0, 500}}}, - {"bytes=500-999", 10000, []httpRange{{500, 500}}}, - {"bytes=-500", 10000, []httpRange{{9500, 500}}}, - {"bytes=9500-", 10000, []httpRange{{9500, 500}}}, - {"bytes=0-0,-1", 10000, []httpRange{{0, 1}, {9999, 1}}}, - {"bytes=500-600,601-999", 10000, []httpRange{{500, 101}, {601, 399}}}, - {"bytes=500-700,601-999", 10000, []httpRange{{500, 201}, {601, 399}}}, - - // Match Apache laxity: - {"bytes= 1 -2 , 4- 5, 7 - 8 , ,,", 11, []httpRange{{1, 2}, {4, 2}, {7, 2}}}, -} - -func TestParseRange(t *testing.T) { - for _, test := range ParseRangeTests { - r := test.r - ranges, err := parseRange(test.s, test.length) - if err != nil && r != nil { - t.Errorf("parseRange(%q) returned error %q", test.s, err) - } - if len(ranges) != len(r) { - t.Errorf("len(parseRange(%q)) = %d, want %d", test.s, len(ranges), len(r)) - continue - } - for i := range r { - if ranges[i].start != r[i].start { - t.Errorf("parseRange(%q)[%d].start = %d, want %d", test.s, i, ranges[i].start, r[i].start) - } - if ranges[i].length != r[i].length { - t.Errorf("parseRange(%q)[%d].length = %d, want %d", test.s, i, ranges[i].length, r[i].length) - } - } - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/readrequest_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/readrequest_test.go deleted file mode 100644 index ffdd6a892d..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/readrequest_test.go +++ /dev/null @@ -1,331 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http - -import ( - "bufio" - "bytes" - "fmt" - "io" - "net/url" - "reflect" - "testing" -) - -type reqTest struct { - Raw string - Req *Request - Body string - Trailer Header - Error string -} - -var noError = "" -var noBody = "" -var noTrailer Header = nil - -var reqTests = []reqTest{ - // Baseline test; All Request fields included for template use - { - "GET http://www.techcrunch.com/ HTTP/1.1\r\n" + - "Host: www.techcrunch.com\r\n" + - "User-Agent: Fake\r\n" + - "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" + - "Accept-Language: en-us,en;q=0.5\r\n" + - "Accept-Encoding: gzip,deflate\r\n" + - "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" + - "Keep-Alive: 300\r\n" + - "Content-Length: 7\r\n" + - "Proxy-Connection: keep-alive\r\n\r\n" + - "abcdef\n???", - - &Request{ - Method: "GET", - URL: &url.URL{ - Scheme: "http", - Host: "www.techcrunch.com", - Path: "/", - }, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{ - "Accept": {"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}, - "Accept-Language": {"en-us,en;q=0.5"}, - "Accept-Encoding": {"gzip,deflate"}, - "Accept-Charset": {"ISO-8859-1,utf-8;q=0.7,*;q=0.7"}, - "Keep-Alive": {"300"}, - "Proxy-Connection": {"keep-alive"}, - "Content-Length": {"7"}, - "User-Agent": {"Fake"}, - }, - Close: false, - ContentLength: 7, - Host: "www.techcrunch.com", - RequestURI: "http://www.techcrunch.com/", - }, - - "abcdef\n", - - noTrailer, - noError, - }, - - // GET request with no body (the normal case) - { - "GET / HTTP/1.1\r\n" + - "Host: foo.com\r\n\r\n", - - &Request{ - Method: "GET", - URL: &url.URL{ - Path: "/", - }, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{}, - Close: false, - ContentLength: 0, - Host: "foo.com", - RequestURI: "/", - }, - - noBody, - noTrailer, - noError, - }, - - // Tests that we don't parse a path that looks like a - // scheme-relative URI as a scheme-relative URI. - { - "GET //user@host/is/actually/a/path/ HTTP/1.1\r\n" + - "Host: test\r\n\r\n", - - &Request{ - Method: "GET", - URL: &url.URL{ - Path: "//user@host/is/actually/a/path/", - }, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{}, - Close: false, - ContentLength: 0, - Host: "test", - RequestURI: "//user@host/is/actually/a/path/", - }, - - noBody, - noTrailer, - noError, - }, - - // Tests a bogus abs_path on the Request-Line (RFC 2616 section 5.1.2) - { - "GET ../../../../etc/passwd HTTP/1.1\r\n" + - "Host: test\r\n\r\n", - nil, - noBody, - noTrailer, - "parse ../../../../etc/passwd: invalid URI for request", - }, - - // Tests missing URL: - { - "GET HTTP/1.1\r\n" + - "Host: test\r\n\r\n", - nil, - noBody, - noTrailer, - "parse : empty url", - }, - - // Tests chunked body with trailer: - { - "POST / HTTP/1.1\r\n" + - "Host: foo.com\r\n" + - "Transfer-Encoding: chunked\r\n\r\n" + - "3\r\nfoo\r\n" + - "3\r\nbar\r\n" + - "0\r\n" + - "Trailer-Key: Trailer-Value\r\n" + - "\r\n", - &Request{ - Method: "POST", - URL: &url.URL{ - Path: "/", - }, - TransferEncoding: []string{"chunked"}, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{}, - ContentLength: -1, - Host: "foo.com", - RequestURI: "/", - }, - - "foobar", - Header{ - "Trailer-Key": {"Trailer-Value"}, - }, - noError, - }, - - // CONNECT request with domain name: - { - "CONNECT www.google.com:443 HTTP/1.1\r\n\r\n", - - &Request{ - Method: "CONNECT", - URL: &url.URL{ - Host: "www.google.com:443", - }, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{}, - Close: false, - ContentLength: 0, - Host: "www.google.com:443", - RequestURI: "www.google.com:443", - }, - - noBody, - noTrailer, - noError, - }, - - // CONNECT request with IP address: - { - "CONNECT 127.0.0.1:6060 HTTP/1.1\r\n\r\n", - - &Request{ - Method: "CONNECT", - URL: &url.URL{ - Host: "127.0.0.1:6060", - }, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{}, - Close: false, - ContentLength: 0, - Host: "127.0.0.1:6060", - RequestURI: "127.0.0.1:6060", - }, - - noBody, - noTrailer, - noError, - }, - - // CONNECT request for RPC: - { - "CONNECT /_goRPC_ HTTP/1.1\r\n\r\n", - - &Request{ - Method: "CONNECT", - URL: &url.URL{ - Path: "/_goRPC_", - }, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{}, - Close: false, - ContentLength: 0, - Host: "", - RequestURI: "/_goRPC_", - }, - - noBody, - noTrailer, - noError, - }, - - // SSDP Notify request. golang.org/issue/3692 - { - "NOTIFY * HTTP/1.1\r\nServer: foo\r\n\r\n", - &Request{ - Method: "NOTIFY", - URL: &url.URL{ - Path: "*", - }, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{ - "Server": []string{"foo"}, - }, - Close: false, - ContentLength: 0, - RequestURI: "*", - }, - - noBody, - noTrailer, - noError, - }, - - // OPTIONS request. Similar to golang.org/issue/3692 - { - "OPTIONS * HTTP/1.1\r\nServer: foo\r\n\r\n", - &Request{ - Method: "OPTIONS", - URL: &url.URL{ - Path: "*", - }, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{ - "Server": []string{"foo"}, - }, - Close: false, - ContentLength: 0, - RequestURI: "*", - }, - - noBody, - noTrailer, - noError, - }, -} - -func TestReadRequest(t *testing.T) { - for i := range reqTests { - tt := &reqTests[i] - var braw bytes.Buffer - braw.WriteString(tt.Raw) - req, err := ReadRequest(bufio.NewReader(&braw)) - if err != nil { - if err.Error() != tt.Error { - t.Errorf("#%d: error %q, want error %q", i, err.Error(), tt.Error) - } - continue - } - rbody := req.Body - req.Body = nil - diff(t, fmt.Sprintf("#%d Request", i), req, tt.Req) - var bout bytes.Buffer - if rbody != nil { - _, err := io.Copy(&bout, rbody) - if err != nil { - t.Fatalf("#%d. copying body: %v", i, err) - } - rbody.Close() - } - body := bout.String() - if body != tt.Body { - t.Errorf("#%d: Body = %q want %q", i, body, tt.Body) - } - if !reflect.DeepEqual(tt.Trailer, req.Trailer) { - t.Errorf("#%d. Trailers differ.\n got: %v\nwant: %v", i, req.Trailer, tt.Trailer) - } - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/request_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/request_test.go deleted file mode 100644 index b9fa3c2bfc..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/request_test.go +++ /dev/null @@ -1,610 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http_test - -import ( - "bufio" - "bytes" - "fmt" - "io" - "io/ioutil" - "mime/multipart" - . "net/http" - "net/http/httptest" - "net/url" - "os" - "reflect" - "regexp" - "strings" - "testing" -) - -func TestQuery(t *testing.T) { - req := &Request{Method: "GET"} - req.URL, _ = url.Parse("http://www.google.com/search?q=foo&q=bar") - if q := req.FormValue("q"); q != "foo" { - t.Errorf(`req.FormValue("q") = %q, want "foo"`, q) - } -} - -func TestPostQuery(t *testing.T) { - req, _ := NewRequest("POST", "http://www.google.com/search?q=foo&q=bar&both=x&prio=1&empty=not", - strings.NewReader("z=post&both=y&prio=2&empty=")) - req.Header.Set("Content-Type", "application/x-www-form-urlencoded; param=value") - - if q := req.FormValue("q"); q != "foo" { - t.Errorf(`req.FormValue("q") = %q, want "foo"`, q) - } - if z := req.FormValue("z"); z != "post" { - t.Errorf(`req.FormValue("z") = %q, want "post"`, z) - } - if bq, found := req.PostForm["q"]; found { - t.Errorf(`req.PostForm["q"] = %q, want no entry in map`, bq) - } - if bz := req.PostFormValue("z"); bz != "post" { - t.Errorf(`req.PostFormValue("z") = %q, want "post"`, bz) - } - if qs := req.Form["q"]; !reflect.DeepEqual(qs, []string{"foo", "bar"}) { - t.Errorf(`req.Form["q"] = %q, want ["foo", "bar"]`, qs) - } - if both := req.Form["both"]; !reflect.DeepEqual(both, []string{"y", "x"}) { - t.Errorf(`req.Form["both"] = %q, want ["y", "x"]`, both) - } - if prio := req.FormValue("prio"); prio != "2" { - t.Errorf(`req.FormValue("prio") = %q, want "2" (from body)`, prio) - } - if empty := req.FormValue("empty"); empty != "" { - t.Errorf(`req.FormValue("empty") = %q, want "" (from body)`, empty) - } -} - -func TestPatchQuery(t *testing.T) { - req, _ := NewRequest("PATCH", "http://www.google.com/search?q=foo&q=bar&both=x&prio=1&empty=not", - strings.NewReader("z=post&both=y&prio=2&empty=")) - req.Header.Set("Content-Type", "application/x-www-form-urlencoded; param=value") - - if q := req.FormValue("q"); q != "foo" { - t.Errorf(`req.FormValue("q") = %q, want "foo"`, q) - } - if z := req.FormValue("z"); z != "post" { - t.Errorf(`req.FormValue("z") = %q, want "post"`, z) - } - if bq, found := req.PostForm["q"]; found { - t.Errorf(`req.PostForm["q"] = %q, want no entry in map`, bq) - } - if bz := req.PostFormValue("z"); bz != "post" { - t.Errorf(`req.PostFormValue("z") = %q, want "post"`, bz) - } - if qs := req.Form["q"]; !reflect.DeepEqual(qs, []string{"foo", "bar"}) { - t.Errorf(`req.Form["q"] = %q, want ["foo", "bar"]`, qs) - } - if both := req.Form["both"]; !reflect.DeepEqual(both, []string{"y", "x"}) { - t.Errorf(`req.Form["both"] = %q, want ["y", "x"]`, both) - } - if prio := req.FormValue("prio"); prio != "2" { - t.Errorf(`req.FormValue("prio") = %q, want "2" (from body)`, prio) - } - if empty := req.FormValue("empty"); empty != "" { - t.Errorf(`req.FormValue("empty") = %q, want "" (from body)`, empty) - } -} - -type stringMap map[string][]string -type parseContentTypeTest struct { - shouldError bool - contentType stringMap -} - -var parseContentTypeTests = []parseContentTypeTest{ - {false, stringMap{"Content-Type": {"text/plain"}}}, - // Empty content type is legal - shoult be treated as - // application/octet-stream (RFC 2616, section 7.2.1) - {false, stringMap{}}, - {true, stringMap{"Content-Type": {"text/plain; boundary="}}}, - {false, stringMap{"Content-Type": {"application/unknown"}}}, -} - -func TestParseFormUnknownContentType(t *testing.T) { - for i, test := range parseContentTypeTests { - req := &Request{ - Method: "POST", - Header: Header(test.contentType), - Body: ioutil.NopCloser(strings.NewReader("body")), - } - err := req.ParseForm() - switch { - case err == nil && test.shouldError: - t.Errorf("test %d should have returned error", i) - case err != nil && !test.shouldError: - t.Errorf("test %d should not have returned error, got %v", i, err) - } - } -} - -func TestParseFormInitializeOnError(t *testing.T) { - nilBody, _ := NewRequest("POST", "http://www.google.com/search?q=foo", nil) - tests := []*Request{ - nilBody, - {Method: "GET", URL: nil}, - } - for i, req := range tests { - err := req.ParseForm() - if req.Form == nil { - t.Errorf("%d. Form not initialized, error %v", i, err) - } - if req.PostForm == nil { - t.Errorf("%d. PostForm not initialized, error %v", i, err) - } - } -} - -func TestMultipartReader(t *testing.T) { - req := &Request{ - Method: "POST", - Header: Header{"Content-Type": {`multipart/form-data; boundary="foo123"`}}, - Body: ioutil.NopCloser(new(bytes.Buffer)), - } - multipart, err := req.MultipartReader() - if multipart == nil { - t.Errorf("expected multipart; error: %v", err) - } - - req.Header = Header{"Content-Type": {"text/plain"}} - multipart, err = req.MultipartReader() - if multipart != nil { - t.Error("unexpected multipart for text/plain") - } -} - -func TestParseMultipartForm(t *testing.T) { - req := &Request{ - Method: "POST", - Header: Header{"Content-Type": {`multipart/form-data; boundary="foo123"`}}, - Body: ioutil.NopCloser(new(bytes.Buffer)), - } - err := req.ParseMultipartForm(25) - if err == nil { - t.Error("expected multipart EOF, got nil") - } - - req.Header = Header{"Content-Type": {"text/plain"}} - err = req.ParseMultipartForm(25) - if err != ErrNotMultipart { - t.Error("expected ErrNotMultipart for text/plain") - } -} - -func TestRedirect(t *testing.T) { - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - switch r.URL.Path { - case "/": - w.Header().Set("Location", "/foo/") - w.WriteHeader(StatusSeeOther) - case "/foo/": - fmt.Fprintf(w, "foo") - default: - w.WriteHeader(StatusBadRequest) - } - })) - defer ts.Close() - - var end = regexp.MustCompile("/foo/$") - r, err := Get(ts.URL) - if err != nil { - t.Fatal(err) - } - r.Body.Close() - url := r.Request.URL.String() - if r.StatusCode != 200 || !end.MatchString(url) { - t.Fatalf("Get got status %d at %q, want 200 matching /foo/$", r.StatusCode, url) - } -} - -func TestSetBasicAuth(t *testing.T) { - r, _ := NewRequest("GET", "http://example.com/", nil) - r.SetBasicAuth("Aladdin", "open sesame") - if g, e := r.Header.Get("Authorization"), "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="; g != e { - t.Errorf("got header %q, want %q", g, e) - } -} - -func TestMultipartRequest(t *testing.T) { - // Test that we can read the values and files of a - // multipart request with FormValue and FormFile, - // and that ParseMultipartForm can be called multiple times. - req := newTestMultipartRequest(t) - if err := req.ParseMultipartForm(25); err != nil { - t.Fatal("ParseMultipartForm first call:", err) - } - defer req.MultipartForm.RemoveAll() - validateTestMultipartContents(t, req, false) - if err := req.ParseMultipartForm(25); err != nil { - t.Fatal("ParseMultipartForm second call:", err) - } - validateTestMultipartContents(t, req, false) -} - -func TestMultipartRequestAuto(t *testing.T) { - // Test that FormValue and FormFile automatically invoke - // ParseMultipartForm and return the right values. - req := newTestMultipartRequest(t) - defer func() { - if req.MultipartForm != nil { - req.MultipartForm.RemoveAll() - } - }() - validateTestMultipartContents(t, req, true) -} - -func TestMissingFileMultipartRequest(t *testing.T) { - // Test that FormFile returns an error if - // the named file is missing. - req := newTestMultipartRequest(t) - testMissingFile(t, req) -} - -// Test that FormValue invokes ParseMultipartForm. -func TestFormValueCallsParseMultipartForm(t *testing.T) { - req, _ := NewRequest("POST", "http://www.google.com/", strings.NewReader("z=post")) - req.Header.Set("Content-Type", "application/x-www-form-urlencoded; param=value") - if req.Form != nil { - t.Fatal("Unexpected request Form, want nil") - } - req.FormValue("z") - if req.Form == nil { - t.Fatal("ParseMultipartForm not called by FormValue") - } -} - -// Test that FormFile invokes ParseMultipartForm. -func TestFormFileCallsParseMultipartForm(t *testing.T) { - req := newTestMultipartRequest(t) - if req.Form != nil { - t.Fatal("Unexpected request Form, want nil") - } - req.FormFile("") - if req.Form == nil { - t.Fatal("ParseMultipartForm not called by FormFile") - } -} - -// Test that ParseMultipartForm errors if called -// after MultipartReader on the same request. -func TestParseMultipartFormOrder(t *testing.T) { - req := newTestMultipartRequest(t) - if _, err := req.MultipartReader(); err != nil { - t.Fatalf("MultipartReader: %v", err) - } - if err := req.ParseMultipartForm(1024); err == nil { - t.Fatal("expected an error from ParseMultipartForm after call to MultipartReader") - } -} - -// Test that MultipartReader errors if called -// after ParseMultipartForm on the same request. -func TestMultipartReaderOrder(t *testing.T) { - req := newTestMultipartRequest(t) - if err := req.ParseMultipartForm(25); err != nil { - t.Fatalf("ParseMultipartForm: %v", err) - } - defer req.MultipartForm.RemoveAll() - if _, err := req.MultipartReader(); err == nil { - t.Fatal("expected an error from MultipartReader after call to ParseMultipartForm") - } -} - -// Test that FormFile errors if called after -// MultipartReader on the same request. -func TestFormFileOrder(t *testing.T) { - req := newTestMultipartRequest(t) - if _, err := req.MultipartReader(); err != nil { - t.Fatalf("MultipartReader: %v", err) - } - if _, _, err := req.FormFile(""); err == nil { - t.Fatal("expected an error from FormFile after call to MultipartReader") - } -} - -var readRequestErrorTests = []struct { - in string - err error -}{ - {"GET / HTTP/1.1\r\nheader:foo\r\n\r\n", nil}, - {"GET / HTTP/1.1\r\nheader:foo\r\n", io.ErrUnexpectedEOF}, - {"", io.EOF}, -} - -func TestReadRequestErrors(t *testing.T) { - for i, tt := range readRequestErrorTests { - _, err := ReadRequest(bufio.NewReader(strings.NewReader(tt.in))) - if err != tt.err { - t.Errorf("%d. got error = %v; want %v", i, err, tt.err) - } - } -} - -func TestNewRequestHost(t *testing.T) { - req, err := NewRequest("GET", "http://localhost:1234/", nil) - if err != nil { - t.Fatal(err) - } - if req.Host != "localhost:1234" { - t.Errorf("Host = %q; want localhost:1234", req.Host) - } -} - -func TestNewRequestContentLength(t *testing.T) { - readByte := func(r io.Reader) io.Reader { - var b [1]byte - r.Read(b[:]) - return r - } - tests := []struct { - r io.Reader - want int64 - }{ - {bytes.NewReader([]byte("123")), 3}, - {bytes.NewBuffer([]byte("1234")), 4}, - {strings.NewReader("12345"), 5}, - // Not detected: - {struct{ io.Reader }{strings.NewReader("xyz")}, 0}, - {io.NewSectionReader(strings.NewReader("x"), 0, 6), 0}, - {readByte(io.NewSectionReader(strings.NewReader("xy"), 0, 6)), 0}, - } - for _, tt := range tests { - req, err := NewRequest("POST", "http://localhost/", tt.r) - if err != nil { - t.Fatal(err) - } - if req.ContentLength != tt.want { - t.Errorf("ContentLength(%T) = %d; want %d", tt.r, req.ContentLength, tt.want) - } - } -} - -var parseHTTPVersionTests = []struct { - vers string - major, minor int - ok bool -}{ - {"HTTP/0.9", 0, 9, true}, - {"HTTP/1.0", 1, 0, true}, - {"HTTP/1.1", 1, 1, true}, - {"HTTP/3.14", 3, 14, true}, - - {"HTTP", 0, 0, false}, - {"HTTP/one.one", 0, 0, false}, - {"HTTP/1.1/", 0, 0, false}, - {"HTTP/-1,0", 0, 0, false}, - {"HTTP/0,-1", 0, 0, false}, - {"HTTP/", 0, 0, false}, - {"HTTP/1,1", 0, 0, false}, -} - -func TestParseHTTPVersion(t *testing.T) { - for _, tt := range parseHTTPVersionTests { - major, minor, ok := ParseHTTPVersion(tt.vers) - if ok != tt.ok || major != tt.major || minor != tt.minor { - type version struct { - major, minor int - ok bool - } - t.Errorf("failed to parse %q, expected: %#v, got %#v", tt.vers, version{tt.major, tt.minor, tt.ok}, version{major, minor, ok}) - } - } -} - -type logWrites struct { - t *testing.T - dst *[]string -} - -func (l logWrites) WriteByte(c byte) error { - l.t.Fatalf("unexpected WriteByte call") - return nil -} - -func (l logWrites) Write(p []byte) (n int, err error) { - *l.dst = append(*l.dst, string(p)) - return len(p), nil -} - -func TestRequestWriteBufferedWriter(t *testing.T) { - got := []string{} - req, _ := NewRequest("GET", "http://foo.com/", nil) - req.Write(logWrites{t, &got}) - want := []string{ - "GET / HTTP/1.1\r\n", - "Host: foo.com\r\n", - "User-Agent: " + DefaultUserAgent + "\r\n", - "\r\n", - } - if !reflect.DeepEqual(got, want) { - t.Errorf("Writes = %q\n Want = %q", got, want) - } -} - -func testMissingFile(t *testing.T, req *Request) { - f, fh, err := req.FormFile("missing") - if f != nil { - t.Errorf("FormFile file = %v, want nil", f) - } - if fh != nil { - t.Errorf("FormFile file header = %q, want nil", fh) - } - if err != ErrMissingFile { - t.Errorf("FormFile err = %q, want ErrMissingFile", err) - } -} - -func newTestMultipartRequest(t *testing.T) *Request { - b := strings.NewReader(strings.Replace(message, "\n", "\r\n", -1)) - req, err := NewRequest("POST", "/", b) - if err != nil { - t.Fatal("NewRequest:", err) - } - ctype := fmt.Sprintf(`multipart/form-data; boundary="%s"`, boundary) - req.Header.Set("Content-type", ctype) - return req -} - -func validateTestMultipartContents(t *testing.T, req *Request, allMem bool) { - if g, e := req.FormValue("texta"), textaValue; g != e { - t.Errorf("texta value = %q, want %q", g, e) - } - if g, e := req.FormValue("textb"), textbValue; g != e { - t.Errorf("textb value = %q, want %q", g, e) - } - if g := req.FormValue("missing"); g != "" { - t.Errorf("missing value = %q, want empty string", g) - } - - assertMem := func(n string, fd multipart.File) { - if _, ok := fd.(*os.File); ok { - t.Error(n, " is *os.File, should not be") - } - } - fda := testMultipartFile(t, req, "filea", "filea.txt", fileaContents) - defer fda.Close() - assertMem("filea", fda) - fdb := testMultipartFile(t, req, "fileb", "fileb.txt", filebContents) - defer fdb.Close() - if allMem { - assertMem("fileb", fdb) - } else { - if _, ok := fdb.(*os.File); !ok { - t.Errorf("fileb has unexpected underlying type %T", fdb) - } - } - - testMissingFile(t, req) -} - -func testMultipartFile(t *testing.T, req *Request, key, expectFilename, expectContent string) multipart.File { - f, fh, err := req.FormFile(key) - if err != nil { - t.Fatalf("FormFile(%q): %q", key, err) - } - if fh.Filename != expectFilename { - t.Errorf("filename = %q, want %q", fh.Filename, expectFilename) - } - var b bytes.Buffer - _, err = io.Copy(&b, f) - if err != nil { - t.Fatal("copying contents:", err) - } - if g := b.String(); g != expectContent { - t.Errorf("contents = %q, want %q", g, expectContent) - } - return f -} - -const ( - fileaContents = "This is a test file." - filebContents = "Another test file." - textaValue = "foo" - textbValue = "bar" - boundary = `MyBoundary` -) - -const message = ` ---MyBoundary -Content-Disposition: form-data; name="filea"; filename="filea.txt" -Content-Type: text/plain - -` + fileaContents + ` ---MyBoundary -Content-Disposition: form-data; name="fileb"; filename="fileb.txt" -Content-Type: text/plain - -` + filebContents + ` ---MyBoundary -Content-Disposition: form-data; name="texta" - -` + textaValue + ` ---MyBoundary -Content-Disposition: form-data; name="textb" - -` + textbValue + ` ---MyBoundary-- -` - -func benchmarkReadRequest(b *testing.B, request string) { - request = request + "\n" // final \n - request = strings.Replace(request, "\n", "\r\n", -1) // expand \n to \r\n - b.SetBytes(int64(len(request))) - r := bufio.NewReader(&infiniteReader{buf: []byte(request)}) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - _, err := ReadRequest(r) - if err != nil { - b.Fatalf("failed to read request: %v", err) - } - } -} - -// infiniteReader satisfies Read requests as if the contents of buf -// loop indefinitely. -type infiniteReader struct { - buf []byte - offset int -} - -func (r *infiniteReader) Read(b []byte) (int, error) { - n := copy(b, r.buf[r.offset:]) - r.offset = (r.offset + n) % len(r.buf) - return n, nil -} - -func BenchmarkReadRequestChrome(b *testing.B) { - // https://github.com/felixge/node-http-perf/blob/master/fixtures/get.http - benchmarkReadRequest(b, `GET / HTTP/1.1 -Host: localhost:8080 -Connection: keep-alive -Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 -User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17 -Accept-Encoding: gzip,deflate,sdch -Accept-Language: en-US,en;q=0.8 -Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 -Cookie: __utma=1.1978842379.1323102373.1323102373.1323102373.1; EPi:NumberOfVisits=1,2012-02-28T13:42:18; CrmSession=5b707226b9563e1bc69084d07a107c98; plushContainerWidth=100%25; plushNoTopMenu=0; hudson_auto_refresh=false -`) -} - -func BenchmarkReadRequestCurl(b *testing.B) { - // curl http://localhost:8080/ - benchmarkReadRequest(b, `GET / HTTP/1.1 -User-Agent: curl/7.27.0 -Host: localhost:8080 -Accept: */* -`) -} - -func BenchmarkReadRequestApachebench(b *testing.B) { - // ab -n 1 -c 1 http://localhost:8080/ - benchmarkReadRequest(b, `GET / HTTP/1.0 -Host: localhost:8080 -User-Agent: ApacheBench/2.3 -Accept: */* -`) -} - -func BenchmarkReadRequestSiege(b *testing.B) { - // siege -r 1 -c 1 http://localhost:8080/ - benchmarkReadRequest(b, `GET / HTTP/1.1 -Host: localhost:8080 -Accept: */* -Accept-Encoding: gzip -User-Agent: JoeDog/1.00 [en] (X11; I; Siege 2.70) -Connection: keep-alive -`) -} - -func BenchmarkReadRequestWrk(b *testing.B) { - // wrk -t 1 -r 1 -c 1 http://localhost:8080/ - benchmarkReadRequest(b, `GET / HTTP/1.1 -Host: localhost:8080 -`) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/requestwrite_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/requestwrite_test.go deleted file mode 100644 index dc0e204cac..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/requestwrite_test.go +++ /dev/null @@ -1,565 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http - -import ( - "bytes" - "errors" - "fmt" - "io" - "io/ioutil" - "net/url" - "strings" - "testing" -) - -type reqWriteTest struct { - Req Request - Body interface{} // optional []byte or func() io.ReadCloser to populate Req.Body - - // Any of these three may be empty to skip that test. - WantWrite string // Request.Write - WantProxy string // Request.WriteProxy - - WantError error // wanted error from Request.Write -} - -var reqWriteTests = []reqWriteTest{ - // HTTP/1.1 => chunked coding; no body; no trailer - { - Req: Request{ - Method: "GET", - URL: &url.URL{ - Scheme: "http", - Host: "www.techcrunch.com", - Path: "/", - }, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{ - "Accept": {"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}, - "Accept-Charset": {"ISO-8859-1,utf-8;q=0.7,*;q=0.7"}, - "Accept-Encoding": {"gzip,deflate"}, - "Accept-Language": {"en-us,en;q=0.5"}, - "Keep-Alive": {"300"}, - "Proxy-Connection": {"keep-alive"}, - "User-Agent": {"Fake"}, - }, - Body: nil, - Close: false, - Host: "www.techcrunch.com", - Form: map[string][]string{}, - }, - - WantWrite: "GET / HTTP/1.1\r\n" + - "Host: www.techcrunch.com\r\n" + - "User-Agent: Fake\r\n" + - "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" + - "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" + - "Accept-Encoding: gzip,deflate\r\n" + - "Accept-Language: en-us,en;q=0.5\r\n" + - "Keep-Alive: 300\r\n" + - "Proxy-Connection: keep-alive\r\n\r\n", - - WantProxy: "GET http://www.techcrunch.com/ HTTP/1.1\r\n" + - "Host: www.techcrunch.com\r\n" + - "User-Agent: Fake\r\n" + - "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" + - "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" + - "Accept-Encoding: gzip,deflate\r\n" + - "Accept-Language: en-us,en;q=0.5\r\n" + - "Keep-Alive: 300\r\n" + - "Proxy-Connection: keep-alive\r\n\r\n", - }, - // HTTP/1.1 => chunked coding; body; empty trailer - { - Req: Request{ - Method: "GET", - URL: &url.URL{ - Scheme: "http", - Host: "www.google.com", - Path: "/search", - }, - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{}, - TransferEncoding: []string{"chunked"}, - }, - - Body: []byte("abcdef"), - - WantWrite: "GET /search HTTP/1.1\r\n" + - "Host: www.google.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "Transfer-Encoding: chunked\r\n\r\n" + - chunk("abcdef") + chunk(""), - - WantProxy: "GET http://www.google.com/search HTTP/1.1\r\n" + - "Host: www.google.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "Transfer-Encoding: chunked\r\n\r\n" + - chunk("abcdef") + chunk(""), - }, - // HTTP/1.1 POST => chunked coding; body; empty trailer - { - Req: Request{ - Method: "POST", - URL: &url.URL{ - Scheme: "http", - Host: "www.google.com", - Path: "/search", - }, - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{}, - Close: true, - TransferEncoding: []string{"chunked"}, - }, - - Body: []byte("abcdef"), - - WantWrite: "POST /search HTTP/1.1\r\n" + - "Host: www.google.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "Connection: close\r\n" + - "Transfer-Encoding: chunked\r\n\r\n" + - chunk("abcdef") + chunk(""), - - WantProxy: "POST http://www.google.com/search HTTP/1.1\r\n" + - "Host: www.google.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "Connection: close\r\n" + - "Transfer-Encoding: chunked\r\n\r\n" + - chunk("abcdef") + chunk(""), - }, - - // HTTP/1.1 POST with Content-Length, no chunking - { - Req: Request{ - Method: "POST", - URL: &url.URL{ - Scheme: "http", - Host: "www.google.com", - Path: "/search", - }, - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{}, - Close: true, - ContentLength: 6, - }, - - Body: []byte("abcdef"), - - WantWrite: "POST /search HTTP/1.1\r\n" + - "Host: www.google.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "Connection: close\r\n" + - "Content-Length: 6\r\n" + - "\r\n" + - "abcdef", - - WantProxy: "POST http://www.google.com/search HTTP/1.1\r\n" + - "Host: www.google.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "Connection: close\r\n" + - "Content-Length: 6\r\n" + - "\r\n" + - "abcdef", - }, - - // HTTP/1.1 POST with Content-Length in headers - { - Req: Request{ - Method: "POST", - URL: mustParseURL("http://example.com/"), - Host: "example.com", - Header: Header{ - "Content-Length": []string{"10"}, // ignored - }, - ContentLength: 6, - }, - - Body: []byte("abcdef"), - - WantWrite: "POST / HTTP/1.1\r\n" + - "Host: example.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "Content-Length: 6\r\n" + - "\r\n" + - "abcdef", - - WantProxy: "POST http://example.com/ HTTP/1.1\r\n" + - "Host: example.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "Content-Length: 6\r\n" + - "\r\n" + - "abcdef", - }, - - // default to HTTP/1.1 - { - Req: Request{ - Method: "GET", - URL: mustParseURL("/search"), - Host: "www.google.com", - }, - - WantWrite: "GET /search HTTP/1.1\r\n" + - "Host: www.google.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "\r\n", - }, - - // Request with a 0 ContentLength and a 0 byte body. - { - Req: Request{ - Method: "POST", - URL: mustParseURL("/"), - Host: "example.com", - ProtoMajor: 1, - ProtoMinor: 1, - ContentLength: 0, // as if unset by user - }, - - Body: func() io.ReadCloser { return ioutil.NopCloser(io.LimitReader(strings.NewReader("xx"), 0)) }, - - // RFC 2616 Section 14.13 says Content-Length should be specified - // unless body is prohibited by the request method. - // Also, nginx expects it for POST and PUT. - WantWrite: "POST / HTTP/1.1\r\n" + - "Host: example.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "Content-Length: 0\r\n" + - "\r\n", - - WantProxy: "POST / HTTP/1.1\r\n" + - "Host: example.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "Content-Length: 0\r\n" + - "\r\n", - }, - - // Request with a 0 ContentLength and a 1 byte body. - { - Req: Request{ - Method: "POST", - URL: mustParseURL("/"), - Host: "example.com", - ProtoMajor: 1, - ProtoMinor: 1, - ContentLength: 0, // as if unset by user - }, - - Body: func() io.ReadCloser { return ioutil.NopCloser(io.LimitReader(strings.NewReader("xx"), 1)) }, - - WantWrite: "POST / HTTP/1.1\r\n" + - "Host: example.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "Transfer-Encoding: chunked\r\n\r\n" + - chunk("x") + chunk(""), - - WantProxy: "POST / HTTP/1.1\r\n" + - "Host: example.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "Transfer-Encoding: chunked\r\n\r\n" + - chunk("x") + chunk(""), - }, - - // Request with a ContentLength of 10 but a 5 byte body. - { - Req: Request{ - Method: "POST", - URL: mustParseURL("/"), - Host: "example.com", - ProtoMajor: 1, - ProtoMinor: 1, - ContentLength: 10, // but we're going to send only 5 bytes - }, - Body: []byte("12345"), - WantError: errors.New("http: Request.ContentLength=10 with Body length 5"), - }, - - // Request with a ContentLength of 4 but an 8 byte body. - { - Req: Request{ - Method: "POST", - URL: mustParseURL("/"), - Host: "example.com", - ProtoMajor: 1, - ProtoMinor: 1, - ContentLength: 4, // but we're going to try to send 8 bytes - }, - Body: []byte("12345678"), - WantError: errors.New("http: Request.ContentLength=4 with Body length 8"), - }, - - // Request with a 5 ContentLength and nil body. - { - Req: Request{ - Method: "POST", - URL: mustParseURL("/"), - Host: "example.com", - ProtoMajor: 1, - ProtoMinor: 1, - ContentLength: 5, // but we'll omit the body - }, - WantError: errors.New("http: Request.ContentLength=5 with nil Body"), - }, - - // Request with a 0 ContentLength and a body with 1 byte content and an error. - { - Req: Request{ - Method: "POST", - URL: mustParseURL("/"), - Host: "example.com", - ProtoMajor: 1, - ProtoMinor: 1, - ContentLength: 0, // as if unset by user - }, - - Body: func() io.ReadCloser { - err := errors.New("Custom reader error") - errReader := &errorReader{err} - return ioutil.NopCloser(io.MultiReader(strings.NewReader("x"), errReader)) - }, - - WantError: errors.New("Custom reader error"), - }, - - // Request with a 0 ContentLength and a body without content and an error. - { - Req: Request{ - Method: "POST", - URL: mustParseURL("/"), - Host: "example.com", - ProtoMajor: 1, - ProtoMinor: 1, - ContentLength: 0, // as if unset by user - }, - - Body: func() io.ReadCloser { - err := errors.New("Custom reader error") - errReader := &errorReader{err} - return ioutil.NopCloser(errReader) - }, - - WantError: errors.New("Custom reader error"), - }, - - // Verify that DumpRequest preserves the HTTP version number, doesn't add a Host, - // and doesn't add a User-Agent. - { - Req: Request{ - Method: "GET", - URL: mustParseURL("/foo"), - ProtoMajor: 1, - ProtoMinor: 0, - Header: Header{ - "X-Foo": []string{"X-Bar"}, - }, - }, - - WantWrite: "GET /foo HTTP/1.1\r\n" + - "Host: \r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "X-Foo: X-Bar\r\n\r\n", - }, - - // If no Request.Host and no Request.URL.Host, we send - // an empty Host header, and don't use - // Request.Header["Host"]. This is just testing that - // we don't change Go 1.0 behavior. - { - Req: Request{ - Method: "GET", - Host: "", - URL: &url.URL{ - Scheme: "http", - Host: "", - Path: "/search", - }, - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{ - "Host": []string{"bad.example.com"}, - }, - }, - - WantWrite: "GET /search HTTP/1.1\r\n" + - "Host: \r\n" + - "User-Agent: Go 1.1 package http\r\n\r\n", - }, - - // Opaque test #1 from golang.org/issue/4860 - { - Req: Request{ - Method: "GET", - URL: &url.URL{ - Scheme: "http", - Host: "www.google.com", - Opaque: "/%2F/%2F/", - }, - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{}, - }, - - WantWrite: "GET /%2F/%2F/ HTTP/1.1\r\n" + - "Host: www.google.com\r\n" + - "User-Agent: Go 1.1 package http\r\n\r\n", - }, - - // Opaque test #2 from golang.org/issue/4860 - { - Req: Request{ - Method: "GET", - URL: &url.URL{ - Scheme: "http", - Host: "x.google.com", - Opaque: "//y.google.com/%2F/%2F/", - }, - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{}, - }, - - WantWrite: "GET http://y.google.com/%2F/%2F/ HTTP/1.1\r\n" + - "Host: x.google.com\r\n" + - "User-Agent: Go 1.1 package http\r\n\r\n", - }, - - // Testing custom case in header keys. Issue 5022. - { - Req: Request{ - Method: "GET", - URL: &url.URL{ - Scheme: "http", - Host: "www.google.com", - Path: "/", - }, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{ - "ALL-CAPS": {"x"}, - }, - }, - - WantWrite: "GET / HTTP/1.1\r\n" + - "Host: www.google.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "ALL-CAPS: x\r\n" + - "\r\n", - }, -} - -func TestRequestWrite(t *testing.T) { - for i := range reqWriteTests { - tt := &reqWriteTests[i] - - setBody := func() { - if tt.Body == nil { - return - } - switch b := tt.Body.(type) { - case []byte: - tt.Req.Body = ioutil.NopCloser(bytes.NewReader(b)) - case func() io.ReadCloser: - tt.Req.Body = b() - } - } - setBody() - if tt.Req.Header == nil { - tt.Req.Header = make(Header) - } - - var braw bytes.Buffer - err := tt.Req.Write(&braw) - if g, e := fmt.Sprintf("%v", err), fmt.Sprintf("%v", tt.WantError); g != e { - t.Errorf("writing #%d, err = %q, want %q", i, g, e) - continue - } - if err != nil { - continue - } - - if tt.WantWrite != "" { - sraw := braw.String() - if sraw != tt.WantWrite { - t.Errorf("Test %d, expecting:\n%s\nGot:\n%s\n", i, tt.WantWrite, sraw) - continue - } - } - - if tt.WantProxy != "" { - setBody() - var praw bytes.Buffer - err = tt.Req.WriteProxy(&praw) - if err != nil { - t.Errorf("WriteProxy #%d: %s", i, err) - continue - } - sraw := praw.String() - if sraw != tt.WantProxy { - t.Errorf("Test Proxy %d, expecting:\n%s\nGot:\n%s\n", i, tt.WantProxy, sraw) - continue - } - } - } -} - -type closeChecker struct { - io.Reader - closed bool -} - -func (rc *closeChecker) Close() error { - rc.closed = true - return nil -} - -// TestRequestWriteClosesBody tests that Request.Write does close its request.Body. -// It also indirectly tests NewRequest and that it doesn't wrap an existing Closer -// inside a NopCloser, and that it serializes it correctly. -func TestRequestWriteClosesBody(t *testing.T) { - rc := &closeChecker{Reader: strings.NewReader("my body")} - req, _ := NewRequest("POST", "http://foo.com/", rc) - if req.ContentLength != 0 { - t.Errorf("got req.ContentLength %d, want 0", req.ContentLength) - } - buf := new(bytes.Buffer) - req.Write(buf) - if !rc.closed { - t.Error("body not closed after write") - } - expected := "POST / HTTP/1.1\r\n" + - "Host: foo.com\r\n" + - "User-Agent: Go 1.1 package http\r\n" + - "Transfer-Encoding: chunked\r\n\r\n" + - // TODO: currently we don't buffer before chunking, so we get a - // single "m" chunk before the other chunks, as this was the 1-byte - // read from our MultiReader where we stiched the Body back together - // after sniffing whether the Body was 0 bytes or not. - chunk("m") + - chunk("y body") + - chunk("") - if buf.String() != expected { - t.Errorf("write:\n got: %s\nwant: %s", buf.String(), expected) - } -} - -func chunk(s string) string { - return fmt.Sprintf("%x\r\n%s\r\n", len(s), s) -} - -func mustParseURL(s string) *url.URL { - u, err := url.Parse(s) - if err != nil { - panic(fmt.Sprintf("Error parsing URL %q: %v", s, err)) - } - return u -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/response_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/response_test.go deleted file mode 100644 index 4b8946f7ae..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/response_test.go +++ /dev/null @@ -1,645 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http - -import ( - "bufio" - "bytes" - "compress/gzip" - "crypto/rand" - "fmt" - "io" - "io/ioutil" - "net/url" - "reflect" - "regexp" - "strings" - "testing" -) - -type respTest struct { - Raw string - Resp Response - Body string -} - -func dummyReq(method string) *Request { - return &Request{Method: method} -} - -func dummyReq11(method string) *Request { - return &Request{Method: method, Proto: "HTTP/1.1", ProtoMajor: 1, ProtoMinor: 1} -} - -var respTests = []respTest{ - // Unchunked response without Content-Length. - { - "HTTP/1.0 200 OK\r\n" + - "Connection: close\r\n" + - "\r\n" + - "Body here\n", - - Response{ - Status: "200 OK", - StatusCode: 200, - Proto: "HTTP/1.0", - ProtoMajor: 1, - ProtoMinor: 0, - Request: dummyReq("GET"), - Header: Header{ - "Connection": {"close"}, // TODO(rsc): Delete? - }, - Close: true, - ContentLength: -1, - }, - - "Body here\n", - }, - - // Unchunked HTTP/1.1 response without Content-Length or - // Connection headers. - { - "HTTP/1.1 200 OK\r\n" + - "\r\n" + - "Body here\n", - - Response{ - Status: "200 OK", - StatusCode: 200, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{}, - Request: dummyReq("GET"), - Close: true, - ContentLength: -1, - }, - - "Body here\n", - }, - - // Unchunked HTTP/1.1 204 response without Content-Length. - { - "HTTP/1.1 204 No Content\r\n" + - "\r\n" + - "Body should not be read!\n", - - Response{ - Status: "204 No Content", - StatusCode: 204, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Header: Header{}, - Request: dummyReq("GET"), - Close: false, - ContentLength: 0, - }, - - "", - }, - - // Unchunked response with Content-Length. - { - "HTTP/1.0 200 OK\r\n" + - "Content-Length: 10\r\n" + - "Connection: close\r\n" + - "\r\n" + - "Body here\n", - - Response{ - Status: "200 OK", - StatusCode: 200, - Proto: "HTTP/1.0", - ProtoMajor: 1, - ProtoMinor: 0, - Request: dummyReq("GET"), - Header: Header{ - "Connection": {"close"}, - "Content-Length": {"10"}, - }, - Close: true, - ContentLength: 10, - }, - - "Body here\n", - }, - - // Chunked response without Content-Length. - { - "HTTP/1.1 200 OK\r\n" + - "Transfer-Encoding: chunked\r\n" + - "\r\n" + - "0a\r\n" + - "Body here\n\r\n" + - "09\r\n" + - "continued\r\n" + - "0\r\n" + - "\r\n", - - Response{ - Status: "200 OK", - StatusCode: 200, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Request: dummyReq("GET"), - Header: Header{}, - Close: false, - ContentLength: -1, - TransferEncoding: []string{"chunked"}, - }, - - "Body here\ncontinued", - }, - - // Chunked response with Content-Length. - { - "HTTP/1.1 200 OK\r\n" + - "Transfer-Encoding: chunked\r\n" + - "Content-Length: 10\r\n" + - "\r\n" + - "0a\r\n" + - "Body here\n\r\n" + - "0\r\n" + - "\r\n", - - Response{ - Status: "200 OK", - StatusCode: 200, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Request: dummyReq("GET"), - Header: Header{}, - Close: false, - ContentLength: -1, - TransferEncoding: []string{"chunked"}, - }, - - "Body here\n", - }, - - // Chunked response in response to a HEAD request - { - "HTTP/1.1 200 OK\r\n" + - "Transfer-Encoding: chunked\r\n" + - "\r\n", - - Response{ - Status: "200 OK", - StatusCode: 200, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Request: dummyReq("HEAD"), - Header: Header{}, - TransferEncoding: []string{"chunked"}, - Close: false, - ContentLength: -1, - }, - - "", - }, - - // Content-Length in response to a HEAD request - { - "HTTP/1.0 200 OK\r\n" + - "Content-Length: 256\r\n" + - "\r\n", - - Response{ - Status: "200 OK", - StatusCode: 200, - Proto: "HTTP/1.0", - ProtoMajor: 1, - ProtoMinor: 0, - Request: dummyReq("HEAD"), - Header: Header{"Content-Length": {"256"}}, - TransferEncoding: nil, - Close: true, - ContentLength: 256, - }, - - "", - }, - - // Content-Length in response to a HEAD request with HTTP/1.1 - { - "HTTP/1.1 200 OK\r\n" + - "Content-Length: 256\r\n" + - "\r\n", - - Response{ - Status: "200 OK", - StatusCode: 200, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Request: dummyReq("HEAD"), - Header: Header{"Content-Length": {"256"}}, - TransferEncoding: nil, - Close: false, - ContentLength: 256, - }, - - "", - }, - - // No Content-Length or Chunked in response to a HEAD request - { - "HTTP/1.0 200 OK\r\n" + - "\r\n", - - Response{ - Status: "200 OK", - StatusCode: 200, - Proto: "HTTP/1.0", - ProtoMajor: 1, - ProtoMinor: 0, - Request: dummyReq("HEAD"), - Header: Header{}, - TransferEncoding: nil, - Close: true, - ContentLength: -1, - }, - - "", - }, - - // explicit Content-Length of 0. - { - "HTTP/1.1 200 OK\r\n" + - "Content-Length: 0\r\n" + - "\r\n", - - Response{ - Status: "200 OK", - StatusCode: 200, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Request: dummyReq("GET"), - Header: Header{ - "Content-Length": {"0"}, - }, - Close: false, - ContentLength: 0, - }, - - "", - }, - - // Status line without a Reason-Phrase, but trailing space. - // (permitted by RFC 2616) - { - "HTTP/1.0 303 \r\n\r\n", - Response{ - Status: "303 ", - StatusCode: 303, - Proto: "HTTP/1.0", - ProtoMajor: 1, - ProtoMinor: 0, - Request: dummyReq("GET"), - Header: Header{}, - Close: true, - ContentLength: -1, - }, - - "", - }, - - // Status line without a Reason-Phrase, and no trailing space. - // (not permitted by RFC 2616, but we'll accept it anyway) - { - "HTTP/1.0 303\r\n\r\n", - Response{ - Status: "303 ", - StatusCode: 303, - Proto: "HTTP/1.0", - ProtoMajor: 1, - ProtoMinor: 0, - Request: dummyReq("GET"), - Header: Header{}, - Close: true, - ContentLength: -1, - }, - - "", - }, - - // golang.org/issue/4767: don't special-case multipart/byteranges responses - { - `HTTP/1.1 206 Partial Content -Connection: close -Content-Type: multipart/byteranges; boundary=18a75608c8f47cef - -some body`, - Response{ - Status: "206 Partial Content", - StatusCode: 206, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Request: dummyReq("GET"), - Header: Header{ - "Content-Type": []string{"multipart/byteranges; boundary=18a75608c8f47cef"}, - }, - Close: true, - ContentLength: -1, - }, - - "some body", - }, - - // Unchunked response without Content-Length, Request is nil - { - "HTTP/1.0 200 OK\r\n" + - "Connection: close\r\n" + - "\r\n" + - "Body here\n", - - Response{ - Status: "200 OK", - StatusCode: 200, - Proto: "HTTP/1.0", - ProtoMajor: 1, - ProtoMinor: 0, - Header: Header{ - "Connection": {"close"}, // TODO(rsc): Delete? - }, - Close: true, - ContentLength: -1, - }, - - "Body here\n", - }, -} - -func TestReadResponse(t *testing.T) { - for i, tt := range respTests { - resp, err := ReadResponse(bufio.NewReader(strings.NewReader(tt.Raw)), tt.Resp.Request) - if err != nil { - t.Errorf("#%d: %v", i, err) - continue - } - rbody := resp.Body - resp.Body = nil - diff(t, fmt.Sprintf("#%d Response", i), resp, &tt.Resp) - var bout bytes.Buffer - if rbody != nil { - _, err = io.Copy(&bout, rbody) - if err != nil { - t.Errorf("#%d: %v", i, err) - continue - } - rbody.Close() - } - body := bout.String() - if body != tt.Body { - t.Errorf("#%d: Body = %q want %q", i, body, tt.Body) - } - } -} - -func TestWriteResponse(t *testing.T) { - for i, tt := range respTests { - resp, err := ReadResponse(bufio.NewReader(strings.NewReader(tt.Raw)), tt.Resp.Request) - if err != nil { - t.Errorf("#%d: %v", i, err) - continue - } - err = resp.Write(ioutil.Discard) - if err != nil { - t.Errorf("#%d: %v", i, err) - continue - } - } -} - -var readResponseCloseInMiddleTests = []struct { - chunked, compressed bool -}{ - {false, false}, - {true, false}, - {true, true}, -} - -// TestReadResponseCloseInMiddle tests that closing a body after -// reading only part of its contents advances the read to the end of -// the request, right up until the next request. -func TestReadResponseCloseInMiddle(t *testing.T) { - for _, test := range readResponseCloseInMiddleTests { - fatalf := func(format string, args ...interface{}) { - args = append([]interface{}{test.chunked, test.compressed}, args...) - t.Fatalf("on test chunked=%v, compressed=%v: "+format, args...) - } - checkErr := func(err error, msg string) { - if err == nil { - return - } - fatalf(msg+": %v", err) - } - var buf bytes.Buffer - buf.WriteString("HTTP/1.1 200 OK\r\n") - if test.chunked { - buf.WriteString("Transfer-Encoding: chunked\r\n") - } else { - buf.WriteString("Content-Length: 1000000\r\n") - } - var wr io.Writer = &buf - if test.chunked { - wr = newChunkedWriter(wr) - } - if test.compressed { - buf.WriteString("Content-Encoding: gzip\r\n") - wr = gzip.NewWriter(wr) - } - buf.WriteString("\r\n") - - chunk := bytes.Repeat([]byte{'x'}, 1000) - for i := 0; i < 1000; i++ { - if test.compressed { - // Otherwise this compresses too well. - _, err := io.ReadFull(rand.Reader, chunk) - checkErr(err, "rand.Reader ReadFull") - } - wr.Write(chunk) - } - if test.compressed { - err := wr.(*gzip.Writer).Close() - checkErr(err, "compressor close") - } - if test.chunked { - buf.WriteString("0\r\n\r\n") - } - buf.WriteString("Next Request Here") - - bufr := bufio.NewReader(&buf) - resp, err := ReadResponse(bufr, dummyReq("GET")) - checkErr(err, "ReadResponse") - expectedLength := int64(-1) - if !test.chunked { - expectedLength = 1000000 - } - if resp.ContentLength != expectedLength { - fatalf("expected response length %d, got %d", expectedLength, resp.ContentLength) - } - if resp.Body == nil { - fatalf("nil body") - } - if test.compressed { - gzReader, err := gzip.NewReader(resp.Body) - checkErr(err, "gzip.NewReader") - resp.Body = &readerAndCloser{gzReader, resp.Body} - } - - rbuf := make([]byte, 2500) - n, err := io.ReadFull(resp.Body, rbuf) - checkErr(err, "2500 byte ReadFull") - if n != 2500 { - fatalf("ReadFull only read %d bytes", n) - } - if test.compressed == false && !bytes.Equal(bytes.Repeat([]byte{'x'}, 2500), rbuf) { - fatalf("ReadFull didn't read 2500 'x'; got %q", string(rbuf)) - } - resp.Body.Close() - - rest, err := ioutil.ReadAll(bufr) - checkErr(err, "ReadAll on remainder") - if e, g := "Next Request Here", string(rest); e != g { - g = regexp.MustCompile(`(xx+)`).ReplaceAllStringFunc(g, func(match string) string { - return fmt.Sprintf("x(repeated x%d)", len(match)) - }) - fatalf("remainder = %q, expected %q", g, e) - } - } -} - -func diff(t *testing.T, prefix string, have, want interface{}) { - hv := reflect.ValueOf(have).Elem() - wv := reflect.ValueOf(want).Elem() - if hv.Type() != wv.Type() { - t.Errorf("%s: type mismatch %v want %v", prefix, hv.Type(), wv.Type()) - } - for i := 0; i < hv.NumField(); i++ { - hf := hv.Field(i).Interface() - wf := wv.Field(i).Interface() - if !reflect.DeepEqual(hf, wf) { - t.Errorf("%s: %s = %v want %v", prefix, hv.Type().Field(i).Name, hf, wf) - } - } -} - -type responseLocationTest struct { - location string // Response's Location header or "" - requrl string // Response.Request.URL or "" - want string - wantErr error -} - -var responseLocationTests = []responseLocationTest{ - {"/foo", "http://bar.com/baz", "http://bar.com/foo", nil}, - {"http://foo.com/", "http://bar.com/baz", "http://foo.com/", nil}, - {"", "http://bar.com/baz", "", ErrNoLocation}, -} - -func TestLocationResponse(t *testing.T) { - for i, tt := range responseLocationTests { - res := new(Response) - res.Header = make(Header) - res.Header.Set("Location", tt.location) - if tt.requrl != "" { - res.Request = &Request{} - var err error - res.Request.URL, err = url.Parse(tt.requrl) - if err != nil { - t.Fatalf("bad test URL %q: %v", tt.requrl, err) - } - } - - got, err := res.Location() - if tt.wantErr != nil { - if err == nil { - t.Errorf("%d. err=nil; want %q", i, tt.wantErr) - continue - } - if g, e := err.Error(), tt.wantErr.Error(); g != e { - t.Errorf("%d. err=%q; want %q", i, g, e) - continue - } - continue - } - if err != nil { - t.Errorf("%d. err=%q", i, err) - continue - } - if g, e := got.String(), tt.want; g != e { - t.Errorf("%d. Location=%q; want %q", i, g, e) - } - } -} - -func TestResponseStatusStutter(t *testing.T) { - r := &Response{ - Status: "123 some status", - StatusCode: 123, - ProtoMajor: 1, - ProtoMinor: 3, - } - var buf bytes.Buffer - r.Write(&buf) - if strings.Contains(buf.String(), "123 123") { - t.Errorf("stutter in status: %s", buf.String()) - } -} - -func TestResponseContentLengthShortBody(t *testing.T) { - const shortBody = "Short body, not 123 bytes." - br := bufio.NewReader(strings.NewReader("HTTP/1.1 200 OK\r\n" + - "Content-Length: 123\r\n" + - "\r\n" + - shortBody)) - res, err := ReadResponse(br, &Request{Method: "GET"}) - if err != nil { - t.Fatal(err) - } - if res.ContentLength != 123 { - t.Fatalf("Content-Length = %d; want 123", res.ContentLength) - } - var buf bytes.Buffer - n, err := io.Copy(&buf, res.Body) - if n != int64(len(shortBody)) { - t.Errorf("Copied %d bytes; want %d, len(%q)", n, len(shortBody), shortBody) - } - if buf.String() != shortBody { - t.Errorf("Read body %q; want %q", buf.String(), shortBody) - } - if err != io.ErrUnexpectedEOF { - t.Errorf("io.Copy error = %#v; want io.ErrUnexpectedEOF", err) - } -} - -func TestReadResponseUnexpectedEOF(t *testing.T) { - br := bufio.NewReader(strings.NewReader("HTTP/1.1 301 Moved Permanently\r\n" + - "Location: http://example.com")) - _, err := ReadResponse(br, nil) - if err != io.ErrUnexpectedEOF { - t.Errorf("ReadResponse = %v; want io.ErrUnexpectedEOF", err) - } -} - -func TestNeedsSniff(t *testing.T) { - // needsSniff returns true with an empty response. - r := &response{} - if got, want := r.needsSniff(), true; got != want { - t.Errorf("needsSniff = %t; want %t", got, want) - } - // needsSniff returns false when Content-Type = nil. - r.handlerHeader = Header{"Content-Type": nil} - if got, want := r.needsSniff(), false; got != want { - t.Errorf("needsSniff empty Content-Type = %t; want %t", got, want) - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/responsewrite_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/responsewrite_test.go deleted file mode 100644 index 585b13b850..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/responsewrite_test.go +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http - -import ( - "bytes" - "io/ioutil" - "strings" - "testing" -) - -type respWriteTest struct { - Resp Response - Raw string -} - -func TestResponseWrite(t *testing.T) { - respWriteTests := []respWriteTest{ - // HTTP/1.0, identity coding; no trailer - { - Response{ - StatusCode: 503, - ProtoMajor: 1, - ProtoMinor: 0, - Request: dummyReq("GET"), - Header: Header{}, - Body: ioutil.NopCloser(strings.NewReader("abcdef")), - ContentLength: 6, - }, - - "HTTP/1.0 503 Service Unavailable\r\n" + - "Content-Length: 6\r\n\r\n" + - "abcdef", - }, - // Unchunked response without Content-Length. - { - Response{ - StatusCode: 200, - ProtoMajor: 1, - ProtoMinor: 0, - Request: dummyReq("GET"), - Header: Header{}, - Body: ioutil.NopCloser(strings.NewReader("abcdef")), - ContentLength: -1, - }, - "HTTP/1.0 200 OK\r\n" + - "\r\n" + - "abcdef", - }, - // HTTP/1.1 response with unknown length and Connection: close - { - Response{ - StatusCode: 200, - ProtoMajor: 1, - ProtoMinor: 1, - Request: dummyReq("GET"), - Header: Header{}, - Body: ioutil.NopCloser(strings.NewReader("abcdef")), - ContentLength: -1, - Close: true, - }, - "HTTP/1.1 200 OK\r\n" + - "Connection: close\r\n" + - "\r\n" + - "abcdef", - }, - // HTTP/1.1 response with unknown length and not setting connection: close - { - Response{ - StatusCode: 200, - ProtoMajor: 1, - ProtoMinor: 1, - Request: dummyReq11("GET"), - Header: Header{}, - Body: ioutil.NopCloser(strings.NewReader("abcdef")), - ContentLength: -1, - Close: false, - }, - "HTTP/1.1 200 OK\r\n" + - "Connection: close\r\n" + - "\r\n" + - "abcdef", - }, - // HTTP/1.1 response with unknown length and not setting connection: close, but - // setting chunked. - { - Response{ - StatusCode: 200, - ProtoMajor: 1, - ProtoMinor: 1, - Request: dummyReq11("GET"), - Header: Header{}, - Body: ioutil.NopCloser(strings.NewReader("abcdef")), - ContentLength: -1, - TransferEncoding: []string{"chunked"}, - Close: false, - }, - "HTTP/1.1 200 OK\r\n" + - "Transfer-Encoding: chunked\r\n\r\n" + - "6\r\nabcdef\r\n0\r\n\r\n", - }, - // HTTP/1.1 response 0 content-length, and nil body - { - Response{ - StatusCode: 200, - ProtoMajor: 1, - ProtoMinor: 1, - Request: dummyReq11("GET"), - Header: Header{}, - Body: nil, - ContentLength: 0, - Close: false, - }, - "HTTP/1.1 200 OK\r\n" + - "Content-Length: 0\r\n" + - "\r\n", - }, - // HTTP/1.1 response 0 content-length, and non-nil empty body - { - Response{ - StatusCode: 200, - ProtoMajor: 1, - ProtoMinor: 1, - Request: dummyReq11("GET"), - Header: Header{}, - Body: ioutil.NopCloser(strings.NewReader("")), - ContentLength: 0, - Close: false, - }, - "HTTP/1.1 200 OK\r\n" + - "Content-Length: 0\r\n" + - "\r\n", - }, - // HTTP/1.1 response 0 content-length, and non-nil non-empty body - { - Response{ - StatusCode: 200, - ProtoMajor: 1, - ProtoMinor: 1, - Request: dummyReq11("GET"), - Header: Header{}, - Body: ioutil.NopCloser(strings.NewReader("foo")), - ContentLength: 0, - Close: false, - }, - "HTTP/1.1 200 OK\r\n" + - "Connection: close\r\n" + - "\r\nfoo", - }, - // HTTP/1.1, chunked coding; empty trailer; close - { - Response{ - StatusCode: 200, - ProtoMajor: 1, - ProtoMinor: 1, - Request: dummyReq("GET"), - Header: Header{}, - Body: ioutil.NopCloser(strings.NewReader("abcdef")), - ContentLength: 6, - TransferEncoding: []string{"chunked"}, - Close: true, - }, - - "HTTP/1.1 200 OK\r\n" + - "Connection: close\r\n" + - "Transfer-Encoding: chunked\r\n\r\n" + - "6\r\nabcdef\r\n0\r\n\r\n", - }, - - // Header value with a newline character (Issue 914). - // Also tests removal of leading and trailing whitespace. - { - Response{ - StatusCode: 204, - ProtoMajor: 1, - ProtoMinor: 1, - Request: dummyReq("GET"), - Header: Header{ - "Foo": []string{" Bar\nBaz "}, - }, - Body: nil, - ContentLength: 0, - TransferEncoding: []string{"chunked"}, - Close: true, - }, - - "HTTP/1.1 204 No Content\r\n" + - "Connection: close\r\n" + - "Foo: Bar Baz\r\n" + - "\r\n", - }, - - // Want a single Content-Length header. Fixing issue 8180 where - // there were two. - { - Response{ - StatusCode: StatusOK, - ProtoMajor: 1, - ProtoMinor: 1, - Request: &Request{Method: "POST"}, - Header: Header{}, - ContentLength: 0, - TransferEncoding: nil, - Body: nil, - }, - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n", - }, - } - - for i := range respWriteTests { - tt := &respWriteTests[i] - var braw bytes.Buffer - err := tt.Resp.Write(&braw) - if err != nil { - t.Errorf("error writing #%d: %s", i, err) - continue - } - sraw := braw.String() - if sraw != tt.Raw { - t.Errorf("Test %d, expecting:\n%q\nGot:\n%q\n", i, tt.Raw, sraw) - continue - } - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/serve_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/serve_test.go deleted file mode 100644 index 9e4d226bfe..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/serve_test.go +++ /dev/null @@ -1,2848 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// End-to-end serving tests - -package http_test - -import ( - "bufio" - "bytes" - "crypto/tls" - "errors" - "fmt" - "io" - "io/ioutil" - "log" - "net" - . "net/http" - "net/http/httptest" - "net/http/httputil" - "net/url" - "os" - "os/exec" - "reflect" - "runtime" - "strconv" - "strings" - "sync" - "sync/atomic" - "syscall" - "testing" - "time" -) - -type dummyAddr string -type oneConnListener struct { - conn net.Conn -} - -func (l *oneConnListener) Accept() (c net.Conn, err error) { - c = l.conn - if c == nil { - err = io.EOF - return - } - err = nil - l.conn = nil - return -} - -func (l *oneConnListener) Close() error { - return nil -} - -func (l *oneConnListener) Addr() net.Addr { - return dummyAddr("test-address") -} - -func (a dummyAddr) Network() string { - return string(a) -} - -func (a dummyAddr) String() string { - return string(a) -} - -type noopConn struct{} - -func (noopConn) LocalAddr() net.Addr { return dummyAddr("local-addr") } -func (noopConn) RemoteAddr() net.Addr { return dummyAddr("remote-addr") } -func (noopConn) SetDeadline(t time.Time) error { return nil } -func (noopConn) SetReadDeadline(t time.Time) error { return nil } -func (noopConn) SetWriteDeadline(t time.Time) error { return nil } - -type rwTestConn struct { - io.Reader - io.Writer - noopConn - - closeFunc func() error // called if non-nil - closec chan bool // else, if non-nil, send value to it on close -} - -func (c *rwTestConn) Close() error { - if c.closeFunc != nil { - return c.closeFunc() - } - select { - case c.closec <- true: - default: - } - return nil -} - -type testConn struct { - readBuf bytes.Buffer - writeBuf bytes.Buffer - closec chan bool // if non-nil, send value to it on close - noopConn -} - -func (c *testConn) Read(b []byte) (int, error) { - return c.readBuf.Read(b) -} - -func (c *testConn) Write(b []byte) (int, error) { - return c.writeBuf.Write(b) -} - -func (c *testConn) Close() error { - select { - case c.closec <- true: - default: - } - return nil -} - -// reqBytes treats req as a request (with \n delimiters) and returns it with \r\n delimiters, -// ending in \r\n\r\n -func reqBytes(req string) []byte { - return []byte(strings.Replace(strings.TrimSpace(req), "\n", "\r\n", -1) + "\r\n\r\n") -} - -type handlerTest struct { - handler Handler -} - -func newHandlerTest(h Handler) handlerTest { - return handlerTest{h} -} - -func (ht handlerTest) rawResponse(req string) string { - reqb := reqBytes(req) - var output bytes.Buffer - conn := &rwTestConn{ - Reader: bytes.NewReader(reqb), - Writer: &output, - closec: make(chan bool, 1), - } - ln := &oneConnListener{conn: conn} - go Serve(ln, ht.handler) - <-conn.closec - return output.String() -} - -func TestConsumingBodyOnNextConn(t *testing.T) { - conn := new(testConn) - for i := 0; i < 2; i++ { - conn.readBuf.Write([]byte( - "POST / HTTP/1.1\r\n" + - "Host: test\r\n" + - "Content-Length: 11\r\n" + - "\r\n" + - "foo=1&bar=1")) - } - - reqNum := 0 - ch := make(chan *Request) - servech := make(chan error) - listener := &oneConnListener{conn} - handler := func(res ResponseWriter, req *Request) { - reqNum++ - ch <- req - } - - go func() { - servech <- Serve(listener, HandlerFunc(handler)) - }() - - var req *Request - req = <-ch - if req == nil { - t.Fatal("Got nil first request.") - } - if req.Method != "POST" { - t.Errorf("For request #1's method, got %q; expected %q", - req.Method, "POST") - } - - req = <-ch - if req == nil { - t.Fatal("Got nil first request.") - } - if req.Method != "POST" { - t.Errorf("For request #2's method, got %q; expected %q", - req.Method, "POST") - } - - if serveerr := <-servech; serveerr != io.EOF { - t.Errorf("Serve returned %q; expected EOF", serveerr) - } -} - -type stringHandler string - -func (s stringHandler) ServeHTTP(w ResponseWriter, r *Request) { - w.Header().Set("Result", string(s)) -} - -var handlers = []struct { - pattern string - msg string -}{ - {"/", "Default"}, - {"/someDir/", "someDir"}, - {"someHost.com/someDir/", "someHost.com/someDir"}, -} - -var vtests = []struct { - url string - expected string -}{ - {"http://localhost/someDir/apage", "someDir"}, - {"http://localhost/otherDir/apage", "Default"}, - {"http://someHost.com/someDir/apage", "someHost.com/someDir"}, - {"http://otherHost.com/someDir/apage", "someDir"}, - {"http://otherHost.com/aDir/apage", "Default"}, - // redirections for trees - {"http://localhost/someDir", "/someDir/"}, - {"http://someHost.com/someDir", "/someDir/"}, -} - -func TestHostHandlers(t *testing.T) { - defer afterTest(t) - mux := NewServeMux() - for _, h := range handlers { - mux.Handle(h.pattern, stringHandler(h.msg)) - } - ts := httptest.NewServer(mux) - defer ts.Close() - - conn, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatal(err) - } - defer conn.Close() - cc := httputil.NewClientConn(conn, nil) - for _, vt := range vtests { - var r *Response - var req Request - if req.URL, err = url.Parse(vt.url); err != nil { - t.Errorf("cannot parse url: %v", err) - continue - } - if err := cc.Write(&req); err != nil { - t.Errorf("writing request: %v", err) - continue - } - r, err := cc.Read(&req) - if err != nil { - t.Errorf("reading response: %v", err) - continue - } - switch r.StatusCode { - case StatusOK: - s := r.Header.Get("Result") - if s != vt.expected { - t.Errorf("Get(%q) = %q, want %q", vt.url, s, vt.expected) - } - case StatusMovedPermanently: - s := r.Header.Get("Location") - if s != vt.expected { - t.Errorf("Get(%q) = %q, want %q", vt.url, s, vt.expected) - } - default: - t.Errorf("Get(%q) unhandled status code %d", vt.url, r.StatusCode) - } - } -} - -var serveMuxRegister = []struct { - pattern string - h Handler -}{ - {"/dir/", serve(200)}, - {"/search", serve(201)}, - {"codesearch.google.com/search", serve(202)}, - {"codesearch.google.com/", serve(203)}, - {"example.com/", HandlerFunc(checkQueryStringHandler)}, -} - -// serve returns a handler that sends a response with the given code. -func serve(code int) HandlerFunc { - return func(w ResponseWriter, r *Request) { - w.WriteHeader(code) - } -} - -// checkQueryStringHandler checks if r.URL.RawQuery has the same value -// as the URL excluding the scheme and the query string and sends 200 -// response code if it is, 500 otherwise. -func checkQueryStringHandler(w ResponseWriter, r *Request) { - u := *r.URL - u.Scheme = "http" - u.Host = r.Host - u.RawQuery = "" - if "http://"+r.URL.RawQuery == u.String() { - w.WriteHeader(200) - } else { - w.WriteHeader(500) - } -} - -var serveMuxTests = []struct { - method string - host string - path string - code int - pattern string -}{ - {"GET", "google.com", "/", 404, ""}, - {"GET", "google.com", "/dir", 301, "/dir/"}, - {"GET", "google.com", "/dir/", 200, "/dir/"}, - {"GET", "google.com", "/dir/file", 200, "/dir/"}, - {"GET", "google.com", "/search", 201, "/search"}, - {"GET", "google.com", "/search/", 404, ""}, - {"GET", "google.com", "/search/foo", 404, ""}, - {"GET", "codesearch.google.com", "/search", 202, "codesearch.google.com/search"}, - {"GET", "codesearch.google.com", "/search/", 203, "codesearch.google.com/"}, - {"GET", "codesearch.google.com", "/search/foo", 203, "codesearch.google.com/"}, - {"GET", "codesearch.google.com", "/", 203, "codesearch.google.com/"}, - {"GET", "images.google.com", "/search", 201, "/search"}, - {"GET", "images.google.com", "/search/", 404, ""}, - {"GET", "images.google.com", "/search/foo", 404, ""}, - {"GET", "google.com", "/../search", 301, "/search"}, - {"GET", "google.com", "/dir/..", 301, ""}, - {"GET", "google.com", "/dir/..", 301, ""}, - {"GET", "google.com", "/dir/./file", 301, "/dir/"}, - - // The /foo -> /foo/ redirect applies to CONNECT requests - // but the path canonicalization does not. - {"CONNECT", "google.com", "/dir", 301, "/dir/"}, - {"CONNECT", "google.com", "/../search", 404, ""}, - {"CONNECT", "google.com", "/dir/..", 200, "/dir/"}, - {"CONNECT", "google.com", "/dir/..", 200, "/dir/"}, - {"CONNECT", "google.com", "/dir/./file", 200, "/dir/"}, -} - -func TestServeMuxHandler(t *testing.T) { - mux := NewServeMux() - for _, e := range serveMuxRegister { - mux.Handle(e.pattern, e.h) - } - - for _, tt := range serveMuxTests { - r := &Request{ - Method: tt.method, - Host: tt.host, - URL: &url.URL{ - Path: tt.path, - }, - } - h, pattern := mux.Handler(r) - rr := httptest.NewRecorder() - h.ServeHTTP(rr, r) - if pattern != tt.pattern || rr.Code != tt.code { - t.Errorf("%s %s %s = %d, %q, want %d, %q", tt.method, tt.host, tt.path, rr.Code, pattern, tt.code, tt.pattern) - } - } -} - -var serveMuxTests2 = []struct { - method string - host string - url string - code int - redirOk bool -}{ - {"GET", "google.com", "/", 404, false}, - {"GET", "example.com", "/test/?example.com/test/", 200, false}, - {"GET", "example.com", "test/?example.com/test/", 200, true}, -} - -// TestServeMuxHandlerRedirects tests that automatic redirects generated by -// mux.Handler() shouldn't clear the request's query string. -func TestServeMuxHandlerRedirects(t *testing.T) { - mux := NewServeMux() - for _, e := range serveMuxRegister { - mux.Handle(e.pattern, e.h) - } - - for _, tt := range serveMuxTests2 { - tries := 1 - turl := tt.url - for tries > 0 { - u, e := url.Parse(turl) - if e != nil { - t.Fatal(e) - } - r := &Request{ - Method: tt.method, - Host: tt.host, - URL: u, - } - h, _ := mux.Handler(r) - rr := httptest.NewRecorder() - h.ServeHTTP(rr, r) - if rr.Code != 301 { - if rr.Code != tt.code { - t.Errorf("%s %s %s = %d, want %d", tt.method, tt.host, tt.url, rr.Code, tt.code) - } - break - } - if !tt.redirOk { - t.Errorf("%s %s %s, unexpected redirect", tt.method, tt.host, tt.url) - break - } - turl = rr.HeaderMap.Get("Location") - tries-- - } - if tries < 0 { - t.Errorf("%s %s %s, too many redirects", tt.method, tt.host, tt.url) - } - } -} - -// Tests for http://code.google.com/p/go/issues/detail?id=900 -func TestMuxRedirectLeadingSlashes(t *testing.T) { - paths := []string{"//foo.txt", "///foo.txt", "/../../foo.txt"} - for _, path := range paths { - req, err := ReadRequest(bufio.NewReader(strings.NewReader("GET " + path + " HTTP/1.1\r\nHost: test\r\n\r\n"))) - if err != nil { - t.Errorf("%s", err) - } - mux := NewServeMux() - resp := httptest.NewRecorder() - - mux.ServeHTTP(resp, req) - - if loc, expected := resp.Header().Get("Location"), "/foo.txt"; loc != expected { - t.Errorf("Expected Location header set to %q; got %q", expected, loc) - return - } - - if code, expected := resp.Code, StatusMovedPermanently; code != expected { - t.Errorf("Expected response code of StatusMovedPermanently; got %d", code) - return - } - } -} - -func TestServerTimeouts(t *testing.T) { - if runtime.GOOS == "plan9" { - t.Skip("skipping test; see http://golang.org/issue/7237") - } - defer afterTest(t) - reqNum := 0 - ts := httptest.NewUnstartedServer(HandlerFunc(func(res ResponseWriter, req *Request) { - reqNum++ - fmt.Fprintf(res, "req=%d", reqNum) - })) - ts.Config.ReadTimeout = 250 * time.Millisecond - ts.Config.WriteTimeout = 250 * time.Millisecond - ts.Start() - defer ts.Close() - - // Hit the HTTP server successfully. - tr := &Transport{DisableKeepAlives: true} // they interfere with this test - defer tr.CloseIdleConnections() - c := &Client{Transport: tr} - r, err := c.Get(ts.URL) - if err != nil { - t.Fatalf("http Get #1: %v", err) - } - got, _ := ioutil.ReadAll(r.Body) - expected := "req=1" - if string(got) != expected { - t.Errorf("Unexpected response for request #1; got %q; expected %q", - string(got), expected) - } - - // Slow client that should timeout. - t1 := time.Now() - conn, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatalf("Dial: %v", err) - } - buf := make([]byte, 1) - n, err := conn.Read(buf) - latency := time.Since(t1) - if n != 0 || err != io.EOF { - t.Errorf("Read = %v, %v, wanted %v, %v", n, err, 0, io.EOF) - } - if latency < 200*time.Millisecond /* fudge from 250 ms above */ { - t.Errorf("got EOF after %s, want >= %s", latency, 200*time.Millisecond) - } - - // Hit the HTTP server successfully again, verifying that the - // previous slow connection didn't run our handler. (that we - // get "req=2", not "req=3") - r, err = Get(ts.URL) - if err != nil { - t.Fatalf("http Get #2: %v", err) - } - got, _ = ioutil.ReadAll(r.Body) - expected = "req=2" - if string(got) != expected { - t.Errorf("Get #2 got %q, want %q", string(got), expected) - } - - if !testing.Short() { - conn, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatalf("Dial: %v", err) - } - defer conn.Close() - go io.Copy(ioutil.Discard, conn) - for i := 0; i < 5; i++ { - _, err := conn.Write([]byte("GET / HTTP/1.1\r\nHost: foo\r\n\r\n")) - if err != nil { - t.Fatalf("on write %d: %v", i, err) - } - time.Sleep(ts.Config.ReadTimeout / 2) - } - } -} - -// golang.org/issue/4741 -- setting only a write timeout that triggers -// shouldn't cause a handler to block forever on reads (next HTTP -// request) that will never happen. -func TestOnlyWriteTimeout(t *testing.T) { - if runtime.GOOS == "plan9" { - t.Skip("skipping test; see http://golang.org/issue/7237") - } - defer afterTest(t) - var conn net.Conn - var afterTimeoutErrc = make(chan error, 1) - ts := httptest.NewUnstartedServer(HandlerFunc(func(w ResponseWriter, req *Request) { - buf := make([]byte, 512<<10) - _, err := w.Write(buf) - if err != nil { - t.Errorf("handler Write error: %v", err) - return - } - conn.SetWriteDeadline(time.Now().Add(-30 * time.Second)) - _, err = w.Write(buf) - afterTimeoutErrc <- err - })) - ts.Listener = trackLastConnListener{ts.Listener, &conn} - ts.Start() - defer ts.Close() - - tr := &Transport{DisableKeepAlives: false} - defer tr.CloseIdleConnections() - c := &Client{Transport: tr} - - errc := make(chan error) - go func() { - res, err := c.Get(ts.URL) - if err != nil { - errc <- err - return - } - _, err = io.Copy(ioutil.Discard, res.Body) - errc <- err - }() - select { - case err := <-errc: - if err == nil { - t.Errorf("expected an error from Get request") - } - case <-time.After(5 * time.Second): - t.Fatal("timeout waiting for Get error") - } - if err := <-afterTimeoutErrc; err == nil { - t.Error("expected write error after timeout") - } -} - -// trackLastConnListener tracks the last net.Conn that was accepted. -type trackLastConnListener struct { - net.Listener - last *net.Conn // destination -} - -func (l trackLastConnListener) Accept() (c net.Conn, err error) { - c, err = l.Listener.Accept() - *l.last = c - return -} - -// TestIdentityResponse verifies that a handler can unset -func TestIdentityResponse(t *testing.T) { - defer afterTest(t) - handler := HandlerFunc(func(rw ResponseWriter, req *Request) { - rw.Header().Set("Content-Length", "3") - rw.Header().Set("Transfer-Encoding", req.FormValue("te")) - switch { - case req.FormValue("overwrite") == "1": - _, err := rw.Write([]byte("foo TOO LONG")) - if err != ErrContentLength { - t.Errorf("expected ErrContentLength; got %v", err) - } - case req.FormValue("underwrite") == "1": - rw.Header().Set("Content-Length", "500") - rw.Write([]byte("too short")) - default: - rw.Write([]byte("foo")) - } - }) - - ts := httptest.NewServer(handler) - defer ts.Close() - - // Note: this relies on the assumption (which is true) that - // Get sends HTTP/1.1 or greater requests. Otherwise the - // server wouldn't have the choice to send back chunked - // responses. - for _, te := range []string{"", "identity"} { - url := ts.URL + "/?te=" + te - res, err := Get(url) - if err != nil { - t.Fatalf("error with Get of %s: %v", url, err) - } - if cl, expected := res.ContentLength, int64(3); cl != expected { - t.Errorf("for %s expected res.ContentLength of %d; got %d", url, expected, cl) - } - if cl, expected := res.Header.Get("Content-Length"), "3"; cl != expected { - t.Errorf("for %s expected Content-Length header of %q; got %q", url, expected, cl) - } - if tl, expected := len(res.TransferEncoding), 0; tl != expected { - t.Errorf("for %s expected len(res.TransferEncoding) of %d; got %d (%v)", - url, expected, tl, res.TransferEncoding) - } - res.Body.Close() - } - - // Verify that ErrContentLength is returned - url := ts.URL + "/?overwrite=1" - res, err := Get(url) - if err != nil { - t.Fatalf("error with Get of %s: %v", url, err) - } - res.Body.Close() - - // Verify that the connection is closed when the declared Content-Length - // is larger than what the handler wrote. - conn, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatalf("error dialing: %v", err) - } - _, err = conn.Write([]byte("GET /?underwrite=1 HTTP/1.1\r\nHost: foo\r\n\r\n")) - if err != nil { - t.Fatalf("error writing: %v", err) - } - - // The ReadAll will hang for a failing test, so use a Timer to - // fail explicitly. - goTimeout(t, 2*time.Second, func() { - got, _ := ioutil.ReadAll(conn) - expectedSuffix := "\r\n\r\ntoo short" - if !strings.HasSuffix(string(got), expectedSuffix) { - t.Errorf("Expected output to end with %q; got response body %q", - expectedSuffix, string(got)) - } - }) -} - -func testTCPConnectionCloses(t *testing.T, req string, h Handler) { - defer afterTest(t) - s := httptest.NewServer(h) - defer s.Close() - - conn, err := net.Dial("tcp", s.Listener.Addr().String()) - if err != nil { - t.Fatal("dial error:", err) - } - defer conn.Close() - - _, err = fmt.Fprint(conn, req) - if err != nil { - t.Fatal("print error:", err) - } - - r := bufio.NewReader(conn) - res, err := ReadResponse(r, &Request{Method: "GET"}) - if err != nil { - t.Fatal("ReadResponse error:", err) - } - - didReadAll := make(chan bool, 1) - go func() { - select { - case <-time.After(5 * time.Second): - t.Error("body not closed after 5s") - return - case <-didReadAll: - } - }() - - _, err = ioutil.ReadAll(r) - if err != nil { - t.Fatal("read error:", err) - } - didReadAll <- true - - if !res.Close { - t.Errorf("Response.Close = false; want true") - } -} - -// TestServeHTTP10Close verifies that HTTP/1.0 requests won't be kept alive. -func TestServeHTTP10Close(t *testing.T) { - testTCPConnectionCloses(t, "GET / HTTP/1.0\r\n\r\n", HandlerFunc(func(w ResponseWriter, r *Request) { - ServeFile(w, r, "testdata/file") - })) -} - -// TestClientCanClose verifies that clients can also force a connection to close. -func TestClientCanClose(t *testing.T) { - testTCPConnectionCloses(t, "GET / HTTP/1.1\r\nConnection: close\r\n\r\n", HandlerFunc(func(w ResponseWriter, r *Request) { - // Nothing. - })) -} - -// TestHandlersCanSetConnectionClose verifies that handlers can force a connection to close, -// even for HTTP/1.1 requests. -func TestHandlersCanSetConnectionClose11(t *testing.T) { - testTCPConnectionCloses(t, "GET / HTTP/1.1\r\n\r\n", HandlerFunc(func(w ResponseWriter, r *Request) { - w.Header().Set("Connection", "close") - })) -} - -func TestHandlersCanSetConnectionClose10(t *testing.T) { - testTCPConnectionCloses(t, "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n", HandlerFunc(func(w ResponseWriter, r *Request) { - w.Header().Set("Connection", "close") - })) -} - -func TestSetsRemoteAddr(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - fmt.Fprintf(w, "%s", r.RemoteAddr) - })) - defer ts.Close() - - res, err := Get(ts.URL) - if err != nil { - t.Fatalf("Get error: %v", err) - } - body, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatalf("ReadAll error: %v", err) - } - ip := string(body) - if !strings.HasPrefix(ip, "127.0.0.1:") && !strings.HasPrefix(ip, "[::1]:") { - t.Fatalf("Expected local addr; got %q", ip) - } -} - -func TestChunkedResponseHeaders(t *testing.T) { - defer afterTest(t) - log.SetOutput(ioutil.Discard) // is noisy otherwise - defer log.SetOutput(os.Stderr) - - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - w.Header().Set("Content-Length", "intentional gibberish") // we check that this is deleted - w.(Flusher).Flush() - fmt.Fprintf(w, "I am a chunked response.") - })) - defer ts.Close() - - res, err := Get(ts.URL) - if err != nil { - t.Fatalf("Get error: %v", err) - } - defer res.Body.Close() - if g, e := res.ContentLength, int64(-1); g != e { - t.Errorf("expected ContentLength of %d; got %d", e, g) - } - if g, e := res.TransferEncoding, []string{"chunked"}; !reflect.DeepEqual(g, e) { - t.Errorf("expected TransferEncoding of %v; got %v", e, g) - } - if _, haveCL := res.Header["Content-Length"]; haveCL { - t.Errorf("Unexpected Content-Length") - } -} - -// Test304Responses verifies that 304s don't declare that they're -// chunking in their response headers and aren't allowed to produce -// output. -func Test304Responses(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - w.WriteHeader(StatusNotModified) - _, err := w.Write([]byte("illegal body")) - if err != ErrBodyNotAllowed { - t.Errorf("on Write, expected ErrBodyNotAllowed, got %v", err) - } - })) - defer ts.Close() - res, err := Get(ts.URL) - if err != nil { - t.Error(err) - } - if len(res.TransferEncoding) > 0 { - t.Errorf("expected no TransferEncoding; got %v", res.TransferEncoding) - } - body, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Error(err) - } - if len(body) > 0 { - t.Errorf("got unexpected body %q", string(body)) - } -} - -// TestHeadResponses verifies that all MIME type sniffing and Content-Length -// counting of GET requests also happens on HEAD requests. -func TestHeadResponses(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - _, err := w.Write([]byte("")) - if err != nil { - t.Errorf("ResponseWriter.Write: %v", err) - } - - // Also exercise the ReaderFrom path - _, err = io.Copy(w, strings.NewReader("789a")) - if err != nil { - t.Errorf("Copy(ResponseWriter, ...): %v", err) - } - })) - defer ts.Close() - res, err := Head(ts.URL) - if err != nil { - t.Error(err) - } - if len(res.TransferEncoding) > 0 { - t.Errorf("expected no TransferEncoding; got %v", res.TransferEncoding) - } - if ct := res.Header.Get("Content-Type"); ct != "text/html; charset=utf-8" { - t.Errorf("Content-Type: %q; want text/html; charset=utf-8", ct) - } - if v := res.ContentLength; v != 10 { - t.Errorf("Content-Length: %d; want 10", v) - } - body, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Error(err) - } - if len(body) > 0 { - t.Errorf("got unexpected body %q", string(body)) - } -} - -func TestTLSHandshakeTimeout(t *testing.T) { - if runtime.GOOS == "plan9" { - t.Skip("skipping test; see http://golang.org/issue/7237") - } - defer afterTest(t) - ts := httptest.NewUnstartedServer(HandlerFunc(func(w ResponseWriter, r *Request) {})) - errc := make(chanWriter, 10) // but only expecting 1 - ts.Config.ReadTimeout = 250 * time.Millisecond - ts.Config.ErrorLog = log.New(errc, "", 0) - ts.StartTLS() - defer ts.Close() - conn, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatalf("Dial: %v", err) - } - defer conn.Close() - goTimeout(t, 10*time.Second, func() { - var buf [1]byte - n, err := conn.Read(buf[:]) - if err == nil || n != 0 { - t.Errorf("Read = %d, %v; want an error and no bytes", n, err) - } - }) - select { - case v := <-errc: - if !strings.Contains(v, "timeout") && !strings.Contains(v, "TLS handshake") { - t.Errorf("expected a TLS handshake timeout error; got %q", v) - } - case <-time.After(5 * time.Second): - t.Errorf("timeout waiting for logged error") - } -} - -func TestTLSServer(t *testing.T) { - defer afterTest(t) - ts := httptest.NewTLSServer(HandlerFunc(func(w ResponseWriter, r *Request) { - if r.TLS != nil { - w.Header().Set("X-TLS-Set", "true") - if r.TLS.HandshakeComplete { - w.Header().Set("X-TLS-HandshakeComplete", "true") - } - } - })) - ts.Config.ErrorLog = log.New(ioutil.Discard, "", 0) - defer ts.Close() - - // Connect an idle TCP connection to this server before we run - // our real tests. This idle connection used to block forever - // in the TLS handshake, preventing future connections from - // being accepted. It may prevent future accidental blocking - // in newConn. - idleConn, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatalf("Dial: %v", err) - } - defer idleConn.Close() - goTimeout(t, 10*time.Second, func() { - if !strings.HasPrefix(ts.URL, "https://") { - t.Errorf("expected test TLS server to start with https://, got %q", ts.URL) - return - } - noVerifyTransport := &Transport{ - TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true, - }, - } - client := &Client{Transport: noVerifyTransport} - res, err := client.Get(ts.URL) - if err != nil { - t.Error(err) - return - } - if res == nil { - t.Errorf("got nil Response") - return - } - defer res.Body.Close() - if res.Header.Get("X-TLS-Set") != "true" { - t.Errorf("expected X-TLS-Set response header") - return - } - if res.Header.Get("X-TLS-HandshakeComplete") != "true" { - t.Errorf("expected X-TLS-HandshakeComplete header") - } - }) -} - -type serverExpectTest struct { - contentLength int // of request body - chunked bool - expectation string // e.g. "100-continue" - readBody bool // whether handler should read the body (if false, sends StatusUnauthorized) - expectedResponse string // expected substring in first line of http response -} - -func expectTest(contentLength int, expectation string, readBody bool, expectedResponse string) serverExpectTest { - return serverExpectTest{ - contentLength: contentLength, - expectation: expectation, - readBody: readBody, - expectedResponse: expectedResponse, - } -} - -var serverExpectTests = []serverExpectTest{ - // Normal 100-continues, case-insensitive. - expectTest(100, "100-continue", true, "100 Continue"), - expectTest(100, "100-cOntInUE", true, "100 Continue"), - - // No 100-continue. - expectTest(100, "", true, "200 OK"), - - // 100-continue but requesting client to deny us, - // so it never reads the body. - expectTest(100, "100-continue", false, "401 Unauthorized"), - // Likewise without 100-continue: - expectTest(100, "", false, "401 Unauthorized"), - - // Non-standard expectations are failures - expectTest(0, "a-pony", false, "417 Expectation Failed"), - - // Expect-100 requested but no body (is apparently okay: Issue 7625) - expectTest(0, "100-continue", true, "200 OK"), - // Expect-100 requested but handler doesn't read the body - expectTest(0, "100-continue", false, "401 Unauthorized"), - // Expect-100 continue with no body, but a chunked body. - { - expectation: "100-continue", - readBody: true, - chunked: true, - expectedResponse: "100 Continue", - }, -} - -// Tests that the server responds to the "Expect" request header -// correctly. -func TestServerExpect(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - // Note using r.FormValue("readbody") because for POST - // requests that would read from r.Body, which we only - // conditionally want to do. - if strings.Contains(r.URL.RawQuery, "readbody=true") { - ioutil.ReadAll(r.Body) - w.Write([]byte("Hi")) - } else { - w.WriteHeader(StatusUnauthorized) - } - })) - defer ts.Close() - - runTest := func(test serverExpectTest) { - conn, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatalf("Dial: %v", err) - } - defer conn.Close() - - // Only send the body immediately if we're acting like an HTTP client - // that doesn't send 100-continue expectations. - writeBody := test.contentLength != 0 && strings.ToLower(test.expectation) != "100-continue" - - go func() { - contentLen := fmt.Sprintf("Content-Length: %d", test.contentLength) - if test.chunked { - contentLen = "Transfer-Encoding: chunked" - } - _, err := fmt.Fprintf(conn, "POST /?readbody=%v HTTP/1.1\r\n"+ - "Connection: close\r\n"+ - "%s\r\n"+ - "Expect: %s\r\nHost: foo\r\n\r\n", - test.readBody, contentLen, test.expectation) - if err != nil { - t.Errorf("On test %#v, error writing request headers: %v", test, err) - return - } - if writeBody { - var targ io.WriteCloser = struct { - io.Writer - io.Closer - }{ - conn, - ioutil.NopCloser(nil), - } - if test.chunked { - targ = httputil.NewChunkedWriter(conn) - } - body := strings.Repeat("A", test.contentLength) - _, err = fmt.Fprint(targ, body) - if err == nil { - err = targ.Close() - } - if err != nil { - if !test.readBody { - // Server likely already hung up on us. - // See larger comment below. - t.Logf("On test %#v, acceptable error writing request body: %v", test, err) - return - } - t.Errorf("On test %#v, error writing request body: %v", test, err) - } - } - }() - bufr := bufio.NewReader(conn) - line, err := bufr.ReadString('\n') - if err != nil { - if writeBody && !test.readBody { - // This is an acceptable failure due to a possible TCP race: - // We were still writing data and the server hung up on us. A TCP - // implementation may send a RST if our request body data was known - // to be lost, which may trigger our reads to fail. - // See RFC 1122 page 88. - t.Logf("On test %#v, acceptable error from ReadString: %v", test, err) - return - } - t.Fatalf("On test %#v, ReadString: %v", test, err) - } - if !strings.Contains(line, test.expectedResponse) { - t.Errorf("On test %#v, got first line = %q; want %q", test, line, test.expectedResponse) - } - } - - for _, test := range serverExpectTests { - runTest(test) - } -} - -// Under a ~256KB (maxPostHandlerReadBytes) threshold, the server -// should consume client request bodies that a handler didn't read. -func TestServerUnreadRequestBodyLittle(t *testing.T) { - conn := new(testConn) - body := strings.Repeat("x", 100<<10) - conn.readBuf.Write([]byte(fmt.Sprintf( - "POST / HTTP/1.1\r\n"+ - "Host: test\r\n"+ - "Content-Length: %d\r\n"+ - "\r\n", len(body)))) - conn.readBuf.Write([]byte(body)) - - done := make(chan bool) - - ls := &oneConnListener{conn} - go Serve(ls, HandlerFunc(func(rw ResponseWriter, req *Request) { - defer close(done) - if conn.readBuf.Len() < len(body)/2 { - t.Errorf("on request, read buffer length is %d; expected about 100 KB", conn.readBuf.Len()) - } - rw.WriteHeader(200) - rw.(Flusher).Flush() - if g, e := conn.readBuf.Len(), 0; g != e { - t.Errorf("after WriteHeader, read buffer length is %d; want %d", g, e) - } - if c := rw.Header().Get("Connection"); c != "" { - t.Errorf(`Connection header = %q; want ""`, c) - } - })) - <-done -} - -// Over a ~256KB (maxPostHandlerReadBytes) threshold, the server -// should ignore client request bodies that a handler didn't read -// and close the connection. -func TestServerUnreadRequestBodyLarge(t *testing.T) { - conn := new(testConn) - body := strings.Repeat("x", 1<<20) - conn.readBuf.Write([]byte(fmt.Sprintf( - "POST / HTTP/1.1\r\n"+ - "Host: test\r\n"+ - "Content-Length: %d\r\n"+ - "\r\n", len(body)))) - conn.readBuf.Write([]byte(body)) - conn.closec = make(chan bool, 1) - - ls := &oneConnListener{conn} - go Serve(ls, HandlerFunc(func(rw ResponseWriter, req *Request) { - if conn.readBuf.Len() < len(body)/2 { - t.Errorf("on request, read buffer length is %d; expected about 1MB", conn.readBuf.Len()) - } - rw.WriteHeader(200) - rw.(Flusher).Flush() - if conn.readBuf.Len() < len(body)/2 { - t.Errorf("post-WriteHeader, read buffer length is %d; expected about 1MB", conn.readBuf.Len()) - } - })) - <-conn.closec - - if res := conn.writeBuf.String(); !strings.Contains(res, "Connection: close") { - t.Errorf("Expected a Connection: close header; got response: %s", res) - } -} - -func TestTimeoutHandler(t *testing.T) { - defer afterTest(t) - sendHi := make(chan bool, 1) - writeErrors := make(chan error, 1) - sayHi := HandlerFunc(func(w ResponseWriter, r *Request) { - <-sendHi - _, werr := w.Write([]byte("hi")) - writeErrors <- werr - }) - timeout := make(chan time.Time, 1) // write to this to force timeouts - ts := httptest.NewServer(NewTestTimeoutHandler(sayHi, timeout)) - defer ts.Close() - - // Succeed without timing out: - sendHi <- true - res, err := Get(ts.URL) - if err != nil { - t.Error(err) - } - if g, e := res.StatusCode, StatusOK; g != e { - t.Errorf("got res.StatusCode %d; expected %d", g, e) - } - body, _ := ioutil.ReadAll(res.Body) - if g, e := string(body), "hi"; g != e { - t.Errorf("got body %q; expected %q", g, e) - } - if g := <-writeErrors; g != nil { - t.Errorf("got unexpected Write error on first request: %v", g) - } - - // Times out: - timeout <- time.Time{} - res, err = Get(ts.URL) - if err != nil { - t.Error(err) - } - if g, e := res.StatusCode, StatusServiceUnavailable; g != e { - t.Errorf("got res.StatusCode %d; expected %d", g, e) - } - body, _ = ioutil.ReadAll(res.Body) - if !strings.Contains(string(body), "Timeout") { - t.Errorf("expected timeout body; got %q", string(body)) - } - - // Now make the previously-timed out handler speak again, - // which verifies the panic is handled: - sendHi <- true - if g, e := <-writeErrors, ErrHandlerTimeout; g != e { - t.Errorf("expected Write error of %v; got %v", e, g) - } -} - -// Verifies we don't path.Clean() on the wrong parts in redirects. -func TestRedirectMunging(t *testing.T) { - req, _ := NewRequest("GET", "http://example.com/", nil) - - resp := httptest.NewRecorder() - Redirect(resp, req, "/foo?next=http://bar.com/", 302) - if g, e := resp.Header().Get("Location"), "/foo?next=http://bar.com/"; g != e { - t.Errorf("Location header was %q; want %q", g, e) - } - - resp = httptest.NewRecorder() - Redirect(resp, req, "http://localhost:8080/_ah/login?continue=http://localhost:8080/", 302) - if g, e := resp.Header().Get("Location"), "http://localhost:8080/_ah/login?continue=http://localhost:8080/"; g != e { - t.Errorf("Location header was %q; want %q", g, e) - } -} - -func TestRedirectBadPath(t *testing.T) { - // This used to crash. It's not valid input (bad path), but it - // shouldn't crash. - rr := httptest.NewRecorder() - req := &Request{ - Method: "GET", - URL: &url.URL{ - Scheme: "http", - Path: "not-empty-but-no-leading-slash", // bogus - }, - } - Redirect(rr, req, "", 304) - if rr.Code != 304 { - t.Errorf("Code = %d; want 304", rr.Code) - } -} - -// TestZeroLengthPostAndResponse exercises an optimization done by the Transport: -// when there is no body (either because the method doesn't permit a body, or an -// explicit Content-Length of zero is present), then the transport can re-use the -// connection immediately. But when it re-uses the connection, it typically closes -// the previous request's body, which is not optimal for zero-lengthed bodies, -// as the client would then see http.ErrBodyReadAfterClose and not 0, io.EOF. -func TestZeroLengthPostAndResponse(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(rw ResponseWriter, r *Request) { - all, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("handler ReadAll: %v", err) - } - if len(all) != 0 { - t.Errorf("handler got %d bytes; expected 0", len(all)) - } - rw.Header().Set("Content-Length", "0") - })) - defer ts.Close() - - req, err := NewRequest("POST", ts.URL, strings.NewReader("")) - if err != nil { - t.Fatal(err) - } - req.ContentLength = 0 - - var resp [5]*Response - for i := range resp { - resp[i], err = DefaultClient.Do(req) - if err != nil { - t.Fatalf("client post #%d: %v", i, err) - } - } - - for i := range resp { - all, err := ioutil.ReadAll(resp[i].Body) - if err != nil { - t.Fatalf("req #%d: client ReadAll: %v", i, err) - } - if len(all) != 0 { - t.Errorf("req #%d: client got %d bytes; expected 0", i, len(all)) - } - } -} - -func TestHandlerPanicNil(t *testing.T) { - testHandlerPanic(t, false, nil) -} - -func TestHandlerPanic(t *testing.T) { - testHandlerPanic(t, false, "intentional death for testing") -} - -func TestHandlerPanicWithHijack(t *testing.T) { - testHandlerPanic(t, true, "intentional death for testing") -} - -func testHandlerPanic(t *testing.T, withHijack bool, panicValue interface{}) { - defer afterTest(t) - // Unlike the other tests that set the log output to ioutil.Discard - // to quiet the output, this test uses a pipe. The pipe serves three - // purposes: - // - // 1) The log.Print from the http server (generated by the caught - // panic) will go to the pipe instead of stderr, making the - // output quiet. - // - // 2) We read from the pipe to verify that the handler - // actually caught the panic and logged something. - // - // 3) The blocking Read call prevents this TestHandlerPanic - // function from exiting before the HTTP server handler - // finishes crashing. If this text function exited too - // early (and its defer log.SetOutput(os.Stderr) ran), - // then the crash output could spill into the next test. - pr, pw := io.Pipe() - log.SetOutput(pw) - defer log.SetOutput(os.Stderr) - defer pw.Close() - - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - if withHijack { - rwc, _, err := w.(Hijacker).Hijack() - if err != nil { - t.Logf("unexpected error: %v", err) - } - defer rwc.Close() - } - panic(panicValue) - })) - defer ts.Close() - - // Do a blocking read on the log output pipe so its logging - // doesn't bleed into the next test. But wait only 5 seconds - // for it. - done := make(chan bool, 1) - go func() { - buf := make([]byte, 4<<10) - _, err := pr.Read(buf) - pr.Close() - if err != nil && err != io.EOF { - t.Error(err) - } - done <- true - }() - - _, err := Get(ts.URL) - if err == nil { - t.Logf("expected an error") - } - - if panicValue == nil { - return - } - - select { - case <-done: - return - case <-time.After(5 * time.Second): - t.Fatal("expected server handler to log an error") - } -} - -func TestNoDate(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - w.Header()["Date"] = nil - })) - defer ts.Close() - res, err := Get(ts.URL) - if err != nil { - t.Fatal(err) - } - _, present := res.Header["Date"] - if present { - t.Fatalf("Expected no Date header; got %v", res.Header["Date"]) - } -} - -func TestStripPrefix(t *testing.T) { - defer afterTest(t) - h := HandlerFunc(func(w ResponseWriter, r *Request) { - w.Header().Set("X-Path", r.URL.Path) - }) - ts := httptest.NewServer(StripPrefix("/foo", h)) - defer ts.Close() - - res, err := Get(ts.URL + "/foo/bar") - if err != nil { - t.Fatal(err) - } - if g, e := res.Header.Get("X-Path"), "/bar"; g != e { - t.Errorf("test 1: got %s, want %s", g, e) - } - res.Body.Close() - - res, err = Get(ts.URL + "/bar") - if err != nil { - t.Fatal(err) - } - if g, e := res.StatusCode, 404; g != e { - t.Errorf("test 2: got status %v, want %v", g, e) - } - res.Body.Close() -} - -func TestRequestLimit(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - t.Fatalf("didn't expect to get request in Handler") - })) - defer ts.Close() - req, _ := NewRequest("GET", ts.URL, nil) - var bytesPerHeader = len("header12345: val12345\r\n") - for i := 0; i < ((DefaultMaxHeaderBytes+4096)/bytesPerHeader)+1; i++ { - req.Header.Set(fmt.Sprintf("header%05d", i), fmt.Sprintf("val%05d", i)) - } - res, err := DefaultClient.Do(req) - if err != nil { - // Some HTTP clients may fail on this undefined behavior (server replying and - // closing the connection while the request is still being written), but - // we do support it (at least currently), so we expect a response below. - t.Fatalf("Do: %v", err) - } - defer res.Body.Close() - if res.StatusCode != 413 { - t.Fatalf("expected 413 response status; got: %d %s", res.StatusCode, res.Status) - } -} - -type neverEnding byte - -func (b neverEnding) Read(p []byte) (n int, err error) { - for i := range p { - p[i] = byte(b) - } - return len(p), nil -} - -type countReader struct { - r io.Reader - n *int64 -} - -func (cr countReader) Read(p []byte) (n int, err error) { - n, err = cr.r.Read(p) - atomic.AddInt64(cr.n, int64(n)) - return -} - -func TestRequestBodyLimit(t *testing.T) { - defer afterTest(t) - const limit = 1 << 20 - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - r.Body = MaxBytesReader(w, r.Body, limit) - n, err := io.Copy(ioutil.Discard, r.Body) - if err == nil { - t.Errorf("expected error from io.Copy") - } - if n != limit { - t.Errorf("io.Copy = %d, want %d", n, limit) - } - })) - defer ts.Close() - - nWritten := new(int64) - req, _ := NewRequest("POST", ts.URL, io.LimitReader(countReader{neverEnding('a'), nWritten}, limit*200)) - - // Send the POST, but don't care it succeeds or not. The - // remote side is going to reply and then close the TCP - // connection, and HTTP doesn't really define if that's - // allowed or not. Some HTTP clients will get the response - // and some (like ours, currently) will complain that the - // request write failed, without reading the response. - // - // But that's okay, since what we're really testing is that - // the remote side hung up on us before we wrote too much. - _, _ = DefaultClient.Do(req) - - if atomic.LoadInt64(nWritten) > limit*100 { - t.Errorf("handler restricted the request body to %d bytes, but client managed to write %d", - limit, nWritten) - } -} - -// TestClientWriteShutdown tests that if the client shuts down the write -// side of their TCP connection, the server doesn't send a 400 Bad Request. -func TestClientWriteShutdown(t *testing.T) { - if runtime.GOOS == "plan9" { - t.Skip("skipping test; see http://golang.org/issue/7237") - } - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) {})) - defer ts.Close() - conn, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatalf("Dial: %v", err) - } - err = conn.(*net.TCPConn).CloseWrite() - if err != nil { - t.Fatalf("Dial: %v", err) - } - donec := make(chan bool) - go func() { - defer close(donec) - bs, err := ioutil.ReadAll(conn) - if err != nil { - t.Fatalf("ReadAll: %v", err) - } - got := string(bs) - if got != "" { - t.Errorf("read %q from server; want nothing", got) - } - }() - select { - case <-donec: - case <-time.After(10 * time.Second): - t.Fatalf("timeout") - } -} - -// Tests that chunked server responses that write 1 byte at a time are -// buffered before chunk headers are added, not after chunk headers. -func TestServerBufferedChunking(t *testing.T) { - conn := new(testConn) - conn.readBuf.Write([]byte("GET / HTTP/1.1\r\n\r\n")) - conn.closec = make(chan bool, 1) - ls := &oneConnListener{conn} - go Serve(ls, HandlerFunc(func(rw ResponseWriter, req *Request) { - rw.(Flusher).Flush() // force the Header to be sent, in chunking mode, not counting the length - rw.Write([]byte{'x'}) - rw.Write([]byte{'y'}) - rw.Write([]byte{'z'}) - })) - <-conn.closec - if !bytes.HasSuffix(conn.writeBuf.Bytes(), []byte("\r\n\r\n3\r\nxyz\r\n0\r\n\r\n")) { - t.Errorf("response didn't end with a single 3 byte 'xyz' chunk; got:\n%q", - conn.writeBuf.Bytes()) - } -} - -// Tests that the server flushes its response headers out when it's -// ignoring the response body and waits a bit before forcefully -// closing the TCP connection, causing the client to get a RST. -// See http://golang.org/issue/3595 -func TestServerGracefulClose(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - Error(w, "bye", StatusUnauthorized) - })) - defer ts.Close() - - conn, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatal(err) - } - defer conn.Close() - const bodySize = 5 << 20 - req := []byte(fmt.Sprintf("POST / HTTP/1.1\r\nHost: foo.com\r\nContent-Length: %d\r\n\r\n", bodySize)) - for i := 0; i < bodySize; i++ { - req = append(req, 'x') - } - writeErr := make(chan error) - go func() { - _, err := conn.Write(req) - writeErr <- err - }() - br := bufio.NewReader(conn) - lineNum := 0 - for { - line, err := br.ReadString('\n') - if err == io.EOF { - break - } - if err != nil { - t.Fatalf("ReadLine: %v", err) - } - lineNum++ - if lineNum == 1 && !strings.Contains(line, "401 Unauthorized") { - t.Errorf("Response line = %q; want a 401", line) - } - } - // Wait for write to finish. This is a broken pipe on both - // Darwin and Linux, but checking this isn't the point of - // the test. - <-writeErr -} - -func TestCaseSensitiveMethod(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - if r.Method != "get" { - t.Errorf(`Got method %q; want "get"`, r.Method) - } - })) - defer ts.Close() - req, _ := NewRequest("get", ts.URL, nil) - res, err := DefaultClient.Do(req) - if err != nil { - t.Error(err) - return - } - res.Body.Close() -} - -// TestContentLengthZero tests that for both an HTTP/1.0 and HTTP/1.1 -// request (both keep-alive), when a Handler never writes any -// response, the net/http package adds a "Content-Length: 0" response -// header. -func TestContentLengthZero(t *testing.T) { - ts := httptest.NewServer(HandlerFunc(func(rw ResponseWriter, req *Request) {})) - defer ts.Close() - - for _, version := range []string{"HTTP/1.0", "HTTP/1.1"} { - conn, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatalf("error dialing: %v", err) - } - _, err = fmt.Fprintf(conn, "GET / %v\r\nConnection: keep-alive\r\nHost: foo\r\n\r\n", version) - if err != nil { - t.Fatalf("error writing: %v", err) - } - req, _ := NewRequest("GET", "/", nil) - res, err := ReadResponse(bufio.NewReader(conn), req) - if err != nil { - t.Fatalf("error reading response: %v", err) - } - if te := res.TransferEncoding; len(te) > 0 { - t.Errorf("For version %q, Transfer-Encoding = %q; want none", version, te) - } - if cl := res.ContentLength; cl != 0 { - t.Errorf("For version %q, Content-Length = %v; want 0", version, cl) - } - conn.Close() - } -} - -func TestCloseNotifier(t *testing.T) { - defer afterTest(t) - gotReq := make(chan bool, 1) - sawClose := make(chan bool, 1) - ts := httptest.NewServer(HandlerFunc(func(rw ResponseWriter, req *Request) { - gotReq <- true - cc := rw.(CloseNotifier).CloseNotify() - <-cc - sawClose <- true - })) - conn, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatalf("error dialing: %v", err) - } - diec := make(chan bool) - go func() { - _, err = fmt.Fprintf(conn, "GET / HTTP/1.1\r\nConnection: keep-alive\r\nHost: foo\r\n\r\n") - if err != nil { - t.Fatal(err) - } - <-diec - conn.Close() - }() -For: - for { - select { - case <-gotReq: - diec <- true - case <-sawClose: - break For - case <-time.After(5 * time.Second): - t.Fatal("timeout") - } - } - ts.Close() -} - -func TestCloseNotifierChanLeak(t *testing.T) { - defer afterTest(t) - req := reqBytes("GET / HTTP/1.0\nHost: golang.org") - for i := 0; i < 20; i++ { - var output bytes.Buffer - conn := &rwTestConn{ - Reader: bytes.NewReader(req), - Writer: &output, - closec: make(chan bool, 1), - } - ln := &oneConnListener{conn: conn} - handler := HandlerFunc(func(rw ResponseWriter, r *Request) { - // Ignore the return value and never read from - // it, testing that we don't leak goroutines - // on the sending side: - _ = rw.(CloseNotifier).CloseNotify() - }) - go Serve(ln, handler) - <-conn.closec - } -} - -func TestOptions(t *testing.T) { - uric := make(chan string, 2) // only expect 1, but leave space for 2 - mux := NewServeMux() - mux.HandleFunc("/", func(w ResponseWriter, r *Request) { - uric <- r.RequestURI - }) - ts := httptest.NewServer(mux) - defer ts.Close() - - conn, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatal(err) - } - defer conn.Close() - - // An OPTIONS * request should succeed. - _, err = conn.Write([]byte("OPTIONS * HTTP/1.1\r\nHost: foo.com\r\n\r\n")) - if err != nil { - t.Fatal(err) - } - br := bufio.NewReader(conn) - res, err := ReadResponse(br, &Request{Method: "OPTIONS"}) - if err != nil { - t.Fatal(err) - } - if res.StatusCode != 200 { - t.Errorf("Got non-200 response to OPTIONS *: %#v", res) - } - - // A GET * request on a ServeMux should fail. - _, err = conn.Write([]byte("GET * HTTP/1.1\r\nHost: foo.com\r\n\r\n")) - if err != nil { - t.Fatal(err) - } - res, err = ReadResponse(br, &Request{Method: "GET"}) - if err != nil { - t.Fatal(err) - } - if res.StatusCode != 400 { - t.Errorf("Got non-400 response to GET *: %#v", res) - } - - res, err = Get(ts.URL + "/second") - if err != nil { - t.Fatal(err) - } - res.Body.Close() - if got := <-uric; got != "/second" { - t.Errorf("Handler saw request for %q; want /second", got) - } -} - -// Tests regarding the ordering of Write, WriteHeader, Header, and -// Flush calls. In Go 1.0, rw.WriteHeader immediately flushed the -// (*response).header to the wire. In Go 1.1, the actual wire flush is -// delayed, so we could maybe tack on a Content-Length and better -// Content-Type after we see more (or all) of the output. To preserve -// compatibility with Go 1, we need to be careful to track which -// headers were live at the time of WriteHeader, so we write the same -// ones, even if the handler modifies them (~erroneously) after the -// first Write. -func TestHeaderToWire(t *testing.T) { - tests := []struct { - name string - handler func(ResponseWriter, *Request) - check func(output string) error - }{ - { - name: "write without Header", - handler: func(rw ResponseWriter, r *Request) { - rw.Write([]byte("hello world")) - }, - check: func(got string) error { - if !strings.Contains(got, "Content-Length:") { - return errors.New("no content-length") - } - if !strings.Contains(got, "Content-Type: text/plain") { - return errors.New("no content-length") - } - return nil - }, - }, - { - name: "Header mutation before write", - handler: func(rw ResponseWriter, r *Request) { - h := rw.Header() - h.Set("Content-Type", "some/type") - rw.Write([]byte("hello world")) - h.Set("Too-Late", "bogus") - }, - check: func(got string) error { - if !strings.Contains(got, "Content-Length:") { - return errors.New("no content-length") - } - if !strings.Contains(got, "Content-Type: some/type") { - return errors.New("wrong content-type") - } - if strings.Contains(got, "Too-Late") { - return errors.New("don't want too-late header") - } - return nil - }, - }, - { - name: "write then useless Header mutation", - handler: func(rw ResponseWriter, r *Request) { - rw.Write([]byte("hello world")) - rw.Header().Set("Too-Late", "Write already wrote headers") - }, - check: func(got string) error { - if strings.Contains(got, "Too-Late") { - return errors.New("header appeared from after WriteHeader") - } - return nil - }, - }, - { - name: "flush then write", - handler: func(rw ResponseWriter, r *Request) { - rw.(Flusher).Flush() - rw.Write([]byte("post-flush")) - rw.Header().Set("Too-Late", "Write already wrote headers") - }, - check: func(got string) error { - if !strings.Contains(got, "Transfer-Encoding: chunked") { - return errors.New("not chunked") - } - if strings.Contains(got, "Too-Late") { - return errors.New("header appeared from after WriteHeader") - } - return nil - }, - }, - { - name: "header then flush", - handler: func(rw ResponseWriter, r *Request) { - rw.Header().Set("Content-Type", "some/type") - rw.(Flusher).Flush() - rw.Write([]byte("post-flush")) - rw.Header().Set("Too-Late", "Write already wrote headers") - }, - check: func(got string) error { - if !strings.Contains(got, "Transfer-Encoding: chunked") { - return errors.New("not chunked") - } - if strings.Contains(got, "Too-Late") { - return errors.New("header appeared from after WriteHeader") - } - if !strings.Contains(got, "Content-Type: some/type") { - return errors.New("wrong content-length") - } - return nil - }, - }, - { - name: "sniff-on-first-write content-type", - handler: func(rw ResponseWriter, r *Request) { - rw.Write([]byte("some html")) - rw.Header().Set("Content-Type", "x/wrong") - }, - check: func(got string) error { - if !strings.Contains(got, "Content-Type: text/html") { - return errors.New("wrong content-length; want html") - } - return nil - }, - }, - { - name: "explicit content-type wins", - handler: func(rw ResponseWriter, r *Request) { - rw.Header().Set("Content-Type", "some/type") - rw.Write([]byte("some html")) - }, - check: func(got string) error { - if !strings.Contains(got, "Content-Type: some/type") { - return errors.New("wrong content-length; want html") - } - return nil - }, - }, - { - name: "empty handler", - handler: func(rw ResponseWriter, r *Request) { - }, - check: func(got string) error { - if !strings.Contains(got, "Content-Type: text/plain") { - return errors.New("wrong content-length; want text/plain") - } - if !strings.Contains(got, "Content-Length: 0") { - return errors.New("want 0 content-length") - } - return nil - }, - }, - { - name: "only Header, no write", - handler: func(rw ResponseWriter, r *Request) { - rw.Header().Set("Some-Header", "some-value") - }, - check: func(got string) error { - if !strings.Contains(got, "Some-Header") { - return errors.New("didn't get header") - } - return nil - }, - }, - { - name: "WriteHeader call", - handler: func(rw ResponseWriter, r *Request) { - rw.WriteHeader(404) - rw.Header().Set("Too-Late", "some-value") - }, - check: func(got string) error { - if !strings.Contains(got, "404") { - return errors.New("wrong status") - } - if strings.Contains(got, "Some-Header") { - return errors.New("shouldn't have seen Too-Late") - } - return nil - }, - }, - } - for _, tc := range tests { - ht := newHandlerTest(HandlerFunc(tc.handler)) - got := ht.rawResponse("GET / HTTP/1.1\nHost: golang.org") - if err := tc.check(got); err != nil { - t.Errorf("%s: %v\nGot response:\n%s", tc.name, err, got) - } - } -} - -// goTimeout runs f, failing t if f takes more than ns to complete. -func goTimeout(t *testing.T, d time.Duration, f func()) { - ch := make(chan bool, 2) - timer := time.AfterFunc(d, func() { - t.Errorf("Timeout expired after %v", d) - ch <- true - }) - defer timer.Stop() - go func() { - defer func() { ch <- true }() - f() - }() - <-ch -} - -type errorListener struct { - errs []error -} - -func (l *errorListener) Accept() (c net.Conn, err error) { - if len(l.errs) == 0 { - return nil, io.EOF - } - err = l.errs[0] - l.errs = l.errs[1:] - return -} - -func (l *errorListener) Close() error { - return nil -} - -func (l *errorListener) Addr() net.Addr { - return dummyAddr("test-address") -} - -func TestAcceptMaxFds(t *testing.T) { - log.SetOutput(ioutil.Discard) // is noisy otherwise - defer log.SetOutput(os.Stderr) - - ln := &errorListener{[]error{ - &net.OpError{ - Op: "accept", - Err: syscall.EMFILE, - }}} - err := Serve(ln, HandlerFunc(HandlerFunc(func(ResponseWriter, *Request) {}))) - if err != io.EOF { - t.Errorf("got error %v, want EOF", err) - } -} - -func TestWriteAfterHijack(t *testing.T) { - req := reqBytes("GET / HTTP/1.1\nHost: golang.org") - var buf bytes.Buffer - wrotec := make(chan bool, 1) - conn := &rwTestConn{ - Reader: bytes.NewReader(req), - Writer: &buf, - closec: make(chan bool, 1), - } - handler := HandlerFunc(func(rw ResponseWriter, r *Request) { - conn, bufrw, err := rw.(Hijacker).Hijack() - if err != nil { - t.Error(err) - return - } - go func() { - bufrw.Write([]byte("[hijack-to-bufw]")) - bufrw.Flush() - conn.Write([]byte("[hijack-to-conn]")) - conn.Close() - wrotec <- true - }() - }) - ln := &oneConnListener{conn: conn} - go Serve(ln, handler) - <-conn.closec - <-wrotec - if g, w := buf.String(), "[hijack-to-bufw][hijack-to-conn]"; g != w { - t.Errorf("wrote %q; want %q", g, w) - } -} - -func TestDoubleHijack(t *testing.T) { - req := reqBytes("GET / HTTP/1.1\nHost: golang.org") - var buf bytes.Buffer - conn := &rwTestConn{ - Reader: bytes.NewReader(req), - Writer: &buf, - closec: make(chan bool, 1), - } - handler := HandlerFunc(func(rw ResponseWriter, r *Request) { - conn, _, err := rw.(Hijacker).Hijack() - if err != nil { - t.Error(err) - return - } - _, _, err = rw.(Hijacker).Hijack() - if err == nil { - t.Errorf("got err = nil; want err != nil") - } - conn.Close() - }) - ln := &oneConnListener{conn: conn} - go Serve(ln, handler) - <-conn.closec -} - -// http://code.google.com/p/go/issues/detail?id=5955 -// Note that this does not test the "request too large" -// exit path from the http server. This is intentional; -// not sending Connection: close is just a minor wire -// optimization and is pointless if dealing with a -// badly behaved client. -func TestHTTP10ConnectionHeader(t *testing.T) { - defer afterTest(t) - - mux := NewServeMux() - mux.Handle("/", HandlerFunc(func(resp ResponseWriter, req *Request) {})) - ts := httptest.NewServer(mux) - defer ts.Close() - - // net/http uses HTTP/1.1 for requests, so write requests manually - tests := []struct { - req string // raw http request - expect []string // expected Connection header(s) - }{ - { - req: "GET / HTTP/1.0\r\n\r\n", - expect: nil, - }, - { - req: "OPTIONS * HTTP/1.0\r\n\r\n", - expect: nil, - }, - { - req: "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n", - expect: []string{"keep-alive"}, - }, - } - - for _, tt := range tests { - conn, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatal("dial err:", err) - } - - _, err = fmt.Fprint(conn, tt.req) - if err != nil { - t.Fatal("conn write err:", err) - } - - resp, err := ReadResponse(bufio.NewReader(conn), &Request{Method: "GET"}) - if err != nil { - t.Fatal("ReadResponse err:", err) - } - conn.Close() - resp.Body.Close() - - got := resp.Header["Connection"] - if !reflect.DeepEqual(got, tt.expect) { - t.Errorf("wrong Connection headers for request %q. Got %q expect %q", tt.req, got, tt.expect) - } - } -} - -// See golang.org/issue/5660 -func TestServerReaderFromOrder(t *testing.T) { - defer afterTest(t) - pr, pw := io.Pipe() - const size = 3 << 20 - ts := httptest.NewServer(HandlerFunc(func(rw ResponseWriter, req *Request) { - rw.Header().Set("Content-Type", "text/plain") // prevent sniffing path - done := make(chan bool) - go func() { - io.Copy(rw, pr) - close(done) - }() - time.Sleep(25 * time.Millisecond) // give Copy a chance to break things - n, err := io.Copy(ioutil.Discard, req.Body) - if err != nil { - t.Errorf("handler Copy: %v", err) - return - } - if n != size { - t.Errorf("handler Copy = %d; want %d", n, size) - } - pw.Write([]byte("hi")) - pw.Close() - <-done - })) - defer ts.Close() - - req, err := NewRequest("POST", ts.URL, io.LimitReader(neverEnding('a'), size)) - if err != nil { - t.Fatal(err) - } - res, err := DefaultClient.Do(req) - if err != nil { - t.Fatal(err) - } - all, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatal(err) - } - res.Body.Close() - if string(all) != "hi" { - t.Errorf("Body = %q; want hi", all) - } -} - -// Issue 6157, Issue 6685 -func TestCodesPreventingContentTypeAndBody(t *testing.T) { - for _, code := range []int{StatusNotModified, StatusNoContent, StatusContinue} { - ht := newHandlerTest(HandlerFunc(func(w ResponseWriter, r *Request) { - if r.URL.Path == "/header" { - w.Header().Set("Content-Length", "123") - } - w.WriteHeader(code) - if r.URL.Path == "/more" { - w.Write([]byte("stuff")) - } - })) - for _, req := range []string{ - "GET / HTTP/1.0", - "GET /header HTTP/1.0", - "GET /more HTTP/1.0", - "GET / HTTP/1.1", - "GET /header HTTP/1.1", - "GET /more HTTP/1.1", - } { - got := ht.rawResponse(req) - wantStatus := fmt.Sprintf("%d %s", code, StatusText(code)) - if !strings.Contains(got, wantStatus) { - t.Errorf("Code %d: Wanted %q Modified for %q: %s", code, wantStatus, req, got) - } else if strings.Contains(got, "Content-Length") { - t.Errorf("Code %d: Got a Content-Length from %q: %s", code, req, got) - } else if strings.Contains(got, "stuff") { - t.Errorf("Code %d: Response contains a body from %q: %s", code, req, got) - } - } - } -} - -func TestContentTypeOkayOn204(t *testing.T) { - ht := newHandlerTest(HandlerFunc(func(w ResponseWriter, r *Request) { - w.Header().Set("Content-Length", "123") // suppressed - w.Header().Set("Content-Type", "foo/bar") - w.WriteHeader(204) - })) - got := ht.rawResponse("GET / HTTP/1.1") - if !strings.Contains(got, "Content-Type: foo/bar") { - t.Errorf("Response = %q; want Content-Type: foo/bar", got) - } - if strings.Contains(got, "Content-Length: 123") { - t.Errorf("Response = %q; don't want a Content-Length", got) - } -} - -// Issue 6995 -// A server Handler can receive a Request, and then turn around and -// give a copy of that Request.Body out to the Transport (e.g. any -// proxy). So then two people own that Request.Body (both the server -// and the http client), and both think they can close it on failure. -// Therefore, all incoming server requests Bodies need to be thread-safe. -func TestTransportAndServerSharedBodyRace(t *testing.T) { - defer afterTest(t) - - const bodySize = 1 << 20 - - unblockBackend := make(chan bool) - backend := httptest.NewServer(HandlerFunc(func(rw ResponseWriter, req *Request) { - io.CopyN(rw, req.Body, bodySize/2) - <-unblockBackend - })) - defer backend.Close() - - backendRespc := make(chan *Response, 1) - proxy := httptest.NewServer(HandlerFunc(func(rw ResponseWriter, req *Request) { - if req.RequestURI == "/foo" { - rw.Write([]byte("bar")) - return - } - req2, _ := NewRequest("POST", backend.URL, req.Body) - req2.ContentLength = bodySize - - bresp, err := DefaultClient.Do(req2) - if err != nil { - t.Errorf("Proxy outbound request: %v", err) - return - } - _, err = io.CopyN(ioutil.Discard, bresp.Body, bodySize/4) - if err != nil { - t.Errorf("Proxy copy error: %v", err) - return - } - backendRespc <- bresp // to close later - - // Try to cause a race: Both the DefaultTransport and the proxy handler's Server - // will try to read/close req.Body (aka req2.Body) - DefaultTransport.(*Transport).CancelRequest(req2) - rw.Write([]byte("OK")) - })) - defer proxy.Close() - - req, _ := NewRequest("POST", proxy.URL, io.LimitReader(neverEnding('a'), bodySize)) - res, err := DefaultClient.Do(req) - if err != nil { - t.Fatalf("Original request: %v", err) - } - - // Cleanup, so we don't leak goroutines. - res.Body.Close() - close(unblockBackend) - (<-backendRespc).Body.Close() -} - -// Test that a hanging Request.Body.Read from another goroutine can't -// cause the Handler goroutine's Request.Body.Close to block. -func TestRequestBodyCloseDoesntBlock(t *testing.T) { - t.Skipf("Skipping known issue; see golang.org/issue/7121") - if testing.Short() { - t.Skip("skipping in -short mode") - } - defer afterTest(t) - - readErrCh := make(chan error, 1) - errCh := make(chan error, 2) - - server := httptest.NewServer(HandlerFunc(func(rw ResponseWriter, req *Request) { - go func(body io.Reader) { - _, err := body.Read(make([]byte, 100)) - readErrCh <- err - }(req.Body) - time.Sleep(500 * time.Millisecond) - })) - defer server.Close() - - closeConn := make(chan bool) - defer close(closeConn) - go func() { - conn, err := net.Dial("tcp", server.Listener.Addr().String()) - if err != nil { - errCh <- err - return - } - defer conn.Close() - _, err = conn.Write([]byte("POST / HTTP/1.1\r\nConnection: close\r\nHost: foo\r\nContent-Length: 100000\r\n\r\n")) - if err != nil { - errCh <- err - return - } - // And now just block, making the server block on our - // 100000 bytes of body that will never arrive. - <-closeConn - }() - select { - case err := <-readErrCh: - if err == nil { - t.Error("Read was nil. Expected error.") - } - case err := <-errCh: - t.Error(err) - case <-time.After(5 * time.Second): - t.Error("timeout") - } -} - -func TestResponseWriterWriteStringAllocs(t *testing.T) { - ht := newHandlerTest(HandlerFunc(func(w ResponseWriter, r *Request) { - if r.URL.Path == "/s" { - io.WriteString(w, "Hello world") - } else { - w.Write([]byte("Hello world")) - } - })) - before := testing.AllocsPerRun(50, func() { ht.rawResponse("GET / HTTP/1.0") }) - after := testing.AllocsPerRun(50, func() { ht.rawResponse("GET /s HTTP/1.0") }) - if int(after) >= int(before) { - t.Errorf("WriteString allocs of %v >= Write allocs of %v", after, before) - } -} - -func TestAppendTime(t *testing.T) { - var b [len(TimeFormat)]byte - t1 := time.Date(2013, 9, 21, 15, 41, 0, 0, time.FixedZone("CEST", 2*60*60)) - res := ExportAppendTime(b[:0], t1) - t2, err := ParseTime(string(res)) - if err != nil { - t.Fatalf("Error parsing time: %s", err) - } - if !t1.Equal(t2) { - t.Fatalf("Times differ; expected: %v, got %v (%s)", t1, t2, string(res)) - } -} - -func TestServerConnState(t *testing.T) { - defer afterTest(t) - handler := map[string]func(w ResponseWriter, r *Request){ - "/": func(w ResponseWriter, r *Request) { - fmt.Fprintf(w, "Hello.") - }, - "/close": func(w ResponseWriter, r *Request) { - w.Header().Set("Connection", "close") - fmt.Fprintf(w, "Hello.") - }, - "/hijack": func(w ResponseWriter, r *Request) { - c, _, _ := w.(Hijacker).Hijack() - c.Write([]byte("HTTP/1.0 200 OK\r\nConnection: close\r\n\r\nHello.")) - c.Close() - }, - "/hijack-panic": func(w ResponseWriter, r *Request) { - c, _, _ := w.(Hijacker).Hijack() - c.Write([]byte("HTTP/1.0 200 OK\r\nConnection: close\r\n\r\nHello.")) - c.Close() - panic("intentional panic") - }, - } - ts := httptest.NewUnstartedServer(HandlerFunc(func(w ResponseWriter, r *Request) { - handler[r.URL.Path](w, r) - })) - defer ts.Close() - - var mu sync.Mutex // guard stateLog and connID - var stateLog = map[int][]ConnState{} - var connID = map[net.Conn]int{} - - ts.Config.ErrorLog = log.New(ioutil.Discard, "", 0) - ts.Config.ConnState = func(c net.Conn, state ConnState) { - if c == nil { - t.Errorf("nil conn seen in state %s", state) - return - } - mu.Lock() - defer mu.Unlock() - id, ok := connID[c] - if !ok { - id = len(connID) + 1 - connID[c] = id - } - stateLog[id] = append(stateLog[id], state) - } - ts.Start() - - mustGet(t, ts.URL+"/") - mustGet(t, ts.URL+"/close") - - mustGet(t, ts.URL+"/") - mustGet(t, ts.URL+"/", "Connection", "close") - - mustGet(t, ts.URL+"/hijack") - mustGet(t, ts.URL+"/hijack-panic") - - // New->Closed - { - c, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatal(err) - } - c.Close() - } - - // New->Active->Closed - { - c, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatal(err) - } - if _, err := io.WriteString(c, "BOGUS REQUEST\r\n\r\n"); err != nil { - t.Fatal(err) - } - c.Close() - } - - // New->Idle->Closed - { - c, err := net.Dial("tcp", ts.Listener.Addr().String()) - if err != nil { - t.Fatal(err) - } - if _, err := io.WriteString(c, "GET / HTTP/1.1\r\nHost: foo\r\n\r\n"); err != nil { - t.Fatal(err) - } - res, err := ReadResponse(bufio.NewReader(c), nil) - if err != nil { - t.Fatal(err) - } - if _, err := io.Copy(ioutil.Discard, res.Body); err != nil { - t.Fatal(err) - } - c.Close() - } - - want := map[int][]ConnState{ - 1: []ConnState{StateNew, StateActive, StateIdle, StateActive, StateClosed}, - 2: []ConnState{StateNew, StateActive, StateIdle, StateActive, StateClosed}, - 3: []ConnState{StateNew, StateActive, StateHijacked}, - 4: []ConnState{StateNew, StateActive, StateHijacked}, - 5: []ConnState{StateNew, StateClosed}, - 6: []ConnState{StateNew, StateActive, StateClosed}, - 7: []ConnState{StateNew, StateActive, StateIdle, StateClosed}, - } - logString := func(m map[int][]ConnState) string { - var b bytes.Buffer - for id, l := range m { - fmt.Fprintf(&b, "Conn %d: ", id) - for _, s := range l { - fmt.Fprintf(&b, "%s ", s) - } - b.WriteString("\n") - } - return b.String() - } - - for i := 0; i < 5; i++ { - time.Sleep(time.Duration(i) * 50 * time.Millisecond) - mu.Lock() - match := reflect.DeepEqual(stateLog, want) - mu.Unlock() - if match { - return - } - } - - mu.Lock() - t.Errorf("Unexpected events.\nGot log: %s\n Want: %s\n", logString(stateLog), logString(want)) - mu.Unlock() -} - -func mustGet(t *testing.T, url string, headers ...string) { - req, err := NewRequest("GET", url, nil) - if err != nil { - t.Fatal(err) - } - for len(headers) > 0 { - req.Header.Add(headers[0], headers[1]) - headers = headers[2:] - } - res, err := DefaultClient.Do(req) - if err != nil { - t.Errorf("Error fetching %s: %v", url, err) - return - } - _, err = ioutil.ReadAll(res.Body) - defer res.Body.Close() - if err != nil { - t.Errorf("Error reading %s: %v", url, err) - } -} - -func TestServerKeepAlivesEnabled(t *testing.T) { - defer afterTest(t) - ts := httptest.NewUnstartedServer(HandlerFunc(func(w ResponseWriter, r *Request) {})) - ts.Config.SetKeepAlivesEnabled(false) - ts.Start() - defer ts.Close() - res, err := Get(ts.URL) - if err != nil { - t.Fatal(err) - } - defer res.Body.Close() - if !res.Close { - t.Errorf("Body.Close == false; want true") - } -} - -// golang.org/issue/7856 -func TestServerEmptyBodyRace(t *testing.T) { - defer afterTest(t) - var n int32 - ts := httptest.NewServer(HandlerFunc(func(rw ResponseWriter, req *Request) { - atomic.AddInt32(&n, 1) - })) - defer ts.Close() - var wg sync.WaitGroup - const reqs = 20 - for i := 0; i < reqs; i++ { - wg.Add(1) - go func() { - defer wg.Done() - res, err := Get(ts.URL) - if err != nil { - t.Error(err) - return - } - defer res.Body.Close() - _, err = io.Copy(ioutil.Discard, res.Body) - if err != nil { - t.Error(err) - return - } - }() - } - wg.Wait() - if got := atomic.LoadInt32(&n); got != reqs { - t.Errorf("handler ran %d times; want %d", got, reqs) - } -} - -func TestServerConnStateNew(t *testing.T) { - sawNew := false // if the test is buggy, we'll race on this variable. - srv := &Server{ - ConnState: func(c net.Conn, state ConnState) { - if state == StateNew { - sawNew = true // testing that this write isn't racy - } - }, - Handler: HandlerFunc(func(w ResponseWriter, r *Request) {}), // irrelevant - } - srv.Serve(&oneConnListener{ - conn: &rwTestConn{ - Reader: strings.NewReader("GET / HTTP/1.1\r\nHost: foo\r\n\r\n"), - Writer: ioutil.Discard, - }, - }) - if !sawNew { // testing that this read isn't racy - t.Error("StateNew not seen") - } -} - -func BenchmarkClientServer(b *testing.B) { - b.ReportAllocs() - b.StopTimer() - ts := httptest.NewServer(HandlerFunc(func(rw ResponseWriter, r *Request) { - fmt.Fprintf(rw, "Hello world.\n") - })) - defer ts.Close() - b.StartTimer() - - for i := 0; i < b.N; i++ { - res, err := Get(ts.URL) - if err != nil { - b.Fatal("Get:", err) - } - all, err := ioutil.ReadAll(res.Body) - res.Body.Close() - if err != nil { - b.Fatal("ReadAll:", err) - } - body := string(all) - if body != "Hello world.\n" { - b.Fatal("Got body:", body) - } - } - - b.StopTimer() -} - -func BenchmarkClientServerParallel4(b *testing.B) { - benchmarkClientServerParallel(b, 4) -} - -func BenchmarkClientServerParallel64(b *testing.B) { - benchmarkClientServerParallel(b, 64) -} - -func benchmarkClientServerParallel(b *testing.B, parallelism int) { - b.ReportAllocs() - ts := httptest.NewServer(HandlerFunc(func(rw ResponseWriter, r *Request) { - fmt.Fprintf(rw, "Hello world.\n") - })) - defer ts.Close() - b.ResetTimer() - b.SetParallelism(parallelism) - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - res, err := Get(ts.URL) - if err != nil { - b.Logf("Get: %v", err) - continue - } - all, err := ioutil.ReadAll(res.Body) - res.Body.Close() - if err != nil { - b.Logf("ReadAll: %v", err) - continue - } - body := string(all) - if body != "Hello world.\n" { - panic("Got body: " + body) - } - } - }) -} - -// A benchmark for profiling the server without the HTTP client code. -// The client code runs in a subprocess. -// -// For use like: -// $ go test -c -// $ ./http.test -test.run=XX -test.bench=BenchmarkServer -test.benchtime=15s -test.cpuprofile=http.prof -// $ go tool pprof http.test http.prof -// (pprof) web -func BenchmarkServer(b *testing.B) { - b.ReportAllocs() - // Child process mode; - if url := os.Getenv("TEST_BENCH_SERVER_URL"); url != "" { - n, err := strconv.Atoi(os.Getenv("TEST_BENCH_CLIENT_N")) - if err != nil { - panic(err) - } - for i := 0; i < n; i++ { - res, err := Get(url) - if err != nil { - log.Panicf("Get: %v", err) - } - all, err := ioutil.ReadAll(res.Body) - res.Body.Close() - if err != nil { - log.Panicf("ReadAll: %v", err) - } - body := string(all) - if body != "Hello world.\n" { - log.Panicf("Got body: %q", body) - } - } - os.Exit(0) - return - } - - var res = []byte("Hello world.\n") - b.StopTimer() - ts := httptest.NewServer(HandlerFunc(func(rw ResponseWriter, r *Request) { - rw.Header().Set("Content-Type", "text/html; charset=utf-8") - rw.Write(res) - })) - defer ts.Close() - b.StartTimer() - - cmd := exec.Command(os.Args[0], "-test.run=XXXX", "-test.bench=BenchmarkServer") - cmd.Env = append([]string{ - fmt.Sprintf("TEST_BENCH_CLIENT_N=%d", b.N), - fmt.Sprintf("TEST_BENCH_SERVER_URL=%s", ts.URL), - }, os.Environ()...) - out, err := cmd.CombinedOutput() - if err != nil { - b.Errorf("Test failure: %v, with output: %s", err, out) - } -} - -func BenchmarkServerFakeConnNoKeepAlive(b *testing.B) { - b.ReportAllocs() - req := reqBytes(`GET / HTTP/1.0 -Host: golang.org -Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 -User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17 -Accept-Encoding: gzip,deflate,sdch -Accept-Language: en-US,en;q=0.8 -Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 -`) - res := []byte("Hello world!\n") - - conn := &testConn{ - // testConn.Close will not push into the channel - // if it's full. - closec: make(chan bool, 1), - } - handler := HandlerFunc(func(rw ResponseWriter, r *Request) { - rw.Header().Set("Content-Type", "text/html; charset=utf-8") - rw.Write(res) - }) - ln := new(oneConnListener) - for i := 0; i < b.N; i++ { - conn.readBuf.Reset() - conn.writeBuf.Reset() - conn.readBuf.Write(req) - ln.conn = conn - Serve(ln, handler) - <-conn.closec - } -} - -// repeatReader reads content count times, then EOFs. -type repeatReader struct { - content []byte - count int - off int -} - -func (r *repeatReader) Read(p []byte) (n int, err error) { - if r.count <= 0 { - return 0, io.EOF - } - n = copy(p, r.content[r.off:]) - r.off += n - if r.off == len(r.content) { - r.count-- - r.off = 0 - } - return -} - -func BenchmarkServerFakeConnWithKeepAlive(b *testing.B) { - b.ReportAllocs() - - req := reqBytes(`GET / HTTP/1.1 -Host: golang.org -Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 -User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17 -Accept-Encoding: gzip,deflate,sdch -Accept-Language: en-US,en;q=0.8 -Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 -`) - res := []byte("Hello world!\n") - - conn := &rwTestConn{ - Reader: &repeatReader{content: req, count: b.N}, - Writer: ioutil.Discard, - closec: make(chan bool, 1), - } - handled := 0 - handler := HandlerFunc(func(rw ResponseWriter, r *Request) { - handled++ - rw.Header().Set("Content-Type", "text/html; charset=utf-8") - rw.Write(res) - }) - ln := &oneConnListener{conn: conn} - go Serve(ln, handler) - <-conn.closec - if b.N != handled { - b.Errorf("b.N=%d but handled %d", b.N, handled) - } -} - -// same as above, but representing the most simple possible request -// and handler. Notably: the handler does not call rw.Header(). -func BenchmarkServerFakeConnWithKeepAliveLite(b *testing.B) { - b.ReportAllocs() - - req := reqBytes(`GET / HTTP/1.1 -Host: golang.org -`) - res := []byte("Hello world!\n") - - conn := &rwTestConn{ - Reader: &repeatReader{content: req, count: b.N}, - Writer: ioutil.Discard, - closec: make(chan bool, 1), - } - handled := 0 - handler := HandlerFunc(func(rw ResponseWriter, r *Request) { - handled++ - rw.Write(res) - }) - ln := &oneConnListener{conn: conn} - go Serve(ln, handler) - <-conn.closec - if b.N != handled { - b.Errorf("b.N=%d but handled %d", b.N, handled) - } -} - -const someResponse = "some response" - -// A Response that's just no bigger than 2KB, the buffer-before-chunking threshold. -var response = bytes.Repeat([]byte(someResponse), 2<<10/len(someResponse)) - -// Both Content-Type and Content-Length set. Should be no buffering. -func BenchmarkServerHandlerTypeLen(b *testing.B) { - benchmarkHandler(b, HandlerFunc(func(w ResponseWriter, r *Request) { - w.Header().Set("Content-Type", "text/html") - w.Header().Set("Content-Length", strconv.Itoa(len(response))) - w.Write(response) - })) -} - -// A Content-Type is set, but no length. No sniffing, but will count the Content-Length. -func BenchmarkServerHandlerNoLen(b *testing.B) { - benchmarkHandler(b, HandlerFunc(func(w ResponseWriter, r *Request) { - w.Header().Set("Content-Type", "text/html") - w.Write(response) - })) -} - -// A Content-Length is set, but the Content-Type will be sniffed. -func BenchmarkServerHandlerNoType(b *testing.B) { - benchmarkHandler(b, HandlerFunc(func(w ResponseWriter, r *Request) { - w.Header().Set("Content-Length", strconv.Itoa(len(response))) - w.Write(response) - })) -} - -// Neither a Content-Type or Content-Length, so sniffed and counted. -func BenchmarkServerHandlerNoHeader(b *testing.B) { - benchmarkHandler(b, HandlerFunc(func(w ResponseWriter, r *Request) { - w.Write(response) - })) -} - -func benchmarkHandler(b *testing.B, h Handler) { - b.ReportAllocs() - req := reqBytes(`GET / HTTP/1.1 -Host: golang.org -`) - conn := &rwTestConn{ - Reader: &repeatReader{content: req, count: b.N}, - Writer: ioutil.Discard, - closec: make(chan bool, 1), - } - handled := 0 - handler := HandlerFunc(func(rw ResponseWriter, r *Request) { - handled++ - h.ServeHTTP(rw, r) - }) - ln := &oneConnListener{conn: conn} - go Serve(ln, handler) - <-conn.closec - if b.N != handled { - b.Errorf("b.N=%d but handled %d", b.N, handled) - } -} - -func BenchmarkServerHijack(b *testing.B) { - b.ReportAllocs() - req := reqBytes(`GET / HTTP/1.1 -Host: golang.org -`) - h := HandlerFunc(func(w ResponseWriter, r *Request) { - conn, _, err := w.(Hijacker).Hijack() - if err != nil { - panic(err) - } - conn.Close() - }) - conn := &rwTestConn{ - Writer: ioutil.Discard, - closec: make(chan bool, 1), - } - ln := &oneConnListener{conn: conn} - for i := 0; i < b.N; i++ { - conn.Reader = bytes.NewReader(req) - ln.conn = conn - Serve(ln, h) - <-conn.closec - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/sniff_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/sniff_test.go deleted file mode 100644 index 24ca27afc1..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/sniff_test.go +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http_test - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "log" - . "net/http" - "net/http/httptest" - "reflect" - "strconv" - "strings" - "testing" -) - -var sniffTests = []struct { - desc string - data []byte - contentType string -}{ - // Some nonsense. - {"Empty", []byte{}, "text/plain; charset=utf-8"}, - {"Binary", []byte{1, 2, 3}, "application/octet-stream"}, - - {"HTML document #1", []byte(`blah blah blah`), "text/html; charset=utf-8"}, - {"HTML document #2", []byte(``), "text/html; charset=utf-8"}, - {"HTML document #3 (leading whitespace)", []byte(` ...`), "text/html; charset=utf-8"}, - {"HTML document #4 (leading CRLF)", []byte("\r\n..."), "text/html; charset=utf-8"}, - - {"Plain text", []byte(`This is not HTML. It has ☃ though.`), "text/plain; charset=utf-8"}, - - {"XML", []byte("\nhi") - })) - defer ts.Close() - - resp, err := Get(ts.URL) - if err != nil { - t.Fatal(err) - } - - got := resp.Header["Content-Type"] - want := []string{""} - if !reflect.DeepEqual(got, want) { - t.Errorf("Content-Type = %q; want %q", got, want) - } - resp.Body.Close() -} - -func TestContentTypeWithCopy(t *testing.T) { - defer afterTest(t) - - const ( - input = "\n\n\t\n" - expected = "text/html; charset=utf-8" - ) - - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - // Use io.Copy from a bytes.Buffer to trigger ReadFrom. - buf := bytes.NewBuffer([]byte(input)) - n, err := io.Copy(w, buf) - if int(n) != len(input) || err != nil { - t.Errorf("io.Copy(w, %q) = %v, %v want %d, nil", input, n, err, len(input)) - } - })) - defer ts.Close() - - resp, err := Get(ts.URL) - if err != nil { - t.Fatalf("Get: %v", err) - } - if ct := resp.Header.Get("Content-Type"); ct != expected { - t.Errorf("Content-Type = %q, want %q", ct, expected) - } - data, err := ioutil.ReadAll(resp.Body) - if err != nil { - t.Errorf("reading body: %v", err) - } else if !bytes.Equal(data, []byte(input)) { - t.Errorf("data is %q, want %q", data, input) - } - resp.Body.Close() -} - -func TestSniffWriteSize(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - size, _ := strconv.Atoi(r.FormValue("size")) - written, err := io.WriteString(w, strings.Repeat("a", size)) - if err != nil { - t.Errorf("write of %d bytes: %v", size, err) - return - } - if written != size { - t.Errorf("write of %d bytes wrote %d bytes", size, written) - } - })) - defer ts.Close() - for _, size := range []int{0, 1, 200, 600, 999, 1000, 1023, 1024, 512 << 10, 1 << 20} { - res, err := Get(fmt.Sprintf("%s/?size=%d", ts.URL, size)) - if err != nil { - t.Fatalf("size %d: %v", size, err) - } - if _, err := io.Copy(ioutil.Discard, res.Body); err != nil { - t.Fatalf("size %d: io.Copy of body = %v", size, err) - } - if err := res.Body.Close(); err != nil { - t.Fatalf("size %d: body Close = %v", size, err) - } - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/testdata/file b/vendor/github.com/Azure/azure-sdk-for-go/core/http/testdata/file deleted file mode 100644 index 11f11f9be3..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/testdata/file +++ /dev/null @@ -1 +0,0 @@ -0123456789 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/testdata/index.html b/vendor/github.com/Azure/azure-sdk-for-go/core/http/testdata/index.html deleted file mode 100644 index da8e1e93d1..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/testdata/index.html +++ /dev/null @@ -1 +0,0 @@ -index.html says hello diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/testdata/style.css b/vendor/github.com/Azure/azure-sdk-for-go/core/http/testdata/style.css deleted file mode 100644 index 208d16d421..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/testdata/style.css +++ /dev/null @@ -1 +0,0 @@ -body {} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/transfer_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/transfer_test.go deleted file mode 100644 index 48cd540b9f..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/transfer_test.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http - -import ( - "bufio" - "io" - "strings" - "testing" -) - -func TestBodyReadBadTrailer(t *testing.T) { - b := &body{ - src: strings.NewReader("foobar"), - hdr: true, // force reading the trailer - r: bufio.NewReader(strings.NewReader("")), - } - buf := make([]byte, 7) - n, err := b.Read(buf[:3]) - got := string(buf[:n]) - if got != "foo" || err != nil { - t.Fatalf(`first Read = %d (%q), %v; want 3 ("foo")`, n, got, err) - } - - n, err = b.Read(buf[:]) - got = string(buf[:n]) - if got != "bar" || err != nil { - t.Fatalf(`second Read = %d (%q), %v; want 3 ("bar")`, n, got, err) - } - - n, err = b.Read(buf[:]) - got = string(buf[:n]) - if err == nil { - t.Errorf("final Read was successful (%q), expected error from trailer read", got) - } -} - -func TestFinalChunkedBodyReadEOF(t *testing.T) { - res, err := ReadResponse(bufio.NewReader(strings.NewReader( - "HTTP/1.1 200 OK\r\n"+ - "Transfer-Encoding: chunked\r\n"+ - "\r\n"+ - "0a\r\n"+ - "Body here\n\r\n"+ - "09\r\n"+ - "continued\r\n"+ - "0\r\n"+ - "\r\n")), nil) - if err != nil { - t.Fatal(err) - } - want := "Body here\ncontinued" - buf := make([]byte, len(want)) - n, err := res.Body.Read(buf) - if n != len(want) || err != io.EOF { - t.Logf("body = %#v", res.Body) - t.Errorf("Read = %v, %v; want %d, EOF", n, err, len(want)) - } - if string(buf) != want { - t.Errorf("buf = %q; want %q", buf, want) - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/transport_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/transport_test.go deleted file mode 100644 index afa2e4a602..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/transport_test.go +++ /dev/null @@ -1,2173 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Tests for transport.go - -package http_test - -import ( - "bufio" - "bytes" - "compress/gzip" - "crypto/rand" - "crypto/tls" - "errors" - "fmt" - "io" - "io/ioutil" - "log" - "net" - "net/http" - . "net/http" - "net/http/httptest" - "net/url" - "os" - "runtime" - "strconv" - "strings" - "sync" - "testing" - "time" -) - -// TODO: test 5 pipelined requests with responses: 1) OK, 2) OK, Connection: Close -// and then verify that the final 2 responses get errors back. - -// hostPortHandler writes back the client's "host:port". -var hostPortHandler = HandlerFunc(func(w ResponseWriter, r *Request) { - if r.FormValue("close") == "true" { - w.Header().Set("Connection", "close") - } - w.Write([]byte(r.RemoteAddr)) -}) - -// testCloseConn is a net.Conn tracked by a testConnSet. -type testCloseConn struct { - net.Conn - set *testConnSet -} - -func (c *testCloseConn) Close() error { - c.set.remove(c) - return c.Conn.Close() -} - -// testConnSet tracks a set of TCP connections and whether they've -// been closed. -type testConnSet struct { - t *testing.T - mu sync.Mutex // guards closed and list - closed map[net.Conn]bool - list []net.Conn // in order created -} - -func (tcs *testConnSet) insert(c net.Conn) { - tcs.mu.Lock() - defer tcs.mu.Unlock() - tcs.closed[c] = false - tcs.list = append(tcs.list, c) -} - -func (tcs *testConnSet) remove(c net.Conn) { - tcs.mu.Lock() - defer tcs.mu.Unlock() - tcs.closed[c] = true -} - -// some tests use this to manage raw tcp connections for later inspection -func makeTestDial(t *testing.T) (*testConnSet, func(n, addr string) (net.Conn, error)) { - connSet := &testConnSet{ - t: t, - closed: make(map[net.Conn]bool), - } - dial := func(n, addr string) (net.Conn, error) { - c, err := net.Dial(n, addr) - if err != nil { - return nil, err - } - tc := &testCloseConn{c, connSet} - connSet.insert(tc) - return tc, nil - } - return connSet, dial -} - -func (tcs *testConnSet) check(t *testing.T) { - tcs.mu.Lock() - defer tcs.mu.Unlock() - for i := 4; i >= 0; i-- { - for i, c := range tcs.list { - if tcs.closed[c] { - continue - } - if i != 0 { - tcs.mu.Unlock() - time.Sleep(50 * time.Millisecond) - tcs.mu.Lock() - continue - } - t.Errorf("TCP connection #%d, %+v (of %d total) was not closed", i+1, c, len(tcs.list)) - } - } -} - -// Two subsequent requests and verify their response is the same. -// The response from the server is our own IP:port -func TestTransportKeepAlives(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(hostPortHandler) - defer ts.Close() - - for _, disableKeepAlive := range []bool{false, true} { - tr := &Transport{DisableKeepAlives: disableKeepAlive} - defer tr.CloseIdleConnections() - c := &Client{Transport: tr} - - fetch := func(n int) string { - res, err := c.Get(ts.URL) - if err != nil { - t.Fatalf("error in disableKeepAlive=%v, req #%d, GET: %v", disableKeepAlive, n, err) - } - body, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatalf("error in disableKeepAlive=%v, req #%d, ReadAll: %v", disableKeepAlive, n, err) - } - return string(body) - } - - body1 := fetch(1) - body2 := fetch(2) - - bodiesDiffer := body1 != body2 - if bodiesDiffer != disableKeepAlive { - t.Errorf("error in disableKeepAlive=%v. unexpected bodiesDiffer=%v; body1=%q; body2=%q", - disableKeepAlive, bodiesDiffer, body1, body2) - } - } -} - -func TestTransportConnectionCloseOnResponse(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(hostPortHandler) - defer ts.Close() - - connSet, testDial := makeTestDial(t) - - for _, connectionClose := range []bool{false, true} { - tr := &Transport{ - Dial: testDial, - } - c := &Client{Transport: tr} - - fetch := func(n int) string { - req := new(Request) - var err error - req.URL, err = url.Parse(ts.URL + fmt.Sprintf("/?close=%v", connectionClose)) - if err != nil { - t.Fatalf("URL parse error: %v", err) - } - req.Method = "GET" - req.Proto = "HTTP/1.1" - req.ProtoMajor = 1 - req.ProtoMinor = 1 - - res, err := c.Do(req) - if err != nil { - t.Fatalf("error in connectionClose=%v, req #%d, Do: %v", connectionClose, n, err) - } - defer res.Body.Close() - body, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatalf("error in connectionClose=%v, req #%d, ReadAll: %v", connectionClose, n, err) - } - return string(body) - } - - body1 := fetch(1) - body2 := fetch(2) - bodiesDiffer := body1 != body2 - if bodiesDiffer != connectionClose { - t.Errorf("error in connectionClose=%v. unexpected bodiesDiffer=%v; body1=%q; body2=%q", - connectionClose, bodiesDiffer, body1, body2) - } - - tr.CloseIdleConnections() - } - - connSet.check(t) -} - -func TestTransportConnectionCloseOnRequest(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(hostPortHandler) - defer ts.Close() - - connSet, testDial := makeTestDial(t) - - for _, connectionClose := range []bool{false, true} { - tr := &Transport{ - Dial: testDial, - } - c := &Client{Transport: tr} - - fetch := func(n int) string { - req := new(Request) - var err error - req.URL, err = url.Parse(ts.URL) - if err != nil { - t.Fatalf("URL parse error: %v", err) - } - req.Method = "GET" - req.Proto = "HTTP/1.1" - req.ProtoMajor = 1 - req.ProtoMinor = 1 - req.Close = connectionClose - - res, err := c.Do(req) - if err != nil { - t.Fatalf("error in connectionClose=%v, req #%d, Do: %v", connectionClose, n, err) - } - body, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatalf("error in connectionClose=%v, req #%d, ReadAll: %v", connectionClose, n, err) - } - return string(body) - } - - body1 := fetch(1) - body2 := fetch(2) - bodiesDiffer := body1 != body2 - if bodiesDiffer != connectionClose { - t.Errorf("error in connectionClose=%v. unexpected bodiesDiffer=%v; body1=%q; body2=%q", - connectionClose, bodiesDiffer, body1, body2) - } - - tr.CloseIdleConnections() - } - - connSet.check(t) -} - -func TestTransportIdleCacheKeys(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(hostPortHandler) - defer ts.Close() - - tr := &Transport{DisableKeepAlives: false} - c := &Client{Transport: tr} - - if e, g := 0, len(tr.IdleConnKeysForTesting()); e != g { - t.Errorf("After CloseIdleConnections expected %d idle conn cache keys; got %d", e, g) - } - - resp, err := c.Get(ts.URL) - if err != nil { - t.Error(err) - } - ioutil.ReadAll(resp.Body) - - keys := tr.IdleConnKeysForTesting() - if e, g := 1, len(keys); e != g { - t.Fatalf("After Get expected %d idle conn cache keys; got %d", e, g) - } - - if e := "|http|" + ts.Listener.Addr().String(); keys[0] != e { - t.Errorf("Expected idle cache key %q; got %q", e, keys[0]) - } - - tr.CloseIdleConnections() - if e, g := 0, len(tr.IdleConnKeysForTesting()); e != g { - t.Errorf("After CloseIdleConnections expected %d idle conn cache keys; got %d", e, g) - } -} - -// Tests that the HTTP transport re-uses connections when a client -// reads to the end of a response Body without closing it. -func TestTransportReadToEndReusesConn(t *testing.T) { - defer afterTest(t) - const msg = "foobar" - - var addrSeen map[string]int - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - addrSeen[r.RemoteAddr]++ - if r.URL.Path == "/chunked/" { - w.WriteHeader(200) - w.(http.Flusher).Flush() - } else { - w.Header().Set("Content-Type", strconv.Itoa(len(msg))) - w.WriteHeader(200) - } - w.Write([]byte(msg)) - })) - defer ts.Close() - - buf := make([]byte, len(msg)) - - for pi, path := range []string{"/content-length/", "/chunked/"} { - wantLen := []int{len(msg), -1}[pi] - addrSeen = make(map[string]int) - for i := 0; i < 3; i++ { - res, err := http.Get(ts.URL + path) - if err != nil { - t.Errorf("Get %s: %v", path, err) - continue - } - // We want to close this body eventually (before the - // defer afterTest at top runs), but not before the - // len(addrSeen) check at the bottom of this test, - // since Closing this early in the loop would risk - // making connections be re-used for the wrong reason. - defer res.Body.Close() - - if res.ContentLength != int64(wantLen) { - t.Errorf("%s res.ContentLength = %d; want %d", path, res.ContentLength, wantLen) - } - n, err := res.Body.Read(buf) - if n != len(msg) || err != io.EOF { - t.Errorf("%s Read = %v, %v; want %d, EOF", path, n, err, len(msg)) - } - } - if len(addrSeen) != 1 { - t.Errorf("for %s, server saw %d distinct client addresses; want 1", path, len(addrSeen)) - } - } -} - -func TestTransportMaxPerHostIdleConns(t *testing.T) { - defer afterTest(t) - resch := make(chan string) - gotReq := make(chan bool) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - gotReq <- true - msg := <-resch - _, err := w.Write([]byte(msg)) - if err != nil { - t.Fatalf("Write: %v", err) - } - })) - defer ts.Close() - maxIdleConns := 2 - tr := &Transport{DisableKeepAlives: false, MaxIdleConnsPerHost: maxIdleConns} - c := &Client{Transport: tr} - - // Start 3 outstanding requests and wait for the server to get them. - // Their responses will hang until we write to resch, though. - donech := make(chan bool) - doReq := func() { - resp, err := c.Get(ts.URL) - if err != nil { - t.Error(err) - return - } - if _, err := ioutil.ReadAll(resp.Body); err != nil { - t.Errorf("ReadAll: %v", err) - return - } - donech <- true - } - go doReq() - <-gotReq - go doReq() - <-gotReq - go doReq() - <-gotReq - - if e, g := 0, len(tr.IdleConnKeysForTesting()); e != g { - t.Fatalf("Before writes, expected %d idle conn cache keys; got %d", e, g) - } - - resch <- "res1" - <-donech - keys := tr.IdleConnKeysForTesting() - if e, g := 1, len(keys); e != g { - t.Fatalf("after first response, expected %d idle conn cache keys; got %d", e, g) - } - cacheKey := "|http|" + ts.Listener.Addr().String() - if keys[0] != cacheKey { - t.Fatalf("Expected idle cache key %q; got %q", cacheKey, keys[0]) - } - if e, g := 1, tr.IdleConnCountForTesting(cacheKey); e != g { - t.Errorf("after first response, expected %d idle conns; got %d", e, g) - } - - resch <- "res2" - <-donech - if e, g := 2, tr.IdleConnCountForTesting(cacheKey); e != g { - t.Errorf("after second response, expected %d idle conns; got %d", e, g) - } - - resch <- "res3" - <-donech - if e, g := maxIdleConns, tr.IdleConnCountForTesting(cacheKey); e != g { - t.Errorf("after third response, still expected %d idle conns; got %d", e, g) - } -} - -func TestTransportServerClosingUnexpectedly(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(hostPortHandler) - defer ts.Close() - - tr := &Transport{} - c := &Client{Transport: tr} - - fetch := func(n, retries int) string { - condFatalf := func(format string, arg ...interface{}) { - if retries <= 0 { - t.Fatalf(format, arg...) - } - t.Logf("retrying shortly after expected error: "+format, arg...) - time.Sleep(time.Second / time.Duration(retries)) - } - for retries >= 0 { - retries-- - res, err := c.Get(ts.URL) - if err != nil { - condFatalf("error in req #%d, GET: %v", n, err) - continue - } - body, err := ioutil.ReadAll(res.Body) - if err != nil { - condFatalf("error in req #%d, ReadAll: %v", n, err) - continue - } - res.Body.Close() - return string(body) - } - panic("unreachable") - } - - body1 := fetch(1, 0) - body2 := fetch(2, 0) - - ts.CloseClientConnections() // surprise! - - // This test has an expected race. Sleeping for 25 ms prevents - // it on most fast machines, causing the next fetch() call to - // succeed quickly. But if we do get errors, fetch() will retry 5 - // times with some delays between. - time.Sleep(25 * time.Millisecond) - - body3 := fetch(3, 5) - - if body1 != body2 { - t.Errorf("expected body1 and body2 to be equal") - } - if body2 == body3 { - t.Errorf("expected body2 and body3 to be different") - } -} - -// Test for http://golang.org/issue/2616 (appropriate issue number) -// This fails pretty reliably with GOMAXPROCS=100 or something high. -func TestStressSurpriseServerCloses(t *testing.T) { - defer afterTest(t) - if testing.Short() { - t.Skip("skipping test in short mode") - } - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - w.Header().Set("Content-Length", "5") - w.Header().Set("Content-Type", "text/plain") - w.Write([]byte("Hello")) - w.(Flusher).Flush() - conn, buf, _ := w.(Hijacker).Hijack() - buf.Flush() - conn.Close() - })) - defer ts.Close() - - tr := &Transport{DisableKeepAlives: false} - c := &Client{Transport: tr} - - // Do a bunch of traffic from different goroutines. Send to activityc - // after each request completes, regardless of whether it failed. - const ( - numClients = 50 - reqsPerClient = 250 - ) - activityc := make(chan bool) - for i := 0; i < numClients; i++ { - go func() { - for i := 0; i < reqsPerClient; i++ { - res, err := c.Get(ts.URL) - if err == nil { - // We expect errors since the server is - // hanging up on us after telling us to - // send more requests, so we don't - // actually care what the error is. - // But we want to close the body in cases - // where we won the race. - res.Body.Close() - } - activityc <- true - } - }() - } - - // Make sure all the request come back, one way or another. - for i := 0; i < numClients*reqsPerClient; i++ { - select { - case <-activityc: - case <-time.After(5 * time.Second): - t.Fatalf("presumed deadlock; no HTTP client activity seen in awhile") - } - } -} - -// TestTransportHeadResponses verifies that we deal with Content-Lengths -// with no bodies properly -func TestTransportHeadResponses(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - if r.Method != "HEAD" { - panic("expected HEAD; got " + r.Method) - } - w.Header().Set("Content-Length", "123") - w.WriteHeader(200) - })) - defer ts.Close() - - tr := &Transport{DisableKeepAlives: false} - c := &Client{Transport: tr} - for i := 0; i < 2; i++ { - res, err := c.Head(ts.URL) - if err != nil { - t.Errorf("error on loop %d: %v", i, err) - continue - } - if e, g := "123", res.Header.Get("Content-Length"); e != g { - t.Errorf("loop %d: expected Content-Length header of %q, got %q", i, e, g) - } - if e, g := int64(123), res.ContentLength; e != g { - t.Errorf("loop %d: expected res.ContentLength of %v, got %v", i, e, g) - } - if all, err := ioutil.ReadAll(res.Body); err != nil { - t.Errorf("loop %d: Body ReadAll: %v", i, err) - } else if len(all) != 0 { - t.Errorf("Bogus body %q", all) - } - } -} - -// TestTransportHeadChunkedResponse verifies that we ignore chunked transfer-encoding -// on responses to HEAD requests. -func TestTransportHeadChunkedResponse(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - if r.Method != "HEAD" { - panic("expected HEAD; got " + r.Method) - } - w.Header().Set("Transfer-Encoding", "chunked") // client should ignore - w.Header().Set("x-client-ipport", r.RemoteAddr) - w.WriteHeader(200) - })) - defer ts.Close() - - tr := &Transport{DisableKeepAlives: false} - c := &Client{Transport: tr} - - res1, err := c.Head(ts.URL) - if err != nil { - t.Fatalf("request 1 error: %v", err) - } - res2, err := c.Head(ts.URL) - if err != nil { - t.Fatalf("request 2 error: %v", err) - } - if v1, v2 := res1.Header.Get("x-client-ipport"), res2.Header.Get("x-client-ipport"); v1 != v2 { - t.Errorf("ip/ports differed between head requests: %q vs %q", v1, v2) - } -} - -var roundTripTests = []struct { - accept string - expectAccept string - compressed bool -}{ - // Requests with no accept-encoding header use transparent compression - {"", "gzip", false}, - // Requests with other accept-encoding should pass through unmodified - {"foo", "foo", false}, - // Requests with accept-encoding == gzip should be passed through - {"gzip", "gzip", true}, -} - -// Test that the modification made to the Request by the RoundTripper is cleaned up -func TestRoundTripGzip(t *testing.T) { - defer afterTest(t) - const responseBody = "test response body" - ts := httptest.NewServer(HandlerFunc(func(rw ResponseWriter, req *Request) { - accept := req.Header.Get("Accept-Encoding") - if expect := req.FormValue("expect_accept"); accept != expect { - t.Errorf("in handler, test %v: Accept-Encoding = %q, want %q", - req.FormValue("testnum"), accept, expect) - } - if accept == "gzip" { - rw.Header().Set("Content-Encoding", "gzip") - gz := gzip.NewWriter(rw) - gz.Write([]byte(responseBody)) - gz.Close() - } else { - rw.Header().Set("Content-Encoding", accept) - rw.Write([]byte(responseBody)) - } - })) - defer ts.Close() - - for i, test := range roundTripTests { - // Test basic request (no accept-encoding) - req, _ := NewRequest("GET", fmt.Sprintf("%s/?testnum=%d&expect_accept=%s", ts.URL, i, test.expectAccept), nil) - if test.accept != "" { - req.Header.Set("Accept-Encoding", test.accept) - } - res, err := DefaultTransport.RoundTrip(req) - var body []byte - if test.compressed { - var r *gzip.Reader - r, err = gzip.NewReader(res.Body) - if err != nil { - t.Errorf("%d. gzip NewReader: %v", i, err) - continue - } - body, err = ioutil.ReadAll(r) - res.Body.Close() - } else { - body, err = ioutil.ReadAll(res.Body) - } - if err != nil { - t.Errorf("%d. Error: %q", i, err) - continue - } - if g, e := string(body), responseBody; g != e { - t.Errorf("%d. body = %q; want %q", i, g, e) - } - if g, e := req.Header.Get("Accept-Encoding"), test.accept; g != e { - t.Errorf("%d. Accept-Encoding = %q; want %q (it was mutated, in violation of RoundTrip contract)", i, g, e) - } - if g, e := res.Header.Get("Content-Encoding"), test.accept; g != e { - t.Errorf("%d. Content-Encoding = %q; want %q", i, g, e) - } - } - -} - -func TestTransportGzip(t *testing.T) { - defer afterTest(t) - const testString = "The test string aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - const nRandBytes = 1024 * 1024 - ts := httptest.NewServer(HandlerFunc(func(rw ResponseWriter, req *Request) { - if req.Method == "HEAD" { - if g := req.Header.Get("Accept-Encoding"); g != "" { - t.Errorf("HEAD request sent with Accept-Encoding of %q; want none", g) - } - return - } - if g, e := req.Header.Get("Accept-Encoding"), "gzip"; g != e { - t.Errorf("Accept-Encoding = %q, want %q", g, e) - } - rw.Header().Set("Content-Encoding", "gzip") - - var w io.Writer = rw - var buf bytes.Buffer - if req.FormValue("chunked") == "0" { - w = &buf - defer io.Copy(rw, &buf) - defer func() { - rw.Header().Set("Content-Length", strconv.Itoa(buf.Len())) - }() - } - gz := gzip.NewWriter(w) - gz.Write([]byte(testString)) - if req.FormValue("body") == "large" { - io.CopyN(gz, rand.Reader, nRandBytes) - } - gz.Close() - })) - defer ts.Close() - - for _, chunked := range []string{"1", "0"} { - c := &Client{Transport: &Transport{}} - - // First fetch something large, but only read some of it. - res, err := c.Get(ts.URL + "/?body=large&chunked=" + chunked) - if err != nil { - t.Fatalf("large get: %v", err) - } - buf := make([]byte, len(testString)) - n, err := io.ReadFull(res.Body, buf) - if err != nil { - t.Fatalf("partial read of large response: size=%d, %v", n, err) - } - if e, g := testString, string(buf); e != g { - t.Errorf("partial read got %q, expected %q", g, e) - } - res.Body.Close() - // Read on the body, even though it's closed - n, err = res.Body.Read(buf) - if n != 0 || err == nil { - t.Errorf("expected error post-closed large Read; got = %d, %v", n, err) - } - - // Then something small. - res, err = c.Get(ts.URL + "/?chunked=" + chunked) - if err != nil { - t.Fatal(err) - } - body, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatal(err) - } - if g, e := string(body), testString; g != e { - t.Fatalf("body = %q; want %q", g, e) - } - if g, e := res.Header.Get("Content-Encoding"), ""; g != e { - t.Fatalf("Content-Encoding = %q; want %q", g, e) - } - - // Read on the body after it's been fully read: - n, err = res.Body.Read(buf) - if n != 0 || err == nil { - t.Errorf("expected Read error after exhausted reads; got %d, %v", n, err) - } - res.Body.Close() - n, err = res.Body.Read(buf) - if n != 0 || err == nil { - t.Errorf("expected Read error after Close; got %d, %v", n, err) - } - } - - // And a HEAD request too, because they're always weird. - c := &Client{Transport: &Transport{}} - res, err := c.Head(ts.URL) - if err != nil { - t.Fatalf("Head: %v", err) - } - if res.StatusCode != 200 { - t.Errorf("Head status=%d; want=200", res.StatusCode) - } -} - -func TestTransportProxy(t *testing.T) { - defer afterTest(t) - ch := make(chan string, 1) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - ch <- "real server" - })) - defer ts.Close() - proxy := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - ch <- "proxy for " + r.URL.String() - })) - defer proxy.Close() - - pu, err := url.Parse(proxy.URL) - if err != nil { - t.Fatal(err) - } - c := &Client{Transport: &Transport{Proxy: ProxyURL(pu)}} - c.Head(ts.URL) - got := <-ch - want := "proxy for " + ts.URL + "/" - if got != want { - t.Errorf("want %q, got %q", want, got) - } -} - -// TestTransportGzipRecursive sends a gzip quine and checks that the -// client gets the same value back. This is more cute than anything, -// but checks that we don't recurse forever, and checks that -// Content-Encoding is removed. -func TestTransportGzipRecursive(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - w.Header().Set("Content-Encoding", "gzip") - w.Write(rgz) - })) - defer ts.Close() - - c := &Client{Transport: &Transport{}} - res, err := c.Get(ts.URL) - if err != nil { - t.Fatal(err) - } - body, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatal(err) - } - if !bytes.Equal(body, rgz) { - t.Fatalf("Incorrect result from recursive gz:\nhave=%x\nwant=%x", - body, rgz) - } - if g, e := res.Header.Get("Content-Encoding"), ""; g != e { - t.Fatalf("Content-Encoding = %q; want %q", g, e) - } -} - -// golang.org/issue/7750: request fails when server replies with -// a short gzip body -func TestTransportGzipShort(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - w.Header().Set("Content-Encoding", "gzip") - w.Write([]byte{0x1f, 0x8b}) - })) - defer ts.Close() - - tr := &Transport{} - defer tr.CloseIdleConnections() - c := &Client{Transport: tr} - res, err := c.Get(ts.URL) - if err != nil { - t.Fatal(err) - } - defer res.Body.Close() - _, err = ioutil.ReadAll(res.Body) - if err == nil { - t.Fatal("Expect an error from reading a body.") - } - if err != io.ErrUnexpectedEOF { - t.Errorf("ReadAll error = %v; want io.ErrUnexpectedEOF", err) - } -} - -// tests that persistent goroutine connections shut down when no longer desired. -func TestTransportPersistConnLeak(t *testing.T) { - if runtime.GOOS == "plan9" { - t.Skip("skipping test; see http://golang.org/issue/7237") - } - defer afterTest(t) - gotReqCh := make(chan bool) - unblockCh := make(chan bool) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - gotReqCh <- true - <-unblockCh - w.Header().Set("Content-Length", "0") - w.WriteHeader(204) - })) - defer ts.Close() - - tr := &Transport{} - c := &Client{Transport: tr} - - n0 := runtime.NumGoroutine() - - const numReq = 25 - didReqCh := make(chan bool) - for i := 0; i < numReq; i++ { - go func() { - res, err := c.Get(ts.URL) - didReqCh <- true - if err != nil { - t.Errorf("client fetch error: %v", err) - return - } - res.Body.Close() - }() - } - - // Wait for all goroutines to be stuck in the Handler. - for i := 0; i < numReq; i++ { - <-gotReqCh - } - - nhigh := runtime.NumGoroutine() - - // Tell all handlers to unblock and reply. - for i := 0; i < numReq; i++ { - unblockCh <- true - } - - // Wait for all HTTP clients to be done. - for i := 0; i < numReq; i++ { - <-didReqCh - } - - tr.CloseIdleConnections() - time.Sleep(100 * time.Millisecond) - runtime.GC() - runtime.GC() // even more. - nfinal := runtime.NumGoroutine() - - growth := nfinal - n0 - - // We expect 0 or 1 extra goroutine, empirically. Allow up to 5. - // Previously we were leaking one per numReq. - if int(growth) > 5 { - t.Logf("goroutine growth: %d -> %d -> %d (delta: %d)", n0, nhigh, nfinal, growth) - t.Error("too many new goroutines") - } -} - -// golang.org/issue/4531: Transport leaks goroutines when -// request.ContentLength is explicitly short -func TestTransportPersistConnLeakShortBody(t *testing.T) { - if runtime.GOOS == "plan9" { - t.Skip("skipping test; see http://golang.org/issue/7237") - } - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - })) - defer ts.Close() - - tr := &Transport{} - c := &Client{Transport: tr} - - n0 := runtime.NumGoroutine() - body := []byte("Hello") - for i := 0; i < 20; i++ { - req, err := NewRequest("POST", ts.URL, bytes.NewReader(body)) - if err != nil { - t.Fatal(err) - } - req.ContentLength = int64(len(body) - 2) // explicitly short - _, err = c.Do(req) - if err == nil { - t.Fatal("Expect an error from writing too long of a body.") - } - } - nhigh := runtime.NumGoroutine() - tr.CloseIdleConnections() - time.Sleep(400 * time.Millisecond) - runtime.GC() - nfinal := runtime.NumGoroutine() - - growth := nfinal - n0 - - // We expect 0 or 1 extra goroutine, empirically. Allow up to 5. - // Previously we were leaking one per numReq. - t.Logf("goroutine growth: %d -> %d -> %d (delta: %d)", n0, nhigh, nfinal, growth) - if int(growth) > 5 { - t.Error("too many new goroutines") - } -} - -// This used to crash; http://golang.org/issue/3266 -func TestTransportIdleConnCrash(t *testing.T) { - defer afterTest(t) - tr := &Transport{} - c := &Client{Transport: tr} - - unblockCh := make(chan bool, 1) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - <-unblockCh - tr.CloseIdleConnections() - })) - defer ts.Close() - - didreq := make(chan bool) - go func() { - res, err := c.Get(ts.URL) - if err != nil { - t.Error(err) - } else { - res.Body.Close() // returns idle conn - } - didreq <- true - }() - unblockCh <- true - <-didreq -} - -// Test that the transport doesn't close the TCP connection early, -// before the response body has been read. This was a regression -// which sadly lacked a triggering test. The large response body made -// the old race easier to trigger. -func TestIssue3644(t *testing.T) { - defer afterTest(t) - const numFoos = 5000 - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - w.Header().Set("Connection", "close") - for i := 0; i < numFoos; i++ { - w.Write([]byte("foo ")) - } - })) - defer ts.Close() - tr := &Transport{} - c := &Client{Transport: tr} - res, err := c.Get(ts.URL) - if err != nil { - t.Fatal(err) - } - defer res.Body.Close() - bs, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatal(err) - } - if len(bs) != numFoos*len("foo ") { - t.Errorf("unexpected response length") - } -} - -// Test that a client receives a server's reply, even if the server doesn't read -// the entire request body. -func TestIssue3595(t *testing.T) { - defer afterTest(t) - const deniedMsg = "sorry, denied." - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - Error(w, deniedMsg, StatusUnauthorized) - })) - defer ts.Close() - tr := &Transport{} - c := &Client{Transport: tr} - res, err := c.Post(ts.URL, "application/octet-stream", neverEnding('a')) - if err != nil { - t.Errorf("Post: %v", err) - return - } - got, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatalf("Body ReadAll: %v", err) - } - if !strings.Contains(string(got), deniedMsg) { - t.Errorf("Known bug: response %q does not contain %q", got, deniedMsg) - } -} - -// From http://golang.org/issue/4454 , -// "client fails to handle requests with no body and chunked encoding" -func TestChunkedNoContent(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - w.WriteHeader(StatusNoContent) - })) - defer ts.Close() - - for _, closeBody := range []bool{true, false} { - c := &Client{Transport: &Transport{}} - const n = 4 - for i := 1; i <= n; i++ { - res, err := c.Get(ts.URL) - if err != nil { - t.Errorf("closingBody=%v, req %d/%d: %v", closeBody, i, n, err) - } else { - if closeBody { - res.Body.Close() - } - } - } - } -} - -func TestTransportConcurrency(t *testing.T) { - defer afterTest(t) - maxProcs, numReqs := 16, 500 - if testing.Short() { - maxProcs, numReqs = 4, 50 - } - defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(maxProcs)) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - fmt.Fprintf(w, "%v", r.FormValue("echo")) - })) - defer ts.Close() - - var wg sync.WaitGroup - wg.Add(numReqs) - - tr := &Transport{ - Dial: func(netw, addr string) (c net.Conn, err error) { - // Due to the Transport's "socket late - // binding" (see idleConnCh in transport.go), - // the numReqs HTTP requests below can finish - // with a dial still outstanding. So count - // our dials as work too so the leak checker - // doesn't complain at us. - wg.Add(1) - defer wg.Done() - return net.Dial(netw, addr) - }, - } - defer tr.CloseIdleConnections() - c := &Client{Transport: tr} - reqs := make(chan string) - defer close(reqs) - - for i := 0; i < maxProcs*2; i++ { - go func() { - for req := range reqs { - res, err := c.Get(ts.URL + "/?echo=" + req) - if err != nil { - t.Errorf("error on req %s: %v", req, err) - wg.Done() - continue - } - all, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Errorf("read error on req %s: %v", req, err) - wg.Done() - continue - } - if string(all) != req { - t.Errorf("body of req %s = %q; want %q", req, all, req) - } - res.Body.Close() - wg.Done() - } - }() - } - for i := 0; i < numReqs; i++ { - reqs <- fmt.Sprintf("request-%d", i) - } - wg.Wait() -} - -func TestIssue4191_InfiniteGetTimeout(t *testing.T) { - if runtime.GOOS == "plan9" { - t.Skip("skipping test; see http://golang.org/issue/7237") - } - defer afterTest(t) - const debug = false - mux := NewServeMux() - mux.HandleFunc("/get", func(w ResponseWriter, r *Request) { - io.Copy(w, neverEnding('a')) - }) - ts := httptest.NewServer(mux) - timeout := 100 * time.Millisecond - - client := &Client{ - Transport: &Transport{ - Dial: func(n, addr string) (net.Conn, error) { - conn, err := net.Dial(n, addr) - if err != nil { - return nil, err - } - conn.SetDeadline(time.Now().Add(timeout)) - if debug { - conn = NewLoggingConn("client", conn) - } - return conn, nil - }, - DisableKeepAlives: true, - }, - } - - getFailed := false - nRuns := 5 - if testing.Short() { - nRuns = 1 - } - for i := 0; i < nRuns; i++ { - if debug { - println("run", i+1, "of", nRuns) - } - sres, err := client.Get(ts.URL + "/get") - if err != nil { - if !getFailed { - // Make the timeout longer, once. - getFailed = true - t.Logf("increasing timeout") - i-- - timeout *= 10 - continue - } - t.Errorf("Error issuing GET: %v", err) - break - } - _, err = io.Copy(ioutil.Discard, sres.Body) - if err == nil { - t.Errorf("Unexpected successful copy") - break - } - } - if debug { - println("tests complete; waiting for handlers to finish") - } - ts.Close() -} - -func TestIssue4191_InfiniteGetToPutTimeout(t *testing.T) { - if runtime.GOOS == "plan9" { - t.Skip("skipping test; see http://golang.org/issue/7237") - } - defer afterTest(t) - const debug = false - mux := NewServeMux() - mux.HandleFunc("/get", func(w ResponseWriter, r *Request) { - io.Copy(w, neverEnding('a')) - }) - mux.HandleFunc("/put", func(w ResponseWriter, r *Request) { - defer r.Body.Close() - io.Copy(ioutil.Discard, r.Body) - }) - ts := httptest.NewServer(mux) - timeout := 100 * time.Millisecond - - client := &Client{ - Transport: &Transport{ - Dial: func(n, addr string) (net.Conn, error) { - conn, err := net.Dial(n, addr) - if err != nil { - return nil, err - } - conn.SetDeadline(time.Now().Add(timeout)) - if debug { - conn = NewLoggingConn("client", conn) - } - return conn, nil - }, - DisableKeepAlives: true, - }, - } - - getFailed := false - nRuns := 5 - if testing.Short() { - nRuns = 1 - } - for i := 0; i < nRuns; i++ { - if debug { - println("run", i+1, "of", nRuns) - } - sres, err := client.Get(ts.URL + "/get") - if err != nil { - if !getFailed { - // Make the timeout longer, once. - getFailed = true - t.Logf("increasing timeout") - i-- - timeout *= 10 - continue - } - t.Errorf("Error issuing GET: %v", err) - break - } - req, _ := NewRequest("PUT", ts.URL+"/put", sres.Body) - _, err = client.Do(req) - if err == nil { - sres.Body.Close() - t.Errorf("Unexpected successful PUT") - break - } - sres.Body.Close() - } - if debug { - println("tests complete; waiting for handlers to finish") - } - ts.Close() -} - -func TestTransportResponseHeaderTimeout(t *testing.T) { - defer afterTest(t) - if testing.Short() { - t.Skip("skipping timeout test in -short mode") - } - inHandler := make(chan bool, 1) - mux := NewServeMux() - mux.HandleFunc("/fast", func(w ResponseWriter, r *Request) { - inHandler <- true - }) - mux.HandleFunc("/slow", func(w ResponseWriter, r *Request) { - inHandler <- true - time.Sleep(2 * time.Second) - }) - ts := httptest.NewServer(mux) - defer ts.Close() - - tr := &Transport{ - ResponseHeaderTimeout: 500 * time.Millisecond, - } - defer tr.CloseIdleConnections() - c := &Client{Transport: tr} - - tests := []struct { - path string - want int - wantErr string - }{ - {path: "/fast", want: 200}, - {path: "/slow", wantErr: "timeout awaiting response headers"}, - {path: "/fast", want: 200}, - } - for i, tt := range tests { - res, err := c.Get(ts.URL + tt.path) - select { - case <-inHandler: - case <-time.After(5 * time.Second): - t.Errorf("never entered handler for test index %d, %s", i, tt.path) - continue - } - if err != nil { - uerr, ok := err.(*url.Error) - if !ok { - t.Errorf("error is not an url.Error; got: %#v", err) - continue - } - nerr, ok := uerr.Err.(net.Error) - if !ok { - t.Errorf("error does not satisfy net.Error interface; got: %#v", err) - continue - } - if !nerr.Timeout() { - t.Errorf("want timeout error; got: %q", nerr) - continue - } - if strings.Contains(err.Error(), tt.wantErr) { - continue - } - t.Errorf("%d. unexpected error: %v", i, err) - continue - } - if tt.wantErr != "" { - t.Errorf("%d. no error. expected error: %v", i, tt.wantErr) - continue - } - if res.StatusCode != tt.want { - t.Errorf("%d for path %q status = %d; want %d", i, tt.path, res.StatusCode, tt.want) - } - } -} - -func TestTransportCancelRequest(t *testing.T) { - defer afterTest(t) - if testing.Short() { - t.Skip("skipping test in -short mode") - } - unblockc := make(chan bool) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - fmt.Fprintf(w, "Hello") - w.(Flusher).Flush() // send headers and some body - <-unblockc - })) - defer ts.Close() - defer close(unblockc) - - tr := &Transport{} - defer tr.CloseIdleConnections() - c := &Client{Transport: tr} - - req, _ := NewRequest("GET", ts.URL, nil) - res, err := c.Do(req) - if err != nil { - t.Fatal(err) - } - go func() { - time.Sleep(1 * time.Second) - tr.CancelRequest(req) - }() - t0 := time.Now() - body, err := ioutil.ReadAll(res.Body) - d := time.Since(t0) - - if err == nil { - t.Error("expected an error reading the body") - } - if string(body) != "Hello" { - t.Errorf("Body = %q; want Hello", body) - } - if d < 500*time.Millisecond { - t.Errorf("expected ~1 second delay; got %v", d) - } - // Verify no outstanding requests after readLoop/writeLoop - // goroutines shut down. - for tries := 3; tries > 0; tries-- { - n := tr.NumPendingRequestsForTesting() - if n == 0 { - break - } - time.Sleep(100 * time.Millisecond) - if tries == 1 { - t.Errorf("pending requests = %d; want 0", n) - } - } -} - -func TestTransportCancelRequestInDial(t *testing.T) { - defer afterTest(t) - if testing.Short() { - t.Skip("skipping test in -short mode") - } - var logbuf bytes.Buffer - eventLog := log.New(&logbuf, "", 0) - - unblockDial := make(chan bool) - defer close(unblockDial) - - inDial := make(chan bool) - tr := &Transport{ - Dial: func(network, addr string) (net.Conn, error) { - eventLog.Println("dial: blocking") - inDial <- true - <-unblockDial - return nil, errors.New("nope") - }, - } - cl := &Client{Transport: tr} - gotres := make(chan bool) - req, _ := NewRequest("GET", "http://something.no-network.tld/", nil) - go func() { - _, err := cl.Do(req) - eventLog.Printf("Get = %v", err) - gotres <- true - }() - - select { - case <-inDial: - case <-time.After(5 * time.Second): - t.Fatal("timeout; never saw blocking dial") - } - - eventLog.Printf("canceling") - tr.CancelRequest(req) - - select { - case <-gotres: - case <-time.After(5 * time.Second): - panic("hang. events are: " + logbuf.String()) - } - - got := logbuf.String() - want := `dial: blocking -canceling -Get = Get http://something.no-network.tld/: net/http: request canceled while waiting for connection -` - if got != want { - t.Errorf("Got events:\n%s\nWant:\n%s", got, want) - } -} - -// golang.org/issue/3672 -- Client can't close HTTP stream -// Calling Close on a Response.Body used to just read until EOF. -// Now it actually closes the TCP connection. -func TestTransportCloseResponseBody(t *testing.T) { - defer afterTest(t) - writeErr := make(chan error, 1) - msg := []byte("young\n") - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - for { - _, err := w.Write(msg) - if err != nil { - writeErr <- err - return - } - w.(Flusher).Flush() - } - })) - defer ts.Close() - - tr := &Transport{} - defer tr.CloseIdleConnections() - c := &Client{Transport: tr} - - req, _ := NewRequest("GET", ts.URL, nil) - defer tr.CancelRequest(req) - - res, err := c.Do(req) - if err != nil { - t.Fatal(err) - } - - const repeats = 3 - buf := make([]byte, len(msg)*repeats) - want := bytes.Repeat(msg, repeats) - - _, err = io.ReadFull(res.Body, buf) - if err != nil { - t.Fatal(err) - } - if !bytes.Equal(buf, want) { - t.Fatalf("read %q; want %q", buf, want) - } - didClose := make(chan error, 1) - go func() { - didClose <- res.Body.Close() - }() - select { - case err := <-didClose: - if err != nil { - t.Errorf("Close = %v", err) - } - case <-time.After(10 * time.Second): - t.Fatal("too long waiting for close") - } - select { - case err := <-writeErr: - if err == nil { - t.Errorf("expected non-nil write error") - } - case <-time.After(10 * time.Second): - t.Fatal("too long waiting for write error") - } -} - -type fooProto struct{} - -func (fooProto) RoundTrip(req *Request) (*Response, error) { - res := &Response{ - Status: "200 OK", - StatusCode: 200, - Header: make(Header), - Body: ioutil.NopCloser(strings.NewReader("You wanted " + req.URL.String())), - } - return res, nil -} - -func TestTransportAltProto(t *testing.T) { - defer afterTest(t) - tr := &Transport{} - c := &Client{Transport: tr} - tr.RegisterProtocol("foo", fooProto{}) - res, err := c.Get("foo://bar.com/path") - if err != nil { - t.Fatal(err) - } - bodyb, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatal(err) - } - body := string(bodyb) - if e := "You wanted foo://bar.com/path"; body != e { - t.Errorf("got response %q, want %q", body, e) - } -} - -func TestTransportNoHost(t *testing.T) { - defer afterTest(t) - tr := &Transport{} - _, err := tr.RoundTrip(&Request{ - Header: make(Header), - URL: &url.URL{ - Scheme: "http", - }, - }) - want := "http: no Host in request URL" - if got := fmt.Sprint(err); got != want { - t.Errorf("error = %v; want %q", err, want) - } -} - -func TestTransportSocketLateBinding(t *testing.T) { - defer afterTest(t) - - mux := NewServeMux() - fooGate := make(chan bool, 1) - mux.HandleFunc("/foo", func(w ResponseWriter, r *Request) { - w.Header().Set("foo-ipport", r.RemoteAddr) - w.(Flusher).Flush() - <-fooGate - }) - mux.HandleFunc("/bar", func(w ResponseWriter, r *Request) { - w.Header().Set("bar-ipport", r.RemoteAddr) - }) - ts := httptest.NewServer(mux) - defer ts.Close() - - dialGate := make(chan bool, 1) - tr := &Transport{ - Dial: func(n, addr string) (net.Conn, error) { - if <-dialGate { - return net.Dial(n, addr) - } - return nil, errors.New("manually closed") - }, - DisableKeepAlives: false, - } - defer tr.CloseIdleConnections() - c := &Client{ - Transport: tr, - } - - dialGate <- true // only allow one dial - fooRes, err := c.Get(ts.URL + "/foo") - if err != nil { - t.Fatal(err) - } - fooAddr := fooRes.Header.Get("foo-ipport") - if fooAddr == "" { - t.Fatal("No addr on /foo request") - } - time.AfterFunc(200*time.Millisecond, func() { - // let the foo response finish so we can use its - // connection for /bar - fooGate <- true - io.Copy(ioutil.Discard, fooRes.Body) - fooRes.Body.Close() - }) - - barRes, err := c.Get(ts.URL + "/bar") - if err != nil { - t.Fatal(err) - } - barAddr := barRes.Header.Get("bar-ipport") - if barAddr != fooAddr { - t.Fatalf("/foo came from conn %q; /bar came from %q instead", fooAddr, barAddr) - } - barRes.Body.Close() - dialGate <- false -} - -// Issue 2184 -func TestTransportReading100Continue(t *testing.T) { - defer afterTest(t) - - const numReqs = 5 - reqBody := func(n int) string { return fmt.Sprintf("request body %d", n) } - reqID := func(n int) string { return fmt.Sprintf("REQ-ID-%d", n) } - - send100Response := func(w *io.PipeWriter, r *io.PipeReader) { - defer w.Close() - defer r.Close() - br := bufio.NewReader(r) - n := 0 - for { - n++ - req, err := ReadRequest(br) - if err == io.EOF { - return - } - if err != nil { - t.Error(err) - return - } - slurp, err := ioutil.ReadAll(req.Body) - if err != nil { - t.Errorf("Server request body slurp: %v", err) - return - } - id := req.Header.Get("Request-Id") - resCode := req.Header.Get("X-Want-Response-Code") - if resCode == "" { - resCode = "100 Continue" - if string(slurp) != reqBody(n) { - t.Errorf("Server got %q, %v; want %q", slurp, err, reqBody(n)) - } - } - body := fmt.Sprintf("Response number %d", n) - v := []byte(strings.Replace(fmt.Sprintf(`HTTP/1.1 %s -Date: Thu, 28 Feb 2013 17:55:41 GMT - -HTTP/1.1 200 OK -Content-Type: text/html -Echo-Request-Id: %s -Content-Length: %d - -%s`, resCode, id, len(body), body), "\n", "\r\n", -1)) - w.Write(v) - if id == reqID(numReqs) { - return - } - } - - } - - tr := &Transport{ - Dial: func(n, addr string) (net.Conn, error) { - sr, sw := io.Pipe() // server read/write - cr, cw := io.Pipe() // client read/write - conn := &rwTestConn{ - Reader: cr, - Writer: sw, - closeFunc: func() error { - sw.Close() - cw.Close() - return nil - }, - } - go send100Response(cw, sr) - return conn, nil - }, - DisableKeepAlives: false, - } - defer tr.CloseIdleConnections() - c := &Client{Transport: tr} - - testResponse := func(req *Request, name string, wantCode int) { - res, err := c.Do(req) - if err != nil { - t.Fatalf("%s: Do: %v", name, err) - } - if res.StatusCode != wantCode { - t.Fatalf("%s: Response Statuscode=%d; want %d", name, res.StatusCode, wantCode) - } - if id, idBack := req.Header.Get("Request-Id"), res.Header.Get("Echo-Request-Id"); id != "" && id != idBack { - t.Errorf("%s: response id %q != request id %q", name, idBack, id) - } - _, err = ioutil.ReadAll(res.Body) - if err != nil { - t.Fatalf("%s: Slurp error: %v", name, err) - } - } - - // Few 100 responses, making sure we're not off-by-one. - for i := 1; i <= numReqs; i++ { - req, _ := NewRequest("POST", "http://dummy.tld/", strings.NewReader(reqBody(i))) - req.Header.Set("Request-Id", reqID(i)) - testResponse(req, fmt.Sprintf("100, %d/%d", i, numReqs), 200) - } - - // And some other informational 1xx but non-100 responses, to test - // we return them but don't re-use the connection. - for i := 1; i <= numReqs; i++ { - req, _ := NewRequest("POST", "http://other.tld/", strings.NewReader(reqBody(i))) - req.Header.Set("X-Want-Response-Code", "123 Sesame Street") - testResponse(req, fmt.Sprintf("123, %d/%d", i, numReqs), 123) - } -} - -type proxyFromEnvTest struct { - req string // URL to fetch; blank means "http://example.com" - env string - noenv string - want string - wanterr error -} - -func (t proxyFromEnvTest) String() string { - var buf bytes.Buffer - if t.env != "" { - fmt.Fprintf(&buf, "http_proxy=%q", t.env) - } - if t.noenv != "" { - fmt.Fprintf(&buf, " no_proxy=%q", t.noenv) - } - req := "http://example.com" - if t.req != "" { - req = t.req - } - fmt.Fprintf(&buf, " req=%q", req) - return strings.TrimSpace(buf.String()) -} - -var proxyFromEnvTests = []proxyFromEnvTest{ - {env: "127.0.0.1:8080", want: "http://127.0.0.1:8080"}, - {env: "cache.corp.example.com:1234", want: "http://cache.corp.example.com:1234"}, - {env: "cache.corp.example.com", want: "http://cache.corp.example.com"}, - {env: "https://cache.corp.example.com", want: "https://cache.corp.example.com"}, - {env: "http://127.0.0.1:8080", want: "http://127.0.0.1:8080"}, - {env: "https://127.0.0.1:8080", want: "https://127.0.0.1:8080"}, - {want: ""}, - {noenv: "example.com", req: "http://example.com/", env: "proxy", want: ""}, - {noenv: ".example.com", req: "http://example.com/", env: "proxy", want: ""}, - {noenv: "ample.com", req: "http://example.com/", env: "proxy", want: "http://proxy"}, - {noenv: "example.com", req: "http://foo.example.com/", env: "proxy", want: ""}, - {noenv: ".foo.com", req: "http://example.com/", env: "proxy", want: "http://proxy"}, -} - -func TestProxyFromEnvironment(t *testing.T) { - ResetProxyEnv() - for _, tt := range proxyFromEnvTests { - os.Setenv("HTTP_PROXY", tt.env) - os.Setenv("NO_PROXY", tt.noenv) - ResetCachedEnvironment() - reqURL := tt.req - if reqURL == "" { - reqURL = "http://example.com" - } - req, _ := NewRequest("GET", reqURL, nil) - url, err := ProxyFromEnvironment(req) - if g, e := fmt.Sprintf("%v", err), fmt.Sprintf("%v", tt.wanterr); g != e { - t.Errorf("%v: got error = %q, want %q", tt, g, e) - continue - } - if got := fmt.Sprintf("%s", url); got != tt.want { - t.Errorf("%v: got URL = %q, want %q", tt, url, tt.want) - } - } -} - -func TestIdleConnChannelLeak(t *testing.T) { - var mu sync.Mutex - var n int - - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - mu.Lock() - n++ - mu.Unlock() - })) - defer ts.Close() - - tr := &Transport{ - Dial: func(netw, addr string) (net.Conn, error) { - return net.Dial(netw, ts.Listener.Addr().String()) - }, - } - defer tr.CloseIdleConnections() - - c := &Client{Transport: tr} - - // First, without keep-alives. - for _, disableKeep := range []bool{true, false} { - tr.DisableKeepAlives = disableKeep - for i := 0; i < 5; i++ { - _, err := c.Get(fmt.Sprintf("http://foo-host-%d.tld/", i)) - if err != nil { - t.Fatal(err) - } - } - if got := tr.IdleConnChMapSizeForTesting(); got != 0 { - t.Fatalf("ForDisableKeepAlives = %v, map size = %d; want 0", disableKeep, got) - } - } -} - -// Verify the status quo: that the Client.Post function coerces its -// body into a ReadCloser if it's a Closer, and that the Transport -// then closes it. -func TestTransportClosesRequestBody(t *testing.T) { - defer afterTest(t) - ts := httptest.NewServer(http.HandlerFunc(func(w ResponseWriter, r *Request) { - io.Copy(ioutil.Discard, r.Body) - })) - defer ts.Close() - - tr := &Transport{} - defer tr.CloseIdleConnections() - cl := &Client{Transport: tr} - - closes := 0 - - res, err := cl.Post(ts.URL, "text/plain", countCloseReader{&closes, strings.NewReader("hello")}) - if err != nil { - t.Fatal(err) - } - res.Body.Close() - if closes != 1 { - t.Errorf("closes = %d; want 1", closes) - } -} - -func TestTransportTLSHandshakeTimeout(t *testing.T) { - defer afterTest(t) - if testing.Short() { - t.Skip("skipping in short mode") - } - ln := newLocalListener(t) - defer ln.Close() - testdonec := make(chan struct{}) - defer close(testdonec) - - go func() { - c, err := ln.Accept() - if err != nil { - t.Error(err) - return - } - <-testdonec - c.Close() - }() - - getdonec := make(chan struct{}) - go func() { - defer close(getdonec) - tr := &Transport{ - Dial: func(_, _ string) (net.Conn, error) { - return net.Dial("tcp", ln.Addr().String()) - }, - TLSHandshakeTimeout: 250 * time.Millisecond, - } - cl := &Client{Transport: tr} - _, err := cl.Get("https://dummy.tld/") - if err == nil { - t.Error("expected error") - return - } - ue, ok := err.(*url.Error) - if !ok { - t.Errorf("expected url.Error; got %#v", err) - return - } - ne, ok := ue.Err.(net.Error) - if !ok { - t.Errorf("expected net.Error; got %#v", err) - return - } - if !ne.Timeout() { - t.Errorf("expected timeout error; got %v", err) - } - if !strings.Contains(err.Error(), "handshake timeout") { - t.Errorf("expected 'handshake timeout' in error; got %v", err) - } - }() - select { - case <-getdonec: - case <-time.After(5 * time.Second): - t.Error("test timeout; TLS handshake hung?") - } -} - -// Trying to repro golang.org/issue/3514 -func TestTLSServerClosesConnection(t *testing.T) { - defer afterTest(t) - if runtime.GOOS == "windows" { - t.Skip("skipping flaky test on Windows; golang.org/issue/7634") - } - closedc := make(chan bool, 1) - ts := httptest.NewTLSServer(HandlerFunc(func(w ResponseWriter, r *Request) { - if strings.Contains(r.URL.Path, "/keep-alive-then-die") { - conn, _, _ := w.(Hijacker).Hijack() - conn.Write([]byte("HTTP/1.1 200 OK\r\nContent-Length: 3\r\n\r\nfoo")) - conn.Close() - closedc <- true - return - } - fmt.Fprintf(w, "hello") - })) - defer ts.Close() - tr := &Transport{ - TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true, - }, - } - defer tr.CloseIdleConnections() - client := &Client{Transport: tr} - - var nSuccess = 0 - var errs []error - const trials = 20 - for i := 0; i < trials; i++ { - tr.CloseIdleConnections() - res, err := client.Get(ts.URL + "/keep-alive-then-die") - if err != nil { - t.Fatal(err) - } - <-closedc - slurp, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatal(err) - } - if string(slurp) != "foo" { - t.Errorf("Got %q, want foo", slurp) - } - - // Now try again and see if we successfully - // pick a new connection. - res, err = client.Get(ts.URL + "/") - if err != nil { - errs = append(errs, err) - continue - } - slurp, err = ioutil.ReadAll(res.Body) - if err != nil { - errs = append(errs, err) - continue - } - nSuccess++ - } - if nSuccess > 0 { - t.Logf("successes = %d of %d", nSuccess, trials) - } else { - t.Errorf("All runs failed:") - } - for _, err := range errs { - t.Logf(" err: %v", err) - } -} - -// byteFromChanReader is an io.Reader that reads a single byte at a -// time from the channel. When the channel is closed, the reader -// returns io.EOF. -type byteFromChanReader chan byte - -func (c byteFromChanReader) Read(p []byte) (n int, err error) { - if len(p) == 0 { - return - } - b, ok := <-c - if !ok { - return 0, io.EOF - } - p[0] = b - return 1, nil -} - -// Verifies that the Transport doesn't reuse a connection in the case -// where the server replies before the request has been fully -// written. We still honor that reply (see TestIssue3595), but don't -// send future requests on the connection because it's then in a -// questionable state. -// golang.org/issue/7569 -func TestTransportNoReuseAfterEarlyResponse(t *testing.T) { - defer afterTest(t) - var sconn struct { - sync.Mutex - c net.Conn - } - var getOkay bool - closeConn := func() { - sconn.Lock() - defer sconn.Unlock() - if sconn.c != nil { - sconn.c.Close() - sconn.c = nil - if !getOkay { - t.Logf("Closed server connection") - } - } - } - defer closeConn() - - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - if r.Method == "GET" { - io.WriteString(w, "bar") - return - } - conn, _, _ := w.(Hijacker).Hijack() - sconn.Lock() - sconn.c = conn - sconn.Unlock() - conn.Write([]byte("HTTP/1.1 200 OK\r\nContent-Length: 3\r\n\r\nfoo")) // keep-alive - go io.Copy(ioutil.Discard, conn) - })) - defer ts.Close() - tr := &Transport{} - defer tr.CloseIdleConnections() - client := &Client{Transport: tr} - - const bodySize = 256 << 10 - finalBit := make(byteFromChanReader, 1) - req, _ := NewRequest("POST", ts.URL, io.MultiReader(io.LimitReader(neverEnding('x'), bodySize-1), finalBit)) - req.ContentLength = bodySize - res, err := client.Do(req) - if err := wantBody(res, err, "foo"); err != nil { - t.Errorf("POST response: %v", err) - } - donec := make(chan bool) - go func() { - defer close(donec) - res, err = client.Get(ts.URL) - if err := wantBody(res, err, "bar"); err != nil { - t.Errorf("GET response: %v", err) - return - } - getOkay = true // suppress test noise - }() - time.AfterFunc(5*time.Second, closeConn) - select { - case <-donec: - finalBit <- 'x' // unblock the writeloop of the first Post - close(finalBit) - case <-time.After(7 * time.Second): - t.Fatal("timeout waiting for GET request to finish") - } -} - -type errorReader struct { - err error -} - -func (e errorReader) Read(p []byte) (int, error) { return 0, e.err } - -type closerFunc func() error - -func (f closerFunc) Close() error { return f() } - -// Issue 6981 -func TestTransportClosesBodyOnError(t *testing.T) { - if runtime.GOOS == "plan9" { - t.Skip("skipping test; see http://golang.org/issue/7782") - } - defer afterTest(t) - readBody := make(chan error, 1) - ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { - _, err := ioutil.ReadAll(r.Body) - readBody <- err - })) - defer ts.Close() - fakeErr := errors.New("fake error") - didClose := make(chan bool, 1) - req, _ := NewRequest("POST", ts.URL, struct { - io.Reader - io.Closer - }{ - io.MultiReader(io.LimitReader(neverEnding('x'), 1<<20), errorReader{fakeErr}), - closerFunc(func() error { - select { - case didClose <- true: - default: - } - return nil - }), - }) - res, err := DefaultClient.Do(req) - if res != nil { - defer res.Body.Close() - } - if err == nil || !strings.Contains(err.Error(), fakeErr.Error()) { - t.Fatalf("Do error = %v; want something containing %q", err, fakeErr.Error()) - } - select { - case err := <-readBody: - if err == nil { - t.Errorf("Unexpected success reading request body from handler; want 'unexpected EOF reading trailer'") - } - case <-time.After(5 * time.Second): - t.Error("timeout waiting for server handler to complete") - } - select { - case <-didClose: - default: - t.Errorf("didn't see Body.Close") - } -} - -func wantBody(res *http.Response, err error, want string) error { - if err != nil { - return err - } - slurp, err := ioutil.ReadAll(res.Body) - if err != nil { - return fmt.Errorf("error reading body: %v", err) - } - if string(slurp) != want { - return fmt.Errorf("body = %q; want %q", slurp, want) - } - if err := res.Body.Close(); err != nil { - return fmt.Errorf("body Close = %v", err) - } - return nil -} - -func newLocalListener(t *testing.T) net.Listener { - ln, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - ln, err = net.Listen("tcp6", "[::1]:0") - } - if err != nil { - t.Fatal(err) - } - return ln -} - -type countCloseReader struct { - n *int - io.Reader -} - -func (cr countCloseReader) Close() error { - (*cr.n)++ - return nil -} - -// rgz is a gzip quine that uncompresses to itself. -var rgz = []byte{ - 0x1f, 0x8b, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, - 0x69, 0x76, 0x65, 0x00, 0x92, 0xef, 0xe6, 0xe0, - 0x60, 0x00, 0x83, 0xa2, 0xd4, 0xe4, 0xd2, 0xa2, - 0xe2, 0xcc, 0xb2, 0x54, 0x06, 0x00, 0x00, 0x17, - 0x00, 0xe8, 0xff, 0x92, 0xef, 0xe6, 0xe0, 0x60, - 0x00, 0x83, 0xa2, 0xd4, 0xe4, 0xd2, 0xa2, 0xe2, - 0xcc, 0xb2, 0x54, 0x06, 0x00, 0x00, 0x17, 0x00, - 0xe8, 0xff, 0x42, 0x12, 0x46, 0x16, 0x06, 0x00, - 0x05, 0x00, 0xfa, 0xff, 0x42, 0x12, 0x46, 0x16, - 0x06, 0x00, 0x05, 0x00, 0xfa, 0xff, 0x00, 0x05, - 0x00, 0xfa, 0xff, 0x00, 0x14, 0x00, 0xeb, 0xff, - 0x42, 0x12, 0x46, 0x16, 0x06, 0x00, 0x05, 0x00, - 0xfa, 0xff, 0x00, 0x05, 0x00, 0xfa, 0xff, 0x00, - 0x14, 0x00, 0xeb, 0xff, 0x42, 0x88, 0x21, 0xc4, - 0x00, 0x00, 0x14, 0x00, 0xeb, 0xff, 0x42, 0x88, - 0x21, 0xc4, 0x00, 0x00, 0x14, 0x00, 0xeb, 0xff, - 0x42, 0x88, 0x21, 0xc4, 0x00, 0x00, 0x14, 0x00, - 0xeb, 0xff, 0x42, 0x88, 0x21, 0xc4, 0x00, 0x00, - 0x14, 0x00, 0xeb, 0xff, 0x42, 0x88, 0x21, 0xc4, - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x00, 0x17, 0x00, 0xe8, 0xff, - 0x42, 0x88, 0x21, 0xc4, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, - 0x17, 0x00, 0xe8, 0xff, 0x42, 0x12, 0x46, 0x16, - 0x06, 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0x08, - 0x00, 0xf7, 0xff, 0x3d, 0xb1, 0x20, 0x85, 0xfa, - 0x00, 0x00, 0x00, 0x42, 0x12, 0x46, 0x16, 0x06, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0x08, 0x00, - 0xf7, 0xff, 0x3d, 0xb1, 0x20, 0x85, 0xfa, 0x00, - 0x00, 0x00, 0x3d, 0xb1, 0x20, 0x85, 0xfa, 0x00, - 0x00, 0x00, -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/http/z_last_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/http/z_last_test.go deleted file mode 100644 index 5a0cc11984..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/http/z_last_test.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http_test - -import ( - "net/http" - "runtime" - "sort" - "strings" - "testing" - "time" -) - -func interestingGoroutines() (gs []string) { - buf := make([]byte, 2<<20) - buf = buf[:runtime.Stack(buf, true)] - for _, g := range strings.Split(string(buf), "\n\n") { - sl := strings.SplitN(g, "\n", 2) - if len(sl) != 2 { - continue - } - stack := strings.TrimSpace(sl[1]) - if stack == "" || - strings.Contains(stack, "created by net.startServer") || - strings.Contains(stack, "created by testing.RunTests") || - strings.Contains(stack, "closeWriteAndWait") || - strings.Contains(stack, "testing.Main(") || - // These only show up with GOTRACEBACK=2; Issue 5005 (comment 28) - strings.Contains(stack, "runtime.goexit") || - strings.Contains(stack, "created by runtime.gc") || - strings.Contains(stack, "runtime.MHeap_Scavenger") { - continue - } - gs = append(gs, stack) - } - sort.Strings(gs) - return -} - -// Verify the other tests didn't leave any goroutines running. -// This is in a file named z_last_test.go so it sorts at the end. -func TestGoroutinesRunning(t *testing.T) { - if testing.Short() { - t.Skip("not counting goroutines for leakage in -short mode") - } - gs := interestingGoroutines() - - n := 0 - stackCount := make(map[string]int) - for _, g := range gs { - stackCount[g]++ - n++ - } - - t.Logf("num goroutines = %d", n) - if n > 0 { - t.Error("Too many goroutines.") - for stack, count := range stackCount { - t.Logf("%d instances of:\n%s", count, stack) - } - } -} - -func afterTest(t *testing.T) { - http.DefaultTransport.(*http.Transport).CloseIdleConnections() - if testing.Short() { - return - } - var bad string - badSubstring := map[string]string{ - ").readLoop(": "a Transport", - ").writeLoop(": "a Transport", - "created by net/http/httptest.(*Server).Start": "an httptest.Server", - "timeoutHandler": "a TimeoutHandler", - "net.(*netFD).connect(": "a timing out dial", - ").noteClientGone(": "a closenotifier sender", - } - var stacks string - for i := 0; i < 4; i++ { - bad = "" - stacks = strings.Join(interestingGoroutines(), "\n\n") - for substr, what := range badSubstring { - if strings.Contains(stacks, substr) { - bad = what - } - } - if bad == "" { - return - } - // Bad stuff found, but goroutines might just still be - // shutting down, so give it some time. - time.Sleep(250 * time.Millisecond) - } - t.Errorf("Test appears to have leaked %s:\n%s", bad, stacks) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/tls/conn_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/tls/conn_test.go deleted file mode 100644 index 5c555147ca..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/tls/conn_test.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "testing" -) - -func TestRoundUp(t *testing.T) { - if roundUp(0, 16) != 0 || - roundUp(1, 16) != 16 || - roundUp(15, 16) != 16 || - roundUp(16, 16) != 16 || - roundUp(17, 16) != 32 { - t.Error("roundUp broken") - } -} - -var paddingTests = []struct { - in []byte - good bool - expectedLen int -}{ - {[]byte{1, 2, 3, 4, 0}, true, 4}, - {[]byte{1, 2, 3, 4, 0, 1}, false, 0}, - {[]byte{1, 2, 3, 4, 99, 99}, false, 0}, - {[]byte{1, 2, 3, 4, 1, 1}, true, 4}, - {[]byte{1, 2, 3, 2, 2, 2}, true, 3}, - {[]byte{1, 2, 3, 3, 3, 3}, true, 2}, - {[]byte{1, 2, 3, 4, 3, 3}, false, 0}, - {[]byte{1, 4, 4, 4, 4, 4}, true, 1}, - {[]byte{5, 5, 5, 5, 5, 5}, true, 0}, - {[]byte{6, 6, 6, 6, 6, 6}, false, 0}, -} - -func TestRemovePadding(t *testing.T) { - for i, test := range paddingTests { - payload, good := removePadding(test.in) - expectedGood := byte(255) - if !test.good { - expectedGood = 0 - } - if good != expectedGood { - t.Errorf("#%d: wrong validity, want:%d got:%d", i, expectedGood, good) - } - if good == 255 && len(payload) != test.expectedLen { - t.Errorf("#%d: got %d, want %d", i, len(payload), test.expectedLen) - } - } -} - -var certExampleCom = `308201403081eda003020102020101300b06092a864886f70d010105301e311c301a060355040a131354657374696e67204365727469666963617465301e170d3131313030313138353835325a170d3132303933303138353835325a301e311c301a060355040a131354657374696e67204365727469666963617465305a300b06092a864886f70d010101034b003048024100bced6e32368599eeddf18796bfd03958a154f87e5b084f96e85136a56b886733592f493f0fc68b0d6b3551781cb95e13c5de458b28d6fb60d20a9129313261410203010001a31a301830160603551d11040f300d820b6578616d706c652e636f6d300b06092a864886f70d0101050341001a0b419d2c74474c6450654e5f10b32bf426ffdf55cad1c52602e7a9151513a3424c70f5960dcd682db0c33769cc1daa3fcdd3db10809d2392ed4a1bf50ced18` - -var certWildcardExampleCom = `308201423081efa003020102020101300b06092a864886f70d010105301e311c301a060355040a131354657374696e67204365727469666963617465301e170d3131313030313139303034365a170d3132303933303139303034365a301e311c301a060355040a131354657374696e67204365727469666963617465305a300b06092a864886f70d010101034b003048024100bced6e32368599eeddf18796bfd03958a154f87e5b084f96e85136a56b886733592f493f0fc68b0d6b3551781cb95e13c5de458b28d6fb60d20a9129313261410203010001a31c301a30180603551d110411300f820d2a2e6578616d706c652e636f6d300b06092a864886f70d0101050341001676f0c9e7c33c1b656ed5a6476c4e2ee9ec8e62df7407accb1875272b2edd0a22096cb2c22598d11604104d604f810eb4b5987ca6bb319c7e6ce48725c54059` - -var certFooExampleCom = `308201443081f1a003020102020101300b06092a864886f70d010105301e311c301a060355040a131354657374696e67204365727469666963617465301e170d3131313030313139303131345a170d3132303933303139303131345a301e311c301a060355040a131354657374696e67204365727469666963617465305a300b06092a864886f70d010101034b003048024100bced6e32368599eeddf18796bfd03958a154f87e5b084f96e85136a56b886733592f493f0fc68b0d6b3551781cb95e13c5de458b28d6fb60d20a9129313261410203010001a31e301c301a0603551d1104133011820f666f6f2e6578616d706c652e636f6d300b06092a864886f70d010105034100646a2a51f2aa2477add854b462cf5207ba16d3213ffb5d3d0eed473fbf09935019192d1d5b8ca6a2407b424cf04d97c4cd9197c83ecf81f0eab9464a1109d09f` - -var certDoubleWildcardExampleCom = `308201443081f1a003020102020101300b06092a864886f70d010105301e311c301a060355040a131354657374696e67204365727469666963617465301e170d3131313030313139303134315a170d3132303933303139303134315a301e311c301a060355040a131354657374696e67204365727469666963617465305a300b06092a864886f70d010101034b003048024100bced6e32368599eeddf18796bfd03958a154f87e5b084f96e85136a56b886733592f493f0fc68b0d6b3551781cb95e13c5de458b28d6fb60d20a9129313261410203010001a31e301c301a0603551d1104133011820f2a2e2a2e6578616d706c652e636f6d300b06092a864886f70d0101050341001c3de267975f56ef57771c6218ef95ecc65102e57bd1defe6f7efea90d9b26cf40de5bd7ad75e46201c7f2a92aaa3e907451e9409f65e28ddb6db80d726290f6` - -func TestCertificateSelection(t *testing.T) { - config := Config{ - Certificates: []Certificate{ - { - Certificate: [][]byte{fromHex(certExampleCom)}, - }, - { - Certificate: [][]byte{fromHex(certWildcardExampleCom)}, - }, - { - Certificate: [][]byte{fromHex(certFooExampleCom)}, - }, - { - Certificate: [][]byte{fromHex(certDoubleWildcardExampleCom)}, - }, - }, - } - - config.BuildNameToCertificate() - - pointerToIndex := func(c *Certificate) int { - for i := range config.Certificates { - if c == &config.Certificates[i] { - return i - } - } - return -1 - } - - if n := pointerToIndex(config.getCertificateForName("example.com")); n != 0 { - t.Errorf("example.com returned certificate %d, not 0", n) - } - if n := pointerToIndex(config.getCertificateForName("bar.example.com")); n != 1 { - t.Errorf("bar.example.com returned certificate %d, not 1", n) - } - if n := pointerToIndex(config.getCertificateForName("foo.example.com")); n != 2 { - t.Errorf("foo.example.com returned certificate %d, not 2", n) - } - if n := pointerToIndex(config.getCertificateForName("foo.bar.example.com")); n != 3 { - t.Errorf("foo.bar.example.com returned certificate %d, not 3", n) - } - if n := pointerToIndex(config.getCertificateForName("foo.bar.baz.example.com")); n != 0 { - t.Errorf("foo.bar.baz.example.com returned certificate %d, not 0", n) - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/tls/handshake_client_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/tls/handshake_client_test.go deleted file mode 100644 index 6c564001b0..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/tls/handshake_client_test.go +++ /dev/null @@ -1,3050 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "bytes" - "flag" - "io" - "net" - "os" - "testing" -) - -func testClientScript(t *testing.T, name string, clientScript [][]byte, config *Config) { - c, s := net.Pipe() - cli := Client(c, config) - go func() { - cli.Write([]byte("hello\n")) - cli.Close() - c.Close() - }() - - defer c.Close() - for i, b := range clientScript { - if i%2 == 1 { - s.Write(b) - continue - } - bb := make([]byte, len(b)) - _, err := io.ReadFull(s, bb) - if err != nil { - t.Fatalf("%s #%d: %s", name, i, err) - } - if !bytes.Equal(b, bb) { - t.Fatalf("%s #%d: mismatch on read: got:%x want:%x", name, i, bb, b) - } - } -} - -func TestHandshakeClientRSARC4(t *testing.T) { - var config = *testConfig - config.CipherSuites = []uint16{TLS_RSA_WITH_RC4_128_SHA} - testClientScript(t, "RSA-RC4", rsaRC4ClientScript, &config) -} - -func TestHandshakeClientECDHERSAAES(t *testing.T) { - var config = *testConfig - config.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA} - testClientScript(t, "ECDHE-RSA-AES", ecdheRSAAESClientScript, &config) -} - -func TestHandshakeClientECDHECDSAAES(t *testing.T) { - var config = *testConfig - config.CipherSuites = []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA} - config.Certificates = nil - config.BuildNameToCertificate() - testClientScript(t, "ECDHE-ECDSA-AES", ecdheECDSAAESClientScript, &config) -} - -func TestLongClientCerticiateChain(t *testing.T) { - config := *testConfig - cert, _ := X509KeyPair(testClientChainCertificate, testClientChainCertificate) - config.Certificates = []Certificate{cert} - testClientScript(t, "Long client certificate chains", clientChainCertificateScript, &config) -} - -func TestHandshakeClientTLS11(t *testing.T) { - var config = *testConfig - config.MaxVersion = VersionTLS11 - config.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA} - testClientScript(t, "TLS11-ECDHE-AES", tls11ECDHEAESClientScript, &config) -} - -func TestHandshakeClientTLS12(t *testing.T) { - config := *testConfig - config.MaxVersion = VersionTLS12 - config.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA} - cert, _ := X509KeyPair(testClientChainCertificate, testClientChainCertificate) - config.Certificates = []Certificate{cert} - testClientScript(t, "TLS12", clientTLS12Script, &config) -} - -func TestHandshakeClientTLS12ClientCert(t *testing.T) { - config := *testConfig - config.MaxVersion = VersionTLS12 - config.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256} - cert, _ := X509KeyPair(testClientChainCertificate, testClientChainCertificate) - config.Certificates = []Certificate{cert} - testClientScript(t, "TLS12ClientCert", clientTLS12ClientCertScript, &config) -} - -var connect = flag.Bool("connect", false, "connect to a TLS server on :10443") - -func TestRunClient(t *testing.T) { - if !*connect { - return - } - - tcpConn, err := net.Dial("tcp", "127.0.0.1:10443") - if err != nil { - t.Fatal(err) - } - - record := &recordingConn{ - Conn: tcpConn, - } - - config := GetTestConfig() - conn := Client(record, config) - if err := conn.Handshake(); err != nil { - t.Fatalf("error from TLS handshake: %s", err) - } - - conn.Write([]byte("hello\n")) - conn.Close() - - record.WriteTo(os.Stdout) -} - -func TestEmptyRecords(t *testing.T) { - // emptyRecordScript contains a TLS connection with an empty record as - // the first application data from the server. This test ensures that - // the empty record doesn't cause (0, nil) to be returned from - // Conn.Read. - config := *testConfig - config.CipherSuites = []uint16{TLS_RSA_WITH_AES_256_CBC_SHA} - - c, s := net.Pipe() - cli := Client(c, &config) - go func() { - buf := make([]byte, 1024) - n, err := cli.Read(buf) - defer c.Close() - defer cli.Close() - - if err != nil { - t.Fatalf("error reading from tls.Client: %s", err) - } - const expectedLength = 197 - if n != expectedLength { - t.Fatalf("incorrect length reading from tls.Client, got %d, want %d", n, expectedLength) - } - }() - - defer c.Close() - for i, b := range emptyRecordScript { - if i%2 == 1 { - s.Write(b) - continue - } - bb := make([]byte, len(b)) - _, err := io.ReadFull(s, bb) - if err != nil { - t.Fatalf("#%d: %s", i, err) - } - if !bytes.Equal(b, bb) { - t.Fatalf("#%d: mismatch on read: got:%x want:%x", i, bb, b) - } - } -} - -// Script of interaction with gnutls implementation. -// The values for this test are obtained by building and running in client mode: -// % go test -test.run "TestRunClient" -connect -// The recorded bytes are written to stdout. -// -// The server private key is: -// -----BEGIN RSA PRIVATE KEY----- -// MIIBPAIBAAJBAJ+zw4Qnlf8SMVIPFe9GEcStgOY2Ww/dgNdhjeD8ckUJNP5VZkVD -// TGiXav6ooKXfX3j/7tdkuD8Ey2//Kv7+ue0CAwEAAQJAN6W31vDEP2DjdqhzCDDu -// OA4NACqoiFqyblo7yc2tM4h4xMbC3Yx5UKMN9ZkCtX0gzrz6DyF47bdKcWBzNWCj -// gQIhANEoojVt7hq+SQ6MCN6FTAysGgQf56Q3TYoJMoWvdiXVAiEAw3e3rc+VJpOz -// rHuDo6bgpjUAAXM+v3fcpsfZSNO6V7kCIQCtbVjanpUwvZkMI9by02oUk9taki3b -// PzPfAfNPYAbCJQIhAJXNQDWyqwn/lGmR11cqY2y9nZ1+5w3yHGatLrcDnQHxAiEA -// vnlEGo8K85u+KwIOimM48ZG8oTk7iFdkqLJR1utT3aU= -// -----END RSA PRIVATE KEY----- -// -// and certificate is: -// -----BEGIN CERTIFICATE----- -// MIICKzCCAdWgAwIBAgIJALE1E2URIMWSMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV -// BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX -// aWRnaXRzIFB0eSBMdGQwHhcNMTIwNDA2MTcxMDEzWhcNMTUwNDA2MTcxMDEzWjBF -// MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 -// ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJ+z -// w4Qnlf8SMVIPFe9GEcStgOY2Ww/dgNdhjeD8ckUJNP5VZkVDTGiXav6ooKXfX3j/ -// 7tdkuD8Ey2//Kv7+ue0CAwEAAaOBpzCBpDAdBgNVHQ4EFgQUeKaXmmO1xaGlM7oi -// fCNuWxt6zCswdQYDVR0jBG4wbIAUeKaXmmO1xaGlM7oifCNuWxt6zCuhSaRHMEUx -// CzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRl -// cm5ldCBXaWRnaXRzIFB0eSBMdGSCCQCxNRNlESDFkjAMBgNVHRMEBTADAQH/MA0G -// CSqGSIb3DQEBBQUAA0EAhTZAc8G7GtrUWZ8tonAxRnTsg26oyDxRrzms7EC86CJG -// HZnWRiok1IsFCEv7NRFukrt3uuQSu/TIXpyBqJdgTA== -// -----END CERTIFICATE----- -var rsaRC4ClientScript = [][]byte{ - { - 0x16, 0x03, 0x01, 0x00, 0x4a, 0x01, 0x00, 0x00, - 0x46, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, - 0x01, 0x00, 0x00, 0x1b, 0x00, 0x05, 0x00, 0x05, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, - 0x08, 0x00, 0x06, 0x00, 0x17, 0x00, 0x18, 0x00, - 0x19, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, - }, - - { - 0x16, 0x03, 0x01, 0x00, 0x4a, 0x02, 0x00, 0x00, - 0x46, 0x03, 0x01, 0x4d, 0x0a, 0x56, 0x16, 0xb5, - 0x91, 0xd1, 0xcb, 0x80, 0x4d, 0xc7, 0x46, 0xf3, - 0x37, 0x0c, 0xef, 0xea, 0x64, 0x11, 0x14, 0x56, - 0x97, 0x9b, 0xc5, 0x67, 0x08, 0xb7, 0x13, 0xea, - 0xf8, 0xc9, 0xb3, 0x20, 0xe2, 0xfc, 0x41, 0xf6, - 0x96, 0x90, 0x9d, 0x43, 0x9b, 0xe9, 0x6e, 0xf8, - 0x41, 0x16, 0xcc, 0xf3, 0xc7, 0xde, 0xda, 0x5a, - 0xa1, 0x33, 0x69, 0xe2, 0xde, 0x5b, 0xaf, 0x2a, - 0x92, 0xe7, 0xd4, 0xa0, 0x00, 0x05, 0x00, 0x16, - 0x03, 0x01, 0x01, 0xf7, 0x0b, 0x00, 0x01, 0xf3, - 0x00, 0x01, 0xf0, 0x00, 0x01, 0xed, 0x30, 0x82, - 0x01, 0xe9, 0x30, 0x82, 0x01, 0x52, 0x02, 0x01, - 0x06, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, - 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x04, 0x05, 0x00, - 0x30, 0x5b, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, - 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, - 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, - 0x13, 0x0a, 0x51, 0x75, 0x65, 0x65, 0x6e, 0x73, - 0x6c, 0x61, 0x6e, 0x64, 0x31, 0x1a, 0x30, 0x18, - 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x11, 0x43, - 0x72, 0x79, 0x70, 0x74, 0x53, 0x6f, 0x66, 0x74, - 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, - 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, - 0x03, 0x13, 0x12, 0x54, 0x65, 0x73, 0x74, 0x20, - 0x43, 0x41, 0x20, 0x28, 0x31, 0x30, 0x32, 0x34, - 0x20, 0x62, 0x69, 0x74, 0x29, 0x30, 0x1e, 0x17, - 0x0d, 0x30, 0x30, 0x31, 0x30, 0x31, 0x36, 0x32, - 0x32, 0x33, 0x31, 0x30, 0x33, 0x5a, 0x17, 0x0d, - 0x30, 0x33, 0x30, 0x31, 0x31, 0x34, 0x32, 0x32, - 0x33, 0x31, 0x30, 0x33, 0x5a, 0x30, 0x63, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x51, - 0x75, 0x65, 0x65, 0x6e, 0x73, 0x6c, 0x61, 0x6e, - 0x64, 0x31, 0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x11, 0x43, 0x72, 0x79, 0x70, - 0x74, 0x53, 0x6f, 0x66, 0x74, 0x20, 0x50, 0x74, - 0x79, 0x20, 0x4c, 0x74, 0x64, 0x31, 0x23, 0x30, - 0x21, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1a, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x74, - 0x65, 0x73, 0x74, 0x20, 0x63, 0x65, 0x72, 0x74, - 0x20, 0x28, 0x35, 0x31, 0x32, 0x20, 0x62, 0x69, - 0x74, 0x29, 0x30, 0x5c, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x01, 0x05, 0x00, 0x03, 0x4b, 0x00, 0x30, 0x48, - 0x02, 0x41, 0x00, 0x9f, 0xb3, 0xc3, 0x84, 0x27, - 0x95, 0xff, 0x12, 0x31, 0x52, 0x0f, 0x15, 0xef, - 0x46, 0x11, 0xc4, 0xad, 0x80, 0xe6, 0x36, 0x5b, - 0x0f, 0xdd, 0x80, 0xd7, 0x61, 0x8d, 0xe0, 0xfc, - 0x72, 0x45, 0x09, 0x34, 0xfe, 0x55, 0x66, 0x45, - 0x43, 0x4c, 0x68, 0x97, 0x6a, 0xfe, 0xa8, 0xa0, - 0xa5, 0xdf, 0x5f, 0x78, 0xff, 0xee, 0xd7, 0x64, - 0xb8, 0x3f, 0x04, 0xcb, 0x6f, 0xff, 0x2a, 0xfe, - 0xfe, 0xb9, 0xed, 0x02, 0x03, 0x01, 0x00, 0x01, - 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, - 0xf7, 0x0d, 0x01, 0x01, 0x04, 0x05, 0x00, 0x03, - 0x81, 0x81, 0x00, 0x93, 0xd2, 0x0a, 0xc5, 0x41, - 0xe6, 0x5a, 0xa9, 0x86, 0xf9, 0x11, 0x87, 0xe4, - 0xdb, 0x45, 0xe2, 0xc5, 0x95, 0x78, 0x1a, 0x6c, - 0x80, 0x6d, 0x73, 0x1f, 0xb4, 0x6d, 0x44, 0xa3, - 0xba, 0x86, 0x88, 0xc8, 0x58, 0xcd, 0x1c, 0x06, - 0x35, 0x6c, 0x44, 0x62, 0x88, 0xdf, 0xe4, 0xf6, - 0x64, 0x61, 0x95, 0xef, 0x4a, 0xa6, 0x7f, 0x65, - 0x71, 0xd7, 0x6b, 0x88, 0x39, 0xf6, 0x32, 0xbf, - 0xac, 0x93, 0x67, 0x69, 0x51, 0x8c, 0x93, 0xec, - 0x48, 0x5f, 0xc9, 0xb1, 0x42, 0xf9, 0x55, 0xd2, - 0x7e, 0x4e, 0xf4, 0xf2, 0x21, 0x6b, 0x90, 0x57, - 0xe6, 0xd7, 0x99, 0x9e, 0x41, 0xca, 0x80, 0xbf, - 0x1a, 0x28, 0xa2, 0xca, 0x5b, 0x50, 0x4a, 0xed, - 0x84, 0xe7, 0x82, 0xc7, 0xd2, 0xcf, 0x36, 0x9e, - 0x6a, 0x67, 0xb9, 0x88, 0xa7, 0xf3, 0x8a, 0xd0, - 0x04, 0xf8, 0xe8, 0xc6, 0x17, 0xe3, 0xc5, 0x29, - 0xbc, 0x17, 0xf1, 0x16, 0x03, 0x01, 0x00, 0x04, - 0x0e, 0x00, 0x00, 0x00, - }, - - { - 0x16, 0x03, 0x01, 0x00, 0x46, 0x10, 0x00, 0x00, - 0x42, 0x00, 0x40, 0x87, 0xa1, 0x1f, 0x14, 0xe1, - 0xfb, 0x91, 0xac, 0x58, 0x2e, 0xf3, 0x71, 0xce, - 0x01, 0x85, 0x2c, 0xc7, 0xfe, 0x84, 0x87, 0x82, - 0xb7, 0x57, 0xdb, 0x37, 0x4d, 0x46, 0x83, 0x67, - 0x52, 0x82, 0x51, 0x01, 0x95, 0x23, 0x68, 0x69, - 0x6b, 0xd0, 0xa7, 0xa7, 0xe5, 0x88, 0xd0, 0x47, - 0x71, 0xb8, 0xd2, 0x03, 0x05, 0x25, 0x56, 0x5c, - 0x10, 0x08, 0xc6, 0x9b, 0xd4, 0x67, 0xcd, 0x28, - 0xbe, 0x9c, 0x48, 0x14, 0x03, 0x01, 0x00, 0x01, - 0x01, 0x16, 0x03, 0x01, 0x00, 0x24, 0xc1, 0xb8, - 0xd3, 0x7f, 0xc5, 0xc2, 0x5a, 0x1d, 0x6d, 0x5b, - 0x2d, 0x5c, 0x82, 0x87, 0xc2, 0x6f, 0x0d, 0x63, - 0x7b, 0x72, 0x2b, 0xda, 0x69, 0xc4, 0xfe, 0x3c, - 0x84, 0xa1, 0x5a, 0x62, 0x38, 0x37, 0xc6, 0x54, - 0x25, 0x2a, - }, - - { - 0x14, 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, - 0x01, 0x00, 0x24, 0xea, 0x88, 0x9c, 0x00, 0xf6, - 0x35, 0xb8, 0x42, 0x7f, 0x15, 0x17, 0x76, 0x5e, - 0x4b, 0x24, 0xcb, 0x7e, 0xa0, 0x7b, 0xc3, 0x70, - 0x52, 0x0a, 0x88, 0x2a, 0x7a, 0x45, 0x59, 0x90, - 0x59, 0xac, 0xc6, 0xb5, 0x56, 0x55, 0x96, - }, -} - -var ecdheRSAAESClientScript = [][]byte{ - { - 0x16, 0x03, 0x01, 0x00, 0x4a, 0x01, 0x00, 0x00, - 0x46, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xc0, 0x13, - 0x01, 0x00, 0x00, 0x1b, 0x00, 0x05, 0x00, 0x05, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, - 0x08, 0x00, 0x06, 0x00, 0x17, 0x00, 0x18, 0x00, - 0x19, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x52, 0x02, 0x00, 0x00, - 0x4e, 0x03, 0x01, 0x50, 0xad, 0x72, 0xb1, 0x14, - 0x45, 0xce, 0x0a, 0x95, 0xf9, 0x63, 0xef, 0xa8, - 0xe5, 0x07, 0x34, 0x04, 0xe9, 0x08, 0x0f, 0x38, - 0xe4, 0x28, 0x27, 0x91, 0x07, 0x03, 0xe2, 0xfe, - 0xe3, 0x25, 0xf7, 0x20, 0x08, 0x42, 0xa2, 0x01, - 0x69, 0x53, 0xf0, 0xd9, 0x4c, 0xfa, 0x01, 0xa1, - 0xce, 0x4b, 0xf8, 0x28, 0x21, 0xad, 0x06, 0xbe, - 0xe0, 0x1b, 0x3b, 0xf7, 0xec, 0xd2, 0x52, 0xae, - 0x2a, 0x57, 0xb7, 0xa8, 0xc0, 0x13, 0x00, 0x00, - 0x06, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, 0x16, - 0x03, 0x01, 0x02, 0x39, 0x0b, 0x00, 0x02, 0x35, - 0x00, 0x02, 0x32, 0x00, 0x02, 0x2f, 0x30, 0x82, - 0x02, 0x2b, 0x30, 0x82, 0x01, 0xd5, 0xa0, 0x03, - 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xb1, 0x35, - 0x13, 0x65, 0x11, 0x20, 0xc5, 0x92, 0x30, 0x0d, - 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, - 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x30, 0x1e, 0x17, 0x0d, - 0x31, 0x32, 0x30, 0x34, 0x30, 0x36, 0x31, 0x37, - 0x31, 0x30, 0x31, 0x33, 0x5a, 0x17, 0x0d, 0x31, - 0x35, 0x30, 0x34, 0x30, 0x36, 0x31, 0x37, 0x31, - 0x30, 0x31, 0x33, 0x5a, 0x30, 0x45, 0x31, 0x0b, - 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, - 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, - 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, - 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, - 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, - 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, - 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, - 0x4c, 0x74, 0x64, 0x30, 0x5c, 0x30, 0x0d, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x01, 0x01, 0x05, 0x00, 0x03, 0x4b, 0x00, 0x30, - 0x48, 0x02, 0x41, 0x00, 0x9f, 0xb3, 0xc3, 0x84, - 0x27, 0x95, 0xff, 0x12, 0x31, 0x52, 0x0f, 0x15, - 0xef, 0x46, 0x11, 0xc4, 0xad, 0x80, 0xe6, 0x36, - 0x5b, 0x0f, 0xdd, 0x80, 0xd7, 0x61, 0x8d, 0xe0, - 0xfc, 0x72, 0x45, 0x09, 0x34, 0xfe, 0x55, 0x66, - 0x45, 0x43, 0x4c, 0x68, 0x97, 0x6a, 0xfe, 0xa8, - 0xa0, 0xa5, 0xdf, 0x5f, 0x78, 0xff, 0xee, 0xd7, - 0x64, 0xb8, 0x3f, 0x04, 0xcb, 0x6f, 0xff, 0x2a, - 0xfe, 0xfe, 0xb9, 0xed, 0x02, 0x03, 0x01, 0x00, - 0x01, 0xa3, 0x81, 0xa7, 0x30, 0x81, 0xa4, 0x30, - 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, - 0x04, 0x14, 0x78, 0xa6, 0x97, 0x9a, 0x63, 0xb5, - 0xc5, 0xa1, 0xa5, 0x33, 0xba, 0x22, 0x7c, 0x23, - 0x6e, 0x5b, 0x1b, 0x7a, 0xcc, 0x2b, 0x30, 0x75, - 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x6e, 0x30, - 0x6c, 0x80, 0x14, 0x78, 0xa6, 0x97, 0x9a, 0x63, - 0xb5, 0xc5, 0xa1, 0xa5, 0x33, 0xba, 0x22, 0x7c, - 0x23, 0x6e, 0x5b, 0x1b, 0x7a, 0xcc, 0x2b, 0xa1, - 0x49, 0xa4, 0x47, 0x30, 0x45, 0x31, 0x0b, 0x30, - 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, - 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, - 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, - 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, - 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, - 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, - 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, - 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, - 0x74, 0x64, 0x82, 0x09, 0x00, 0xb1, 0x35, 0x13, - 0x65, 0x11, 0x20, 0xc5, 0x92, 0x30, 0x0c, 0x06, - 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, - 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, 0x09, 0x2a, - 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, - 0x05, 0x00, 0x03, 0x41, 0x00, 0x85, 0x36, 0x40, - 0x73, 0xc1, 0xbb, 0x1a, 0xda, 0xd4, 0x59, 0x9f, - 0x2d, 0xa2, 0x70, 0x31, 0x46, 0x74, 0xec, 0x83, - 0x6e, 0xa8, 0xc8, 0x3c, 0x51, 0xaf, 0x39, 0xac, - 0xec, 0x40, 0xbc, 0xe8, 0x22, 0x46, 0x1d, 0x99, - 0xd6, 0x46, 0x2a, 0x24, 0xd4, 0x8b, 0x05, 0x08, - 0x4b, 0xfb, 0x35, 0x11, 0x6e, 0x92, 0xbb, 0x77, - 0xba, 0xe4, 0x12, 0xbb, 0xf4, 0xc8, 0x5e, 0x9c, - 0x81, 0xa8, 0x97, 0x60, 0x4c, 0x16, 0x03, 0x01, - 0x00, 0x8b, 0x0c, 0x00, 0x00, 0x87, 0x03, 0x00, - 0x17, 0x41, 0x04, 0x1c, 0x8f, 0x9c, 0x6d, 0xe7, - 0xab, 0x3e, 0xf8, 0x0a, 0x5d, 0xe1, 0x86, 0xb4, - 0xe2, 0x8e, 0xb2, 0x1c, 0x3b, 0xd9, 0xb6, 0x08, - 0x80, 0x58, 0x21, 0xe9, 0x0e, 0xc6, 0x66, 0x67, - 0x97, 0xcb, 0xb9, 0x92, 0x07, 0x00, 0xc4, 0xe5, - 0xec, 0x5f, 0xb4, 0xe2, 0x20, 0xa9, 0xc9, 0x62, - 0xd0, 0x98, 0xd5, 0xe3, 0x53, 0xff, 0xd0, 0x0a, - 0x6e, 0x29, 0x69, 0x39, 0x2a, 0x4b, 0x5c, 0xd8, - 0x6c, 0xf5, 0xfe, 0x00, 0x40, 0x35, 0xa7, 0x26, - 0x2e, 0xc2, 0x48, 0x93, 0x32, 0xf7, 0x7d, 0x0f, - 0x0d, 0x77, 0x56, 0x9a, 0x85, 0x0c, 0xa6, 0x74, - 0x06, 0xb8, 0x3d, 0x90, 0x56, 0x12, 0x63, 0xff, - 0x00, 0x5e, 0x0f, 0xf7, 0x24, 0xf7, 0xdb, 0x48, - 0x71, 0xe9, 0x2e, 0x03, 0xd3, 0xfa, 0x3a, 0xae, - 0xa0, 0xc1, 0x77, 0x3c, 0x4c, 0x59, 0xce, 0x33, - 0x1a, 0xd2, 0x47, 0x83, 0xfa, 0xea, 0xd8, 0x1e, - 0x06, 0xe7, 0x7d, 0xa0, 0x9b, 0x16, 0x03, 0x01, - 0x00, 0x04, 0x0e, 0x00, 0x00, 0x00, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x46, 0x10, 0x00, 0x00, - 0x42, 0x41, 0x04, 0x1e, 0x18, 0x37, 0xef, 0x0d, - 0x19, 0x51, 0x88, 0x35, 0x75, 0x71, 0xb5, 0xe5, - 0x54, 0x5b, 0x12, 0x2e, 0x8f, 0x09, 0x67, 0xfd, - 0xa7, 0x24, 0x20, 0x3e, 0xb2, 0x56, 0x1c, 0xce, - 0x97, 0x28, 0x5e, 0xf8, 0x2b, 0x2d, 0x4f, 0x9e, - 0xf1, 0x07, 0x9f, 0x6c, 0x4b, 0x5b, 0x83, 0x56, - 0xe2, 0x32, 0x42, 0xe9, 0x58, 0xb6, 0xd7, 0x49, - 0xa6, 0xb5, 0x68, 0x1a, 0x41, 0x03, 0x56, 0x6b, - 0xdc, 0x5a, 0x89, 0x14, 0x03, 0x01, 0x00, 0x01, - 0x01, 0x16, 0x03, 0x01, 0x00, 0x30, 0xd9, 0xa7, - 0x80, 0x56, 0x3f, 0xa3, 0x8f, 0x96, 0x72, 0x4e, - 0x4e, 0x6e, 0x23, 0x41, 0x8f, 0xda, 0x91, 0xb2, - 0x9e, 0x63, 0x23, 0x82, 0x64, 0xcd, 0x07, 0x24, - 0xd3, 0x40, 0x20, 0x22, 0x4c, 0xe3, 0xff, 0x38, - 0xbb, 0x43, 0x9d, 0x57, 0x11, 0xd5, 0x46, 0xa5, - 0x05, 0x29, 0x92, 0x02, 0xce, 0xdf, - }, - { - 0x14, 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, - 0x01, 0x00, 0x90, 0xe7, 0xba, 0x0e, 0xb1, 0xda, - 0x92, 0xb5, 0x77, 0x56, 0x38, 0xa6, 0x22, 0xc1, - 0x72, 0xeb, 0x8a, 0x68, 0x09, 0xb6, 0x74, 0xad, - 0xb3, 0x4a, 0xf2, 0xdd, 0x09, 0x9b, 0xc9, 0x4f, - 0x84, 0x73, 0x8b, 0xd6, 0x97, 0x50, 0x23, 0x1c, - 0xa0, 0xc2, 0x0c, 0x25, 0x18, 0xdd, 0x5e, 0x15, - 0x4d, 0xd9, 0xef, 0x4f, 0x6a, 0x43, 0x61, 0x9c, - 0x95, 0xde, 0x3c, 0x66, 0xc4, 0xc1, 0x33, 0x56, - 0xdd, 0x2f, 0x90, 0xaf, 0x68, 0x5c, 0x9c, 0xa4, - 0x90, 0x6d, 0xbf, 0x51, 0x1d, 0x68, 0xcb, 0x81, - 0x77, 0x52, 0xa0, 0x93, 0x2a, 0xf8, 0xc7, 0x61, - 0x87, 0x76, 0xca, 0x93, 0x9e, 0xd6, 0xee, 0x6f, - 0x3f, 0xeb, 0x7d, 0x06, 0xdd, 0x73, 0x4e, 0x27, - 0x16, 0x63, 0x92, 0xe4, 0xb2, 0x3f, 0x91, 0x23, - 0x21, 0x97, 0x90, 0xce, 0x53, 0xb8, 0xb0, 0x9d, - 0xbd, 0xbd, 0x33, 0x84, 0xad, 0x6b, 0x2e, 0x7b, - 0xf5, 0xeb, 0x1d, 0x64, 0x37, 0x2e, 0x29, 0x4e, - 0xb0, 0x93, 0xdb, 0x92, 0xc7, 0xaa, 0x94, 0xa5, - 0x3b, 0x64, 0xd0, - }, - { - 0x17, 0x03, 0x01, 0x00, 0x20, 0x11, 0xd8, 0x6b, - 0x3c, 0xf6, 0xbe, 0xf4, 0x54, 0x87, 0xec, 0x75, - 0x0c, 0x44, 0xdb, 0x92, 0xfc, 0xde, 0x7e, 0x0f, - 0x9f, 0x87, 0x87, 0x9c, 0x03, 0xd5, 0x07, 0x84, - 0xe0, 0x3a, 0xf8, 0xae, 0x14, 0x17, 0x03, 0x01, - 0x00, 0x20, 0xba, 0x54, 0xef, 0x5b, 0xce, 0xfd, - 0x47, 0x76, 0x6d, 0xa1, 0x8b, 0xfd, 0x48, 0xde, - 0x6e, 0x26, 0xc1, 0x0c, 0x9d, 0x54, 0xbf, 0x98, - 0xf6, 0x1c, 0x80, 0xb9, 0xca, 0x93, 0x81, 0x0a, - 0x2e, 0x06, 0x15, 0x03, 0x01, 0x00, 0x20, 0x93, - 0x3e, 0x38, 0x17, 0xc9, 0x0a, 0xc3, 0xea, 0xd3, - 0x92, 0x75, 0xa6, 0x53, 0x37, 0x4d, 0x74, 0x94, - 0xbe, 0x01, 0xdc, 0x5c, 0x5a, 0x0f, 0x09, 0xf6, - 0x57, 0x33, 0xc3, 0xbc, 0x3f, 0x7a, 0x4d, - }, -} - -var emptyRecordScript = [][]byte{ - { - 0x16, 0x03, 0x01, 0x00, 0x4a, 0x01, 0x00, 0x00, - 0x46, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x35, - 0x01, 0x00, 0x00, 0x1b, 0x00, 0x05, 0x00, 0x05, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, - 0x08, 0x00, 0x06, 0x00, 0x17, 0x00, 0x18, 0x00, - 0x19, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x4a, 0x02, 0x00, 0x00, - 0x46, 0x03, 0x01, 0x51, 0x71, 0x8e, 0x03, 0x02, - 0xef, 0x09, 0xf2, 0x0e, 0xf5, 0x3b, 0x29, 0x9a, - 0xa8, 0x8b, 0x46, 0xa3, 0xd4, 0xb4, 0xc1, 0x14, - 0xc3, 0x19, 0x99, 0xba, 0x3d, 0x78, 0xcf, 0x50, - 0xd1, 0xe7, 0x26, 0x20, 0xa0, 0x37, 0x6d, 0xc9, - 0xae, 0x93, 0x33, 0x81, 0x20, 0xe3, 0xc1, 0x90, - 0x64, 0x6e, 0x67, 0x93, 0xdb, 0xb4, 0x04, 0x16, - 0xc4, 0x25, 0xdd, 0x10, 0x79, 0x3c, 0x18, 0x0a, - 0x7c, 0xfd, 0x28, 0x65, 0x00, 0x35, 0x00, 0x16, - 0x03, 0x01, 0x09, 0x9e, 0x0b, 0x00, 0x09, 0x9a, - 0x00, 0x09, 0x97, 0x00, 0x04, 0xea, 0x30, 0x82, - 0x04, 0xe6, 0x30, 0x82, 0x03, 0xce, 0xa0, 0x03, - 0x02, 0x01, 0x02, 0x02, 0x11, 0x00, 0xff, 0xab, - 0x02, 0x93, 0xe0, 0x72, 0x99, 0x18, 0x6c, 0x9e, - 0x96, 0xb8, 0xb9, 0xf7, 0x47, 0xcb, 0x30, 0x0d, - 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, - 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x41, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x46, 0x52, 0x31, 0x12, 0x30, 0x10, - 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x09, 0x47, - 0x41, 0x4e, 0x44, 0x49, 0x20, 0x53, 0x41, 0x53, - 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, - 0x03, 0x13, 0x15, 0x47, 0x61, 0x6e, 0x64, 0x69, - 0x20, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, - 0x64, 0x20, 0x53, 0x53, 0x4c, 0x20, 0x43, 0x41, - 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x33, 0x30, 0x31, - 0x31, 0x34, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, - 0x5a, 0x17, 0x0d, 0x31, 0x34, 0x30, 0x31, 0x31, - 0x34, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, - 0x30, 0x62, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, - 0x55, 0x04, 0x0b, 0x13, 0x18, 0x44, 0x6f, 0x6d, - 0x61, 0x69, 0x6e, 0x20, 0x43, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x20, 0x56, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x64, 0x31, 0x24, 0x30, - 0x22, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x1b, - 0x47, 0x61, 0x6e, 0x64, 0x69, 0x20, 0x53, 0x74, - 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x20, 0x57, - 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x20, - 0x53, 0x53, 0x4c, 0x31, 0x17, 0x30, 0x15, 0x06, - 0x03, 0x55, 0x04, 0x03, 0x14, 0x0e, 0x2a, 0x2e, - 0x66, 0x72, 0x65, 0x65, 0x6e, 0x6f, 0x64, 0x65, - 0x2e, 0x6e, 0x65, 0x74, 0x30, 0x82, 0x01, 0x22, - 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, - 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, - 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, - 0x02, 0x82, 0x01, 0x01, 0x00, 0xdc, 0xe3, 0xfd, - 0xce, 0xc1, 0x66, 0x62, 0x28, 0x8b, 0x99, 0x65, - 0x72, 0x52, 0x88, 0x93, 0x5b, 0x3f, 0x8d, 0xde, - 0x2b, 0xb0, 0xa0, 0xf4, 0xbd, 0xb4, 0x07, 0x5f, - 0x9e, 0x01, 0x47, 0x60, 0x57, 0x5f, 0xdf, 0xdc, - 0x63, 0x28, 0x1c, 0x1e, 0x5b, 0xc8, 0xe6, 0x29, - 0xdd, 0xeb, 0x26, 0x63, 0xd5, 0xbf, 0x83, 0xb2, - 0x2d, 0xcd, 0x2c, 0xa0, 0xb6, 0x91, 0xad, 0xaf, - 0x95, 0x21, 0x1d, 0x1f, 0x39, 0x8d, 0x3e, 0x17, - 0xd6, 0xbd, 0x99, 0xf5, 0x6c, 0xd4, 0xcb, 0x79, - 0x12, 0x3e, 0x11, 0xb9, 0x7e, 0x62, 0xbc, 0x2d, - 0xbf, 0xe0, 0x55, 0x1b, 0x5c, 0x1e, 0xce, 0x31, - 0xd9, 0xf8, 0x56, 0x68, 0x95, 0x2b, 0x15, 0x84, - 0x35, 0xae, 0x98, 0x2c, 0x63, 0x01, 0xb2, 0x0d, - 0xab, 0xa8, 0x61, 0xef, 0x7f, 0x15, 0x2c, 0x6d, - 0xf7, 0x67, 0x1d, 0xb8, 0x8d, 0xf6, 0xa2, 0x1c, - 0x4e, 0x85, 0xf0, 0xea, 0x1a, 0x2b, 0xc8, 0xac, - 0x70, 0x86, 0x9a, 0xbb, 0x9e, 0x9d, 0xbd, 0xc9, - 0x87, 0x2b, 0x9f, 0x5e, 0x40, 0x44, 0x9b, 0xba, - 0x96, 0x45, 0x24, 0xbc, 0x49, 0xb8, 0xfe, 0x26, - 0x3a, 0x1d, 0x1a, 0x0a, 0x3a, 0x90, 0x9c, 0x75, - 0x51, 0x59, 0x89, 0x98, 0x1a, 0x56, 0xe1, 0x3a, - 0x1a, 0xba, 0xff, 0xb4, 0x37, 0x7d, 0xd8, 0x99, - 0xe2, 0xeb, 0x45, 0x27, 0xe2, 0x42, 0x42, 0x46, - 0xbb, 0x00, 0x29, 0x9f, 0x30, 0xc9, 0x1e, 0x6c, - 0xce, 0x59, 0x0e, 0xbe, 0x16, 0x03, 0x31, 0xec, - 0x10, 0xc1, 0x6d, 0xca, 0x9d, 0x5f, 0x6d, 0xf1, - 0x26, 0x11, 0xe5, 0x50, 0xa1, 0xbb, 0x67, 0xb2, - 0xe0, 0x2b, 0xed, 0x76, 0x5b, 0xc7, 0x68, 0xc0, - 0x18, 0xad, 0x91, 0x9e, 0xb5, 0xd4, 0x4d, 0x21, - 0xcd, 0x98, 0xd9, 0xe0, 0x05, 0x0a, 0x4d, 0x24, - 0xa3, 0xe6, 0x12, 0x04, 0xdd, 0x50, 0xe6, 0xc8, - 0x7a, 0x69, 0xb9, 0x32, 0x43, 0x02, 0x03, 0x01, - 0x00, 0x01, 0xa3, 0x82, 0x01, 0xb6, 0x30, 0x82, - 0x01, 0xb2, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, - 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xb6, - 0xa8, 0xff, 0xa2, 0xa8, 0x2f, 0xd0, 0xa6, 0xcd, - 0x4b, 0xb1, 0x68, 0xf3, 0xe7, 0x50, 0x10, 0x31, - 0xa7, 0x79, 0x21, 0x30, 0x1d, 0x06, 0x03, 0x55, - 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x62, 0x37, - 0xd4, 0x3c, 0xbf, 0xd9, 0xc2, 0x99, 0xf3, 0x28, - 0x3e, 0xdb, 0xca, 0xee, 0xf3, 0xb3, 0xc8, 0x73, - 0xb0, 0x3c, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, - 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, - 0x05, 0xa0, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, - 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00, - 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x04, - 0x16, 0x30, 0x14, 0x06, 0x08, 0x2b, 0x06, 0x01, - 0x05, 0x05, 0x07, 0x03, 0x01, 0x06, 0x08, 0x2b, - 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x02, 0x30, - 0x60, 0x06, 0x03, 0x55, 0x1d, 0x20, 0x04, 0x59, - 0x30, 0x57, 0x30, 0x4b, 0x06, 0x0b, 0x2b, 0x06, - 0x01, 0x04, 0x01, 0xb2, 0x31, 0x01, 0x02, 0x02, - 0x1a, 0x30, 0x3c, 0x30, 0x3a, 0x06, 0x08, 0x2b, - 0x06, 0x01, 0x05, 0x05, 0x07, 0x02, 0x01, 0x16, - 0x2e, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, - 0x77, 0x77, 0x77, 0x2e, 0x67, 0x61, 0x6e, 0x64, - 0x69, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x73, 0x2f, - 0x66, 0x72, 0x2f, 0x73, 0x73, 0x6c, 0x2f, 0x63, - 0x70, 0x73, 0x2f, 0x70, 0x64, 0x66, 0x2f, 0x30, - 0x08, 0x06, 0x06, 0x67, 0x81, 0x0c, 0x01, 0x02, - 0x01, 0x30, 0x3c, 0x06, 0x03, 0x55, 0x1d, 0x1f, - 0x04, 0x35, 0x30, 0x33, 0x30, 0x31, 0xa0, 0x2f, - 0xa0, 0x2d, 0x86, 0x2b, 0x68, 0x74, 0x74, 0x70, - 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x6c, 0x2e, 0x67, - 0x61, 0x6e, 0x64, 0x69, 0x2e, 0x6e, 0x65, 0x74, - 0x2f, 0x47, 0x61, 0x6e, 0x64, 0x69, 0x53, 0x74, - 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x53, 0x53, - 0x4c, 0x43, 0x41, 0x2e, 0x63, 0x72, 0x6c, 0x30, - 0x6a, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, - 0x07, 0x01, 0x01, 0x04, 0x5e, 0x30, 0x5c, 0x30, - 0x37, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, - 0x07, 0x30, 0x02, 0x86, 0x2b, 0x68, 0x74, 0x74, - 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x74, 0x2e, - 0x67, 0x61, 0x6e, 0x64, 0x69, 0x2e, 0x6e, 0x65, - 0x74, 0x2f, 0x47, 0x61, 0x6e, 0x64, 0x69, 0x53, - 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x53, - 0x53, 0x4c, 0x43, 0x41, 0x2e, 0x63, 0x72, 0x74, - 0x30, 0x21, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, - 0x05, 0x07, 0x30, 0x01, 0x86, 0x15, 0x68, 0x74, - 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6f, 0x63, 0x73, - 0x70, 0x2e, 0x67, 0x61, 0x6e, 0x64, 0x69, 0x2e, - 0x6e, 0x65, 0x74, 0x30, 0x27, 0x06, 0x03, 0x55, - 0x1d, 0x11, 0x04, 0x20, 0x30, 0x1e, 0x82, 0x0e, - 0x2a, 0x2e, 0x66, 0x72, 0x65, 0x65, 0x6e, 0x6f, - 0x64, 0x65, 0x2e, 0x6e, 0x65, 0x74, 0x82, 0x0c, - 0x66, 0x72, 0x65, 0x65, 0x6e, 0x6f, 0x64, 0x65, - 0x2e, 0x6e, 0x65, 0x74, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, - 0x5b, 0x4a, 0x3a, 0x1d, 0x75, 0xe0, 0xc0, 0x9e, - 0xc9, 0x16, 0x66, 0x7f, 0x73, 0x95, 0x6e, 0x35, - 0xe4, 0x27, 0xfa, 0x8c, 0x9d, 0xee, 0xb1, 0x37, - 0x42, 0x3f, 0x54, 0x6a, 0x9d, 0x41, 0x84, 0x57, - 0xe1, 0x03, 0x3d, 0x69, 0x61, 0x77, 0x3b, 0x91, - 0xa2, 0x70, 0x94, 0xb6, 0x8e, 0x41, 0x63, 0x70, - 0xf2, 0x16, 0x04, 0x50, 0x05, 0x14, 0xfb, 0x59, - 0x7d, 0x89, 0x09, 0x3f, 0xb6, 0xef, 0xca, 0x3c, - 0x89, 0x88, 0x08, 0xe9, 0xa1, 0xf3, 0x33, 0x31, - 0x05, 0x4d, 0x70, 0xff, 0xdd, 0xa7, 0xd2, 0xe2, - 0xa0, 0x94, 0x3a, 0xf7, 0xc2, 0x9f, 0xad, 0x2b, - 0x2e, 0x20, 0xfa, 0x6c, 0xe1, 0xfc, 0xe6, 0x62, - 0x22, 0xa1, 0x38, 0x93, 0xec, 0x3e, 0xce, 0xfd, - 0x1f, 0xdd, 0xd4, 0x7c, 0x39, 0x46, 0x8b, 0xb4, - 0x64, 0xfa, 0xa1, 0x46, 0x87, 0x78, 0x2c, 0xd7, - 0x9c, 0xdd, 0x60, 0xd6, 0xda, 0x8e, 0xd8, 0x29, - 0x6d, 0x61, 0xa7, 0x29, 0x07, 0x76, 0xfc, 0xf9, - 0xbd, 0xfd, 0x14, 0xeb, 0x44, 0x70, 0xff, 0xd0, - 0x23, 0x99, 0x83, 0xc5, 0x5c, 0x56, 0x88, 0xaa, - 0x34, 0xda, 0xa6, 0xb3, 0x9a, 0xbf, 0xda, 0x58, - 0x1e, 0xa4, 0xb8, 0xc0, 0x40, 0x9d, 0xf0, 0xfc, - 0xf1, 0x23, 0xc2, 0xbc, 0x59, 0xe1, 0x82, 0xed, - 0x5d, 0xfb, 0x99, 0xaf, 0xf5, 0xf5, 0x15, 0xb8, - 0x8b, 0x59, 0xce, 0xaa, 0xca, 0xdf, 0xdc, 0x94, - 0x11, 0xe0, 0x96, 0xbf, 0x9f, 0x54, 0xa4, 0x9f, - 0x54, 0x36, 0x4a, 0xe8, 0x93, 0xda, 0xf4, 0x8c, - 0xb0, 0x6b, 0x8d, 0x4a, 0x9e, 0x11, 0xae, 0xcb, - 0xcb, 0x33, 0x8a, 0x4d, 0xcd, 0x4e, 0xa5, 0x9b, - 0xe9, 0x14, 0x46, 0x43, 0x9b, 0x96, 0x5f, 0x6d, - 0xf2, 0xea, 0x40, 0xef, 0x14, 0xc3, 0x99, 0x9f, - 0x23, 0x1e, 0xa5, 0x13, 0xab, 0x08, 0xea, 0x8f, - 0x68, 0x5b, 0x7d, 0x71, 0xdf, 0x18, 0xd1, 0x57, - 0x00, 0x04, 0xa7, 0x30, 0x82, 0x04, 0xa3, 0x30, - 0x82, 0x03, 0x8b, 0xa0, 0x03, 0x02, 0x01, 0x02, - 0x02, 0x10, 0x5a, 0xb6, 0x1d, 0xac, 0x1e, 0x4d, - 0xa2, 0x06, 0x14, 0xc7, 0x55, 0x3d, 0x3d, 0xa9, - 0xb2, 0xdc, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, - 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, - 0x00, 0x30, 0x81, 0x97, 0x31, 0x0b, 0x30, 0x09, - 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, - 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, - 0x04, 0x08, 0x13, 0x02, 0x55, 0x54, 0x31, 0x17, - 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, - 0x0e, 0x53, 0x61, 0x6c, 0x74, 0x20, 0x4c, 0x61, - 0x6b, 0x65, 0x20, 0x43, 0x69, 0x74, 0x79, 0x31, - 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, - 0x13, 0x15, 0x54, 0x68, 0x65, 0x20, 0x55, 0x53, - 0x45, 0x52, 0x54, 0x52, 0x55, 0x53, 0x54, 0x20, - 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x31, - 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0b, - 0x13, 0x18, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, - 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x75, 0x73, 0x65, - 0x72, 0x74, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x63, - 0x6f, 0x6d, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x03, - 0x55, 0x04, 0x03, 0x13, 0x16, 0x55, 0x54, 0x4e, - 0x2d, 0x55, 0x53, 0x45, 0x52, 0x46, 0x69, 0x72, - 0x73, 0x74, 0x2d, 0x48, 0x61, 0x72, 0x64, 0x77, - 0x61, 0x72, 0x65, 0x30, 0x1e, 0x17, 0x0d, 0x30, - 0x38, 0x31, 0x30, 0x32, 0x33, 0x30, 0x30, 0x30, - 0x30, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x32, 0x30, - 0x30, 0x35, 0x33, 0x30, 0x31, 0x30, 0x34, 0x38, - 0x33, 0x38, 0x5a, 0x30, 0x41, 0x31, 0x0b, 0x30, - 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, - 0x46, 0x52, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, - 0x55, 0x04, 0x0a, 0x13, 0x09, 0x47, 0x41, 0x4e, - 0x44, 0x49, 0x20, 0x53, 0x41, 0x53, 0x31, 0x1e, - 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, - 0x15, 0x47, 0x61, 0x6e, 0x64, 0x69, 0x20, 0x53, - 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x20, - 0x53, 0x53, 0x4c, 0x20, 0x43, 0x41, 0x30, 0x82, - 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, - 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, - 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, - 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xb6, - 0x54, 0x3d, 0xa5, 0xdb, 0x0d, 0x22, 0x78, 0x50, - 0x6a, 0x5a, 0x23, 0x89, 0x3f, 0x97, 0xa1, 0xd4, - 0x07, 0x1a, 0xa9, 0x58, 0x08, 0x9b, 0xa0, 0x15, - 0xc3, 0x32, 0xb6, 0xb7, 0xf1, 0xe8, 0xb9, 0xa5, - 0x6f, 0xad, 0x37, 0xf6, 0x6e, 0x71, 0x1b, 0xb4, - 0x75, 0x2d, 0x48, 0x5e, 0x9f, 0xc6, 0x15, 0xaa, - 0x81, 0xef, 0xe5, 0xc4, 0x88, 0x95, 0x8a, 0x3a, - 0x6c, 0x77, 0xcc, 0xb5, 0xcd, 0x65, 0xe4, 0x67, - 0xe5, 0x73, 0xc9, 0x50, 0x52, 0x94, 0xc1, 0x27, - 0x49, 0x3e, 0xa0, 0x6b, 0x41, 0x16, 0x41, 0xb6, - 0x94, 0x99, 0x41, 0xae, 0x3e, 0xcb, 0xe2, 0x06, - 0x46, 0x09, 0xe9, 0x4d, 0xbe, 0xc9, 0x4c, 0x55, - 0xa9, 0x18, 0x7e, 0xa6, 0xdf, 0x6e, 0xfd, 0x4a, - 0xb2, 0xcc, 0x6c, 0x4e, 0xd9, 0xc8, 0x50, 0x15, - 0x93, 0xb3, 0xf2, 0xe9, 0xe3, 0xc2, 0x6a, 0xad, - 0x3a, 0xd5, 0xfb, 0xc3, 0x79, 0x50, 0x9f, 0x25, - 0x79, 0x29, 0xb2, 0x47, 0x64, 0x7c, 0x20, 0x3e, - 0xe2, 0x08, 0x4d, 0x93, 0x29, 0x14, 0xb6, 0x34, - 0x6e, 0xcf, 0x71, 0x46, 0x7e, 0x76, 0x10, 0xf4, - 0xfd, 0x6c, 0xaa, 0x01, 0xd2, 0xc2, 0x06, 0xde, - 0x92, 0x83, 0xcc, 0x58, 0x90, 0x2e, 0x92, 0xde, - 0x1e, 0x65, 0xb7, 0x63, 0x2f, 0x3d, 0xb2, 0xeb, - 0x70, 0x8c, 0x4c, 0xe0, 0xbe, 0x15, 0x9d, 0xde, - 0xc1, 0x4d, 0x56, 0xf8, 0x0b, 0xc6, 0x8e, 0x07, - 0xb9, 0x5d, 0xdf, 0x95, 0xf0, 0x7b, 0x40, 0x1f, - 0x1a, 0x2c, 0xd7, 0x9c, 0x2b, 0x4b, 0x76, 0xf4, - 0x59, 0xf5, 0x43, 0xc1, 0x2c, 0x66, 0x10, 0x9e, - 0x9e, 0x66, 0x96, 0x60, 0x9d, 0x1c, 0x74, 0x1b, - 0x4e, 0x18, 0x5c, 0x08, 0xb0, 0x6e, 0x6c, 0xca, - 0x69, 0x1a, 0x02, 0xe9, 0xbb, 0xca, 0x78, 0xef, - 0x66, 0x2e, 0xe3, 0x32, 0xfd, 0x41, 0x5c, 0x95, - 0x74, 0x81, 0x4d, 0xf4, 0xda, 0xfe, 0x4b, 0x02, - 0x03, 0x01, 0x00, 0x01, 0xa3, 0x82, 0x01, 0x3e, - 0x30, 0x82, 0x01, 0x3a, 0x30, 0x1f, 0x06, 0x03, - 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, - 0x14, 0xa1, 0x72, 0x5f, 0x26, 0x1b, 0x28, 0x98, - 0x43, 0x95, 0x5d, 0x07, 0x37, 0xd5, 0x85, 0x96, - 0x9d, 0x4b, 0xd2, 0xc3, 0x45, 0x30, 0x1d, 0x06, - 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, - 0xb6, 0xa8, 0xff, 0xa2, 0xa8, 0x2f, 0xd0, 0xa6, - 0xcd, 0x4b, 0xb1, 0x68, 0xf3, 0xe7, 0x50, 0x10, - 0x31, 0xa7, 0x79, 0x21, 0x30, 0x0e, 0x06, 0x03, - 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, - 0x03, 0x02, 0x01, 0x06, 0x30, 0x12, 0x06, 0x03, - 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x08, - 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x00, - 0x30, 0x18, 0x06, 0x03, 0x55, 0x1d, 0x20, 0x04, - 0x11, 0x30, 0x0f, 0x30, 0x0d, 0x06, 0x0b, 0x2b, - 0x06, 0x01, 0x04, 0x01, 0xb2, 0x31, 0x01, 0x02, - 0x02, 0x1a, 0x30, 0x44, 0x06, 0x03, 0x55, 0x1d, - 0x1f, 0x04, 0x3d, 0x30, 0x3b, 0x30, 0x39, 0xa0, - 0x37, 0xa0, 0x35, 0x86, 0x33, 0x68, 0x74, 0x74, - 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x6c, 0x2e, - 0x75, 0x73, 0x65, 0x72, 0x74, 0x72, 0x75, 0x73, - 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x55, 0x54, - 0x4e, 0x2d, 0x55, 0x53, 0x45, 0x52, 0x46, 0x69, - 0x72, 0x73, 0x74, 0x2d, 0x48, 0x61, 0x72, 0x64, - 0x77, 0x61, 0x72, 0x65, 0x2e, 0x63, 0x72, 0x6c, - 0x30, 0x74, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, - 0x05, 0x07, 0x01, 0x01, 0x04, 0x68, 0x30, 0x66, - 0x30, 0x3d, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, - 0x05, 0x07, 0x30, 0x02, 0x86, 0x31, 0x68, 0x74, - 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x74, - 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72, 0x75, - 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x55, - 0x54, 0x4e, 0x41, 0x64, 0x64, 0x54, 0x72, 0x75, - 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x5f, 0x43, 0x41, 0x2e, 0x63, 0x72, 0x74, 0x30, - 0x25, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, - 0x07, 0x30, 0x01, 0x86, 0x19, 0x68, 0x74, 0x74, - 0x70, 0x3a, 0x2f, 0x2f, 0x6f, 0x63, 0x73, 0x70, - 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72, 0x75, - 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x0d, - 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, - 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, - 0x01, 0x00, 0x19, 0x53, 0xbf, 0x03, 0x3d, 0x9b, - 0xe2, 0x6b, 0x5a, 0xfd, 0xba, 0x49, 0x1f, 0x4f, - 0xec, 0xe1, 0xc6, 0x82, 0x39, 0x3c, 0xd2, 0x03, - 0x04, 0x0f, 0xab, 0x7b, 0x3e, 0x82, 0xa9, 0x85, - 0x10, 0x1f, 0xf4, 0xde, 0x32, 0xaf, 0x58, 0x3f, - 0xff, 0x70, 0xf3, 0x30, 0x1d, 0x97, 0x2d, 0x4c, - 0x9a, 0xe2, 0xec, 0x0c, 0x3e, 0x14, 0x2d, 0x2f, - 0x98, 0x48, 0x9d, 0xae, 0x16, 0x6a, 0xac, 0x2d, - 0x42, 0xaa, 0xb5, 0x64, 0xa4, 0x70, 0xbb, 0xeb, - 0x73, 0x94, 0x7b, 0x46, 0x4c, 0xe7, 0x7a, 0x14, - 0x76, 0x5b, 0x4c, 0x1d, 0x84, 0xa1, 0x20, 0x74, - 0x1f, 0x2e, 0x4b, 0x5c, 0x70, 0x88, 0xdc, 0xbd, - 0xf7, 0x19, 0x3d, 0xed, 0x59, 0x0d, 0xe2, 0x3f, - 0x26, 0xe2, 0x9c, 0xac, 0xa4, 0x3c, 0x95, 0x1c, - 0xf8, 0xbe, 0x8c, 0x03, 0xae, 0xf0, 0xe5, 0x9c, - 0x4d, 0xbc, 0xc7, 0x9b, 0x58, 0x00, 0xbf, 0xaf, - 0xad, 0xfa, 0x37, 0x6e, 0x71, 0x6d, 0x18, 0x34, - 0x0e, 0xc1, 0xea, 0x6a, 0xf8, 0x0d, 0xdf, 0x69, - 0x54, 0x56, 0x15, 0xf2, 0x28, 0xb3, 0xfe, 0xa4, - 0x63, 0xec, 0xc5, 0x04, 0x64, 0x60, 0xbb, 0xfe, - 0x2a, 0xf0, 0xf4, 0x87, 0xa1, 0xb0, 0xae, 0xbd, - 0xaa, 0xe4, 0x2f, 0xe3, 0x03, 0x0b, 0x2f, 0x66, - 0x5f, 0x85, 0xa4, 0x32, 0x7b, 0x46, 0xed, 0x25, - 0x0c, 0xe7, 0xf1, 0xb7, 0xe7, 0x19, 0xfd, 0x60, - 0xba, 0x5f, 0x87, 0x77, 0xde, 0x98, 0x07, 0x96, - 0xe4, 0x5e, 0xea, 0x63, 0x7d, 0xa8, 0xde, 0x55, - 0xda, 0x61, 0x5c, 0x3c, 0x90, 0x83, 0x43, 0x04, - 0x07, 0x3c, 0xdd, 0xf3, 0xf8, 0x9f, 0x06, 0x52, - 0x0a, 0xde, 0xc7, 0xb6, 0x7b, 0x8f, 0xe1, 0x11, - 0xf7, 0x04, 0x7a, 0x35, 0xff, 0x6a, 0xbc, 0x5b, - 0xc7, 0x50, 0x49, 0x08, 0x70, 0x6f, 0x94, 0x43, - 0xcd, 0x9e, 0xc7, 0x70, 0xf1, 0xdb, 0xd0, 0x6d, - 0xda, 0x8f, 0x16, 0x03, 0x01, 0x00, 0x0e, 0x0d, - 0x00, 0x00, 0x06, 0x03, 0x01, 0x02, 0x40, 0x00, - 0x00, 0x0e, 0x00, 0x00, 0x00, - }, - { - 0x16, 0x03, 0x01, 0x02, 0xbe, 0x0b, 0x00, 0x02, - 0xba, 0x00, 0x02, 0xb7, 0x00, 0x02, 0xb4, 0x30, - 0x82, 0x02, 0xb0, 0x30, 0x82, 0x02, 0x19, 0xa0, - 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0x85, - 0xb0, 0xbb, 0xa4, 0x8a, 0x7f, 0xb8, 0xca, 0x30, - 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x45, - 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, - 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, - 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, - 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, - 0x55, 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, - 0x64, 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, - 0x79, 0x20, 0x4c, 0x74, 0x64, 0x30, 0x1e, 0x17, - 0x0d, 0x31, 0x30, 0x30, 0x34, 0x32, 0x34, 0x30, - 0x39, 0x30, 0x39, 0x33, 0x38, 0x5a, 0x17, 0x0d, - 0x31, 0x31, 0x30, 0x34, 0x32, 0x34, 0x30, 0x39, - 0x30, 0x39, 0x33, 0x38, 0x5a, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x30, 0x81, 0x9f, 0x30, - 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, - 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, - 0x00, 0xbb, 0x79, 0xd6, 0xf5, 0x17, 0xb5, 0xe5, - 0xbf, 0x46, 0x10, 0xd0, 0xdc, 0x69, 0xbe, 0xe6, - 0x2b, 0x07, 0x43, 0x5a, 0xd0, 0x03, 0x2d, 0x8a, - 0x7a, 0x43, 0x85, 0xb7, 0x14, 0x52, 0xe7, 0xa5, - 0x65, 0x4c, 0x2c, 0x78, 0xb8, 0x23, 0x8c, 0xb5, - 0xb4, 0x82, 0xe5, 0xde, 0x1f, 0x95, 0x3b, 0x7e, - 0x62, 0xa5, 0x2c, 0xa5, 0x33, 0xd6, 0xfe, 0x12, - 0x5c, 0x7a, 0x56, 0xfc, 0xf5, 0x06, 0xbf, 0xfa, - 0x58, 0x7b, 0x26, 0x3f, 0xb5, 0xcd, 0x04, 0xd3, - 0xd0, 0xc9, 0x21, 0x96, 0x4a, 0xc7, 0xf4, 0x54, - 0x9f, 0x5a, 0xbf, 0xef, 0x42, 0x71, 0x00, 0xfe, - 0x18, 0x99, 0x07, 0x7f, 0x7e, 0x88, 0x7d, 0x7d, - 0xf1, 0x04, 0x39, 0xc4, 0xa2, 0x2e, 0xdb, 0x51, - 0xc9, 0x7c, 0xe3, 0xc0, 0x4c, 0x3b, 0x32, 0x66, - 0x01, 0xcf, 0xaf, 0xb1, 0x1d, 0xb8, 0x71, 0x9a, - 0x1d, 0xdb, 0xdb, 0x89, 0x6b, 0xae, 0xda, 0x2d, - 0x79, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81, - 0xa7, 0x30, 0x81, 0xa4, 0x30, 0x1d, 0x06, 0x03, - 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xb1, - 0xad, 0xe2, 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb, - 0x69, 0xce, 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e, - 0x18, 0x88, 0x39, 0x30, 0x75, 0x06, 0x03, 0x55, - 0x1d, 0x23, 0x04, 0x6e, 0x30, 0x6c, 0x80, 0x14, - 0xb1, 0xad, 0xe2, 0x85, 0x5a, 0xcf, 0xcb, 0x28, - 0xdb, 0x69, 0xce, 0x23, 0x69, 0xde, 0xd3, 0x26, - 0x8e, 0x18, 0x88, 0x39, 0xa1, 0x49, 0xa4, 0x47, - 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, - 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, - 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, - 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, - 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x18, 0x49, - 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, - 0x57, 0x69, 0x64, 0x67, 0x69, 0x74, 0x73, 0x20, - 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, 0x82, - 0x09, 0x00, 0x85, 0xb0, 0xbb, 0xa4, 0x8a, 0x7f, - 0xb8, 0xca, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, - 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, - 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, - 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, - 0x81, 0x81, 0x00, 0x08, 0x6c, 0x45, 0x24, 0xc7, - 0x6b, 0xb1, 0x59, 0xab, 0x0c, 0x52, 0xcc, 0xf2, - 0xb0, 0x14, 0xd7, 0x87, 0x9d, 0x7a, 0x64, 0x75, - 0xb5, 0x5a, 0x95, 0x66, 0xe4, 0xc5, 0x2b, 0x8e, - 0xae, 0x12, 0x66, 0x1f, 0xeb, 0x4f, 0x38, 0xb3, - 0x6e, 0x60, 0xd3, 0x92, 0xfd, 0xf7, 0x41, 0x08, - 0xb5, 0x25, 0x13, 0xb1, 0x18, 0x7a, 0x24, 0xfb, - 0x30, 0x1d, 0xba, 0xed, 0x98, 0xb9, 0x17, 0xec, - 0xe7, 0xd7, 0x31, 0x59, 0xdb, 0x95, 0xd3, 0x1d, - 0x78, 0xea, 0x50, 0x56, 0x5c, 0xd5, 0x82, 0x5a, - 0x2d, 0x5a, 0x5f, 0x33, 0xc4, 0xb6, 0xd8, 0xc9, - 0x75, 0x90, 0x96, 0x8c, 0x0f, 0x52, 0x98, 0xb5, - 0xcd, 0x98, 0x1f, 0x89, 0x20, 0x5f, 0xf2, 0xa0, - 0x1c, 0xa3, 0x1b, 0x96, 0x94, 0xdd, 0xa9, 0xfd, - 0x57, 0xe9, 0x70, 0xe8, 0x26, 0x6d, 0x71, 0x99, - 0x9b, 0x26, 0x6e, 0x38, 0x50, 0x29, 0x6c, 0x90, - 0xa7, 0xbd, 0xd9, 0x16, 0x03, 0x01, 0x01, 0x06, - 0x10, 0x00, 0x01, 0x02, 0x01, 0x00, 0x25, 0x48, - 0x6c, 0x0a, 0xde, 0x9d, 0x3a, 0x57, 0xe4, 0x2e, - 0xb9, 0xfc, 0xb4, 0x46, 0x1f, 0x20, 0x4f, 0x58, - 0x4d, 0x12, 0x08, 0xb4, 0x3e, 0x4c, 0xf5, 0xa8, - 0xa5, 0x16, 0x40, 0x29, 0x19, 0x04, 0x4d, 0xf9, - 0x54, 0x3a, 0x32, 0xd7, 0x79, 0xf2, 0x0e, 0xc1, - 0x7b, 0x0c, 0x62, 0x71, 0xbb, 0xb4, 0x8c, 0xe7, - 0x84, 0xd5, 0xf8, 0x11, 0x77, 0x7f, 0x87, 0x6c, - 0xfc, 0x25, 0xf3, 0x2d, 0x97, 0x3d, 0x1f, 0xf5, - 0xfc, 0x64, 0x94, 0x9f, 0xdd, 0x90, 0x82, 0xdd, - 0x11, 0x74, 0x74, 0x59, 0xa2, 0x1a, 0x71, 0xb2, - 0x55, 0x6d, 0x18, 0xca, 0x85, 0x47, 0x8b, 0x79, - 0x73, 0x06, 0x24, 0x38, 0xc3, 0x34, 0x98, 0x84, - 0x62, 0x81, 0xd8, 0xad, 0x54, 0xad, 0x13, 0xa5, - 0xf4, 0xe4, 0x82, 0x85, 0xd3, 0xe3, 0x9e, 0xeb, - 0xb5, 0xf5, 0x95, 0x83, 0x0e, 0xb9, 0x7d, 0xb6, - 0xda, 0x0c, 0xf6, 0x14, 0x6a, 0x60, 0x8c, 0x75, - 0x56, 0xf0, 0xe9, 0x60, 0xe0, 0x4c, 0xf4, 0x4e, - 0x84, 0x8b, 0x4f, 0xf4, 0x2f, 0xde, 0xb7, 0xec, - 0x61, 0xd3, 0x77, 0x07, 0x6e, 0x41, 0x57, 0xc9, - 0xd9, 0x1d, 0x75, 0xee, 0x42, 0x63, 0xdc, 0x58, - 0xad, 0xfc, 0xc7, 0xe1, 0x77, 0x49, 0xb1, 0x58, - 0x21, 0x96, 0x00, 0x55, 0x90, 0x6b, 0xf6, 0x2a, - 0x5a, 0x19, 0x25, 0x93, 0x59, 0x9d, 0xaf, 0x79, - 0x9b, 0x18, 0x5d, 0xf6, 0x5d, 0x64, 0x4b, 0x9a, - 0xf4, 0xde, 0xf2, 0x7f, 0xbd, 0x93, 0x7e, 0x45, - 0x3e, 0x17, 0xae, 0xbf, 0x52, 0xe1, 0xba, 0x8e, - 0x0b, 0xbc, 0x1e, 0x91, 0x9d, 0xf1, 0x4e, 0x0b, - 0xab, 0x9e, 0x5c, 0x4c, 0x6f, 0xf7, 0xf3, 0x8d, - 0x8c, 0x6d, 0xeb, 0x46, 0x05, 0x36, 0x7e, 0x2f, - 0x9c, 0xa1, 0x86, 0x15, 0xe1, 0xe4, 0xb4, 0x20, - 0x06, 0x44, 0x7b, 0x3c, 0x8b, 0x13, 0x96, 0xf5, - 0x02, 0xb1, 0x4f, 0x3c, 0x2d, 0x4a, 0x16, 0x03, - 0x01, 0x00, 0x86, 0x0f, 0x00, 0x00, 0x82, 0x00, - 0x80, 0x52, 0xb1, 0x0d, 0xfc, 0x85, 0x34, 0x56, - 0xb9, 0xdf, 0xa7, 0x8e, 0xf4, 0xfd, 0x02, 0x46, - 0x8a, 0x23, 0xcc, 0x53, 0x3b, 0x0f, 0xa7, 0x61, - 0xf3, 0xb5, 0xbf, 0xfe, 0x59, 0x77, 0x10, 0xd6, - 0x56, 0x93, 0x19, 0x6b, 0x2c, 0xf1, 0x35, 0x71, - 0xe3, 0x36, 0x2f, 0xa0, 0x90, 0x4e, 0x5a, 0xdf, - 0x8d, 0x06, 0x88, 0xcf, 0xb1, 0x06, 0x56, 0x8b, - 0x74, 0x8f, 0x02, 0x8e, 0x10, 0xd2, 0xab, 0x8d, - 0x3f, 0x3e, 0x02, 0xf1, 0x1a, 0x80, 0x6d, 0x0f, - 0x9e, 0x77, 0xd8, 0xfa, 0x92, 0xb3, 0x16, 0x40, - 0xeb, 0x9e, 0xca, 0xd7, 0xe4, 0x31, 0xcc, 0x63, - 0x5f, 0xe2, 0x4c, 0x85, 0x0e, 0xf2, 0xdd, 0xd3, - 0xfe, 0x7e, 0xa7, 0x60, 0x1c, 0xb4, 0x00, 0xd8, - 0xbe, 0x4b, 0x9b, 0x66, 0x78, 0x0f, 0xfb, 0x3b, - 0x52, 0x30, 0x2b, 0x8b, 0xd9, 0xef, 0x82, 0x0a, - 0xa4, 0x18, 0x1d, 0xb0, 0xb5, 0xbf, 0x54, 0x97, - 0x0c, 0x14, 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, - 0x03, 0x01, 0x00, 0x30, 0xa1, 0x74, 0x22, 0xd8, - 0x86, 0x6a, 0xbe, 0x53, 0x34, 0x1d, 0xb3, 0x73, - 0xff, 0x51, 0xc0, 0xce, 0x8e, 0x7d, 0x9b, 0xab, - 0xcb, 0x8b, 0x79, 0xae, 0x04, 0x01, 0xa7, 0xf2, - 0x8e, 0x9d, 0xab, 0xa3, 0x73, 0x80, 0x5c, 0xff, - 0x96, 0x20, 0xbb, 0x8d, 0xc0, 0x02, 0x66, 0x6c, - 0x83, 0x4b, 0x78, 0x20, - }, - { - 0x14, 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, - 0x01, 0x00, 0x30, 0x29, 0xd4, 0xfd, 0x03, 0x8b, - 0x30, 0x20, 0xf7, 0xca, 0xc0, 0x6c, 0x83, 0x5d, - 0x73, 0xcb, 0x81, 0x60, 0xe0, 0x9a, 0x09, 0xcb, - 0x33, 0x03, 0x80, 0x81, 0x4e, 0x84, 0x47, 0xd5, - 0x74, 0x6c, 0x3b, 0xb5, 0xc0, 0x48, 0x0d, 0x52, - 0xdd, 0xbe, 0xc2, 0x06, 0xf5, 0x79, 0x2b, 0x3e, - 0x99, 0x56, 0x94, 0x17, 0x03, 0x01, 0x00, 0x20, - 0x26, 0x46, 0x90, 0x9d, 0xef, 0x59, 0x00, 0xb6, - 0x70, 0xe8, 0x1e, 0x1a, 0x80, 0x8b, 0x04, 0xb2, - 0xfc, 0x51, 0xf8, 0x93, 0xbe, 0x00, 0x28, 0xba, - 0xb8, 0xdc, 0x51, 0x7e, 0x92, 0x80, 0xfa, 0xf2, - 0x17, 0x03, 0x01, 0x00, 0xe0, 0xb8, 0x2e, 0xc4, - 0x6b, 0x3f, 0xda, 0x39, 0x87, 0x7f, 0x03, 0x43, - 0x28, 0xdd, 0xb9, 0xf9, 0x9e, 0x16, 0xf5, 0xce, - 0x3f, 0x7e, 0x6a, 0x7b, 0xb3, 0x60, 0x14, 0xe1, - 0xea, 0x54, 0xc5, 0xe6, 0x05, 0x0a, 0x6c, 0xe0, - 0xef, 0x58, 0x29, 0x8a, 0x77, 0x64, 0x77, 0x5d, - 0x9c, 0xe2, 0xe0, 0x3c, 0x6d, 0x87, 0x82, 0xbe, - 0x47, 0x63, 0xd4, 0xfd, 0x0c, 0x25, 0xc4, 0xb1, - 0xfe, 0x29, 0x6f, 0x84, 0xfb, 0xab, 0x6e, 0xa7, - 0xf9, 0x22, 0x89, 0x97, 0x5b, 0x91, 0x0a, 0x07, - 0xe0, 0xef, 0x3d, 0x67, 0xee, 0x87, 0xa8, 0x33, - 0x02, 0x64, 0x33, 0xca, 0x15, 0x10, 0xb9, 0x57, - 0xd8, 0xe5, 0x1a, 0x4b, 0xe3, 0x45, 0xc1, 0x62, - 0x85, 0x50, 0xf1, 0x79, 0x54, 0xe1, 0x2e, 0x25, - 0x01, 0x3c, 0xdb, 0x2d, 0x39, 0x14, 0x2f, 0x9b, - 0xd0, 0x1d, 0xc1, 0xac, 0x73, 0x7d, 0xa4, 0xed, - 0x89, 0x98, 0xb1, 0xae, 0x8a, 0x9e, 0xc8, 0xa7, - 0xfe, 0x55, 0x27, 0xb5, 0xb5, 0xa2, 0xec, 0x7e, - 0xe3, 0x6b, 0x45, 0x19, 0xfa, 0x20, 0x1c, 0x33, - 0x83, 0x22, 0x33, 0x97, 0xd2, 0x5a, 0xc4, 0xf8, - 0x9a, 0x03, 0x13, 0x85, 0xf2, 0x2b, 0x04, 0x59, - 0x27, 0xd7, 0x0b, 0x42, 0x47, 0x9b, 0x7d, 0x4d, - 0xb2, 0x1a, 0x85, 0x7f, 0x97, 0xc2, 0xf2, 0x10, - 0xf0, 0xfa, 0x4e, 0x4b, 0x62, 0x43, 0x3a, 0x09, - 0x2e, 0xcd, 0x8f, 0xa8, 0xb6, 0x0b, 0x5f, 0x34, - 0xd7, 0x3b, 0xba, 0xd9, 0xe5, 0x01, 0x2d, 0x35, - 0xae, 0xc5, 0x4c, 0xab, 0x40, 0x64, 0xc2, 0xc9, - 0x8c, 0x69, 0x44, 0xf4, 0xb8, 0xb5, 0x3a, 0x05, - 0x3c, 0x29, 0x19, 0xb4, 0x09, 0x17, 0x03, 0x01, - 0x00, 0x20, 0xc8, 0xc5, 0xb7, 0xe3, 0xd2, 0x3e, - 0x27, 0xb5, 0x71, 0x8f, 0x52, 0x0b, 0xce, 0x17, - 0x64, 0x86, 0xa4, 0x34, 0x16, 0x1b, 0x61, 0x64, - 0x7c, 0xb3, 0xf2, 0xe5, 0x3e, 0xfd, 0xdd, 0xfb, - 0x40, 0x78, 0x17, 0x03, 0x01, 0x00, 0x50, 0x8e, - 0x79, 0xf0, 0x8e, 0x76, 0x5d, 0x34, 0x09, 0xdc, - 0xec, 0x6d, 0xc3, 0x43, 0x1d, 0xcb, 0x2d, 0xaa, - 0x08, 0x7a, 0x51, 0x94, 0x4e, 0xc5, 0x26, 0xe4, - 0x0b, 0x8e, 0x8f, 0x51, 0xf2, 0x9f, 0xeb, 0xc3, - 0x18, 0x43, 0x95, 0x15, 0xfc, 0x59, 0x18, 0x25, - 0x47, 0xb6, 0x4a, 0x6e, 0xa3, 0xa4, 0x3b, 0xa3, - 0x47, 0x34, 0x74, 0x6b, 0xc5, 0x3d, 0x41, 0x14, - 0x64, 0xd5, 0x69, 0x5f, 0x77, 0xf3, 0x7c, 0x41, - 0xc6, 0xed, 0x2e, 0xcf, 0xff, 0x40, 0xf2, 0xce, - 0xbb, 0xa7, 0x4e, 0x73, 0x88, 0x98, 0x10, - }, - { - 0x15, 0x03, 0x01, 0x00, 0x20, 0x1a, 0xbc, 0x70, - 0x24, 0xf8, 0xfb, 0xf2, 0x4a, 0xf9, 0x44, 0x1e, - 0x58, 0xf8, 0xaa, 0x41, 0x24, 0xe8, 0x80, 0x33, - 0x45, 0x18, 0xa1, 0x5d, 0xee, 0x16, 0x80, 0xae, - 0x40, 0x41, 0x8e, 0x41, 0x9b, - }, -} - -var tls11ECDHEAESClientScript = [][]byte{ - { - 0x16, 0x03, 0x01, 0x00, 0x4a, 0x01, 0x00, 0x00, - 0x46, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xc0, 0x13, - 0x01, 0x00, 0x00, 0x1b, 0x00, 0x05, 0x00, 0x05, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, - 0x08, 0x00, 0x06, 0x00, 0x17, 0x00, 0x18, 0x00, - 0x19, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, - }, - { - 0x16, 0x03, 0x02, 0x00, 0x54, 0x02, 0x00, 0x00, - 0x50, 0x03, 0x02, 0x51, 0x9f, 0xa2, 0x21, 0x1a, - 0xb7, 0x75, 0x42, 0x69, 0xd3, 0x14, 0xdd, 0x05, - 0x1e, 0xda, 0x13, 0x71, 0x8d, 0x6a, 0x45, 0x97, - 0xcb, 0xee, 0x0e, 0x77, 0x01, 0x0d, 0x6e, 0xe5, - 0x22, 0x70, 0x16, 0x20, 0x69, 0xfc, 0xa6, 0x9a, - 0xe8, 0x21, 0xcc, 0x46, 0x65, 0x05, 0xb4, 0x48, - 0x0f, 0x34, 0x63, 0x2c, 0xac, 0xa4, 0xf5, 0x4b, - 0x64, 0xd1, 0x07, 0x13, 0xa7, 0xe4, 0x5b, 0xa3, - 0x4d, 0x31, 0x41, 0x53, 0xc0, 0x13, 0x00, 0x00, - 0x08, 0x00, 0x0b, 0x00, 0x04, 0x03, 0x00, 0x01, - 0x02, 0x16, 0x03, 0x02, 0x02, 0x39, 0x0b, 0x00, - 0x02, 0x35, 0x00, 0x02, 0x32, 0x00, 0x02, 0x2f, - 0x30, 0x82, 0x02, 0x2b, 0x30, 0x82, 0x01, 0xd5, - 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, - 0xb1, 0x35, 0x13, 0x65, 0x11, 0x20, 0xc5, 0x92, - 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, - 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, - 0x45, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, - 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, - 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, - 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, - 0x03, 0x55, 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, - 0x69, 0x64, 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, - 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, 0x30, 0x1e, - 0x17, 0x0d, 0x31, 0x32, 0x30, 0x34, 0x30, 0x36, - 0x31, 0x37, 0x31, 0x30, 0x31, 0x33, 0x5a, 0x17, - 0x0d, 0x31, 0x35, 0x30, 0x34, 0x30, 0x36, 0x31, - 0x37, 0x31, 0x30, 0x31, 0x33, 0x5a, 0x30, 0x45, - 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, - 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, - 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, - 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, - 0x55, 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, - 0x64, 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, - 0x79, 0x20, 0x4c, 0x74, 0x64, 0x30, 0x5c, 0x30, - 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x4b, - 0x00, 0x30, 0x48, 0x02, 0x41, 0x00, 0x9f, 0xb3, - 0xc3, 0x84, 0x27, 0x95, 0xff, 0x12, 0x31, 0x52, - 0x0f, 0x15, 0xef, 0x46, 0x11, 0xc4, 0xad, 0x80, - 0xe6, 0x36, 0x5b, 0x0f, 0xdd, 0x80, 0xd7, 0x61, - 0x8d, 0xe0, 0xfc, 0x72, 0x45, 0x09, 0x34, 0xfe, - 0x55, 0x66, 0x45, 0x43, 0x4c, 0x68, 0x97, 0x6a, - 0xfe, 0xa8, 0xa0, 0xa5, 0xdf, 0x5f, 0x78, 0xff, - 0xee, 0xd7, 0x64, 0xb8, 0x3f, 0x04, 0xcb, 0x6f, - 0xff, 0x2a, 0xfe, 0xfe, 0xb9, 0xed, 0x02, 0x03, - 0x01, 0x00, 0x01, 0xa3, 0x81, 0xa7, 0x30, 0x81, - 0xa4, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, - 0x04, 0x16, 0x04, 0x14, 0x78, 0xa6, 0x97, 0x9a, - 0x63, 0xb5, 0xc5, 0xa1, 0xa5, 0x33, 0xba, 0x22, - 0x7c, 0x23, 0x6e, 0x5b, 0x1b, 0x7a, 0xcc, 0x2b, - 0x30, 0x75, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, - 0x6e, 0x30, 0x6c, 0x80, 0x14, 0x78, 0xa6, 0x97, - 0x9a, 0x63, 0xb5, 0xc5, 0xa1, 0xa5, 0x33, 0xba, - 0x22, 0x7c, 0x23, 0x6e, 0x5b, 0x1b, 0x7a, 0xcc, - 0x2b, 0xa1, 0x49, 0xa4, 0x47, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x82, 0x09, 0x00, 0xb1, - 0x35, 0x13, 0x65, 0x11, 0x20, 0xc5, 0x92, 0x30, - 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, - 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x01, 0x05, 0x05, 0x00, 0x03, 0x41, 0x00, 0x85, - 0x36, 0x40, 0x73, 0xc1, 0xbb, 0x1a, 0xda, 0xd4, - 0x59, 0x9f, 0x2d, 0xa2, 0x70, 0x31, 0x46, 0x74, - 0xec, 0x83, 0x6e, 0xa8, 0xc8, 0x3c, 0x51, 0xaf, - 0x39, 0xac, 0xec, 0x40, 0xbc, 0xe8, 0x22, 0x46, - 0x1d, 0x99, 0xd6, 0x46, 0x2a, 0x24, 0xd4, 0x8b, - 0x05, 0x08, 0x4b, 0xfb, 0x35, 0x11, 0x6e, 0x92, - 0xbb, 0x77, 0xba, 0xe4, 0x12, 0xbb, 0xf4, 0xc8, - 0x5e, 0x9c, 0x81, 0xa8, 0x97, 0x60, 0x4c, 0x16, - 0x03, 0x02, 0x00, 0x8b, 0x0c, 0x00, 0x00, 0x87, - 0x03, 0x00, 0x17, 0x41, 0x04, 0x34, 0xde, 0x50, - 0x32, 0x8f, 0x25, 0x6b, 0x37, 0x2c, 0x36, 0x24, - 0x27, 0x0e, 0xf9, 0x67, 0xb4, 0xf8, 0x29, 0x1c, - 0xa5, 0xa4, 0x59, 0x9a, 0xca, 0x40, 0x26, 0x15, - 0x61, 0x72, 0x34, 0x4a, 0xd3, 0x0c, 0xac, 0x69, - 0xcb, 0x2a, 0x9e, 0xf8, 0x80, 0xfb, 0x7a, 0xc4, - 0xd4, 0x4b, 0x91, 0x1b, 0xbe, 0x24, 0x26, 0xad, - 0x19, 0x24, 0xbe, 0x32, 0x58, 0xfb, 0xc7, 0x77, - 0xce, 0x7e, 0x71, 0x51, 0x1a, 0x00, 0x40, 0x1a, - 0x0b, 0xe8, 0x91, 0x84, 0x64, 0x54, 0xb6, 0x19, - 0xe8, 0xd4, 0x43, 0x7c, 0x09, 0x0c, 0x2e, 0xba, - 0x42, 0xb9, 0x74, 0xc3, 0x6c, 0x06, 0x9b, 0xa6, - 0x7e, 0x92, 0xe9, 0xee, 0x7c, 0x74, 0xa9, 0xd3, - 0x63, 0xf0, 0x16, 0x20, 0x60, 0x71, 0x8e, 0x24, - 0xc7, 0x7f, 0xc5, 0x5b, 0x9c, 0x19, 0x0c, 0x80, - 0x15, 0x61, 0xbf, 0xb6, 0xed, 0x5b, 0x7b, 0x90, - 0xc5, 0x05, 0x13, 0x72, 0x45, 0x79, 0xdf, 0x16, - 0x03, 0x02, 0x00, 0x04, 0x0e, 0x00, 0x00, 0x00, - }, - { - 0x16, 0x03, 0x02, 0x00, 0x46, 0x10, 0x00, 0x00, - 0x42, 0x41, 0x04, 0x1e, 0x18, 0x37, 0xef, 0x0d, - 0x19, 0x51, 0x88, 0x35, 0x75, 0x71, 0xb5, 0xe5, - 0x54, 0x5b, 0x12, 0x2e, 0x8f, 0x09, 0x67, 0xfd, - 0xa7, 0x24, 0x20, 0x3e, 0xb2, 0x56, 0x1c, 0xce, - 0x97, 0x28, 0x5e, 0xf8, 0x2b, 0x2d, 0x4f, 0x9e, - 0xf1, 0x07, 0x9f, 0x6c, 0x4b, 0x5b, 0x83, 0x56, - 0xe2, 0x32, 0x42, 0xe9, 0x58, 0xb6, 0xd7, 0x49, - 0xa6, 0xb5, 0x68, 0x1a, 0x41, 0x03, 0x56, 0x6b, - 0xdc, 0x5a, 0x89, 0x14, 0x03, 0x02, 0x00, 0x01, - 0x01, 0x16, 0x03, 0x02, 0x00, 0x40, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x50, - 0x32, 0x26, 0x51, 0xbd, 0xbd, 0x3c, 0x4f, 0x72, - 0xbf, 0xbc, 0x91, 0x70, 0x4b, 0x5d, 0x43, 0x4a, - 0x65, 0x26, 0x0d, 0xaa, 0xed, 0x00, 0x91, 0xaf, - 0x4f, 0x47, 0x09, 0xaa, 0x79, 0xc4, 0x47, 0x21, - 0x71, 0xd8, 0x2b, 0xc1, 0x51, 0xc8, 0xef, 0xed, - 0x67, 0xde, 0x97, 0xef, 0x18, 0x53, - }, - { - 0x14, 0x03, 0x02, 0x00, 0x01, 0x01, 0x16, 0x03, - 0x02, 0x00, 0x40, 0x72, 0x20, 0xbf, 0xd1, 0xbd, - 0x83, 0x53, 0x57, 0xb0, 0x4e, 0xac, 0xba, 0x1a, - 0x2b, 0x2d, 0xeb, 0x8a, 0x48, 0x17, 0xfa, 0x69, - 0xf9, 0xb5, 0x94, 0x8e, 0x6f, 0x9c, 0xda, 0x59, - 0xba, 0x6c, 0x7c, 0x82, 0xe2, 0x53, 0xa9, 0x46, - 0xdc, 0x33, 0xa0, 0x9b, 0xf0, 0x1e, 0xf1, 0x53, - 0x83, 0x48, 0xbf, 0x5e, 0xef, 0x03, 0x2b, 0x50, - 0x7a, 0xa6, 0xf8, 0xc3, 0x9e, 0x24, 0x43, 0x3a, - 0xdf, 0x44, 0x3e, - }, - { - 0x17, 0x03, 0x02, 0x00, 0x30, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x0b, 0x8f, - 0x6b, 0xf9, 0xd3, 0x9f, 0x2b, 0x49, 0xe0, 0x62, - 0x9a, 0x0b, 0x3e, 0xa2, 0x72, 0x8b, 0x96, 0x0c, - 0x41, 0x09, 0x95, 0x9e, 0x6b, 0x26, 0xa1, 0x46, - 0xca, 0xb8, 0xb6, 0xd2, 0xd4, 0x15, 0x03, 0x02, - 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xa0, 0xd4, 0x84, 0xc6, 0x7e, 0x1c, - 0x2f, 0xbd, 0x6b, 0x45, 0x31, 0x1d, 0x7d, 0x8f, - 0x31, 0x39, 0x5a, 0x4e, 0xaa, 0xf1, 0x0a, 0x8a, - 0x6c, 0x33, 0x59, 0x19, 0xd8, 0x75, 0x80, 0xab, - 0x93, 0x81, - }, -} - -var clientChainCertificateScript = [][]byte{ - { - 0x16, 0x03, 0x01, 0x00, 0x4a, 0x01, 0x00, 0x00, - 0x46, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, - 0x01, 0x00, 0x00, 0x1b, 0x00, 0x05, 0x00, 0x05, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, - 0x08, 0x00, 0x06, 0x00, 0x17, 0x00, 0x18, 0x00, - 0x19, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x4a, 0x02, 0x00, 0x00, - 0x46, 0x03, 0x01, 0x51, 0xa2, 0x9b, 0x8b, 0xd4, - 0xe6, 0x33, 0xa2, 0x70, 0x38, 0x37, 0xba, 0x55, - 0x86, 0xcf, 0x87, 0xea, 0x6d, 0x2c, 0x3e, 0x17, - 0xc2, 0x09, 0xf8, 0x4d, 0xb0, 0x5d, 0x93, 0x2b, - 0x15, 0x99, 0x0c, 0x20, 0x5d, 0x61, 0x21, 0x2c, - 0xed, 0x49, 0x32, 0x29, 0x08, 0x6e, 0x21, 0x58, - 0x00, 0xdb, 0x34, 0xb7, 0x37, 0xcd, 0x27, 0x75, - 0x31, 0x1e, 0x6c, 0x74, 0xa6, 0xef, 0xa2, 0xc4, - 0x2b, 0x6c, 0xc3, 0x03, 0x00, 0x05, 0x00, 0x16, - 0x03, 0x01, 0x03, 0xef, 0x0b, 0x00, 0x03, 0xeb, - 0x00, 0x03, 0xe8, 0x00, 0x03, 0xe5, 0x30, 0x82, - 0x03, 0xe1, 0x30, 0x82, 0x02, 0xc9, 0xa0, 0x03, - 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xcc, 0x22, - 0x4c, 0x4b, 0x98, 0xa2, 0x88, 0xfc, 0x30, 0x0d, - 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, - 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x81, 0x86, - 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, - 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0b, 0x30, - 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x02, - 0x4e, 0x59, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, - 0x55, 0x04, 0x07, 0x0c, 0x08, 0x42, 0x72, 0x6f, - 0x6f, 0x6b, 0x6c, 0x79, 0x6e, 0x31, 0x21, 0x30, - 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x18, - 0x4d, 0x79, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x41, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, - 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, - 0x03, 0x0c, 0x08, 0x6d, 0x79, 0x63, 0x61, 0x2e, - 0x6f, 0x72, 0x67, 0x31, 0x21, 0x30, 0x1f, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x09, 0x01, 0x16, 0x12, 0x6a, 0x76, 0x73, 0x68, - 0x61, 0x68, 0x69, 0x64, 0x40, 0x67, 0x6d, 0x61, - 0x69, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x1e, - 0x17, 0x0d, 0x31, 0x33, 0x30, 0x35, 0x32, 0x36, - 0x32, 0x31, 0x30, 0x35, 0x30, 0x31, 0x5a, 0x17, - 0x0d, 0x32, 0x33, 0x30, 0x35, 0x32, 0x34, 0x32, - 0x31, 0x30, 0x35, 0x30, 0x31, 0x5a, 0x30, 0x81, - 0x86, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, - 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0b, - 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, - 0x02, 0x4e, 0x59, 0x31, 0x11, 0x30, 0x0f, 0x06, - 0x03, 0x55, 0x04, 0x07, 0x0c, 0x08, 0x42, 0x72, - 0x6f, 0x6f, 0x6b, 0x6c, 0x79, 0x6e, 0x31, 0x21, - 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, - 0x18, 0x4d, 0x79, 0x20, 0x43, 0x65, 0x72, 0x74, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, - 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, - 0x79, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, - 0x04, 0x03, 0x0c, 0x08, 0x6d, 0x79, 0x63, 0x61, - 0x2e, 0x6f, 0x72, 0x67, 0x31, 0x21, 0x30, 0x1f, - 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, - 0x01, 0x09, 0x01, 0x16, 0x12, 0x6a, 0x76, 0x73, - 0x68, 0x61, 0x68, 0x69, 0x64, 0x40, 0x67, 0x6d, - 0x61, 0x69, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x30, - 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, - 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, - 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, - 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, - 0xf0, 0xfb, 0xad, 0x80, 0x5e, 0x37, 0xd3, 0x6d, - 0xee, 0x2e, 0xcc, 0xbc, 0x0c, 0xd7, 0x56, 0x4b, - 0x56, 0x45, 0xcd, 0x28, 0xb6, 0x22, 0xe9, 0xe2, - 0x0f, 0xd1, 0x87, 0x2a, 0x27, 0xce, 0x77, 0x8d, - 0x6e, 0x0e, 0x0f, 0xfb, 0x66, 0xe1, 0xb5, 0x0e, - 0x9a, 0xb6, 0x05, 0x8e, 0xb3, 0xe1, 0xc5, 0x77, - 0x86, 0x5b, 0x46, 0xd2, 0x0b, 0x92, 0x03, 0x1b, - 0x89, 0x0c, 0x1b, 0x10, 0x0e, 0x99, 0x8f, 0xe2, - 0x17, 0xe8, 0xc2, 0x30, 0x00, 0x47, 0xd6, 0xfc, - 0xf9, 0x0f, 0x3b, 0x75, 0x34, 0x8d, 0x4d, 0xb0, - 0x99, 0xb7, 0xa0, 0x6d, 0xa0, 0xb6, 0xad, 0xda, - 0x07, 0x5e, 0x38, 0x2e, 0x02, 0xe4, 0x30, 0x6d, - 0xae, 0x13, 0x72, 0xd4, 0xc8, 0xce, 0x14, 0x07, - 0xae, 0x23, 0x8c, 0x8f, 0x9e, 0x8c, 0x60, 0xd6, - 0x06, 0xb9, 0xef, 0x00, 0x18, 0xc0, 0x1d, 0x25, - 0x1e, 0xda, 0x3e, 0x2f, 0xcf, 0x2b, 0x56, 0x84, - 0x9e, 0x30, 0x21, 0xc7, 0x29, 0xf6, 0x03, 0x8a, - 0x24, 0xf9, 0x34, 0xac, 0x65, 0x9d, 0x80, 0x36, - 0xc8, 0x3b, 0x15, 0x10, 0xbd, 0x51, 0xe9, 0xbc, - 0x02, 0xe1, 0xe9, 0xb3, 0x5a, 0x9a, 0x99, 0x41, - 0x1b, 0x27, 0xa0, 0x4d, 0x50, 0x9e, 0x27, 0x7f, - 0xa1, 0x7d, 0x09, 0x87, 0xbd, 0x8a, 0xca, 0x5f, - 0xb1, 0xa5, 0x08, 0xb8, 0x04, 0xd4, 0x52, 0x89, - 0xaa, 0xe0, 0x7d, 0x42, 0x2e, 0x2f, 0x15, 0xee, - 0x66, 0x57, 0x0f, 0x13, 0x19, 0x45, 0xa8, 0x4b, - 0x5d, 0x81, 0x66, 0xcc, 0x12, 0x37, 0x94, 0x5e, - 0xfd, 0x3c, 0x10, 0x81, 0x51, 0x3f, 0xfa, 0x0f, - 0xdd, 0xa1, 0x89, 0x03, 0xa9, 0x78, 0x91, 0xf5, - 0x3b, 0xf3, 0xbc, 0xac, 0xbe, 0x93, 0x30, 0x2e, - 0xbe, 0xca, 0x7f, 0x46, 0xd3, 0x28, 0xb4, 0x4e, - 0x91, 0x7b, 0x5b, 0x43, 0x6c, 0xaf, 0x9b, 0x5c, - 0x6a, 0x6d, 0x5a, 0xdb, 0x79, 0x5e, 0x6a, 0x6b, - 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x50, 0x30, - 0x4e, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, - 0x04, 0x16, 0x04, 0x14, 0x6b, 0x1e, 0x00, 0xa8, - 0x9f, 0xfa, 0x7d, 0x00, 0xf9, 0xe0, 0x9d, 0x0f, - 0x90, 0x8c, 0x90, 0xa8, 0xa1, 0x37, 0x6b, 0xda, - 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, - 0x18, 0x30, 0x16, 0x80, 0x14, 0x6b, 0x1e, 0x00, - 0xa8, 0x9f, 0xfa, 0x7d, 0x00, 0xf9, 0xe0, 0x9d, - 0x0f, 0x90, 0x8c, 0x90, 0xa8, 0xa1, 0x37, 0x6b, - 0xda, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, - 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, - 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, - 0x01, 0x01, 0x00, 0xcd, 0x6f, 0x73, 0x4d, 0x56, - 0x0b, 0xf3, 0x2e, 0x1c, 0xe2, 0x02, 0x0c, 0x14, - 0xbb, 0x2f, 0xdd, 0x3c, 0x43, 0xfe, 0xdf, 0x94, - 0x2d, 0xa9, 0x89, 0x81, 0x51, 0xf8, 0x5f, 0xa7, - 0xa0, 0x13, 0xaa, 0xcc, 0xb0, 0x18, 0xe2, 0x57, - 0x3e, 0x0d, 0x29, 0x93, 0xe8, 0x95, 0xd5, 0x1b, - 0x53, 0xd2, 0x51, 0xf2, 0xbd, 0xf5, 0x9e, 0x7b, - 0x22, 0x65, 0x62, 0x5c, 0xc4, 0x4c, 0x1d, 0xe8, - 0xe9, 0xc3, 0xd4, 0x2b, 0xe7, 0x78, 0xcb, 0x10, - 0xf3, 0xfe, 0x06, 0x83, 0xdc, 0x3a, 0x1e, 0x62, - 0x10, 0xc0, 0x46, 0x77, 0xc6, 0x9d, 0x9f, 0xab, - 0x96, 0x25, 0x5c, 0xfb, 0x26, 0xc1, 0x15, 0x1f, - 0xa5, 0x33, 0xee, 0x4f, 0x9a, 0x14, 0x6a, 0x14, - 0x97, 0x93, 0x2b, 0x95, 0x0b, 0xdc, 0xa8, 0xd7, - 0x69, 0x2e, 0xf0, 0x01, 0x0e, 0xfd, 0x4e, 0xd0, - 0xd9, 0xa8, 0xe5, 0x65, 0xde, 0xfb, 0xca, 0xca, - 0x1c, 0x5f, 0xf9, 0x53, 0xa0, 0x87, 0xe7, 0x33, - 0x9b, 0x2f, 0xcf, 0xe4, 0x13, 0xfc, 0xec, 0x7a, - 0x6c, 0xb0, 0x90, 0x13, 0x9b, 0xb6, 0xc5, 0x03, - 0xf6, 0x0e, 0x5e, 0xe2, 0xe4, 0x26, 0xc1, 0x7e, - 0x53, 0xfe, 0x69, 0xa3, 0xc7, 0xd8, 0x8e, 0x6e, - 0x94, 0x32, 0xa0, 0xde, 0xca, 0xb6, 0xcc, 0xd6, - 0x01, 0xd5, 0x78, 0x40, 0x28, 0x63, 0x9b, 0xee, - 0xcf, 0x09, 0x3b, 0x35, 0x04, 0xf0, 0x14, 0x02, - 0xf6, 0x80, 0x0e, 0x90, 0xb2, 0x94, 0xd2, 0x25, - 0x16, 0xb8, 0x7a, 0x76, 0x87, 0x84, 0x9f, 0x84, - 0xc5, 0xaf, 0xc2, 0x6d, 0x68, 0x7a, 0x84, 0x9c, - 0xc6, 0x8a, 0x63, 0x60, 0x87, 0x6a, 0x25, 0xc1, - 0xa1, 0x78, 0x0f, 0xba, 0xe8, 0x5f, 0xe1, 0xba, - 0xac, 0xa4, 0x6f, 0xdd, 0x09, 0x3f, 0x12, 0xcb, - 0x1d, 0xf3, 0xcf, 0x48, 0xd7, 0xd3, 0x26, 0xe8, - 0x9c, 0xc3, 0x53, 0xb3, 0xba, 0xdc, 0x32, 0x99, - 0x98, 0x96, 0xd6, 0x16, 0x03, 0x01, 0x00, 0x99, - 0x0d, 0x00, 0x00, 0x91, 0x03, 0x01, 0x02, 0x40, - 0x00, 0x8b, 0x00, 0x89, 0x30, 0x81, 0x86, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x02, 0x4e, - 0x59, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, - 0x04, 0x07, 0x0c, 0x08, 0x42, 0x72, 0x6f, 0x6f, - 0x6b, 0x6c, 0x79, 0x6e, 0x31, 0x21, 0x30, 0x1f, - 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x18, 0x4d, - 0x79, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x41, 0x75, - 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31, - 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, - 0x0c, 0x08, 0x6d, 0x79, 0x63, 0x61, 0x2e, 0x6f, - 0x72, 0x67, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, - 0x01, 0x16, 0x12, 0x6a, 0x76, 0x73, 0x68, 0x61, - 0x68, 0x69, 0x64, 0x40, 0x67, 0x6d, 0x61, 0x69, - 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x0e, 0x00, 0x00, - 0x00, - }, - { - 0x16, 0x03, 0x01, 0x0a, 0xfb, 0x0b, 0x00, 0x0a, - 0xf7, 0x00, 0x0a, 0xf4, 0x00, 0x03, 0x7e, 0x30, - 0x82, 0x03, 0x7a, 0x30, 0x82, 0x02, 0x62, 0x02, - 0x09, 0x00, 0xb4, 0x47, 0x58, 0x57, 0x2b, 0x67, - 0xc8, 0xc2, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, - 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, - 0x00, 0x30, 0x81, 0x80, 0x31, 0x0b, 0x30, 0x09, - 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, - 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, - 0x04, 0x08, 0x0c, 0x02, 0x4e, 0x59, 0x31, 0x11, - 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, - 0x08, 0x42, 0x72, 0x6f, 0x6f, 0x6b, 0x6c, 0x79, - 0x6e, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x0c, 0x0c, 0x4d, 0x79, 0x20, 0x43, - 0x41, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, - 0x03, 0x0c, 0x0e, 0x6d, 0x79, 0x63, 0x61, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, - 0x6d, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x09, 0x2a, - 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, - 0x16, 0x12, 0x6a, 0x76, 0x73, 0x68, 0x61, 0x68, - 0x69, 0x64, 0x40, 0x67, 0x6d, 0x61, 0x69, 0x6c, - 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d, - 0x31, 0x33, 0x30, 0x35, 0x32, 0x36, 0x32, 0x31, - 0x34, 0x34, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x31, - 0x33, 0x30, 0x36, 0x32, 0x35, 0x32, 0x31, 0x34, - 0x34, 0x30, 0x30, 0x5a, 0x30, 0x7d, 0x31, 0x0b, - 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, - 0x02, 0x55, 0x53, 0x31, 0x11, 0x30, 0x0f, 0x06, - 0x03, 0x55, 0x04, 0x08, 0x0c, 0x08, 0x4e, 0x65, - 0x77, 0x20, 0x59, 0x6f, 0x72, 0x6b, 0x31, 0x11, - 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, - 0x08, 0x42, 0x72, 0x6f, 0x6f, 0x6b, 0x6c, 0x79, - 0x6e, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x0c, 0x07, 0x4d, 0x79, 0x20, 0x4c, - 0x65, 0x61, 0x66, 0x31, 0x13, 0x30, 0x11, 0x06, - 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0a, 0x6d, 0x79, - 0x6c, 0x65, 0x61, 0x66, 0x2e, 0x63, 0x6f, 0x6d, - 0x31, 0x21, 0x30, 0x1f, 0x06, 0x09, 0x2a, 0x86, - 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, - 0x12, 0x6a, 0x76, 0x73, 0x68, 0x61, 0x68, 0x69, - 0x64, 0x40, 0x67, 0x6d, 0x61, 0x69, 0x6c, 0x2e, - 0x63, 0x6f, 0x6d, 0x30, 0x82, 0x01, 0x22, 0x30, - 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, - 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, - 0x82, 0x01, 0x01, 0x00, 0xa0, 0xa3, 0xef, 0xc1, - 0x44, 0x7d, 0xa2, 0xe3, 0x71, 0x98, 0x27, 0x63, - 0xb3, 0x1d, 0x71, 0x50, 0xa6, 0x34, 0x15, 0xcb, - 0xc9, 0x2a, 0xc3, 0xea, 0xe4, 0x9e, 0x9c, 0x49, - 0xa6, 0x01, 0x9b, 0x7e, 0xa9, 0xb5, 0x7a, 0xff, - 0x15, 0x92, 0x71, 0xc8, 0x97, 0x9c, 0x25, 0xb7, - 0x79, 0x2b, 0xff, 0xab, 0xc6, 0xb1, 0xa7, 0x00, - 0x90, 0xb2, 0x8b, 0xd7, 0x71, 0xd5, 0xc2, 0x3a, - 0xe6, 0x82, 0x42, 0x37, 0x89, 0x41, 0x04, 0xb0, - 0xba, 0xc7, 0x5b, 0x8a, 0x43, 0x9f, 0x97, 0x39, - 0x0c, 0x0f, 0xd5, 0x6d, 0x9e, 0x8d, 0xeb, 0xc0, - 0x26, 0xc5, 0x18, 0xe8, 0x7a, 0x3d, 0x32, 0x2e, - 0x38, 0x90, 0x40, 0x5b, 0x39, 0x2c, 0x07, 0xcb, - 0x24, 0x10, 0xc5, 0xc9, 0x3b, 0xe3, 0x66, 0x47, - 0x57, 0xb9, 0x6a, 0xad, 0x44, 0xf8, 0xd0, 0x70, - 0x62, 0x3b, 0x8e, 0xed, 0x60, 0x5f, 0x22, 0xf8, - 0xb8, 0x0c, 0xc9, 0x41, 0x2b, 0xc9, 0x80, 0x6e, - 0x4e, 0x1b, 0xe1, 0x20, 0xfc, 0x47, 0xa4, 0xac, - 0xc3, 0x3f, 0xe6, 0xc2, 0x81, 0x79, 0x03, 0x37, - 0x25, 0x89, 0xca, 0xd6, 0xa5, 0x46, 0x91, 0x63, - 0x41, 0xc5, 0x3e, 0xd5, 0xed, 0x7f, 0x4f, 0x8d, - 0x06, 0xc0, 0x89, 0x00, 0xbe, 0x37, 0x7b, 0x7e, - 0x73, 0xca, 0x70, 0x00, 0x14, 0x34, 0xbe, 0x47, - 0xbc, 0xb2, 0x6a, 0x28, 0xa5, 0x29, 0x84, 0xa8, - 0x9d, 0xc8, 0x1e, 0x77, 0x66, 0x1f, 0x9f, 0xaa, - 0x2b, 0x47, 0xdb, 0xdd, 0x6b, 0x9c, 0xa8, 0xfc, - 0x82, 0x36, 0x94, 0x62, 0x0d, 0x5c, 0x3f, 0xb2, - 0x01, 0xb4, 0xa5, 0xb8, 0xc6, 0x0e, 0x94, 0x5b, - 0xec, 0x5e, 0xbb, 0x7a, 0x63, 0x24, 0xf1, 0xf9, - 0xd6, 0x50, 0x08, 0xc1, 0xa3, 0xcc, 0x90, 0x07, - 0x5b, 0x04, 0x04, 0x42, 0x74, 0xcf, 0x37, 0xfa, - 0xf0, 0xa5, 0xd9, 0xd3, 0x86, 0x89, 0x89, 0x18, - 0xf3, 0x4c, 0xe2, 0x11, 0x02, 0x03, 0x01, 0x00, - 0x01, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, - 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, - 0x03, 0x82, 0x01, 0x01, 0x00, 0x90, 0xbb, 0xf9, - 0x5e, 0xba, 0x17, 0x1f, 0xac, 0x21, 0x9f, 0x6b, - 0x4a, 0x46, 0xd0, 0x6d, 0x3c, 0x8f, 0x3d, 0xf8, - 0x5e, 0x3e, 0x72, 0xaf, 0xa0, 0x1a, 0xf3, 0xff, - 0x89, 0xac, 0x5b, 0x7a, 0xe2, 0x91, 0x2a, 0x23, - 0x85, 0xc6, 0x4d, 0x47, 0x67, 0x01, 0x08, 0xa8, - 0x05, 0x1d, 0x01, 0x60, 0x50, 0x5f, 0x59, 0xad, - 0xfe, 0x7b, 0xc6, 0x0c, 0x54, 0x90, 0x68, 0x70, - 0x67, 0x2e, 0xed, 0x87, 0xf8, 0x69, 0x8a, 0xac, - 0x32, 0xfe, 0x6f, 0x90, 0x19, 0x2a, 0x64, 0x8d, - 0x82, 0x66, 0x05, 0x43, 0x88, 0xee, 0xf2, 0x30, - 0xed, 0xa4, 0x8f, 0xbf, 0xd6, 0x57, 0x20, 0xd4, - 0x43, 0x1d, 0x52, 0x96, 0x6f, 0xae, 0x09, 0x96, - 0x01, 0x52, 0x38, 0xe3, 0xaf, 0x99, 0xd7, 0xdc, - 0x14, 0x99, 0xc4, 0x8b, 0x0e, 0x04, 0x0f, 0xb3, - 0x14, 0x14, 0xd4, 0xa5, 0x93, 0xe1, 0xc9, 0x8a, - 0x81, 0xef, 0x63, 0xfc, 0x36, 0x77, 0x05, 0x06, - 0xf0, 0x2a, 0x04, 0x0a, 0xbe, 0x2e, 0xce, 0x81, - 0x3d, 0x23, 0xa1, 0xda, 0xd8, 0xeb, 0xc6, 0xea, - 0x5e, 0xcf, 0x28, 0x36, 0x51, 0x31, 0x95, 0x5e, - 0x40, 0x04, 0xed, 0xac, 0xc1, 0xc8, 0x56, 0x69, - 0x87, 0xec, 0x3b, 0x03, 0x3e, 0x9d, 0x0f, 0x4c, - 0x4c, 0xeb, 0xd7, 0xba, 0x26, 0xdf, 0xe3, 0xde, - 0x10, 0xee, 0x93, 0x62, 0x8d, 0x73, 0x52, 0x6e, - 0xff, 0x37, 0x36, 0x98, 0x7b, 0x2d, 0x56, 0x4c, - 0xba, 0x09, 0xb8, 0xa7, 0xf0, 0x3b, 0x16, 0x81, - 0xca, 0xdb, 0x43, 0xab, 0xec, 0x4c, 0x6e, 0x7c, - 0xc1, 0x0b, 0x22, 0x22, 0x43, 0x1d, 0xb6, 0x0c, - 0xc1, 0xb9, 0xcf, 0xe4, 0x53, 0xee, 0x1d, 0x3e, - 0x88, 0xa7, 0x13, 0xbe, 0x7f, 0xbd, 0xae, 0x72, - 0xcf, 0xcd, 0x63, 0xd2, 0xc3, 0x18, 0x58, 0x92, - 0xa2, 0xad, 0xb5, 0x09, 0x9d, 0x91, 0x03, 0xdd, - 0x3c, 0xe2, 0x1c, 0xde, 0x78, 0x00, 0x03, 0x88, - 0x30, 0x82, 0x03, 0x84, 0x30, 0x82, 0x02, 0x6c, - 0x02, 0x09, 0x00, 0xab, 0xed, 0xa6, 0xe4, 0x4a, - 0x2b, 0x2b, 0xf8, 0x30, 0x0d, 0x06, 0x09, 0x2a, - 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, - 0x05, 0x00, 0x30, 0x81, 0x86, 0x31, 0x0b, 0x30, - 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, - 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, - 0x55, 0x04, 0x08, 0x0c, 0x02, 0x4e, 0x59, 0x31, - 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x07, - 0x0c, 0x08, 0x42, 0x72, 0x6f, 0x6f, 0x6b, 0x6c, - 0x79, 0x6e, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, - 0x55, 0x04, 0x0a, 0x0c, 0x18, 0x4d, 0x79, 0x20, - 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31, 0x11, 0x30, - 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x08, - 0x6d, 0x79, 0x63, 0x61, 0x2e, 0x6f, 0x72, 0x67, - 0x31, 0x21, 0x30, 0x1f, 0x06, 0x09, 0x2a, 0x86, - 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, - 0x12, 0x6a, 0x76, 0x73, 0x68, 0x61, 0x68, 0x69, - 0x64, 0x40, 0x67, 0x6d, 0x61, 0x69, 0x6c, 0x2e, - 0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d, 0x31, - 0x33, 0x30, 0x35, 0x32, 0x36, 0x32, 0x31, 0x31, - 0x38, 0x34, 0x30, 0x5a, 0x17, 0x0d, 0x31, 0x33, - 0x30, 0x36, 0x32, 0x35, 0x32, 0x31, 0x31, 0x38, - 0x34, 0x30, 0x5a, 0x30, 0x81, 0x80, 0x31, 0x0b, - 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, - 0x02, 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, - 0x03, 0x55, 0x04, 0x08, 0x0c, 0x02, 0x4e, 0x59, - 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, - 0x07, 0x0c, 0x08, 0x42, 0x72, 0x6f, 0x6f, 0x6b, - 0x6c, 0x79, 0x6e, 0x31, 0x15, 0x30, 0x13, 0x06, - 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x0c, 0x4d, 0x79, - 0x20, 0x43, 0x41, 0x20, 0x43, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, - 0x55, 0x04, 0x03, 0x0c, 0x0e, 0x6d, 0x79, 0x63, - 0x61, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, - 0x63, 0x6f, 0x6d, 0x31, 0x21, 0x30, 0x1f, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x09, 0x01, 0x16, 0x12, 0x6a, 0x76, 0x73, 0x68, - 0x61, 0x68, 0x69, 0x64, 0x40, 0x67, 0x6d, 0x61, - 0x69, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x82, - 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, - 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, - 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, - 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xce, - 0x13, 0xf0, 0x72, 0xb0, 0x61, 0xc8, 0x18, 0x37, - 0x8a, 0x41, 0x3d, 0x20, 0xa1, 0x1c, 0xcb, 0xbf, - 0xf6, 0x3b, 0x74, 0x26, 0x2a, 0x96, 0x11, 0xec, - 0x53, 0xa1, 0xcc, 0x7d, 0x77, 0x56, 0x45, 0x0f, - 0x36, 0xb7, 0xf2, 0x48, 0x92, 0x1a, 0x62, 0xcc, - 0xb6, 0xc0, 0xa1, 0x2f, 0x44, 0x2b, 0xc1, 0x89, - 0xcb, 0x6e, 0x1e, 0xdb, 0x57, 0x92, 0xd5, 0x97, - 0x60, 0x8c, 0x41, 0x2c, 0xd9, 0x20, 0xfe, 0xe9, - 0x1f, 0x8e, 0xfc, 0x7f, 0x02, 0x44, 0x0f, 0x28, - 0x81, 0xd6, 0x0c, 0xcd, 0xbc, 0xf0, 0x57, 0x6c, - 0xcc, 0xa7, 0xba, 0x06, 0xa0, 0xa6, 0x91, 0xda, - 0xef, 0x46, 0x8a, 0x60, 0x0f, 0x52, 0x6c, 0x90, - 0x6c, 0x8c, 0x44, 0xaf, 0xb0, 0x9d, 0x90, 0xba, - 0x21, 0x58, 0xa0, 0x3c, 0xee, 0x54, 0xb5, 0x29, - 0x26, 0x1f, 0x0a, 0xac, 0xef, 0x48, 0x68, 0x33, - 0xd0, 0x33, 0xd0, 0x8b, 0x1a, 0xec, 0x6e, 0x2f, - 0xb5, 0x4a, 0x53, 0xc2, 0x1a, 0xd2, 0xf1, 0x50, - 0x05, 0x59, 0x5c, 0xd9, 0xda, 0x03, 0x0a, 0x47, - 0xb7, 0xdd, 0xf7, 0x3a, 0x69, 0xf5, 0x4e, 0xea, - 0x4a, 0xc2, 0xca, 0x54, 0xb0, 0x8b, 0x76, 0xe1, - 0x02, 0x2d, 0x52, 0x67, 0xb9, 0xdd, 0x50, 0xc9, - 0x3b, 0x07, 0x24, 0x22, 0x6a, 0x00, 0x1d, 0x58, - 0x83, 0xa8, 0xec, 0x95, 0xf1, 0xda, 0xe2, 0x73, - 0xa0, 0xa1, 0x72, 0x60, 0x9e, 0x86, 0x53, 0xcb, - 0x45, 0xa8, 0xc2, 0xa0, 0x50, 0xa0, 0x53, 0xd6, - 0xfc, 0x18, 0x84, 0xb5, 0x4a, 0x26, 0xd0, 0xa2, - 0xaa, 0xd0, 0xff, 0xb6, 0xfe, 0x3a, 0x9c, 0xb5, - 0x19, 0x3b, 0x3f, 0xe1, 0x48, 0x0d, 0xa4, 0x09, - 0x4f, 0x83, 0xc9, 0xc0, 0xc9, 0xa6, 0x0b, 0x58, - 0x1f, 0x1c, 0x7b, 0xac, 0xa2, 0x42, 0xbc, 0x61, - 0xf4, 0x21, 0x8a, 0x00, 0xda, 0x14, 0xa0, 0x60, - 0x03, 0xfe, 0x93, 0x12, 0x6c, 0x56, 0xcd, 0x02, - 0x03, 0x01, 0x00, 0x01, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, - 0x25, 0x29, 0x3b, 0x1e, 0xc3, 0x58, 0x32, 0xe6, - 0x23, 0xc8, 0xee, 0x18, 0xf0, 0x1d, 0x62, 0x6d, - 0x3b, 0x59, 0x99, 0x3a, 0xfe, 0x49, 0x72, 0x07, - 0x3f, 0x58, 0x93, 0xdb, 0xc0, 0xaf, 0xb0, 0xb3, - 0x5c, 0xd1, 0x5c, 0x98, 0xc8, 0xea, 0x4a, 0xe4, - 0x58, 0x73, 0x0d, 0x57, 0xc5, 0x13, 0x7c, 0x5c, - 0x79, 0x66, 0xda, 0x04, 0x1d, 0xe5, 0x98, 0xda, - 0x35, 0x47, 0x44, 0xb0, 0xd2, 0x7a, 0x66, 0x9d, - 0xcd, 0x41, 0xa5, 0x8f, 0xa1, 0x11, 0xb2, 0x1a, - 0x87, 0xc0, 0xcd, 0x55, 0xed, 0xb4, 0x7b, 0x33, - 0x72, 0xeb, 0xf7, 0xe3, 0x7b, 0x8b, 0x02, 0x86, - 0xe9, 0x2b, 0x26, 0x32, 0x9f, 0x99, 0xf1, 0xcb, - 0x93, 0xab, 0xb9, 0x16, 0xb3, 0x9a, 0xb2, 0x22, - 0x13, 0x21, 0x1f, 0x5b, 0xcc, 0xa2, 0x59, 0xbb, - 0x69, 0xf2, 0xb8, 0x07, 0x80, 0xce, 0x0c, 0xf7, - 0x98, 0x4c, 0x85, 0xc2, 0x96, 0x6a, 0x22, 0x05, - 0xe9, 0xbe, 0x48, 0xb0, 0x02, 0x5b, 0x69, 0x28, - 0x18, 0x88, 0x96, 0xe3, 0xd7, 0xc6, 0x7a, 0xd3, - 0xe9, 0x99, 0xff, 0x9d, 0xc3, 0x61, 0x4d, 0x9a, - 0x96, 0xf2, 0xc6, 0x33, 0x4d, 0xe5, 0x5d, 0x5a, - 0x68, 0x64, 0x5a, 0x82, 0x35, 0x65, 0x25, 0xe3, - 0x8c, 0x5b, 0xb0, 0xf6, 0x96, 0x56, 0xbc, 0xbf, - 0x97, 0x76, 0x4b, 0x66, 0x44, 0x81, 0xa4, 0xc4, - 0xa7, 0x31, 0xc5, 0xa1, 0x4f, 0xe8, 0xa4, 0xca, - 0x20, 0xf5, 0x01, 0x5b, 0x99, 0x4f, 0x5a, 0xf4, - 0xf0, 0x78, 0xbf, 0x71, 0x49, 0xd5, 0xf1, 0xc1, - 0xa2, 0x18, 0xfd, 0x72, 0x5b, 0x16, 0xe8, 0x92, - 0xc7, 0x37, 0x48, 0xaf, 0xee, 0x24, 0xfc, 0x35, - 0x0b, 0xc2, 0xdd, 0x05, 0xc7, 0x6e, 0xa3, 0x29, - 0xbb, 0x29, 0x7d, 0xd3, 0x2b, 0x94, 0x80, 0xc3, - 0x40, 0x53, 0x0e, 0x03, 0x54, 0x3d, 0x7b, 0x8b, - 0xce, 0xf9, 0xa4, 0x03, 0x27, 0x63, 0xec, 0x51, - 0x00, 0x03, 0xe5, 0x30, 0x82, 0x03, 0xe1, 0x30, - 0x82, 0x02, 0xc9, 0xa0, 0x03, 0x02, 0x01, 0x02, - 0x02, 0x09, 0x00, 0xcc, 0x22, 0x4c, 0x4b, 0x98, - 0xa2, 0x88, 0xfc, 0x30, 0x0d, 0x06, 0x09, 0x2a, - 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, - 0x05, 0x00, 0x30, 0x81, 0x86, 0x31, 0x0b, 0x30, - 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, - 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, - 0x55, 0x04, 0x08, 0x0c, 0x02, 0x4e, 0x59, 0x31, - 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x07, - 0x0c, 0x08, 0x42, 0x72, 0x6f, 0x6f, 0x6b, 0x6c, - 0x79, 0x6e, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, - 0x55, 0x04, 0x0a, 0x0c, 0x18, 0x4d, 0x79, 0x20, - 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31, 0x11, 0x30, - 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x08, - 0x6d, 0x79, 0x63, 0x61, 0x2e, 0x6f, 0x72, 0x67, - 0x31, 0x21, 0x30, 0x1f, 0x06, 0x09, 0x2a, 0x86, - 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, - 0x12, 0x6a, 0x76, 0x73, 0x68, 0x61, 0x68, 0x69, - 0x64, 0x40, 0x67, 0x6d, 0x61, 0x69, 0x6c, 0x2e, - 0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d, 0x31, - 0x33, 0x30, 0x35, 0x32, 0x36, 0x32, 0x31, 0x30, - 0x35, 0x30, 0x31, 0x5a, 0x17, 0x0d, 0x32, 0x33, - 0x30, 0x35, 0x32, 0x34, 0x32, 0x31, 0x30, 0x35, - 0x30, 0x31, 0x5a, 0x30, 0x81, 0x86, 0x31, 0x0b, - 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, - 0x02, 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, - 0x03, 0x55, 0x04, 0x08, 0x0c, 0x02, 0x4e, 0x59, - 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, - 0x07, 0x0c, 0x08, 0x42, 0x72, 0x6f, 0x6f, 0x6b, - 0x6c, 0x79, 0x6e, 0x31, 0x21, 0x30, 0x1f, 0x06, - 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x18, 0x4d, 0x79, - 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x65, 0x20, 0x41, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31, 0x11, - 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, - 0x08, 0x6d, 0x79, 0x63, 0x61, 0x2e, 0x6f, 0x72, - 0x67, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x09, 0x2a, - 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, - 0x16, 0x12, 0x6a, 0x76, 0x73, 0x68, 0x61, 0x68, - 0x69, 0x64, 0x40, 0x67, 0x6d, 0x61, 0x69, 0x6c, - 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x82, 0x01, 0x22, - 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, - 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, - 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, - 0x02, 0x82, 0x01, 0x01, 0x00, 0xf0, 0xfb, 0xad, - 0x80, 0x5e, 0x37, 0xd3, 0x6d, 0xee, 0x2e, 0xcc, - 0xbc, 0x0c, 0xd7, 0x56, 0x4b, 0x56, 0x45, 0xcd, - 0x28, 0xb6, 0x22, 0xe9, 0xe2, 0x0f, 0xd1, 0x87, - 0x2a, 0x27, 0xce, 0x77, 0x8d, 0x6e, 0x0e, 0x0f, - 0xfb, 0x66, 0xe1, 0xb5, 0x0e, 0x9a, 0xb6, 0x05, - 0x8e, 0xb3, 0xe1, 0xc5, 0x77, 0x86, 0x5b, 0x46, - 0xd2, 0x0b, 0x92, 0x03, 0x1b, 0x89, 0x0c, 0x1b, - 0x10, 0x0e, 0x99, 0x8f, 0xe2, 0x17, 0xe8, 0xc2, - 0x30, 0x00, 0x47, 0xd6, 0xfc, 0xf9, 0x0f, 0x3b, - 0x75, 0x34, 0x8d, 0x4d, 0xb0, 0x99, 0xb7, 0xa0, - 0x6d, 0xa0, 0xb6, 0xad, 0xda, 0x07, 0x5e, 0x38, - 0x2e, 0x02, 0xe4, 0x30, 0x6d, 0xae, 0x13, 0x72, - 0xd4, 0xc8, 0xce, 0x14, 0x07, 0xae, 0x23, 0x8c, - 0x8f, 0x9e, 0x8c, 0x60, 0xd6, 0x06, 0xb9, 0xef, - 0x00, 0x18, 0xc0, 0x1d, 0x25, 0x1e, 0xda, 0x3e, - 0x2f, 0xcf, 0x2b, 0x56, 0x84, 0x9e, 0x30, 0x21, - 0xc7, 0x29, 0xf6, 0x03, 0x8a, 0x24, 0xf9, 0x34, - 0xac, 0x65, 0x9d, 0x80, 0x36, 0xc8, 0x3b, 0x15, - 0x10, 0xbd, 0x51, 0xe9, 0xbc, 0x02, 0xe1, 0xe9, - 0xb3, 0x5a, 0x9a, 0x99, 0x41, 0x1b, 0x27, 0xa0, - 0x4d, 0x50, 0x9e, 0x27, 0x7f, 0xa1, 0x7d, 0x09, - 0x87, 0xbd, 0x8a, 0xca, 0x5f, 0xb1, 0xa5, 0x08, - 0xb8, 0x04, 0xd4, 0x52, 0x89, 0xaa, 0xe0, 0x7d, - 0x42, 0x2e, 0x2f, 0x15, 0xee, 0x66, 0x57, 0x0f, - 0x13, 0x19, 0x45, 0xa8, 0x4b, 0x5d, 0x81, 0x66, - 0xcc, 0x12, 0x37, 0x94, 0x5e, 0xfd, 0x3c, 0x10, - 0x81, 0x51, 0x3f, 0xfa, 0x0f, 0xdd, 0xa1, 0x89, - 0x03, 0xa9, 0x78, 0x91, 0xf5, 0x3b, 0xf3, 0xbc, - 0xac, 0xbe, 0x93, 0x30, 0x2e, 0xbe, 0xca, 0x7f, - 0x46, 0xd3, 0x28, 0xb4, 0x4e, 0x91, 0x7b, 0x5b, - 0x43, 0x6c, 0xaf, 0x9b, 0x5c, 0x6a, 0x6d, 0x5a, - 0xdb, 0x79, 0x5e, 0x6a, 0x6b, 0x02, 0x03, 0x01, - 0x00, 0x01, 0xa3, 0x50, 0x30, 0x4e, 0x30, 0x1d, - 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, - 0x14, 0x6b, 0x1e, 0x00, 0xa8, 0x9f, 0xfa, 0x7d, - 0x00, 0xf9, 0xe0, 0x9d, 0x0f, 0x90, 0x8c, 0x90, - 0xa8, 0xa1, 0x37, 0x6b, 0xda, 0x30, 0x1f, 0x06, - 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, - 0x80, 0x14, 0x6b, 0x1e, 0x00, 0xa8, 0x9f, 0xfa, - 0x7d, 0x00, 0xf9, 0xe0, 0x9d, 0x0f, 0x90, 0x8c, - 0x90, 0xa8, 0xa1, 0x37, 0x6b, 0xda, 0x30, 0x0c, - 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, - 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, - 0xcd, 0x6f, 0x73, 0x4d, 0x56, 0x0b, 0xf3, 0x2e, - 0x1c, 0xe2, 0x02, 0x0c, 0x14, 0xbb, 0x2f, 0xdd, - 0x3c, 0x43, 0xfe, 0xdf, 0x94, 0x2d, 0xa9, 0x89, - 0x81, 0x51, 0xf8, 0x5f, 0xa7, 0xa0, 0x13, 0xaa, - 0xcc, 0xb0, 0x18, 0xe2, 0x57, 0x3e, 0x0d, 0x29, - 0x93, 0xe8, 0x95, 0xd5, 0x1b, 0x53, 0xd2, 0x51, - 0xf2, 0xbd, 0xf5, 0x9e, 0x7b, 0x22, 0x65, 0x62, - 0x5c, 0xc4, 0x4c, 0x1d, 0xe8, 0xe9, 0xc3, 0xd4, - 0x2b, 0xe7, 0x78, 0xcb, 0x10, 0xf3, 0xfe, 0x06, - 0x83, 0xdc, 0x3a, 0x1e, 0x62, 0x10, 0xc0, 0x46, - 0x77, 0xc6, 0x9d, 0x9f, 0xab, 0x96, 0x25, 0x5c, - 0xfb, 0x26, 0xc1, 0x15, 0x1f, 0xa5, 0x33, 0xee, - 0x4f, 0x9a, 0x14, 0x6a, 0x14, 0x97, 0x93, 0x2b, - 0x95, 0x0b, 0xdc, 0xa8, 0xd7, 0x69, 0x2e, 0xf0, - 0x01, 0x0e, 0xfd, 0x4e, 0xd0, 0xd9, 0xa8, 0xe5, - 0x65, 0xde, 0xfb, 0xca, 0xca, 0x1c, 0x5f, 0xf9, - 0x53, 0xa0, 0x87, 0xe7, 0x33, 0x9b, 0x2f, 0xcf, - 0xe4, 0x13, 0xfc, 0xec, 0x7a, 0x6c, 0xb0, 0x90, - 0x13, 0x9b, 0xb6, 0xc5, 0x03, 0xf6, 0x0e, 0x5e, - 0xe2, 0xe4, 0x26, 0xc1, 0x7e, 0x53, 0xfe, 0x69, - 0xa3, 0xc7, 0xd8, 0x8e, 0x6e, 0x94, 0x32, 0xa0, - 0xde, 0xca, 0xb6, 0xcc, 0xd6, 0x01, 0xd5, 0x78, - 0x40, 0x28, 0x63, 0x9b, 0xee, 0xcf, 0x09, 0x3b, - 0x35, 0x04, 0xf0, 0x14, 0x02, 0xf6, 0x80, 0x0e, - 0x90, 0xb2, 0x94, 0xd2, 0x25, 0x16, 0xb8, 0x7a, - 0x76, 0x87, 0x84, 0x9f, 0x84, 0xc5, 0xaf, 0xc2, - 0x6d, 0x68, 0x7a, 0x84, 0x9c, 0xc6, 0x8a, 0x63, - 0x60, 0x87, 0x6a, 0x25, 0xc1, 0xa1, 0x78, 0x0f, - 0xba, 0xe8, 0x5f, 0xe1, 0xba, 0xac, 0xa4, 0x6f, - 0xdd, 0x09, 0x3f, 0x12, 0xcb, 0x1d, 0xf3, 0xcf, - 0x48, 0xd7, 0xd3, 0x26, 0xe8, 0x9c, 0xc3, 0x53, - 0xb3, 0xba, 0xdc, 0x32, 0x99, 0x98, 0x96, 0xd6, - 0x16, 0x03, 0x01, 0x01, 0x06, 0x10, 0x00, 0x01, - 0x02, 0x01, 0x00, 0x6e, 0xea, 0x15, 0x6f, 0x21, - 0xbd, 0x2d, 0x14, 0xde, 0x9d, 0x02, 0xeb, 0xdf, - 0x3b, 0x09, 0x75, 0xaf, 0x32, 0x80, 0x0c, 0xe2, - 0xc2, 0x7b, 0x0d, 0xca, 0x24, 0x96, 0xf6, 0x3e, - 0xa5, 0x97, 0xba, 0x0c, 0x50, 0x7e, 0xb3, 0x68, - 0x58, 0xc6, 0xd8, 0xec, 0xab, 0xa9, 0xd9, 0x3a, - 0xb1, 0x49, 0xea, 0x2f, 0xd7, 0xdb, 0x15, 0x1b, - 0xb5, 0xaf, 0xec, 0xcc, 0x40, 0x5c, 0xe6, 0x0f, - 0xc4, 0x33, 0x71, 0xe7, 0x41, 0xc0, 0x04, 0x89, - 0x60, 0x3e, 0xb7, 0xe6, 0xda, 0x38, 0x62, 0x27, - 0x6a, 0xd9, 0xfb, 0x93, 0x94, 0x9d, 0xc1, 0x63, - 0x92, 0x5c, 0x88, 0x19, 0x38, 0x81, 0x79, 0x9d, - 0x59, 0x48, 0x5e, 0xd3, 0xc8, 0xea, 0xcb, 0x6e, - 0x66, 0x66, 0x03, 0xdc, 0x0c, 0x2d, 0x95, 0xb1, - 0x4d, 0x68, 0xc7, 0xc5, 0x6e, 0xfa, 0x94, 0x14, - 0xdf, 0x2c, 0x70, 0x69, 0x04, 0xf4, 0x69, 0xf1, - 0xf0, 0x07, 0xbd, 0x23, 0x53, 0x63, 0xb3, 0x41, - 0xec, 0xa7, 0x10, 0xa5, 0x04, 0x84, 0x24, 0xb5, - 0xf5, 0x0c, 0x0f, 0x5d, 0x02, 0x47, 0x79, 0x60, - 0x76, 0xbb, 0xdf, 0x60, 0xa6, 0xd7, 0x4d, 0x08, - 0x7d, 0xa6, 0x85, 0x4f, 0x61, 0xac, 0x96, 0x3d, - 0xbc, 0xaf, 0x07, 0xb0, 0x7c, 0xb6, 0x23, 0x3e, - 0x1f, 0x0a, 0x62, 0x77, 0x97, 0x77, 0xae, 0x33, - 0x55, 0x0f, 0x85, 0xdf, 0xdc, 0xbe, 0xc6, 0xe0, - 0xe0, 0x14, 0x83, 0x4c, 0x50, 0xf0, 0xe5, 0x2d, - 0xdc, 0x0b, 0x74, 0x7f, 0xc3, 0x28, 0x98, 0x16, - 0xda, 0x74, 0xe6, 0x40, 0xc2, 0xf0, 0xea, 0xc0, - 0x00, 0xd5, 0xfc, 0x16, 0xe4, 0x43, 0xa1, 0xfc, - 0x31, 0x19, 0x81, 0x62, 0xec, 0x2b, 0xfe, 0xcc, - 0xe8, 0x19, 0xed, 0xa1, 0x1e, 0x6a, 0x49, 0x73, - 0xde, 0xc4, 0xe9, 0x22, 0x0a, 0x21, 0xde, 0x45, - 0x1e, 0x55, 0x12, 0xd9, 0x44, 0xef, 0x4e, 0xaa, - 0x5e, 0x26, 0x57, 0x16, 0x03, 0x01, 0x01, 0x06, - 0x0f, 0x00, 0x01, 0x02, 0x01, 0x00, 0x23, 0xde, - 0xb0, 0x39, 0x60, 0xe9, 0x82, 0xb8, 0xed, 0x17, - 0x78, 0xd2, 0x37, 0x0e, 0x85, 0x69, 0xda, 0xcc, - 0x9f, 0x54, 0x4d, 0xda, 0xce, 0xe8, 0x5a, 0xeb, - 0x3c, 0x61, 0x4c, 0x7a, 0x84, 0x1f, 0x21, 0x03, - 0xb3, 0x8a, 0x74, 0x3b, 0x6a, 0x9e, 0x4f, 0x44, - 0xd9, 0x75, 0x0a, 0xd8, 0x7e, 0x56, 0xa3, 0xef, - 0x5a, 0xfe, 0x8a, 0x35, 0xce, 0x29, 0x18, 0xfe, - 0xa6, 0x61, 0x8e, 0x8f, 0x00, 0x90, 0x2d, 0x85, - 0xe3, 0x6c, 0x0e, 0x8d, 0x8c, 0x27, 0x80, 0x8c, - 0x9f, 0x51, 0xe9, 0xd3, 0xe6, 0x7d, 0x70, 0xe9, - 0xfb, 0xcb, 0xb8, 0x24, 0x94, 0x30, 0x9b, 0xba, - 0x01, 0x14, 0x49, 0x9f, 0xaf, 0x09, 0xd8, 0x26, - 0x1b, 0x23, 0xa4, 0xb8, 0xd9, 0x44, 0x0a, 0xdc, - 0x4e, 0x27, 0xe7, 0x32, 0xf5, 0x9c, 0xf3, 0x8d, - 0xa0, 0xc5, 0xc4, 0xbe, 0x92, 0x02, 0x85, 0x4f, - 0x33, 0x8f, 0xa7, 0xf7, 0x87, 0xa9, 0x44, 0xf3, - 0x64, 0xbd, 0x32, 0x04, 0xeb, 0xc5, 0xc3, 0x62, - 0xe9, 0xda, 0x2f, 0x95, 0x5c, 0xf7, 0x58, 0x3e, - 0xad, 0x35, 0xd7, 0x7e, 0xad, 0xdd, 0x32, 0x8d, - 0xce, 0x81, 0x08, 0xad, 0x49, 0xf7, 0xdb, 0xf7, - 0xaf, 0xe3, 0xc6, 0xb2, 0xdd, 0x76, 0x0c, 0xcf, - 0x0f, 0x87, 0x79, 0x90, 0x10, 0x79, 0xc6, 0xc8, - 0x7b, 0xe6, 0x23, 0xf2, 0xda, 0x33, 0xca, 0xe1, - 0xf0, 0x59, 0x42, 0x43, 0x03, 0x56, 0x19, 0xe3, - 0x8b, 0xe6, 0xa8, 0x70, 0xbc, 0x80, 0xfa, 0x24, - 0xae, 0x03, 0x13, 0x30, 0x0d, 0x1f, 0xab, 0xb7, - 0x82, 0xd9, 0x24, 0x90, 0x80, 0xbf, 0x75, 0xe1, - 0x0d, 0x1c, 0xb2, 0xfe, 0x92, 0x2c, 0x4d, 0x21, - 0xe9, 0x5d, 0xa1, 0x68, 0xf3, 0x16, 0xd8, 0x3f, - 0xb2, 0xc3, 0x00, 0x3e, 0xd8, 0x42, 0x25, 0x5c, - 0x90, 0x11, 0xc0, 0x1b, 0xd4, 0x26, 0x5c, 0x37, - 0x47, 0xbd, 0xf8, 0x1e, 0x34, 0xa9, 0x14, 0x03, - 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, 0x01, 0x00, - 0x24, 0x8f, 0x94, 0x7e, 0x01, 0xee, 0xd5, 0x4f, - 0x83, 0x41, 0x31, 0xc0, 0x36, 0x81, 0x46, 0xc3, - 0xc0, 0xcc, 0x9c, 0xea, 0x0f, 0x29, 0x04, 0x10, - 0x43, 0x1e, 0x08, 0x6e, 0x08, 0xce, 0xb2, 0x62, - 0xa6, 0x0f, 0x68, 0x9f, 0x99, - }, - { - 0x14, 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, - 0x01, 0x00, 0x24, 0xd9, 0x46, 0x5b, 0xbf, 0xfd, - 0x8a, 0xa1, 0x08, 0xd5, 0xf3, 0x0c, 0x1c, 0xd8, - 0xa8, 0xb3, 0xe5, 0x89, 0x83, 0x9e, 0x23, 0x47, - 0x81, 0x66, 0x77, 0x11, 0x98, 0xe5, 0xf4, 0xac, - 0x06, 0xe9, 0x4c, 0x05, 0x8b, 0xc4, 0x16, - }, - { - 0x17, 0x03, 0x01, 0x00, 0x1a, 0xc5, 0x28, 0xfd, - 0x71, 0xc0, 0xe6, 0x89, 0xb8, 0x82, 0x92, 0x1b, - 0xdd, 0x39, 0xe5, 0xbf, 0x41, 0x82, 0x1f, 0xc1, - 0xbc, 0x85, 0xe5, 0x32, 0x1b, 0x93, 0x46, 0x15, - 0x03, 0x01, 0x00, 0x16, 0x1a, 0x8b, 0x10, 0x42, - 0x12, 0xb2, 0xbd, 0xd3, 0xf1, 0x74, 0x1f, 0xc2, - 0x10, 0x08, 0xc2, 0x79, 0x99, 0x2c, 0x55, 0xef, - 0x4a, 0xbd, - }, -} - -// $ openssl s_server -tls1_2 -cert server.crt -key server.key \ -// -cipher ECDHE-RSA-AES128-SHA -port 10443 -// $ go test -test.run "TestRunClient" -connect -ciphersuites=0xc013 \ -// -minversion=0x0303 -maxversion=0x0303 -var clientTLS12Script = [][]byte{ - { - 0x16, 0x03, 0x01, 0x00, 0x58, 0x01, 0x00, 0x00, - 0x54, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xc0, 0x13, - 0x01, 0x00, 0x00, 0x29, 0x00, 0x05, 0x00, 0x05, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, - 0x08, 0x00, 0x06, 0x00, 0x17, 0x00, 0x18, 0x00, - 0x19, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, 0x00, - 0x0d, 0x00, 0x0a, 0x00, 0x08, 0x04, 0x01, 0x04, - 0x03, 0x02, 0x01, 0x02, 0x03, - }, - { - 0x16, 0x03, 0x03, 0x00, 0x54, 0x02, 0x00, 0x00, - 0x50, 0x03, 0x03, 0x52, 0x65, 0x67, 0xbd, 0xe8, - 0x72, 0x03, 0x6a, 0x52, 0x8d, 0x28, 0x2c, 0x9a, - 0x53, 0xff, 0xc2, 0xa1, 0x62, 0x5f, 0x54, 0xfb, - 0x73, 0x00, 0xcf, 0x4d, 0x28, 0x36, 0xc2, 0xee, - 0xfd, 0x78, 0xf0, 0x20, 0x6f, 0xbe, 0x49, 0xec, - 0x5b, 0x6f, 0xf9, 0x53, 0x42, 0x69, 0x0d, 0x6d, - 0x8b, 0x68, 0x2e, 0xca, 0x3c, 0x3c, 0x88, 0x9e, - 0x8b, 0xf9, 0x32, 0x65, 0x09, 0xd6, 0xa0, 0x7d, - 0xea, 0xc6, 0xd5, 0xc4, 0xc0, 0x13, 0x00, 0x00, - 0x08, 0x00, 0x0b, 0x00, 0x04, 0x03, 0x00, 0x01, - 0x02, 0x16, 0x03, 0x03, 0x02, 0x39, 0x0b, 0x00, - 0x02, 0x35, 0x00, 0x02, 0x32, 0x00, 0x02, 0x2f, - 0x30, 0x82, 0x02, 0x2b, 0x30, 0x82, 0x01, 0xd5, - 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, - 0xb1, 0x35, 0x13, 0x65, 0x11, 0x20, 0xc5, 0x92, - 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, - 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, - 0x45, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, - 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, - 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, - 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, - 0x03, 0x55, 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, - 0x69, 0x64, 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, - 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, 0x30, 0x1e, - 0x17, 0x0d, 0x31, 0x32, 0x30, 0x34, 0x30, 0x36, - 0x31, 0x37, 0x31, 0x30, 0x31, 0x33, 0x5a, 0x17, - 0x0d, 0x31, 0x35, 0x30, 0x34, 0x30, 0x36, 0x31, - 0x37, 0x31, 0x30, 0x31, 0x33, 0x5a, 0x30, 0x45, - 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, - 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, - 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, - 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, - 0x55, 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, - 0x64, 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, - 0x79, 0x20, 0x4c, 0x74, 0x64, 0x30, 0x5c, 0x30, - 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x4b, - 0x00, 0x30, 0x48, 0x02, 0x41, 0x00, 0x9f, 0xb3, - 0xc3, 0x84, 0x27, 0x95, 0xff, 0x12, 0x31, 0x52, - 0x0f, 0x15, 0xef, 0x46, 0x11, 0xc4, 0xad, 0x80, - 0xe6, 0x36, 0x5b, 0x0f, 0xdd, 0x80, 0xd7, 0x61, - 0x8d, 0xe0, 0xfc, 0x72, 0x45, 0x09, 0x34, 0xfe, - 0x55, 0x66, 0x45, 0x43, 0x4c, 0x68, 0x97, 0x6a, - 0xfe, 0xa8, 0xa0, 0xa5, 0xdf, 0x5f, 0x78, 0xff, - 0xee, 0xd7, 0x64, 0xb8, 0x3f, 0x04, 0xcb, 0x6f, - 0xff, 0x2a, 0xfe, 0xfe, 0xb9, 0xed, 0x02, 0x03, - 0x01, 0x00, 0x01, 0xa3, 0x81, 0xa7, 0x30, 0x81, - 0xa4, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, - 0x04, 0x16, 0x04, 0x14, 0x78, 0xa6, 0x97, 0x9a, - 0x63, 0xb5, 0xc5, 0xa1, 0xa5, 0x33, 0xba, 0x22, - 0x7c, 0x23, 0x6e, 0x5b, 0x1b, 0x7a, 0xcc, 0x2b, - 0x30, 0x75, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, - 0x6e, 0x30, 0x6c, 0x80, 0x14, 0x78, 0xa6, 0x97, - 0x9a, 0x63, 0xb5, 0xc5, 0xa1, 0xa5, 0x33, 0xba, - 0x22, 0x7c, 0x23, 0x6e, 0x5b, 0x1b, 0x7a, 0xcc, - 0x2b, 0xa1, 0x49, 0xa4, 0x47, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x82, 0x09, 0x00, 0xb1, - 0x35, 0x13, 0x65, 0x11, 0x20, 0xc5, 0x92, 0x30, - 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, - 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x01, 0x05, 0x05, 0x00, 0x03, 0x41, 0x00, 0x85, - 0x36, 0x40, 0x73, 0xc1, 0xbb, 0x1a, 0xda, 0xd4, - 0x59, 0x9f, 0x2d, 0xa2, 0x70, 0x31, 0x46, 0x74, - 0xec, 0x83, 0x6e, 0xa8, 0xc8, 0x3c, 0x51, 0xaf, - 0x39, 0xac, 0xec, 0x40, 0xbc, 0xe8, 0x22, 0x46, - 0x1d, 0x99, 0xd6, 0x46, 0x2a, 0x24, 0xd4, 0x8b, - 0x05, 0x08, 0x4b, 0xfb, 0x35, 0x11, 0x6e, 0x92, - 0xbb, 0x77, 0xba, 0xe4, 0x12, 0xbb, 0xf4, 0xc8, - 0x5e, 0x9c, 0x81, 0xa8, 0x97, 0x60, 0x4c, 0x16, - 0x03, 0x03, 0x00, 0x8d, 0x0c, 0x00, 0x00, 0x89, - 0x03, 0x00, 0x17, 0x41, 0x04, 0x48, 0x93, 0x62, - 0x6a, 0xf8, 0x7c, 0x94, 0xcc, 0xcc, 0x0a, 0x9b, - 0x5e, 0x11, 0xad, 0x0b, 0x30, 0xc4, 0x5d, 0xf7, - 0x63, 0x24, 0xc1, 0xb0, 0x40, 0x5f, 0xff, 0x9f, - 0x0d, 0x7e, 0xd5, 0xa5, 0xd0, 0x4f, 0x80, 0x16, - 0xa8, 0x66, 0x18, 0x31, 0x1f, 0x81, 0xb2, 0x9a, - 0x41, 0x62, 0x5b, 0xcf, 0x73, 0xac, 0x4a, 0x64, - 0xb5, 0xc1, 0x46, 0x4d, 0x8a, 0xac, 0x25, 0xba, - 0x81, 0x7f, 0xbe, 0x64, 0x68, 0x04, 0x01, 0x00, - 0x40, 0x4e, 0x3f, 0x1e, 0x04, 0x4c, 0xef, 0xd2, - 0xa6, 0x82, 0xe6, 0x7c, 0x76, 0x23, 0x17, 0xb9, - 0xe7, 0x52, 0x15, 0x6b, 0x3d, 0xb2, 0xb1, 0x17, - 0x7d, 0xe6, 0xde, 0x06, 0x87, 0x30, 0xb0, 0xb5, - 0x57, 0xae, 0xdf, 0xb2, 0xdc, 0x8d, 0xab, 0x76, - 0x9c, 0xaa, 0x45, 0x6d, 0x23, 0x5d, 0xc1, 0xa8, - 0x7b, 0x79, 0x79, 0xb1, 0x3c, 0xdc, 0xf5, 0x33, - 0x2c, 0xa1, 0x62, 0x3e, 0xbd, 0xf5, 0x5d, 0x6c, - 0x87, 0x16, 0x03, 0x03, 0x00, 0x04, 0x0e, 0x00, - 0x00, 0x00, - }, - { - 0x16, 0x03, 0x03, 0x00, 0x46, 0x10, 0x00, 0x00, - 0x42, 0x41, 0x04, 0x1e, 0x18, 0x37, 0xef, 0x0d, - 0x19, 0x51, 0x88, 0x35, 0x75, 0x71, 0xb5, 0xe5, - 0x54, 0x5b, 0x12, 0x2e, 0x8f, 0x09, 0x67, 0xfd, - 0xa7, 0x24, 0x20, 0x3e, 0xb2, 0x56, 0x1c, 0xce, - 0x97, 0x28, 0x5e, 0xf8, 0x2b, 0x2d, 0x4f, 0x9e, - 0xf1, 0x07, 0x9f, 0x6c, 0x4b, 0x5b, 0x83, 0x56, - 0xe2, 0x32, 0x42, 0xe9, 0x58, 0xb6, 0xd7, 0x49, - 0xa6, 0xb5, 0x68, 0x1a, 0x41, 0x03, 0x56, 0x6b, - 0xdc, 0x5a, 0x89, 0x14, 0x03, 0x03, 0x00, 0x01, - 0x01, 0x16, 0x03, 0x03, 0x00, 0x40, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0x17, - 0x54, 0x51, 0xb6, 0x1d, 0x8e, 0xe4, 0x6b, 0xed, - 0x5b, 0xa1, 0x27, 0x7f, 0xdc, 0xa9, 0xa5, 0xcf, - 0x38, 0xe6, 0x5d, 0x17, 0x34, 0xf9, 0xc0, 0x07, - 0xb8, 0xbe, 0x56, 0xe6, 0xd6, 0x6a, 0xb6, 0x26, - 0x4e, 0x45, 0x8d, 0x48, 0xe9, 0xc6, 0xb1, 0xa1, - 0xea, 0xdc, 0xb1, 0x37, 0xd9, 0xf6, - }, - { - 0x14, 0x03, 0x03, 0x00, 0x01, 0x01, 0x16, 0x03, - 0x03, 0x00, 0x40, 0x00, 0x68, 0xc5, 0x27, 0xd5, - 0x3d, 0xba, 0x04, 0xde, 0x63, 0xf1, 0x5b, 0xc3, - 0x86, 0xb9, 0x82, 0xc7, 0xb3, 0x90, 0x31, 0xea, - 0x15, 0xe1, 0x42, 0x76, 0x7d, 0x90, 0xcb, 0xc9, - 0xd1, 0x05, 0xe6, 0x8c, 0x76, 0xc7, 0x9a, 0x35, - 0x67, 0xa2, 0x70, 0x9a, 0x8a, 0x6c, 0xb5, 0x6b, - 0xc7, 0x87, 0xf3, 0x65, 0x0a, 0xa0, 0x98, 0xba, - 0x57, 0xbb, 0x31, 0x7b, 0x1f, 0x1a, 0xf7, 0x2a, - 0xf3, 0x12, 0xf6, - }, - { - 0x17, 0x03, 0x03, 0x00, 0x30, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x10, 0x80, - 0x54, 0x1e, 0x72, 0xd3, 0x1a, 0x86, 0x1c, 0xc4, - 0x4a, 0x9b, 0xd4, 0x80, 0xd2, 0x03, 0x35, 0x0d, - 0xe4, 0x12, 0xc2, 0x3d, 0x79, 0x4a, 0x2c, 0xba, - 0xc2, 0xad, 0xf3, 0xd2, 0x16, 0x15, 0x03, 0x03, - 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x04, 0x9b, 0x68, 0x78, 0x92, 0x28, - 0x62, 0x02, 0x65, 0x87, 0x90, 0xe4, 0x32, 0xd7, - 0x72, 0x08, 0x70, 0xb8, 0x52, 0x32, 0x1f, 0x97, - 0xd4, 0x6a, 0xc6, 0x28, 0x83, 0xb0, 0x1d, 0x6e, - 0x16, 0xd5, - }, -} - -// $ openssl s_server -tls1_2 -cert server.crt -key server.key \ -// -port 10443 -verify 0 -// $ go test -test.run "TestRunClient" -connect -ciphersuites=0xc02f \ -// -maxversion=0x0303 -var clientTLS12ClientCertScript = [][]byte{ - { - 0x16, 0x03, 0x01, 0x00, 0x58, 0x01, 0x00, 0x00, - 0x54, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xc0, 0x2f, - 0x01, 0x00, 0x00, 0x29, 0x00, 0x05, 0x00, 0x05, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, - 0x08, 0x00, 0x06, 0x00, 0x17, 0x00, 0x18, 0x00, - 0x19, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, 0x00, - 0x0d, 0x00, 0x0a, 0x00, 0x08, 0x04, 0x01, 0x04, - 0x03, 0x02, 0x01, 0x02, 0x03, - }, - { - 0x16, 0x03, 0x03, 0x00, 0x54, 0x02, 0x00, 0x00, - 0x50, 0x03, 0x03, 0x52, 0x65, 0x67, 0xe0, 0xe8, - 0xf1, 0x13, 0x2a, 0x83, 0x28, 0xa8, 0x2e, 0x76, - 0x69, 0xe6, 0x89, 0x55, 0x6c, 0x48, 0x49, 0x2e, - 0x00, 0xf6, 0x87, 0x6c, 0x13, 0xa1, 0xd4, 0xaa, - 0xd0, 0x76, 0x3b, 0x20, 0xe4, 0xd6, 0x5b, 0x1d, - 0x11, 0xf2, 0x42, 0xf2, 0x82, 0x0c, 0x0d, 0x66, - 0x6d, 0xec, 0x52, 0xf8, 0x4a, 0xd9, 0x45, 0xcf, - 0xe4, 0x4a, 0xba, 0x8b, 0xf1, 0xab, 0x55, 0xe4, - 0x57, 0x18, 0xa9, 0x36, 0xc0, 0x2f, 0x00, 0x00, - 0x08, 0x00, 0x0b, 0x00, 0x04, 0x03, 0x00, 0x01, - 0x02, 0x16, 0x03, 0x03, 0x02, 0x39, 0x0b, 0x00, - 0x02, 0x35, 0x00, 0x02, 0x32, 0x00, 0x02, 0x2f, - 0x30, 0x82, 0x02, 0x2b, 0x30, 0x82, 0x01, 0xd5, - 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, - 0xb1, 0x35, 0x13, 0x65, 0x11, 0x20, 0xc5, 0x92, - 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, - 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, - 0x45, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, - 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, - 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, - 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, - 0x03, 0x55, 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, - 0x69, 0x64, 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, - 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, 0x30, 0x1e, - 0x17, 0x0d, 0x31, 0x32, 0x30, 0x34, 0x30, 0x36, - 0x31, 0x37, 0x31, 0x30, 0x31, 0x33, 0x5a, 0x17, - 0x0d, 0x31, 0x35, 0x30, 0x34, 0x30, 0x36, 0x31, - 0x37, 0x31, 0x30, 0x31, 0x33, 0x5a, 0x30, 0x45, - 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, - 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, - 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, - 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, - 0x55, 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, - 0x64, 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, - 0x79, 0x20, 0x4c, 0x74, 0x64, 0x30, 0x5c, 0x30, - 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x4b, - 0x00, 0x30, 0x48, 0x02, 0x41, 0x00, 0x9f, 0xb3, - 0xc3, 0x84, 0x27, 0x95, 0xff, 0x12, 0x31, 0x52, - 0x0f, 0x15, 0xef, 0x46, 0x11, 0xc4, 0xad, 0x80, - 0xe6, 0x36, 0x5b, 0x0f, 0xdd, 0x80, 0xd7, 0x61, - 0x8d, 0xe0, 0xfc, 0x72, 0x45, 0x09, 0x34, 0xfe, - 0x55, 0x66, 0x45, 0x43, 0x4c, 0x68, 0x97, 0x6a, - 0xfe, 0xa8, 0xa0, 0xa5, 0xdf, 0x5f, 0x78, 0xff, - 0xee, 0xd7, 0x64, 0xb8, 0x3f, 0x04, 0xcb, 0x6f, - 0xff, 0x2a, 0xfe, 0xfe, 0xb9, 0xed, 0x02, 0x03, - 0x01, 0x00, 0x01, 0xa3, 0x81, 0xa7, 0x30, 0x81, - 0xa4, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, - 0x04, 0x16, 0x04, 0x14, 0x78, 0xa6, 0x97, 0x9a, - 0x63, 0xb5, 0xc5, 0xa1, 0xa5, 0x33, 0xba, 0x22, - 0x7c, 0x23, 0x6e, 0x5b, 0x1b, 0x7a, 0xcc, 0x2b, - 0x30, 0x75, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, - 0x6e, 0x30, 0x6c, 0x80, 0x14, 0x78, 0xa6, 0x97, - 0x9a, 0x63, 0xb5, 0xc5, 0xa1, 0xa5, 0x33, 0xba, - 0x22, 0x7c, 0x23, 0x6e, 0x5b, 0x1b, 0x7a, 0xcc, - 0x2b, 0xa1, 0x49, 0xa4, 0x47, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x82, 0x09, 0x00, 0xb1, - 0x35, 0x13, 0x65, 0x11, 0x20, 0xc5, 0x92, 0x30, - 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, - 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x01, 0x05, 0x05, 0x00, 0x03, 0x41, 0x00, 0x85, - 0x36, 0x40, 0x73, 0xc1, 0xbb, 0x1a, 0xda, 0xd4, - 0x59, 0x9f, 0x2d, 0xa2, 0x70, 0x31, 0x46, 0x74, - 0xec, 0x83, 0x6e, 0xa8, 0xc8, 0x3c, 0x51, 0xaf, - 0x39, 0xac, 0xec, 0x40, 0xbc, 0xe8, 0x22, 0x46, - 0x1d, 0x99, 0xd6, 0x46, 0x2a, 0x24, 0xd4, 0x8b, - 0x05, 0x08, 0x4b, 0xfb, 0x35, 0x11, 0x6e, 0x92, - 0xbb, 0x77, 0xba, 0xe4, 0x12, 0xbb, 0xf4, 0xc8, - 0x5e, 0x9c, 0x81, 0xa8, 0x97, 0x60, 0x4c, 0x16, - 0x03, 0x03, 0x00, 0x8d, 0x0c, 0x00, 0x00, 0x89, - 0x03, 0x00, 0x17, 0x41, 0x04, 0xaa, 0xf0, 0x0c, - 0xa3, 0x60, 0xcf, 0x69, 0x1e, 0xad, 0x16, 0x9a, - 0x01, 0x40, 0xc6, 0x22, 0xc4, 0xbb, 0x06, 0x3b, - 0x84, 0x65, 0xea, 0xc7, 0xa2, 0x96, 0x79, 0x17, - 0x2f, 0xc7, 0xbe, 0x56, 0x39, 0xe4, 0x79, 0xf3, - 0xad, 0x17, 0xf3, 0x7e, 0xe2, 0x7b, 0xa2, 0x6f, - 0x3f, 0x96, 0xea, 0xe5, 0x0e, 0xea, 0x39, 0x79, - 0x77, 0xeb, 0x14, 0x18, 0xbb, 0x7c, 0x95, 0xda, - 0xa7, 0x51, 0x09, 0xba, 0xd7, 0x04, 0x01, 0x00, - 0x40, 0x82, 0x3e, 0xce, 0xee, 0x7e, 0xba, 0x3b, - 0x51, 0xb1, 0xba, 0x71, 0x2e, 0x54, 0xa9, 0xb9, - 0xe2, 0xb1, 0x59, 0x17, 0xa1, 0xac, 0x76, 0xb4, - 0x4e, 0xf1, 0xae, 0x65, 0x17, 0x2b, 0x43, 0x06, - 0x31, 0x29, 0x0b, 0xa0, 0x1e, 0xb6, 0xfa, 0x35, - 0xe8, 0x63, 0x06, 0xde, 0x13, 0x89, 0x83, 0x69, - 0x3b, 0xc2, 0x15, 0x73, 0x1c, 0xc5, 0x07, 0xe9, - 0x38, 0x9b, 0x06, 0x81, 0x1b, 0x97, 0x7c, 0xa6, - 0x89, 0x16, 0x03, 0x03, 0x00, 0x30, 0x0d, 0x00, - 0x00, 0x28, 0x03, 0x01, 0x02, 0x40, 0x00, 0x20, - 0x06, 0x01, 0x06, 0x02, 0x06, 0x03, 0x05, 0x01, - 0x05, 0x02, 0x05, 0x03, 0x04, 0x01, 0x04, 0x02, - 0x04, 0x03, 0x03, 0x01, 0x03, 0x02, 0x03, 0x03, - 0x02, 0x01, 0x02, 0x02, 0x02, 0x03, 0x01, 0x01, - 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, - }, - { - 0x16, 0x03, 0x03, 0x0a, 0xfb, 0x0b, 0x00, 0x0a, - 0xf7, 0x00, 0x0a, 0xf4, 0x00, 0x03, 0x7e, 0x30, - 0x82, 0x03, 0x7a, 0x30, 0x82, 0x02, 0x62, 0x02, - 0x09, 0x00, 0xb4, 0x47, 0x58, 0x57, 0x2b, 0x67, - 0xc8, 0xc2, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, - 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, - 0x00, 0x30, 0x81, 0x80, 0x31, 0x0b, 0x30, 0x09, - 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, - 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, - 0x04, 0x08, 0x0c, 0x02, 0x4e, 0x59, 0x31, 0x11, - 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, - 0x08, 0x42, 0x72, 0x6f, 0x6f, 0x6b, 0x6c, 0x79, - 0x6e, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x0c, 0x0c, 0x4d, 0x79, 0x20, 0x43, - 0x41, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, - 0x03, 0x0c, 0x0e, 0x6d, 0x79, 0x63, 0x61, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, - 0x6d, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x09, 0x2a, - 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, - 0x16, 0x12, 0x6a, 0x76, 0x73, 0x68, 0x61, 0x68, - 0x69, 0x64, 0x40, 0x67, 0x6d, 0x61, 0x69, 0x6c, - 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d, - 0x31, 0x33, 0x30, 0x35, 0x32, 0x36, 0x32, 0x31, - 0x34, 0x34, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x31, - 0x33, 0x30, 0x36, 0x32, 0x35, 0x32, 0x31, 0x34, - 0x34, 0x30, 0x30, 0x5a, 0x30, 0x7d, 0x31, 0x0b, - 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, - 0x02, 0x55, 0x53, 0x31, 0x11, 0x30, 0x0f, 0x06, - 0x03, 0x55, 0x04, 0x08, 0x0c, 0x08, 0x4e, 0x65, - 0x77, 0x20, 0x59, 0x6f, 0x72, 0x6b, 0x31, 0x11, - 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, - 0x08, 0x42, 0x72, 0x6f, 0x6f, 0x6b, 0x6c, 0x79, - 0x6e, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x0c, 0x07, 0x4d, 0x79, 0x20, 0x4c, - 0x65, 0x61, 0x66, 0x31, 0x13, 0x30, 0x11, 0x06, - 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0a, 0x6d, 0x79, - 0x6c, 0x65, 0x61, 0x66, 0x2e, 0x63, 0x6f, 0x6d, - 0x31, 0x21, 0x30, 0x1f, 0x06, 0x09, 0x2a, 0x86, - 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, - 0x12, 0x6a, 0x76, 0x73, 0x68, 0x61, 0x68, 0x69, - 0x64, 0x40, 0x67, 0x6d, 0x61, 0x69, 0x6c, 0x2e, - 0x63, 0x6f, 0x6d, 0x30, 0x82, 0x01, 0x22, 0x30, - 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, - 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, - 0x82, 0x01, 0x01, 0x00, 0xa0, 0xa3, 0xef, 0xc1, - 0x44, 0x7d, 0xa2, 0xe3, 0x71, 0x98, 0x27, 0x63, - 0xb3, 0x1d, 0x71, 0x50, 0xa6, 0x34, 0x15, 0xcb, - 0xc9, 0x2a, 0xc3, 0xea, 0xe4, 0x9e, 0x9c, 0x49, - 0xa6, 0x01, 0x9b, 0x7e, 0xa9, 0xb5, 0x7a, 0xff, - 0x15, 0x92, 0x71, 0xc8, 0x97, 0x9c, 0x25, 0xb7, - 0x79, 0x2b, 0xff, 0xab, 0xc6, 0xb1, 0xa7, 0x00, - 0x90, 0xb2, 0x8b, 0xd7, 0x71, 0xd5, 0xc2, 0x3a, - 0xe6, 0x82, 0x42, 0x37, 0x89, 0x41, 0x04, 0xb0, - 0xba, 0xc7, 0x5b, 0x8a, 0x43, 0x9f, 0x97, 0x39, - 0x0c, 0x0f, 0xd5, 0x6d, 0x9e, 0x8d, 0xeb, 0xc0, - 0x26, 0xc5, 0x18, 0xe8, 0x7a, 0x3d, 0x32, 0x2e, - 0x38, 0x90, 0x40, 0x5b, 0x39, 0x2c, 0x07, 0xcb, - 0x24, 0x10, 0xc5, 0xc9, 0x3b, 0xe3, 0x66, 0x47, - 0x57, 0xb9, 0x6a, 0xad, 0x44, 0xf8, 0xd0, 0x70, - 0x62, 0x3b, 0x8e, 0xed, 0x60, 0x5f, 0x22, 0xf8, - 0xb8, 0x0c, 0xc9, 0x41, 0x2b, 0xc9, 0x80, 0x6e, - 0x4e, 0x1b, 0xe1, 0x20, 0xfc, 0x47, 0xa4, 0xac, - 0xc3, 0x3f, 0xe6, 0xc2, 0x81, 0x79, 0x03, 0x37, - 0x25, 0x89, 0xca, 0xd6, 0xa5, 0x46, 0x91, 0x63, - 0x41, 0xc5, 0x3e, 0xd5, 0xed, 0x7f, 0x4f, 0x8d, - 0x06, 0xc0, 0x89, 0x00, 0xbe, 0x37, 0x7b, 0x7e, - 0x73, 0xca, 0x70, 0x00, 0x14, 0x34, 0xbe, 0x47, - 0xbc, 0xb2, 0x6a, 0x28, 0xa5, 0x29, 0x84, 0xa8, - 0x9d, 0xc8, 0x1e, 0x77, 0x66, 0x1f, 0x9f, 0xaa, - 0x2b, 0x47, 0xdb, 0xdd, 0x6b, 0x9c, 0xa8, 0xfc, - 0x82, 0x36, 0x94, 0x62, 0x0d, 0x5c, 0x3f, 0xb2, - 0x01, 0xb4, 0xa5, 0xb8, 0xc6, 0x0e, 0x94, 0x5b, - 0xec, 0x5e, 0xbb, 0x7a, 0x63, 0x24, 0xf1, 0xf9, - 0xd6, 0x50, 0x08, 0xc1, 0xa3, 0xcc, 0x90, 0x07, - 0x5b, 0x04, 0x04, 0x42, 0x74, 0xcf, 0x37, 0xfa, - 0xf0, 0xa5, 0xd9, 0xd3, 0x86, 0x89, 0x89, 0x18, - 0xf3, 0x4c, 0xe2, 0x11, 0x02, 0x03, 0x01, 0x00, - 0x01, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, - 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, - 0x03, 0x82, 0x01, 0x01, 0x00, 0x90, 0xbb, 0xf9, - 0x5e, 0xba, 0x17, 0x1f, 0xac, 0x21, 0x9f, 0x6b, - 0x4a, 0x46, 0xd0, 0x6d, 0x3c, 0x8f, 0x3d, 0xf8, - 0x5e, 0x3e, 0x72, 0xaf, 0xa0, 0x1a, 0xf3, 0xff, - 0x89, 0xac, 0x5b, 0x7a, 0xe2, 0x91, 0x2a, 0x23, - 0x85, 0xc6, 0x4d, 0x47, 0x67, 0x01, 0x08, 0xa8, - 0x05, 0x1d, 0x01, 0x60, 0x50, 0x5f, 0x59, 0xad, - 0xfe, 0x7b, 0xc6, 0x0c, 0x54, 0x90, 0x68, 0x70, - 0x67, 0x2e, 0xed, 0x87, 0xf8, 0x69, 0x8a, 0xac, - 0x32, 0xfe, 0x6f, 0x90, 0x19, 0x2a, 0x64, 0x8d, - 0x82, 0x66, 0x05, 0x43, 0x88, 0xee, 0xf2, 0x30, - 0xed, 0xa4, 0x8f, 0xbf, 0xd6, 0x57, 0x20, 0xd4, - 0x43, 0x1d, 0x52, 0x96, 0x6f, 0xae, 0x09, 0x96, - 0x01, 0x52, 0x38, 0xe3, 0xaf, 0x99, 0xd7, 0xdc, - 0x14, 0x99, 0xc4, 0x8b, 0x0e, 0x04, 0x0f, 0xb3, - 0x14, 0x14, 0xd4, 0xa5, 0x93, 0xe1, 0xc9, 0x8a, - 0x81, 0xef, 0x63, 0xfc, 0x36, 0x77, 0x05, 0x06, - 0xf0, 0x2a, 0x04, 0x0a, 0xbe, 0x2e, 0xce, 0x81, - 0x3d, 0x23, 0xa1, 0xda, 0xd8, 0xeb, 0xc6, 0xea, - 0x5e, 0xcf, 0x28, 0x36, 0x51, 0x31, 0x95, 0x5e, - 0x40, 0x04, 0xed, 0xac, 0xc1, 0xc8, 0x56, 0x69, - 0x87, 0xec, 0x3b, 0x03, 0x3e, 0x9d, 0x0f, 0x4c, - 0x4c, 0xeb, 0xd7, 0xba, 0x26, 0xdf, 0xe3, 0xde, - 0x10, 0xee, 0x93, 0x62, 0x8d, 0x73, 0x52, 0x6e, - 0xff, 0x37, 0x36, 0x98, 0x7b, 0x2d, 0x56, 0x4c, - 0xba, 0x09, 0xb8, 0xa7, 0xf0, 0x3b, 0x16, 0x81, - 0xca, 0xdb, 0x43, 0xab, 0xec, 0x4c, 0x6e, 0x7c, - 0xc1, 0x0b, 0x22, 0x22, 0x43, 0x1d, 0xb6, 0x0c, - 0xc1, 0xb9, 0xcf, 0xe4, 0x53, 0xee, 0x1d, 0x3e, - 0x88, 0xa7, 0x13, 0xbe, 0x7f, 0xbd, 0xae, 0x72, - 0xcf, 0xcd, 0x63, 0xd2, 0xc3, 0x18, 0x58, 0x92, - 0xa2, 0xad, 0xb5, 0x09, 0x9d, 0x91, 0x03, 0xdd, - 0x3c, 0xe2, 0x1c, 0xde, 0x78, 0x00, 0x03, 0x88, - 0x30, 0x82, 0x03, 0x84, 0x30, 0x82, 0x02, 0x6c, - 0x02, 0x09, 0x00, 0xab, 0xed, 0xa6, 0xe4, 0x4a, - 0x2b, 0x2b, 0xf8, 0x30, 0x0d, 0x06, 0x09, 0x2a, - 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, - 0x05, 0x00, 0x30, 0x81, 0x86, 0x31, 0x0b, 0x30, - 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, - 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, - 0x55, 0x04, 0x08, 0x0c, 0x02, 0x4e, 0x59, 0x31, - 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x07, - 0x0c, 0x08, 0x42, 0x72, 0x6f, 0x6f, 0x6b, 0x6c, - 0x79, 0x6e, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, - 0x55, 0x04, 0x0a, 0x0c, 0x18, 0x4d, 0x79, 0x20, - 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31, 0x11, 0x30, - 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x08, - 0x6d, 0x79, 0x63, 0x61, 0x2e, 0x6f, 0x72, 0x67, - 0x31, 0x21, 0x30, 0x1f, 0x06, 0x09, 0x2a, 0x86, - 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, - 0x12, 0x6a, 0x76, 0x73, 0x68, 0x61, 0x68, 0x69, - 0x64, 0x40, 0x67, 0x6d, 0x61, 0x69, 0x6c, 0x2e, - 0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d, 0x31, - 0x33, 0x30, 0x35, 0x32, 0x36, 0x32, 0x31, 0x31, - 0x38, 0x34, 0x30, 0x5a, 0x17, 0x0d, 0x31, 0x33, - 0x30, 0x36, 0x32, 0x35, 0x32, 0x31, 0x31, 0x38, - 0x34, 0x30, 0x5a, 0x30, 0x81, 0x80, 0x31, 0x0b, - 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, - 0x02, 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, - 0x03, 0x55, 0x04, 0x08, 0x0c, 0x02, 0x4e, 0x59, - 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, - 0x07, 0x0c, 0x08, 0x42, 0x72, 0x6f, 0x6f, 0x6b, - 0x6c, 0x79, 0x6e, 0x31, 0x15, 0x30, 0x13, 0x06, - 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x0c, 0x4d, 0x79, - 0x20, 0x43, 0x41, 0x20, 0x43, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, - 0x55, 0x04, 0x03, 0x0c, 0x0e, 0x6d, 0x79, 0x63, - 0x61, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, - 0x63, 0x6f, 0x6d, 0x31, 0x21, 0x30, 0x1f, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x09, 0x01, 0x16, 0x12, 0x6a, 0x76, 0x73, 0x68, - 0x61, 0x68, 0x69, 0x64, 0x40, 0x67, 0x6d, 0x61, - 0x69, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x82, - 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, - 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, - 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, - 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xce, - 0x13, 0xf0, 0x72, 0xb0, 0x61, 0xc8, 0x18, 0x37, - 0x8a, 0x41, 0x3d, 0x20, 0xa1, 0x1c, 0xcb, 0xbf, - 0xf6, 0x3b, 0x74, 0x26, 0x2a, 0x96, 0x11, 0xec, - 0x53, 0xa1, 0xcc, 0x7d, 0x77, 0x56, 0x45, 0x0f, - 0x36, 0xb7, 0xf2, 0x48, 0x92, 0x1a, 0x62, 0xcc, - 0xb6, 0xc0, 0xa1, 0x2f, 0x44, 0x2b, 0xc1, 0x89, - 0xcb, 0x6e, 0x1e, 0xdb, 0x57, 0x92, 0xd5, 0x97, - 0x60, 0x8c, 0x41, 0x2c, 0xd9, 0x20, 0xfe, 0xe9, - 0x1f, 0x8e, 0xfc, 0x7f, 0x02, 0x44, 0x0f, 0x28, - 0x81, 0xd6, 0x0c, 0xcd, 0xbc, 0xf0, 0x57, 0x6c, - 0xcc, 0xa7, 0xba, 0x06, 0xa0, 0xa6, 0x91, 0xda, - 0xef, 0x46, 0x8a, 0x60, 0x0f, 0x52, 0x6c, 0x90, - 0x6c, 0x8c, 0x44, 0xaf, 0xb0, 0x9d, 0x90, 0xba, - 0x21, 0x58, 0xa0, 0x3c, 0xee, 0x54, 0xb5, 0x29, - 0x26, 0x1f, 0x0a, 0xac, 0xef, 0x48, 0x68, 0x33, - 0xd0, 0x33, 0xd0, 0x8b, 0x1a, 0xec, 0x6e, 0x2f, - 0xb5, 0x4a, 0x53, 0xc2, 0x1a, 0xd2, 0xf1, 0x50, - 0x05, 0x59, 0x5c, 0xd9, 0xda, 0x03, 0x0a, 0x47, - 0xb7, 0xdd, 0xf7, 0x3a, 0x69, 0xf5, 0x4e, 0xea, - 0x4a, 0xc2, 0xca, 0x54, 0xb0, 0x8b, 0x76, 0xe1, - 0x02, 0x2d, 0x52, 0x67, 0xb9, 0xdd, 0x50, 0xc9, - 0x3b, 0x07, 0x24, 0x22, 0x6a, 0x00, 0x1d, 0x58, - 0x83, 0xa8, 0xec, 0x95, 0xf1, 0xda, 0xe2, 0x73, - 0xa0, 0xa1, 0x72, 0x60, 0x9e, 0x86, 0x53, 0xcb, - 0x45, 0xa8, 0xc2, 0xa0, 0x50, 0xa0, 0x53, 0xd6, - 0xfc, 0x18, 0x84, 0xb5, 0x4a, 0x26, 0xd0, 0xa2, - 0xaa, 0xd0, 0xff, 0xb6, 0xfe, 0x3a, 0x9c, 0xb5, - 0x19, 0x3b, 0x3f, 0xe1, 0x48, 0x0d, 0xa4, 0x09, - 0x4f, 0x83, 0xc9, 0xc0, 0xc9, 0xa6, 0x0b, 0x58, - 0x1f, 0x1c, 0x7b, 0xac, 0xa2, 0x42, 0xbc, 0x61, - 0xf4, 0x21, 0x8a, 0x00, 0xda, 0x14, 0xa0, 0x60, - 0x03, 0xfe, 0x93, 0x12, 0x6c, 0x56, 0xcd, 0x02, - 0x03, 0x01, 0x00, 0x01, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, - 0x25, 0x29, 0x3b, 0x1e, 0xc3, 0x58, 0x32, 0xe6, - 0x23, 0xc8, 0xee, 0x18, 0xf0, 0x1d, 0x62, 0x6d, - 0x3b, 0x59, 0x99, 0x3a, 0xfe, 0x49, 0x72, 0x07, - 0x3f, 0x58, 0x93, 0xdb, 0xc0, 0xaf, 0xb0, 0xb3, - 0x5c, 0xd1, 0x5c, 0x98, 0xc8, 0xea, 0x4a, 0xe4, - 0x58, 0x73, 0x0d, 0x57, 0xc5, 0x13, 0x7c, 0x5c, - 0x79, 0x66, 0xda, 0x04, 0x1d, 0xe5, 0x98, 0xda, - 0x35, 0x47, 0x44, 0xb0, 0xd2, 0x7a, 0x66, 0x9d, - 0xcd, 0x41, 0xa5, 0x8f, 0xa1, 0x11, 0xb2, 0x1a, - 0x87, 0xc0, 0xcd, 0x55, 0xed, 0xb4, 0x7b, 0x33, - 0x72, 0xeb, 0xf7, 0xe3, 0x7b, 0x8b, 0x02, 0x86, - 0xe9, 0x2b, 0x26, 0x32, 0x9f, 0x99, 0xf1, 0xcb, - 0x93, 0xab, 0xb9, 0x16, 0xb3, 0x9a, 0xb2, 0x22, - 0x13, 0x21, 0x1f, 0x5b, 0xcc, 0xa2, 0x59, 0xbb, - 0x69, 0xf2, 0xb8, 0x07, 0x80, 0xce, 0x0c, 0xf7, - 0x98, 0x4c, 0x85, 0xc2, 0x96, 0x6a, 0x22, 0x05, - 0xe9, 0xbe, 0x48, 0xb0, 0x02, 0x5b, 0x69, 0x28, - 0x18, 0x88, 0x96, 0xe3, 0xd7, 0xc6, 0x7a, 0xd3, - 0xe9, 0x99, 0xff, 0x9d, 0xc3, 0x61, 0x4d, 0x9a, - 0x96, 0xf2, 0xc6, 0x33, 0x4d, 0xe5, 0x5d, 0x5a, - 0x68, 0x64, 0x5a, 0x82, 0x35, 0x65, 0x25, 0xe3, - 0x8c, 0x5b, 0xb0, 0xf6, 0x96, 0x56, 0xbc, 0xbf, - 0x97, 0x76, 0x4b, 0x66, 0x44, 0x81, 0xa4, 0xc4, - 0xa7, 0x31, 0xc5, 0xa1, 0x4f, 0xe8, 0xa4, 0xca, - 0x20, 0xf5, 0x01, 0x5b, 0x99, 0x4f, 0x5a, 0xf4, - 0xf0, 0x78, 0xbf, 0x71, 0x49, 0xd5, 0xf1, 0xc1, - 0xa2, 0x18, 0xfd, 0x72, 0x5b, 0x16, 0xe8, 0x92, - 0xc7, 0x37, 0x48, 0xaf, 0xee, 0x24, 0xfc, 0x35, - 0x0b, 0xc2, 0xdd, 0x05, 0xc7, 0x6e, 0xa3, 0x29, - 0xbb, 0x29, 0x7d, 0xd3, 0x2b, 0x94, 0x80, 0xc3, - 0x40, 0x53, 0x0e, 0x03, 0x54, 0x3d, 0x7b, 0x8b, - 0xce, 0xf9, 0xa4, 0x03, 0x27, 0x63, 0xec, 0x51, - 0x00, 0x03, 0xe5, 0x30, 0x82, 0x03, 0xe1, 0x30, - 0x82, 0x02, 0xc9, 0xa0, 0x03, 0x02, 0x01, 0x02, - 0x02, 0x09, 0x00, 0xcc, 0x22, 0x4c, 0x4b, 0x98, - 0xa2, 0x88, 0xfc, 0x30, 0x0d, 0x06, 0x09, 0x2a, - 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, - 0x05, 0x00, 0x30, 0x81, 0x86, 0x31, 0x0b, 0x30, - 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, - 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, - 0x55, 0x04, 0x08, 0x0c, 0x02, 0x4e, 0x59, 0x31, - 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x07, - 0x0c, 0x08, 0x42, 0x72, 0x6f, 0x6f, 0x6b, 0x6c, - 0x79, 0x6e, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, - 0x55, 0x04, 0x0a, 0x0c, 0x18, 0x4d, 0x79, 0x20, - 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31, 0x11, 0x30, - 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x08, - 0x6d, 0x79, 0x63, 0x61, 0x2e, 0x6f, 0x72, 0x67, - 0x31, 0x21, 0x30, 0x1f, 0x06, 0x09, 0x2a, 0x86, - 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, - 0x12, 0x6a, 0x76, 0x73, 0x68, 0x61, 0x68, 0x69, - 0x64, 0x40, 0x67, 0x6d, 0x61, 0x69, 0x6c, 0x2e, - 0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d, 0x31, - 0x33, 0x30, 0x35, 0x32, 0x36, 0x32, 0x31, 0x30, - 0x35, 0x30, 0x31, 0x5a, 0x17, 0x0d, 0x32, 0x33, - 0x30, 0x35, 0x32, 0x34, 0x32, 0x31, 0x30, 0x35, - 0x30, 0x31, 0x5a, 0x30, 0x81, 0x86, 0x31, 0x0b, - 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, - 0x02, 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, - 0x03, 0x55, 0x04, 0x08, 0x0c, 0x02, 0x4e, 0x59, - 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, - 0x07, 0x0c, 0x08, 0x42, 0x72, 0x6f, 0x6f, 0x6b, - 0x6c, 0x79, 0x6e, 0x31, 0x21, 0x30, 0x1f, 0x06, - 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x18, 0x4d, 0x79, - 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x65, 0x20, 0x41, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31, 0x11, - 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, - 0x08, 0x6d, 0x79, 0x63, 0x61, 0x2e, 0x6f, 0x72, - 0x67, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x09, 0x2a, - 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, - 0x16, 0x12, 0x6a, 0x76, 0x73, 0x68, 0x61, 0x68, - 0x69, 0x64, 0x40, 0x67, 0x6d, 0x61, 0x69, 0x6c, - 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x82, 0x01, 0x22, - 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, - 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, - 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, - 0x02, 0x82, 0x01, 0x01, 0x00, 0xf0, 0xfb, 0xad, - 0x80, 0x5e, 0x37, 0xd3, 0x6d, 0xee, 0x2e, 0xcc, - 0xbc, 0x0c, 0xd7, 0x56, 0x4b, 0x56, 0x45, 0xcd, - 0x28, 0xb6, 0x22, 0xe9, 0xe2, 0x0f, 0xd1, 0x87, - 0x2a, 0x27, 0xce, 0x77, 0x8d, 0x6e, 0x0e, 0x0f, - 0xfb, 0x66, 0xe1, 0xb5, 0x0e, 0x9a, 0xb6, 0x05, - 0x8e, 0xb3, 0xe1, 0xc5, 0x77, 0x86, 0x5b, 0x46, - 0xd2, 0x0b, 0x92, 0x03, 0x1b, 0x89, 0x0c, 0x1b, - 0x10, 0x0e, 0x99, 0x8f, 0xe2, 0x17, 0xe8, 0xc2, - 0x30, 0x00, 0x47, 0xd6, 0xfc, 0xf9, 0x0f, 0x3b, - 0x75, 0x34, 0x8d, 0x4d, 0xb0, 0x99, 0xb7, 0xa0, - 0x6d, 0xa0, 0xb6, 0xad, 0xda, 0x07, 0x5e, 0x38, - 0x2e, 0x02, 0xe4, 0x30, 0x6d, 0xae, 0x13, 0x72, - 0xd4, 0xc8, 0xce, 0x14, 0x07, 0xae, 0x23, 0x8c, - 0x8f, 0x9e, 0x8c, 0x60, 0xd6, 0x06, 0xb9, 0xef, - 0x00, 0x18, 0xc0, 0x1d, 0x25, 0x1e, 0xda, 0x3e, - 0x2f, 0xcf, 0x2b, 0x56, 0x84, 0x9e, 0x30, 0x21, - 0xc7, 0x29, 0xf6, 0x03, 0x8a, 0x24, 0xf9, 0x34, - 0xac, 0x65, 0x9d, 0x80, 0x36, 0xc8, 0x3b, 0x15, - 0x10, 0xbd, 0x51, 0xe9, 0xbc, 0x02, 0xe1, 0xe9, - 0xb3, 0x5a, 0x9a, 0x99, 0x41, 0x1b, 0x27, 0xa0, - 0x4d, 0x50, 0x9e, 0x27, 0x7f, 0xa1, 0x7d, 0x09, - 0x87, 0xbd, 0x8a, 0xca, 0x5f, 0xb1, 0xa5, 0x08, - 0xb8, 0x04, 0xd4, 0x52, 0x89, 0xaa, 0xe0, 0x7d, - 0x42, 0x2e, 0x2f, 0x15, 0xee, 0x66, 0x57, 0x0f, - 0x13, 0x19, 0x45, 0xa8, 0x4b, 0x5d, 0x81, 0x66, - 0xcc, 0x12, 0x37, 0x94, 0x5e, 0xfd, 0x3c, 0x10, - 0x81, 0x51, 0x3f, 0xfa, 0x0f, 0xdd, 0xa1, 0x89, - 0x03, 0xa9, 0x78, 0x91, 0xf5, 0x3b, 0xf3, 0xbc, - 0xac, 0xbe, 0x93, 0x30, 0x2e, 0xbe, 0xca, 0x7f, - 0x46, 0xd3, 0x28, 0xb4, 0x4e, 0x91, 0x7b, 0x5b, - 0x43, 0x6c, 0xaf, 0x9b, 0x5c, 0x6a, 0x6d, 0x5a, - 0xdb, 0x79, 0x5e, 0x6a, 0x6b, 0x02, 0x03, 0x01, - 0x00, 0x01, 0xa3, 0x50, 0x30, 0x4e, 0x30, 0x1d, - 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, - 0x14, 0x6b, 0x1e, 0x00, 0xa8, 0x9f, 0xfa, 0x7d, - 0x00, 0xf9, 0xe0, 0x9d, 0x0f, 0x90, 0x8c, 0x90, - 0xa8, 0xa1, 0x37, 0x6b, 0xda, 0x30, 0x1f, 0x06, - 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, - 0x80, 0x14, 0x6b, 0x1e, 0x00, 0xa8, 0x9f, 0xfa, - 0x7d, 0x00, 0xf9, 0xe0, 0x9d, 0x0f, 0x90, 0x8c, - 0x90, 0xa8, 0xa1, 0x37, 0x6b, 0xda, 0x30, 0x0c, - 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, - 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, - 0xcd, 0x6f, 0x73, 0x4d, 0x56, 0x0b, 0xf3, 0x2e, - 0x1c, 0xe2, 0x02, 0x0c, 0x14, 0xbb, 0x2f, 0xdd, - 0x3c, 0x43, 0xfe, 0xdf, 0x94, 0x2d, 0xa9, 0x89, - 0x81, 0x51, 0xf8, 0x5f, 0xa7, 0xa0, 0x13, 0xaa, - 0xcc, 0xb0, 0x18, 0xe2, 0x57, 0x3e, 0x0d, 0x29, - 0x93, 0xe8, 0x95, 0xd5, 0x1b, 0x53, 0xd2, 0x51, - 0xf2, 0xbd, 0xf5, 0x9e, 0x7b, 0x22, 0x65, 0x62, - 0x5c, 0xc4, 0x4c, 0x1d, 0xe8, 0xe9, 0xc3, 0xd4, - 0x2b, 0xe7, 0x78, 0xcb, 0x10, 0xf3, 0xfe, 0x06, - 0x83, 0xdc, 0x3a, 0x1e, 0x62, 0x10, 0xc0, 0x46, - 0x77, 0xc6, 0x9d, 0x9f, 0xab, 0x96, 0x25, 0x5c, - 0xfb, 0x26, 0xc1, 0x15, 0x1f, 0xa5, 0x33, 0xee, - 0x4f, 0x9a, 0x14, 0x6a, 0x14, 0x97, 0x93, 0x2b, - 0x95, 0x0b, 0xdc, 0xa8, 0xd7, 0x69, 0x2e, 0xf0, - 0x01, 0x0e, 0xfd, 0x4e, 0xd0, 0xd9, 0xa8, 0xe5, - 0x65, 0xde, 0xfb, 0xca, 0xca, 0x1c, 0x5f, 0xf9, - 0x53, 0xa0, 0x87, 0xe7, 0x33, 0x9b, 0x2f, 0xcf, - 0xe4, 0x13, 0xfc, 0xec, 0x7a, 0x6c, 0xb0, 0x90, - 0x13, 0x9b, 0xb6, 0xc5, 0x03, 0xf6, 0x0e, 0x5e, - 0xe2, 0xe4, 0x26, 0xc1, 0x7e, 0x53, 0xfe, 0x69, - 0xa3, 0xc7, 0xd8, 0x8e, 0x6e, 0x94, 0x32, 0xa0, - 0xde, 0xca, 0xb6, 0xcc, 0xd6, 0x01, 0xd5, 0x78, - 0x40, 0x28, 0x63, 0x9b, 0xee, 0xcf, 0x09, 0x3b, - 0x35, 0x04, 0xf0, 0x14, 0x02, 0xf6, 0x80, 0x0e, - 0x90, 0xb2, 0x94, 0xd2, 0x25, 0x16, 0xb8, 0x7a, - 0x76, 0x87, 0x84, 0x9f, 0x84, 0xc5, 0xaf, 0xc2, - 0x6d, 0x68, 0x7a, 0x84, 0x9c, 0xc6, 0x8a, 0x63, - 0x60, 0x87, 0x6a, 0x25, 0xc1, 0xa1, 0x78, 0x0f, - 0xba, 0xe8, 0x5f, 0xe1, 0xba, 0xac, 0xa4, 0x6f, - 0xdd, 0x09, 0x3f, 0x12, 0xcb, 0x1d, 0xf3, 0xcf, - 0x48, 0xd7, 0xd3, 0x26, 0xe8, 0x9c, 0xc3, 0x53, - 0xb3, 0xba, 0xdc, 0x32, 0x99, 0x98, 0x96, 0xd6, - 0x16, 0x03, 0x03, 0x00, 0x46, 0x10, 0x00, 0x00, - 0x42, 0x41, 0x04, 0x1e, 0x18, 0x37, 0xef, 0x0d, - 0x19, 0x51, 0x88, 0x35, 0x75, 0x71, 0xb5, 0xe5, - 0x54, 0x5b, 0x12, 0x2e, 0x8f, 0x09, 0x67, 0xfd, - 0xa7, 0x24, 0x20, 0x3e, 0xb2, 0x56, 0x1c, 0xce, - 0x97, 0x28, 0x5e, 0xf8, 0x2b, 0x2d, 0x4f, 0x9e, - 0xf1, 0x07, 0x9f, 0x6c, 0x4b, 0x5b, 0x83, 0x56, - 0xe2, 0x32, 0x42, 0xe9, 0x58, 0xb6, 0xd7, 0x49, - 0xa6, 0xb5, 0x68, 0x1a, 0x41, 0x03, 0x56, 0x6b, - 0xdc, 0x5a, 0x89, 0x16, 0x03, 0x03, 0x01, 0x08, - 0x0f, 0x00, 0x01, 0x04, 0x04, 0x01, 0x01, 0x00, - 0x7e, 0xe4, 0x65, 0x02, 0x8e, 0xb3, 0x34, 0x6a, - 0x47, 0x71, 0xd1, 0xb0, 0x8d, 0x3c, 0x0c, 0xe1, - 0xde, 0x7e, 0x5f, 0xb4, 0x15, 0x2d, 0x32, 0x0a, - 0x2a, 0xdb, 0x9b, 0x40, 0xba, 0xce, 0x8b, 0xf5, - 0x74, 0xc1, 0x68, 0x20, 0x7c, 0x87, 0x23, 0x13, - 0xc3, 0x13, 0xa7, 0xdb, 0xec, 0x59, 0xa0, 0x40, - 0x9e, 0x64, 0x03, 0x60, 0xac, 0x76, 0xff, 0x01, - 0x34, 0x7b, 0x32, 0x26, 0xd9, 0x41, 0x31, 0x93, - 0xaa, 0x30, 0x51, 0x83, 0x85, 0x40, 0xeb, 0x4e, - 0x66, 0x39, 0x83, 0xb1, 0x30, 0x0d, 0x96, 0x01, - 0xee, 0x81, 0x53, 0x5e, 0xec, 0xa9, 0xc9, 0xdf, - 0x7e, 0xc1, 0x09, 0x47, 0x8b, 0x35, 0xdb, 0x10, - 0x15, 0xd4, 0xc7, 0x5a, 0x39, 0xe3, 0xc0, 0xf3, - 0x93, 0x38, 0x11, 0xdc, 0x71, 0xbb, 0xc7, 0x62, - 0x2b, 0x85, 0xad, 0x6b, 0x4f, 0x09, 0xb3, 0x31, - 0xa8, 0xe5, 0xd1, 0xb3, 0xa9, 0x21, 0x37, 0x50, - 0xc8, 0x7d, 0xc3, 0xd2, 0xf7, 0x00, 0xd3, 0xdb, - 0x0f, 0x82, 0xf2, 0x43, 0xcf, 0x36, 0x6c, 0x98, - 0x63, 0xd8, 0x1d, 0xb3, 0xf3, 0xde, 0x63, 0x79, - 0x64, 0xf0, 0xdb, 0x46, 0x04, 0xe1, 0x1c, 0x57, - 0x0f, 0x9e, 0x96, 0xb9, 0x93, 0x45, 0x71, 0x1c, - 0x8b, 0x65, 0x7d, 0x1e, 0xad, 0xbd, 0x03, 0x51, - 0xae, 0x44, 0xef, 0x97, 0x45, 0x0d, 0x8d, 0x41, - 0x5c, 0x80, 0x7b, 0xe6, 0xe0, 0xbc, 0xa6, 0x72, - 0x95, 0xa0, 0x97, 0xe1, 0xbb, 0xc0, 0xcc, 0xe5, - 0x1e, 0xc3, 0xbe, 0xd7, 0x42, 0x2a, 0xf3, 0x75, - 0x8a, 0x44, 0x67, 0x3c, 0xe5, 0x68, 0x78, 0xe5, - 0x40, 0x1f, 0xf0, 0x89, 0x57, 0xda, 0xee, 0x45, - 0xf4, 0x44, 0x81, 0x01, 0x77, 0xf0, 0x4a, 0x14, - 0xb1, 0x3f, 0x60, 0x2b, 0xeb, 0x42, 0x38, 0xa6, - 0xfb, 0xe5, 0x4d, 0x71, 0xdc, 0x7d, 0x0a, 0x72, - 0x56, 0x28, 0x9d, 0xa6, 0x8e, 0x74, 0x2d, 0xbd, - 0x14, 0x03, 0x03, 0x00, 0x01, 0x01, 0x16, 0x03, - 0x03, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x31, 0x4d, 0x58, 0x94, 0x0b, - 0x0b, 0x06, 0x5f, 0xae, 0x57, 0x17, 0x98, 0x86, - 0xaa, 0x49, 0x17, 0x7f, 0xbd, 0x41, 0x05, 0xa5, - 0x74, 0x1c, 0x58, 0xc8, 0x38, 0x2d, 0x99, 0x5d, - 0xe5, 0x12, 0x43, - }, - { - 0x14, 0x03, 0x03, 0x00, 0x01, 0x01, 0x16, 0x03, - 0x03, 0x00, 0x28, 0xf2, 0x60, 0xc2, 0x75, 0x27, - 0x64, 0xf4, 0x05, 0x98, 0xc9, 0xd3, 0xa8, 0x00, - 0x4c, 0xa0, 0x49, 0x82, 0x68, 0xf1, 0x21, 0x05, - 0x7b, 0x4b, 0x25, 0x3e, 0xe1, 0x5f, 0x0f, 0x84, - 0x26, 0x2d, 0x16, 0x2e, 0xc0, 0xfd, 0xdf, 0x0a, - 0xf4, 0xba, 0x19, - }, - { - 0x17, 0x03, 0x03, 0x00, 0x1e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x35, 0xef, 0x9d, - 0x6a, 0x86, 0x98, 0xc5, 0xca, 0x55, 0xca, 0x89, - 0x29, 0xb4, 0x55, 0xd4, 0x41, 0x08, 0x96, 0xe0, - 0xf3, 0x39, 0xfc, 0x15, 0x03, 0x03, 0x00, 0x1a, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x02, 0x63, 0x1b, 0xaa, 0xc6, 0xc9, 0x6d, 0x72, - 0x24, 0x10, 0x55, 0xa9, 0x8c, 0x3b, 0x23, 0xce, - 0xd8, 0x4a, - }, -} - -var testClientChainCertificate = fromHex( - "2d2d2d2d2d424547494e2050524956415445204b" + - "45592d2d2d2d2d0a4d494945766749424144414e" + - "42676b71686b6947397730424151454641415343" + - "424b67776767536b41674541416f494241514367" + - "6f2b2f4252483269343347590a4a324f7a485846" + - "51706a515679386b71772b726b6e70784a706747" + - "6266716d31657638566b6e48496c35776c74336b" + - "722f367647736163416b4c4b4c313348560a776a" + - "726d676b493369554545734c7248573470446e35" + - "633544412f56625a364e3638416d78526a6f656a" + - "30794c6a6951514673354c41664c4a4244467954" + - "766a0a5a6b64587557717452506a51634749376a" + - "75316758794c3475417a4a5153764a6747354f47" + - "2b45672f45656b724d4d2f35734b4265514d334a" + - "596e4b317156470a6b574e427854375637583950" + - "6a5162416951432b4e33742b6338707741425130" + - "766b6538736d6f6f70536d45714a3349486e646d" + - "48352b714b306662335775630a715079434e7052" + - "694456772f7367473070626a4744705262374636" + - "37656d4d6b38666e5755416a426f387951423173" + - "4542454a307a7a6636384b585a3034614a0a6952" + - "6a7a544f495241674d424141454367674542414a" + - "4b613676326b5a3144596146786e586d7369624c" + - "386734426f67514c6a42307362524a6d746b6b4d" + - "54370a685343325873537551522f446c654d7148" + - "664555786731784a717579597643544d44585972" + - "473667354a5051744d4432465a424a7239626c65" + - "467138386c706a0a543766514e793571354c2b4f" + - "682f6b62433835436e623641753641656978776d" + - "2b6e77665a4f3766726b6278306d35516b715975" + - "5739392f452b69502b454e570a76396a68773436" + - "76515065563236494b79717656462b4f7362722f" + - "6152316138707948336361566e3579594a433346" + - "5855756c6f5a77516331714a6b4c434c4c0a375a" + - "49744f525a78514c486d4d4a654d44722f5a4942" + - "34675467645650636145375a4d5141714d6d3066" + - "4c6b6d7671723149526b77642f6831455a645650" + - "79320a742f6b6b43413039566336663749556575" + - "6f67706d705a50303130564e376b6277394a6348" + - "75544561564543675945417a47395679426e6d62" + - "6858496c57764f0a71583747524f2f5231636a2b" + - "6b564e35377876674b54756b35592b7a4d774a48" + - "32626c57435945513251753974446c476854756b" + - "664273385746772b6e6263460a7a6f706d535245" + - "6c6d464d2f6141536d464733574e5a7072696a68" + - "504b77726338376470636b31703131635a415478" + - "5a413168566d43743457616343673634690a4d74" + - "64507a334e2f34416147664956794d2b69624949" + - "35332f515543675945417953693556735a356f6a" + - "644a795077426e6c6142554231686f2b336b7068" + - "70770a7264572b2b4d796b51494a345564534437" + - "3052486e5a315839754359713978616671746c51" + - "664c44395963442f436d665264706461586c5673" + - "5249467a5a556c0a454630557149644e77337046" + - "68634f4a6d6e5a3241434470434342476f763542" + - "6e3068302b3137686a4b376f69315833716e4542" + - "7857326c7462593476556a500a44394c5330666e" + - "4a76703043675942504a527330714c4a4a464333" + - "6669796b712f57574d38727474354b364a584b50" + - "734b674b53644144577a7463316645434d0a7a65" + - "2b394a6a5a376b4d77557063666a644c2b745047" + - "3455563048326c524375635735414131396d7058" + - "50367454494733713737655a6b416e65516f6163" + - "41340a716c3073583051476c6a5763414e30464b" + - "6f4759733975582b6378445a6e7265362f52392f" + - "3930567766443237454c57546373677734633463" + - "514b42675143420a6f5432326e745a5a59396d6e" + - "72455a36752f492f4a332f35664e396737783733" + - "3177746e463745745a5361575453587364597256" + - "466b564f6362505135494a6f0a714a6a7249372b" + - "474a4d69376f6a4c69642f4c45656f31764f3163" + - "454158334f43723236554e38612f6c7434394f5a" + - "69354c337348556b756c475951755671650a6737" + - "6e6e4632437749544c34503645486443575a4461" + - "7a4136626d7375524f2b6462536e335a6c567651" + - "4b42674859524c5a665458536c44755264776977" + - "746b0a513148546b6d6b57694156726c4f577864" + - "5858456d546130303045574c46446145797a7358" + - "7834424863357166776b5a4e746b634a56396e58" + - "63536e647441530a35767a427a676e797a4f7962" + - "68315878484a3966427472414f3847555878446c" + - "6634394457616753393449763072596e616b7656" + - "2f673039786875415763366e0a5365757230576b" + - "5376453847666653734d485149584c456b0a2d2d" + - "2d2d2d454e442050524956415445204b45592d2d" + - "2d2d2d0a2d2d2d2d2d424547494e204345525449" + - "4649434154452d2d2d2d2d0a4d494944656a4343" + - "416d494343514330523168584b326649776a414e" + - "42676b71686b6947397730424151554641444342" + - "6744454c4d416b474131554542684d430a56564d" + - "78437a414a42674e564241674d416b355a4d5245" + - "77447759445651514844416843636d3976613278" + - "35626a45564d424d47413155454367774d54586b" + - "670a51304567513278705a5735304d5263774651" + - "5944565151444441357465574e68593278705a57" + - "35304c6d4e76625445684d423847435371475349" + - "62334451454a0a41525953616e5a7a6147466f61" + - "5752415a32316861577775593239744d42345844" + - "54457a4d4455794e6a49784e4451774d466f5844" + - "54457a4d4459794e5449780a4e4451774d466f77" + - "6654454c4d416b474131554542684d4356564d78" + - "4554415042674e564241674d4345356c6479425a" + - "62334a724d52457744775944565151480a444168" + - "43636d397661327835626a45514d413447413155" + - "454367774854586b67544756685a6a45544d4245" + - "47413155454177774b62586c735a57466d4c6d4e" + - "760a625445684d42384743537147534962334451" + - "454a41525953616e5a7a6147466f615752415a32" + - "316861577775593239744d494942496a414e4267" + - "6b71686b69470a397730424151454641414f4341" + - "5138414d49494243674b43415145416f4b507677" + - "5552396f754e786d43646a73783178554b593046" + - "63764a4b735071354a36630a536159426d333670" + - "7458722f465a4a78794a65634a6264354b2f2b72" + - "7872476e414a43796939647831634936356f4a43" + - "4e346c42424c43367831754b51352b580a4f5177" + - "50315732656a6576414a73555936486f394d6934" + - "346b4542624f5377487979515178636b3734325a" + - "4856376c7172555434304842694f343774594638" + - "690a2b4c674d7955457279594275546876684950" + - "7848704b7a44502b624367586b444e79574a7974" + - "616c5270466a5163552b3165312f543430477749" + - "6b41766a64370a666e504b634141554e4c354876" + - "4c4a714b4b5570684b6964794235335a682b6671" + - "697448323931726e4b6a38676a61555967316350" + - "374942744b5734786736550a572b78657533706a" + - "4a504835316c41497761504d6b41646242415243" + - "644d38332b76436c32644f4769596b5938307a69" + - "45514944415141424d413047435371470a534962" + - "3344514542425155414134494241514351752f6c" + - "65756863667243476661307047304730386a7a33" + - "34586a357972364161382f2b4a72467436347045" + - "710a493458475455646e4151696f425230425946" + - "42665761332b6538594d564a426f634763753759" + - "6634615971734d7635766b426b715a4932435a67" + - "5644694f37790a4d4f326b6a372f575679445551" + - "7831536c6d2b75435a5942556a6a6a72356e5833" + - "42535a7849734f42412b7a46425455705a506879" + - "597142373250384e6e63460a427641714241712b" + - "4c73364250534f6832746a72787570657a796732" + - "55544756586b414537617a4279465a70682b7737" + - "417a36644430784d363965364a742f6a0a336844" + - "756b324b4e63314a752f7a63326d487374566b79" + - "364362696e384473576763726251367673544735" + - "3877517369496b4d6474677a4275632f6b552b34" + - "640a506f696e4537352f766135797a38316a3073" + - "4d59574a4b697262554a6e5a454433547a69484e" + - "35340a2d2d2d2d2d454e44204345525449464943" + - "4154452d2d2d2d2d0a2d2d2d2d2d424547494e20" + - "43455254494649434154452d2d2d2d2d0a4d4949" + - "4468444343416d7743435143723761626b536973" + - "722b44414e42676b71686b694739773042415155" + - "4641444342686a454c4d416b474131554542684d" + - "430a56564d78437a414a42674e564241674d416b" + - "355a4d524577447759445651514844416843636d" + - "397661327835626a45684d423847413155454367" + - "775954586b670a5132567964476c6d61574e6864" + - "4755675158563061473979615852354d52457744" + - "775944565151444441687465574e684c6d39795a" + - "7a45684d423847435371470a534962334451454a" + - "41525953616e5a7a6147466f615752415a323168" + - "61577775593239744d4234584454457a4d445579" + - "4e6a49784d5467304d466f584454457a0a4d4459" + - "794e5449784d5467304d466f7767594178437a41" + - "4a42674e5642415954416c56544d517377435159" + - "445651514944414a4f575445524d413847413155" + - "450a42777749516e4a7662327473655734784654" + - "415442674e5642416f4d4445313549454e424945" + - "4e7361575675644445584d425547413155454177" + - "774f62586c6a0a59574e73615756756443356a62" + - "3230784954416642676b71686b69473977304243" + - "514557456d70326332686861476c6b5147647459" + - "576c734c6d4e76625443430a415349774451594a" + - "4b6f5a496876634e415145424251414467674550" + - "4144434341516f4367674542414d345438484b77" + - "596367594e34704250534368484d752f0a396a74" + - "304a697157456578546f63783964315a46447a61" + - "33386b6953476d4c4d747343684c30517277596e" + - "4c6268376256354c566c32434d51537a5a495037" + - "700a4834373866774a454479694231677a4e7650" + - "4258624d796e75676167707048613730614b5941" + - "3953624a42736a455376734a3251756946596f44" + - "7a75564c55700a4a68384b724f3949614450514d" + - "39434c477578754c37564b553849613076465142" + - "566c6332646f44436b6533336663366166564f36" + - "6b7243796c5377693362680a416931535a376e64" + - "554d6b37427951696167416457494f6f374a5878" + - "32754a7a6f4b4679594a364755387446714d4b67" + - "554b425431767759684c564b4a7443690a717444" + - "2f747634366e4c555a4f7a2f685341326b43552b" + - "447963444a7067745948787837724b4a43764748" + - "3049596f41326853675941502b6b784a73567330" + - "430a417745414154414e42676b71686b69473977" + - "30424151554641414f43415145414a536b374873" + - "4e594d75596a794f3459384231696254745a6d54" + - "722b535849480a5031695432384376734c4e6330" + - "567959794f704b3546687a445666464533786365" + - "5762614242336c6d4e6f3152305377306e706d6e" + - "63314270592b68456249610a6838444e56653230" + - "657a4e79362f666a6534734368756b724a6a4b66" + - "6d66484c6b36753546724f617369495449523962" + - "7a4b4a5a75326e79754165417a677a330a6d4579" + - "4677705a7149675870766b6977416c74704b4269" + - "496c755058786e7254365a6e2f6e634e68545a71" + - "573873597a54655664576d686b576f49315a5358" + - "6a0a6a46757739705a57764c2b58646b746d5249" + - "476b784b637878614650364b544b495055425735" + - "6c5057765477654c397853645878776149592f58" + - "4a62467569530a787a6449722b346b2f44554c77" + - "7430467832366a4b62737066644d726c49444451" + - "464d4f413151396534764f2b6151444a32507355" + - "513d3d0a2d2d2d2d2d454e442043455254494649" + - "434154452d2d2d2d2d0a2d2d2d2d2d424547494e" + - "2043455254494649434154452d2d2d2d2d0a4d49" + - "49443454434341736d67417749424167494a414d" + - "7769544575596f6f6a384d413047435371475349" + - "623344514542425155414d4947474d5173774351" + - "59440a5651514745774a56557a454c4d416b4741" + - "31554543417743546c6b784554415042674e5642" + - "41634d43454a796232397262486c754d53457748" + - "7759445651514b0a4442684e655342445a584a30" + - "61575a70593246305a5342426458526f62334a70" + - "64486b784554415042674e5642414d4d43473135" + - "5932457562334a6e4d5345770a4877594a4b6f5a" + - "496876634e41516b4246684a71646e4e6f595768" + - "705a45426e625746706243356a62323077486863" + - "4e4d544d774e5449324d6a45774e5441780a5768" + - "634e4d6a4d774e5449304d6a45774e544178576a" + - "4342686a454c4d416b474131554542684d435656" + - "4d78437a414a42674e564241674d416b355a4d52" + - "45770a447759445651514844416843636d397661" + - "327835626a45684d423847413155454367775954" + - "586b675132567964476c6d61574e686447556751" + - "585630614739790a615852354d52457744775944" + - "565151444441687465574e684c6d39795a7a4568" + - "4d42384743537147534962334451454a41525953" + - "616e5a7a6147466f615752410a5a323168615777" + - "75593239744d494942496a414e42676b71686b69" + - "47397730424151454641414f43415138414d4949" + - "4243674b434151454138507574674634330a3032" + - "33754c737938444e645753315a467a5369324975" + - "6e69443947484b69664f6434317544672f375a75" + - "4731447071324259367a34635633686c74473067" + - "75530a4178754a4442735144706d503468666f77" + - "6a4141523962382b5138376454534e5462435a74" + - "3642746f4c6174326764654f4334433544427472" + - "684e79314d6a4f0a46416575493479506e6f7867" + - "31676135377741597742306c48746f2b4c383872" + - "566f53654d4348484b665944696954354e4b786c" + - "6e59413279447356454c31520a3662774334656d" + - "7a5770715a5152736e6f4531516e69642f6f5830" + - "4a6837324b796c2b7870516934424e5253696172" + - "67665549754c7858755a6c635045786c460a7145" + - "74646757624d456a65555876303845494652502f" + - "6f503361474a41366c346b665537383779737670" + - "4d774c72374b663062544b4c524f6b5874625132" + - "79760a6d31787162567262655635716177494441" + - "5141426f314177546a416442674e564851344546" + - "67515561783441714a2f3666514435344a30506b" + - "497951714b45330a61396f77487759445652306a" + - "42426777466f415561783441714a2f3666514435" + - "344a30506b497951714b453361396f7744415944" + - "5652305442415577417745420a2f7a414e42676b" + - "71686b6947397730424151554641414f43415145" + - "417a57397a5456594c387934633467494d464c73" + - "76335478442f742b554c616d4a675648340a5836" + - "65674536724d73426a69567a344e4b5a506f6c64" + - "556255394a52387233316e6e73695a574a637845" + - "7764364f6e443143766e654d7351382f34476739" + - "77360a486d495177455a33787032667135596c58" + - "50736d775255667054507554356f55616853586b" + - "7975564339796f31326b753841454f2f55375132" + - "616a6c5a6437370a79736f63582f6c546f49666e" + - "4d3573767a2b51542f4f7836624c435145357532" + - "78515032446c376935436242666c502b61615048" + - "324935756c444b67337371320a7a4e5942315868" + - "414b474f623773384a4f7a554538425143396f41" + - "4f6b4c4b55306955577548703268345366684d57" + - "76776d316f656f5363786f706a594964710a4a63" + - "476865412b3636462f687571796b6239304a5078" + - "4c4c48665050534e66544a75696377314f7a7574" + - "77796d5a695731673d3d0a2d2d2d2d2d454e4420" + - "43455254494649434154452d2d2d2d2d0a", -) - -// Script of interaction with openssl implementation: -// -// openssl s_server -cipher ECDHE-ECDSA-AES128-SHA \ -// -key server.key -cert server.crt -port 10443 -// -// The values for this test are obtained by building and running in client mode: -// % go test -test.run "TestRunClient" -connect -ciphersuites=0xc009 -// The recorded bytes are written to stdout. -// -// The server private key is: -// -// -----BEGIN EC PARAMETERS----- -// BgUrgQQAIw== -// -----END EC PARAMETERS----- -// -----BEGIN EC PRIVATE KEY----- -// MIHcAgEBBEIBmIPpCa0Kyeo9M/nq5mHxeFIGlw+MqakWcvHu3Keo7xK9ZWG7JG3a -// XfS01efjqSZJvF2DoL+Sly4A5iBn0Me9mdegBwYFK4EEACOhgYkDgYYABADEoe2+ -// mPkLSHM2fsMWVhEi8j1TwztNIT3Na3Xm9rDcmt8mwbyyh/ByMnyzZC8ckLzqaCMQ -// fv7jJcBIOmngKG3TNwDvBGLdDaCccGKD2IHTZDGqnpcxvZawaMCbI952ZD8aXH/p -// Eg5YWLZfcN2b2OrV1/XVzLm2nzBmW2aaIOIn5b/+Ow== -// -----END EC PRIVATE KEY----- -// -// and certificate is: -// -// -----BEGIN CERTIFICATE----- -// MIICADCCAWICCQC4vy1HoNLr9DAJBgcqhkjOPQQBMEUxCzAJBgNVBAYTAkFVMRMw -// EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 -// eSBMdGQwHhcNMTIxMTIyMTUwNjMyWhcNMjIxMTIwMTUwNjMyWjBFMQswCQYDVQQG -// EwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lk -// Z2l0cyBQdHkgTHRkMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQAxKHtvpj5C0hz -// Nn7DFlYRIvI9U8M7TSE9zWt15vaw3JrfJsG8sofwcjJ8s2QvHJC86mgjEH7+4yXA -// SDpp4Cht0zcA7wRi3Q2gnHBig9iB02Qxqp6XMb2WsGjAmyPedmQ/Glx/6RIOWFi2 -// X3Ddm9jq1df11cy5tp8wZltmmiDiJ+W//jswCQYHKoZIzj0EAQOBjAAwgYgCQgGI -// ok/r4kXFSH0brPXtmJ2uR3DAXhu2L73xtk23YUDTEaLO7gt+kn7/dp3DO36lP876 -// EOJZ7EctfKzaTpcOFaBv0AJCAU38vmcTnC0FDr0/o4wlwTMTgw2UBrvUN3r27HrJ -// hi7d1xFpf4V8Vt77MXgr5Md4Da7Lvp5ONiQxe2oPOZUSB48q -// -----END CERTIFICATE----- -var ecdheECDSAAESClientScript = [][]byte{ - { - 0x16, 0x03, 0x01, 0x00, 0x4a, 0x01, 0x00, 0x00, - 0x46, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xc0, 0x09, - 0x01, 0x00, 0x00, 0x1b, 0x00, 0x05, 0x00, 0x05, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, - 0x08, 0x00, 0x06, 0x00, 0x17, 0x00, 0x18, 0x00, - 0x19, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x54, 0x02, 0x00, 0x00, - 0x50, 0x03, 0x01, 0x50, 0xd7, 0x19, 0xc9, 0x03, - 0xc2, 0x3a, 0xc6, 0x1f, 0x0a, 0x84, 0x9e, 0xd7, - 0xf4, 0x7e, 0x07, 0x6d, 0xa8, 0xe4, 0xa9, 0x4f, - 0x22, 0x50, 0xa2, 0x19, 0x24, 0x44, 0x42, 0x65, - 0xaa, 0xba, 0x3a, 0x20, 0x90, 0x70, 0xb7, 0xe5, - 0x57, 0xed, 0xb1, 0xb1, 0x43, 0x4b, 0xa1, 0x4e, - 0xee, 0x7a, 0x5b, 0x88, 0xf6, 0xa6, 0x73, 0x3b, - 0xcb, 0xa7, 0xbd, 0x57, 0x50, 0xf2, 0x72, 0x8c, - 0xbc, 0x45, 0x73, 0xaa, 0xc0, 0x09, 0x00, 0x00, - 0x08, 0x00, 0x0b, 0x00, 0x04, 0x03, 0x00, 0x01, - 0x02, 0x16, 0x03, 0x01, 0x02, 0x0e, 0x0b, 0x00, - 0x02, 0x0a, 0x00, 0x02, 0x07, 0x00, 0x02, 0x04, - 0x30, 0x82, 0x02, 0x00, 0x30, 0x82, 0x01, 0x62, - 0x02, 0x09, 0x00, 0xb8, 0xbf, 0x2d, 0x47, 0xa0, - 0xd2, 0xeb, 0xf4, 0x30, 0x09, 0x06, 0x07, 0x2a, - 0x86, 0x48, 0xce, 0x3d, 0x04, 0x01, 0x30, 0x45, - 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, - 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, - 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, - 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, - 0x55, 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, - 0x64, 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, - 0x79, 0x20, 0x4c, 0x74, 0x64, 0x30, 0x1e, 0x17, - 0x0d, 0x31, 0x32, 0x31, 0x31, 0x32, 0x32, 0x31, - 0x35, 0x30, 0x36, 0x33, 0x32, 0x5a, 0x17, 0x0d, - 0x32, 0x32, 0x31, 0x31, 0x32, 0x30, 0x31, 0x35, - 0x30, 0x36, 0x33, 0x32, 0x5a, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x30, 0x81, 0x9b, 0x30, - 0x10, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, - 0x02, 0x01, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, - 0x23, 0x03, 0x81, 0x86, 0x00, 0x04, 0x00, 0xc4, - 0xa1, 0xed, 0xbe, 0x98, 0xf9, 0x0b, 0x48, 0x73, - 0x36, 0x7e, 0xc3, 0x16, 0x56, 0x11, 0x22, 0xf2, - 0x3d, 0x53, 0xc3, 0x3b, 0x4d, 0x21, 0x3d, 0xcd, - 0x6b, 0x75, 0xe6, 0xf6, 0xb0, 0xdc, 0x9a, 0xdf, - 0x26, 0xc1, 0xbc, 0xb2, 0x87, 0xf0, 0x72, 0x32, - 0x7c, 0xb3, 0x64, 0x2f, 0x1c, 0x90, 0xbc, 0xea, - 0x68, 0x23, 0x10, 0x7e, 0xfe, 0xe3, 0x25, 0xc0, - 0x48, 0x3a, 0x69, 0xe0, 0x28, 0x6d, 0xd3, 0x37, - 0x00, 0xef, 0x04, 0x62, 0xdd, 0x0d, 0xa0, 0x9c, - 0x70, 0x62, 0x83, 0xd8, 0x81, 0xd3, 0x64, 0x31, - 0xaa, 0x9e, 0x97, 0x31, 0xbd, 0x96, 0xb0, 0x68, - 0xc0, 0x9b, 0x23, 0xde, 0x76, 0x64, 0x3f, 0x1a, - 0x5c, 0x7f, 0xe9, 0x12, 0x0e, 0x58, 0x58, 0xb6, - 0x5f, 0x70, 0xdd, 0x9b, 0xd8, 0xea, 0xd5, 0xd7, - 0xf5, 0xd5, 0xcc, 0xb9, 0xb6, 0x9f, 0x30, 0x66, - 0x5b, 0x66, 0x9a, 0x20, 0xe2, 0x27, 0xe5, 0xbf, - 0xfe, 0x3b, 0x30, 0x09, 0x06, 0x07, 0x2a, 0x86, - 0x48, 0xce, 0x3d, 0x04, 0x01, 0x03, 0x81, 0x8c, - 0x00, 0x30, 0x81, 0x88, 0x02, 0x42, 0x01, 0x88, - 0xa2, 0x4f, 0xeb, 0xe2, 0x45, 0xc5, 0x48, 0x7d, - 0x1b, 0xac, 0xf5, 0xed, 0x98, 0x9d, 0xae, 0x47, - 0x70, 0xc0, 0x5e, 0x1b, 0xb6, 0x2f, 0xbd, 0xf1, - 0xb6, 0x4d, 0xb7, 0x61, 0x40, 0xd3, 0x11, 0xa2, - 0xce, 0xee, 0x0b, 0x7e, 0x92, 0x7e, 0xff, 0x76, - 0x9d, 0xc3, 0x3b, 0x7e, 0xa5, 0x3f, 0xce, 0xfa, - 0x10, 0xe2, 0x59, 0xec, 0x47, 0x2d, 0x7c, 0xac, - 0xda, 0x4e, 0x97, 0x0e, 0x15, 0xa0, 0x6f, 0xd0, - 0x02, 0x42, 0x01, 0x4d, 0xfc, 0xbe, 0x67, 0x13, - 0x9c, 0x2d, 0x05, 0x0e, 0xbd, 0x3f, 0xa3, 0x8c, - 0x25, 0xc1, 0x33, 0x13, 0x83, 0x0d, 0x94, 0x06, - 0xbb, 0xd4, 0x37, 0x7a, 0xf6, 0xec, 0x7a, 0xc9, - 0x86, 0x2e, 0xdd, 0xd7, 0x11, 0x69, 0x7f, 0x85, - 0x7c, 0x56, 0xde, 0xfb, 0x31, 0x78, 0x2b, 0xe4, - 0xc7, 0x78, 0x0d, 0xae, 0xcb, 0xbe, 0x9e, 0x4e, - 0x36, 0x24, 0x31, 0x7b, 0x6a, 0x0f, 0x39, 0x95, - 0x12, 0x07, 0x8f, 0x2a, 0x16, 0x03, 0x01, 0x00, - 0xd6, 0x0c, 0x00, 0x00, 0xd2, 0x03, 0x00, 0x17, - 0x41, 0x04, 0x33, 0xed, 0xe1, 0x10, 0x3d, 0xe2, - 0xb0, 0x81, 0x5e, 0x01, 0x1b, 0x00, 0x4a, 0x7d, - 0xdc, 0xc5, 0x78, 0x02, 0xb1, 0x9a, 0x78, 0x92, - 0x34, 0xd9, 0x23, 0xcc, 0x01, 0xfb, 0x0c, 0x49, - 0x1c, 0x4a, 0x59, 0x8a, 0x80, 0x1b, 0x34, 0xf0, - 0xe8, 0x87, 0x1b, 0x7c, 0xfb, 0x72, 0xf5, 0xea, - 0xf9, 0xf3, 0xff, 0xa6, 0x3e, 0x4e, 0xac, 0xbc, - 0xee, 0x14, 0x2b, 0x87, 0xd4, 0x0b, 0xda, 0x19, - 0x60, 0x2b, 0x00, 0x8b, 0x30, 0x81, 0x88, 0x02, - 0x42, 0x01, 0x75, 0x46, 0x4f, 0x97, 0x9f, 0xc5, - 0xf9, 0x4c, 0x38, 0xcf, 0x3b, 0x37, 0x1a, 0x6b, - 0x53, 0xfc, 0x05, 0x73, 0x7d, 0x98, 0x2c, 0x5b, - 0x76, 0xd4, 0x37, 0x1f, 0x50, 0x6d, 0xad, 0xc6, - 0x0f, 0x8f, 0x7b, 0xcc, 0x60, 0x8e, 0x04, 0x00, - 0x21, 0x80, 0xa8, 0xa5, 0x98, 0xf2, 0x42, 0xf2, - 0xc3, 0xf6, 0x44, 0x50, 0xc4, 0x7a, 0xae, 0x6f, - 0x74, 0xa0, 0x7f, 0x07, 0x7a, 0x0b, 0xbb, 0x41, - 0x9e, 0x3c, 0x0b, 0x02, 0x42, 0x01, 0xbe, 0x64, - 0xaa, 0x12, 0x03, 0xfb, 0xd8, 0x4f, 0x93, 0xf9, - 0x92, 0x54, 0x0d, 0x9c, 0x9d, 0x53, 0x88, 0x19, - 0x69, 0x94, 0xfc, 0xd6, 0xf7, 0x60, 0xcf, 0x70, - 0x64, 0x15, 0x1b, 0x02, 0x22, 0x56, 0xb0, 0x2c, - 0xb1, 0x72, 0x4c, 0x9e, 0x7b, 0xf0, 0x53, 0x97, - 0x43, 0xac, 0x11, 0x62, 0xe5, 0x5a, 0xf1, 0x7e, - 0x87, 0x8f, 0x5c, 0x43, 0x1d, 0xae, 0x56, 0x28, - 0xdb, 0x76, 0x15, 0xd8, 0x1c, 0x73, 0xce, 0x16, - 0x03, 0x01, 0x00, 0x04, 0x0e, 0x00, 0x00, 0x00, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x46, 0x10, 0x00, 0x00, - 0x42, 0x41, 0x04, 0x1e, 0x18, 0x37, 0xef, 0x0d, - 0x19, 0x51, 0x88, 0x35, 0x75, 0x71, 0xb5, 0xe5, - 0x54, 0x5b, 0x12, 0x2e, 0x8f, 0x09, 0x67, 0xfd, - 0xa7, 0x24, 0x20, 0x3e, 0xb2, 0x56, 0x1c, 0xce, - 0x97, 0x28, 0x5e, 0xf8, 0x2b, 0x2d, 0x4f, 0x9e, - 0xf1, 0x07, 0x9f, 0x6c, 0x4b, 0x5b, 0x83, 0x56, - 0xe2, 0x32, 0x42, 0xe9, 0x58, 0xb6, 0xd7, 0x49, - 0xa6, 0xb5, 0x68, 0x1a, 0x41, 0x03, 0x56, 0x6b, - 0xdc, 0x5a, 0x89, 0x14, 0x03, 0x01, 0x00, 0x01, - 0x01, 0x16, 0x03, 0x01, 0x00, 0x30, 0x1a, 0x45, - 0x92, 0x3b, 0xac, 0x8d, 0x91, 0x89, 0xd3, 0x2c, - 0xf4, 0x3c, 0x5f, 0x70, 0xf1, 0x79, 0xa5, 0x6a, - 0xcf, 0x97, 0x8f, 0x3f, 0x73, 0x08, 0xca, 0x3f, - 0x55, 0xb0, 0x28, 0xd1, 0x6f, 0xcd, 0x9b, 0xca, - 0xb6, 0xb7, 0xd0, 0xa5, 0x21, 0x5b, 0x08, 0xf8, - 0x42, 0xe2, 0xdf, 0x25, 0x6a, 0x16, - }, - { - 0x14, 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, - 0x01, 0x00, 0x30, 0x30, 0x83, 0xb6, 0x51, 0x8a, - 0x85, 0x4a, 0xee, 0xe4, 0xb6, 0xae, 0xf3, 0xc1, - 0xdc, 0xd2, 0x04, 0xb3, 0xd0, 0x25, 0x47, 0x5f, - 0xac, 0x83, 0xa3, 0x7d, 0xcf, 0x47, 0x92, 0xed, - 0x92, 0x6c, 0xd1, 0x6e, 0xfd, 0x63, 0xf5, 0x2d, - 0x89, 0xd8, 0x04, 0x8c, 0x62, 0x71, 0xae, 0x5e, - 0x32, 0x48, 0xf8, - }, - { - 0x17, 0x03, 0x01, 0x00, 0x20, 0xcf, 0x5e, 0xba, - 0xf4, 0x47, 0x32, 0x35, 0x9b, 0x85, 0xdc, 0xb3, - 0xff, 0x77, 0x90, 0xd9, 0x2b, 0xbd, 0x59, 0x2a, - 0x33, 0xe4, 0x6e, 0x9b, 0xfc, 0x1c, 0x73, 0x3f, - 0x5e, 0x1e, 0xe3, 0xa4, 0xc2, 0x17, 0x03, 0x01, - 0x00, 0x20, 0x05, 0xdf, 0x2d, 0x9b, 0x29, 0x7f, - 0x97, 0xcd, 0x49, 0x04, 0x53, 0x22, 0x1a, 0xa1, - 0xa1, 0xe6, 0x38, 0x3a, 0x56, 0x37, 0x1f, 0xd8, - 0x3a, 0x12, 0x2c, 0xf0, 0xeb, 0x61, 0x35, 0x76, - 0xe5, 0xf0, 0x15, 0x03, 0x01, 0x00, 0x20, 0xa5, - 0x56, 0xb5, 0x49, 0x4b, 0xc2, 0xd4, 0x4c, 0xf6, - 0x95, 0x15, 0x7d, 0x41, 0x1d, 0x5c, 0x00, 0x0e, - 0x20, 0xb1, 0x0a, 0xbc, 0xc9, 0x2a, 0x09, 0x17, - 0xb4, 0xaa, 0x1c, 0x79, 0xda, 0x79, 0x27, - }, -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/tls/handshake_messages_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/tls/handshake_messages_test.go deleted file mode 100644 index 4f569eeb13..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/tls/handshake_messages_test.go +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "math/rand" - "reflect" - "testing" - "testing/quick" -) - -var tests = []interface{}{ - &clientHelloMsg{}, - &serverHelloMsg{}, - &finishedMsg{}, - - &certificateMsg{}, - &certificateRequestMsg{}, - &certificateVerifyMsg{}, - &certificateStatusMsg{}, - &clientKeyExchangeMsg{}, - &nextProtoMsg{}, - &newSessionTicketMsg{}, - &sessionState{}, -} - -type testMessage interface { - marshal() []byte - unmarshal([]byte) bool - equal(interface{}) bool -} - -func TestMarshalUnmarshal(t *testing.T) { - rand := rand.New(rand.NewSource(0)) - - for i, iface := range tests { - ty := reflect.ValueOf(iface).Type() - - n := 100 - if testing.Short() { - n = 5 - } - for j := 0; j < n; j++ { - v, ok := quick.Value(ty, rand) - if !ok { - t.Errorf("#%d: failed to create value", i) - break - } - - m1 := v.Interface().(testMessage) - marshaled := m1.marshal() - m2 := iface.(testMessage) - if !m2.unmarshal(marshaled) { - t.Errorf("#%d failed to unmarshal %#v %x", i, m1, marshaled) - break - } - m2.marshal() // to fill any marshal cache in the message - - if !m1.equal(m2) { - t.Errorf("#%d got:%#v want:%#v %x", i, m2, m1, marshaled) - break - } - - if i >= 3 { - // The first three message types (ClientHello, - // ServerHello and Finished) are allowed to - // have parsable prefixes because the extension - // data is optional and the length of the - // Finished varies across versions. - for j := 0; j < len(marshaled); j++ { - if m2.unmarshal(marshaled[0:j]) { - t.Errorf("#%d unmarshaled a prefix of length %d of %#v", i, j, m1) - break - } - } - } - } - } -} - -func TestFuzz(t *testing.T) { - rand := rand.New(rand.NewSource(0)) - for _, iface := range tests { - m := iface.(testMessage) - - for j := 0; j < 1000; j++ { - len := rand.Intn(100) - bytes := randomBytes(len, rand) - // This just looks for crashes due to bounds errors etc. - m.unmarshal(bytes) - } - } -} - -func randomBytes(n int, rand *rand.Rand) []byte { - r := make([]byte, n) - for i := 0; i < n; i++ { - r[i] = byte(rand.Int31()) - } - return r -} - -func randomString(n int, rand *rand.Rand) string { - b := randomBytes(n, rand) - return string(b) -} - -func (*clientHelloMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &clientHelloMsg{} - m.vers = uint16(rand.Intn(65536)) - m.random = randomBytes(32, rand) - m.sessionId = randomBytes(rand.Intn(32), rand) - m.cipherSuites = make([]uint16, rand.Intn(63)+1) - for i := 0; i < len(m.cipherSuites); i++ { - m.cipherSuites[i] = uint16(rand.Int31()) - } - m.compressionMethods = randomBytes(rand.Intn(63)+1, rand) - if rand.Intn(10) > 5 { - m.nextProtoNeg = true - } - if rand.Intn(10) > 5 { - m.serverName = randomString(rand.Intn(255), rand) - } - m.ocspStapling = rand.Intn(10) > 5 - m.supportedPoints = randomBytes(rand.Intn(5)+1, rand) - m.supportedCurves = make([]uint16, rand.Intn(5)+1) - for i := range m.supportedCurves { - m.supportedCurves[i] = uint16(rand.Intn(30000)) - } - if rand.Intn(10) > 5 { - m.ticketSupported = true - if rand.Intn(10) > 5 { - m.sessionTicket = randomBytes(rand.Intn(300), rand) - } - } - if rand.Intn(10) > 5 { - m.signatureAndHashes = supportedSKXSignatureAlgorithms - } - - return reflect.ValueOf(m) -} - -func (*serverHelloMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &serverHelloMsg{} - m.vers = uint16(rand.Intn(65536)) - m.random = randomBytes(32, rand) - m.sessionId = randomBytes(rand.Intn(32), rand) - m.cipherSuite = uint16(rand.Int31()) - m.compressionMethod = uint8(rand.Intn(256)) - - if rand.Intn(10) > 5 { - m.nextProtoNeg = true - - n := rand.Intn(10) - m.nextProtos = make([]string, n) - for i := 0; i < n; i++ { - m.nextProtos[i] = randomString(20, rand) - } - } - - if rand.Intn(10) > 5 { - m.ocspStapling = true - } - if rand.Intn(10) > 5 { - m.ticketSupported = true - } - - return reflect.ValueOf(m) -} - -func (*certificateMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &certificateMsg{} - numCerts := rand.Intn(20) - m.certificates = make([][]byte, numCerts) - for i := 0; i < numCerts; i++ { - m.certificates[i] = randomBytes(rand.Intn(10)+1, rand) - } - return reflect.ValueOf(m) -} - -func (*certificateRequestMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &certificateRequestMsg{} - m.certificateTypes = randomBytes(rand.Intn(5)+1, rand) - numCAs := rand.Intn(100) - m.certificateAuthorities = make([][]byte, numCAs) - for i := 0; i < numCAs; i++ { - m.certificateAuthorities[i] = randomBytes(rand.Intn(15)+1, rand) - } - return reflect.ValueOf(m) -} - -func (*certificateVerifyMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &certificateVerifyMsg{} - m.signature = randomBytes(rand.Intn(15)+1, rand) - return reflect.ValueOf(m) -} - -func (*certificateStatusMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &certificateStatusMsg{} - if rand.Intn(10) > 5 { - m.statusType = statusTypeOCSP - m.response = randomBytes(rand.Intn(10)+1, rand) - } else { - m.statusType = 42 - } - return reflect.ValueOf(m) -} - -func (*clientKeyExchangeMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &clientKeyExchangeMsg{} - m.ciphertext = randomBytes(rand.Intn(1000)+1, rand) - return reflect.ValueOf(m) -} - -func (*finishedMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &finishedMsg{} - m.verifyData = randomBytes(12, rand) - return reflect.ValueOf(m) -} - -func (*nextProtoMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &nextProtoMsg{} - m.proto = randomString(rand.Intn(255), rand) - return reflect.ValueOf(m) -} - -func (*newSessionTicketMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &newSessionTicketMsg{} - m.ticket = randomBytes(rand.Intn(4), rand) - return reflect.ValueOf(m) -} - -func (*sessionState) Generate(rand *rand.Rand, size int) reflect.Value { - s := &sessionState{} - s.vers = uint16(rand.Intn(10000)) - s.cipherSuite = uint16(rand.Intn(10000)) - s.masterSecret = randomBytes(rand.Intn(100), rand) - numCerts := rand.Intn(20) - s.certificates = make([][]byte, numCerts) - for i := 0; i < numCerts; i++ { - s.certificates[i] = randomBytes(rand.Intn(10)+1, rand) - } - return reflect.ValueOf(s) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/tls/handshake_server_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/tls/handshake_server_test.go deleted file mode 100644 index c08eba7f17..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/tls/handshake_server_test.go +++ /dev/null @@ -1,3796 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "bytes" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rsa" - "crypto/x509" - "encoding/hex" - "encoding/pem" - "flag" - "fmt" - "io" - "log" - "math/big" - "net" - "os" - "strconv" - "strings" - "sync" - "testing" - "time" -) - -type zeroSource struct{} - -func (zeroSource) Read(b []byte) (n int, err error) { - for i := range b { - b[i] = 0 - } - - return len(b), nil -} - -var testConfig *Config - -func init() { - testConfig = new(Config) - testConfig.Time = func() time.Time { return time.Unix(0, 0) } - testConfig.Rand = zeroSource{} - testConfig.Certificates = make([]Certificate, 2) - testConfig.Certificates[0].Certificate = [][]byte{testRSACertificate} - testConfig.Certificates[0].PrivateKey = testRSAPrivateKey - testConfig.Certificates[1].Certificate = [][]byte{testSNICertificate} - testConfig.Certificates[1].PrivateKey = testRSAPrivateKey - testConfig.BuildNameToCertificate() - testConfig.CipherSuites = []uint16{TLS_RSA_WITH_RC4_128_SHA} - testConfig.InsecureSkipVerify = true - testConfig.MinVersion = VersionSSL30 - testConfig.MaxVersion = VersionTLS10 -} - -func testClientHelloFailure(t *testing.T, m handshakeMessage, expected error) { - // Create in-memory network connection, - // send message to server. Should return - // expected error. - c, s := net.Pipe() - go func() { - cli := Client(c, testConfig) - if ch, ok := m.(*clientHelloMsg); ok { - cli.vers = ch.vers - } - cli.writeRecord(recordTypeHandshake, m.marshal()) - c.Close() - }() - err := Server(s, testConfig).Handshake() - s.Close() - if e, ok := err.(*net.OpError); !ok || e.Err != expected { - t.Errorf("Got error: %s; expected: %s", err, expected) - } -} - -func TestSimpleError(t *testing.T) { - testClientHelloFailure(t, &serverHelloDoneMsg{}, alertUnexpectedMessage) -} - -var badProtocolVersions = []uint16{0x0000, 0x0005, 0x0100, 0x0105, 0x0200, 0x0205} - -func TestRejectBadProtocolVersion(t *testing.T) { - for _, v := range badProtocolVersions { - testClientHelloFailure(t, &clientHelloMsg{vers: v}, alertProtocolVersion) - } -} - -func TestNoSuiteOverlap(t *testing.T) { - clientHello := &clientHelloMsg{ - vers: 0x0301, - cipherSuites: []uint16{0xff00}, - compressionMethods: []uint8{0}, - } - testClientHelloFailure(t, clientHello, alertHandshakeFailure) -} - -func TestNoCompressionOverlap(t *testing.T) { - clientHello := &clientHelloMsg{ - vers: 0x0301, - cipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA}, - compressionMethods: []uint8{0xff}, - } - testClientHelloFailure(t, clientHello, alertHandshakeFailure) -} - -func TestTLS12OnlyCipherSuites(t *testing.T) { - // Test that a Server doesn't select a TLS 1.2-only cipher suite when - // the client negotiates TLS 1.1. - var zeros [32]byte - - clientHello := &clientHelloMsg{ - vers: VersionTLS11, - random: zeros[:], - cipherSuites: []uint16{ - // The Server, by default, will use the client's - // preference order. So the GCM cipher suite - // will be selected unless it's excluded because - // of the version in this ClientHello. - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, - TLS_RSA_WITH_RC4_128_SHA, - }, - compressionMethods: []uint8{compressionNone}, - supportedCurves: []uint16{curveP256, curveP384, curveP521}, - supportedPoints: []uint8{pointFormatUncompressed}, - } - - c, s := net.Pipe() - var reply interface{} - var clientErr error - go func() { - cli := Client(c, testConfig) - cli.vers = clientHello.vers - cli.writeRecord(recordTypeHandshake, clientHello.marshal()) - reply, clientErr = cli.readHandshake() - c.Close() - }() - config := *testConfig - config.CipherSuites = clientHello.cipherSuites - Server(s, &config).Handshake() - s.Close() - if clientErr != nil { - t.Fatal(clientErr) - } - serverHello, ok := reply.(*serverHelloMsg) - if !ok { - t.Fatalf("didn't get ServerHello message in reply. Got %v\n", reply) - } - if s := serverHello.cipherSuite; s != TLS_RSA_WITH_RC4_128_SHA { - t.Fatalf("bad cipher suite from server: %x", s) - } -} - -func TestAlertForwarding(t *testing.T) { - c, s := net.Pipe() - go func() { - Client(c, testConfig).sendAlert(alertUnknownCA) - c.Close() - }() - - err := Server(s, testConfig).Handshake() - s.Close() - if e, ok := err.(*net.OpError); !ok || e.Err != error(alertUnknownCA) { - t.Errorf("Got error: %s; expected: %s", err, error(alertUnknownCA)) - } -} - -func TestClose(t *testing.T) { - c, s := net.Pipe() - go c.Close() - - err := Server(s, testConfig).Handshake() - s.Close() - if err != io.EOF { - t.Errorf("Got error: %s; expected: %s", err, io.EOF) - } -} - -func testHandshake(clientConfig, serverConfig *Config) (state ConnectionState, err error) { - c, s := net.Pipe() - go func() { - cli := Client(c, clientConfig) - cli.Handshake() - c.Close() - }() - server := Server(s, serverConfig) - err = server.Handshake() - if err == nil { - state = server.ConnectionState() - } - s.Close() - return -} - -func TestCipherSuitePreference(t *testing.T) { - serverConfig := &Config{ - CipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_RC4_128_SHA}, - Certificates: testConfig.Certificates, - MaxVersion: VersionTLS11, - } - clientConfig := &Config{ - CipherSuites: []uint16{TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_RC4_128_SHA}, - InsecureSkipVerify: true, - } - state, err := testHandshake(clientConfig, serverConfig) - if err != nil { - t.Fatalf("handshake failed: %s", err) - } - if state.CipherSuite != TLS_RSA_WITH_AES_128_CBC_SHA { - // By default the server should use the client's preference. - t.Fatalf("Client's preference was not used, got %x", state.CipherSuite) - } - - serverConfig.PreferServerCipherSuites = true - state, err = testHandshake(clientConfig, serverConfig) - if err != nil { - t.Fatalf("handshake failed: %s", err) - } - if state.CipherSuite != TLS_RSA_WITH_RC4_128_SHA { - t.Fatalf("Server's preference was not used, got %x", state.CipherSuite) - } -} - -func testServerScript(t *testing.T, name string, serverScript [][]byte, config *Config, peers []*x509.Certificate) { - c, s := net.Pipe() - srv := Server(s, config) - pchan := make(chan []*x509.Certificate, 1) - go func() { - srv.Write([]byte("hello, world\n")) - srv.Close() - s.Close() - st := srv.ConnectionState() - pchan <- st.PeerCertificates - }() - - for i, b := range serverScript { - if i%2 == 0 { - c.Write(b) - continue - } - bb := make([]byte, len(b)) - n, err := io.ReadFull(c, bb) - if err != nil { - t.Fatalf("%s #%d: %s\nRead %d, wanted %d, got %x, wanted %x\n", name, i, err, n, len(bb), bb[:n], b) - } - if !bytes.Equal(b, bb) { - t.Fatalf("%s #%d: mismatch on read: got:%x want:%x", name, i, bb, b) - } - } - c.Close() - - if peers != nil { - gotpeers := <-pchan - if len(peers) == len(gotpeers) { - for i := range peers { - if !peers[i].Equal(gotpeers[i]) { - t.Fatalf("%s: mismatch on peer cert %d", name, i) - } - } - } else { - t.Fatalf("%s: mismatch on peer list length: %d (wanted) != %d (got)", name, len(peers), len(gotpeers)) - } - } -} - -func TestHandshakeServerRSARC4(t *testing.T) { - testServerScript(t, "RSA-RC4", rsaRC4ServerScript, testConfig, nil) -} - -func TestHandshakeServerRSA3DES(t *testing.T) { - des3Config := new(Config) - *des3Config = *testConfig - des3Config.CipherSuites = []uint16{TLS_RSA_WITH_3DES_EDE_CBC_SHA} - testServerScript(t, "RSA-3DES", rsaDES3ServerScript, des3Config, nil) -} - -func TestHandshakeServerRSAAES(t *testing.T) { - aesConfig := new(Config) - *aesConfig = *testConfig - aesConfig.CipherSuites = []uint16{TLS_RSA_WITH_AES_128_CBC_SHA} - testServerScript(t, "RSA-AES", rsaAESServerScript, aesConfig, nil) -} - -func TestHandshakeServerECDHEECDSAAES(t *testing.T) { - ecdsaConfig := new(Config) - *ecdsaConfig = *testConfig - ecdsaConfig.Certificates = make([]Certificate, 1) - ecdsaConfig.Certificates[0].Certificate = [][]byte{testECDSACertificate} - ecdsaConfig.Certificates[0].PrivateKey = testECDSAPrivateKey - ecdsaConfig.BuildNameToCertificate() - ecdsaConfig.CipherSuites = []uint16{TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA} - testServerScript(t, "ECDHE-ECDSA-AES", ecdheECDSAAESServerScript, ecdsaConfig, nil) -} - -func TestHandshakeServerSSLv3(t *testing.T) { - testServerScript(t, "SSLv3", sslv3ServerScript, testConfig, nil) -} - -// TestHandshakeServerSNI involves a client sending an SNI extension of -// "snitest.com", which happens to match the CN of testSNICertificate. The test -// verifies that the server correctly selects that certificate. -func TestHandshakeServerSNI(t *testing.T) { - testServerScript(t, "SNI", selectCertificateBySNIScript, testConfig, nil) -} - -func TestResumption(t *testing.T) { - testServerScript(t, "IssueTicket", issueSessionTicketTest, testConfig, nil) - testServerScript(t, "Resume", serverResumeTest, testConfig, nil) -} - -func TestTLS12ClientCertServer(t *testing.T) { - config := *testConfig - config.MaxVersion = VersionTLS12 - config.ClientAuth = RequireAnyClientCert - config.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_RC4_128_SHA} - - testServerScript(t, "TLS12", tls12ServerScript, &config, nil) -} - -type clientauthTest struct { - name string - clientauth ClientAuthType - peers []*x509.Certificate - script [][]byte -} - -func TestClientAuthRSA(t *testing.T) { - for _, cat := range clientauthRSATests { - t.Log("running", cat.name) - cfg := new(Config) - *cfg = *testConfig - cfg.ClientAuth = cat.clientauth - testServerScript(t, cat.name, cat.script, cfg, cat.peers) - } -} - -func TestClientAuthECDSA(t *testing.T) { - for _, cat := range clientauthECDSATests { - t.Log("running", cat.name) - cfg := new(Config) - *cfg = *testConfig - cfg.Certificates = make([]Certificate, 1) - cfg.Certificates[0].Certificate = [][]byte{testECDSACertificate} - cfg.Certificates[0].PrivateKey = testECDSAPrivateKey - cfg.BuildNameToCertificate() - cfg.CipherSuites = []uint16{TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA} - cfg.ClientAuth = cat.clientauth - testServerScript(t, cat.name, cat.script, cfg, cat.peers) - } -} - -// TestCipherSuiteCertPreferance ensures that we select an RSA ciphersuite with -// an RSA certificate and an ECDSA ciphersuite with an ECDSA certificate. -func TestCipherSuiteCertPreferance(t *testing.T) { - var config = *testConfig - config.CipherSuites = []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA} - config.MaxVersion = VersionTLS11 - config.PreferServerCipherSuites = true - testServerScript(t, "CipherSuiteCertPreference", tls11ECDHEAESServerScript, &config, nil) - - config = *testConfig - config.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA} - config.Certificates = []Certificate{ - Certificate{ - Certificate: [][]byte{testECDSACertificate}, - PrivateKey: testECDSAPrivateKey, - }, - } - config.BuildNameToCertificate() - config.PreferServerCipherSuites = true - testServerScript(t, "CipherSuiteCertPreference2", ecdheECDSAAESServerScript, &config, nil) -} - -func TestTLS11Server(t *testing.T) { - var config = *testConfig - config.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA} - config.MaxVersion = VersionTLS11 - testServerScript(t, "TLS11", tls11ECDHEAESServerScript, &config, nil) -} - -func TestAESGCM(t *testing.T) { - var config = *testConfig - config.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256} - config.MaxVersion = VersionTLS12 - testServerScript(t, "AES-GCM", aesGCMServerScript, &config, nil) -} - -// recordingConn is a net.Conn that records the traffic that passes through it. -// WriteTo can be used to produce Go code that contains the recorded traffic. -type recordingConn struct { - net.Conn - lock sync.Mutex - flows [][]byte - currentlyReading bool -} - -func (r *recordingConn) Read(b []byte) (n int, err error) { - if n, err = r.Conn.Read(b); n == 0 { - return - } - b = b[:n] - - r.lock.Lock() - defer r.lock.Unlock() - - if l := len(r.flows); l == 0 || !r.currentlyReading { - buf := make([]byte, len(b)) - copy(buf, b) - r.flows = append(r.flows, buf) - } else { - r.flows[l-1] = append(r.flows[l-1], b[:n]...) - } - r.currentlyReading = true - return -} - -func (r *recordingConn) Write(b []byte) (n int, err error) { - if n, err = r.Conn.Write(b); n == 0 { - return - } - b = b[:n] - - r.lock.Lock() - defer r.lock.Unlock() - - if l := len(r.flows); l == 0 || r.currentlyReading { - buf := make([]byte, len(b)) - copy(buf, b) - r.flows = append(r.flows, buf) - } else { - r.flows[l-1] = append(r.flows[l-1], b[:n]...) - } - r.currentlyReading = false - return -} - -// WriteTo writes Go source code to w that contains the recorded traffic. -func (r *recordingConn) WriteTo(w io.Writer) { - fmt.Fprintf(w, "var changeMe = [][]byte {\n") - for _, buf := range r.flows { - fmt.Fprintf(w, "\t{") - for i, b := range buf { - if i%8 == 0 { - fmt.Fprintf(w, "\n\t\t") - } - fmt.Fprintf(w, "0x%02x, ", b) - } - fmt.Fprintf(w, "\n\t},\n") - } - fmt.Fprintf(w, "}\n") -} - -var serve = flag.Bool("serve", false, "run a TLS server on :10443") -var testCipherSuites = flag.String("ciphersuites", - "0x"+strconv.FormatInt(int64(TLS_RSA_WITH_RC4_128_SHA), 16), - "cipher suites to accept in serving mode") -var testMinVersion = flag.String("minversion", - "0x"+strconv.FormatInt(int64(VersionSSL30), 16), - "minimum version to negotiate") -var testMaxVersion = flag.String("maxversion", - "0x"+strconv.FormatInt(int64(VersionTLS10), 16), - "maximum version to negotiate") -var testClientAuth = flag.Int("clientauth", 0, "value for tls.Config.ClientAuth") - -func GetTestConfig() *Config { - var config = *testConfig - - minVersion, err := strconv.ParseUint(*testMinVersion, 0, 64) - if err != nil { - panic(err) - } - config.MinVersion = uint16(minVersion) - maxVersion, err := strconv.ParseUint(*testMaxVersion, 0, 64) - if err != nil { - panic(err) - } - config.MaxVersion = uint16(maxVersion) - - suites := strings.Split(*testCipherSuites, ",") - config.CipherSuites = make([]uint16, len(suites)) - for i := range suites { - suite, err := strconv.ParseUint(suites[i], 0, 64) - if err != nil { - panic(err) - } - config.CipherSuites[i] = uint16(suite) - } - - ecdsa := false - for _, suite := range config.CipherSuites { - switch suite { - case TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, - TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA: - ecdsa = true - } - } - if ecdsa { - config.Certificates = nil - if !*connect { - config.Certificates = make([]Certificate, 1) - config.Certificates[0].Certificate = [][]byte{testECDSACertificate} - config.Certificates[0].PrivateKey = testECDSAPrivateKey - } - config.BuildNameToCertificate() - } - - config.ClientAuth = ClientAuthType(*testClientAuth) - return &config -} - -func TestRunServer(t *testing.T) { - if !*serve { - return - } - - config := GetTestConfig() - - const addr = ":10443" - l, err := net.Listen("tcp", addr) - if err != nil { - t.Fatal(err) - } - log.Printf("Now listening for connections on %s", addr) - - for { - tcpConn, err := l.Accept() - if err != nil { - log.Printf("error accepting connection: %s", err) - break - } - - record := &recordingConn{ - Conn: tcpConn, - } - - conn := Server(record, config) - if err := conn.Handshake(); err != nil { - log.Printf("error from TLS handshake: %s", err) - break - } - - _, err = conn.Write([]byte("hello, world\n")) - if err != nil { - log.Printf("error from Write: %s", err) - continue - } - - conn.Close() - - record.WriteTo(os.Stdout) - } -} - -func bigFromString(s string) *big.Int { - ret := new(big.Int) - ret.SetString(s, 10) - return ret -} - -func fromHex(s string) []byte { - b, _ := hex.DecodeString(s) - return b -} - -var testRSACertificate = fromHex("308202b030820219a00302010202090085b0bba48a7fb8ca300d06092a864886f70d01010505003045310b3009060355040613024155311330110603550408130a536f6d652d53746174653121301f060355040a1318496e7465726e6574205769646769747320507479204c7464301e170d3130303432343039303933385a170d3131303432343039303933385a3045310b3009060355040613024155311330110603550408130a536f6d652d53746174653121301f060355040a1318496e7465726e6574205769646769747320507479204c746430819f300d06092a864886f70d010101050003818d0030818902818100bb79d6f517b5e5bf4610d0dc69bee62b07435ad0032d8a7a4385b71452e7a5654c2c78b8238cb5b482e5de1f953b7e62a52ca533d6fe125c7a56fcf506bffa587b263fb5cd04d3d0c921964ac7f4549f5abfef427100fe1899077f7e887d7df10439c4a22edb51c97ce3c04c3b326601cfafb11db8719a1ddbdb896baeda2d790203010001a381a73081a4301d0603551d0e04160414b1ade2855acfcb28db69ce2369ded3268e18883930750603551d23046e306c8014b1ade2855acfcb28db69ce2369ded3268e188839a149a4473045310b3009060355040613024155311330110603550408130a536f6d652d53746174653121301f060355040a1318496e7465726e6574205769646769747320507479204c746482090085b0bba48a7fb8ca300c0603551d13040530030101ff300d06092a864886f70d010105050003818100086c4524c76bb159ab0c52ccf2b014d7879d7a6475b55a9566e4c52b8eae12661feb4f38b36e60d392fdf74108b52513b1187a24fb301dbaed98b917ece7d73159db95d31d78ea50565cd5825a2d5a5f33c4b6d8c97590968c0f5298b5cd981f89205ff2a01ca31b9694dda9fd57e970e8266d71999b266e3850296c90a7bdd9") - -var testECDSACertificate = fromHex("3082020030820162020900b8bf2d47a0d2ebf4300906072a8648ce3d04013045310b3009060355040613024155311330110603550408130a536f6d652d53746174653121301f060355040a1318496e7465726e6574205769646769747320507479204c7464301e170d3132313132323135303633325a170d3232313132303135303633325a3045310b3009060355040613024155311330110603550408130a536f6d652d53746174653121301f060355040a1318496e7465726e6574205769646769747320507479204c746430819b301006072a8648ce3d020106052b81040023038186000400c4a1edbe98f90b4873367ec316561122f23d53c33b4d213dcd6b75e6f6b0dc9adf26c1bcb287f072327cb3642f1c90bcea6823107efee325c0483a69e0286dd33700ef0462dd0da09c706283d881d36431aa9e9731bd96b068c09b23de76643f1a5c7fe9120e5858b65f70dd9bd8ead5d7f5d5ccb9b69f30665b669a20e227e5bffe3b300906072a8648ce3d040103818c0030818802420188a24febe245c5487d1bacf5ed989dae4770c05e1bb62fbdf1b64db76140d311a2ceee0b7e927eff769dc33b7ea53fcefa10e259ec472d7cacda4e970e15a06fd00242014dfcbe67139c2d050ebd3fa38c25c13313830d9406bbd4377af6ec7ac9862eddd711697f857c56defb31782be4c7780daecbbe9e4e3624317b6a0f399512078f2a") - -var testSNICertificate = fromHex("308201f23082015da003020102020100300b06092a864886f70d01010530283110300e060355040a130741636d6520436f311430120603550403130b736e69746573742e636f6d301e170d3132303431313137343033355a170d3133303431313137343533355a30283110300e060355040a130741636d6520436f311430120603550403130b736e69746573742e636f6d30819d300b06092a864886f70d01010103818d0030818902818100bb79d6f517b5e5bf4610d0dc69bee62b07435ad0032d8a7a4385b71452e7a5654c2c78b8238cb5b482e5de1f953b7e62a52ca533d6fe125c7a56fcf506bffa587b263fb5cd04d3d0c921964ac7f4549f5abfef427100fe1899077f7e887d7df10439c4a22edb51c97ce3c04c3b326601cfafb11db8719a1ddbdb896baeda2d790203010001a3323030300e0603551d0f0101ff0404030200a0300d0603551d0e0406040401020304300f0603551d2304083006800401020304300b06092a864886f70d0101050381810089c6455f1c1f5ef8eb1ab174ee2439059f5c4259bb1a8d86cdb1d056f56a717da40e95ab90f59e8deaf627c157995094db0802266eb34fc6842dea8a4b68d9c1389103ab84fb9e1f85d9b5d23ff2312c8670fbb540148245a4ebafe264d90c8a4cf4f85b0fac12ac2fc4a3154bad52462868af96c62c6525d652b6e31845bdcc") - -var testRSAPrivateKey = &rsa.PrivateKey{ - PublicKey: rsa.PublicKey{ - N: bigFromString("131650079503776001033793877885499001334664249354723305978524647182322416328664556247316495448366990052837680518067798333412266673813370895702118944398081598789828837447552603077848001020611640547221687072142537202428102790818451901395596882588063427854225330436740647715202971973145151161964464812406232198521"), - E: 65537, - }, - D: bigFromString("29354450337804273969007277378287027274721892607543397931919078829901848876371746653677097639302788129485893852488285045793268732234230875671682624082413996177431586734171663258657462237320300610850244186316880055243099640544518318093544057213190320837094958164973959123058337475052510833916491060913053867729"), - Primes: []*big.Int{ - bigFromString("11969277782311800166562047708379380720136961987713178380670422671426759650127150688426177829077494755200794297055316163155755835813760102405344560929062149"), - bigFromString("10998999429884441391899182616418192492905073053684657075974935218461686523870125521822756579792315215543092255516093840728890783887287417039645833477273829"), - }, -} - -var testECDSAPrivateKey = &ecdsa.PrivateKey{ - PublicKey: ecdsa.PublicKey{ - Curve: &elliptic.CurveParams{ - P: bigFromString("6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151"), - N: bigFromString("6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005449"), - B: bigFromString("1093849038073734274511112390766805569936207598951683748994586394495953116150735016013708737573759623248592132296706313309438452531591012912142327488478985984"), - Gx: bigFromString("2661740802050217063228768716723360960729859168756973147706671368418802944996427808491545080627771902352094241225065558662157113545570916814161637315895999846"), - Gy: bigFromString("3757180025770020463545507224491183603594455134769762486694567779615544477440556316691234405012945539562144444537289428522585666729196580810124344277578376784"), - BitSize: 521, - }, - X: bigFromString("2636411247892461147287360222306590634450676461695221912739908880441342231985950069527906976759812296359387337367668045707086543273113073382714101597903639351"), - Y: bigFromString("3204695818431246682253994090650952614555094516658732116404513121125038617915183037601737180082382202488628239201196033284060130040574800684774115478859677243"), - }, - D: bigFromString("5477294338614160138026852784385529180817726002953041720191098180813046231640184669647735805135001309477695746518160084669446643325196003346204701381388769751"), -} - -func loadPEMCert(in string) *x509.Certificate { - block, _ := pem.Decode([]byte(in)) - if block.Type == "CERTIFICATE" && len(block.Headers) == 0 { - cert, err := x509.ParseCertificate(block.Bytes) - if err == nil { - return cert - } - panic("error parsing cert") - } - panic("error parsing PEM") -} - -// Script of interaction with gnutls implementation. -// The values for this test are obtained by building and running in server mode: -// % go test -test.run "TestRunServer" -serve -// The recorded bytes are written to stdout. -var rsaRC4ServerScript = [][]byte{ - { - 0x16, 0x03, 0x01, 0x00, 0x54, 0x01, 0x00, 0x00, - 0x50, 0x03, 0x01, 0x50, 0x77, 0x3d, 0xbd, 0x32, - 0x13, 0xd7, 0xea, 0x33, 0x65, 0x02, 0xb8, 0x70, - 0xb7, 0x84, 0xc4, 0x05, 0x1f, 0xa4, 0x24, 0xc4, - 0x91, 0x69, 0x04, 0x32, 0x96, 0xfe, 0x5b, 0x49, - 0x71, 0x60, 0x9a, 0x00, 0x00, 0x28, 0x00, 0x39, - 0x00, 0x38, 0x00, 0x35, 0x00, 0x16, 0x00, 0x13, - 0x00, 0x0a, 0x00, 0x33, 0x00, 0x32, 0x00, 0x2f, - 0x00, 0x05, 0x00, 0x04, 0x00, 0x15, 0x00, 0x12, - 0x00, 0x09, 0x00, 0x14, 0x00, 0x11, 0x00, 0x08, - 0x00, 0x06, 0x00, 0x03, 0x00, 0xff, 0x02, 0x01, - 0x00, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x2a, 0x02, 0x00, 0x00, - 0x26, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x16, - 0x03, 0x01, 0x02, 0xbe, 0x0b, 0x00, 0x02, 0xba, - 0x00, 0x02, 0xb7, 0x00, 0x02, 0xb4, 0x30, 0x82, - 0x02, 0xb0, 0x30, 0x82, 0x02, 0x19, 0xa0, 0x03, - 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0x85, 0xb0, - 0xbb, 0xa4, 0x8a, 0x7f, 0xb8, 0xca, 0x30, 0x0d, - 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, - 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x30, 0x1e, 0x17, 0x0d, - 0x31, 0x30, 0x30, 0x34, 0x32, 0x34, 0x30, 0x39, - 0x30, 0x39, 0x33, 0x38, 0x5a, 0x17, 0x0d, 0x31, - 0x31, 0x30, 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, - 0x39, 0x33, 0x38, 0x5a, 0x30, 0x45, 0x31, 0x0b, - 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, - 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, - 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, - 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, - 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, - 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, - 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, - 0x4c, 0x74, 0x64, 0x30, 0x81, 0x9f, 0x30, 0x0d, - 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, - 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, - 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, - 0xbb, 0x79, 0xd6, 0xf5, 0x17, 0xb5, 0xe5, 0xbf, - 0x46, 0x10, 0xd0, 0xdc, 0x69, 0xbe, 0xe6, 0x2b, - 0x07, 0x43, 0x5a, 0xd0, 0x03, 0x2d, 0x8a, 0x7a, - 0x43, 0x85, 0xb7, 0x14, 0x52, 0xe7, 0xa5, 0x65, - 0x4c, 0x2c, 0x78, 0xb8, 0x23, 0x8c, 0xb5, 0xb4, - 0x82, 0xe5, 0xde, 0x1f, 0x95, 0x3b, 0x7e, 0x62, - 0xa5, 0x2c, 0xa5, 0x33, 0xd6, 0xfe, 0x12, 0x5c, - 0x7a, 0x56, 0xfc, 0xf5, 0x06, 0xbf, 0xfa, 0x58, - 0x7b, 0x26, 0x3f, 0xb5, 0xcd, 0x04, 0xd3, 0xd0, - 0xc9, 0x21, 0x96, 0x4a, 0xc7, 0xf4, 0x54, 0x9f, - 0x5a, 0xbf, 0xef, 0x42, 0x71, 0x00, 0xfe, 0x18, - 0x99, 0x07, 0x7f, 0x7e, 0x88, 0x7d, 0x7d, 0xf1, - 0x04, 0x39, 0xc4, 0xa2, 0x2e, 0xdb, 0x51, 0xc9, - 0x7c, 0xe3, 0xc0, 0x4c, 0x3b, 0x32, 0x66, 0x01, - 0xcf, 0xaf, 0xb1, 0x1d, 0xb8, 0x71, 0x9a, 0x1d, - 0xdb, 0xdb, 0x89, 0x6b, 0xae, 0xda, 0x2d, 0x79, - 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81, 0xa7, - 0x30, 0x81, 0xa4, 0x30, 0x1d, 0x06, 0x03, 0x55, - 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xb1, 0xad, - 0xe2, 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, - 0xce, 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, - 0x88, 0x39, 0x30, 0x75, 0x06, 0x03, 0x55, 0x1d, - 0x23, 0x04, 0x6e, 0x30, 0x6c, 0x80, 0x14, 0xb1, - 0xad, 0xe2, 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb, - 0x69, 0xce, 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e, - 0x18, 0x88, 0x39, 0xa1, 0x49, 0xa4, 0x47, 0x30, - 0x45, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, - 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, - 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, - 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, - 0x03, 0x55, 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, - 0x69, 0x64, 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, - 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, 0x82, 0x09, - 0x00, 0x85, 0xb0, 0xbb, 0xa4, 0x8a, 0x7f, 0xb8, - 0xca, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, - 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, - 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x81, - 0x81, 0x00, 0x08, 0x6c, 0x45, 0x24, 0xc7, 0x6b, - 0xb1, 0x59, 0xab, 0x0c, 0x52, 0xcc, 0xf2, 0xb0, - 0x14, 0xd7, 0x87, 0x9d, 0x7a, 0x64, 0x75, 0xb5, - 0x5a, 0x95, 0x66, 0xe4, 0xc5, 0x2b, 0x8e, 0xae, - 0x12, 0x66, 0x1f, 0xeb, 0x4f, 0x38, 0xb3, 0x6e, - 0x60, 0xd3, 0x92, 0xfd, 0xf7, 0x41, 0x08, 0xb5, - 0x25, 0x13, 0xb1, 0x18, 0x7a, 0x24, 0xfb, 0x30, - 0x1d, 0xba, 0xed, 0x98, 0xb9, 0x17, 0xec, 0xe7, - 0xd7, 0x31, 0x59, 0xdb, 0x95, 0xd3, 0x1d, 0x78, - 0xea, 0x50, 0x56, 0x5c, 0xd5, 0x82, 0x5a, 0x2d, - 0x5a, 0x5f, 0x33, 0xc4, 0xb6, 0xd8, 0xc9, 0x75, - 0x90, 0x96, 0x8c, 0x0f, 0x52, 0x98, 0xb5, 0xcd, - 0x98, 0x1f, 0x89, 0x20, 0x5f, 0xf2, 0xa0, 0x1c, - 0xa3, 0x1b, 0x96, 0x94, 0xdd, 0xa9, 0xfd, 0x57, - 0xe9, 0x70, 0xe8, 0x26, 0x6d, 0x71, 0x99, 0x9b, - 0x26, 0x6e, 0x38, 0x50, 0x29, 0x6c, 0x90, 0xa7, - 0xbd, 0xd9, 0x16, 0x03, 0x01, 0x00, 0x04, 0x0e, - 0x00, 0x00, 0x00, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x86, 0x10, 0x00, 0x00, - 0x82, 0x00, 0x80, 0x2d, 0x09, 0x7c, 0x7f, 0xfc, - 0x84, 0xce, 0xb3, 0x30, 0x9b, 0xf9, 0xb7, 0xc8, - 0xc3, 0xff, 0xee, 0x6f, 0x20, 0x8a, 0xf4, 0xfb, - 0x86, 0x55, 0x1f, 0x6a, 0xb4, 0x81, 0x50, 0x3a, - 0x46, 0x1b, 0xd3, 0xca, 0x4b, 0x11, 0xff, 0xef, - 0x02, 0xbc, 0x18, 0xb8, 0x4a, 0x7d, 0x43, 0x23, - 0x96, 0x92, 0x27, 0x7c, 0xca, 0xcf, 0xe6, 0x91, - 0xe8, 0x14, 0x97, 0x68, 0xb4, 0xe5, 0xc0, 0xc9, - 0x23, 0xdd, 0x54, 0x07, 0xa6, 0x2e, 0x8c, 0x98, - 0xfc, 0xc6, 0x8c, 0x04, 0x6b, 0x1b, 0x5f, 0xd5, - 0x3d, 0x8b, 0x6c, 0x55, 0x4f, 0x7a, 0xe6, 0x6c, - 0x74, 0x2c, 0x1e, 0x34, 0xdb, 0xfb, 0x00, 0xb1, - 0x4e, 0x10, 0x21, 0x16, 0xe0, 0x3e, 0xc5, 0x64, - 0x84, 0x28, 0x2b, 0x2b, 0x29, 0x47, 0x51, 0x34, - 0x76, 0x15, 0x20, 0x71, 0x0b, 0x30, 0xa1, 0x85, - 0xd5, 0x15, 0x18, 0x14, 0x64, 0x4b, 0x40, 0x7c, - 0x4f, 0xb3, 0x7b, 0x14, 0x03, 0x01, 0x00, 0x01, - 0x01, 0x16, 0x03, 0x01, 0x00, 0x24, 0xab, 0xee, - 0xf5, 0x97, 0x5f, 0xc6, 0x78, 0xf3, 0xc6, 0x83, - 0x5b, 0x55, 0x4f, 0xcb, 0x45, 0x3f, 0xfa, 0xf7, - 0x05, 0x02, 0xc2, 0x63, 0x87, 0x18, 0xb5, 0x9a, - 0x62, 0xe2, 0x3f, 0x88, 0x5a, 0x60, 0x61, 0x72, - 0xfa, 0x9c, - }, - { - 0x14, 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, - 0x01, 0x00, 0x24, 0x72, 0xa4, 0xe4, 0xaa, 0xd2, - 0xc4, 0x39, 0x7e, 0x2a, 0xc1, 0x6f, 0x34, 0x42, - 0x28, 0xcb, 0x9d, 0x7a, 0x09, 0xca, 0x96, 0xad, - 0x0e, 0x11, 0x51, 0x8a, 0x06, 0xb0, 0xe9, 0xca, - 0xeb, 0xce, 0xe2, 0xd5, 0x2e, 0xc1, 0x8d, 0x17, - 0x03, 0x01, 0x00, 0x21, 0x2e, 0x61, 0x86, 0x17, - 0xdb, 0xa6, 0x30, 0xe2, 0x62, 0x06, 0x2a, 0x8b, - 0x75, 0x2c, 0x2d, 0xcf, 0xf5, 0x01, 0x11, 0x52, - 0x81, 0x38, 0xcf, 0xd5, 0xf7, 0xdc, 0x52, 0x31, - 0x1f, 0x97, 0x43, 0xc2, 0x71, 0x15, 0x03, 0x01, - 0x00, 0x16, 0xe0, 0x21, 0xfe, 0x36, 0x2e, 0x68, - 0x2c, 0xf1, 0xbe, 0x04, 0xec, 0xd4, 0xc6, 0xdd, - 0xac, 0x6f, 0x4c, 0x85, 0x32, 0x3f, 0x87, 0x1b, - }, -} - -var rsaDES3ServerScript = [][]byte{ - { - 0x16, 0x03, 0x00, 0x00, 0xc5, 0x01, 0x00, 0x00, - 0xc1, 0x03, 0x03, 0x50, 0xae, 0x5d, 0x38, 0xec, - 0xaa, 0x2f, 0x41, 0xf9, 0xd2, 0x7b, 0xa1, 0xfd, - 0x0f, 0xff, 0x4e, 0x54, 0x0e, 0x15, 0x57, 0xaf, - 0x2c, 0x91, 0xb5, 0x35, 0x5b, 0x2e, 0xb0, 0xec, - 0x20, 0xe5, 0xd2, 0x00, 0x00, 0x50, 0xc0, 0x09, - 0xc0, 0x23, 0xc0, 0x2b, 0xc0, 0x0a, 0xc0, 0x24, - 0xc0, 0x2c, 0xc0, 0x08, 0xc0, 0x13, 0xc0, 0x27, - 0xc0, 0x2f, 0xc0, 0x14, 0xc0, 0x30, 0xc0, 0x12, - 0x00, 0x33, 0x00, 0x67, 0x00, 0x45, 0x00, 0x9e, - 0x00, 0x39, 0x00, 0x6b, 0x00, 0x88, 0x00, 0x16, - 0x00, 0x32, 0x00, 0x40, 0x00, 0x44, 0x00, 0xa2, - 0x00, 0x38, 0x00, 0x6a, 0x00, 0x87, 0x00, 0x13, - 0x00, 0x66, 0x00, 0x2f, 0x00, 0x3c, 0x00, 0x41, - 0x00, 0x9c, 0x00, 0x35, 0x00, 0x3d, 0x00, 0x84, - 0x00, 0x0a, 0x00, 0x05, 0x00, 0x04, 0x01, 0x00, - 0x00, 0x48, 0x00, 0x05, 0x00, 0x05, 0x01, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x01, 0x00, - 0x00, 0x23, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x0c, - 0x00, 0x0a, 0x00, 0x13, 0x00, 0x15, 0x00, 0x17, - 0x00, 0x18, 0x00, 0x19, 0x00, 0x0b, 0x00, 0x02, - 0x01, 0x00, 0x00, 0x0d, 0x00, 0x1c, 0x00, 0x1a, - 0x04, 0x01, 0x04, 0x02, 0x04, 0x03, 0x05, 0x01, - 0x05, 0x03, 0x06, 0x01, 0x06, 0x03, 0x03, 0x01, - 0x03, 0x02, 0x03, 0x03, 0x02, 0x01, 0x02, 0x02, - 0x02, 0x03, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x30, 0x02, 0x00, 0x00, - 0x2c, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, - 0x04, 0x00, 0x23, 0x00, 0x00, 0x16, 0x03, 0x01, - 0x02, 0xbe, 0x0b, 0x00, 0x02, 0xba, 0x00, 0x02, - 0xb7, 0x00, 0x02, 0xb4, 0x30, 0x82, 0x02, 0xb0, - 0x30, 0x82, 0x02, 0x19, 0xa0, 0x03, 0x02, 0x01, - 0x02, 0x02, 0x09, 0x00, 0x85, 0xb0, 0xbb, 0xa4, - 0x8a, 0x7f, 0xb8, 0xca, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x05, 0x05, 0x00, 0x30, 0x45, 0x31, 0x0b, 0x30, - 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, - 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, - 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, - 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, - 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, - 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, - 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, - 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, - 0x74, 0x64, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30, - 0x30, 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, 0x39, - 0x33, 0x38, 0x5a, 0x17, 0x0d, 0x31, 0x31, 0x30, - 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, 0x39, 0x33, - 0x38, 0x5a, 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, - 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, - 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, - 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, - 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, - 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, - 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, - 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, 0x74, - 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, - 0x64, 0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, - 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xbb, 0x79, - 0xd6, 0xf5, 0x17, 0xb5, 0xe5, 0xbf, 0x46, 0x10, - 0xd0, 0xdc, 0x69, 0xbe, 0xe6, 0x2b, 0x07, 0x43, - 0x5a, 0xd0, 0x03, 0x2d, 0x8a, 0x7a, 0x43, 0x85, - 0xb7, 0x14, 0x52, 0xe7, 0xa5, 0x65, 0x4c, 0x2c, - 0x78, 0xb8, 0x23, 0x8c, 0xb5, 0xb4, 0x82, 0xe5, - 0xde, 0x1f, 0x95, 0x3b, 0x7e, 0x62, 0xa5, 0x2c, - 0xa5, 0x33, 0xd6, 0xfe, 0x12, 0x5c, 0x7a, 0x56, - 0xfc, 0xf5, 0x06, 0xbf, 0xfa, 0x58, 0x7b, 0x26, - 0x3f, 0xb5, 0xcd, 0x04, 0xd3, 0xd0, 0xc9, 0x21, - 0x96, 0x4a, 0xc7, 0xf4, 0x54, 0x9f, 0x5a, 0xbf, - 0xef, 0x42, 0x71, 0x00, 0xfe, 0x18, 0x99, 0x07, - 0x7f, 0x7e, 0x88, 0x7d, 0x7d, 0xf1, 0x04, 0x39, - 0xc4, 0xa2, 0x2e, 0xdb, 0x51, 0xc9, 0x7c, 0xe3, - 0xc0, 0x4c, 0x3b, 0x32, 0x66, 0x01, 0xcf, 0xaf, - 0xb1, 0x1d, 0xb8, 0x71, 0x9a, 0x1d, 0xdb, 0xdb, - 0x89, 0x6b, 0xae, 0xda, 0x2d, 0x79, 0x02, 0x03, - 0x01, 0x00, 0x01, 0xa3, 0x81, 0xa7, 0x30, 0x81, - 0xa4, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, - 0x04, 0x16, 0x04, 0x14, 0xb1, 0xad, 0xe2, 0x85, - 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, 0xce, 0x23, - 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, 0x88, 0x39, - 0x30, 0x75, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, - 0x6e, 0x30, 0x6c, 0x80, 0x14, 0xb1, 0xad, 0xe2, - 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, 0xce, - 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, 0x88, - 0x39, 0xa1, 0x49, 0xa4, 0x47, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x82, 0x09, 0x00, 0x85, - 0xb0, 0xbb, 0xa4, 0x8a, 0x7f, 0xb8, 0xca, 0x30, - 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, - 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x01, 0x05, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, - 0x08, 0x6c, 0x45, 0x24, 0xc7, 0x6b, 0xb1, 0x59, - 0xab, 0x0c, 0x52, 0xcc, 0xf2, 0xb0, 0x14, 0xd7, - 0x87, 0x9d, 0x7a, 0x64, 0x75, 0xb5, 0x5a, 0x95, - 0x66, 0xe4, 0xc5, 0x2b, 0x8e, 0xae, 0x12, 0x66, - 0x1f, 0xeb, 0x4f, 0x38, 0xb3, 0x6e, 0x60, 0xd3, - 0x92, 0xfd, 0xf7, 0x41, 0x08, 0xb5, 0x25, 0x13, - 0xb1, 0x18, 0x7a, 0x24, 0xfb, 0x30, 0x1d, 0xba, - 0xed, 0x98, 0xb9, 0x17, 0xec, 0xe7, 0xd7, 0x31, - 0x59, 0xdb, 0x95, 0xd3, 0x1d, 0x78, 0xea, 0x50, - 0x56, 0x5c, 0xd5, 0x82, 0x5a, 0x2d, 0x5a, 0x5f, - 0x33, 0xc4, 0xb6, 0xd8, 0xc9, 0x75, 0x90, 0x96, - 0x8c, 0x0f, 0x52, 0x98, 0xb5, 0xcd, 0x98, 0x1f, - 0x89, 0x20, 0x5f, 0xf2, 0xa0, 0x1c, 0xa3, 0x1b, - 0x96, 0x94, 0xdd, 0xa9, 0xfd, 0x57, 0xe9, 0x70, - 0xe8, 0x26, 0x6d, 0x71, 0x99, 0x9b, 0x26, 0x6e, - 0x38, 0x50, 0x29, 0x6c, 0x90, 0xa7, 0xbd, 0xd9, - 0x16, 0x03, 0x01, 0x00, 0x04, 0x0e, 0x00, 0x00, - 0x00, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x86, 0x10, 0x00, 0x00, - 0x82, 0x00, 0x80, 0x51, 0x04, 0xf1, 0x7a, 0xbf, - 0xe8, 0xa5, 0x86, 0x09, 0xa7, 0xf3, 0xcc, 0x93, - 0x00, 0x10, 0x5b, 0xb8, 0xc1, 0x51, 0x0d, 0x5b, - 0xcd, 0xed, 0x26, 0x01, 0x69, 0x73, 0xf4, 0x05, - 0x8a, 0x6a, 0xc3, 0xb1, 0x9e, 0x84, 0x4e, 0x39, - 0xcf, 0x5e, 0x55, 0xa9, 0x70, 0x19, 0x96, 0x91, - 0xcd, 0x2c, 0x78, 0x3c, 0xa2, 0x6d, 0xb0, 0x49, - 0x86, 0xf6, 0xd1, 0x3a, 0xde, 0x00, 0x4b, 0xa6, - 0x25, 0xbf, 0x85, 0x39, 0xce, 0xb1, 0xcf, 0xbc, - 0x16, 0xc7, 0x66, 0xac, 0xf8, 0xd2, 0x3b, 0xd1, - 0xcc, 0x16, 0xac, 0x63, 0x3c, 0xbe, 0xd9, 0xb6, - 0x6a, 0xe4, 0x13, 0x8a, 0xf4, 0x56, 0x2f, 0x92, - 0x54, 0xd8, 0xf0, 0x84, 0x01, 0x32, 0x1a, 0xa9, - 0x2d, 0xaf, 0x82, 0x0e, 0x00, 0xfa, 0x07, 0x88, - 0xd9, 0x87, 0xe7, 0xdc, 0x9e, 0xe9, 0x72, 0x49, - 0xb8, 0xfa, 0x8c, 0x7b, 0x07, 0x0b, 0x03, 0x7c, - 0x10, 0x8c, 0x8a, 0x14, 0x03, 0x01, 0x00, 0x01, - 0x01, 0x16, 0x03, 0x01, 0x00, 0xa8, 0x61, 0xa4, - 0xf4, 0x5f, 0x8a, 0x1f, 0x5c, 0x92, 0x3f, 0x8c, - 0xdb, 0xd6, 0x10, 0xcd, 0x9e, 0xe7, 0xf0, 0xc4, - 0x3c, 0xb6, 0x1c, 0x9a, 0x56, 0x73, 0x7f, 0xa6, - 0x14, 0x24, 0xcb, 0x96, 0x1f, 0xe0, 0xaf, 0xcd, - 0x3c, 0x66, 0x43, 0xb7, 0x37, 0x65, 0x34, 0x47, - 0xf8, 0x43, 0xf1, 0xcc, 0x15, 0xb8, 0xdc, 0x35, - 0xe0, 0xa4, 0x2d, 0x78, 0x94, 0xe0, 0x02, 0xf3, - 0x76, 0x46, 0xf7, 0x9b, 0x8d, 0x0d, 0x5d, 0x0b, - 0xd3, 0xdd, 0x9a, 0x9e, 0x62, 0x2e, 0xc5, 0x98, - 0x75, 0x63, 0x0c, 0xbf, 0x8e, 0x49, 0x33, 0x23, - 0x7c, 0x00, 0xcf, 0xfb, 0xcf, 0xba, 0x0f, 0x41, - 0x39, 0x89, 0xb9, 0xcc, 0x59, 0xd0, 0x2b, 0xb6, - 0xec, 0x04, 0xe2, 0xc0, 0x52, 0xc7, 0xcf, 0x71, - 0x47, 0xff, 0x70, 0x7e, 0xa9, 0xbd, 0x1c, 0xdd, - 0x17, 0xa5, 0x6c, 0xb7, 0x10, 0x4f, 0x42, 0x18, - 0x37, 0x69, 0xa9, 0xd2, 0xb3, 0x18, 0x84, 0x92, - 0xa7, 0x47, 0x21, 0xf6, 0x95, 0x63, 0x29, 0xd6, - 0xa5, 0xb6, 0xda, 0x65, 0x67, 0x69, 0xc4, 0x26, - 0xac, 0x8b, 0x08, 0x58, 0xdd, 0x3c, 0x31, 0x20, - 0xd5, 0x0c, 0x88, 0x72, 0x18, 0x16, 0x88, 0x1e, - 0x4a, 0x0f, 0xe1, 0xcf, 0x95, 0x24, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x72, 0x04, 0x00, 0x00, - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, - 0xe8, 0x4b, 0xde, 0xef, 0xba, 0x3e, 0x18, 0x1c, - 0x1e, 0x5e, 0xbc, 0x87, 0xf1, 0x87, 0x8d, 0x72, - 0xe3, 0xbe, 0x0f, 0xdf, 0xfd, 0xd0, 0xb2, 0x89, - 0xf8, 0x05, 0x9a, 0x52, 0x47, 0x77, 0x9e, 0xe8, - 0xb1, 0x1d, 0x18, 0xed, 0x6a, 0x4b, 0x63, 0x1d, - 0xf1, 0x62, 0xd2, 0x65, 0x21, 0x26, 0x73, 0xd4, - 0x35, 0x5b, 0x95, 0x89, 0x12, 0x59, 0x23, 0x8c, - 0xc3, 0xfc, 0xf9, 0x4d, 0x21, 0x79, 0xa0, 0xbd, - 0xff, 0x33, 0xa2, 0x3d, 0x0b, 0x6f, 0x89, 0xc9, - 0x23, 0xe4, 0xe7, 0x9f, 0x1d, 0x98, 0xf6, 0xed, - 0x02, 0x8d, 0xac, 0x1a, 0xf9, 0xcb, 0xa5, 0x14, - 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, 0x01, - 0x00, 0x28, 0x91, 0x56, 0x80, 0xe2, 0x6d, 0x51, - 0x88, 0x03, 0xf8, 0x49, 0xe6, 0x6a, 0x5a, 0xfb, - 0x2f, 0x0b, 0xb5, 0xa1, 0x0d, 0x63, 0x83, 0xae, - 0xb9, 0xbc, 0x05, 0xf0, 0x81, 0x00, 0x61, 0x83, - 0x38, 0xda, 0x14, 0xf6, 0xea, 0xd8, 0x78, 0x65, - 0xc7, 0x26, 0x17, 0x03, 0x01, 0x00, 0x18, 0x81, - 0x30, 0x8b, 0x22, 0x5a, 0xd3, 0x7f, 0xc8, 0xf2, - 0x8a, 0x6b, 0xa3, 0xba, 0x4d, 0xe7, 0x6e, 0xd2, - 0xfd, 0xbf, 0xf2, 0xc5, 0x28, 0xa0, 0x62, 0x17, - 0x03, 0x01, 0x00, 0x28, 0x17, 0x83, 0x3c, 0x78, - 0x18, 0xfa, 0x8d, 0x58, 0x5c, 0xaa, 0x05, 0x7d, - 0x67, 0x96, 0x11, 0x60, 0x11, 0xc0, 0x1e, 0x0d, - 0x6a, 0x6e, 0x5f, 0x1d, 0x98, 0x4b, 0xff, 0x82, - 0xee, 0x21, 0x06, 0x29, 0xd3, 0x8b, 0x80, 0x78, - 0x39, 0x05, 0x34, 0x9b, 0x15, 0x03, 0x01, 0x00, - 0x18, 0xa9, 0x38, 0x18, 0x4f, 0x9d, 0x84, 0x75, - 0x88, 0x53, 0xd6, 0x85, 0xc2, 0x15, 0x4b, 0xe3, - 0xe3, 0x35, 0x9a, 0x74, 0xc9, 0x3e, 0x13, 0xc1, - 0x8c, - }, -} - -var rsaAESServerScript = [][]byte{ - { - 0x16, 0x03, 0x00, 0x00, 0xc5, 0x01, 0x00, 0x00, - 0xc1, 0x03, 0x03, 0x50, 0xae, 0x5c, 0xe9, 0x5e, - 0x31, 0x93, 0x82, 0xa5, 0x6f, 0x51, 0x82, 0xc8, - 0x55, 0x4f, 0x1f, 0x2e, 0x90, 0x98, 0x81, 0x13, - 0x27, 0x80, 0x68, 0xb4, 0x2d, 0xba, 0x3a, 0x76, - 0xd8, 0xd7, 0x2c, 0x00, 0x00, 0x50, 0xc0, 0x09, - 0xc0, 0x23, 0xc0, 0x2b, 0xc0, 0x0a, 0xc0, 0x24, - 0xc0, 0x2c, 0xc0, 0x08, 0xc0, 0x13, 0xc0, 0x27, - 0xc0, 0x2f, 0xc0, 0x14, 0xc0, 0x30, 0xc0, 0x12, - 0x00, 0x33, 0x00, 0x67, 0x00, 0x45, 0x00, 0x9e, - 0x00, 0x39, 0x00, 0x6b, 0x00, 0x88, 0x00, 0x16, - 0x00, 0x32, 0x00, 0x40, 0x00, 0x44, 0x00, 0xa2, - 0x00, 0x38, 0x00, 0x6a, 0x00, 0x87, 0x00, 0x13, - 0x00, 0x66, 0x00, 0x2f, 0x00, 0x3c, 0x00, 0x41, - 0x00, 0x9c, 0x00, 0x35, 0x00, 0x3d, 0x00, 0x84, - 0x00, 0x0a, 0x00, 0x05, 0x00, 0x04, 0x01, 0x00, - 0x00, 0x48, 0x00, 0x05, 0x00, 0x05, 0x01, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x01, 0x00, - 0x00, 0x23, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x0c, - 0x00, 0x0a, 0x00, 0x13, 0x00, 0x15, 0x00, 0x17, - 0x00, 0x18, 0x00, 0x19, 0x00, 0x0b, 0x00, 0x02, - 0x01, 0x00, 0x00, 0x0d, 0x00, 0x1c, 0x00, 0x1a, - 0x04, 0x01, 0x04, 0x02, 0x04, 0x03, 0x05, 0x01, - 0x05, 0x03, 0x06, 0x01, 0x06, 0x03, 0x03, 0x01, - 0x03, 0x02, 0x03, 0x03, 0x02, 0x01, 0x02, 0x02, - 0x02, 0x03, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x30, 0x02, 0x00, 0x00, - 0x2c, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, - 0x04, 0x00, 0x23, 0x00, 0x00, 0x16, 0x03, 0x01, - 0x02, 0xbe, 0x0b, 0x00, 0x02, 0xba, 0x00, 0x02, - 0xb7, 0x00, 0x02, 0xb4, 0x30, 0x82, 0x02, 0xb0, - 0x30, 0x82, 0x02, 0x19, 0xa0, 0x03, 0x02, 0x01, - 0x02, 0x02, 0x09, 0x00, 0x85, 0xb0, 0xbb, 0xa4, - 0x8a, 0x7f, 0xb8, 0xca, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x05, 0x05, 0x00, 0x30, 0x45, 0x31, 0x0b, 0x30, - 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, - 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, - 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, - 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, - 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, - 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, - 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, - 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, - 0x74, 0x64, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30, - 0x30, 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, 0x39, - 0x33, 0x38, 0x5a, 0x17, 0x0d, 0x31, 0x31, 0x30, - 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, 0x39, 0x33, - 0x38, 0x5a, 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, - 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, - 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, - 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, - 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, - 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, - 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, - 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, 0x74, - 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, - 0x64, 0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, - 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xbb, 0x79, - 0xd6, 0xf5, 0x17, 0xb5, 0xe5, 0xbf, 0x46, 0x10, - 0xd0, 0xdc, 0x69, 0xbe, 0xe6, 0x2b, 0x07, 0x43, - 0x5a, 0xd0, 0x03, 0x2d, 0x8a, 0x7a, 0x43, 0x85, - 0xb7, 0x14, 0x52, 0xe7, 0xa5, 0x65, 0x4c, 0x2c, - 0x78, 0xb8, 0x23, 0x8c, 0xb5, 0xb4, 0x82, 0xe5, - 0xde, 0x1f, 0x95, 0x3b, 0x7e, 0x62, 0xa5, 0x2c, - 0xa5, 0x33, 0xd6, 0xfe, 0x12, 0x5c, 0x7a, 0x56, - 0xfc, 0xf5, 0x06, 0xbf, 0xfa, 0x58, 0x7b, 0x26, - 0x3f, 0xb5, 0xcd, 0x04, 0xd3, 0xd0, 0xc9, 0x21, - 0x96, 0x4a, 0xc7, 0xf4, 0x54, 0x9f, 0x5a, 0xbf, - 0xef, 0x42, 0x71, 0x00, 0xfe, 0x18, 0x99, 0x07, - 0x7f, 0x7e, 0x88, 0x7d, 0x7d, 0xf1, 0x04, 0x39, - 0xc4, 0xa2, 0x2e, 0xdb, 0x51, 0xc9, 0x7c, 0xe3, - 0xc0, 0x4c, 0x3b, 0x32, 0x66, 0x01, 0xcf, 0xaf, - 0xb1, 0x1d, 0xb8, 0x71, 0x9a, 0x1d, 0xdb, 0xdb, - 0x89, 0x6b, 0xae, 0xda, 0x2d, 0x79, 0x02, 0x03, - 0x01, 0x00, 0x01, 0xa3, 0x81, 0xa7, 0x30, 0x81, - 0xa4, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, - 0x04, 0x16, 0x04, 0x14, 0xb1, 0xad, 0xe2, 0x85, - 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, 0xce, 0x23, - 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, 0x88, 0x39, - 0x30, 0x75, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, - 0x6e, 0x30, 0x6c, 0x80, 0x14, 0xb1, 0xad, 0xe2, - 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, 0xce, - 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, 0x88, - 0x39, 0xa1, 0x49, 0xa4, 0x47, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x82, 0x09, 0x00, 0x85, - 0xb0, 0xbb, 0xa4, 0x8a, 0x7f, 0xb8, 0xca, 0x30, - 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, - 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x01, 0x05, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, - 0x08, 0x6c, 0x45, 0x24, 0xc7, 0x6b, 0xb1, 0x59, - 0xab, 0x0c, 0x52, 0xcc, 0xf2, 0xb0, 0x14, 0xd7, - 0x87, 0x9d, 0x7a, 0x64, 0x75, 0xb5, 0x5a, 0x95, - 0x66, 0xe4, 0xc5, 0x2b, 0x8e, 0xae, 0x12, 0x66, - 0x1f, 0xeb, 0x4f, 0x38, 0xb3, 0x6e, 0x60, 0xd3, - 0x92, 0xfd, 0xf7, 0x41, 0x08, 0xb5, 0x25, 0x13, - 0xb1, 0x18, 0x7a, 0x24, 0xfb, 0x30, 0x1d, 0xba, - 0xed, 0x98, 0xb9, 0x17, 0xec, 0xe7, 0xd7, 0x31, - 0x59, 0xdb, 0x95, 0xd3, 0x1d, 0x78, 0xea, 0x50, - 0x56, 0x5c, 0xd5, 0x82, 0x5a, 0x2d, 0x5a, 0x5f, - 0x33, 0xc4, 0xb6, 0xd8, 0xc9, 0x75, 0x90, 0x96, - 0x8c, 0x0f, 0x52, 0x98, 0xb5, 0xcd, 0x98, 0x1f, - 0x89, 0x20, 0x5f, 0xf2, 0xa0, 0x1c, 0xa3, 0x1b, - 0x96, 0x94, 0xdd, 0xa9, 0xfd, 0x57, 0xe9, 0x70, - 0xe8, 0x26, 0x6d, 0x71, 0x99, 0x9b, 0x26, 0x6e, - 0x38, 0x50, 0x29, 0x6c, 0x90, 0xa7, 0xbd, 0xd9, - 0x16, 0x03, 0x01, 0x00, 0x04, 0x0e, 0x00, 0x00, - 0x00, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x86, 0x10, 0x00, 0x00, - 0x82, 0x00, 0x80, 0x51, 0x2e, 0xec, 0x0d, 0x86, - 0xf3, 0x9f, 0xf2, 0x77, 0x04, 0x27, 0x2b, 0x0e, - 0x9c, 0xab, 0x35, 0x84, 0x65, 0xff, 0x36, 0xef, - 0xc0, 0x08, 0xc9, 0x1d, 0x9f, 0x29, 0xae, 0x8d, - 0xc5, 0x66, 0x81, 0x31, 0x92, 0x5e, 0x3d, 0xac, - 0xaa, 0x37, 0x28, 0x2c, 0x06, 0x91, 0xa6, 0xc2, - 0xd0, 0x83, 0x34, 0x24, 0x1c, 0x88, 0xfc, 0x0a, - 0xcf, 0xbf, 0xc2, 0x94, 0xe2, 0xed, 0xa7, 0x6a, - 0xa8, 0x8d, 0x3d, 0xf7, 0x06, 0x7d, 0x69, 0xf8, - 0x0d, 0xb2, 0xf7, 0xe4, 0x45, 0xcb, 0x0a, 0x25, - 0xcb, 0xb2, 0x2e, 0x38, 0x9a, 0x84, 0x75, 0xe8, - 0xe1, 0x42, 0x39, 0xa2, 0x18, 0x0e, 0x48, 0xca, - 0x33, 0x16, 0x4e, 0xf6, 0x2f, 0xec, 0x07, 0xe7, - 0x57, 0xe1, 0x20, 0x40, 0x40, 0x6d, 0x4e, 0x29, - 0x04, 0x1a, 0x8c, 0x99, 0xfb, 0x19, 0x3c, 0xaa, - 0x75, 0x64, 0xd3, 0xa6, 0xe6, 0xed, 0x3f, 0x5a, - 0xd2, 0xc9, 0x80, 0x14, 0x03, 0x01, 0x00, 0x01, - 0x01, 0x16, 0x03, 0x01, 0x01, 0x10, 0xe9, 0x9e, - 0x06, 0x92, 0x18, 0xbf, 0x5e, 0xaf, 0x33, 0xc1, - 0xbf, 0x0e, 0x12, 0x07, 0x48, 0x4f, 0x6b, 0x6c, - 0xf5, 0x23, 0x5e, 0x87, 0xa7, 0xd3, 0x50, 0x79, - 0x38, 0xdc, 0xe0, 0x49, 0xd3, 0x81, 0x21, 0x12, - 0xd0, 0x3d, 0x9a, 0xfb, 0x83, 0xc1, 0x8b, 0xfc, - 0x14, 0xd5, 0xd5, 0xa7, 0xa3, 0x34, 0x14, 0x71, - 0xbe, 0xea, 0x37, 0x18, 0x12, 0x7f, 0x41, 0xfb, - 0xc5, 0x51, 0x17, 0x9d, 0x96, 0x58, 0x14, 0xfb, - 0x4f, 0xd7, 0xd3, 0x15, 0x0f, 0xec, 0x5a, 0x0d, - 0x35, 0xbb, 0x3c, 0x81, 0x5b, 0x3f, 0xdf, 0x52, - 0xa4, 0x4c, 0xcd, 0x13, 0xe1, 0x10, 0x37, 0x34, - 0xbf, 0xb4, 0x80, 0x1e, 0x8d, 0xe2, 0xc3, 0x7a, - 0x0f, 0x7b, 0x7d, 0x23, 0xeb, 0xd0, 0x99, 0x69, - 0xad, 0x0a, 0x2d, 0xb3, 0x6c, 0xd6, 0x80, 0x11, - 0x7f, 0x6c, 0xed, 0x1b, 0xcd, 0x08, 0x22, 0x56, - 0x90, 0x0e, 0xa4, 0xc3, 0x29, 0x33, 0x96, 0x30, - 0x34, 0x94, 0xa1, 0xeb, 0x9c, 0x1b, 0x5a, 0xd1, - 0x03, 0x61, 0xf9, 0xdd, 0xf3, 0x64, 0x8a, 0xfd, - 0x5f, 0x44, 0xdb, 0x2e, 0xa7, 0xfd, 0xe1, 0x1a, - 0x66, 0xc5, 0x01, 0x9c, 0xc7, 0xd1, 0xc4, 0xd3, - 0xea, 0x14, 0x3c, 0xed, 0x74, 0xbb, 0x1b, 0x97, - 0x8f, 0xf1, 0x29, 0x39, 0x33, 0x92, 0x93, 0x4e, - 0xf5, 0x87, 0x91, 0x61, 0x65, 0x8d, 0x27, 0x8d, - 0x76, 0xc1, 0xfa, 0x6a, 0x99, 0x80, 0xb1, 0x9b, - 0x29, 0x53, 0xce, 0x3e, 0xb6, 0x9a, 0xce, 0x3c, - 0x19, 0x5e, 0x48, 0x83, 0xaa, 0xa7, 0x66, 0x98, - 0x59, 0xf4, 0xbb, 0xf2, 0xbc, 0xd9, 0xc5, 0x9a, - 0xc8, 0x2c, 0x63, 0x58, 0xd5, 0xd4, 0xbc, 0x03, - 0xa9, 0x06, 0xa9, 0x80, 0x0d, 0xb3, 0x46, 0x2d, - 0xe3, 0xc6, 0xaf, 0x1a, 0x39, 0x18, 0x7e, 0x1e, - 0x83, 0x80, 0x46, 0x11, 0xd2, 0x13, 0x9f, 0xda, - 0xfc, 0x2d, 0x42, 0xaa, 0x5a, 0x1d, 0x4c, 0x31, - 0xe5, 0x58, 0x78, 0x5e, 0xe2, 0x04, 0xd6, 0x23, - 0x7f, 0x3f, 0x06, 0xc0, 0x54, 0xf8, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x72, 0x04, 0x00, 0x00, - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, - 0xe8, 0x4b, 0xfb, 0xef, 0xba, 0xed, 0xc5, 0x36, - 0xc8, 0x5a, 0x41, 0x3f, 0x05, 0xfa, 0xfe, 0x48, - 0xc3, 0x91, 0x12, 0x8b, 0xe8, 0x32, 0x6a, 0x9f, - 0xdc, 0x97, 0xe2, 0x77, 0xb9, 0x96, 0x2d, 0xd4, - 0xe5, 0xbd, 0xa1, 0xfd, 0x94, 0xbb, 0x74, 0x63, - 0xb1, 0x0c, 0x38, 0xbc, 0x6f, 0x69, 0xaf, 0xa3, - 0x46, 0x9c, 0x96, 0x41, 0xde, 0x59, 0x23, 0xff, - 0x15, 0x6b, 0x3a, 0xef, 0x91, 0x6d, 0x92, 0x44, - 0xdc, 0x72, 0x1f, 0x40, 0x3d, 0xb5, 0x34, 0x8f, - 0x2a, 0xac, 0x21, 0x69, 0x05, 0x6f, 0xb2, 0x60, - 0x32, 0x5d, 0x3d, 0x97, 0xb4, 0x24, 0x99, 0x14, - 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, 0x01, - 0x00, 0x30, 0x68, 0x27, 0x97, 0xca, 0x63, 0x09, - 0x22, 0xed, 0x0e, 0x61, 0x7c, 0x76, 0x31, 0x9c, - 0xbe, 0x27, 0xc9, 0xe6, 0x09, 0xc3, 0xc3, 0xc2, - 0xf4, 0xa2, 0x32, 0xba, 0x7c, 0xf2, 0x0f, 0xb8, - 0x3d, 0xcb, 0xe2, 0x4c, 0xc0, 0x7d, 0x8e, 0x5b, - 0x5a, 0xed, 0x05, 0x5c, 0x15, 0x96, 0x69, 0xc2, - 0x6f, 0x5f, 0x17, 0x03, 0x01, 0x00, 0x20, 0x5a, - 0xfe, 0x0b, 0xe1, 0x6f, 0xa8, 0x54, 0x19, 0x78, - 0xca, 0xba, 0x2e, 0x1e, 0x2e, 0xe1, 0x5d, 0x17, - 0xe5, 0x97, 0x05, 0x2c, 0x08, 0x0c, 0xff, 0xa8, - 0x59, 0xa9, 0xde, 0x5e, 0x21, 0x34, 0x04, 0x17, - 0x03, 0x01, 0x00, 0x30, 0x86, 0xb1, 0x3f, 0x88, - 0x43, 0xf0, 0x07, 0xee, 0xa8, 0xf4, 0xbc, 0xe7, - 0x5f, 0xc6, 0x8c, 0x86, 0x4c, 0xca, 0x70, 0x88, - 0xcc, 0x6a, 0xb4, 0x3d, 0x40, 0xe8, 0x54, 0x89, - 0x19, 0x43, 0x1f, 0x76, 0xe2, 0xac, 0xb2, 0x5b, - 0x92, 0xf8, 0x57, 0x39, 0x2a, 0xc3, 0x6d, 0x13, - 0x45, 0xfa, 0x36, 0x9e, 0x15, 0x03, 0x01, 0x00, - 0x20, 0x6d, 0xed, 0x7b, 0x59, 0x28, 0x2a, 0x27, - 0x04, 0x15, 0x07, 0x4e, 0xeb, 0x13, 0x00, 0xe3, - 0x3a, 0x3f, 0xf8, 0xaa, 0x2b, 0x3b, 0x1a, 0x8c, - 0x12, 0xd6, 0x4c, 0xec, 0x2a, 0xaf, 0x33, 0x60, - 0xaf, - }, -} - -// Generated using: -// $ go test -test.run TestRunServer -serve -ciphersuites=0xc00a -// $ openssl s_client -host 127.0.0.1 -port 10443 -cipher ECDHE-ECDSA-AES256-SHA -var ecdheECDSAAESServerScript = [][]byte{ - { - 0x16, 0x03, 0x01, 0x00, 0xa0, 0x01, 0x00, 0x00, - 0x9c, 0x03, 0x03, 0x50, 0xd7, 0x18, 0x31, 0x49, - 0xde, 0x19, 0x8d, 0x08, 0x5c, 0x4b, 0x60, 0x67, - 0x0f, 0xfe, 0xd0, 0x62, 0xf9, 0x31, 0x48, 0x17, - 0x9e, 0x50, 0xc1, 0xd8, 0x35, 0x24, 0x0e, 0xa6, - 0x09, 0x06, 0x51, 0x00, 0x00, 0x04, 0xc0, 0x0a, - 0x00, 0xff, 0x01, 0x00, 0x00, 0x6f, 0x00, 0x0b, - 0x00, 0x04, 0x03, 0x00, 0x01, 0x02, 0x00, 0x0a, - 0x00, 0x34, 0x00, 0x32, 0x00, 0x0e, 0x00, 0x0d, - 0x00, 0x19, 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x18, - 0x00, 0x09, 0x00, 0x0a, 0x00, 0x16, 0x00, 0x17, - 0x00, 0x08, 0x00, 0x06, 0x00, 0x07, 0x00, 0x14, - 0x00, 0x15, 0x00, 0x04, 0x00, 0x05, 0x00, 0x12, - 0x00, 0x13, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, - 0x00, 0x0f, 0x00, 0x10, 0x00, 0x11, 0x00, 0x23, - 0x00, 0x00, 0x00, 0x0d, 0x00, 0x22, 0x00, 0x20, - 0x06, 0x01, 0x06, 0x02, 0x06, 0x03, 0x05, 0x01, - 0x05, 0x02, 0x05, 0x03, 0x04, 0x01, 0x04, 0x02, - 0x04, 0x03, 0x03, 0x01, 0x03, 0x02, 0x03, 0x03, - 0x02, 0x01, 0x02, 0x02, 0x02, 0x03, 0x01, 0x01, - 0x00, 0x0f, 0x00, 0x01, 0x01, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x30, 0x02, 0x00, 0x00, - 0x2c, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0a, 0x00, 0x00, - 0x04, 0x00, 0x23, 0x00, 0x00, 0x16, 0x03, 0x01, - 0x02, 0x0e, 0x0b, 0x00, 0x02, 0x0a, 0x00, 0x02, - 0x07, 0x00, 0x02, 0x04, 0x30, 0x82, 0x02, 0x00, - 0x30, 0x82, 0x01, 0x62, 0x02, 0x09, 0x00, 0xb8, - 0xbf, 0x2d, 0x47, 0xa0, 0xd2, 0xeb, 0xf4, 0x30, - 0x09, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, - 0x04, 0x01, 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, - 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, - 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, - 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, - 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, - 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, - 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, - 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, 0x74, - 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, - 0x64, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x32, 0x31, - 0x31, 0x32, 0x32, 0x31, 0x35, 0x30, 0x36, 0x33, - 0x32, 0x5a, 0x17, 0x0d, 0x32, 0x32, 0x31, 0x31, - 0x32, 0x30, 0x31, 0x35, 0x30, 0x36, 0x33, 0x32, - 0x5a, 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, 0x06, - 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, - 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, - 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, 0x30, - 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x18, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, - 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, 0x74, 0x73, - 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, - 0x30, 0x81, 0x9b, 0x30, 0x10, 0x06, 0x07, 0x2a, - 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, - 0x2b, 0x81, 0x04, 0x00, 0x23, 0x03, 0x81, 0x86, - 0x00, 0x04, 0x00, 0xc4, 0xa1, 0xed, 0xbe, 0x98, - 0xf9, 0x0b, 0x48, 0x73, 0x36, 0x7e, 0xc3, 0x16, - 0x56, 0x11, 0x22, 0xf2, 0x3d, 0x53, 0xc3, 0x3b, - 0x4d, 0x21, 0x3d, 0xcd, 0x6b, 0x75, 0xe6, 0xf6, - 0xb0, 0xdc, 0x9a, 0xdf, 0x26, 0xc1, 0xbc, 0xb2, - 0x87, 0xf0, 0x72, 0x32, 0x7c, 0xb3, 0x64, 0x2f, - 0x1c, 0x90, 0xbc, 0xea, 0x68, 0x23, 0x10, 0x7e, - 0xfe, 0xe3, 0x25, 0xc0, 0x48, 0x3a, 0x69, 0xe0, - 0x28, 0x6d, 0xd3, 0x37, 0x00, 0xef, 0x04, 0x62, - 0xdd, 0x0d, 0xa0, 0x9c, 0x70, 0x62, 0x83, 0xd8, - 0x81, 0xd3, 0x64, 0x31, 0xaa, 0x9e, 0x97, 0x31, - 0xbd, 0x96, 0xb0, 0x68, 0xc0, 0x9b, 0x23, 0xde, - 0x76, 0x64, 0x3f, 0x1a, 0x5c, 0x7f, 0xe9, 0x12, - 0x0e, 0x58, 0x58, 0xb6, 0x5f, 0x70, 0xdd, 0x9b, - 0xd8, 0xea, 0xd5, 0xd7, 0xf5, 0xd5, 0xcc, 0xb9, - 0xb6, 0x9f, 0x30, 0x66, 0x5b, 0x66, 0x9a, 0x20, - 0xe2, 0x27, 0xe5, 0xbf, 0xfe, 0x3b, 0x30, 0x09, - 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, - 0x01, 0x03, 0x81, 0x8c, 0x00, 0x30, 0x81, 0x88, - 0x02, 0x42, 0x01, 0x88, 0xa2, 0x4f, 0xeb, 0xe2, - 0x45, 0xc5, 0x48, 0x7d, 0x1b, 0xac, 0xf5, 0xed, - 0x98, 0x9d, 0xae, 0x47, 0x70, 0xc0, 0x5e, 0x1b, - 0xb6, 0x2f, 0xbd, 0xf1, 0xb6, 0x4d, 0xb7, 0x61, - 0x40, 0xd3, 0x11, 0xa2, 0xce, 0xee, 0x0b, 0x7e, - 0x92, 0x7e, 0xff, 0x76, 0x9d, 0xc3, 0x3b, 0x7e, - 0xa5, 0x3f, 0xce, 0xfa, 0x10, 0xe2, 0x59, 0xec, - 0x47, 0x2d, 0x7c, 0xac, 0xda, 0x4e, 0x97, 0x0e, - 0x15, 0xa0, 0x6f, 0xd0, 0x02, 0x42, 0x01, 0x4d, - 0xfc, 0xbe, 0x67, 0x13, 0x9c, 0x2d, 0x05, 0x0e, - 0xbd, 0x3f, 0xa3, 0x8c, 0x25, 0xc1, 0x33, 0x13, - 0x83, 0x0d, 0x94, 0x06, 0xbb, 0xd4, 0x37, 0x7a, - 0xf6, 0xec, 0x7a, 0xc9, 0x86, 0x2e, 0xdd, 0xd7, - 0x11, 0x69, 0x7f, 0x85, 0x7c, 0x56, 0xde, 0xfb, - 0x31, 0x78, 0x2b, 0xe4, 0xc7, 0x78, 0x0d, 0xae, - 0xcb, 0xbe, 0x9e, 0x4e, 0x36, 0x24, 0x31, 0x7b, - 0x6a, 0x0f, 0x39, 0x95, 0x12, 0x07, 0x8f, 0x2a, - 0x16, 0x03, 0x01, 0x01, 0x1a, 0x0c, 0x00, 0x01, - 0x16, 0x03, 0x00, 0x19, 0x85, 0x04, 0x01, 0x39, - 0xdc, 0xee, 0x44, 0x17, 0x5e, 0xdb, 0xd7, 0x27, - 0xaf, 0xb6, 0x56, 0xd9, 0xb4, 0x43, 0x5a, 0x99, - 0xcf, 0xaa, 0x31, 0x37, 0x0c, 0x6f, 0x3a, 0xa0, - 0xf8, 0x53, 0xc4, 0x74, 0xd1, 0x91, 0x0a, 0x46, - 0xf5, 0x38, 0x3b, 0x5c, 0x09, 0xd8, 0x97, 0xdc, - 0x4b, 0xaa, 0x70, 0x26, 0x48, 0xf2, 0xd6, 0x0b, - 0x31, 0xc9, 0xf8, 0xd4, 0x98, 0x43, 0xe1, 0x6c, - 0xd5, 0xc7, 0xb2, 0x8e, 0x0b, 0x01, 0xe6, 0xb6, - 0x00, 0x28, 0x80, 0x7b, 0xfc, 0x96, 0x8f, 0x0d, - 0xa2, 0x4f, 0xb0, 0x79, 0xaf, 0xdc, 0x61, 0x28, - 0x63, 0x33, 0x78, 0xf6, 0x31, 0x39, 0xfd, 0x8a, - 0xf4, 0x15, 0x18, 0x11, 0xfe, 0xdb, 0xd5, 0x07, - 0xda, 0x2c, 0xed, 0x49, 0xa0, 0x23, 0xbf, 0xd0, - 0x3a, 0x38, 0x1d, 0x54, 0xae, 0x1c, 0x7b, 0xea, - 0x29, 0xee, 0xd0, 0x38, 0xc1, 0x76, 0xa7, 0x7f, - 0x2a, 0xf4, 0xce, 0x1e, 0xac, 0xcc, 0x94, 0x79, - 0x90, 0x33, 0x00, 0x8b, 0x30, 0x81, 0x88, 0x02, - 0x42, 0x00, 0xc6, 0x85, 0x8e, 0x06, 0xb7, 0x04, - 0x04, 0xe9, 0xcd, 0x9e, 0x3e, 0xcb, 0x66, 0x23, - 0x95, 0xb4, 0x42, 0x9c, 0x64, 0x81, 0x39, 0x05, - 0x3f, 0xb5, 0x21, 0xf8, 0x28, 0xaf, 0x60, 0x6b, - 0x4d, 0x3d, 0xba, 0xa1, 0x4b, 0x5e, 0x77, 0xef, - 0xe7, 0x59, 0x28, 0xfe, 0x1d, 0xc1, 0x27, 0xa2, - 0xff, 0xa8, 0xde, 0x33, 0x48, 0xb3, 0xc1, 0x85, - 0x6a, 0x42, 0x9b, 0xf9, 0x7e, 0x7e, 0x31, 0xc2, - 0xe5, 0xbd, 0x66, 0x02, 0x42, 0x00, 0xad, 0x7d, - 0x06, 0x35, 0xab, 0xec, 0x8d, 0xac, 0xd4, 0xba, - 0x1b, 0x49, 0x5e, 0x05, 0x5f, 0xf0, 0x97, 0x93, - 0x82, 0xb8, 0x2b, 0x8d, 0x91, 0x98, 0x63, 0x8e, - 0xb4, 0x14, 0x62, 0xdb, 0x1e, 0xc9, 0x2b, 0x30, - 0xf8, 0x41, 0x9b, 0xa6, 0xe6, 0xbc, 0xde, 0x0e, - 0x68, 0x30, 0x22, 0x50, 0xe6, 0x98, 0x97, 0x7b, - 0x69, 0xf7, 0x93, 0xed, 0xcd, 0x19, 0x2f, 0x44, - 0x6c, 0x2e, 0xdf, 0x25, 0xee, 0xcc, 0x46, 0x16, - 0x03, 0x01, 0x00, 0x04, 0x0e, 0x00, 0x00, 0x00, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x8a, 0x10, 0x00, 0x00, - 0x86, 0x85, 0x04, 0x00, 0x1c, 0xc5, 0xe8, 0xb3, - 0x42, 0xb4, 0xad, 0xca, 0x45, 0xcd, 0x42, 0x7b, - 0xfb, 0x0c, 0xea, 0x32, 0x26, 0xd4, 0x8a, 0xef, - 0xdf, 0xc9, 0xff, 0xd2, 0xe0, 0x36, 0xea, 0x4e, - 0xbb, 0x3e, 0xf4, 0x9c, 0x76, 0x4f, 0x44, 0xbd, - 0x84, 0x72, 0xdd, 0xcb, 0xe5, 0x28, 0x8d, 0x31, - 0x72, 0x3b, 0xd3, 0xf2, 0x9a, 0x13, 0xfb, 0x8a, - 0xa7, 0x72, 0xca, 0x21, 0x6c, 0xea, 0xbf, 0xe9, - 0x8c, 0x0a, 0xcc, 0x8f, 0xd6, 0x00, 0x20, 0x87, - 0xf3, 0x7d, 0x18, 0xc5, 0xfd, 0x9e, 0xdd, 0x6b, - 0x06, 0xdc, 0x52, 0xeb, 0x14, 0xc0, 0x67, 0x5a, - 0x06, 0xd8, 0x98, 0x19, 0x14, 0xe7, 0xd4, 0x36, - 0x32, 0xee, 0xb7, 0xfa, 0xe2, 0x85, 0x4a, 0x16, - 0x42, 0x0c, 0xa6, 0x21, 0xcf, 0x1f, 0xae, 0x10, - 0x8b, 0x28, 0x32, 0x19, 0xa4, 0x0a, 0xd7, 0xce, - 0xe6, 0xe1, 0x93, 0xfb, 0x5f, 0x08, 0x8b, 0x42, - 0xa2, 0x20, 0xed, 0x0d, 0x62, 0xca, 0xed, 0x14, - 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, 0x01, - 0x00, 0x30, 0x2e, 0x33, 0xc0, 0x57, 0x6c, 0xb4, - 0x1b, 0xd2, 0x63, 0xe8, 0x67, 0x10, 0x2d, 0x87, - 0x71, 0x6e, 0x19, 0x60, 0xf4, 0xa4, 0x10, 0x52, - 0x73, 0x2d, 0x09, 0x5e, 0xdb, 0x6c, 0xdc, 0xcf, - 0x2d, 0xff, 0x03, 0x11, 0x95, 0x76, 0x90, 0xd7, - 0x87, 0x54, 0x43, 0xed, 0xc2, 0x36, 0x69, 0x14, - 0x72, 0x4a, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x72, 0x04, 0x00, 0x00, - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, - 0xe8, 0x8b, 0xde, 0xef, 0xba, 0xc5, 0x7e, 0x04, - 0xab, 0xfd, 0x79, 0x56, 0xf3, 0xe1, 0xa5, 0x3e, - 0x02, 0xdf, 0x69, 0x6d, 0x1f, 0x41, 0x9f, 0xbc, - 0x93, 0xe2, 0x6c, 0xf1, 0xb1, 0x38, 0xf5, 0x2b, - 0x8c, 0x4c, 0xf4, 0x74, 0xe1, 0x79, 0x35, 0x34, - 0x97, 0x9b, 0xd5, 0xba, 0xfd, 0xf7, 0x2f, 0x2d, - 0x9e, 0x84, 0x54, 0xee, 0x77, 0x59, 0x23, 0x8f, - 0xc8, 0x84, 0xb4, 0xd6, 0xea, 0x4c, 0x44, 0x8a, - 0xc6, 0x9c, 0xf9, 0x9b, 0x27, 0xea, 0x4f, 0x28, - 0x72, 0x33, 0x12, 0x20, 0x7c, 0xd7, 0x3f, 0x56, - 0xa6, 0x76, 0xc7, 0x48, 0xe4, 0x2d, 0x6f, 0x14, - 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, 0x01, - 0x00, 0x30, 0x36, 0xe3, 0xd4, 0xf7, 0xb1, 0x69, - 0x18, 0x8d, 0x09, 0xba, 0x52, 0x1e, 0xd5, 0x7d, - 0x2c, 0x15, 0x3a, 0xd6, 0xe3, 0x99, 0x30, 0x2c, - 0x99, 0x97, 0xbc, 0x19, 0x3c, 0x63, 0xa1, 0x25, - 0x68, 0xbc, 0x8a, 0x16, 0x47, 0xec, 0xae, 0x13, - 0xa4, 0x03, 0x96, 0x29, 0x11, 0x92, 0x90, 0x1a, - 0xc8, 0xa4, 0x17, 0x03, 0x01, 0x00, 0x20, 0xc1, - 0x10, 0x1d, 0xa6, 0xf1, 0xe2, 0x8a, 0xcc, 0x37, - 0x7d, 0x8e, 0x05, 0x00, 0xfb, 0xd1, 0x9f, 0xc7, - 0x11, 0xd2, 0x00, 0xb4, 0x27, 0x0a, 0x25, 0x14, - 0xd9, 0x79, 0x1b, 0xcb, 0x4d, 0x81, 0x61, 0x17, - 0x03, 0x01, 0x00, 0x30, 0x5c, 0x7c, 0x2d, 0xc0, - 0x9e, 0xa6, 0xc4, 0x8e, 0xfd, 0xf4, 0xe2, 0xe5, - 0xe4, 0xe6, 0x56, 0x9f, 0x7d, 0x4c, 0x4c, 0x2d, - 0xb7, 0xa9, 0xac, 0xfa, 0x9f, 0x12, 0x7f, 0x2d, - 0x30, 0x57, 0xe4, 0x8e, 0x30, 0x86, 0x65, 0x59, - 0xcd, 0x24, 0xda, 0xe2, 0x8a, 0x7b, 0x0c, 0x5e, - 0x86, 0x05, 0x06, 0x2a, 0x15, 0x03, 0x01, 0x00, - 0x20, 0xd6, 0xb7, 0x70, 0xf8, 0x47, 0xbc, 0x0f, - 0xf4, 0x66, 0x98, 0x1b, 0x1e, 0x8a, 0x8c, 0x0b, - 0xa1, 0x4a, 0x04, 0x29, 0x60, 0x72, 0x8b, 0xc4, - 0x73, 0xc1, 0xd6, 0x41, 0x72, 0xb7, 0x17, 0x39, - 0xda, - }, -} - -var sslv3ServerScript = [][]byte{ - { - 0x16, 0x03, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, - 0x50, 0x03, 0x00, 0x50, 0x77, 0x3d, 0x42, 0xae, - 0x84, 0xbd, 0xc5, 0x07, 0xa5, 0xc4, 0xd6, 0x16, - 0x4e, 0xd5, 0xc5, 0xfa, 0x02, 0x7a, 0x0f, 0x1d, - 0xc1, 0xe1, 0xaa, 0xe3, 0x3b, 0x4b, 0x6f, 0x11, - 0xfa, 0x1a, 0xa4, 0x00, 0x00, 0x28, 0x00, 0x39, - 0x00, 0x38, 0x00, 0x35, 0x00, 0x16, 0x00, 0x13, - 0x00, 0x0a, 0x00, 0x33, 0x00, 0x32, 0x00, 0x2f, - 0x00, 0x05, 0x00, 0x04, 0x00, 0x15, 0x00, 0x12, - 0x00, 0x09, 0x00, 0x14, 0x00, 0x11, 0x00, 0x08, - 0x00, 0x06, 0x00, 0x03, 0x00, 0xff, 0x02, 0x01, - 0x00, - }, - { - 0x16, 0x03, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, - 0x26, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x16, - 0x03, 0x00, 0x02, 0xbe, 0x0b, 0x00, 0x02, 0xba, - 0x00, 0x02, 0xb7, 0x00, 0x02, 0xb4, 0x30, 0x82, - 0x02, 0xb0, 0x30, 0x82, 0x02, 0x19, 0xa0, 0x03, - 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0x85, 0xb0, - 0xbb, 0xa4, 0x8a, 0x7f, 0xb8, 0xca, 0x30, 0x0d, - 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, - 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x30, 0x1e, 0x17, 0x0d, - 0x31, 0x30, 0x30, 0x34, 0x32, 0x34, 0x30, 0x39, - 0x30, 0x39, 0x33, 0x38, 0x5a, 0x17, 0x0d, 0x31, - 0x31, 0x30, 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, - 0x39, 0x33, 0x38, 0x5a, 0x30, 0x45, 0x31, 0x0b, - 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, - 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, - 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, - 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, - 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, - 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, - 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, - 0x4c, 0x74, 0x64, 0x30, 0x81, 0x9f, 0x30, 0x0d, - 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, - 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, - 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, - 0xbb, 0x79, 0xd6, 0xf5, 0x17, 0xb5, 0xe5, 0xbf, - 0x46, 0x10, 0xd0, 0xdc, 0x69, 0xbe, 0xe6, 0x2b, - 0x07, 0x43, 0x5a, 0xd0, 0x03, 0x2d, 0x8a, 0x7a, - 0x43, 0x85, 0xb7, 0x14, 0x52, 0xe7, 0xa5, 0x65, - 0x4c, 0x2c, 0x78, 0xb8, 0x23, 0x8c, 0xb5, 0xb4, - 0x82, 0xe5, 0xde, 0x1f, 0x95, 0x3b, 0x7e, 0x62, - 0xa5, 0x2c, 0xa5, 0x33, 0xd6, 0xfe, 0x12, 0x5c, - 0x7a, 0x56, 0xfc, 0xf5, 0x06, 0xbf, 0xfa, 0x58, - 0x7b, 0x26, 0x3f, 0xb5, 0xcd, 0x04, 0xd3, 0xd0, - 0xc9, 0x21, 0x96, 0x4a, 0xc7, 0xf4, 0x54, 0x9f, - 0x5a, 0xbf, 0xef, 0x42, 0x71, 0x00, 0xfe, 0x18, - 0x99, 0x07, 0x7f, 0x7e, 0x88, 0x7d, 0x7d, 0xf1, - 0x04, 0x39, 0xc4, 0xa2, 0x2e, 0xdb, 0x51, 0xc9, - 0x7c, 0xe3, 0xc0, 0x4c, 0x3b, 0x32, 0x66, 0x01, - 0xcf, 0xaf, 0xb1, 0x1d, 0xb8, 0x71, 0x9a, 0x1d, - 0xdb, 0xdb, 0x89, 0x6b, 0xae, 0xda, 0x2d, 0x79, - 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81, 0xa7, - 0x30, 0x81, 0xa4, 0x30, 0x1d, 0x06, 0x03, 0x55, - 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xb1, 0xad, - 0xe2, 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, - 0xce, 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, - 0x88, 0x39, 0x30, 0x75, 0x06, 0x03, 0x55, 0x1d, - 0x23, 0x04, 0x6e, 0x30, 0x6c, 0x80, 0x14, 0xb1, - 0xad, 0xe2, 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb, - 0x69, 0xce, 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e, - 0x18, 0x88, 0x39, 0xa1, 0x49, 0xa4, 0x47, 0x30, - 0x45, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, - 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, - 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, - 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, - 0x03, 0x55, 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, - 0x69, 0x64, 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, - 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, 0x82, 0x09, - 0x00, 0x85, 0xb0, 0xbb, 0xa4, 0x8a, 0x7f, 0xb8, - 0xca, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, - 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, - 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x81, - 0x81, 0x00, 0x08, 0x6c, 0x45, 0x24, 0xc7, 0x6b, - 0xb1, 0x59, 0xab, 0x0c, 0x52, 0xcc, 0xf2, 0xb0, - 0x14, 0xd7, 0x87, 0x9d, 0x7a, 0x64, 0x75, 0xb5, - 0x5a, 0x95, 0x66, 0xe4, 0xc5, 0x2b, 0x8e, 0xae, - 0x12, 0x66, 0x1f, 0xeb, 0x4f, 0x38, 0xb3, 0x6e, - 0x60, 0xd3, 0x92, 0xfd, 0xf7, 0x41, 0x08, 0xb5, - 0x25, 0x13, 0xb1, 0x18, 0x7a, 0x24, 0xfb, 0x30, - 0x1d, 0xba, 0xed, 0x98, 0xb9, 0x17, 0xec, 0xe7, - 0xd7, 0x31, 0x59, 0xdb, 0x95, 0xd3, 0x1d, 0x78, - 0xea, 0x50, 0x56, 0x5c, 0xd5, 0x82, 0x5a, 0x2d, - 0x5a, 0x5f, 0x33, 0xc4, 0xb6, 0xd8, 0xc9, 0x75, - 0x90, 0x96, 0x8c, 0x0f, 0x52, 0x98, 0xb5, 0xcd, - 0x98, 0x1f, 0x89, 0x20, 0x5f, 0xf2, 0xa0, 0x1c, - 0xa3, 0x1b, 0x96, 0x94, 0xdd, 0xa9, 0xfd, 0x57, - 0xe9, 0x70, 0xe8, 0x26, 0x6d, 0x71, 0x99, 0x9b, - 0x26, 0x6e, 0x38, 0x50, 0x29, 0x6c, 0x90, 0xa7, - 0xbd, 0xd9, 0x16, 0x03, 0x00, 0x00, 0x04, 0x0e, - 0x00, 0x00, 0x00, - }, - { - 0x16, 0x03, 0x00, 0x00, 0x84, 0x10, 0x00, 0x00, - 0x80, 0x4a, 0x8d, 0xc4, 0x38, 0x7a, 0x9c, 0xd6, - 0xe8, 0x72, 0x9e, 0xa3, 0xdf, 0x37, 0xb4, 0x6c, - 0x58, 0x33, 0x59, 0xd9, 0xc9, 0x4b, 0x50, 0x33, - 0x6c, 0xed, 0x73, 0x38, 0x2a, 0x46, 0x55, 0x31, - 0xa9, 0x8e, 0x8e, 0xfc, 0x0b, 0x5d, 0x5f, 0x3c, - 0x88, 0x28, 0x3f, 0x60, 0x51, 0x13, 0xf1, 0x59, - 0x0c, 0xa3, 0x5e, 0xe0, 0xa3, 0x35, 0x06, 0xb1, - 0x71, 0x59, 0x24, 0x4e, 0xed, 0x07, 0x15, 0x88, - 0x50, 0xef, 0xc2, 0xb2, 0x2a, 0x52, 0x30, 0x6a, - 0x7c, 0xbe, 0x2f, 0xc6, 0x8f, 0xa8, 0x83, 0xc5, - 0x80, 0x14, 0x62, 0x74, 0x7f, 0x96, 0x9f, 0x41, - 0x32, 0x74, 0xdd, 0x76, 0x2d, 0x7b, 0xeb, 0x7b, - 0xea, 0xd0, 0x4f, 0x0c, 0xcf, 0x9a, 0x9c, 0xc5, - 0x7a, 0xe4, 0xbc, 0xf8, 0xa6, 0xe1, 0x09, 0x8e, - 0x7c, 0x53, 0x3a, 0xe3, 0x30, 0x8f, 0x76, 0xee, - 0x58, 0xbb, 0xfd, 0x0b, 0x06, 0xb8, 0xdf, 0xb7, - 0x31, 0x14, 0x03, 0x00, 0x00, 0x01, 0x01, 0x16, - 0x03, 0x00, 0x00, 0x3c, 0x13, 0x91, 0xc6, 0x4a, - 0x0c, 0x59, 0x25, 0xce, 0x54, 0xc0, 0x1d, 0xb9, - 0x2a, 0xff, 0x4d, 0xca, 0x26, 0x0c, 0x8c, 0x04, - 0x98, 0x7c, 0x7c, 0x38, 0xa3, 0xf5, 0xf9, 0x36, - 0x1c, 0x04, 0x32, 0x47, 0x2d, 0x48, 0x0e, 0x96, - 0xe8, 0x2b, 0x5e, 0x5a, 0xc6, 0x0a, 0x48, 0x41, - 0x34, 0x5e, 0x62, 0xd5, 0x68, 0x4e, 0x44, 0x1d, - 0xb2, 0xa1, 0x11, 0xad, 0x6e, 0x14, 0x85, 0x61, - }, - { - 0x14, 0x03, 0x00, 0x00, 0x01, 0x01, 0x16, 0x03, - 0x00, 0x00, 0x3c, 0x88, 0xae, 0xa9, 0xd4, 0xa8, - 0x10, 0x8d, 0x65, 0xa6, 0x3e, 0x1e, 0xed, 0xd2, - 0xfc, 0xc4, 0x7c, 0xa8, 0x94, 0x4f, 0x11, 0xaf, - 0xa6, 0x87, 0x09, 0x37, 0x54, 0xf7, 0x69, 0xd1, - 0xb5, 0x25, 0x6b, 0xb5, 0xed, 0xcb, 0x25, 0x39, - 0x73, 0xeb, 0x53, 0x6c, 0xc7, 0xb4, 0x29, 0x8f, - 0xd6, 0x49, 0xd1, 0x95, 0x59, 0x80, 0x9a, 0x67, - 0x5c, 0xb2, 0xe0, 0xbd, 0x1e, 0xff, 0xaa, 0x17, - 0x03, 0x00, 0x00, 0x21, 0x65, 0x7b, 0x99, 0x09, - 0x02, 0xc3, 0x9d, 0x54, 0xd6, 0xe7, 0x32, 0x62, - 0xab, 0xc1, 0x09, 0x91, 0x30, 0x0a, 0xc9, 0xfa, - 0x70, 0xec, 0x06, 0x7b, 0xa3, 0xe1, 0x5f, 0xb4, - 0x63, 0xe6, 0x5c, 0xba, 0x1f, 0x15, 0x03, 0x00, - 0x00, 0x16, 0x40, 0x70, 0xbe, 0xe6, 0xa6, 0xee, - 0x8f, 0xd0, 0x87, 0xa0, 0x43, 0xa1, 0x92, 0xd7, - 0xd0, 0x1a, 0x0c, 0x20, 0x7c, 0xbf, 0xa2, 0xb5, - }, -} - -var selectCertificateBySNIScript = [][]byte{ - { - 0x16, 0x03, 0x01, 0x00, 0x6a, 0x01, 0x00, 0x00, - 0x66, 0x03, 0x01, 0x50, 0x77, 0x3d, 0xfe, 0xfb, - 0x8d, 0xc2, 0x68, 0xeb, 0xf9, 0xfa, 0x54, 0x97, - 0x86, 0x45, 0xa2, 0xa3, 0xed, 0xb1, 0x91, 0xb8, - 0x28, 0xc0, 0x47, 0xaf, 0xfb, 0xcd, 0xdc, 0x0e, - 0xb3, 0xea, 0xa5, 0x00, 0x00, 0x28, 0x00, 0x39, - 0x00, 0x38, 0x00, 0x35, 0x00, 0x16, 0x00, 0x13, - 0x00, 0x0a, 0x00, 0x33, 0x00, 0x32, 0x00, 0x2f, - 0x00, 0x05, 0x00, 0x04, 0x00, 0x15, 0x00, 0x12, - 0x00, 0x09, 0x00, 0x14, 0x00, 0x11, 0x00, 0x08, - 0x00, 0x06, 0x00, 0x03, 0x00, 0xff, 0x02, 0x01, - 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, - 0x0e, 0x00, 0x00, 0x0b, 0x73, 0x6e, 0x69, 0x74, - 0x65, 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x2a, 0x02, 0x00, 0x00, - 0x26, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x16, - 0x03, 0x01, 0x02, 0x00, 0x0b, 0x00, 0x01, 0xfc, - 0x00, 0x01, 0xf9, 0x00, 0x01, 0xf6, 0x30, 0x82, - 0x01, 0xf2, 0x30, 0x82, 0x01, 0x5d, 0xa0, 0x03, - 0x02, 0x01, 0x02, 0x02, 0x01, 0x00, 0x30, 0x0b, - 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, - 0x01, 0x01, 0x05, 0x30, 0x28, 0x31, 0x10, 0x30, - 0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x07, - 0x41, 0x63, 0x6d, 0x65, 0x20, 0x43, 0x6f, 0x31, - 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x03, - 0x13, 0x0b, 0x73, 0x6e, 0x69, 0x74, 0x65, 0x73, - 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17, - 0x0d, 0x31, 0x32, 0x30, 0x34, 0x31, 0x31, 0x31, - 0x37, 0x34, 0x30, 0x33, 0x35, 0x5a, 0x17, 0x0d, - 0x31, 0x33, 0x30, 0x34, 0x31, 0x31, 0x31, 0x37, - 0x34, 0x35, 0x33, 0x35, 0x5a, 0x30, 0x28, 0x31, - 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, - 0x13, 0x07, 0x41, 0x63, 0x6d, 0x65, 0x20, 0x43, - 0x6f, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, - 0x04, 0x03, 0x13, 0x0b, 0x73, 0x6e, 0x69, 0x74, - 0x65, 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x30, - 0x81, 0x9d, 0x30, 0x0b, 0x06, 0x09, 0x2a, 0x86, - 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x03, - 0x81, 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, - 0x81, 0x00, 0xbb, 0x79, 0xd6, 0xf5, 0x17, 0xb5, - 0xe5, 0xbf, 0x46, 0x10, 0xd0, 0xdc, 0x69, 0xbe, - 0xe6, 0x2b, 0x07, 0x43, 0x5a, 0xd0, 0x03, 0x2d, - 0x8a, 0x7a, 0x43, 0x85, 0xb7, 0x14, 0x52, 0xe7, - 0xa5, 0x65, 0x4c, 0x2c, 0x78, 0xb8, 0x23, 0x8c, - 0xb5, 0xb4, 0x82, 0xe5, 0xde, 0x1f, 0x95, 0x3b, - 0x7e, 0x62, 0xa5, 0x2c, 0xa5, 0x33, 0xd6, 0xfe, - 0x12, 0x5c, 0x7a, 0x56, 0xfc, 0xf5, 0x06, 0xbf, - 0xfa, 0x58, 0x7b, 0x26, 0x3f, 0xb5, 0xcd, 0x04, - 0xd3, 0xd0, 0xc9, 0x21, 0x96, 0x4a, 0xc7, 0xf4, - 0x54, 0x9f, 0x5a, 0xbf, 0xef, 0x42, 0x71, 0x00, - 0xfe, 0x18, 0x99, 0x07, 0x7f, 0x7e, 0x88, 0x7d, - 0x7d, 0xf1, 0x04, 0x39, 0xc4, 0xa2, 0x2e, 0xdb, - 0x51, 0xc9, 0x7c, 0xe3, 0xc0, 0x4c, 0x3b, 0x32, - 0x66, 0x01, 0xcf, 0xaf, 0xb1, 0x1d, 0xb8, 0x71, - 0x9a, 0x1d, 0xdb, 0xdb, 0x89, 0x6b, 0xae, 0xda, - 0x2d, 0x79, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, - 0x32, 0x30, 0x30, 0x30, 0x0e, 0x06, 0x03, 0x55, - 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, - 0x02, 0x00, 0xa0, 0x30, 0x0d, 0x06, 0x03, 0x55, - 0x1d, 0x0e, 0x04, 0x06, 0x04, 0x04, 0x01, 0x02, - 0x03, 0x04, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, - 0x23, 0x04, 0x08, 0x30, 0x06, 0x80, 0x04, 0x01, - 0x02, 0x03, 0x04, 0x30, 0x0b, 0x06, 0x09, 0x2a, - 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, - 0x03, 0x81, 0x81, 0x00, 0x89, 0xc6, 0x45, 0x5f, - 0x1c, 0x1f, 0x5e, 0xf8, 0xeb, 0x1a, 0xb1, 0x74, - 0xee, 0x24, 0x39, 0x05, 0x9f, 0x5c, 0x42, 0x59, - 0xbb, 0x1a, 0x8d, 0x86, 0xcd, 0xb1, 0xd0, 0x56, - 0xf5, 0x6a, 0x71, 0x7d, 0xa4, 0x0e, 0x95, 0xab, - 0x90, 0xf5, 0x9e, 0x8d, 0xea, 0xf6, 0x27, 0xc1, - 0x57, 0x99, 0x50, 0x94, 0xdb, 0x08, 0x02, 0x26, - 0x6e, 0xb3, 0x4f, 0xc6, 0x84, 0x2d, 0xea, 0x8a, - 0x4b, 0x68, 0xd9, 0xc1, 0x38, 0x91, 0x03, 0xab, - 0x84, 0xfb, 0x9e, 0x1f, 0x85, 0xd9, 0xb5, 0xd2, - 0x3f, 0xf2, 0x31, 0x2c, 0x86, 0x70, 0xfb, 0xb5, - 0x40, 0x14, 0x82, 0x45, 0xa4, 0xeb, 0xaf, 0xe2, - 0x64, 0xd9, 0x0c, 0x8a, 0x4c, 0xf4, 0xf8, 0x5b, - 0x0f, 0xac, 0x12, 0xac, 0x2f, 0xc4, 0xa3, 0x15, - 0x4b, 0xad, 0x52, 0x46, 0x28, 0x68, 0xaf, 0x96, - 0xc6, 0x2c, 0x65, 0x25, 0xd6, 0x52, 0xb6, 0xe3, - 0x18, 0x45, 0xbd, 0xcc, 0x16, 0x03, 0x01, 0x00, - 0x04, 0x0e, 0x00, 0x00, 0x00, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x86, 0x10, 0x00, 0x00, - 0x82, 0x00, 0x80, 0x69, 0xc3, 0xd4, 0x0e, 0xcc, - 0xdc, 0xbc, 0x5e, 0xc2, 0x64, 0xa6, 0xde, 0x3c, - 0x0c, 0x7e, 0x0c, 0x6b, 0x80, 0x0f, 0xd4, 0x8f, - 0x02, 0x4b, 0xb2, 0xba, 0x8d, 0x01, 0xeb, 0x6b, - 0xa1, 0x2e, 0x79, 0x37, 0xba, 0xae, 0x24, 0xc2, - 0x26, 0x72, 0x51, 0xe1, 0x82, 0x8e, 0x51, 0x41, - 0x1c, 0x54, 0xa4, 0x26, 0xbe, 0x13, 0xcd, 0x1b, - 0xc6, 0xed, 0x3d, 0x1f, 0xfd, 0x72, 0x80, 0x90, - 0xdb, 0xbf, 0xd6, 0x39, 0x94, 0x5f, 0x48, 0xfb, - 0x25, 0x5a, 0xc9, 0x60, 0x9b, 0xd7, 0xc6, 0x20, - 0xa8, 0x66, 0x64, 0x13, 0xf3, 0x65, 0xc8, 0xb1, - 0xd5, 0x33, 0x21, 0x0e, 0x73, 0x41, 0xc0, 0x18, - 0x1a, 0x37, 0xfe, 0xcf, 0x28, 0x2a, 0xcd, 0xe4, - 0x0b, 0xac, 0xdd, 0x25, 0x5e, 0xcb, 0x17, 0x51, - 0x69, 0xd5, 0x8c, 0xf4, 0xb6, 0x21, 0x98, 0xef, - 0x20, 0xdb, 0x14, 0x67, 0xf3, 0x7c, 0x95, 0x6a, - 0x48, 0x2a, 0x6a, 0x14, 0x03, 0x01, 0x00, 0x01, - 0x01, 0x16, 0x03, 0x01, 0x00, 0x24, 0x36, 0x1b, - 0x09, 0xe5, 0xb9, 0xb9, 0x4d, 0x7d, 0xae, 0x87, - 0xb6, 0x0f, 0xaf, 0xec, 0x22, 0xba, 0x0d, 0xa5, - 0x96, 0x5e, 0x64, 0x65, 0xe7, 0xfb, 0xe3, 0xf3, - 0x6b, 0x72, 0xa8, 0xdb, 0xed, 0xd8, 0x69, 0x9c, - 0x08, 0xd8, - }, - { - 0x14, 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, - 0x01, 0x00, 0x24, 0x60, 0xf7, 0x09, 0x5f, 0xd1, - 0xcb, 0xc9, 0xe1, 0x22, 0xb5, 0x2a, 0xcc, 0xde, - 0x7c, 0xa7, 0xb8, 0x85, 0x00, 0xbc, 0xfd, 0x85, - 0xe1, 0x91, 0x36, 0xbb, 0x07, 0x42, 0xad, 0x3d, - 0x29, 0x62, 0x69, 0xc1, 0x45, 0x92, 0x6f, 0x17, - 0x03, 0x01, 0x00, 0x21, 0x0d, 0xf9, 0xd5, 0x87, - 0xb9, 0x57, 0x3c, 0x50, 0x19, 0xe4, 0x3a, 0x50, - 0x45, 0xcc, 0x86, 0x89, 0xd4, 0x32, 0x79, 0x45, - 0x7c, 0x9f, 0x96, 0xd4, 0x54, 0x56, 0x0c, 0x63, - 0x72, 0x81, 0xc3, 0xd3, 0xe3, 0x15, 0x03, 0x01, - 0x00, 0x16, 0x84, 0xec, 0x2e, 0xf6, 0xaf, 0x4f, - 0xee, 0x48, 0x0f, 0xbe, 0xcd, 0x82, 0x5c, 0x56, - 0x16, 0xe4, 0xfb, 0x89, 0xc5, 0x57, 0x3e, 0x91, - }, -} - -var issueSessionTicketTest = [][]byte{ - { - 0x16, 0x03, 0x01, 0x00, 0x5a, 0x01, 0x00, 0x00, - 0x56, 0x03, 0x01, 0x50, 0x77, 0x3e, 0x49, 0x7a, - 0xb7, 0x86, 0x5c, 0x27, 0xd2, 0x97, 0x61, 0xe3, - 0x49, 0x41, 0x48, 0xe7, 0x0e, 0xaa, 0x7e, 0x4d, - 0xb8, 0xdc, 0x01, 0x97, 0xfb, 0xab, 0x53, 0xb2, - 0x5e, 0x36, 0xf6, 0x00, 0x00, 0x28, 0x00, 0x39, - 0x00, 0x38, 0x00, 0x35, 0x00, 0x16, 0x00, 0x13, - 0x00, 0x0a, 0x00, 0x33, 0x00, 0x32, 0x00, 0x2f, - 0x00, 0x05, 0x00, 0x04, 0x00, 0x15, 0x00, 0x12, - 0x00, 0x09, 0x00, 0x14, 0x00, 0x11, 0x00, 0x08, - 0x00, 0x06, 0x00, 0x03, 0x00, 0xff, 0x02, 0x01, - 0x00, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x30, 0x02, 0x00, 0x00, - 0x2c, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, - 0x04, 0x00, 0x23, 0x00, 0x00, 0x16, 0x03, 0x01, - 0x02, 0xbe, 0x0b, 0x00, 0x02, 0xba, 0x00, 0x02, - 0xb7, 0x00, 0x02, 0xb4, 0x30, 0x82, 0x02, 0xb0, - 0x30, 0x82, 0x02, 0x19, 0xa0, 0x03, 0x02, 0x01, - 0x02, 0x02, 0x09, 0x00, 0x85, 0xb0, 0xbb, 0xa4, - 0x8a, 0x7f, 0xb8, 0xca, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x05, 0x05, 0x00, 0x30, 0x45, 0x31, 0x0b, 0x30, - 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, - 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, - 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, - 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, - 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, - 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, - 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, - 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, - 0x74, 0x64, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30, - 0x30, 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, 0x39, - 0x33, 0x38, 0x5a, 0x17, 0x0d, 0x31, 0x31, 0x30, - 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, 0x39, 0x33, - 0x38, 0x5a, 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, - 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, - 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, - 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, - 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, - 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, - 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, - 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, 0x74, - 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, - 0x64, 0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, - 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xbb, 0x79, - 0xd6, 0xf5, 0x17, 0xb5, 0xe5, 0xbf, 0x46, 0x10, - 0xd0, 0xdc, 0x69, 0xbe, 0xe6, 0x2b, 0x07, 0x43, - 0x5a, 0xd0, 0x03, 0x2d, 0x8a, 0x7a, 0x43, 0x85, - 0xb7, 0x14, 0x52, 0xe7, 0xa5, 0x65, 0x4c, 0x2c, - 0x78, 0xb8, 0x23, 0x8c, 0xb5, 0xb4, 0x82, 0xe5, - 0xde, 0x1f, 0x95, 0x3b, 0x7e, 0x62, 0xa5, 0x2c, - 0xa5, 0x33, 0xd6, 0xfe, 0x12, 0x5c, 0x7a, 0x56, - 0xfc, 0xf5, 0x06, 0xbf, 0xfa, 0x58, 0x7b, 0x26, - 0x3f, 0xb5, 0xcd, 0x04, 0xd3, 0xd0, 0xc9, 0x21, - 0x96, 0x4a, 0xc7, 0xf4, 0x54, 0x9f, 0x5a, 0xbf, - 0xef, 0x42, 0x71, 0x00, 0xfe, 0x18, 0x99, 0x07, - 0x7f, 0x7e, 0x88, 0x7d, 0x7d, 0xf1, 0x04, 0x39, - 0xc4, 0xa2, 0x2e, 0xdb, 0x51, 0xc9, 0x7c, 0xe3, - 0xc0, 0x4c, 0x3b, 0x32, 0x66, 0x01, 0xcf, 0xaf, - 0xb1, 0x1d, 0xb8, 0x71, 0x9a, 0x1d, 0xdb, 0xdb, - 0x89, 0x6b, 0xae, 0xda, 0x2d, 0x79, 0x02, 0x03, - 0x01, 0x00, 0x01, 0xa3, 0x81, 0xa7, 0x30, 0x81, - 0xa4, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, - 0x04, 0x16, 0x04, 0x14, 0xb1, 0xad, 0xe2, 0x85, - 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, 0xce, 0x23, - 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, 0x88, 0x39, - 0x30, 0x75, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, - 0x6e, 0x30, 0x6c, 0x80, 0x14, 0xb1, 0xad, 0xe2, - 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, 0xce, - 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, 0x88, - 0x39, 0xa1, 0x49, 0xa4, 0x47, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x82, 0x09, 0x00, 0x85, - 0xb0, 0xbb, 0xa4, 0x8a, 0x7f, 0xb8, 0xca, 0x30, - 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, - 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x01, 0x05, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, - 0x08, 0x6c, 0x45, 0x24, 0xc7, 0x6b, 0xb1, 0x59, - 0xab, 0x0c, 0x52, 0xcc, 0xf2, 0xb0, 0x14, 0xd7, - 0x87, 0x9d, 0x7a, 0x64, 0x75, 0xb5, 0x5a, 0x95, - 0x66, 0xe4, 0xc5, 0x2b, 0x8e, 0xae, 0x12, 0x66, - 0x1f, 0xeb, 0x4f, 0x38, 0xb3, 0x6e, 0x60, 0xd3, - 0x92, 0xfd, 0xf7, 0x41, 0x08, 0xb5, 0x25, 0x13, - 0xb1, 0x18, 0x7a, 0x24, 0xfb, 0x30, 0x1d, 0xba, - 0xed, 0x98, 0xb9, 0x17, 0xec, 0xe7, 0xd7, 0x31, - 0x59, 0xdb, 0x95, 0xd3, 0x1d, 0x78, 0xea, 0x50, - 0x56, 0x5c, 0xd5, 0x82, 0x5a, 0x2d, 0x5a, 0x5f, - 0x33, 0xc4, 0xb6, 0xd8, 0xc9, 0x75, 0x90, 0x96, - 0x8c, 0x0f, 0x52, 0x98, 0xb5, 0xcd, 0x98, 0x1f, - 0x89, 0x20, 0x5f, 0xf2, 0xa0, 0x1c, 0xa3, 0x1b, - 0x96, 0x94, 0xdd, 0xa9, 0xfd, 0x57, 0xe9, 0x70, - 0xe8, 0x26, 0x6d, 0x71, 0x99, 0x9b, 0x26, 0x6e, - 0x38, 0x50, 0x29, 0x6c, 0x90, 0xa7, 0xbd, 0xd9, - 0x16, 0x03, 0x01, 0x00, 0x04, 0x0e, 0x00, 0x00, - 0x00, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x86, 0x10, 0x00, 0x00, - 0x82, 0x00, 0x80, 0x68, 0x10, 0xdc, 0x80, 0xbc, - 0xb3, 0x5a, 0x10, 0x75, 0x89, 0xcc, 0xe5, 0x9f, - 0xbf, 0xe2, 0xce, 0xa4, 0x9f, 0x7f, 0x60, 0xc4, - 0xfe, 0x5c, 0xb5, 0x02, 0x2d, 0xa5, 0xa9, 0x1e, - 0x2c, 0x10, 0x79, 0x15, 0x0f, 0xed, 0x96, 0xb3, - 0xa8, 0x5e, 0x21, 0xbc, 0x5b, 0xdc, 0x58, 0x04, - 0x7d, 0x37, 0xdb, 0xa0, 0x31, 0xe8, 0x4f, 0x04, - 0xbc, 0x46, 0x7c, 0xdb, 0x2e, 0x93, 0x07, 0xaf, - 0xa6, 0x36, 0xd3, 0x39, 0x8d, 0x1d, 0x95, 0xa8, - 0x50, 0x4b, 0xc4, 0x2b, 0xde, 0xd7, 0x04, 0x6d, - 0x77, 0x6c, 0x4d, 0x70, 0x51, 0x88, 0x16, 0x31, - 0x40, 0xb5, 0xba, 0x90, 0x47, 0x64, 0x0c, 0x87, - 0xa5, 0x19, 0xf9, 0x89, 0x24, 0x3c, 0x5e, 0x4b, - 0xaa, 0xe0, 0x60, 0x47, 0x0f, 0x2e, 0xcc, 0xc2, - 0xd5, 0x21, 0xed, 0x72, 0xd0, 0xa9, 0xdd, 0x2a, - 0x2b, 0xef, 0x08, 0x3a, 0x65, 0xea, 0x8b, 0x52, - 0x77, 0x2d, 0xcc, 0x14, 0x03, 0x01, 0x00, 0x01, - 0x01, 0x16, 0x03, 0x01, 0x00, 0x24, 0xe2, 0x95, - 0x62, 0x3c, 0x18, 0xe5, 0xc7, 0x2c, 0xda, 0x16, - 0x9b, 0x28, 0x0d, 0xf7, 0x88, 0x7b, 0x5d, 0x33, - 0x55, 0x3b, 0x01, 0x73, 0xf2, 0xc6, 0x4e, 0x96, - 0x01, 0x01, 0x83, 0x65, 0xd4, 0xef, 0x12, 0x13, - 0x1d, 0x42, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x72, 0x04, 0x00, 0x00, - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, - 0xe8, 0x4b, 0xd1, 0xef, 0xba, 0xfb, 0x41, 0x92, - 0x6d, 0x37, 0x5f, 0xf8, 0x7d, 0x90, 0x0f, 0x01, - 0xf8, 0x8c, 0xee, 0xbc, 0xd9, 0x0c, 0x97, 0x7e, - 0x23, 0x46, 0xe2, 0x6b, 0x52, 0xc6, 0xc6, 0x97, - 0x1d, 0xab, 0xde, 0xa0, 0x86, 0x94, 0xc8, 0x2e, - 0x8b, 0x2e, 0x42, 0x5f, 0xc2, 0x70, 0x35, 0xc9, - 0xee, 0x37, 0xeb, 0x70, 0xaa, 0x59, 0x23, 0x6c, - 0xc8, 0xc1, 0x84, 0x89, 0x39, 0x87, 0x73, 0x0a, - 0x7e, 0xba, 0xca, 0xed, 0x63, 0xba, 0x4e, 0x4f, - 0xf3, 0x31, 0x4b, 0xf0, 0xee, 0x91, 0xa5, 0xb4, - 0x62, 0x01, 0x9e, 0xbd, 0xbc, 0xb3, 0x35, 0x14, - 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, 0x01, - 0x00, 0x24, 0x3f, 0x66, 0xe4, 0x98, 0xc1, 0x3f, - 0xc6, 0x2c, 0x81, 0xfb, 0xa9, 0x9f, 0x27, 0xe9, - 0x63, 0x20, 0x1e, 0x0e, 0x4f, 0xfc, 0x5d, 0x12, - 0xee, 0x77, 0x73, 0xc6, 0x96, 0x51, 0xf2, 0x26, - 0x35, 0x3f, 0xce, 0x6a, 0xa9, 0xfd, 0x17, 0x03, - 0x01, 0x00, 0x21, 0x8d, 0xd5, 0x67, 0x60, 0x5d, - 0xa7, 0x93, 0xcc, 0x39, 0x78, 0x59, 0xab, 0xdb, - 0x10, 0x96, 0xf2, 0xad, 0xa2, 0x85, 0xe2, 0x93, - 0x43, 0x43, 0xcf, 0x82, 0xbd, 0x1f, 0xdc, 0x7a, - 0x72, 0xd6, 0x83, 0x3b, 0x15, 0x03, 0x01, 0x00, - 0x16, 0x89, 0x55, 0xf6, 0x42, 0x71, 0xa9, 0xe9, - 0x05, 0x68, 0xe8, 0xce, 0x0d, 0x21, 0xe9, 0xec, - 0xf2, 0x27, 0x67, 0xa7, 0x94, 0xf8, 0x34, - }, -} -var serverResumeTest = [][]byte{ - { - 0x16, 0x03, 0x01, 0x00, 0xc2, 0x01, 0x00, 0x00, - 0xbe, 0x03, 0x01, 0x50, 0x77, 0x3e, 0x4f, 0x1f, - 0x6f, 0xa5, 0x81, 0xeb, 0xb8, 0x80, 0x55, 0xa4, - 0x76, 0xc2, 0x7f, 0x27, 0xf2, 0xe7, 0xc9, 0x7a, - 0x01, 0x3c, 0xd8, 0xc1, 0xde, 0x99, 0x1f, 0x7c, - 0xab, 0x35, 0x98, 0x00, 0x00, 0x28, 0x00, 0x39, - 0x00, 0x38, 0x00, 0x35, 0x00, 0x16, 0x00, 0x13, - 0x00, 0x0a, 0x00, 0x33, 0x00, 0x32, 0x00, 0x2f, - 0x00, 0x05, 0x00, 0x04, 0x00, 0x15, 0x00, 0x12, - 0x00, 0x09, 0x00, 0x14, 0x00, 0x11, 0x00, 0x08, - 0x00, 0x06, 0x00, 0x03, 0x00, 0xff, 0x02, 0x01, - 0x00, 0x00, 0x6c, 0x00, 0x23, 0x00, 0x68, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, - 0xe8, 0x4b, 0xd1, 0xef, 0xba, 0xfb, 0x41, 0x92, - 0x6d, 0x37, 0x5f, 0xf8, 0x7d, 0x90, 0x0f, 0x01, - 0xf8, 0x8c, 0xee, 0xbc, 0xd9, 0x0c, 0x97, 0x7e, - 0x23, 0x46, 0xe2, 0x6b, 0x52, 0xc6, 0xc6, 0x97, - 0x1d, 0xab, 0xde, 0xa0, 0x86, 0x94, 0xc8, 0x2e, - 0x8b, 0x2e, 0x42, 0x5f, 0xc2, 0x70, 0x35, 0xc9, - 0xee, 0x37, 0xeb, 0x70, 0xaa, 0x59, 0x23, 0x6c, - 0xc8, 0xc1, 0x84, 0x89, 0x39, 0x87, 0x73, 0x0a, - 0x7e, 0xba, 0xca, 0xed, 0x63, 0xba, 0x4e, 0x4f, - 0xf3, 0x31, 0x4b, 0xf0, 0xee, 0x91, 0xa5, 0xb4, - 0x62, 0x01, 0x9e, 0xbd, 0xbc, 0xb3, 0x35, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x2a, 0x02, 0x00, 0x00, - 0x26, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x14, - 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, 0x01, - 0x00, 0x24, 0xc5, 0x35, 0x74, 0x19, 0x05, 0xc5, - 0x85, 0x68, 0x48, 0xe8, 0xb5, 0xe9, 0xaf, 0x78, - 0xbd, 0x35, 0x6f, 0xe9, 0x79, 0x34, 0x1b, 0xf0, - 0x35, 0xd4, 0x4e, 0x55, 0x2e, 0x3c, 0xd5, 0xaf, - 0xfc, 0xba, 0xf5, 0x1e, 0x83, 0x32, - }, - { - 0x14, 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, - 0x01, 0x00, 0x24, 0x27, 0x28, 0x88, 0xe1, 0x7e, - 0x0d, 0x9c, 0x12, 0x50, 0xf6, 0x7a, 0xa7, 0x32, - 0x21, 0x68, 0xba, 0xd8, 0x0a, 0xdc, 0x39, 0xef, - 0x68, 0x95, 0x82, 0xae, 0xbd, 0x12, 0x79, 0xa1, - 0x99, 0xfd, 0xd0, 0x10, 0x8e, 0x4b, 0xd8, - }, - { - 0x17, 0x03, 0x01, 0x00, 0x21, 0xc5, 0x7e, 0x0a, - 0x52, 0x6a, 0xb9, 0xaa, 0x1d, 0xae, 0x9e, 0x24, - 0x9c, 0x34, 0x1e, 0xdb, 0x50, 0x95, 0xee, 0x76, - 0xd7, 0x28, 0x88, 0x08, 0xe3, 0x2e, 0x58, 0xf7, - 0xdb, 0x34, 0x75, 0xa5, 0x7f, 0x9d, 0x15, 0x03, - 0x01, 0x00, 0x16, 0x2c, 0xc1, 0x29, 0x5f, 0x12, - 0x1d, 0x19, 0xab, 0xb3, 0xf4, 0x35, 0x1c, 0x62, - 0x6a, 0x80, 0x29, 0x0d, 0x0e, 0xef, 0x7d, 0x6e, - 0x50, - }, -} - -var clientauthRSATests = []clientauthTest{ - // Server asks for cert with empty CA list, client doesn't give it. - // go test -run "TestRunServer" -serve -clientauth 1 - {"RequestClientCert, none given", RequestClientCert, nil, [][]byte{ - { - 0x16, 0x03, 0x01, 0x01, 0x1e, 0x01, 0x00, 0x01, - 0x1a, 0x03, 0x03, 0x51, 0xe5, 0x6c, 0xb5, 0x5a, - 0xc2, 0xf5, 0xf0, 0x92, 0x94, 0x8a, 0x64, 0x18, - 0xa4, 0x2b, 0x82, 0x07, 0xbc, 0xd9, 0xd9, 0xf9, - 0x7b, 0xd2, 0xd0, 0xee, 0xa2, 0x70, 0x4e, 0x23, - 0x88, 0x7c, 0x95, 0x00, 0x00, 0x82, 0xc0, 0x30, - 0xc0, 0x2c, 0xc0, 0x28, 0xc0, 0x24, 0xc0, 0x14, - 0xc0, 0x0a, 0x00, 0xa3, 0x00, 0x9f, 0x00, 0x6b, - 0x00, 0x6a, 0x00, 0x39, 0x00, 0x38, 0xc0, 0x32, - 0xc0, 0x2e, 0xc0, 0x2a, 0xc0, 0x26, 0xc0, 0x0f, - 0xc0, 0x05, 0x00, 0x9d, 0x00, 0x3d, 0x00, 0x35, - 0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16, 0x00, 0x13, - 0xc0, 0x0d, 0xc0, 0x03, 0x00, 0x0a, 0xc0, 0x2f, - 0xc0, 0x2b, 0xc0, 0x27, 0xc0, 0x23, 0xc0, 0x13, - 0xc0, 0x09, 0x00, 0xa2, 0x00, 0x9e, 0x00, 0x67, - 0x00, 0x40, 0x00, 0x33, 0x00, 0x32, 0xc0, 0x31, - 0xc0, 0x2d, 0xc0, 0x29, 0xc0, 0x25, 0xc0, 0x0e, - 0xc0, 0x04, 0x00, 0x9c, 0x00, 0x3c, 0x00, 0x2f, - 0x00, 0x07, 0xc0, 0x11, 0xc0, 0x07, 0xc0, 0x0c, - 0xc0, 0x02, 0x00, 0x05, 0x00, 0x04, 0x00, 0x15, - 0x00, 0x12, 0x00, 0x09, 0x00, 0x14, 0x00, 0x11, - 0x00, 0x08, 0x00, 0x06, 0x00, 0x03, 0x00, 0xff, - 0x01, 0x00, 0x00, 0x6f, 0x00, 0x0b, 0x00, 0x04, - 0x03, 0x00, 0x01, 0x02, 0x00, 0x0a, 0x00, 0x34, - 0x00, 0x32, 0x00, 0x0e, 0x00, 0x0d, 0x00, 0x19, - 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x18, 0x00, 0x09, - 0x00, 0x0a, 0x00, 0x16, 0x00, 0x17, 0x00, 0x08, - 0x00, 0x06, 0x00, 0x07, 0x00, 0x14, 0x00, 0x15, - 0x00, 0x04, 0x00, 0x05, 0x00, 0x12, 0x00, 0x13, - 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x0f, - 0x00, 0x10, 0x00, 0x11, 0x00, 0x23, 0x00, 0x00, - 0x00, 0x0d, 0x00, 0x22, 0x00, 0x20, 0x06, 0x01, - 0x06, 0x02, 0x06, 0x03, 0x05, 0x01, 0x05, 0x02, - 0x05, 0x03, 0x04, 0x01, 0x04, 0x02, 0x04, 0x03, - 0x03, 0x01, 0x03, 0x02, 0x03, 0x03, 0x02, 0x01, - 0x02, 0x02, 0x02, 0x03, 0x01, 0x01, 0x00, 0x0f, - 0x00, 0x01, 0x01, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x30, 0x02, 0x00, 0x00, - 0x2c, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, - 0x04, 0x00, 0x23, 0x00, 0x00, 0x16, 0x03, 0x01, - 0x02, 0xbe, 0x0b, 0x00, 0x02, 0xba, 0x00, 0x02, - 0xb7, 0x00, 0x02, 0xb4, 0x30, 0x82, 0x02, 0xb0, - 0x30, 0x82, 0x02, 0x19, 0xa0, 0x03, 0x02, 0x01, - 0x02, 0x02, 0x09, 0x00, 0x85, 0xb0, 0xbb, 0xa4, - 0x8a, 0x7f, 0xb8, 0xca, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x05, 0x05, 0x00, 0x30, 0x45, 0x31, 0x0b, 0x30, - 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, - 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, - 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, - 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, - 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, - 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, - 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, - 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, - 0x74, 0x64, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30, - 0x30, 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, 0x39, - 0x33, 0x38, 0x5a, 0x17, 0x0d, 0x31, 0x31, 0x30, - 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, 0x39, 0x33, - 0x38, 0x5a, 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, - 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, - 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, - 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, - 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, - 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, - 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, - 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, 0x74, - 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, - 0x64, 0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, - 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xbb, 0x79, - 0xd6, 0xf5, 0x17, 0xb5, 0xe5, 0xbf, 0x46, 0x10, - 0xd0, 0xdc, 0x69, 0xbe, 0xe6, 0x2b, 0x07, 0x43, - 0x5a, 0xd0, 0x03, 0x2d, 0x8a, 0x7a, 0x43, 0x85, - 0xb7, 0x14, 0x52, 0xe7, 0xa5, 0x65, 0x4c, 0x2c, - 0x78, 0xb8, 0x23, 0x8c, 0xb5, 0xb4, 0x82, 0xe5, - 0xde, 0x1f, 0x95, 0x3b, 0x7e, 0x62, 0xa5, 0x2c, - 0xa5, 0x33, 0xd6, 0xfe, 0x12, 0x5c, 0x7a, 0x56, - 0xfc, 0xf5, 0x06, 0xbf, 0xfa, 0x58, 0x7b, 0x26, - 0x3f, 0xb5, 0xcd, 0x04, 0xd3, 0xd0, 0xc9, 0x21, - 0x96, 0x4a, 0xc7, 0xf4, 0x54, 0x9f, 0x5a, 0xbf, - 0xef, 0x42, 0x71, 0x00, 0xfe, 0x18, 0x99, 0x07, - 0x7f, 0x7e, 0x88, 0x7d, 0x7d, 0xf1, 0x04, 0x39, - 0xc4, 0xa2, 0x2e, 0xdb, 0x51, 0xc9, 0x7c, 0xe3, - 0xc0, 0x4c, 0x3b, 0x32, 0x66, 0x01, 0xcf, 0xaf, - 0xb1, 0x1d, 0xb8, 0x71, 0x9a, 0x1d, 0xdb, 0xdb, - 0x89, 0x6b, 0xae, 0xda, 0x2d, 0x79, 0x02, 0x03, - 0x01, 0x00, 0x01, 0xa3, 0x81, 0xa7, 0x30, 0x81, - 0xa4, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, - 0x04, 0x16, 0x04, 0x14, 0xb1, 0xad, 0xe2, 0x85, - 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, 0xce, 0x23, - 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, 0x88, 0x39, - 0x30, 0x75, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, - 0x6e, 0x30, 0x6c, 0x80, 0x14, 0xb1, 0xad, 0xe2, - 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, 0xce, - 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, 0x88, - 0x39, 0xa1, 0x49, 0xa4, 0x47, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x82, 0x09, 0x00, 0x85, - 0xb0, 0xbb, 0xa4, 0x8a, 0x7f, 0xb8, 0xca, 0x30, - 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, - 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x01, 0x05, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, - 0x08, 0x6c, 0x45, 0x24, 0xc7, 0x6b, 0xb1, 0x59, - 0xab, 0x0c, 0x52, 0xcc, 0xf2, 0xb0, 0x14, 0xd7, - 0x87, 0x9d, 0x7a, 0x64, 0x75, 0xb5, 0x5a, 0x95, - 0x66, 0xe4, 0xc5, 0x2b, 0x8e, 0xae, 0x12, 0x66, - 0x1f, 0xeb, 0x4f, 0x38, 0xb3, 0x6e, 0x60, 0xd3, - 0x92, 0xfd, 0xf7, 0x41, 0x08, 0xb5, 0x25, 0x13, - 0xb1, 0x18, 0x7a, 0x24, 0xfb, 0x30, 0x1d, 0xba, - 0xed, 0x98, 0xb9, 0x17, 0xec, 0xe7, 0xd7, 0x31, - 0x59, 0xdb, 0x95, 0xd3, 0x1d, 0x78, 0xea, 0x50, - 0x56, 0x5c, 0xd5, 0x82, 0x5a, 0x2d, 0x5a, 0x5f, - 0x33, 0xc4, 0xb6, 0xd8, 0xc9, 0x75, 0x90, 0x96, - 0x8c, 0x0f, 0x52, 0x98, 0xb5, 0xcd, 0x98, 0x1f, - 0x89, 0x20, 0x5f, 0xf2, 0xa0, 0x1c, 0xa3, 0x1b, - 0x96, 0x94, 0xdd, 0xa9, 0xfd, 0x57, 0xe9, 0x70, - 0xe8, 0x26, 0x6d, 0x71, 0x99, 0x9b, 0x26, 0x6e, - 0x38, 0x50, 0x29, 0x6c, 0x90, 0xa7, 0xbd, 0xd9, - 0x16, 0x03, 0x01, 0x00, 0x09, 0x0d, 0x00, 0x00, - 0x05, 0x02, 0x01, 0x40, 0x00, 0x00, 0x16, 0x03, - 0x01, 0x00, 0x04, 0x0e, 0x00, 0x00, 0x00, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x07, 0x0b, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x16, 0x03, 0x01, 0x00, - 0x86, 0x10, 0x00, 0x00, 0x82, 0x00, 0x80, 0x36, - 0xfc, 0xd8, 0xc8, 0xa2, 0x67, 0xc8, 0xc6, 0xf4, - 0x28, 0x70, 0xe1, 0x5a, 0x02, 0x8f, 0xef, 0x42, - 0xe0, 0xd3, 0xb8, 0xd6, 0x6b, 0xe4, 0xee, 0x5c, - 0xcf, 0x42, 0xc4, 0xfa, 0xcd, 0x0f, 0xfe, 0xf4, - 0x76, 0x76, 0x47, 0x73, 0xa8, 0x72, 0x8f, 0xa2, - 0x56, 0x81, 0x83, 0xb8, 0x84, 0x72, 0x67, 0xdd, - 0xbe, 0x05, 0x4b, 0x84, 0xd9, 0xd2, 0xb6, 0xc2, - 0xe7, 0x20, 0xac, 0x1f, 0x46, 0x9d, 0x05, 0x47, - 0x8e, 0x89, 0xc0, 0x42, 0x57, 0x4a, 0xa2, 0x98, - 0xe5, 0x39, 0x4f, 0xc4, 0x27, 0x6d, 0x43, 0xa8, - 0x83, 0x76, 0xe6, 0xad, 0xe3, 0x17, 0x68, 0x31, - 0xcb, 0x7e, 0xfc, 0xe7, 0x4b, 0x76, 0x3d, 0x3c, - 0xfa, 0x77, 0x65, 0xc9, 0x4c, 0x5b, 0xce, 0x5e, - 0xf7, 0x8b, 0xa8, 0xa6, 0xdd, 0xb2, 0xef, 0x0b, - 0x46, 0x83, 0xdf, 0x0a, 0x8c, 0x22, 0x12, 0x6e, - 0xe1, 0x45, 0x54, 0x88, 0xd1, 0xe8, 0xd2, 0x14, - 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, 0x01, - 0x00, 0x24, 0x30, 0x8c, 0x7d, 0x40, 0xfc, 0x5e, - 0x80, 0x9c, 0xc4, 0x7c, 0x62, 0x01, 0xa1, 0x37, - 0xcf, 0x1a, 0x75, 0x28, 0x8d, 0xeb, 0x63, 0xcc, - 0x02, 0xa6, 0x66, 0xdf, 0x36, 0x01, 0xb3, 0x9d, - 0x38, 0x42, 0x16, 0x91, 0xf0, 0x02, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x72, 0x04, 0x00, 0x00, - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, - 0xe8, 0x4b, 0xd1, 0xef, 0xba, 0x96, 0x9a, 0x2a, - 0x6c, 0x8c, 0x7e, 0x38, 0x10, 0x46, 0x86, 0x1d, - 0x19, 0x1d, 0x62, 0x29, 0x3f, 0x58, 0xfb, 0x6d, - 0x89, 0xd2, 0x81, 0x9a, 0x1c, 0xb3, 0x58, 0xb3, - 0x19, 0x39, 0x17, 0x47, 0x49, 0xc9, 0xfe, 0x4a, - 0x7a, 0x32, 0xac, 0x2c, 0x43, 0xf9, 0xa9, 0xea, - 0xec, 0x51, 0x46, 0xf1, 0xb8, 0x59, 0x23, 0x70, - 0xce, 0x7c, 0xb9, 0x47, 0x70, 0xa3, 0xc9, 0xae, - 0x47, 0x7b, 0x7e, 0xc7, 0xcf, 0x76, 0x12, 0x76, - 0x18, 0x90, 0x12, 0xcd, 0xf3, 0xd4, 0x27, 0x81, - 0xfc, 0x46, 0x03, 0x3e, 0x05, 0x87, 0x6f, 0x14, - 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, 0x01, - 0x00, 0x24, 0xc3, 0xa0, 0x29, 0xb1, 0x52, 0x82, - 0xef, 0x85, 0xa1, 0x64, 0x0f, 0xe4, 0xa3, 0xfb, - 0xa7, 0x1d, 0x22, 0x4c, 0xcb, 0xd6, 0x5b, 0x18, - 0x61, 0xc7, 0x7c, 0xf2, 0x67, 0x4a, 0xc7, 0x11, - 0x9d, 0x8e, 0x0e, 0x15, 0x22, 0xcf, 0x17, 0x03, - 0x01, 0x00, 0x21, 0xfd, 0xbb, 0xf1, 0xa9, 0x7c, - 0xbf, 0x92, 0xb3, 0xfa, 0x2c, 0x08, 0x6f, 0x22, - 0x78, 0x80, 0xf2, 0x2e, 0x86, 0x26, 0x21, 0x36, - 0x3f, 0x32, 0xdf, 0xb6, 0x47, 0xa5, 0xf8, 0x27, - 0xc1, 0xe9, 0x53, 0x90, 0x15, 0x03, 0x01, 0x00, - 0x16, 0xfe, 0xef, 0x2e, 0xa0, 0x5d, 0xe0, 0xce, - 0x94, 0x20, 0x56, 0x61, 0x6e, 0xe5, 0x62, 0xce, - 0x27, 0x57, 0x3e, 0x30, 0x32, 0x77, 0x53, - }, - }}, - - // Server asks for cert with empty CA list, client gives one - // go test -run "TestRunServer" -serve -clientauth 1 - {"RequestClientCert, client gives it", RequestClientCert, []*x509.Certificate{clientCertificate}, [][]byte{ - { - 0x16, 0x03, 0x01, 0x01, 0x1e, 0x01, 0x00, 0x01, - 0x1a, 0x03, 0x03, 0x51, 0xe5, 0x74, 0x0e, 0x95, - 0x6f, 0x4f, 0x4a, 0xbf, 0xb7, 0xc0, 0x6c, 0xac, - 0xd9, 0xfe, 0x7d, 0xd0, 0x51, 0x19, 0x62, 0x62, - 0x1c, 0x6e, 0x57, 0x77, 0xd2, 0x31, 0xaf, 0x88, - 0xb9, 0xc0, 0x1d, 0x00, 0x00, 0x82, 0xc0, 0x30, - 0xc0, 0x2c, 0xc0, 0x28, 0xc0, 0x24, 0xc0, 0x14, - 0xc0, 0x0a, 0x00, 0xa3, 0x00, 0x9f, 0x00, 0x6b, - 0x00, 0x6a, 0x00, 0x39, 0x00, 0x38, 0xc0, 0x32, - 0xc0, 0x2e, 0xc0, 0x2a, 0xc0, 0x26, 0xc0, 0x0f, - 0xc0, 0x05, 0x00, 0x9d, 0x00, 0x3d, 0x00, 0x35, - 0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16, 0x00, 0x13, - 0xc0, 0x0d, 0xc0, 0x03, 0x00, 0x0a, 0xc0, 0x2f, - 0xc0, 0x2b, 0xc0, 0x27, 0xc0, 0x23, 0xc0, 0x13, - 0xc0, 0x09, 0x00, 0xa2, 0x00, 0x9e, 0x00, 0x67, - 0x00, 0x40, 0x00, 0x33, 0x00, 0x32, 0xc0, 0x31, - 0xc0, 0x2d, 0xc0, 0x29, 0xc0, 0x25, 0xc0, 0x0e, - 0xc0, 0x04, 0x00, 0x9c, 0x00, 0x3c, 0x00, 0x2f, - 0x00, 0x07, 0xc0, 0x11, 0xc0, 0x07, 0xc0, 0x0c, - 0xc0, 0x02, 0x00, 0x05, 0x00, 0x04, 0x00, 0x15, - 0x00, 0x12, 0x00, 0x09, 0x00, 0x14, 0x00, 0x11, - 0x00, 0x08, 0x00, 0x06, 0x00, 0x03, 0x00, 0xff, - 0x01, 0x00, 0x00, 0x6f, 0x00, 0x0b, 0x00, 0x04, - 0x03, 0x00, 0x01, 0x02, 0x00, 0x0a, 0x00, 0x34, - 0x00, 0x32, 0x00, 0x0e, 0x00, 0x0d, 0x00, 0x19, - 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x18, 0x00, 0x09, - 0x00, 0x0a, 0x00, 0x16, 0x00, 0x17, 0x00, 0x08, - 0x00, 0x06, 0x00, 0x07, 0x00, 0x14, 0x00, 0x15, - 0x00, 0x04, 0x00, 0x05, 0x00, 0x12, 0x00, 0x13, - 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x0f, - 0x00, 0x10, 0x00, 0x11, 0x00, 0x23, 0x00, 0x00, - 0x00, 0x0d, 0x00, 0x22, 0x00, 0x20, 0x06, 0x01, - 0x06, 0x02, 0x06, 0x03, 0x05, 0x01, 0x05, 0x02, - 0x05, 0x03, 0x04, 0x01, 0x04, 0x02, 0x04, 0x03, - 0x03, 0x01, 0x03, 0x02, 0x03, 0x03, 0x02, 0x01, - 0x02, 0x02, 0x02, 0x03, 0x01, 0x01, 0x00, 0x0f, - 0x00, 0x01, 0x01, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x30, 0x02, 0x00, 0x00, - 0x2c, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, - 0x04, 0x00, 0x23, 0x00, 0x00, 0x16, 0x03, 0x01, - 0x02, 0xbe, 0x0b, 0x00, 0x02, 0xba, 0x00, 0x02, - 0xb7, 0x00, 0x02, 0xb4, 0x30, 0x82, 0x02, 0xb0, - 0x30, 0x82, 0x02, 0x19, 0xa0, 0x03, 0x02, 0x01, - 0x02, 0x02, 0x09, 0x00, 0x85, 0xb0, 0xbb, 0xa4, - 0x8a, 0x7f, 0xb8, 0xca, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x05, 0x05, 0x00, 0x30, 0x45, 0x31, 0x0b, 0x30, - 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, - 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, - 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, - 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, - 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, - 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, - 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, - 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, - 0x74, 0x64, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30, - 0x30, 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, 0x39, - 0x33, 0x38, 0x5a, 0x17, 0x0d, 0x31, 0x31, 0x30, - 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, 0x39, 0x33, - 0x38, 0x5a, 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, - 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, - 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, - 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, - 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, - 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, - 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, - 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, 0x74, - 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, - 0x64, 0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, - 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xbb, 0x79, - 0xd6, 0xf5, 0x17, 0xb5, 0xe5, 0xbf, 0x46, 0x10, - 0xd0, 0xdc, 0x69, 0xbe, 0xe6, 0x2b, 0x07, 0x43, - 0x5a, 0xd0, 0x03, 0x2d, 0x8a, 0x7a, 0x43, 0x85, - 0xb7, 0x14, 0x52, 0xe7, 0xa5, 0x65, 0x4c, 0x2c, - 0x78, 0xb8, 0x23, 0x8c, 0xb5, 0xb4, 0x82, 0xe5, - 0xde, 0x1f, 0x95, 0x3b, 0x7e, 0x62, 0xa5, 0x2c, - 0xa5, 0x33, 0xd6, 0xfe, 0x12, 0x5c, 0x7a, 0x56, - 0xfc, 0xf5, 0x06, 0xbf, 0xfa, 0x58, 0x7b, 0x26, - 0x3f, 0xb5, 0xcd, 0x04, 0xd3, 0xd0, 0xc9, 0x21, - 0x96, 0x4a, 0xc7, 0xf4, 0x54, 0x9f, 0x5a, 0xbf, - 0xef, 0x42, 0x71, 0x00, 0xfe, 0x18, 0x99, 0x07, - 0x7f, 0x7e, 0x88, 0x7d, 0x7d, 0xf1, 0x04, 0x39, - 0xc4, 0xa2, 0x2e, 0xdb, 0x51, 0xc9, 0x7c, 0xe3, - 0xc0, 0x4c, 0x3b, 0x32, 0x66, 0x01, 0xcf, 0xaf, - 0xb1, 0x1d, 0xb8, 0x71, 0x9a, 0x1d, 0xdb, 0xdb, - 0x89, 0x6b, 0xae, 0xda, 0x2d, 0x79, 0x02, 0x03, - 0x01, 0x00, 0x01, 0xa3, 0x81, 0xa7, 0x30, 0x81, - 0xa4, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, - 0x04, 0x16, 0x04, 0x14, 0xb1, 0xad, 0xe2, 0x85, - 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, 0xce, 0x23, - 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, 0x88, 0x39, - 0x30, 0x75, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, - 0x6e, 0x30, 0x6c, 0x80, 0x14, 0xb1, 0xad, 0xe2, - 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, 0xce, - 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, 0x88, - 0x39, 0xa1, 0x49, 0xa4, 0x47, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x82, 0x09, 0x00, 0x85, - 0xb0, 0xbb, 0xa4, 0x8a, 0x7f, 0xb8, 0xca, 0x30, - 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, - 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x01, 0x05, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, - 0x08, 0x6c, 0x45, 0x24, 0xc7, 0x6b, 0xb1, 0x59, - 0xab, 0x0c, 0x52, 0xcc, 0xf2, 0xb0, 0x14, 0xd7, - 0x87, 0x9d, 0x7a, 0x64, 0x75, 0xb5, 0x5a, 0x95, - 0x66, 0xe4, 0xc5, 0x2b, 0x8e, 0xae, 0x12, 0x66, - 0x1f, 0xeb, 0x4f, 0x38, 0xb3, 0x6e, 0x60, 0xd3, - 0x92, 0xfd, 0xf7, 0x41, 0x08, 0xb5, 0x25, 0x13, - 0xb1, 0x18, 0x7a, 0x24, 0xfb, 0x30, 0x1d, 0xba, - 0xed, 0x98, 0xb9, 0x17, 0xec, 0xe7, 0xd7, 0x31, - 0x59, 0xdb, 0x95, 0xd3, 0x1d, 0x78, 0xea, 0x50, - 0x56, 0x5c, 0xd5, 0x82, 0x5a, 0x2d, 0x5a, 0x5f, - 0x33, 0xc4, 0xb6, 0xd8, 0xc9, 0x75, 0x90, 0x96, - 0x8c, 0x0f, 0x52, 0x98, 0xb5, 0xcd, 0x98, 0x1f, - 0x89, 0x20, 0x5f, 0xf2, 0xa0, 0x1c, 0xa3, 0x1b, - 0x96, 0x94, 0xdd, 0xa9, 0xfd, 0x57, 0xe9, 0x70, - 0xe8, 0x26, 0x6d, 0x71, 0x99, 0x9b, 0x26, 0x6e, - 0x38, 0x50, 0x29, 0x6c, 0x90, 0xa7, 0xbd, 0xd9, - 0x16, 0x03, 0x01, 0x00, 0x09, 0x0d, 0x00, 0x00, - 0x05, 0x02, 0x01, 0x40, 0x00, 0x00, 0x16, 0x03, - 0x01, 0x00, 0x04, 0x0e, 0x00, 0x00, 0x00, - }, - { - 0x16, 0x03, 0x01, 0x01, 0xfb, 0x0b, 0x00, 0x01, - 0xf7, 0x00, 0x01, 0xf4, 0x00, 0x01, 0xf1, 0x30, - 0x82, 0x01, 0xed, 0x30, 0x82, 0x01, 0x58, 0xa0, - 0x03, 0x02, 0x01, 0x02, 0x02, 0x01, 0x00, 0x30, - 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x0d, 0x01, 0x01, 0x05, 0x30, 0x26, 0x31, 0x10, - 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, - 0x07, 0x41, 0x63, 0x6d, 0x65, 0x20, 0x43, 0x6f, - 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, - 0x03, 0x13, 0x09, 0x31, 0x32, 0x37, 0x2e, 0x30, - 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x1e, 0x17, 0x0d, - 0x31, 0x31, 0x31, 0x32, 0x30, 0x38, 0x30, 0x37, - 0x35, 0x35, 0x31, 0x32, 0x5a, 0x17, 0x0d, 0x31, - 0x32, 0x31, 0x32, 0x30, 0x37, 0x30, 0x38, 0x30, - 0x30, 0x31, 0x32, 0x5a, 0x30, 0x26, 0x31, 0x10, - 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, - 0x07, 0x41, 0x63, 0x6d, 0x65, 0x20, 0x43, 0x6f, - 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, - 0x03, 0x13, 0x09, 0x31, 0x32, 0x37, 0x2e, 0x30, - 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x81, 0x9c, 0x30, - 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x0d, 0x01, 0x01, 0x01, 0x03, 0x81, 0x8c, 0x00, - 0x30, 0x81, 0x88, 0x02, 0x81, 0x80, 0x4e, 0xd0, - 0x7b, 0x31, 0xe3, 0x82, 0x64, 0xd9, 0x59, 0xc0, - 0xc2, 0x87, 0xa4, 0x5e, 0x1e, 0x8b, 0x73, 0x33, - 0xc7, 0x63, 0x53, 0xdf, 0x66, 0x92, 0x06, 0x84, - 0xf6, 0x64, 0xd5, 0x8f, 0xe4, 0x36, 0xa7, 0x1d, - 0x2b, 0xe8, 0xb3, 0x20, 0x36, 0x45, 0x23, 0xb5, - 0xe3, 0x95, 0xae, 0xed, 0xe0, 0xf5, 0x20, 0x9c, - 0x8d, 0x95, 0xdf, 0x7f, 0x5a, 0x12, 0xef, 0x87, - 0xe4, 0x5b, 0x68, 0xe4, 0xe9, 0x0e, 0x74, 0xec, - 0x04, 0x8a, 0x7f, 0xde, 0x93, 0x27, 0xc4, 0x01, - 0x19, 0x7a, 0xbd, 0xf2, 0xdc, 0x3d, 0x14, 0xab, - 0xd0, 0x54, 0xca, 0x21, 0x0c, 0xd0, 0x4d, 0x6e, - 0x87, 0x2e, 0x5c, 0xc5, 0xd2, 0xbb, 0x4d, 0x4b, - 0x4f, 0xce, 0xb6, 0x2c, 0xf7, 0x7e, 0x88, 0xec, - 0x7c, 0xd7, 0x02, 0x91, 0x74, 0xa6, 0x1e, 0x0c, - 0x1a, 0xda, 0xe3, 0x4a, 0x5a, 0x2e, 0xde, 0x13, - 0x9c, 0x4c, 0x40, 0x88, 0x59, 0x93, 0x02, 0x03, - 0x01, 0x00, 0x01, 0xa3, 0x32, 0x30, 0x30, 0x30, - 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, - 0xff, 0x04, 0x04, 0x03, 0x02, 0x00, 0xa0, 0x30, - 0x0d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x06, - 0x04, 0x04, 0x01, 0x02, 0x03, 0x04, 0x30, 0x0f, - 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x08, 0x30, - 0x06, 0x80, 0x04, 0x01, 0x02, 0x03, 0x04, 0x30, - 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x0d, 0x01, 0x01, 0x05, 0x03, 0x81, 0x81, 0x00, - 0x36, 0x1f, 0xb3, 0x7a, 0x0c, 0x75, 0xc9, 0x6e, - 0x37, 0x46, 0x61, 0x2b, 0xd5, 0xbd, 0xc0, 0xa7, - 0x4b, 0xcc, 0x46, 0x9a, 0x81, 0x58, 0x7c, 0x85, - 0x79, 0x29, 0xc8, 0xc8, 0xc6, 0x67, 0xdd, 0x32, - 0x56, 0x45, 0x2b, 0x75, 0xb6, 0xe9, 0x24, 0xa9, - 0x50, 0x9a, 0xbe, 0x1f, 0x5a, 0xfa, 0x1a, 0x15, - 0xd9, 0xcc, 0x55, 0x95, 0x72, 0x16, 0x83, 0xb9, - 0xc2, 0xb6, 0x8f, 0xfd, 0x88, 0x8c, 0x38, 0x84, - 0x1d, 0xab, 0x5d, 0x92, 0x31, 0x13, 0x4f, 0xfd, - 0x83, 0x3b, 0xc6, 0x9d, 0xf1, 0x11, 0x62, 0xb6, - 0x8b, 0xec, 0xab, 0x67, 0xbe, 0xc8, 0x64, 0xb0, - 0x11, 0x50, 0x46, 0x58, 0x17, 0x6b, 0x99, 0x1c, - 0xd3, 0x1d, 0xfc, 0x06, 0xf1, 0x0e, 0xe5, 0x96, - 0xa8, 0x0c, 0xf9, 0x78, 0x20, 0xb7, 0x44, 0x18, - 0x51, 0x8d, 0x10, 0x7e, 0x4f, 0x94, 0x67, 0xdf, - 0xa3, 0x4e, 0x70, 0x73, 0x8e, 0x90, 0x91, 0x85, - 0x16, 0x03, 0x01, 0x00, 0x86, 0x10, 0x00, 0x00, - 0x82, 0x00, 0x80, 0x0a, 0x4e, 0x89, 0xdf, 0x3a, - 0x3f, 0xf0, 0x4f, 0xef, 0x1a, 0x90, 0xd4, 0x3c, - 0xaf, 0x10, 0x57, 0xb0, 0xa1, 0x5f, 0xcd, 0x62, - 0x01, 0xe9, 0x0c, 0x36, 0x42, 0xfd, 0xaf, 0x23, - 0xf9, 0x14, 0xa6, 0x72, 0x26, 0x4e, 0x01, 0xdb, - 0xac, 0xb7, 0x4c, 0xe6, 0xa9, 0x52, 0xe2, 0xec, - 0x26, 0x8c, 0x7a, 0x64, 0xf8, 0x0b, 0x4c, 0x2f, - 0xa9, 0xcb, 0x75, 0xaf, 0x60, 0xd4, 0xb4, 0xe6, - 0xe8, 0xdb, 0x78, 0x78, 0x85, 0xf6, 0x0c, 0x95, - 0xcc, 0xb6, 0x55, 0xb9, 0xba, 0x9e, 0x91, 0xbc, - 0x66, 0xdb, 0x1e, 0x28, 0xab, 0x73, 0xce, 0x8b, - 0xd0, 0xd3, 0xe8, 0xbc, 0xd0, 0x21, 0x28, 0xbd, - 0xfb, 0x74, 0x64, 0xde, 0x3b, 0x3b, 0xd3, 0x4c, - 0x32, 0x40, 0x82, 0xba, 0x91, 0x1e, 0xe8, 0x47, - 0xc2, 0x09, 0xb7, 0x16, 0xaa, 0x25, 0xa9, 0x3c, - 0x6c, 0xa7, 0xf8, 0xc9, 0x54, 0x84, 0xc6, 0xf7, - 0x56, 0x05, 0xa4, 0x16, 0x03, 0x01, 0x00, 0x86, - 0x0f, 0x00, 0x00, 0x82, 0x00, 0x80, 0x4b, 0xab, - 0xda, 0xac, 0x2a, 0xb3, 0xe6, 0x34, 0x55, 0xcd, - 0xf2, 0x4b, 0x67, 0xe3, 0xd3, 0xff, 0xa3, 0xf4, - 0x79, 0x82, 0x01, 0x47, 0x8a, 0xe3, 0x9f, 0x89, - 0x70, 0xbe, 0x24, 0x24, 0xb7, 0x69, 0x60, 0xed, - 0x55, 0xa0, 0xca, 0x72, 0xb6, 0x4a, 0xbc, 0x1d, - 0xe2, 0x3f, 0xb5, 0x31, 0xda, 0x02, 0xf6, 0x37, - 0x51, 0xf8, 0x4c, 0x88, 0x2e, 0xb3, 0x8a, 0xe8, - 0x7b, 0x4a, 0x90, 0x36, 0xe4, 0xa6, 0x31, 0x95, - 0x8b, 0xa0, 0xc6, 0x91, 0x12, 0xb9, 0x35, 0x4e, - 0x72, 0xeb, 0x5c, 0xa2, 0xe8, 0x4c, 0x68, 0xf9, - 0x69, 0xfa, 0x70, 0x60, 0x6c, 0x7f, 0x32, 0x99, - 0xf1, 0xc3, 0x2d, 0xb4, 0x59, 0x58, 0x87, 0xaf, - 0x67, 0x62, 0x90, 0xe7, 0x8d, 0xd0, 0xa3, 0x77, - 0x33, 0xc2, 0x9b, 0xd5, 0x9c, 0xc7, 0xea, 0x25, - 0x98, 0x76, 0x9c, 0xe0, 0x6a, 0x03, 0x3a, 0x10, - 0xfd, 0x10, 0x3d, 0x55, 0x53, 0xa0, 0x14, 0x03, - 0x01, 0x00, 0x01, 0x01, 0x16, 0x03, 0x01, 0x00, - 0x24, 0xd5, 0x12, 0xfc, 0xb9, 0x5a, 0xe3, 0x27, - 0x01, 0xbe, 0xc3, 0x77, 0x17, 0x1a, 0xbb, 0x4f, - 0xae, 0xd5, 0xa7, 0xee, 0x56, 0x61, 0x0d, 0x40, - 0xf4, 0xa4, 0xb5, 0xcc, 0x76, 0xfd, 0xbd, 0x13, - 0x04, 0xe1, 0xb8, 0xc7, 0x36, - }, - { - 0x16, 0x03, 0x01, 0x02, 0x67, 0x04, 0x00, 0x02, - 0x63, 0x00, 0x00, 0x00, 0x00, 0x02, 0x5d, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, - 0xe8, 0x4b, 0xd1, 0xef, 0xba, 0x1f, 0xe2, 0x69, - 0x07, 0x7f, 0x85, 0x2d, 0x4e, 0x2a, 0x2e, 0xbd, - 0x05, 0xe9, 0xc1, 0x6c, 0x9e, 0xbf, 0x47, 0x18, - 0x91, 0x77, 0xf7, 0xe8, 0xb6, 0x27, 0x37, 0xa6, - 0x6b, 0x87, 0x29, 0xbb, 0x3b, 0xe5, 0x68, 0x62, - 0x04, 0x3e, 0xad, 0x4d, 0xff, 0xad, 0xf1, 0x22, - 0x87, 0x8d, 0xf6, 0x04, 0x3b, 0x59, 0x22, 0xf7, - 0xfd, 0x88, 0x0e, 0xa4, 0x09, 0xc0, 0x0d, 0x10, - 0x80, 0x10, 0x79, 0xee, 0x70, 0x96, 0xdb, 0x22, - 0x8b, 0xb7, 0xac, 0xe0, 0x98, 0xad, 0xe9, 0xe3, - 0xcb, 0xea, 0x9f, 0xe6, 0x83, 0x28, 0x7c, 0x7e, - 0x4e, 0x9a, 0x8d, 0xd9, 0xf3, 0x86, 0xf4, 0x89, - 0x8b, 0x79, 0x8f, 0xbb, 0xe9, 0x74, 0x02, 0x02, - 0x14, 0x04, 0xea, 0xba, 0x16, 0x10, 0xa1, 0x85, - 0xbe, 0x4e, 0x4e, 0x92, 0xc5, 0x83, 0xf6, 0x1e, - 0x1f, 0xd4, 0x25, 0xc2, 0xc2, 0xb9, 0xce, 0x33, - 0x63, 0x66, 0x79, 0x1f, 0x54, 0x35, 0xc1, 0xe8, - 0x89, 0x34, 0x78, 0x94, 0x36, 0x14, 0xef, 0x01, - 0x1f, 0xf1, 0xbd, 0x77, 0x2c, 0x4d, 0xac, 0x5c, - 0x5c, 0x4a, 0xc6, 0xed, 0xd8, 0x0e, 0x72, 0x84, - 0x83, 0xdc, 0x56, 0x84, 0xc8, 0xf3, 0x89, 0x56, - 0xfd, 0x89, 0xc1, 0xc9, 0x9a, 0x29, 0x91, 0x7e, - 0x19, 0xe9, 0x8b, 0x5b, 0x11, 0x15, 0x4e, 0x6c, - 0xf4, 0x89, 0xe7, 0x6d, 0x68, 0x1e, 0xf9, 0x6c, - 0x23, 0x72, 0x05, 0x68, 0x82, 0x60, 0x84, 0x1f, - 0x83, 0x20, 0x09, 0x86, 0x10, 0x81, 0xec, 0xec, - 0xdc, 0x25, 0x53, 0x20, 0xfa, 0xa9, 0x41, 0x64, - 0xd6, 0x20, 0xf3, 0xf4, 0x52, 0xf2, 0x80, 0x62, - 0x83, 0xc9, 0x23, 0x66, 0x44, 0x95, 0x5a, 0x99, - 0x8a, 0xe1, 0x26, 0x63, 0xc1, 0x8b, 0x31, 0xf9, - 0x21, 0x06, 0x77, 0x04, 0x27, 0xf2, 0x0c, 0x63, - 0x83, 0x45, 0xa0, 0xa9, 0x7b, 0xcf, 0xdf, 0xd7, - 0x56, 0x75, 0xbc, 0xdd, 0x95, 0x36, 0xb1, 0x75, - 0x39, 0x05, 0x00, 0x3c, 0x8a, 0x79, 0xd6, 0xe9, - 0xf0, 0x4b, 0xdc, 0x51, 0x6b, 0x01, 0x94, 0x16, - 0x87, 0x12, 0x92, 0x6c, 0x07, 0xc1, 0xf5, 0x58, - 0xb7, 0x2a, 0x81, 0xf5, 0xa0, 0x37, 0x8b, 0xa6, - 0x22, 0xfe, 0x28, 0x0a, 0x7e, 0x68, 0xe2, 0xda, - 0x6c, 0x53, 0xee, 0x0e, 0x8d, 0x2d, 0x8b, 0x0b, - 0xda, 0xf8, 0x99, 0x3e, 0x0e, 0xed, 0x9f, 0xc1, - 0x2b, 0xf6, 0xfe, 0xe9, 0x52, 0x38, 0x7b, 0x83, - 0x9a, 0x50, 0xa6, 0xd7, 0x49, 0x83, 0x43, 0x7e, - 0x82, 0xec, 0xc7, 0x09, 0x3d, 0x3d, 0xb1, 0xee, - 0xe8, 0xc5, 0x6a, 0xc3, 0x3d, 0x4b, 0x4c, 0x6a, - 0xbb, 0x0b, 0x2c, 0x24, 0x2e, 0xdb, 0x7d, 0x57, - 0x87, 0xb4, 0x80, 0xa5, 0xae, 0xff, 0x54, 0xa8, - 0xa5, 0x27, 0x69, 0x95, 0xc8, 0xe7, 0x79, 0xc7, - 0x89, 0x2a, 0x73, 0x49, 0xcb, 0xf5, 0xc5, 0xbc, - 0x4a, 0xe0, 0x73, 0xa9, 0xbc, 0x88, 0x64, 0x96, - 0x98, 0xa5, 0x1e, 0xe3, 0x43, 0xc1, 0x7d, 0x78, - 0xc7, 0x94, 0x72, 0xd4, 0x2c, 0x6e, 0x85, 0x39, - 0x9a, 0xaf, 0xdb, 0xa1, 0xe9, 0xe2, 0xcb, 0x37, - 0x04, 0xc6, 0x8c, 0x81, 0xd3, 0x2a, 0xb7, 0xbe, - 0x6c, 0x07, 0x1f, 0x5e, 0xd9, 0x00, 0xd2, 0xf7, - 0xe1, 0xa7, 0xbc, 0x0c, 0xb6, 0x6d, 0xfb, 0x3f, - 0x3d, 0x24, 0xaa, 0xfb, 0x7e, 0xe1, 0xb5, 0x1b, - 0xff, 0x38, 0xaa, 0x69, 0x59, 0x38, 0x52, 0x9a, - 0x0e, 0x6d, 0xbc, 0xde, 0x4f, 0x13, 0x09, 0x17, - 0xc4, 0xa9, 0x05, 0x84, 0xbc, 0x50, 0xef, 0x40, - 0xb0, 0x4c, 0x24, 0x32, 0xed, 0x94, 0x2c, 0xdd, - 0xda, 0x20, 0x24, 0x67, 0xe2, 0xea, 0x71, 0x3d, - 0x4a, 0x04, 0x0d, 0x98, 0x29, 0x20, 0x4c, 0xeb, - 0x70, 0xce, 0x45, 0x9e, 0x5a, 0xaf, 0xb6, 0xa3, - 0x92, 0xc8, 0x28, 0xf2, 0xe3, 0xe8, 0x8a, 0x5d, - 0x0a, 0x33, 0x79, 0x9b, 0x6a, 0xf3, 0x30, 0x01, - 0x1d, 0x47, 0xbd, 0x01, 0xcc, 0x4d, 0x71, 0xc0, - 0x56, 0xfa, 0xfd, 0x37, 0xed, 0x0f, 0x27, 0xc0, - 0xbb, 0xa0, 0xee, 0xc3, 0x79, 0x8b, 0xe7, 0x41, - 0x8f, 0xfa, 0x3a, 0xcb, 0x45, 0x3b, 0x85, 0x9f, - 0x06, 0x90, 0xb2, 0x51, 0x7a, 0xc3, 0x11, 0x41, - 0x4b, 0xe3, 0x26, 0x94, 0x3e, 0xa2, 0xfd, 0x0a, - 0xda, 0x50, 0xf6, 0x50, 0x78, 0x19, 0x6c, 0x52, - 0xd1, 0x12, 0x76, 0xc2, 0x50, 0x2f, 0x0b, 0xca, - 0x33, 0xe5, 0x79, 0x93, 0x14, 0x03, 0x01, 0x00, - 0x01, 0x01, 0x16, 0x03, 0x01, 0x00, 0x24, 0x2b, - 0x51, 0x42, 0x95, 0x6b, 0xca, 0x9f, 0x42, 0x5d, - 0xd2, 0xd9, 0x67, 0xf9, 0x49, 0x30, 0xfd, 0x2a, - 0x46, 0xd3, 0x04, 0xf4, 0x86, 0xf9, 0x11, 0x34, - 0x82, 0xac, 0xe2, 0xc2, 0x2d, 0xc4, 0xd0, 0xfe, - 0xa9, 0xc9, 0x4b, 0x17, 0x03, 0x01, 0x00, 0x21, - 0x65, 0x1c, 0xe9, 0x5c, 0xb6, 0xe2, 0x7c, 0x8e, - 0x49, 0x12, 0x1b, 0xe6, 0x40, 0xd3, 0x97, 0x21, - 0x76, 0x01, 0xe5, 0x80, 0x5e, 0xf3, 0x11, 0x47, - 0x25, 0x02, 0x78, 0x8e, 0x6b, 0xae, 0xb3, 0xf3, - 0x59, 0x15, 0x03, 0x01, 0x00, 0x16, 0x38, 0xc1, - 0x99, 0x2e, 0xf8, 0x6f, 0x45, 0xa4, 0x10, 0x79, - 0x5b, 0xc1, 0x47, 0x9a, 0xf6, 0x5c, 0x90, 0xeb, - 0xa6, 0xe3, 0x1a, 0x24, - }, - }}, -} - -var tls11ECDHEAESServerScript = [][]byte{ - { - 0x16, 0x03, 0x01, 0x01, 0x46, 0x01, 0x00, 0x01, - 0x42, 0x03, 0x03, 0x51, 0x9f, 0xa3, 0xb0, 0xb7, - 0x1d, 0x26, 0x93, 0x36, 0xc0, 0x8d, 0x7e, 0xf8, - 0x4f, 0x6f, 0xc9, 0x3c, 0x31, 0x1e, 0x7f, 0xb1, - 0xf0, 0xc1, 0x0f, 0xf9, 0x0c, 0xa2, 0xd5, 0xca, - 0x48, 0xe5, 0x35, 0x00, 0x00, 0xd0, 0xc0, 0x30, - 0xc0, 0x2c, 0xc0, 0x28, 0xc0, 0x24, 0xc0, 0x14, - 0xc0, 0x0a, 0xc0, 0x22, 0xc0, 0x21, 0x00, 0xa5, - 0x00, 0xa3, 0x00, 0xa1, 0x00, 0x9f, 0x00, 0x6b, - 0x00, 0x6a, 0x00, 0x69, 0x00, 0x68, 0x00, 0x39, - 0x00, 0x38, 0x00, 0x37, 0x00, 0x36, 0x00, 0x88, - 0x00, 0x87, 0x00, 0x86, 0x00, 0x85, 0xc0, 0x32, - 0xc0, 0x2e, 0xc0, 0x2a, 0xc0, 0x26, 0xc0, 0x0f, - 0xc0, 0x05, 0x00, 0x9d, 0x00, 0x3d, 0x00, 0x35, - 0x00, 0x84, 0xc0, 0x12, 0xc0, 0x08, 0xc0, 0x1c, - 0xc0, 0x1b, 0x00, 0x16, 0x00, 0x13, 0x00, 0x10, - 0x00, 0x0d, 0xc0, 0x0d, 0xc0, 0x03, 0x00, 0x0a, - 0xc0, 0x2f, 0xc0, 0x2b, 0xc0, 0x27, 0xc0, 0x23, - 0xc0, 0x13, 0xc0, 0x09, 0xc0, 0x1f, 0xc0, 0x1e, - 0x00, 0xa4, 0x00, 0xa2, 0x00, 0xa0, 0x00, 0x9e, - 0x00, 0x67, 0x00, 0x40, 0x00, 0x3f, 0x00, 0x3e, - 0x00, 0x33, 0x00, 0x32, 0x00, 0x31, 0x00, 0x30, - 0x00, 0x9a, 0x00, 0x99, 0x00, 0x98, 0x00, 0x97, - 0x00, 0x45, 0x00, 0x44, 0x00, 0x43, 0x00, 0x42, - 0xc0, 0x31, 0xc0, 0x2d, 0xc0, 0x29, 0xc0, 0x25, - 0xc0, 0x0e, 0xc0, 0x04, 0x00, 0x9c, 0x00, 0x3c, - 0x00, 0x2f, 0x00, 0x96, 0x00, 0x41, 0x00, 0x07, - 0xc0, 0x11, 0xc0, 0x07, 0xc0, 0x0c, 0xc0, 0x02, - 0x00, 0x05, 0x00, 0x04, 0x00, 0x15, 0x00, 0x12, - 0x00, 0x0f, 0x00, 0x0c, 0x00, 0x09, 0x00, 0x14, - 0x00, 0x11, 0x00, 0x0e, 0x00, 0x0b, 0x00, 0x08, - 0x00, 0x06, 0x00, 0x03, 0x00, 0xff, 0x01, 0x00, - 0x00, 0x49, 0x00, 0x0b, 0x00, 0x04, 0x03, 0x00, - 0x01, 0x02, 0x00, 0x0a, 0x00, 0x34, 0x00, 0x32, - 0x00, 0x0e, 0x00, 0x0d, 0x00, 0x19, 0x00, 0x0b, - 0x00, 0x0c, 0x00, 0x18, 0x00, 0x09, 0x00, 0x0a, - 0x00, 0x16, 0x00, 0x17, 0x00, 0x08, 0x00, 0x06, - 0x00, 0x07, 0x00, 0x14, 0x00, 0x15, 0x00, 0x04, - 0x00, 0x05, 0x00, 0x12, 0x00, 0x13, 0x00, 0x01, - 0x00, 0x02, 0x00, 0x03, 0x00, 0x0f, 0x00, 0x10, - 0x00, 0x11, 0x00, 0x23, 0x00, 0x00, 0x00, 0x0f, - 0x00, 0x01, 0x01, - }, - { - 0x16, 0x03, 0x02, 0x00, 0x30, 0x02, 0x00, 0x00, - 0x2c, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc0, 0x13, 0x00, 0x00, - 0x04, 0x00, 0x23, 0x00, 0x00, 0x16, 0x03, 0x02, - 0x02, 0xbe, 0x0b, 0x00, 0x02, 0xba, 0x00, 0x02, - 0xb7, 0x00, 0x02, 0xb4, 0x30, 0x82, 0x02, 0xb0, - 0x30, 0x82, 0x02, 0x19, 0xa0, 0x03, 0x02, 0x01, - 0x02, 0x02, 0x09, 0x00, 0x85, 0xb0, 0xbb, 0xa4, - 0x8a, 0x7f, 0xb8, 0xca, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x05, 0x05, 0x00, 0x30, 0x45, 0x31, 0x0b, 0x30, - 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, - 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, - 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, - 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, - 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, - 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, - 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, - 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, - 0x74, 0x64, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30, - 0x30, 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, 0x39, - 0x33, 0x38, 0x5a, 0x17, 0x0d, 0x31, 0x31, 0x30, - 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, 0x39, 0x33, - 0x38, 0x5a, 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, - 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, - 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, - 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, - 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, - 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, - 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, - 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, 0x74, - 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, - 0x64, 0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, - 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xbb, 0x79, - 0xd6, 0xf5, 0x17, 0xb5, 0xe5, 0xbf, 0x46, 0x10, - 0xd0, 0xdc, 0x69, 0xbe, 0xe6, 0x2b, 0x07, 0x43, - 0x5a, 0xd0, 0x03, 0x2d, 0x8a, 0x7a, 0x43, 0x85, - 0xb7, 0x14, 0x52, 0xe7, 0xa5, 0x65, 0x4c, 0x2c, - 0x78, 0xb8, 0x23, 0x8c, 0xb5, 0xb4, 0x82, 0xe5, - 0xde, 0x1f, 0x95, 0x3b, 0x7e, 0x62, 0xa5, 0x2c, - 0xa5, 0x33, 0xd6, 0xfe, 0x12, 0x5c, 0x7a, 0x56, - 0xfc, 0xf5, 0x06, 0xbf, 0xfa, 0x58, 0x7b, 0x26, - 0x3f, 0xb5, 0xcd, 0x04, 0xd3, 0xd0, 0xc9, 0x21, - 0x96, 0x4a, 0xc7, 0xf4, 0x54, 0x9f, 0x5a, 0xbf, - 0xef, 0x42, 0x71, 0x00, 0xfe, 0x18, 0x99, 0x07, - 0x7f, 0x7e, 0x88, 0x7d, 0x7d, 0xf1, 0x04, 0x39, - 0xc4, 0xa2, 0x2e, 0xdb, 0x51, 0xc9, 0x7c, 0xe3, - 0xc0, 0x4c, 0x3b, 0x32, 0x66, 0x01, 0xcf, 0xaf, - 0xb1, 0x1d, 0xb8, 0x71, 0x9a, 0x1d, 0xdb, 0xdb, - 0x89, 0x6b, 0xae, 0xda, 0x2d, 0x79, 0x02, 0x03, - 0x01, 0x00, 0x01, 0xa3, 0x81, 0xa7, 0x30, 0x81, - 0xa4, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, - 0x04, 0x16, 0x04, 0x14, 0xb1, 0xad, 0xe2, 0x85, - 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, 0xce, 0x23, - 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, 0x88, 0x39, - 0x30, 0x75, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, - 0x6e, 0x30, 0x6c, 0x80, 0x14, 0xb1, 0xad, 0xe2, - 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, 0xce, - 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, 0x88, - 0x39, 0xa1, 0x49, 0xa4, 0x47, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x82, 0x09, 0x00, 0x85, - 0xb0, 0xbb, 0xa4, 0x8a, 0x7f, 0xb8, 0xca, 0x30, - 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, - 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x01, 0x05, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, - 0x08, 0x6c, 0x45, 0x24, 0xc7, 0x6b, 0xb1, 0x59, - 0xab, 0x0c, 0x52, 0xcc, 0xf2, 0xb0, 0x14, 0xd7, - 0x87, 0x9d, 0x7a, 0x64, 0x75, 0xb5, 0x5a, 0x95, - 0x66, 0xe4, 0xc5, 0x2b, 0x8e, 0xae, 0x12, 0x66, - 0x1f, 0xeb, 0x4f, 0x38, 0xb3, 0x6e, 0x60, 0xd3, - 0x92, 0xfd, 0xf7, 0x41, 0x08, 0xb5, 0x25, 0x13, - 0xb1, 0x18, 0x7a, 0x24, 0xfb, 0x30, 0x1d, 0xba, - 0xed, 0x98, 0xb9, 0x17, 0xec, 0xe7, 0xd7, 0x31, - 0x59, 0xdb, 0x95, 0xd3, 0x1d, 0x78, 0xea, 0x50, - 0x56, 0x5c, 0xd5, 0x82, 0x5a, 0x2d, 0x5a, 0x5f, - 0x33, 0xc4, 0xb6, 0xd8, 0xc9, 0x75, 0x90, 0x96, - 0x8c, 0x0f, 0x52, 0x98, 0xb5, 0xcd, 0x98, 0x1f, - 0x89, 0x20, 0x5f, 0xf2, 0xa0, 0x1c, 0xa3, 0x1b, - 0x96, 0x94, 0xdd, 0xa9, 0xfd, 0x57, 0xe9, 0x70, - 0xe8, 0x26, 0x6d, 0x71, 0x99, 0x9b, 0x26, 0x6e, - 0x38, 0x50, 0x29, 0x6c, 0x90, 0xa7, 0xbd, 0xd9, - 0x16, 0x03, 0x02, 0x01, 0x0f, 0x0c, 0x00, 0x01, - 0x0b, 0x03, 0x00, 0x19, 0x85, 0x04, 0x01, 0x39, - 0xdc, 0xee, 0x44, 0x17, 0x5e, 0xdb, 0xd7, 0x27, - 0xaf, 0xb6, 0x56, 0xd9, 0xb4, 0x43, 0x5a, 0x99, - 0xcf, 0xaa, 0x31, 0x37, 0x0c, 0x6f, 0x3a, 0xa0, - 0xf8, 0x53, 0xc4, 0x74, 0xd1, 0x91, 0x0a, 0x46, - 0xf5, 0x38, 0x3b, 0x5c, 0x09, 0xd8, 0x97, 0xdc, - 0x4b, 0xaa, 0x70, 0x26, 0x48, 0xf2, 0xd6, 0x0b, - 0x31, 0xc9, 0xf8, 0xd4, 0x98, 0x43, 0xe1, 0x6c, - 0xd5, 0xc7, 0xb2, 0x8e, 0x0b, 0x01, 0xe6, 0xb6, - 0x00, 0x28, 0x80, 0x7b, 0xfc, 0x96, 0x8f, 0x0d, - 0xa2, 0x4f, 0xb0, 0x79, 0xaf, 0xdc, 0x61, 0x28, - 0x63, 0x33, 0x78, 0xf6, 0x31, 0x39, 0xfd, 0x8a, - 0xf4, 0x15, 0x18, 0x11, 0xfe, 0xdb, 0xd5, 0x07, - 0xda, 0x2c, 0xed, 0x49, 0xa0, 0x23, 0xbf, 0xd0, - 0x3a, 0x38, 0x1d, 0x54, 0xae, 0x1c, 0x7b, 0xea, - 0x29, 0xee, 0xd0, 0x38, 0xc1, 0x76, 0xa7, 0x7f, - 0x2a, 0xf4, 0xce, 0x1e, 0xac, 0xcc, 0x94, 0x79, - 0x90, 0x33, 0x00, 0x80, 0x16, 0x83, 0x9b, 0xf9, - 0x72, 0xdb, 0x9f, 0x55, 0x02, 0xe1, 0x04, 0xf7, - 0xb5, 0x3f, 0x4c, 0x71, 0x13, 0x5a, 0x91, 0xe9, - 0x1d, 0xeb, 0x9d, 0x9c, 0xfb, 0x88, 0xef, 0xca, - 0xec, 0x7d, 0x9b, 0xdd, 0xd9, 0xee, 0x2b, 0x8e, - 0xef, 0xf8, 0xb6, 0xc7, 0x7d, 0xfe, 0xda, 0x7f, - 0x90, 0x2e, 0x53, 0xf1, 0x64, 0x95, 0xfc, 0x66, - 0xfc, 0x87, 0x27, 0xb6, 0x9f, 0xc8, 0x3a, 0x95, - 0x68, 0x17, 0xe1, 0x7d, 0xf1, 0x88, 0xe8, 0x17, - 0x5f, 0x99, 0x90, 0x3f, 0x47, 0x47, 0x81, 0x06, - 0xe2, 0x8e, 0x22, 0x56, 0x8f, 0xc2, 0x14, 0xe5, - 0x62, 0xa7, 0x0d, 0x41, 0x3c, 0xc7, 0x4a, 0x0a, - 0x74, 0x4b, 0xda, 0x00, 0x8e, 0x4f, 0x90, 0xe6, - 0xd7, 0x68, 0xe5, 0x8b, 0xf2, 0x3f, 0x53, 0x1d, - 0x7a, 0xe6, 0xb3, 0xe9, 0x8a, 0xc9, 0x4d, 0x19, - 0xa6, 0xcf, 0xf9, 0xed, 0x5e, 0x26, 0xdc, 0x90, - 0x1c, 0x41, 0xad, 0x7c, 0x16, 0x03, 0x02, 0x00, - 0x04, 0x0e, 0x00, 0x00, 0x00, - }, - { - 0x16, 0x03, 0x02, 0x00, 0x8a, 0x10, 0x00, 0x00, - 0x86, 0x85, 0x04, 0x01, 0x11, 0xf2, 0xa4, 0x2d, - 0x1a, 0x75, 0x6c, 0xbc, 0x2d, 0x91, 0x95, 0x07, - 0xbe, 0xd6, 0x41, 0x7a, 0xbb, 0xc2, 0x7b, 0xa6, - 0x9b, 0xe3, 0xdc, 0x41, 0x7f, 0x1e, 0x2e, 0xcc, - 0x6d, 0xa3, 0x85, 0x53, 0x98, 0x9f, 0x2d, 0xe6, - 0x3c, 0xb9, 0x82, 0xa6, 0x80, 0x53, 0x9b, 0x71, - 0xfd, 0x27, 0xe5, 0xe5, 0xdf, 0x13, 0xba, 0x56, - 0x62, 0x30, 0x4a, 0x57, 0x27, 0xa7, 0xcc, 0x26, - 0x54, 0xe8, 0x65, 0x6e, 0x4d, 0x00, 0xbf, 0x8a, - 0xcc, 0x89, 0x6a, 0x6c, 0x88, 0xda, 0x79, 0x4f, - 0xc5, 0xad, 0x6d, 0x1d, 0x7c, 0x53, 0x7b, 0x1a, - 0x96, 0xf2, 0xf8, 0x30, 0x01, 0x0b, 0xc2, 0xf0, - 0x78, 0x41, 0xf4, 0x0d, 0xe0, 0xbe, 0xb9, 0x36, - 0xe0, 0xb7, 0xee, 0x16, 0xeb, 0x25, 0x67, 0x04, - 0xc0, 0x2e, 0xd8, 0x34, 0x4a, 0x65, 0xa5, 0xf1, - 0x95, 0x75, 0xc7, 0x39, 0xa9, 0x68, 0xa9, 0x53, - 0x93, 0x5b, 0xca, 0x7b, 0x7f, 0xc0, 0x63, 0x14, - 0x03, 0x02, 0x00, 0x01, 0x01, 0x16, 0x03, 0x02, - 0x00, 0x40, 0x01, 0xb1, 0xae, 0x1b, 0x8a, 0x65, - 0xf8, 0x37, 0x50, 0x39, 0x76, 0xef, 0xaa, 0xda, - 0x84, 0xc9, 0x5f, 0x80, 0xdc, 0xfa, 0xe0, 0x46, - 0x5a, 0xc7, 0x77, 0x9d, 0x76, 0x03, 0xa6, 0xd5, - 0x0e, 0xbf, 0x25, 0x30, 0x5c, 0x99, 0x7d, 0xcd, - 0x2b, 0xaa, 0x2e, 0x8c, 0xdd, 0xda, 0xaa, 0xd7, - 0xf1, 0xf6, 0x33, 0x47, 0x51, 0x1e, 0x83, 0xa1, - 0x83, 0x04, 0xd2, 0xb2, 0xc8, 0xbc, 0x11, 0xc5, - 0x1a, 0x87, - }, - { - 0x16, 0x03, 0x02, 0x00, 0x72, 0x04, 0x00, 0x00, - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, - 0xeb, 0x8b, 0xc7, 0xef, 0xba, 0xe8, 0x0f, 0x69, - 0xfe, 0xfb, 0xc3, 0x3d, 0x90, 0x5d, 0xd7, 0xb2, - 0x51, 0x64, 0xac, 0xc3, 0xae, 0x33, 0x03, 0x42, - 0x45, 0x2d, 0xa7, 0x57, 0xbd, 0xa3, 0x85, 0x64, - 0xa6, 0xfe, 0x5c, 0x33, 0x04, 0x93, 0xf2, 0x7c, - 0x06, 0x6d, 0xd7, 0xd7, 0xcf, 0x4a, 0xaf, 0xb2, - 0xdd, 0x06, 0xdc, 0x28, 0x14, 0x59, 0x23, 0x02, - 0xef, 0x97, 0x6a, 0xe8, 0xec, 0xca, 0x10, 0x44, - 0xcd, 0xb8, 0x50, 0x16, 0x46, 0x5a, 0x05, 0xda, - 0x04, 0xb3, 0x0e, 0xe9, 0xf0, 0x74, 0xc5, 0x23, - 0xc2, 0x0e, 0xa1, 0x54, 0x66, 0x7b, 0xe8, 0x14, - 0x03, 0x02, 0x00, 0x01, 0x01, 0x16, 0x03, 0x02, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x6b, 0x43, 0x1c, 0x58, 0xbc, 0x85, - 0xf7, 0xc1, 0x76, 0xbc, 0x72, 0x33, 0x41, 0x6b, - 0xb8, 0xf8, 0xfd, 0x53, 0x21, 0xc2, 0x41, 0x1b, - 0x72, 0x4f, 0xce, 0x97, 0xca, 0x14, 0x23, 0x4d, - 0xbc, 0x44, 0xd6, 0xd7, 0xfc, 0xbc, 0xfd, 0xfd, - 0x5d, 0x33, 0x42, 0x1b, 0x52, 0x40, 0x0a, 0x2b, - 0x6c, 0x98, 0x17, 0x03, 0x02, 0x00, 0x40, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, - 0x31, 0xef, 0x03, 0x7d, 0xa5, 0x74, 0x92, 0x24, - 0x34, 0xae, 0x4e, 0xc9, 0xfc, 0x59, 0xcb, 0x64, - 0xf4, 0x45, 0xb1, 0xac, 0x02, 0xf2, 0x87, 0xe7, - 0x2f, 0xfd, 0x01, 0xca, 0x78, 0x02, 0x2e, 0x3a, - 0x38, 0xcd, 0xb1, 0xe0, 0xf2, 0x2e, 0xf6, 0x27, - 0xa0, 0xac, 0x1f, 0x91, 0x43, 0xc2, 0x3d, 0x15, - 0x03, 0x02, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x9f, 0x30, 0x24, 0x56, - 0x2c, 0xde, 0xa0, 0xe6, 0x44, 0x35, 0x30, 0x51, - 0xec, 0xd4, 0x69, 0x2d, 0x46, 0x64, 0x04, 0x21, - 0xfe, 0x7c, 0x4d, 0xc5, 0xd0, 0x8c, 0xf9, 0xd2, - 0x3f, 0x88, 0x69, 0xd5, - }, -} - -// $ go test -run TestRunServer -serve -clientauth 1 \ -// -ciphersuites=0xc011 -minversion=0x0303 -maxversion=0x0303 -var tls12ServerScript = [][]byte{ - { - 0x16, 0x03, 0x01, 0x01, 0x1e, 0x01, 0x00, 0x01, - 0x1a, 0x03, 0x03, 0x51, 0xe5, 0x76, 0x84, 0x0e, - 0xb9, 0x17, 0xca, 0x08, 0x47, 0xd9, 0xbd, 0xd0, - 0x94, 0xd1, 0x97, 0xca, 0x5b, 0xe7, 0x20, 0xac, - 0x8e, 0xbb, 0xc7, 0x29, 0xe9, 0x26, 0xcf, 0x7d, - 0xb3, 0xdc, 0x99, 0x00, 0x00, 0x82, 0xc0, 0x30, - 0xc0, 0x2c, 0xc0, 0x28, 0xc0, 0x24, 0xc0, 0x14, - 0xc0, 0x0a, 0x00, 0xa3, 0x00, 0x9f, 0x00, 0x6b, - 0x00, 0x6a, 0x00, 0x39, 0x00, 0x38, 0xc0, 0x32, - 0xc0, 0x2e, 0xc0, 0x2a, 0xc0, 0x26, 0xc0, 0x0f, - 0xc0, 0x05, 0x00, 0x9d, 0x00, 0x3d, 0x00, 0x35, - 0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16, 0x00, 0x13, - 0xc0, 0x0d, 0xc0, 0x03, 0x00, 0x0a, 0xc0, 0x2f, - 0xc0, 0x2b, 0xc0, 0x27, 0xc0, 0x23, 0xc0, 0x13, - 0xc0, 0x09, 0x00, 0xa2, 0x00, 0x9e, 0x00, 0x67, - 0x00, 0x40, 0x00, 0x33, 0x00, 0x32, 0xc0, 0x31, - 0xc0, 0x2d, 0xc0, 0x29, 0xc0, 0x25, 0xc0, 0x0e, - 0xc0, 0x04, 0x00, 0x9c, 0x00, 0x3c, 0x00, 0x2f, - 0x00, 0x07, 0xc0, 0x11, 0xc0, 0x07, 0xc0, 0x0c, - 0xc0, 0x02, 0x00, 0x05, 0x00, 0x04, 0x00, 0x15, - 0x00, 0x12, 0x00, 0x09, 0x00, 0x14, 0x00, 0x11, - 0x00, 0x08, 0x00, 0x06, 0x00, 0x03, 0x00, 0xff, - 0x01, 0x00, 0x00, 0x6f, 0x00, 0x0b, 0x00, 0x04, - 0x03, 0x00, 0x01, 0x02, 0x00, 0x0a, 0x00, 0x34, - 0x00, 0x32, 0x00, 0x0e, 0x00, 0x0d, 0x00, 0x19, - 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x18, 0x00, 0x09, - 0x00, 0x0a, 0x00, 0x16, 0x00, 0x17, 0x00, 0x08, - 0x00, 0x06, 0x00, 0x07, 0x00, 0x14, 0x00, 0x15, - 0x00, 0x04, 0x00, 0x05, 0x00, 0x12, 0x00, 0x13, - 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x0f, - 0x00, 0x10, 0x00, 0x11, 0x00, 0x23, 0x00, 0x00, - 0x00, 0x0d, 0x00, 0x22, 0x00, 0x20, 0x06, 0x01, - 0x06, 0x02, 0x06, 0x03, 0x05, 0x01, 0x05, 0x02, - 0x05, 0x03, 0x04, 0x01, 0x04, 0x02, 0x04, 0x03, - 0x03, 0x01, 0x03, 0x02, 0x03, 0x03, 0x02, 0x01, - 0x02, 0x02, 0x02, 0x03, 0x01, 0x01, 0x00, 0x0f, - 0x00, 0x01, 0x01, - }, - { - 0x16, 0x03, 0x03, 0x00, 0x30, 0x02, 0x00, 0x00, - 0x2c, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc0, 0x11, 0x00, 0x00, - 0x04, 0x00, 0x23, 0x00, 0x00, 0x16, 0x03, 0x03, - 0x02, 0xbe, 0x0b, 0x00, 0x02, 0xba, 0x00, 0x02, - 0xb7, 0x00, 0x02, 0xb4, 0x30, 0x82, 0x02, 0xb0, - 0x30, 0x82, 0x02, 0x19, 0xa0, 0x03, 0x02, 0x01, - 0x02, 0x02, 0x09, 0x00, 0x85, 0xb0, 0xbb, 0xa4, - 0x8a, 0x7f, 0xb8, 0xca, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x05, 0x05, 0x00, 0x30, 0x45, 0x31, 0x0b, 0x30, - 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, - 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, - 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, - 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, - 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, - 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, - 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, - 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, - 0x74, 0x64, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30, - 0x30, 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, 0x39, - 0x33, 0x38, 0x5a, 0x17, 0x0d, 0x31, 0x31, 0x30, - 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, 0x39, 0x33, - 0x38, 0x5a, 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, - 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, - 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, - 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, - 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, - 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, - 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, - 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, 0x74, - 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, - 0x64, 0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, - 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xbb, 0x79, - 0xd6, 0xf5, 0x17, 0xb5, 0xe5, 0xbf, 0x46, 0x10, - 0xd0, 0xdc, 0x69, 0xbe, 0xe6, 0x2b, 0x07, 0x43, - 0x5a, 0xd0, 0x03, 0x2d, 0x8a, 0x7a, 0x43, 0x85, - 0xb7, 0x14, 0x52, 0xe7, 0xa5, 0x65, 0x4c, 0x2c, - 0x78, 0xb8, 0x23, 0x8c, 0xb5, 0xb4, 0x82, 0xe5, - 0xde, 0x1f, 0x95, 0x3b, 0x7e, 0x62, 0xa5, 0x2c, - 0xa5, 0x33, 0xd6, 0xfe, 0x12, 0x5c, 0x7a, 0x56, - 0xfc, 0xf5, 0x06, 0xbf, 0xfa, 0x58, 0x7b, 0x26, - 0x3f, 0xb5, 0xcd, 0x04, 0xd3, 0xd0, 0xc9, 0x21, - 0x96, 0x4a, 0xc7, 0xf4, 0x54, 0x9f, 0x5a, 0xbf, - 0xef, 0x42, 0x71, 0x00, 0xfe, 0x18, 0x99, 0x07, - 0x7f, 0x7e, 0x88, 0x7d, 0x7d, 0xf1, 0x04, 0x39, - 0xc4, 0xa2, 0x2e, 0xdb, 0x51, 0xc9, 0x7c, 0xe3, - 0xc0, 0x4c, 0x3b, 0x32, 0x66, 0x01, 0xcf, 0xaf, - 0xb1, 0x1d, 0xb8, 0x71, 0x9a, 0x1d, 0xdb, 0xdb, - 0x89, 0x6b, 0xae, 0xda, 0x2d, 0x79, 0x02, 0x03, - 0x01, 0x00, 0x01, 0xa3, 0x81, 0xa7, 0x30, 0x81, - 0xa4, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, - 0x04, 0x16, 0x04, 0x14, 0xb1, 0xad, 0xe2, 0x85, - 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, 0xce, 0x23, - 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, 0x88, 0x39, - 0x30, 0x75, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, - 0x6e, 0x30, 0x6c, 0x80, 0x14, 0xb1, 0xad, 0xe2, - 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, 0xce, - 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, 0x88, - 0x39, 0xa1, 0x49, 0xa4, 0x47, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x82, 0x09, 0x00, 0x85, - 0xb0, 0xbb, 0xa4, 0x8a, 0x7f, 0xb8, 0xca, 0x30, - 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, - 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x01, 0x05, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, - 0x08, 0x6c, 0x45, 0x24, 0xc7, 0x6b, 0xb1, 0x59, - 0xab, 0x0c, 0x52, 0xcc, 0xf2, 0xb0, 0x14, 0xd7, - 0x87, 0x9d, 0x7a, 0x64, 0x75, 0xb5, 0x5a, 0x95, - 0x66, 0xe4, 0xc5, 0x2b, 0x8e, 0xae, 0x12, 0x66, - 0x1f, 0xeb, 0x4f, 0x38, 0xb3, 0x6e, 0x60, 0xd3, - 0x92, 0xfd, 0xf7, 0x41, 0x08, 0xb5, 0x25, 0x13, - 0xb1, 0x18, 0x7a, 0x24, 0xfb, 0x30, 0x1d, 0xba, - 0xed, 0x98, 0xb9, 0x17, 0xec, 0xe7, 0xd7, 0x31, - 0x59, 0xdb, 0x95, 0xd3, 0x1d, 0x78, 0xea, 0x50, - 0x56, 0x5c, 0xd5, 0x82, 0x5a, 0x2d, 0x5a, 0x5f, - 0x33, 0xc4, 0xb6, 0xd8, 0xc9, 0x75, 0x90, 0x96, - 0x8c, 0x0f, 0x52, 0x98, 0xb5, 0xcd, 0x98, 0x1f, - 0x89, 0x20, 0x5f, 0xf2, 0xa0, 0x1c, 0xa3, 0x1b, - 0x96, 0x94, 0xdd, 0xa9, 0xfd, 0x57, 0xe9, 0x70, - 0xe8, 0x26, 0x6d, 0x71, 0x99, 0x9b, 0x26, 0x6e, - 0x38, 0x50, 0x29, 0x6c, 0x90, 0xa7, 0xbd, 0xd9, - 0x16, 0x03, 0x03, 0x01, 0x11, 0x0c, 0x00, 0x01, - 0x0d, 0x03, 0x00, 0x19, 0x85, 0x04, 0x01, 0x39, - 0xdc, 0xee, 0x44, 0x17, 0x5e, 0xdb, 0xd7, 0x27, - 0xaf, 0xb6, 0x56, 0xd9, 0xb4, 0x43, 0x5a, 0x99, - 0xcf, 0xaa, 0x31, 0x37, 0x0c, 0x6f, 0x3a, 0xa0, - 0xf8, 0x53, 0xc4, 0x74, 0xd1, 0x91, 0x0a, 0x46, - 0xf5, 0x38, 0x3b, 0x5c, 0x09, 0xd8, 0x97, 0xdc, - 0x4b, 0xaa, 0x70, 0x26, 0x48, 0xf2, 0xd6, 0x0b, - 0x31, 0xc9, 0xf8, 0xd4, 0x98, 0x43, 0xe1, 0x6c, - 0xd5, 0xc7, 0xb2, 0x8e, 0x0b, 0x01, 0xe6, 0xb6, - 0x00, 0x28, 0x80, 0x7b, 0xfc, 0x96, 0x8f, 0x0d, - 0xa2, 0x4f, 0xb0, 0x79, 0xaf, 0xdc, 0x61, 0x28, - 0x63, 0x33, 0x78, 0xf6, 0x31, 0x39, 0xfd, 0x8a, - 0xf4, 0x15, 0x18, 0x11, 0xfe, 0xdb, 0xd5, 0x07, - 0xda, 0x2c, 0xed, 0x49, 0xa0, 0x23, 0xbf, 0xd0, - 0x3a, 0x38, 0x1d, 0x54, 0xae, 0x1c, 0x7b, 0xea, - 0x29, 0xee, 0xd0, 0x38, 0xc1, 0x76, 0xa7, 0x7f, - 0x2a, 0xf4, 0xce, 0x1e, 0xac, 0xcc, 0x94, 0x79, - 0x90, 0x33, 0x04, 0x01, 0x00, 0x80, 0x4a, 0xf9, - 0xf5, 0x0a, 0x61, 0x37, 0x7e, 0x4e, 0x92, 0xb5, - 0x1c, 0x91, 0x21, 0xb2, 0xb5, 0x17, 0x00, 0xbf, - 0x01, 0x5f, 0x30, 0xec, 0x62, 0x08, 0xd6, 0x9d, - 0x1a, 0x08, 0x05, 0x72, 0x8b, 0xf4, 0x49, 0x85, - 0xa7, 0xbf, 0x3f, 0x75, 0x58, 0x3e, 0x26, 0x82, - 0xc3, 0x28, 0x07, 0xf9, 0x41, 0x7d, 0x03, 0x14, - 0x3b, 0xc3, 0x05, 0x64, 0xff, 0x52, 0xf4, 0x75, - 0x6a, 0x87, 0xcd, 0xdf, 0x93, 0x31, 0x0a, 0x71, - 0x60, 0x17, 0xc6, 0x33, 0xf0, 0x79, 0xb6, 0x7b, - 0xd0, 0x9c, 0xa0, 0x5f, 0x74, 0x14, 0x2c, 0x5a, - 0xb4, 0x3f, 0x39, 0xf5, 0xe4, 0x9f, 0xbe, 0x6d, - 0x21, 0xd2, 0xa9, 0x42, 0xf7, 0xdc, 0xa6, 0x65, - 0xb7, 0x6a, 0x7e, 0x2e, 0x14, 0xd3, 0xf6, 0xf3, - 0x4b, 0x4c, 0x5b, 0x1a, 0x70, 0x7a, 0xbc, 0xb0, - 0x12, 0xf3, 0x6e, 0x0c, 0xcf, 0x43, 0x22, 0xae, - 0x5b, 0xba, 0x00, 0xf8, 0xfd, 0xaf, 0x16, 0x03, - 0x03, 0x00, 0x0f, 0x0d, 0x00, 0x00, 0x0b, 0x02, - 0x01, 0x40, 0x00, 0x04, 0x04, 0x01, 0x04, 0x03, - 0x00, 0x00, 0x16, 0x03, 0x03, 0x00, 0x04, 0x0e, - 0x00, 0x00, 0x00, - }, - { - 0x16, 0x03, 0x03, 0x01, 0xfb, 0x0b, 0x00, 0x01, - 0xf7, 0x00, 0x01, 0xf4, 0x00, 0x01, 0xf1, 0x30, - 0x82, 0x01, 0xed, 0x30, 0x82, 0x01, 0x58, 0xa0, - 0x03, 0x02, 0x01, 0x02, 0x02, 0x01, 0x00, 0x30, - 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x0d, 0x01, 0x01, 0x05, 0x30, 0x26, 0x31, 0x10, - 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, - 0x07, 0x41, 0x63, 0x6d, 0x65, 0x20, 0x43, 0x6f, - 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, - 0x03, 0x13, 0x09, 0x31, 0x32, 0x37, 0x2e, 0x30, - 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x1e, 0x17, 0x0d, - 0x31, 0x31, 0x31, 0x32, 0x30, 0x38, 0x30, 0x37, - 0x35, 0x35, 0x31, 0x32, 0x5a, 0x17, 0x0d, 0x31, - 0x32, 0x31, 0x32, 0x30, 0x37, 0x30, 0x38, 0x30, - 0x30, 0x31, 0x32, 0x5a, 0x30, 0x26, 0x31, 0x10, - 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, - 0x07, 0x41, 0x63, 0x6d, 0x65, 0x20, 0x43, 0x6f, - 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, - 0x03, 0x13, 0x09, 0x31, 0x32, 0x37, 0x2e, 0x30, - 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x81, 0x9c, 0x30, - 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x0d, 0x01, 0x01, 0x01, 0x03, 0x81, 0x8c, 0x00, - 0x30, 0x81, 0x88, 0x02, 0x81, 0x80, 0x4e, 0xd0, - 0x7b, 0x31, 0xe3, 0x82, 0x64, 0xd9, 0x59, 0xc0, - 0xc2, 0x87, 0xa4, 0x5e, 0x1e, 0x8b, 0x73, 0x33, - 0xc7, 0x63, 0x53, 0xdf, 0x66, 0x92, 0x06, 0x84, - 0xf6, 0x64, 0xd5, 0x8f, 0xe4, 0x36, 0xa7, 0x1d, - 0x2b, 0xe8, 0xb3, 0x20, 0x36, 0x45, 0x23, 0xb5, - 0xe3, 0x95, 0xae, 0xed, 0xe0, 0xf5, 0x20, 0x9c, - 0x8d, 0x95, 0xdf, 0x7f, 0x5a, 0x12, 0xef, 0x87, - 0xe4, 0x5b, 0x68, 0xe4, 0xe9, 0x0e, 0x74, 0xec, - 0x04, 0x8a, 0x7f, 0xde, 0x93, 0x27, 0xc4, 0x01, - 0x19, 0x7a, 0xbd, 0xf2, 0xdc, 0x3d, 0x14, 0xab, - 0xd0, 0x54, 0xca, 0x21, 0x0c, 0xd0, 0x4d, 0x6e, - 0x87, 0x2e, 0x5c, 0xc5, 0xd2, 0xbb, 0x4d, 0x4b, - 0x4f, 0xce, 0xb6, 0x2c, 0xf7, 0x7e, 0x88, 0xec, - 0x7c, 0xd7, 0x02, 0x91, 0x74, 0xa6, 0x1e, 0x0c, - 0x1a, 0xda, 0xe3, 0x4a, 0x5a, 0x2e, 0xde, 0x13, - 0x9c, 0x4c, 0x40, 0x88, 0x59, 0x93, 0x02, 0x03, - 0x01, 0x00, 0x01, 0xa3, 0x32, 0x30, 0x30, 0x30, - 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, - 0xff, 0x04, 0x04, 0x03, 0x02, 0x00, 0xa0, 0x30, - 0x0d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x06, - 0x04, 0x04, 0x01, 0x02, 0x03, 0x04, 0x30, 0x0f, - 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x08, 0x30, - 0x06, 0x80, 0x04, 0x01, 0x02, 0x03, 0x04, 0x30, - 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x0d, 0x01, 0x01, 0x05, 0x03, 0x81, 0x81, 0x00, - 0x36, 0x1f, 0xb3, 0x7a, 0x0c, 0x75, 0xc9, 0x6e, - 0x37, 0x46, 0x61, 0x2b, 0xd5, 0xbd, 0xc0, 0xa7, - 0x4b, 0xcc, 0x46, 0x9a, 0x81, 0x58, 0x7c, 0x85, - 0x79, 0x29, 0xc8, 0xc8, 0xc6, 0x67, 0xdd, 0x32, - 0x56, 0x45, 0x2b, 0x75, 0xb6, 0xe9, 0x24, 0xa9, - 0x50, 0x9a, 0xbe, 0x1f, 0x5a, 0xfa, 0x1a, 0x15, - 0xd9, 0xcc, 0x55, 0x95, 0x72, 0x16, 0x83, 0xb9, - 0xc2, 0xb6, 0x8f, 0xfd, 0x88, 0x8c, 0x38, 0x84, - 0x1d, 0xab, 0x5d, 0x92, 0x31, 0x13, 0x4f, 0xfd, - 0x83, 0x3b, 0xc6, 0x9d, 0xf1, 0x11, 0x62, 0xb6, - 0x8b, 0xec, 0xab, 0x67, 0xbe, 0xc8, 0x64, 0xb0, - 0x11, 0x50, 0x46, 0x58, 0x17, 0x6b, 0x99, 0x1c, - 0xd3, 0x1d, 0xfc, 0x06, 0xf1, 0x0e, 0xe5, 0x96, - 0xa8, 0x0c, 0xf9, 0x78, 0x20, 0xb7, 0x44, 0x18, - 0x51, 0x8d, 0x10, 0x7e, 0x4f, 0x94, 0x67, 0xdf, - 0xa3, 0x4e, 0x70, 0x73, 0x8e, 0x90, 0x91, 0x85, - 0x16, 0x03, 0x03, 0x00, 0x8a, 0x10, 0x00, 0x00, - 0x86, 0x85, 0x04, 0x01, 0x5d, 0x3a, 0x92, 0x59, - 0x7f, 0x9a, 0x22, 0x36, 0x0e, 0x1b, 0x1d, 0x2a, - 0x05, 0xb7, 0xa4, 0xb6, 0x5d, 0xfc, 0x51, 0x6e, - 0x15, 0xe5, 0x89, 0x7c, 0xe2, 0xfa, 0x87, 0x38, - 0x05, 0x79, 0x15, 0x92, 0xb4, 0x8f, 0x88, 0x8f, - 0x9d, 0x5d, 0xa0, 0xaf, 0xf8, 0xce, 0xf9, 0x6f, - 0x83, 0xf4, 0x08, 0x69, 0xe4, 0x91, 0xc5, 0xed, - 0xb9, 0xc5, 0xa8, 0x1f, 0x4b, 0xec, 0xef, 0x91, - 0xc1, 0xa3, 0x34, 0x24, 0x18, 0x00, 0x2d, 0xcd, - 0xe6, 0x44, 0xef, 0x5a, 0x3e, 0x52, 0x63, 0x5b, - 0x36, 0x1f, 0x7e, 0xce, 0x9e, 0xaa, 0xda, 0x8d, - 0xb5, 0xc9, 0xea, 0xd8, 0x1b, 0xd1, 0x1c, 0x7c, - 0x07, 0xfc, 0x3c, 0x2d, 0x70, 0x1f, 0xf9, 0x4d, - 0xcb, 0xaa, 0xad, 0x07, 0xd5, 0x6d, 0xbd, 0xa6, - 0x61, 0xf3, 0x2f, 0xa3, 0x9c, 0x45, 0x02, 0x4a, - 0xac, 0x6c, 0xb6, 0x37, 0x95, 0xb1, 0x4a, 0xb5, - 0x0a, 0x4e, 0x60, 0x67, 0xd7, 0xe0, 0x04, 0x16, - 0x03, 0x03, 0x00, 0x88, 0x0f, 0x00, 0x00, 0x84, - 0x04, 0x01, 0x00, 0x80, 0x08, 0x83, 0x53, 0xf0, - 0xf8, 0x14, 0xf5, 0xc2, 0xd1, 0x8b, 0xf0, 0xa5, - 0xc1, 0xd8, 0x1a, 0x36, 0x4b, 0x75, 0x77, 0x02, - 0x19, 0xd8, 0x11, 0x3f, 0x5a, 0x36, 0xfc, 0xe9, - 0x2b, 0x4b, 0xf9, 0xfe, 0xda, 0x8a, 0x0f, 0x6e, - 0x3d, 0xd3, 0x52, 0x87, 0xf7, 0x9c, 0x78, 0x39, - 0xa8, 0xf1, 0xd7, 0xf7, 0x4e, 0x35, 0x33, 0xf9, - 0xc5, 0x76, 0xa8, 0x12, 0xc4, 0x91, 0x33, 0x1d, - 0x93, 0x8c, 0xbf, 0xb1, 0x83, 0x00, 0x90, 0xc5, - 0x52, 0x3e, 0xe0, 0x0a, 0xe8, 0x92, 0x75, 0xdf, - 0x54, 0x5f, 0x9f, 0x95, 0x76, 0x62, 0xb5, 0x85, - 0x69, 0xa4, 0x86, 0x85, 0x6c, 0xf3, 0x6b, 0x2a, - 0x72, 0x7b, 0x4d, 0x42, 0x33, 0x67, 0x4a, 0xce, - 0xb5, 0xdb, 0x9b, 0xae, 0xc0, 0xb0, 0x10, 0xeb, - 0x3b, 0xf4, 0xc2, 0x9a, 0x64, 0x47, 0x4c, 0x1e, - 0xa5, 0x91, 0x7f, 0x6d, 0xd1, 0x03, 0xf5, 0x4a, - 0x90, 0x69, 0x18, 0xb1, 0x14, 0x03, 0x03, 0x00, - 0x01, 0x01, 0x16, 0x03, 0x03, 0x00, 0x24, 0x59, - 0xfc, 0x7e, 0xae, 0xb3, 0xbf, 0xab, 0x4d, 0xdb, - 0x4e, 0xab, 0xa9, 0x6d, 0x6b, 0x4c, 0x60, 0xb6, - 0x16, 0xe0, 0xab, 0x7f, 0x52, 0x2d, 0xa1, 0xfc, - 0xe1, 0x80, 0xd2, 0x8a, 0xa1, 0xe5, 0x8f, 0xa1, - 0x70, 0x93, 0x23, - }, - { - 0x16, 0x03, 0x03, 0x02, 0x67, 0x04, 0x00, 0x02, - 0x63, 0x00, 0x00, 0x00, 0x00, 0x02, 0x5d, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, - 0xea, 0x8b, 0xc5, 0xef, 0xba, 0x64, 0xb7, 0x23, - 0x08, 0x86, 0x4f, 0x37, 0xe0, 0x8f, 0xbd, 0x75, - 0x71, 0x2b, 0xcb, 0x20, 0x75, 0x11, 0x3b, 0xa2, - 0x9e, 0x39, 0x3c, 0x03, 0xef, 0x6e, 0x41, 0xd7, - 0xcf, 0x1a, 0x2c, 0xf2, 0xfe, 0xc2, 0xd3, 0x65, - 0x59, 0x00, 0x9d, 0x03, 0xb4, 0xf2, 0x20, 0xe4, - 0x33, 0x80, 0xcd, 0xf6, 0xe4, 0x59, 0x22, 0xf7, - 0xfd, 0x88, 0x0e, 0xa4, 0x09, 0xc0, 0x0d, 0x10, - 0x80, 0x10, 0x79, 0xee, 0x70, 0x96, 0xdb, 0x22, - 0x8b, 0xb7, 0xac, 0xe0, 0x98, 0xad, 0xe9, 0xe3, - 0xcb, 0xea, 0x9f, 0xe6, 0x83, 0x28, 0x7c, 0x7e, - 0x4e, 0x9a, 0x8d, 0xd9, 0xf3, 0x86, 0xf4, 0x89, - 0x8b, 0x79, 0x8f, 0xbb, 0xe9, 0x74, 0x02, 0x02, - 0x14, 0x04, 0xea, 0xba, 0x16, 0x10, 0xa1, 0x85, - 0xbe, 0x4e, 0x4e, 0x92, 0xc5, 0x83, 0xf6, 0x1e, - 0x1f, 0xd4, 0x25, 0xc2, 0xc2, 0xb9, 0xce, 0x33, - 0x63, 0x66, 0x79, 0x1f, 0x54, 0x35, 0xc1, 0xe8, - 0x89, 0x34, 0x78, 0x94, 0x36, 0x14, 0xef, 0x01, - 0x1f, 0xf1, 0xbd, 0x77, 0x2c, 0x4d, 0xac, 0x5c, - 0x5c, 0x4a, 0xc6, 0xed, 0xd8, 0x0e, 0x72, 0x84, - 0x83, 0xdc, 0x56, 0x84, 0xc8, 0xf3, 0x89, 0x56, - 0xfd, 0x89, 0xc1, 0xc9, 0x9a, 0x29, 0x91, 0x7e, - 0x19, 0xe9, 0x8b, 0x5b, 0x11, 0x15, 0x4e, 0x6c, - 0xf4, 0x89, 0xe7, 0x6d, 0x68, 0x1e, 0xf9, 0x6c, - 0x23, 0x72, 0x05, 0x68, 0x82, 0x60, 0x84, 0x1f, - 0x83, 0x20, 0x09, 0x86, 0x10, 0x81, 0xec, 0xec, - 0xdc, 0x25, 0x53, 0x20, 0xfa, 0xa9, 0x41, 0x64, - 0xd6, 0x20, 0xf3, 0xf4, 0x52, 0xf2, 0x80, 0x62, - 0x83, 0xc9, 0x23, 0x66, 0x44, 0x95, 0x5a, 0x99, - 0x8a, 0xe1, 0x26, 0x63, 0xc1, 0x8b, 0x31, 0xf9, - 0x21, 0x06, 0x77, 0x04, 0x27, 0xf2, 0x0c, 0x63, - 0x83, 0x45, 0xa0, 0xa9, 0x7b, 0xcf, 0xdf, 0xd7, - 0x56, 0x75, 0xbc, 0xdd, 0x95, 0x36, 0xb1, 0x75, - 0x39, 0x05, 0x00, 0x3c, 0x8a, 0x79, 0xd6, 0xe9, - 0xf0, 0x4b, 0xdc, 0x51, 0x6b, 0x01, 0x94, 0x16, - 0x87, 0x12, 0x92, 0x6c, 0x07, 0xc1, 0xf5, 0x58, - 0xb7, 0x2a, 0x81, 0xf5, 0xa0, 0x37, 0x8b, 0xa6, - 0x22, 0xfe, 0x28, 0x0a, 0x7e, 0x68, 0xe2, 0xda, - 0x6c, 0x53, 0xee, 0x0e, 0x8d, 0x2d, 0x8b, 0x0b, - 0xda, 0xf8, 0x99, 0x3e, 0x0e, 0xed, 0x9f, 0xc1, - 0x2b, 0xf6, 0xfe, 0xe9, 0x52, 0x38, 0x7b, 0x83, - 0x9a, 0x50, 0xa6, 0xd7, 0x49, 0x83, 0x43, 0x7e, - 0x82, 0xec, 0xc7, 0x09, 0x3d, 0x3d, 0xb1, 0xee, - 0xe8, 0xc5, 0x6a, 0xc3, 0x3d, 0x4b, 0x4c, 0x6a, - 0xbb, 0x0b, 0x2c, 0x24, 0x2e, 0xdb, 0x7d, 0x57, - 0x87, 0xb4, 0x80, 0xa5, 0xae, 0xff, 0x54, 0xa8, - 0xa5, 0x27, 0x69, 0x95, 0xc8, 0xe7, 0x79, 0xc7, - 0x89, 0x2a, 0x73, 0x49, 0xcb, 0xf5, 0xc5, 0xbc, - 0x4a, 0xe0, 0x73, 0xa9, 0xbc, 0x88, 0x64, 0x96, - 0x98, 0xa5, 0x1e, 0xe3, 0x43, 0xc1, 0x7d, 0x78, - 0xc7, 0x94, 0x72, 0xd4, 0x2c, 0x6e, 0x85, 0x39, - 0x9a, 0xaf, 0xdb, 0xa1, 0xe9, 0xe2, 0xcb, 0x37, - 0x04, 0xc6, 0x8c, 0x81, 0xd3, 0x2a, 0xb7, 0xbe, - 0x6c, 0x07, 0x1f, 0x5e, 0xd9, 0x00, 0xd2, 0xf7, - 0xe1, 0xa7, 0xbc, 0x0c, 0xb6, 0x6d, 0xfb, 0x3f, - 0x3d, 0x24, 0xaa, 0xfb, 0x7e, 0xe1, 0xb5, 0x1b, - 0xff, 0x38, 0xaa, 0x69, 0x59, 0x38, 0x52, 0x9a, - 0x0e, 0x6d, 0xbc, 0xde, 0x4f, 0x13, 0x09, 0x17, - 0xc4, 0xa9, 0x05, 0x84, 0xbc, 0x50, 0xef, 0x40, - 0xb0, 0x4c, 0x24, 0x32, 0xed, 0x94, 0x2c, 0xdd, - 0xda, 0x20, 0x24, 0x67, 0xe2, 0xea, 0x71, 0x3d, - 0x4a, 0x04, 0x0d, 0x98, 0x29, 0x20, 0x4c, 0xeb, - 0x70, 0xce, 0x45, 0x9e, 0x5a, 0xaf, 0xb6, 0xa3, - 0x92, 0xc8, 0x28, 0xf2, 0xe3, 0xe8, 0x8a, 0x5d, - 0x0a, 0x33, 0x79, 0x9b, 0x6a, 0xf3, 0x30, 0x01, - 0x1d, 0x47, 0xbd, 0x01, 0xcc, 0x4d, 0x71, 0xc0, - 0x56, 0xfa, 0xfd, 0x37, 0xed, 0x0f, 0x27, 0xc0, - 0xbb, 0xa0, 0xee, 0xc3, 0x79, 0x8b, 0xe7, 0x41, - 0x8f, 0xfa, 0x3a, 0xcb, 0x45, 0x3b, 0x85, 0x9f, - 0x06, 0x90, 0xb2, 0x51, 0xc0, 0x48, 0x10, 0xac, - 0x2a, 0xec, 0xec, 0x48, 0x7a, 0x19, 0x47, 0xc4, - 0x2a, 0xeb, 0xb3, 0xa2, 0x07, 0x22, 0x32, 0x78, - 0xf4, 0x73, 0x5e, 0x92, 0x42, 0x15, 0xa1, 0x90, - 0x91, 0xd0, 0xeb, 0x12, 0x14, 0x03, 0x03, 0x00, - 0x01, 0x01, 0x16, 0x03, 0x03, 0x00, 0x24, 0x45, - 0x4b, 0x80, 0x42, 0x46, 0xde, 0xbb, 0xe7, 0x76, - 0xd1, 0x33, 0x92, 0xfc, 0x46, 0x17, 0x6d, 0x21, - 0xf6, 0x0e, 0x16, 0xca, 0x9b, 0x9b, 0x04, 0x65, - 0x16, 0x40, 0x44, 0x64, 0xbc, 0x58, 0xfa, 0x2a, - 0x49, 0xe9, 0xed, 0x17, 0x03, 0x03, 0x00, 0x21, - 0x89, 0x71, 0xcd, 0x56, 0x54, 0xbf, 0x73, 0xde, - 0xfb, 0x4b, 0x4e, 0xf1, 0x7f, 0xc6, 0x75, 0xa6, - 0xbd, 0x6b, 0x6c, 0xd9, 0xdc, 0x0c, 0x71, 0xb4, - 0xb9, 0xbb, 0x6e, 0xfa, 0x9e, 0xc7, 0xc7, 0x4c, - 0x24, 0x15, 0x03, 0x03, 0x00, 0x16, 0x62, 0xea, - 0x65, 0x69, 0x68, 0x4a, 0xce, 0xa7, 0x9e, 0xce, - 0xc0, 0xf1, 0x5c, 0x96, 0xd9, 0x1f, 0x49, 0xac, - 0x2d, 0x05, 0x89, 0x94, - }, -} - -// cert.pem and key.pem were generated with generate_cert.go -// Thus, they have no ExtKeyUsage fields and trigger an error -// when verification is turned on. - -var clientCertificate = loadPEMCert(` ------BEGIN CERTIFICATE----- -MIIB7TCCAVigAwIBAgIBADALBgkqhkiG9w0BAQUwJjEQMA4GA1UEChMHQWNtZSBD -bzESMBAGA1UEAxMJMTI3LjAuMC4xMB4XDTExMTIwODA3NTUxMloXDTEyMTIwNzA4 -MDAxMlowJjEQMA4GA1UEChMHQWNtZSBDbzESMBAGA1UEAxMJMTI3LjAuMC4xMIGc -MAsGCSqGSIb3DQEBAQOBjAAwgYgCgYBO0Hsx44Jk2VnAwoekXh6LczPHY1PfZpIG -hPZk1Y/kNqcdK+izIDZFI7Xjla7t4PUgnI2V339aEu+H5Fto5OkOdOwEin/ekyfE -ARl6vfLcPRSr0FTKIQzQTW6HLlzF0rtNS0/Otiz3fojsfNcCkXSmHgwa2uNKWi7e -E5xMQIhZkwIDAQABozIwMDAOBgNVHQ8BAf8EBAMCAKAwDQYDVR0OBAYEBAECAwQw -DwYDVR0jBAgwBoAEAQIDBDALBgkqhkiG9w0BAQUDgYEANh+zegx1yW43RmEr1b3A -p0vMRpqBWHyFeSnIyMZn3TJWRSt1tukkqVCavh9a+hoV2cxVlXIWg7nCto/9iIw4 -hB2rXZIxE0/9gzvGnfERYraL7KtnvshksBFQRlgXa5kc0x38BvEO5ZaoDPl4ILdE -GFGNEH5PlGffo05wc46QkYU= ------END CERTIFICATE----- -`) - -/* corresponding key.pem for cert.pem is: ------BEGIN RSA PRIVATE KEY----- -MIICWgIBAAKBgE7QezHjgmTZWcDCh6ReHotzM8djU99mkgaE9mTVj+Q2px0r6LMg -NkUjteOVru3g9SCcjZXff1oS74fkW2jk6Q507ASKf96TJ8QBGXq98tw9FKvQVMoh -DNBNbocuXMXSu01LT862LPd+iOx81wKRdKYeDBra40paLt4TnExAiFmTAgMBAAEC -gYBxvXd8yNteFTns8A/2yomEMC4yeosJJSpp1CsN3BJ7g8/qTnrVPxBy+RU+qr63 -t2WquaOu/cr5P8iEsa6lk20tf8pjKLNXeX0b1RTzK8rJLbS7nGzP3tvOhL096VtQ -dAo4ROEaro0TzYpHmpciSvxVIeEIAAdFDObDJPKqcJAxyQJBAJizfYgK8Gzx9fsx -hxp+VteCbVPg2euASH5Yv3K5LukRdKoSzHE2grUVQgN/LafC0eZibRanxHegYSr7 -7qaswKUCQQCEIWor/X4XTMdVj3Oj+vpiw75y/S9gh682+myZL+d/02IEkwnB098P -RkKVpenBHyrGg0oeN5La7URILWKj7CPXAkBKo6F+d+phNjwIFoN1Xb/RA32w/D1I -saG9sF+UEhRt9AxUfW/U/tIQ9V0ZHHcSg1XaCM5Nvp934brdKdvTOKnJAkBD5h/3 -Rybatlvg/fzBEaJFyq09zhngkxlZOUtBVTqzl17RVvY2orgH02U4HbCHy4phxOn7 -qTdQRYlHRftgnWK1AkANibn9PRYJ7mJyJ9Dyj2QeNcSkSTzrt0tPvUMf4+meJymN -1Ntu5+S1DLLzfxlaljWG6ylW6DNxujCyuXIV2rvA ------END RSA PRIVATE KEY----- -*/ - -var clientECDSACertificate = loadPEMCert(` ------BEGIN CERTIFICATE----- -MIIB/DCCAV4CCQCaMIRsJjXZFzAJBgcqhkjOPQQBMEUxCzAJBgNVBAYTAkFVMRMw -EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 -eSBMdGQwHhcNMTIxMTE0MTMyNTUzWhcNMjIxMTEyMTMyNTUzWjBBMQswCQYDVQQG -EwJBVTEMMAoGA1UECBMDTlNXMRAwDgYDVQQHEwdQeXJtb250MRIwEAYDVQQDEwlK -b2VsIFNpbmcwgZswEAYHKoZIzj0CAQYFK4EEACMDgYYABACVjJF1FMBexFe01MNv -ja5oHt1vzobhfm6ySD6B5U7ixohLZNz1MLvT/2XMW/TdtWo+PtAd3kfDdq0Z9kUs -jLzYHQFMH3CQRnZIi4+DzEpcj0B22uCJ7B0rxE4wdihBsmKo+1vx+U56jb0JuK7q -ixgnTy5w/hOWusPTQBbNZU6sER7m8TAJBgcqhkjOPQQBA4GMADCBiAJCAOAUxGBg -C3JosDJdYUoCdFzCgbkWqD8pyDbHgf9stlvZcPE4O1BIKJTLCRpS8V3ujfK58PDa -2RU6+b0DeoeiIzXsAkIBo9SKeDUcSpoj0gq+KxAxnZxfvuiRs9oa9V2jI/Umi0Vw -jWVim34BmT0Y9hCaOGGbLlfk+syxis7iI6CH8OFnUes= ------END CERTIFICATE----- -`) - -/* corresponding key for cert is: ------BEGIN EC PARAMETERS----- -BgUrgQQAIw== ------END EC PARAMETERS----- ------BEGIN EC PRIVATE KEY----- -MIHcAgEBBEIBkJN9X4IqZIguiEVKMqeBUP5xtRsEv4HJEtOpOGLELwO53SD78Ew8 -k+wLWoqizS3NpQyMtrU8JFdWfj+C57UNkOugBwYFK4EEACOhgYkDgYYABACVjJF1 -FMBexFe01MNvja5oHt1vzobhfm6ySD6B5U7ixohLZNz1MLvT/2XMW/TdtWo+PtAd -3kfDdq0Z9kUsjLzYHQFMH3CQRnZIi4+DzEpcj0B22uCJ7B0rxE4wdihBsmKo+1vx -+U56jb0JuK7qixgnTy5w/hOWusPTQBbNZU6sER7m8Q== ------END EC PRIVATE KEY----- -*/ -var clientauthECDSATests = []clientauthTest{ - // Server asks for cert with empty CA list, client gives one - // go test -run "TestRunServer" -serve \ - // -clientauth 1 -ciphersuites=0xc00a - // openssl s_client -host 127.0.0.1 -port 10443 \ - // -cipher ECDHE-ECDSA-AES256-SHA -key client.key -cert client.crt - {"RequestClientCert, client gives it", RequestClientCert, []*x509.Certificate{clientECDSACertificate}, [][]byte{ - { - 0x16, 0x03, 0x01, 0x00, 0xa0, 0x01, 0x00, 0x00, - 0x9c, 0x03, 0x03, 0x51, 0xe5, 0x73, 0xc5, 0xae, - 0x51, 0x94, 0xb4, 0xf2, 0xe8, 0xf6, 0x03, 0x0e, - 0x3b, 0x34, 0xaf, 0xf0, 0xdc, 0x1b, 0xcc, 0xd8, - 0x0c, 0x45, 0x82, 0xd4, 0xd6, 0x76, 0x04, 0x6e, - 0x4f, 0x7a, 0x24, 0x00, 0x00, 0x04, 0xc0, 0x0a, - 0x00, 0xff, 0x01, 0x00, 0x00, 0x6f, 0x00, 0x0b, - 0x00, 0x04, 0x03, 0x00, 0x01, 0x02, 0x00, 0x0a, - 0x00, 0x34, 0x00, 0x32, 0x00, 0x0e, 0x00, 0x0d, - 0x00, 0x19, 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x18, - 0x00, 0x09, 0x00, 0x0a, 0x00, 0x16, 0x00, 0x17, - 0x00, 0x08, 0x00, 0x06, 0x00, 0x07, 0x00, 0x14, - 0x00, 0x15, 0x00, 0x04, 0x00, 0x05, 0x00, 0x12, - 0x00, 0x13, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, - 0x00, 0x0f, 0x00, 0x10, 0x00, 0x11, 0x00, 0x23, - 0x00, 0x00, 0x00, 0x0d, 0x00, 0x22, 0x00, 0x20, - 0x06, 0x01, 0x06, 0x02, 0x06, 0x03, 0x05, 0x01, - 0x05, 0x02, 0x05, 0x03, 0x04, 0x01, 0x04, 0x02, - 0x04, 0x03, 0x03, 0x01, 0x03, 0x02, 0x03, 0x03, - 0x02, 0x01, 0x02, 0x02, 0x02, 0x03, 0x01, 0x01, - 0x00, 0x0f, 0x00, 0x01, 0x01, - }, - { - 0x16, 0x03, 0x01, 0x00, 0x30, 0x02, 0x00, 0x00, - 0x2c, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0a, 0x00, 0x00, - 0x04, 0x00, 0x23, 0x00, 0x00, 0x16, 0x03, 0x01, - 0x02, 0x0e, 0x0b, 0x00, 0x02, 0x0a, 0x00, 0x02, - 0x07, 0x00, 0x02, 0x04, 0x30, 0x82, 0x02, 0x00, - 0x30, 0x82, 0x01, 0x62, 0x02, 0x09, 0x00, 0xb8, - 0xbf, 0x2d, 0x47, 0xa0, 0xd2, 0xeb, 0xf4, 0x30, - 0x09, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, - 0x04, 0x01, 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, - 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, - 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, - 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, - 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, - 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, - 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, - 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, 0x74, - 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, - 0x64, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x32, 0x31, - 0x31, 0x32, 0x32, 0x31, 0x35, 0x30, 0x36, 0x33, - 0x32, 0x5a, 0x17, 0x0d, 0x32, 0x32, 0x31, 0x31, - 0x32, 0x30, 0x31, 0x35, 0x30, 0x36, 0x33, 0x32, - 0x5a, 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, 0x06, - 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, - 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, - 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, 0x30, - 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x18, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, - 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, 0x74, 0x73, - 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, - 0x30, 0x81, 0x9b, 0x30, 0x10, 0x06, 0x07, 0x2a, - 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, - 0x2b, 0x81, 0x04, 0x00, 0x23, 0x03, 0x81, 0x86, - 0x00, 0x04, 0x00, 0xc4, 0xa1, 0xed, 0xbe, 0x98, - 0xf9, 0x0b, 0x48, 0x73, 0x36, 0x7e, 0xc3, 0x16, - 0x56, 0x11, 0x22, 0xf2, 0x3d, 0x53, 0xc3, 0x3b, - 0x4d, 0x21, 0x3d, 0xcd, 0x6b, 0x75, 0xe6, 0xf6, - 0xb0, 0xdc, 0x9a, 0xdf, 0x26, 0xc1, 0xbc, 0xb2, - 0x87, 0xf0, 0x72, 0x32, 0x7c, 0xb3, 0x64, 0x2f, - 0x1c, 0x90, 0xbc, 0xea, 0x68, 0x23, 0x10, 0x7e, - 0xfe, 0xe3, 0x25, 0xc0, 0x48, 0x3a, 0x69, 0xe0, - 0x28, 0x6d, 0xd3, 0x37, 0x00, 0xef, 0x04, 0x62, - 0xdd, 0x0d, 0xa0, 0x9c, 0x70, 0x62, 0x83, 0xd8, - 0x81, 0xd3, 0x64, 0x31, 0xaa, 0x9e, 0x97, 0x31, - 0xbd, 0x96, 0xb0, 0x68, 0xc0, 0x9b, 0x23, 0xde, - 0x76, 0x64, 0x3f, 0x1a, 0x5c, 0x7f, 0xe9, 0x12, - 0x0e, 0x58, 0x58, 0xb6, 0x5f, 0x70, 0xdd, 0x9b, - 0xd8, 0xea, 0xd5, 0xd7, 0xf5, 0xd5, 0xcc, 0xb9, - 0xb6, 0x9f, 0x30, 0x66, 0x5b, 0x66, 0x9a, 0x20, - 0xe2, 0x27, 0xe5, 0xbf, 0xfe, 0x3b, 0x30, 0x09, - 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, - 0x01, 0x03, 0x81, 0x8c, 0x00, 0x30, 0x81, 0x88, - 0x02, 0x42, 0x01, 0x88, 0xa2, 0x4f, 0xeb, 0xe2, - 0x45, 0xc5, 0x48, 0x7d, 0x1b, 0xac, 0xf5, 0xed, - 0x98, 0x9d, 0xae, 0x47, 0x70, 0xc0, 0x5e, 0x1b, - 0xb6, 0x2f, 0xbd, 0xf1, 0xb6, 0x4d, 0xb7, 0x61, - 0x40, 0xd3, 0x11, 0xa2, 0xce, 0xee, 0x0b, 0x7e, - 0x92, 0x7e, 0xff, 0x76, 0x9d, 0xc3, 0x3b, 0x7e, - 0xa5, 0x3f, 0xce, 0xfa, 0x10, 0xe2, 0x59, 0xec, - 0x47, 0x2d, 0x7c, 0xac, 0xda, 0x4e, 0x97, 0x0e, - 0x15, 0xa0, 0x6f, 0xd0, 0x02, 0x42, 0x01, 0x4d, - 0xfc, 0xbe, 0x67, 0x13, 0x9c, 0x2d, 0x05, 0x0e, - 0xbd, 0x3f, 0xa3, 0x8c, 0x25, 0xc1, 0x33, 0x13, - 0x83, 0x0d, 0x94, 0x06, 0xbb, 0xd4, 0x37, 0x7a, - 0xf6, 0xec, 0x7a, 0xc9, 0x86, 0x2e, 0xdd, 0xd7, - 0x11, 0x69, 0x7f, 0x85, 0x7c, 0x56, 0xde, 0xfb, - 0x31, 0x78, 0x2b, 0xe4, 0xc7, 0x78, 0x0d, 0xae, - 0xcb, 0xbe, 0x9e, 0x4e, 0x36, 0x24, 0x31, 0x7b, - 0x6a, 0x0f, 0x39, 0x95, 0x12, 0x07, 0x8f, 0x2a, - 0x16, 0x03, 0x01, 0x01, 0x1a, 0x0c, 0x00, 0x01, - 0x16, 0x03, 0x00, 0x19, 0x85, 0x04, 0x01, 0x39, - 0xdc, 0xee, 0x44, 0x17, 0x5e, 0xdb, 0xd7, 0x27, - 0xaf, 0xb6, 0x56, 0xd9, 0xb4, 0x43, 0x5a, 0x99, - 0xcf, 0xaa, 0x31, 0x37, 0x0c, 0x6f, 0x3a, 0xa0, - 0xf8, 0x53, 0xc4, 0x74, 0xd1, 0x91, 0x0a, 0x46, - 0xf5, 0x38, 0x3b, 0x5c, 0x09, 0xd8, 0x97, 0xdc, - 0x4b, 0xaa, 0x70, 0x26, 0x48, 0xf2, 0xd6, 0x0b, - 0x31, 0xc9, 0xf8, 0xd4, 0x98, 0x43, 0xe1, 0x6c, - 0xd5, 0xc7, 0xb2, 0x8e, 0x0b, 0x01, 0xe6, 0xb6, - 0x00, 0x28, 0x80, 0x7b, 0xfc, 0x96, 0x8f, 0x0d, - 0xa2, 0x4f, 0xb0, 0x79, 0xaf, 0xdc, 0x61, 0x28, - 0x63, 0x33, 0x78, 0xf6, 0x31, 0x39, 0xfd, 0x8a, - 0xf4, 0x15, 0x18, 0x11, 0xfe, 0xdb, 0xd5, 0x07, - 0xda, 0x2c, 0xed, 0x49, 0xa0, 0x23, 0xbf, 0xd0, - 0x3a, 0x38, 0x1d, 0x54, 0xae, 0x1c, 0x7b, 0xea, - 0x29, 0xee, 0xd0, 0x38, 0xc1, 0x76, 0xa7, 0x7f, - 0x2a, 0xf4, 0xce, 0x1e, 0xac, 0xcc, 0x94, 0x79, - 0x90, 0x33, 0x00, 0x8b, 0x30, 0x81, 0x88, 0x02, - 0x42, 0x00, 0xc6, 0x85, 0x8e, 0x06, 0xb7, 0x04, - 0x04, 0xe9, 0xcd, 0x9e, 0x3e, 0xcb, 0x66, 0x23, - 0x95, 0xb4, 0x42, 0x9c, 0x64, 0x81, 0x39, 0x05, - 0x3f, 0xb5, 0x21, 0xf8, 0x28, 0xaf, 0x60, 0x6b, - 0x4d, 0x3d, 0xba, 0xa1, 0x4b, 0x5e, 0x77, 0xef, - 0xe7, 0x59, 0x28, 0xfe, 0x1d, 0xc1, 0x27, 0xa2, - 0xff, 0xa8, 0xde, 0x33, 0x48, 0xb3, 0xc1, 0x85, - 0x6a, 0x42, 0x9b, 0xf9, 0x7e, 0x7e, 0x31, 0xc2, - 0xe5, 0xbd, 0x66, 0x02, 0x42, 0x00, 0xad, 0x7d, - 0x06, 0x35, 0xab, 0xec, 0x8d, 0xac, 0xd4, 0xba, - 0x1b, 0x49, 0x5e, 0x05, 0x5f, 0xf0, 0x97, 0x93, - 0x82, 0xb8, 0x2b, 0x8d, 0x91, 0x98, 0x63, 0x8e, - 0xb4, 0x14, 0x62, 0xdb, 0x1e, 0xc9, 0x2b, 0x30, - 0xf8, 0x41, 0x9b, 0xa6, 0xe6, 0xbc, 0xde, 0x0e, - 0x68, 0x30, 0x21, 0xf4, 0xa8, 0xa9, 0x1b, 0xec, - 0x44, 0x4f, 0x5d, 0x02, 0x2f, 0x60, 0x45, 0x60, - 0xba, 0xe0, 0x4e, 0xc0, 0xd4, 0x3b, 0x01, 0x16, - 0x03, 0x01, 0x00, 0x09, 0x0d, 0x00, 0x00, 0x05, - 0x02, 0x01, 0x40, 0x00, 0x00, 0x16, 0x03, 0x01, - 0x00, 0x04, 0x0e, 0x00, 0x00, 0x00, - }, - { - 0x16, 0x03, 0x01, 0x02, 0x0a, 0x0b, 0x00, 0x02, - 0x06, 0x00, 0x02, 0x03, 0x00, 0x02, 0x00, 0x30, - 0x82, 0x01, 0xfc, 0x30, 0x82, 0x01, 0x5e, 0x02, - 0x09, 0x00, 0x9a, 0x30, 0x84, 0x6c, 0x26, 0x35, - 0xd9, 0x17, 0x30, 0x09, 0x06, 0x07, 0x2a, 0x86, - 0x48, 0xce, 0x3d, 0x04, 0x01, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x30, 0x1e, 0x17, 0x0d, - 0x31, 0x32, 0x31, 0x31, 0x31, 0x34, 0x31, 0x33, - 0x32, 0x35, 0x35, 0x33, 0x5a, 0x17, 0x0d, 0x32, - 0x32, 0x31, 0x31, 0x31, 0x32, 0x31, 0x33, 0x32, - 0x35, 0x35, 0x33, 0x5a, 0x30, 0x41, 0x31, 0x0b, - 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, - 0x02, 0x41, 0x55, 0x31, 0x0c, 0x30, 0x0a, 0x06, - 0x03, 0x55, 0x04, 0x08, 0x13, 0x03, 0x4e, 0x53, - 0x57, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, - 0x04, 0x07, 0x13, 0x07, 0x50, 0x79, 0x72, 0x6d, - 0x6f, 0x6e, 0x74, 0x31, 0x12, 0x30, 0x10, 0x06, - 0x03, 0x55, 0x04, 0x03, 0x13, 0x09, 0x4a, 0x6f, - 0x65, 0x6c, 0x20, 0x53, 0x69, 0x6e, 0x67, 0x30, - 0x81, 0x9b, 0x30, 0x10, 0x06, 0x07, 0x2a, 0x86, - 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b, - 0x81, 0x04, 0x00, 0x23, 0x03, 0x81, 0x86, 0x00, - 0x04, 0x00, 0x95, 0x8c, 0x91, 0x75, 0x14, 0xc0, - 0x5e, 0xc4, 0x57, 0xb4, 0xd4, 0xc3, 0x6f, 0x8d, - 0xae, 0x68, 0x1e, 0xdd, 0x6f, 0xce, 0x86, 0xe1, - 0x7e, 0x6e, 0xb2, 0x48, 0x3e, 0x81, 0xe5, 0x4e, - 0xe2, 0xc6, 0x88, 0x4b, 0x64, 0xdc, 0xf5, 0x30, - 0xbb, 0xd3, 0xff, 0x65, 0xcc, 0x5b, 0xf4, 0xdd, - 0xb5, 0x6a, 0x3e, 0x3e, 0xd0, 0x1d, 0xde, 0x47, - 0xc3, 0x76, 0xad, 0x19, 0xf6, 0x45, 0x2c, 0x8c, - 0xbc, 0xd8, 0x1d, 0x01, 0x4c, 0x1f, 0x70, 0x90, - 0x46, 0x76, 0x48, 0x8b, 0x8f, 0x83, 0xcc, 0x4a, - 0x5c, 0x8f, 0x40, 0x76, 0xda, 0xe0, 0x89, 0xec, - 0x1d, 0x2b, 0xc4, 0x4e, 0x30, 0x76, 0x28, 0x41, - 0xb2, 0x62, 0xa8, 0xfb, 0x5b, 0xf1, 0xf9, 0x4e, - 0x7a, 0x8d, 0xbd, 0x09, 0xb8, 0xae, 0xea, 0x8b, - 0x18, 0x27, 0x4f, 0x2e, 0x70, 0xfe, 0x13, 0x96, - 0xba, 0xc3, 0xd3, 0x40, 0x16, 0xcd, 0x65, 0x4e, - 0xac, 0x11, 0x1e, 0xe6, 0xf1, 0x30, 0x09, 0x06, - 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x01, - 0x03, 0x81, 0x8c, 0x00, 0x30, 0x81, 0x88, 0x02, - 0x42, 0x00, 0xe0, 0x14, 0xc4, 0x60, 0x60, 0x0b, - 0x72, 0x68, 0xb0, 0x32, 0x5d, 0x61, 0x4a, 0x02, - 0x74, 0x5c, 0xc2, 0x81, 0xb9, 0x16, 0xa8, 0x3f, - 0x29, 0xc8, 0x36, 0xc7, 0x81, 0xff, 0x6c, 0xb6, - 0x5b, 0xd9, 0x70, 0xf1, 0x38, 0x3b, 0x50, 0x48, - 0x28, 0x94, 0xcb, 0x09, 0x1a, 0x52, 0xf1, 0x5d, - 0xee, 0x8d, 0xf2, 0xb9, 0xf0, 0xf0, 0xda, 0xd9, - 0x15, 0x3a, 0xf9, 0xbd, 0x03, 0x7a, 0x87, 0xa2, - 0x23, 0x35, 0xec, 0x02, 0x42, 0x01, 0xa3, 0xd4, - 0x8a, 0x78, 0x35, 0x1c, 0x4a, 0x9a, 0x23, 0xd2, - 0x0a, 0xbe, 0x2b, 0x10, 0x31, 0x9d, 0x9c, 0x5f, - 0xbe, 0xe8, 0x91, 0xb3, 0xda, 0x1a, 0xf5, 0x5d, - 0xa3, 0x23, 0xf5, 0x26, 0x8b, 0x45, 0x70, 0x8d, - 0x65, 0x62, 0x9b, 0x7e, 0x01, 0x99, 0x3d, 0x18, - 0xf6, 0x10, 0x9a, 0x38, 0x61, 0x9b, 0x2e, 0x57, - 0xe4, 0xfa, 0xcc, 0xb1, 0x8a, 0xce, 0xe2, 0x23, - 0xa0, 0x87, 0xf0, 0xe1, 0x67, 0x51, 0xeb, 0x16, - 0x03, 0x01, 0x00, 0x8a, 0x10, 0x00, 0x00, 0x86, - 0x85, 0x04, 0x00, 0xcd, 0x1c, 0xe8, 0x66, 0x5b, - 0xa8, 0x9d, 0x83, 0x2f, 0x7e, 0x1d, 0x0b, 0x59, - 0x23, 0xbc, 0x30, 0xcf, 0xa3, 0xaf, 0x21, 0xdc, - 0xf2, 0x57, 0x49, 0x56, 0x30, 0x25, 0x7c, 0x84, - 0x5d, 0xad, 0xaa, 0x9c, 0x7b, 0x2a, 0x95, 0x58, - 0x3d, 0x30, 0x87, 0x01, 0x3b, 0xb7, 0xea, 0xcb, - 0xc4, 0xa3, 0xeb, 0x22, 0xbf, 0x2d, 0x61, 0x17, - 0x8c, 0x9b, 0xe8, 0x1b, 0xb2, 0x87, 0x16, 0x78, - 0xd5, 0xfd, 0x8b, 0xdd, 0x00, 0x0f, 0xda, 0x8e, - 0xfd, 0x28, 0x36, 0xeb, 0xe4, 0xc5, 0x42, 0x14, - 0xc7, 0xbd, 0x29, 0x5e, 0x9a, 0xed, 0x5e, 0xc1, - 0xf7, 0xf4, 0xbd, 0xbd, 0x15, 0x9c, 0xe8, 0x44, - 0x71, 0xa7, 0xb6, 0xe9, 0xfa, 0x7e, 0x97, 0xcb, - 0x96, 0x3e, 0x53, 0x76, 0xfb, 0x11, 0x1f, 0x36, - 0x8f, 0x30, 0xfb, 0x71, 0x3a, 0x75, 0x3a, 0x25, - 0x7b, 0xa2, 0xc1, 0xf9, 0x3e, 0x58, 0x5f, 0x07, - 0x16, 0xed, 0xe1, 0xf7, 0xc1, 0xb1, 0x16, 0x03, - 0x01, 0x00, 0x90, 0x0f, 0x00, 0x00, 0x8c, 0x00, - 0x8a, 0x30, 0x81, 0x87, 0x02, 0x42, 0x00, 0xb2, - 0xd3, 0x91, 0xe6, 0xd5, 0x9b, 0xb2, 0xb8, 0x03, - 0xf4, 0x85, 0x4d, 0x43, 0x79, 0x1f, 0xb6, 0x6f, - 0x0c, 0xcd, 0x67, 0x5f, 0x5e, 0xca, 0xee, 0xb3, - 0xe4, 0xab, 0x1e, 0x58, 0xc3, 0x04, 0xa9, 0x8a, - 0xa7, 0xcf, 0xaa, 0x33, 0x88, 0xd5, 0x35, 0xd2, - 0x80, 0x8f, 0xfa, 0x1b, 0x3c, 0x3d, 0xf7, 0x80, - 0x50, 0xde, 0x80, 0x30, 0x64, 0xee, 0xc0, 0xb3, - 0x91, 0x6e, 0x5d, 0x1e, 0xc0, 0xdc, 0x3a, 0x93, - 0x02, 0x41, 0x4e, 0xca, 0x98, 0x41, 0x8c, 0x36, - 0xf2, 0x12, 0xbf, 0x8e, 0x0f, 0x69, 0x8e, 0xf8, - 0x7b, 0x9d, 0xba, 0x9c, 0x5c, 0x48, 0x79, 0xf4, - 0xba, 0x3d, 0x06, 0xa5, 0xab, 0x47, 0xe0, 0x1a, - 0x45, 0x28, 0x3a, 0x8f, 0xbf, 0x14, 0x24, 0x36, - 0xd1, 0x1d, 0x29, 0xdc, 0xde, 0x72, 0x5b, 0x76, - 0x41, 0x67, 0xe8, 0xe5, 0x71, 0x4a, 0x77, 0xe9, - 0xed, 0x02, 0x19, 0xdd, 0xe4, 0xaa, 0xe9, 0x2d, - 0xe7, 0x47, 0x32, 0x14, 0x03, 0x01, 0x00, 0x01, - 0x01, 0x16, 0x03, 0x01, 0x00, 0x30, 0xfa, 0xc3, - 0xf2, 0x35, 0xd0, 0x6d, 0x32, 0x78, 0x6a, 0xd6, - 0xe6, 0x70, 0x5e, 0x00, 0x4c, 0x35, 0xf1, 0xe0, - 0x21, 0xcf, 0xc3, 0x78, 0xcd, 0xe0, 0x2b, 0x0b, - 0xf4, 0xeb, 0xf9, 0xc0, 0x38, 0xf2, 0x9a, 0x31, - 0x55, 0x07, 0x2b, 0x8d, 0x68, 0x40, 0x31, 0x08, - 0xaa, 0xe3, 0x16, 0xcf, 0x4b, 0xd4, - }, - { - 0x16, 0x03, 0x01, 0x02, 0x76, 0x04, 0x00, 0x02, - 0x72, 0x00, 0x00, 0x00, 0x00, 0x02, 0x6c, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, - 0xe8, 0x8b, 0xde, 0xef, 0xba, 0xf9, 0xdb, 0x95, - 0x24, 0xa5, 0x49, 0xb3, 0x23, 0xd8, 0x73, 0x88, - 0x50, 0x42, 0xed, 0xeb, 0xa3, 0xd8, 0xab, 0x31, - 0x9c, 0xd0, 0x00, 0x01, 0xef, 0xc0, 0xbf, 0xab, - 0x59, 0x55, 0xb5, 0xb9, 0xef, 0xa5, 0xa6, 0xec, - 0x69, 0xed, 0x00, 0x2f, 0x47, 0xdb, 0x75, 0x52, - 0x0c, 0xe5, 0x86, 0xb7, 0x02, 0x59, 0x22, 0xf7, - 0xfd, 0x8b, 0xff, 0xa4, 0x09, 0xc0, 0x1c, 0x10, - 0x80, 0x10, 0x7f, 0x4c, 0x7a, 0x94, 0x40, 0x10, - 0x0d, 0xda, 0x8a, 0xe5, 0x4a, 0xbc, 0xd0, 0xc0, - 0x4b, 0xa5, 0x33, 0x97, 0xc6, 0xe7, 0x40, 0x7f, - 0x7f, 0x8c, 0xf9, 0xf8, 0xc8, 0xb8, 0xfb, 0x8c, - 0xdd, 0x28, 0x81, 0xae, 0xfd, 0x37, 0x20, 0x3a, - 0x40, 0x37, 0x99, 0xc4, 0x21, 0x01, 0xc4, 0x91, - 0xb0, 0x5e, 0x11, 0xc5, 0xa9, 0xfd, 0x9a, 0x02, - 0x7e, 0x97, 0x6a, 0x86, 0x89, 0xb8, 0xc1, 0x32, - 0x4c, 0x7e, 0x6d, 0x47, 0x61, 0x0e, 0xe3, 0xc2, - 0xf0, 0x62, 0x3c, 0xc6, 0x71, 0x4f, 0xbb, 0x47, - 0x65, 0xb1, 0xd9, 0x22, 0x79, 0x15, 0xea, 0x1f, - 0x4b, 0x2a, 0x8a, 0xa4, 0xc8, 0x73, 0x34, 0xba, - 0x83, 0xe4, 0x70, 0x99, 0xc9, 0xcf, 0xbe, 0x64, - 0x99, 0xb9, 0xfa, 0xe9, 0xaf, 0x5d, 0xc7, 0x20, - 0x26, 0xde, 0xc5, 0x06, 0x12, 0x36, 0x4f, 0x4d, - 0xc0, 0xbb, 0x81, 0x5b, 0x5e, 0x38, 0xc3, 0x07, - 0x21, 0x04, 0x1a, 0x53, 0x9c, 0x59, 0xac, 0x2d, - 0xe6, 0xa5, 0x93, 0xa5, 0x19, 0xc6, 0xb0, 0xf7, - 0x56, 0x5d, 0xdf, 0xd1, 0xf4, 0xfd, 0x44, 0x6d, - 0xc6, 0xa2, 0x31, 0xa7, 0x35, 0x42, 0x18, 0x50, - 0x0c, 0x4f, 0x6e, 0xe3, 0x3b, 0xa3, 0xaa, 0x1c, - 0xbe, 0x41, 0x0d, 0xce, 0x6c, 0x62, 0xe1, 0x96, - 0x2d, 0xbd, 0x14, 0x31, 0xe3, 0xc4, 0x5b, 0xbf, - 0xf6, 0xde, 0xec, 0x42, 0xe8, 0xc7, 0x2a, 0x0b, - 0xdb, 0x2d, 0x7c, 0xf0, 0x3f, 0x45, 0x32, 0x45, - 0x09, 0x47, 0x09, 0x0f, 0x21, 0x22, 0x45, 0x06, - 0x11, 0xb8, 0xf9, 0xe6, 0x67, 0x90, 0x4b, 0x4a, - 0xde, 0x81, 0xfb, 0xeb, 0xe7, 0x9a, 0x08, 0x30, - 0xcf, 0x51, 0xe1, 0xd9, 0xfa, 0x79, 0xa3, 0xcc, - 0x65, 0x1a, 0x83, 0x86, 0xc9, 0x7a, 0x41, 0xf5, - 0xdf, 0xa0, 0x7c, 0x44, 0x23, 0x17, 0xf3, 0x62, - 0xe8, 0xa9, 0x31, 0x1e, 0x6b, 0x05, 0x4b, 0x4f, - 0x9d, 0x91, 0x46, 0x92, 0xa6, 0x25, 0x32, 0xca, - 0xa1, 0x75, 0xda, 0xe6, 0x80, 0x3e, 0x7f, 0xd1, - 0x26, 0x57, 0x07, 0x42, 0xe4, 0x91, 0xff, 0xbd, - 0x44, 0xae, 0x98, 0x5c, 0x1d, 0xdf, 0x11, 0xe3, - 0xae, 0x87, 0x5e, 0xb7, 0x69, 0xad, 0x34, 0x7f, - 0x3a, 0x07, 0x7c, 0xdf, 0xfc, 0x76, 0x17, 0x8b, - 0x62, 0xc8, 0xe1, 0x78, 0x2a, 0xc8, 0xb9, 0x8a, - 0xbb, 0x5c, 0xfb, 0x38, 0x74, 0x91, 0x6e, 0x12, - 0x0c, 0x1f, 0x8e, 0xe1, 0xc2, 0x01, 0xd8, 0x9d, - 0x23, 0x0f, 0xc4, 0x67, 0x5d, 0xe5, 0x67, 0x4b, - 0x94, 0x6e, 0x69, 0x72, 0x90, 0x2d, 0x52, 0x78, - 0x8e, 0x61, 0xba, 0xdf, 0x4e, 0xf5, 0xdc, 0xfb, - 0x73, 0xbe, 0x03, 0x70, 0xd9, 0x01, 0x30, 0xf3, - 0xa1, 0xbb, 0x9a, 0x5f, 0xec, 0x9e, 0xed, 0x8d, - 0xdd, 0x53, 0xfd, 0x60, 0xc3, 0x2b, 0x7a, 0x00, - 0x2c, 0xf9, 0x0a, 0x57, 0x47, 0x45, 0x43, 0xb3, - 0x23, 0x01, 0x9c, 0xee, 0x54, 0x4d, 0x58, 0xd3, - 0x71, 0x1c, 0xc9, 0xd3, 0x30, 0x9e, 0x14, 0xa5, - 0xf3, 0xbf, 0x4d, 0x9b, 0xb7, 0x13, 0x21, 0xae, - 0xd2, 0x8d, 0x6e, 0x6f, 0x1c, 0xcc, 0xb2, 0x41, - 0xb2, 0x64, 0x56, 0x83, 0xce, 0xd1, 0x0c, 0x79, - 0x32, 0x78, 0xef, 0xc5, 0x21, 0xb1, 0xe8, 0xc4, - 0x42, 0xa7, 0x8d, 0xc1, 0xfa, 0xa1, 0x9c, 0x3c, - 0x21, 0xd8, 0xe9, 0x90, 0xe2, 0x7c, 0x14, 0x26, - 0xfe, 0x61, 0x3e, 0xf9, 0x71, 0x1d, 0x5d, 0x49, - 0x3b, 0xb1, 0xb8, 0x42, 0xa1, 0xb8, 0x1c, 0x75, - 0x7d, 0xee, 0xed, 0xfc, 0xe6, 0x20, 0x2b, 0x9e, - 0x10, 0x52, 0xda, 0x56, 0x4d, 0x64, 0x6c, 0x41, - 0xc1, 0xf7, 0x60, 0x0c, 0x10, 0x65, 0x6f, 0xd4, - 0xe9, 0x9b, 0x0d, 0x83, 0x13, 0xc8, 0x5a, 0xa3, - 0x56, 0x2a, 0x42, 0xc6, 0x1c, 0xfe, 0xdb, 0xba, - 0x3d, 0x04, 0x12, 0xfd, 0x28, 0xeb, 0x78, 0xdd, - 0xbc, 0xc8, 0x0d, 0xa1, 0xce, 0xd4, 0x54, 0xbf, - 0xaf, 0xe1, 0x60, 0x0c, 0xa3, 0xc3, 0xc3, 0x62, - 0x58, 0xc1, 0x79, 0xa7, 0x95, 0x41, 0x09, 0x24, - 0xc6, 0x9a, 0x50, 0x14, 0x03, 0x01, 0x00, 0x01, - 0x01, 0x16, 0x03, 0x01, 0x00, 0x30, 0x4d, 0x7b, - 0x5f, 0x28, 0x5e, 0x68, 0x6c, 0xa3, 0x65, 0xc7, - 0x7e, 0x49, 0x6c, 0xb3, 0x67, 0xbb, 0xd0, 0x75, - 0xa2, 0x9e, 0x8c, 0x92, 0x4f, 0x8c, 0x33, 0x14, - 0x7c, 0x6c, 0xf1, 0x74, 0x97, 0xc3, 0xe0, 0x10, - 0xe9, 0x0d, 0xc2, 0x30, 0x5c, 0x23, 0xee, 0x1d, - 0x16, 0x2e, 0xb9, 0x96, 0x2b, 0x2d, 0x17, 0x03, - 0x01, 0x00, 0x20, 0xf2, 0xc8, 0xa7, 0x1b, 0x60, - 0x46, 0xee, 0xe5, 0x7e, 0xc9, 0x35, 0xb3, 0xf1, - 0x7c, 0x32, 0x0c, 0x85, 0x94, 0x59, 0x57, 0x27, - 0xb0, 0xbd, 0x52, 0x86, 0x90, 0xf1, 0xb7, 0x4d, - 0x1e, 0xc1, 0x16, 0x17, 0x03, 0x01, 0x00, 0x30, - 0xff, 0x85, 0x50, 0xdf, 0x3f, 0xfc, 0xa2, 0x61, - 0x1a, 0x12, 0xc0, 0x1e, 0x10, 0x32, 0x88, 0x50, - 0xa0, 0x2c, 0x80, 0xda, 0x77, 0xea, 0x09, 0x47, - 0xe0, 0x85, 0x07, 0x29, 0x45, 0x65, 0x19, 0xa3, - 0x8d, 0x99, 0xb8, 0xbf, 0xb6, 0xbc, 0x76, 0xe2, - 0x50, 0x24, 0x82, 0x0a, 0xfd, 0xdd, 0x35, 0x09, - 0x15, 0x03, 0x01, 0x00, 0x20, 0xe7, 0x36, 0xf6, - 0x61, 0xd2, 0x95, 0x3c, 0xb6, 0x65, 0x7b, 0xb2, - 0xb8, 0xdf, 0x03, 0x53, 0xeb, 0xf7, 0x16, 0xe0, - 0xe0, 0x15, 0x22, 0x71, 0x70, 0x62, 0x73, 0xad, - 0xb5, 0x1a, 0x77, 0x44, 0x57, - }, - }}, -} - -var aesGCMServerScript = [][]byte{ - { - 0x16, 0x03, 0x01, 0x01, 0x1c, 0x01, 0x00, 0x01, - 0x18, 0x03, 0x03, 0x52, 0x1e, 0x74, 0xf0, 0xb0, - 0xc1, 0x8b, 0x16, 0xf9, 0x74, 0xfc, 0x16, 0xc4, - 0x11, 0x18, 0x96, 0x08, 0x25, 0x38, 0x4f, 0x98, - 0x98, 0xbe, 0xb5, 0x61, 0xdf, 0x94, 0x15, 0xcc, - 0x9b, 0x61, 0xef, 0x00, 0x00, 0x80, 0xc0, 0x30, - 0xc0, 0x2c, 0xc0, 0x28, 0xc0, 0x24, 0xc0, 0x14, - 0xc0, 0x0a, 0x00, 0xa3, 0x00, 0x9f, 0x00, 0x6b, - 0x00, 0x6a, 0x00, 0x39, 0x00, 0x38, 0xc0, 0x32, - 0xc0, 0x2e, 0xc0, 0x2a, 0xc0, 0x26, 0xc0, 0x0f, - 0xc0, 0x05, 0x00, 0x9d, 0x00, 0x3d, 0x00, 0x35, - 0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16, 0x00, 0x13, - 0xc0, 0x0d, 0xc0, 0x03, 0x00, 0x0a, 0xc0, 0x2f, - 0xc0, 0x2b, 0xc0, 0x27, 0xc0, 0x23, 0xc0, 0x13, - 0xc0, 0x09, 0x00, 0xa2, 0x00, 0x9e, 0x00, 0x67, - 0x00, 0x40, 0x00, 0x33, 0x00, 0x32, 0xc0, 0x31, - 0xc0, 0x2d, 0xc0, 0x29, 0xc0, 0x25, 0xc0, 0x0e, - 0xc0, 0x04, 0x00, 0x9c, 0x00, 0x3c, 0x00, 0x2f, - 0xc0, 0x11, 0xc0, 0x07, 0xc0, 0x0c, 0xc0, 0x02, - 0x00, 0x05, 0x00, 0x04, 0x00, 0x15, 0x00, 0x12, - 0x00, 0x09, 0x00, 0x14, 0x00, 0x11, 0x00, 0x08, - 0x00, 0x06, 0x00, 0x03, 0x00, 0xff, 0x01, 0x00, - 0x00, 0x6f, 0x00, 0x0b, 0x00, 0x04, 0x03, 0x00, - 0x01, 0x02, 0x00, 0x0a, 0x00, 0x34, 0x00, 0x32, - 0x00, 0x0e, 0x00, 0x0d, 0x00, 0x19, 0x00, 0x0b, - 0x00, 0x0c, 0x00, 0x18, 0x00, 0x09, 0x00, 0x0a, - 0x00, 0x16, 0x00, 0x17, 0x00, 0x08, 0x00, 0x06, - 0x00, 0x07, 0x00, 0x14, 0x00, 0x15, 0x00, 0x04, - 0x00, 0x05, 0x00, 0x12, 0x00, 0x13, 0x00, 0x01, - 0x00, 0x02, 0x00, 0x03, 0x00, 0x0f, 0x00, 0x10, - 0x00, 0x11, 0x00, 0x23, 0x00, 0x00, 0x00, 0x0d, - 0x00, 0x22, 0x00, 0x20, 0x06, 0x01, 0x06, 0x02, - 0x06, 0x03, 0x05, 0x01, 0x05, 0x02, 0x05, 0x03, - 0x04, 0x01, 0x04, 0x02, 0x04, 0x03, 0x03, 0x01, - 0x03, 0x02, 0x03, 0x03, 0x02, 0x01, 0x02, 0x02, - 0x02, 0x03, 0x01, 0x01, 0x00, 0x0f, 0x00, 0x01, - 0x01, - }, - { - 0x16, 0x03, 0x03, 0x00, 0x30, 0x02, 0x00, 0x00, - 0x2c, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc0, 0x2f, 0x00, 0x00, - 0x04, 0x00, 0x23, 0x00, 0x00, 0x16, 0x03, 0x03, - 0x02, 0xbe, 0x0b, 0x00, 0x02, 0xba, 0x00, 0x02, - 0xb7, 0x00, 0x02, 0xb4, 0x30, 0x82, 0x02, 0xb0, - 0x30, 0x82, 0x02, 0x19, 0xa0, 0x03, 0x02, 0x01, - 0x02, 0x02, 0x09, 0x00, 0x85, 0xb0, 0xbb, 0xa4, - 0x8a, 0x7f, 0xb8, 0xca, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x05, 0x05, 0x00, 0x30, 0x45, 0x31, 0x0b, 0x30, - 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, - 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, - 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, - 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, - 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, - 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, - 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, - 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, - 0x74, 0x64, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30, - 0x30, 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, 0x39, - 0x33, 0x38, 0x5a, 0x17, 0x0d, 0x31, 0x31, 0x30, - 0x34, 0x32, 0x34, 0x30, 0x39, 0x30, 0x39, 0x33, - 0x38, 0x5a, 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, - 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, - 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, - 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, - 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, - 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, - 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, - 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, 0x74, - 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, - 0x64, 0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, - 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xbb, 0x79, - 0xd6, 0xf5, 0x17, 0xb5, 0xe5, 0xbf, 0x46, 0x10, - 0xd0, 0xdc, 0x69, 0xbe, 0xe6, 0x2b, 0x07, 0x43, - 0x5a, 0xd0, 0x03, 0x2d, 0x8a, 0x7a, 0x43, 0x85, - 0xb7, 0x14, 0x52, 0xe7, 0xa5, 0x65, 0x4c, 0x2c, - 0x78, 0xb8, 0x23, 0x8c, 0xb5, 0xb4, 0x82, 0xe5, - 0xde, 0x1f, 0x95, 0x3b, 0x7e, 0x62, 0xa5, 0x2c, - 0xa5, 0x33, 0xd6, 0xfe, 0x12, 0x5c, 0x7a, 0x56, - 0xfc, 0xf5, 0x06, 0xbf, 0xfa, 0x58, 0x7b, 0x26, - 0x3f, 0xb5, 0xcd, 0x04, 0xd3, 0xd0, 0xc9, 0x21, - 0x96, 0x4a, 0xc7, 0xf4, 0x54, 0x9f, 0x5a, 0xbf, - 0xef, 0x42, 0x71, 0x00, 0xfe, 0x18, 0x99, 0x07, - 0x7f, 0x7e, 0x88, 0x7d, 0x7d, 0xf1, 0x04, 0x39, - 0xc4, 0xa2, 0x2e, 0xdb, 0x51, 0xc9, 0x7c, 0xe3, - 0xc0, 0x4c, 0x3b, 0x32, 0x66, 0x01, 0xcf, 0xaf, - 0xb1, 0x1d, 0xb8, 0x71, 0x9a, 0x1d, 0xdb, 0xdb, - 0x89, 0x6b, 0xae, 0xda, 0x2d, 0x79, 0x02, 0x03, - 0x01, 0x00, 0x01, 0xa3, 0x81, 0xa7, 0x30, 0x81, - 0xa4, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, - 0x04, 0x16, 0x04, 0x14, 0xb1, 0xad, 0xe2, 0x85, - 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, 0xce, 0x23, - 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, 0x88, 0x39, - 0x30, 0x75, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, - 0x6e, 0x30, 0x6c, 0x80, 0x14, 0xb1, 0xad, 0xe2, - 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69, 0xce, - 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18, 0x88, - 0x39, 0xa1, 0x49, 0xa4, 0x47, 0x30, 0x45, 0x31, - 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, - 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, - 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, - 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, - 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, - 0x20, 0x4c, 0x74, 0x64, 0x82, 0x09, 0x00, 0x85, - 0xb0, 0xbb, 0xa4, 0x8a, 0x7f, 0xb8, 0xca, 0x30, - 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, - 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x01, 0x05, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, - 0x08, 0x6c, 0x45, 0x24, 0xc7, 0x6b, 0xb1, 0x59, - 0xab, 0x0c, 0x52, 0xcc, 0xf2, 0xb0, 0x14, 0xd7, - 0x87, 0x9d, 0x7a, 0x64, 0x75, 0xb5, 0x5a, 0x95, - 0x66, 0xe4, 0xc5, 0x2b, 0x8e, 0xae, 0x12, 0x66, - 0x1f, 0xeb, 0x4f, 0x38, 0xb3, 0x6e, 0x60, 0xd3, - 0x92, 0xfd, 0xf7, 0x41, 0x08, 0xb5, 0x25, 0x13, - 0xb1, 0x18, 0x7a, 0x24, 0xfb, 0x30, 0x1d, 0xba, - 0xed, 0x98, 0xb9, 0x17, 0xec, 0xe7, 0xd7, 0x31, - 0x59, 0xdb, 0x95, 0xd3, 0x1d, 0x78, 0xea, 0x50, - 0x56, 0x5c, 0xd5, 0x82, 0x5a, 0x2d, 0x5a, 0x5f, - 0x33, 0xc4, 0xb6, 0xd8, 0xc9, 0x75, 0x90, 0x96, - 0x8c, 0x0f, 0x52, 0x98, 0xb5, 0xcd, 0x98, 0x1f, - 0x89, 0x20, 0x5f, 0xf2, 0xa0, 0x1c, 0xa3, 0x1b, - 0x96, 0x94, 0xdd, 0xa9, 0xfd, 0x57, 0xe9, 0x70, - 0xe8, 0x26, 0x6d, 0x71, 0x99, 0x9b, 0x26, 0x6e, - 0x38, 0x50, 0x29, 0x6c, 0x90, 0xa7, 0xbd, 0xd9, - 0x16, 0x03, 0x03, 0x01, 0x11, 0x0c, 0x00, 0x01, - 0x0d, 0x03, 0x00, 0x19, 0x85, 0x04, 0x01, 0x39, - 0xdc, 0xee, 0x44, 0x17, 0x5e, 0xdb, 0xd7, 0x27, - 0xaf, 0xb6, 0x56, 0xd9, 0xb4, 0x43, 0x5a, 0x99, - 0xcf, 0xaa, 0x31, 0x37, 0x0c, 0x6f, 0x3a, 0xa0, - 0xf8, 0x53, 0xc4, 0x74, 0xd1, 0x91, 0x0a, 0x46, - 0xf5, 0x38, 0x3b, 0x5c, 0x09, 0xd8, 0x97, 0xdc, - 0x4b, 0xaa, 0x70, 0x26, 0x48, 0xf2, 0xd6, 0x0b, - 0x31, 0xc9, 0xf8, 0xd4, 0x98, 0x43, 0xe1, 0x6c, - 0xd5, 0xc7, 0xb2, 0x8e, 0x0b, 0x01, 0xe6, 0xb6, - 0x00, 0x28, 0x80, 0x7b, 0xfc, 0x96, 0x8f, 0x0d, - 0xa2, 0x4f, 0xb0, 0x79, 0xaf, 0xdc, 0x61, 0x28, - 0x63, 0x33, 0x78, 0xf6, 0x31, 0x39, 0xfd, 0x8a, - 0xf4, 0x15, 0x18, 0x11, 0xfe, 0xdb, 0xd5, 0x07, - 0xda, 0x2c, 0xed, 0x49, 0xa0, 0x23, 0xbf, 0xd0, - 0x3a, 0x38, 0x1d, 0x54, 0xae, 0x1c, 0x7b, 0xea, - 0x29, 0xee, 0xd0, 0x38, 0xc1, 0x76, 0xa7, 0x7f, - 0x2a, 0xf4, 0xce, 0x1e, 0xac, 0xcc, 0x94, 0x79, - 0x90, 0x33, 0x04, 0x01, 0x00, 0x80, 0x0d, 0x8e, - 0x79, 0xe6, 0x86, 0xf6, 0xb6, 0xfb, 0x6b, 0x6a, - 0xcc, 0x55, 0xe4, 0x80, 0x4d, 0xc5, 0x0c, 0xc6, - 0xa3, 0x9f, 0x1d, 0x39, 0xd2, 0x98, 0x57, 0x31, - 0xa2, 0x90, 0x73, 0xe8, 0xd2, 0xcd, 0xb0, 0x93, - 0x1a, 0x60, 0x0f, 0x38, 0x02, 0x3b, 0x1b, 0x25, - 0x56, 0xec, 0x44, 0xab, 0xbe, 0x2e, 0x0c, 0xc0, - 0x6e, 0x54, 0x91, 0x50, 0xd6, 0xb1, 0xa2, 0x98, - 0x14, 0xa8, 0x35, 0x62, 0x9d, 0xca, 0xfb, 0x0f, - 0x64, 0x2b, 0x05, 0xa0, 0xa0, 0x57, 0xef, 0xcd, - 0x95, 0x45, 0x13, 0x5a, 0x9b, 0x3d, 0xdb, 0x42, - 0x54, 0x7f, 0xb9, 0x17, 0x08, 0x7f, 0xb2, 0xf0, - 0xb1, 0xc3, 0xdf, 0x67, 0x95, 0xe2, 0x73, 0xf2, - 0x76, 0xa3, 0x97, 0xfd, 0x9c, 0x92, 0x4a, 0xdb, - 0x95, 0x1e, 0x91, 0x95, 0xae, 0x3d, 0xae, 0x58, - 0xb5, 0x03, 0x6f, 0x5c, 0x3a, 0x19, 0xab, 0x92, - 0xa5, 0x09, 0x6b, 0x40, 0x61, 0xb0, 0x16, 0x03, - 0x03, 0x00, 0x04, 0x0e, 0x00, 0x00, 0x00, - }, - { - 0x16, 0x03, 0x03, 0x00, 0x8a, 0x10, 0x00, 0x00, - 0x86, 0x85, 0x04, 0x01, 0xba, 0xb8, 0xad, 0x69, - 0x20, 0x5e, 0xc1, 0x61, 0xc3, 0x0f, 0xb4, 0x30, - 0x64, 0x66, 0x70, 0x96, 0x33, 0x3c, 0x8e, 0x12, - 0x56, 0xbf, 0x6d, 0xb8, 0x6d, 0xc6, 0xba, 0xea, - 0xfc, 0x38, 0xc0, 0x8b, 0x87, 0xa8, 0xf3, 0x87, - 0xa1, 0xd5, 0xb6, 0xb0, 0x72, 0xc7, 0xd4, 0x19, - 0x56, 0xa0, 0x91, 0xe1, 0x45, 0xc7, 0xf1, 0x7d, - 0xb0, 0x1d, 0x78, 0x18, 0xf6, 0x3d, 0xbf, 0x1a, - 0x23, 0x93, 0x0b, 0x19, 0xb1, 0x00, 0x56, 0xc9, - 0x5e, 0x89, 0xd4, 0x9d, 0xd9, 0x5b, 0xe0, 0xb8, - 0xff, 0x2f, 0x7d, 0x93, 0xae, 0x5b, 0xa5, 0x1f, - 0x1f, 0x2b, 0x09, 0xe5, 0xf6, 0x07, 0x26, 0xa3, - 0xed, 0xcb, 0x6a, 0x1a, 0xd6, 0x14, 0x83, 0x9b, - 0xd3, 0x9d, 0x47, 0x1b, 0xf3, 0x72, 0x5f, 0x69, - 0x21, 0x8f, 0xfa, 0x09, 0x38, 0x1a, 0x6b, 0x91, - 0xcf, 0x19, 0x32, 0x54, 0x58, 0x8e, 0xee, 0xaf, - 0xeb, 0x06, 0x9b, 0x3a, 0x34, 0x16, 0x66, 0x14, - 0x03, 0x03, 0x00, 0x01, 0x01, 0x16, 0x03, 0x03, - 0x00, 0x28, 0xc6, 0x96, 0x67, 0x62, 0xcc, 0x47, - 0x01, 0xb5, 0xbd, 0xb7, 0x24, 0xd3, 0xb6, 0xfd, - 0xb8, 0x46, 0xce, 0x82, 0x6d, 0x31, 0x1f, 0x15, - 0x11, 0x8f, 0xed, 0x62, 0x71, 0x5f, 0xae, 0xb6, - 0xa9, 0x0c, 0x24, 0x1d, 0xe8, 0x26, 0x51, 0xca, - 0x7c, 0x42, - }, - { - 0x16, 0x03, 0x03, 0x00, 0x72, 0x04, 0x00, 0x00, - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, - 0xea, 0x8b, 0xfb, 0xef, 0xba, 0xc8, 0x88, 0x94, - 0x44, 0x99, 0x5f, 0x02, 0x68, 0x3a, 0x12, 0x67, - 0x7f, 0xb9, 0x39, 0x71, 0x84, 0xe0, 0x30, 0xe6, - 0x90, 0x6c, 0xcf, 0x32, 0x29, 0x29, 0x5c, 0x5a, - 0x8b, 0x7d, 0xaa, 0x11, 0x28, 0x26, 0xb5, 0xce, - 0xd2, 0x88, 0xd5, 0xb0, 0x5f, 0x94, 0x37, 0xa2, - 0x48, 0xd9, 0x53, 0xb2, 0xab, 0x59, 0x23, 0x3d, - 0x81, 0x6e, 0x64, 0x89, 0xca, 0x1a, 0x84, 0x16, - 0xdf, 0x31, 0x10, 0xde, 0x52, 0x7f, 0x50, 0xf3, - 0xd9, 0x27, 0xa0, 0xe8, 0x34, 0x15, 0x9e, 0x11, - 0xdd, 0xba, 0xce, 0x40, 0x17, 0xf3, 0x67, 0x14, - 0x03, 0x03, 0x00, 0x01, 0x01, 0x16, 0x03, 0x03, - 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x35, 0xcb, 0x17, 0x66, 0xee, 0xfd, - 0x27, 0xdb, 0xb8, 0xa8, 0x8a, 0xf1, 0x56, 0x67, - 0x89, 0x0d, 0x13, 0xac, 0xe2, 0x31, 0xb9, 0xa2, - 0x26, 0xbb, 0x1c, 0xcf, 0xd1, 0xb2, 0x48, 0x1d, - 0x0d, 0xb1, 0x17, 0x03, 0x03, 0x00, 0x25, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, - 0x89, 0x7c, 0x58, 0x6a, 0x9b, 0x00, 0x05, 0x8c, - 0x7f, 0x28, 0x54, 0x61, 0x44, 0x10, 0xee, 0x85, - 0x26, 0xa8, 0x04, 0xcd, 0xca, 0x85, 0x60, 0xf2, - 0xeb, 0x22, 0xbd, 0x9e, 0x15, 0x03, 0x03, 0x00, - 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x10, 0xe4, 0xe5, 0xf9, 0x85, 0xe3, 0xb0, - 0xec, 0x84, 0x29, 0x91, 0x05, 0x7d, 0x86, 0xe3, - 0x97, 0xeb, 0xb2, - }, -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/tls/prf_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/tls/prf_test.go deleted file mode 100644 index a9b6c9e4c7..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/tls/prf_test.go +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "encoding/hex" - "testing" -) - -type testSplitPreMasterSecretTest struct { - in, out1, out2 string -} - -var testSplitPreMasterSecretTests = []testSplitPreMasterSecretTest{ - {"", "", ""}, - {"00", "00", "00"}, - {"0011", "00", "11"}, - {"001122", "0011", "1122"}, - {"00112233", "0011", "2233"}, -} - -func TestSplitPreMasterSecret(t *testing.T) { - for i, test := range testSplitPreMasterSecretTests { - in, _ := hex.DecodeString(test.in) - out1, out2 := splitPreMasterSecret(in) - s1 := hex.EncodeToString(out1) - s2 := hex.EncodeToString(out2) - if s1 != test.out1 || s2 != test.out2 { - t.Errorf("#%d: got: (%s, %s) want: (%s, %s)", i, s1, s2, test.out1, test.out2) - } - } -} - -type testKeysFromTest struct { - version uint16 - preMasterSecret string - clientRandom, serverRandom string - masterSecret string - clientMAC, serverMAC string - clientKey, serverKey string - macLen, keyLen int -} - -func TestKeysFromPreMasterSecret(t *testing.T) { - for i, test := range testKeysFromTests { - in, _ := hex.DecodeString(test.preMasterSecret) - clientRandom, _ := hex.DecodeString(test.clientRandom) - serverRandom, _ := hex.DecodeString(test.serverRandom) - - masterSecret := masterFromPreMasterSecret(test.version, in, clientRandom, serverRandom) - if s := hex.EncodeToString(masterSecret); s != test.masterSecret { - t.Errorf("#%d: bad master secret %s, want %s", i, s, test.masterSecret) - continue - } - - clientMAC, serverMAC, clientKey, serverKey, _, _ := keysFromMasterSecret(test.version, masterSecret, clientRandom, serverRandom, test.macLen, test.keyLen, 0) - clientMACString := hex.EncodeToString(clientMAC) - serverMACString := hex.EncodeToString(serverMAC) - clientKeyString := hex.EncodeToString(clientKey) - serverKeyString := hex.EncodeToString(serverKey) - if clientMACString != test.clientMAC || - serverMACString != test.serverMAC || - clientKeyString != test.clientKey || - serverKeyString != test.serverKey { - t.Errorf("#%d: got: (%s, %s, %s, %s) want: (%s, %s, %s, %s)", i, clientMACString, serverMACString, clientKeyString, serverKeyString, test.clientMAC, test.serverMAC, test.clientKey, test.serverKey) - } - } -} - -// These test vectors were generated from GnuTLS using `gnutls-cli --insecure -d 9 ` -var testKeysFromTests = []testKeysFromTest{ - { - VersionTLS10, - "0302cac83ad4b1db3b9ab49ad05957de2a504a634a386fc600889321e1a971f57479466830ac3e6f468e87f5385fa0c5", - "4ae66303755184a3917fcb44880605fcc53baa01912b22ed94473fc69cebd558", - "4ae663020ec16e6bb5130be918cfcafd4d765979a3136a5d50c593446e4e44db", - "3d851bab6e5556e959a16bc36d66cfae32f672bfa9ecdef6096cbb1b23472df1da63dbbd9827606413221d149ed08ceb", - "805aaa19b3d2c0a0759a4b6c9959890e08480119", - "2d22f9fe519c075c16448305ceee209fc24ad109", - "d50b5771244f850cd8117a9ccafe2cf1", - "e076e33206b30507a85c32855acd0919", - 20, - 16, - }, - { - VersionTLS10, - "03023f7527316bc12cbcd69e4b9e8275d62c028f27e65c745cfcddc7ce01bd3570a111378b63848127f1c36e5f9e4890", - "4ae66364b5ea56b20ce4e25555aed2d7e67f42788dd03f3fee4adae0459ab106", - "4ae66363ab815cbf6a248b87d6b556184e945e9b97fbdf247858b0bdafacfa1c", - "7d64be7c80c59b740200b4b9c26d0baaa1c5ae56705acbcf2307fe62beb4728c19392c83f20483801cce022c77645460", - "97742ed60a0554ca13f04f97ee193177b971e3b0", - "37068751700400e03a8477a5c7eec0813ab9e0dc", - "207cddbc600d2a200abac6502053ee5c", - "df3f94f6e1eacc753b815fe16055cd43", - 20, - 16, - }, - { - VersionTLS10, - "832d515f1d61eebb2be56ba0ef79879efb9b527504abb386fb4310ed5d0e3b1f220d3bb6b455033a2773e6d8bdf951d278a187482b400d45deb88a5d5a6bb7d6a7a1decc04eb9ef0642876cd4a82d374d3b6ff35f0351dc5d411104de431375355addc39bfb1f6329fb163b0bc298d658338930d07d313cd980a7e3d9196cac1", - "4ae663b2ee389c0de147c509d8f18f5052afc4aaf9699efe8cb05ece883d3a5e", - "4ae664d503fd4cff50cfc1fb8fc606580f87b0fcdac9554ba0e01d785bdf278e", - "1aff2e7a2c4279d0126f57a65a77a8d9d0087cf2733366699bec27eb53d5740705a8574bb1acc2abbe90e44f0dd28d6c", - "3c7647c93c1379a31a609542aa44e7f117a70085", - "0d73102994be74a575a3ead8532590ca32a526d4", - "ac7581b0b6c10d85bbd905ffbf36c65e", - "ff07edde49682b45466bd2e39464b306", - 20, - 16, - }, - { - VersionSSL30, - "832d515f1d61eebb2be56ba0ef79879efb9b527504abb386fb4310ed5d0e3b1f220d3bb6b455033a2773e6d8bdf951d278a187482b400d45deb88a5d5a6bb7d6a7a1decc04eb9ef0642876cd4a82d374d3b6ff35f0351dc5d411104de431375355addc39bfb1f6329fb163b0bc298d658338930d07d313cd980a7e3d9196cac1", - "4ae663b2ee389c0de147c509d8f18f5052afc4aaf9699efe8cb05ece883d3a5e", - "4ae664d503fd4cff50cfc1fb8fc606580f87b0fcdac9554ba0e01d785bdf278e", - "a614863e56299dcffeea2938f22c2ba023768dbe4b3f6877bc9c346c6ae529b51d9cb87ff9695ea4d01f2205584405b2", - "2c450d5b6f6e2013ac6bea6a0b32200d4e1ffb94", - "7a7a7438769536f2fb1ae49a61f0703b79b2dc53", - "f8f6b26c10f12855c9aafb1e0e839ccf", - "2b9d4b4a60cb7f396780ebff50650419", - 20, - 16, - }, -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/core/tls/tls_test.go b/vendor/github.com/Azure/azure-sdk-for-go/core/tls/tls_test.go deleted file mode 100644 index 38229014cd..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/core/tls/tls_test.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "testing" -) - -var rsaCertPEM = `-----BEGIN CERTIFICATE----- -MIIB0zCCAX2gAwIBAgIJAI/M7BYjwB+uMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV -BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX -aWRnaXRzIFB0eSBMdGQwHhcNMTIwOTEyMjE1MjAyWhcNMTUwOTEyMjE1MjAyWjBF -MQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50 -ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANLJ -hPHhITqQbPklG3ibCVxwGMRfp/v4XqhfdQHdcVfHap6NQ5Wok/4xIA+ui35/MmNa -rtNuC+BdZ1tMuVCPFZcCAwEAAaNQME4wHQYDVR0OBBYEFJvKs8RfJaXTH08W+SGv -zQyKn0H8MB8GA1UdIwQYMBaAFJvKs8RfJaXTH08W+SGvzQyKn0H8MAwGA1UdEwQF -MAMBAf8wDQYJKoZIhvcNAQEFBQADQQBJlffJHybjDGxRMqaRmDhX0+6v02TUKZsW -r5QuVbpQhH6u+0UgcW0jp9QwpxoPTLTWGXEWBBBurxFwiCBhkQ+V ------END CERTIFICATE----- -` - -var rsaKeyPEM = `-----BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBANLJhPHhITqQbPklG3ibCVxwGMRfp/v4XqhfdQHdcVfHap6NQ5Wo -k/4xIA+ui35/MmNartNuC+BdZ1tMuVCPFZcCAwEAAQJAEJ2N+zsR0Xn8/Q6twa4G -6OB1M1WO+k+ztnX/1SvNeWu8D6GImtupLTYgjZcHufykj09jiHmjHx8u8ZZB/o1N -MQIhAPW+eyZo7ay3lMz1V01WVjNKK9QSn1MJlb06h/LuYv9FAiEA25WPedKgVyCW -SmUwbPw8fnTcpqDWE3yTO3vKcebqMSsCIBF3UmVue8YU3jybC3NxuXq3wNm34R8T -xVLHwDXh/6NJAiEAl2oHGGLz64BuAfjKrqwz7qMYr9HCLIe/YsoWq/olzScCIQDi -D2lWusoe2/nEqfDVVWGWlyJ7yOmqaVm/iNUN9B2N2g== ------END RSA PRIVATE KEY----- -` - -// keyPEM is the same as rsaKeyPEM, but declares itself as just -// "PRIVATE KEY", not "RSA PRIVATE KEY". http://golang.org/issue/4477 -var keyPEM = `-----BEGIN PRIVATE KEY----- -MIIBOwIBAAJBANLJhPHhITqQbPklG3ibCVxwGMRfp/v4XqhfdQHdcVfHap6NQ5Wo -k/4xIA+ui35/MmNartNuC+BdZ1tMuVCPFZcCAwEAAQJAEJ2N+zsR0Xn8/Q6twa4G -6OB1M1WO+k+ztnX/1SvNeWu8D6GImtupLTYgjZcHufykj09jiHmjHx8u8ZZB/o1N -MQIhAPW+eyZo7ay3lMz1V01WVjNKK9QSn1MJlb06h/LuYv9FAiEA25WPedKgVyCW -SmUwbPw8fnTcpqDWE3yTO3vKcebqMSsCIBF3UmVue8YU3jybC3NxuXq3wNm34R8T -xVLHwDXh/6NJAiEAl2oHGGLz64BuAfjKrqwz7qMYr9HCLIe/YsoWq/olzScCIQDi -D2lWusoe2/nEqfDVVWGWlyJ7yOmqaVm/iNUN9B2N2g== ------END PRIVATE KEY----- -` - -var ecdsaCertPEM = `-----BEGIN CERTIFICATE----- -MIIB/jCCAWICCQDscdUxw16XFDAJBgcqhkjOPQQBMEUxCzAJBgNVBAYTAkFVMRMw -EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 -eSBMdGQwHhcNMTIxMTE0MTI0MDQ4WhcNMTUxMTE0MTI0MDQ4WjBFMQswCQYDVQQG -EwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lk -Z2l0cyBQdHkgTHRkMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBY9+my9OoeSUR -lDQdV/x8LsOuLilthhiS1Tz4aGDHIPwC1mlvnf7fg5lecYpMCrLLhauAc1UJXcgl -01xoLuzgtAEAgv2P/jgytzRSpUYvgLBt1UA0leLYBy6mQQbrNEuqT3INapKIcUv8 -XxYP0xMEUksLPq6Ca+CRSqTtrd/23uTnapkwCQYHKoZIzj0EAQOBigAwgYYCQXJo -A7Sl2nLVf+4Iu/tAX/IF4MavARKC4PPHK3zfuGfPR3oCCcsAoz3kAzOeijvd0iXb -H5jBImIxPL4WxQNiBTexAkF8D1EtpYuWdlVQ80/h/f4pBcGiXPqX5h2PQSQY7hP1 -+jwM1FGS4fREIOvlBYr/SzzQRtwrvrzGYxDEDbsC0ZGRnA== ------END CERTIFICATE----- -` - -var ecdsaKeyPEM = `-----BEGIN EC PARAMETERS----- -BgUrgQQAIw== ------END EC PARAMETERS----- ------BEGIN EC PRIVATE KEY----- -MIHcAgEBBEIBrsoKp0oqcv6/JovJJDoDVSGWdirrkgCWxrprGlzB9o0X8fV675X0 -NwuBenXFfeZvVcwluO7/Q9wkYoPd/t3jGImgBwYFK4EEACOhgYkDgYYABAFj36bL -06h5JRGUNB1X/Hwuw64uKW2GGJLVPPhoYMcg/ALWaW+d/t+DmV5xikwKssuFq4Bz -VQldyCXTXGgu7OC0AQCC/Y/+ODK3NFKlRi+AsG3VQDSV4tgHLqZBBus0S6pPcg1q -kohxS/xfFg/TEwRSSws+roJr4JFKpO2t3/be5OdqmQ== ------END EC PRIVATE KEY----- -` - -var keyPairTests = []struct { - algo string - cert string - key string -}{ - {"ECDSA", ecdsaCertPEM, ecdsaKeyPEM}, - {"RSA", rsaCertPEM, rsaKeyPEM}, - {"RSA-untyped", rsaCertPEM, keyPEM}, // golang.org/issue/4477 -} - -func TestX509KeyPair(t *testing.T) { - var pem []byte - for _, test := range keyPairTests { - pem = []byte(test.cert + test.key) - if _, err := X509KeyPair(pem, pem); err != nil { - t.Errorf("Failed to load %s cert followed by %s key: %s", test.algo, test.algo, err) - } - pem = []byte(test.key + test.cert) - if _, err := X509KeyPair(pem, pem); err != nil { - t.Errorf("Failed to load %s key followed by %s cert: %s", test.algo, test.algo, err) - } - } -} - -func TestX509MixedKeyPair(t *testing.T) { - if _, err := X509KeyPair([]byte(rsaCertPEM), []byte(ecdsaKeyPEM)); err == nil { - t.Error("Load of RSA certificate succeeded with ECDSA private key") - } - if _, err := X509KeyPair([]byte(ecdsaCertPEM), []byte(rsaKeyPEM)); err == nil { - t.Error("Load of ECDSA certificate succeeded with RSA private key") - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/errors_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/errors_test.go deleted file mode 100644 index 9ee32be4ea..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/errors_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package management_test - -import ( - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/management" -) - -// TestIsResourceNotFoundError tests IsResourceNotFoundError with the -// set of given test cases. -func TestIsResourceNotFoundError(t *testing.T) { - // isResourceNotFoundTestCases is a set of structs comprising of the error - // IsResourceNotFoundError should test and the expected result. - var isResourceNotFoundTestCases = []struct { - err error - expected bool - }{ - {nil, false}, - {fmt.Errorf("Some other random error."), false}, - {management.AzureError{Code: "ResourceNotFound"}, true}, - {management.AzureError{Code: "NotAResourceNotFound"}, false}, - } - - for i, testCase := range isResourceNotFoundTestCases { - if res := management.IsResourceNotFoundError(testCase.err); res != testCase.expected { - t.Fatalf("Test %d: error %s - expected %t - got %t", i+1, testCase.err, testCase.expected, res) - } - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities_test.go deleted file mode 100644 index 3f02f5beb8..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package storageservice - -import ( - "encoding/xml" - "testing" -) - -func Test_StorageServiceKeysResponse_Unmarshal(t *testing.T) { - // from https://msdn.microsoft.com/en-us/library/azure/ee460785.aspx - response := []byte(` - - storage-service-url - - primary-key - secondary-key - - `) - - keysResponse := GetStorageServiceKeysResponse{} - err := xml.Unmarshal(response, &keysResponse) - if err != nil { - t.Fatal(err) - } - - if expected := "primary-key"; keysResponse.PrimaryKey != expected { - t.Fatalf("Expected %q but got %q", expected, keysResponse.PrimaryKey) - } - if expected := "secondary-key"; keysResponse.SecondaryKey != expected { - t.Fatalf("Expected %q but got %q", expected, keysResponse.SecondaryKey) - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/entities_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/entities_test.go deleted file mode 100644 index 3118e6c5af..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/entities_test.go +++ /dev/null @@ -1,299 +0,0 @@ -package virtualmachine - -import ( - "encoding/xml" - "testing" -) - -func TestDocumentedDeploymentRequest(t *testing.T) { - // xml based on https://msdn.microsoft.com/en-us/library/azure/jj157194.aspx - // fixed typos, replaced strongly typed fields with values of correct type - xmlString := ` - name-of-deployment - deployment-environment - - - - name-of-the-virtual-machine - PersistentVMRole - - - WindowsProvisioningConfiguration - name-of-computer - administrator-password - true - time-zone - - - domain-to-join - user-name-in-the-domain - password-for-the-user-name - - domain-to-join - distinguished-name-of-the-ou - - - - LocalMachine - name-of-store-on-the-machine - certificate-thumbprint - - - - - - listener-protocol - - - certificate-thumbprint - listener-protocol - - - - name-of-administrator-account - base-64-encoded-data - - - - name-of-pass - - - name-of-component - - - name-of-setting - base-64-encoded-XML-content - - - - - - - - - - LinuxProvisioningConfiguration - host-name-for-the-virtual-machine - new-user-name - password-for-the-new-user - true - - - - certificate-fingerprint - SSH-public-key-storage-location - - - - - certificate-fingerprint - SSH-public-key-storage-location - - - - base-64-encoded-data - - - NetworkConfiguration - - - name-of-load-balanced-set - 22 - ZZH - 33 - - /probe/me - 80 - http - 30 - 5 - - endpoint-protocol - enable-direct-server-return - - - - priority-of-the-rule - permit-rule - subnet-of-the-rule - description-of-the-rule - - - - name-of-internal-loadbalancer - 9 - - - - name-of-subnet - - ip-address - - - name-of-public-ip - 11 - - - - - - - name-of-reference - name-of-publisher - name-of-extension - version-of-extension - - - name-of-parameter-key - parameter-value - type-of-parameter - - - state-of-resource - - - certificate-thumbprint - certificate-algorithm - - - - - name-of-vm-image - path-to-vhd - name-of-availability-set - - - caching-mode - label-of-data-disk - name-of-disk - 0 - 50 - path-to-vhd - - - - caching-mode - label-of-operating-system-disk - name-of-disk - path-to-vhd - name-of-source-image - operating-system-of-image - path-to-source-image - 125 - - size-of-virtual-machine - true - - - 126 - - - - disk-name - 127 - - - - - - name-of-virtual-network - - - - dns-name -
dns-ip-address
-
-
-
- name-of-reserved-ip - - - name-of-internal-load-balancer - - Private - name-of-subnet - static-ip-address - - - -
` - - deployment := DeploymentRequest{} - if err := xml.Unmarshal([]byte(xmlString), &deployment); err != nil { - t.Fatal(err) - } - - if deployment.Name != "name-of-deployment" { - t.Fatalf("Expected deployment.Name=\"name-of-deployment\", but got \"%s\"", - deployment.Name) - } - - // ====== - - t.Logf("deployment.RoleList[0]: %+v", deployment.RoleList[0]) - if expected := "name-of-the-virtual-machine"; deployment.RoleList[0].RoleName != expected { - t.Fatalf("Expected deployment.RoleList[0].RoleName=%v, but got %v", expected, deployment.RoleList[0].RoleName) - } - - // ====== - - t.Logf("deployment.DNSServers[0]: %+v", deployment.DNSServers[0]) - if deployment.DNSServers[0].Name != "dns-name" { - t.Fatalf("Expected deployment.DNSServers[0].Name=\"dns-name\", but got \"%s\"", - deployment.DNSServers[0].Name) - } - - // ====== - - t.Logf("deployment.LoadBalancers[0]: %+v", deployment.LoadBalancers[0]) - if deployment.LoadBalancers[0].Name != "name-of-internal-load-balancer" { - t.Fatalf("Expected deployment.LoadBalancers[0].Name=\"name-of-internal-load-balancer\", but got \"%s\"", - deployment.LoadBalancers[0].Name) - } - - if deployment.LoadBalancers[0].Type != IPAddressTypePrivate { - t.Fatalf("Expected deployment.LoadBalancers[0].Type=IPAddressTypePrivate, but got \"%s\"", - deployment.LoadBalancers[0].Type) - } - - if deployment.LoadBalancers[0].StaticVirtualNetworkIPAddress != "static-ip-address" { - t.Fatalf("Expected deployment.LoadBalancers[0].StaticVirtualNetworkIPAddress=\"static-ip-address\", but got \"%s\"", - deployment.LoadBalancers[0].StaticVirtualNetworkIPAddress) - } - - // ====== - - extensionReferences := (*deployment.RoleList[0].ResourceExtensionReferences) - t.Logf("(*deployment.RoleList[0].ResourceExtensionReferences)[0]: %+v", extensionReferences[0]) - if extensionReferences[0].Name != "name-of-extension" { - t.Fatalf("Expected (*deployment.RoleList[0].ResourceExtensionReferences)[0].Name=\"name-of-extension\", but got \"%s\"", - extensionReferences[0].Name) - } - - if extensionReferences[0].ParameterValues[0].Key != "name-of-parameter-key" { - t.Fatalf("Expected (*deployment.RoleList[0].ResourceExtensionReferences)[0].ParameterValues[0].Key=\"name-of-parameter-key\", but got %v", - extensionReferences[0].ParameterValues[0].Key) - } - - // ====== - - if deployment.RoleList[0].VMImageInput.DataDiskConfigurations[0].ResizedSizeInGB != 127 { - t.Fatalf("Expected deployment.RoleList[0].VMImageInput.DataDiskConfigurations[0].ResizedSizeInGB=127, but got %v", - deployment.RoleList[0].VMImageInput.DataDiskConfigurations[0].ResizedSizeInGB) - } - - // ====== - - winRMlisteners := *deployment.RoleList[0].ConfigurationSets[0].WinRMListeners - if string(winRMlisteners[0].Protocol) != "listener-protocol" { - t.Fatalf("Expected winRMlisteners[0].Protocol to be listener-protocol, but got %s", - string(winRMlisteners[0].Protocol)) - } - - winRMlisteners2 := *deployment.RoleList[0].ConfigurationSets[0].WinRMListeners - if winRMlisteners2[1].CertificateThumbprint != "certificate-thumbprint" { - t.Fatalf("Expected winRMlisteners2[1].CertificateThumbprint to be certificate-thumbprint, but got %s", - winRMlisteners2[1].CertificateThumbprint) - } - -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/resourceextensions_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/resourceextensions_test.go deleted file mode 100644 index b4ec2a7692..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/resourceextensions_test.go +++ /dev/null @@ -1,27 +0,0 @@ -package virtualmachine - -import ( - "testing" - - "github.com/Azure/azure-sdk-for-go/management/testutils" -) - -func TestAzureGetResourceExtensions(t *testing.T) { - client := testutils.GetTestClient(t) - - list, err := NewClient(client).GetResourceExtensions() - if err != nil { - t.Fatal(err) - } - - t.Logf("Found %d extensions", len(list)) - if len(list) == 0 { - t.Fatal("Huh, no resource extensions at all? Something must be wrong.") - } - - for _, extension := range list { - if extension.Name == "" { - t.Fatalf("Resource with empty name? Something must have gone wrong with serialization: %+v", extension) - } - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/entities_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/entities_test.go deleted file mode 100644 index b0d5bbe6f2..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/entities_test.go +++ /dev/null @@ -1,110 +0,0 @@ -package virtualmachineimage - -import ( - "encoding/xml" - "testing" -) - -const xml1 = ` - - imgName - - User - packer made image - - OSDisk - ReadWrite - Generalized - Linux - https://sa.blob.core.windows.net/images/PackerMade_Ubuntu_Serv14_2015-12-12.vhd - 30 - Standard - - - PkrSrvf3mz03u4mi - PkrVMf3mz03u4mi - PkrVMf3mz03u4mi - Central US - 2015-12-12T08:59:29.1936858Z - 2015-12-12T08:59:29.1936858Z - PackerMade - Small - false - VMImageReadyForUse - StoppedVM - Small -` -const xml2 = ` - - imgName - - User - packer made image - - OSDisk - ReadWrite - Generalized - Linux - https://sa.blob.core.windows.net/images/PackerMade_Ubuntu_Serv14_2015-12-12.vhd - 30 - Standard - - - - DataDisk1 - ReadWrite - https://sa.blob.core.windows.net/images/PackerMade_Ubuntu_Serv14_2015-12-12-dd1.vhd - 31 - Standard - - - DataDisk2 - ReadWrite - https://sa.blob.core.windows.net/images/PackerMade_Ubuntu_Serv14_2015-12-12-dd2.vhd - 32 - Standard - - - PkrSrvf3mz03u4mi - PkrVMf3mz03u4mi - PkrVMf3mz03u4mi - Central US - 2015-12-12T08:59:29.1936858Z - 2015-12-12T08:59:29.1936858Z - PackerMade - Small - false - VMImageReadyForUse - StoppedVM - Small -` - -func Test_NoDataDisksUnmarshal(t *testing.T) { - var image VMImage - if err := xml.Unmarshal([]byte(xml1), &image); err != nil { - t.Fatal(err) - } - - check := checker{t} - check.Equal(0, len(image.DataDiskConfigurations)) -} - -func Test_DataDiskCountUnmarshal(t *testing.T) { - var image VMImage - if err := xml.Unmarshal([]byte(xml2), &image); err != nil { - t.Fatal(err) - } - - check := checker{t} - check.Equal(2, len(image.DataDiskConfigurations)) - check.Equal("DataDisk1", image.DataDiskConfigurations[0].Name) - check.Equal("DataDisk2", image.DataDiskConfigurations[1].Name) -} - -type checker struct{ *testing.T } - -func (a *checker) Equal(expected, actual interface{}) { - if expected != actual { - a.T.Fatalf("Expected %q, but got %q", expected, actual) - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/examples_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/examples_test.go deleted file mode 100644 index ea23bbd78a..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/examples_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package vmutils - -import ( - "encoding/base64" - "fmt" - - "github.com/Azure/azure-sdk-for-go/management" - "github.com/Azure/azure-sdk-for-go/management/hostedservice" - "github.com/Azure/azure-sdk-for-go/management/virtualmachine" -) - -func Example() { - dnsName := "test-vm-from-go" - storageAccount := "mystorageaccount" - location := "West US" - vmSize := "Small" - vmImage := "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04-LTS-amd64-server-20140724-en-us-30GB" - userName := "testuser" - userPassword := "Test123" - - client, err := management.ClientFromPublishSettingsFile("path/to/downloaded.publishsettings", "") - if err != nil { - panic(err) - } - - // create hosted service - if err := hostedservice.NewClient(client).CreateHostedService(hostedservice.CreateHostedServiceParameters{ - ServiceName: dnsName, - Location: location, - Label: base64.StdEncoding.EncodeToString([]byte(dnsName))}); err != nil { - panic(err) - } - - // create virtual machine - role := NewVMConfiguration(dnsName, vmSize) - ConfigureDeploymentFromPlatformImage( - &role, - vmImage, - fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", storageAccount, dnsName), - "") - ConfigureForLinux(&role, dnsName, userName, userPassword) - ConfigureWithPublicSSH(&role) - - operationID, err := virtualmachine.NewClient(client). - CreateDeployment(role, dnsName, virtualmachine.CreateDeploymentOptions{}) - if err != nil { - panic(err) - } - err = client.WaitForOperation(operationID, nil) - if err != nil { - panic(err) - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/extensions_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/extensions_test.go deleted file mode 100644 index 17a46563db..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/extensions_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package vmutils - -import ( - "encoding/xml" - "testing" - - vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" -) - -func Test_AddAzureVMExtensionConfiguration(t *testing.T) { - - role := vm.Role{} - AddAzureVMExtensionConfiguration(&role, - "nameOfExtension", "nameOfPublisher", "versionOfExtension", "nameOfReference", "state", []byte{1, 2, 3}, []byte{}) - - data, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - if expected := ` - - - - nameOfReference - nameOfPublisher - nameOfExtension - versionOfExtension - - - ignored - AQID - Public - - - state - - - -`; string(data) != expected { - t.Fatalf("Expected %q, but got %q", expected, string(data)) - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/integration_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/integration_test.go deleted file mode 100644 index ac5853d701..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/integration_test.go +++ /dev/null @@ -1,455 +0,0 @@ -package vmutils - -import ( - "encoding/base64" - "fmt" - "math/rand" - "testing" - "time" - - "github.com/Azure/azure-sdk-for-go/management" - "github.com/Azure/azure-sdk-for-go/management/hostedservice" - "github.com/Azure/azure-sdk-for-go/management/location" - "github.com/Azure/azure-sdk-for-go/management/osimage" - storage "github.com/Azure/azure-sdk-for-go/management/storageservice" - "github.com/Azure/azure-sdk-for-go/management/testutils" - vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" - vmimage "github.com/Azure/azure-sdk-for-go/management/virtualmachineimage" -) - -func TestDeployPlatformImage(t *testing.T) { - client := testutils.GetTestClient(t) - vmname := GenerateName() - sa := GetTestStorageAccount(t, client) - location := sa.StorageServiceProperties.Location - - role := NewVMConfiguration(vmname, "Standard_D3") - ConfigureDeploymentFromPlatformImage(&role, - GetLinuxTestImage(t, client).Name, - fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, vmname), - GenerateName()) - ConfigureForLinux(&role, "myvm", "azureuser", GeneratePassword()) - ConfigureWithPublicSSH(&role) - - testRoleConfiguration(t, client, role, location) -} - -func TestDeployPlatformWindowsImage(t *testing.T) { - client := testutils.GetTestClient(t) - vmname := GenerateName() - sa := GetTestStorageAccount(t, client) - location := sa.StorageServiceProperties.Location - - role := NewVMConfiguration(vmname, "Standard_D3") - ConfigureDeploymentFromPlatformImage(&role, - GetWindowsTestImage(t, client).Name, - fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, vmname), - GenerateName()) - ConfigureForWindows(&role, vmname, "azureuser", GeneratePassword(), true, "") - ConfigureWinRMOverHTTP(&role) - ConfigureWinRMOverHTTPS(&role, "") - - testRoleConfiguration(t, client, role, location) -} - -func TestVMImageList(t *testing.T) { - client := testutils.GetTestClient(t) - vmic := vmimage.NewClient(client) - il, _ := vmic.ListVirtualMachineImages(vmimage.ListParameters{}) - for _, im := range il.VMImages { - t.Logf("%s -%s", im.Name, im.Description) - } -} - -func TestDeployPlatformOSImageCaptureRedeploy(t *testing.T) { - client := testutils.GetTestClient(t) - vmname := GenerateName() - sa := GetTestStorageAccount(t, client) - location := sa.StorageServiceProperties.Location - - role := NewVMConfiguration(vmname, "Standard_D3") - ConfigureDeploymentFromPlatformImage(&role, - GetLinuxTestImage(t, client).Name, - fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, vmname), - GenerateName()) - ConfigureForLinux(&role, "myvm", "azureuser", GeneratePassword()) - ConfigureWithPublicSSH(&role) - - t.Logf("Deploying VM: %s", vmname) - createRoleConfiguration(t, client, role, location) - - t.Logf("Wait for deployment to enter running state") - vmc := vm.NewClient(client) - status := vm.DeploymentStatusDeploying - for status != vm.DeploymentStatusRunning { - deployment, err := vmc.GetDeployment(vmname, vmname) - if err != nil { - t.Error(err) - break - } - status = deployment.Status - } - - t.Logf("Shutting down VM: %s", vmname) - if err := Await(client, func() (management.OperationID, error) { - return vmc.ShutdownRole(vmname, vmname, vmname) - }); err != nil { - t.Error(err) - } - - if err := WaitForDeploymentPowerState(client, vmname, vmname, vm.PowerStateStopped); err != nil { - t.Fatal(err) - } - - imagename := GenerateName() - t.Logf("Capturing OSImage: %s", imagename) - if err := Await(client, func() (management.OperationID, error) { - return vmc.CaptureRole(vmname, vmname, vmname, imagename, imagename, nil) - }); err != nil { - t.Error(err) - } - - im := GetUserOSImage(t, client, imagename) - t.Logf("Found image: %+v", im) - - newvmname := GenerateName() - role = NewVMConfiguration(newvmname, "Standard_D3") - ConfigureDeploymentFromPlatformImage(&role, - im.Name, - fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, newvmname), - GenerateName()) - ConfigureForLinux(&role, newvmname, "azureuser", GeneratePassword()) - ConfigureWithPublicSSH(&role) - - t.Logf("Deploying new VM from freshly captured OS image: %s", newvmname) - if err := Await(client, func() (management.OperationID, error) { - return vmc.CreateDeployment(role, vmname, vm.CreateDeploymentOptions{}) - }); err != nil { - t.Error(err) - } - - deleteHostedService(t, client, vmname) -} - -func TestDeployPlatformVMImageCaptureRedeploy(t *testing.T) { - client := testutils.GetTestClient(t) - vmname := GenerateName() - sa := GetTestStorageAccount(t, client) - location := sa.StorageServiceProperties.Location - - role := NewVMConfiguration(vmname, "Standard_D3") - ConfigureDeploymentFromPlatformImage(&role, - GetLinuxTestImage(t, client).Name, - fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, vmname), - GenerateName()) - ConfigureForLinux(&role, "myvm", "azureuser", GeneratePassword()) - ConfigureWithPublicSSH(&role) - - t.Logf("Deploying VM: %s", vmname) - createRoleConfiguration(t, client, role, location) - - t.Logf("Wait for deployment to enter running state") - vmc := vm.NewClient(client) - status := vm.DeploymentStatusDeploying - for status != vm.DeploymentStatusRunning { - deployment, err := vmc.GetDeployment(vmname, vmname) - if err != nil { - t.Error(err) - break - } - status = deployment.Status - } - - t.Logf("Shutting down VM: %s", vmname) - if err := Await(client, func() (management.OperationID, error) { - return vmc.ShutdownRole(vmname, vmname, vmname) - }); err != nil { - t.Error(err) - } - - if err := WaitForDeploymentInstanceStatus(client, vmname, vmname, vm.InstanceStatusStoppedVM); err != nil { - t.Fatal(err) - } - - imagename := GenerateName() - t.Logf("Capturing VMImage: %s", imagename) - if err := Await(client, func() (management.OperationID, error) { - return vmimage.NewClient(client).Capture(vmname, vmname, vmname, imagename, imagename, vmimage.OSStateGeneralized, vmimage.CaptureParameters{}) - }); err != nil { - t.Error(err) - } - - im := GetUserVMImage(t, client, imagename) - t.Logf("Found image: %+v", im) - - newvmname := GenerateName() - role = NewVMConfiguration(newvmname, "Standard_D3") - ConfigureDeploymentFromUserVMImage(&role, im.Name) - ConfigureForLinux(&role, newvmname, "azureuser", GeneratePassword()) - ConfigureWithPublicSSH(&role) - - t.Logf("Deploying new VM from freshly captured VM image: %s", newvmname) - if err := Await(client, func() (management.OperationID, error) { - return vmc.CreateDeployment(role, vmname, vm.CreateDeploymentOptions{}) - }); err != nil { - t.Error(err) - } - - deleteHostedService(t, client, vmname) -} - -func TestDeployFromPublishedVmImage(t *testing.T) { - client := testutils.GetTestClient(t) - vmname := GenerateName() - sa := GetTestStorageAccount(t, client) - location := sa.StorageServiceProperties.Location - - im := GetVMImage(t, client, func(im vmimage.VMImage) bool { - return im.Name == - "fb83b3509582419d99629ce476bcb5c8__SQL-Server-2014-RTM-12.0.2430.0-OLTP-ENU-Win2012R2-cy14su11" - }) - - role := NewVMConfiguration(vmname, "Standard_D4") - ConfigureDeploymentFromPublishedVMImage(&role, im.Name, - fmt.Sprintf("http://%s.blob.core.windows.net/%s", sa.ServiceName, vmname), false) - ConfigureForWindows(&role, vmname, "azureuser", GeneratePassword(), true, "") - ConfigureWithPublicSSH(&role) - - testRoleConfiguration(t, client, role, location) -} - -func TestRoleStateOperations(t *testing.T) { - client := testutils.GetTestClient(t) - vmname := GenerateName() - sa := GetTestStorageAccount(t, client) - location := sa.StorageServiceProperties.Location - - role := NewVMConfiguration(vmname, "Standard_D3") - ConfigureDeploymentFromPlatformImage(&role, - GetLinuxTestImage(t, client).Name, - fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, vmname), - GenerateName()) - ConfigureForLinux(&role, "myvm", "azureuser", GeneratePassword()) - - createRoleConfiguration(t, client, role, location) - - vmc := vm.NewClient(client) - if err := Await(client, func() (management.OperationID, error) { - return vmc.ShutdownRole(vmname, vmname, vmname) - }); err != nil { - t.Error(err) - } - if err := Await(client, func() (management.OperationID, error) { - return vmc.StartRole(vmname, vmname, vmname) - }); err != nil { - t.Error(err) - } - if err := Await(client, func() (management.OperationID, error) { - return vmc.RestartRole(vmname, vmname, vmname) - }); err != nil { - t.Error(err) - } - - deleteHostedService(t, client, vmname) -} - -func testRoleConfiguration(t *testing.T, client management.Client, role vm.Role, location string) { - createRoleConfiguration(t, client, role, location) - - deleteHostedService(t, client, role.RoleName) -} - -func createRoleConfiguration(t *testing.T, client management.Client, role vm.Role, location string) { - vmc := vm.NewClient(client) - hsc := hostedservice.NewClient(client) - vmname := role.RoleName - - if err := hsc.CreateHostedService(hostedservice.CreateHostedServiceParameters{ - ServiceName: vmname, Location: location, - Label: base64.StdEncoding.EncodeToString([]byte(vmname))}); err != nil { - t.Error(err) - } - - if err := Await(client, func() (management.OperationID, error) { - return vmc.CreateDeployment(role, vmname, vm.CreateDeploymentOptions{}) - }); err != nil { - t.Error(err) - } -} - -func deleteHostedService(t *testing.T, client management.Client, vmname string) { - t.Logf("Deleting hosted service: %s", vmname) - if err := Await(client, func() (management.OperationID, error) { - return hostedservice.NewClient(client).DeleteHostedService(vmname, true) - }); err != nil { - t.Error(err) - } -} - -// === utility funcs === - -func GetTestStorageAccount(t *testing.T, client management.Client) storage.StorageServiceResponse { - t.Log("Retrieving storage account") - sc := storage.NewClient(client) - var sa storage.StorageServiceResponse - ssl, err := sc.ListStorageServices() - if err != nil { - t.Fatal(err) - } - rnd := rand.New(rand.NewSource(time.Now().UnixNano())) - - if len(ssl.StorageServices) == 0 { - t.Log("No storage accounts found, creating a new one") - lc := location.NewClient(client) - ll, err := lc.ListLocations() - if err != nil { - t.Fatal(err) - } - loc := ll.Locations[rnd.Intn(len(ll.Locations))].Name - - t.Logf("Location for new storage account: %s", loc) - name := GenerateName() - op, err := sc.CreateStorageService(storage.StorageAccountCreateParameters{ - ServiceName: name, - Label: base64.StdEncoding.EncodeToString([]byte(name)), - Location: loc, - AccountType: storage.AccountTypeStandardLRS}) - if err != nil { - t.Fatal(err) - } - if err := client.WaitForOperation(op, nil); err != nil { - t.Fatal(err) - } - sa, err = sc.GetStorageService(name) - } else { - - sa = ssl.StorageServices[rnd.Intn(len(ssl.StorageServices))] - } - - t.Logf("Selected storage account '%s' in location '%s'", - sa.ServiceName, sa.StorageServiceProperties.Location) - - return sa -} - -func GetLinuxTestImage(t *testing.T, client management.Client) osimage.OSImage { - return GetOSImage(t, client, func(im osimage.OSImage) bool { - return im.Category == "Public" && im.ImageFamily == "Ubuntu Server 14.04 LTS" - }) -} - -func GetWindowsTestImage(t *testing.T, client management.Client) osimage.OSImage { - return GetOSImage(t, client, func(im osimage.OSImage) bool { - return im.Category == "Public" && im.ImageFamily == "Windows Server 2012 R2 Datacenter" - }) -} - -func GetUserOSImage(t *testing.T, client management.Client, name string) osimage.OSImage { - return GetOSImage(t, client, func(im osimage.OSImage) bool { - return im.Category == "User" && im.Name == name - }) -} - -func GetOSImage( - t *testing.T, - client management.Client, - filter func(osimage.OSImage) bool) osimage.OSImage { - t.Log("Selecting OS image") - osc := osimage.NewClient(client) - allimages, err := osc.ListOSImages() - if err != nil { - t.Fatal(err) - } - filtered := []osimage.OSImage{} - for _, im := range allimages.OSImages { - if filter(im) { - filtered = append(filtered, im) - } - } - if len(filtered) == 0 { - t.Fatal("Filter too restrictive, no images left?") - } - - image := filtered[0] - for _, im := range filtered { - if im.PublishedDate > image.PublishedDate { - image = im - } - } - - t.Logf("Selecting image '%s'", image.Name) - return image -} - -func GetUserVMImage(t *testing.T, client management.Client, name string) vmimage.VMImage { - return GetVMImage(t, client, func(im vmimage.VMImage) bool { - return im.Category == "User" && im.Name == name - }) -} - -func GetVMImage( - t *testing.T, - client management.Client, - filter func(vmimage.VMImage) bool) vmimage.VMImage { - t.Log("Selecting VM image") - allimages, err := vmimage.NewClient(client).ListVirtualMachineImages(vmimage.ListParameters{}) - if err != nil { - t.Fatal(err) - } - filtered := []vmimage.VMImage{} - for _, im := range allimages.VMImages { - if filter(im) { - filtered = append(filtered, im) - } - } - if len(filtered) == 0 { - t.Fatal("Filter too restrictive, no images left?") - } - - image := filtered[0] - for _, im := range filtered { - if im.PublishedDate > image.PublishedDate { - image = im - } - } - - t.Logf("Selecting image '%s'", image.Name) - return image -} - -func GenerateName() string { - from := "1234567890abcdefghijklmnopqrstuvwxyz" - return "sdk" + GenerateString(12, from) -} - -func GeneratePassword() string { - pw := GenerateString(20, "1234567890") + - GenerateString(20, "abcdefghijklmnopqrstuvwxyz") + - GenerateString(20, "ABCDEFGHIJKLMNOPQRSTUVWXYZ") - - rnd := rand.New(rand.NewSource(time.Now().UnixNano())) - i := rnd.Intn(len(pw)-2) + 1 - - pw = string(append([]uint8(pw[i:]), pw[:i-1]...)) - - return pw -} - -func GenerateString(length int, from string) string { - str := "" - rnd := rand.New(rand.NewSource(time.Now().UnixNano())) - for len(str) < length { - str += string(from[rnd.Intn(len(from))]) - } - return str -} - -type asyncFunc func() (operationId management.OperationID, err error) - -func Await(client management.Client, async asyncFunc) error { - requestID, err := async() - if err != nil { - return err - } - return client.WaitForOperation(requestID, nil) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/vmutils_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/vmutils_test.go deleted file mode 100644 index 6755940200..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/vmutils_test.go +++ /dev/null @@ -1,440 +0,0 @@ -package vmutils - -import ( - "encoding/xml" - "testing" - - vmdisk "github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk" -) - -func TestNewLinuxVmRemoteImage(t *testing.T) { - role := NewVMConfiguration("myvm", "Standard_D3") - ConfigureDeploymentFromRemoteImage(&role, - "http://remote.host/some.vhd?sv=12&sig=ukhfiuwef78687", "Linux", - "myvm-os-disk", "http://mystorageacct.blob.core.windows.net/vhds/mybrandnewvm.vhd", - "OSDisk") - ConfigureForLinux(&role, "myvm", "azureuser", "P@ssword", "2398yyKJGd78e2389ydfncuirowebhf89yh3IUOBY") - ConfigureWithPublicSSH(&role) - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - myvm - PersistentVMRole - - - LinuxProvisioningConfiguration - - myvm - azureuser - P@ssword - false - - - - 2398yyKJGd78e2389ydfncuirowebhf89yh3IUOBY - /home/azureuser/.ssh/authorized_keys - - - - - - - - - - NetworkConfiguration - - - - 22 - SSH - 22 - TCP - - - - - - - - - OSDisk - myvm-os-disk - http://mystorageacct.blob.core.windows.net/vhds/mybrandnewvm.vhd - Linux - http://remote.host/some.vhd?sv=12&sig=ukhfiuwef78687 - - Standard_D3 - true -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} - -func TestNewLinuxVmPlatformImage(t *testing.T) { - role := NewVMConfiguration("myplatformvm", "Standard_D3") - ConfigureDeploymentFromPlatformImage(&role, - "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_2_LTS-amd64-server-20150309-en-us-30GB", - "http://mystorageacct.blob.core.windows.net/vhds/mybrandnewvm.vhd", "mydisklabel") - ConfigureForLinux(&role, "myvm", "azureuser", "", "2398yyKJGd78e2389ydfncuirdebhf89yh3IUOBY") - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - myplatformvm - PersistentVMRole - - - LinuxProvisioningConfiguration - - myvm - azureuser - - - - 2398yyKJGd78e2389ydfncuirdebhf89yh3IUOBY - /home/azureuser/.ssh/authorized_keys - - - - - - - - - - - - http://mystorageacct.blob.core.windows.net/vhds/mybrandnewvm.vhd - b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_2_LTS-amd64-server-20150309-en-us-30GB - - Standard_D3 - true -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} - -func TestNewVmFromVMImage(t *testing.T) { - role := NewVMConfiguration("restoredbackup", "Standard_D1") - ConfigureDeploymentFromPublishedVMImage(&role, "myvm-backup-20150209", - "http://mystorageacct.blob.core.windows.net/vhds/myoldnewvm.vhd", false) - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - restoredbackup - PersistentVMRole - - myvm-backup-20150209 - http://mystorageacct.blob.core.windows.net/vhds/myoldnewvm.vhd - - Standard_D1 -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} - -func TestNewVmFromExistingDisk(t *testing.T) { - role := NewVMConfiguration("blobvm", "Standard_D14") - ConfigureDeploymentFromExistingOSDisk(&role, "myvm-backup-20150209", "OSDisk") - ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") - ConfigureWindowsToJoinDomain(&role, "user@domain.com", "youReN3verG0nnaGu3ss", "redmond.corp.contoso.com", "") - ConfigureWithNewDataDisk(&role, "my-brand-new-disk", "http://account.blob.core.windows.net/vhds/newdatadisk.vhd", - 30, vmdisk.HostCachingTypeReadWrite) - ConfigureWithExistingDataDisk(&role, "data-disk", vmdisk.HostCachingTypeReadOnly) - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - blobvm - PersistentVMRole - - - WindowsProvisioningConfiguration - WINVM - P2ssw@rd - true - - - - user@domain.com - youReN3verG0nnaGu3ss - - redmond.corp.contoso.com - - - azuser - - - - - - - - ReadWrite - my-brand-new-disk - 30 - http://account.blob.core.windows.net/vhds/newdatadisk.vhd - - - ReadOnly - data-disk - 1 - - - - OSDisk - myvm-backup-20150209 - - Standard_D14 - true -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} - -func TestWinRMOverHttps(t *testing.T) { - role := NewVMConfiguration("winrmoverhttp", "Standard_D1") - ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") - ConfigureWinRMOverHTTPS(&role, "abcdef") - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - winrmoverhttp - PersistentVMRole - - - WindowsProvisioningConfiguration - WINVM - P2ssw@rd - true - - - - - Https - abcdef - - - - azuser - - - - - - - Standard_D1 - true -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} - -func TestWinRMOverHttpsWithNoThumbprint(t *testing.T) { - role := NewVMConfiguration("winrmoverhttp", "Standard_D1") - ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") - ConfigureWinRMOverHTTPS(&role, "") - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - winrmoverhttp - PersistentVMRole - - - WindowsProvisioningConfiguration - WINVM - P2ssw@rd - true - - - - - Https - - - - azuser - - - - - - - Standard_D1 - true -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} - -func TestWinRMOverHttp(t *testing.T) { - role := NewVMConfiguration("winrmoverhttp", "Standard_D1") - ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") - ConfigureWinRMOverHTTP(&role) - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - winrmoverhttp - PersistentVMRole - - - WindowsProvisioningConfiguration - WINVM - P2ssw@rd - true - - - - - Http - - - - azuser - - - - - - - Standard_D1 - true -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} - -func TestSettingWinRMOverHttpTwice(t *testing.T) { - role := NewVMConfiguration("winrmoverhttp", "Standard_D1") - ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") - ConfigureWinRMOverHTTP(&role) - ConfigureWinRMOverHTTP(&role) - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - winrmoverhttp - PersistentVMRole - - - WindowsProvisioningConfiguration - WINVM - P2ssw@rd - true - - - - - Http - - - - azuser - - - - - - - Standard_D1 - true -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} - -func TestSettingWinRMOverHttpAndHttpsTwice(t *testing.T) { - role := NewVMConfiguration("winrmoverhttp", "Standard_D1") - ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") - ConfigureWinRMOverHTTP(&role) - ConfigureWinRMOverHTTPS(&role, "") - ConfigureWinRMOverHTTP(&role) - ConfigureWinRMOverHTTPS(&role, "abcdef") - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - winrmoverhttp - PersistentVMRole - - - WindowsProvisioningConfiguration - WINVM - P2ssw@rd - true - - - - - Http - - - Https - abcdef - - - - azuser - - - - - - - Standard_D1 - true -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/blob_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/blob_test.go deleted file mode 100644 index df31564178..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/blob_test.go +++ /dev/null @@ -1,715 +0,0 @@ -package storage - -import ( - "bytes" - "crypto/rand" - "encoding/base64" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "sort" - "sync" - "testing" - "time" - - chk "github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/gopkg.in/check.v1" -) - -type StorageBlobSuite struct{} - -var _ = chk.Suite(&StorageBlobSuite{}) - -const testContainerPrefix = "zzzztest-" - -func getBlobClient(c *chk.C) BlobStorageClient { - return getBasicClient(c).GetBlobService() -} - -func (s *StorageBlobSuite) Test_pathForContainer(c *chk.C) { - c.Assert(pathForContainer("foo"), chk.Equals, "/foo") -} - -func (s *StorageBlobSuite) Test_pathForBlob(c *chk.C) { - c.Assert(pathForBlob("foo", "blob"), chk.Equals, "/foo/blob") -} - -func (s *StorageBlobSuite) Test_blobSASStringToSign(c *chk.C) { - _, err := blobSASStringToSign("2012-02-12", "CS", "SE", "SP") - c.Assert(err, chk.NotNil) // not implemented SAS for versions earlier than 2013-08-15 - - out, err := blobSASStringToSign("2013-08-15", "CS", "SE", "SP") - c.Assert(err, chk.IsNil) - c.Assert(out, chk.Equals, "SP\n\nSE\nCS\n\n2013-08-15\n\n\n\n\n") -} - -func (s *StorageBlobSuite) TestGetBlobSASURI(c *chk.C) { - api, err := NewClient("foo", "YmFy", DefaultBaseURL, "2013-08-15", true) - c.Assert(err, chk.IsNil) - cli := api.GetBlobService() - expiry := time.Time{} - - expectedParts := url.URL{ - Scheme: "https", - Host: "foo.blob.core.windows.net", - Path: "container/name", - RawQuery: url.Values{ - "sv": {"2013-08-15"}, - "sig": {"/OXG7rWh08jYwtU03GzJM0DHZtidRGpC6g69rSGm3I0="}, - "sr": {"b"}, - "sp": {"r"}, - "se": {"0001-01-01T00:00:00Z"}, - }.Encode()} - - u, err := cli.GetBlobSASURI("container", "name", expiry, "r") - c.Assert(err, chk.IsNil) - sasParts, err := url.Parse(u) - c.Assert(err, chk.IsNil) - c.Assert(expectedParts.String(), chk.Equals, sasParts.String()) - c.Assert(expectedParts.Query(), chk.DeepEquals, sasParts.Query()) -} - -func (s *StorageBlobSuite) TestBlobSASURICorrectness(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - blob := randString(20) - body := []byte(randString(100)) - expiry := time.Now().UTC().Add(time.Hour) - permissions := "r" - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.DeleteContainer(cnt) - - c.Assert(cli.putSingleBlockBlob(cnt, blob, body), chk.IsNil) - - sasURI, err := cli.GetBlobSASURI(cnt, blob, expiry, permissions) - c.Assert(err, chk.IsNil) - - resp, err := http.Get(sasURI) - c.Assert(err, chk.IsNil) - - blobResp, err := ioutil.ReadAll(resp.Body) - defer resp.Body.Close() - c.Assert(err, chk.IsNil) - - c.Assert(resp.StatusCode, chk.Equals, http.StatusOK) - c.Assert(len(blobResp), chk.Equals, len(body)) -} - -func (s *StorageBlobSuite) TestListContainersPagination(c *chk.C) { - cli := getBlobClient(c) - c.Assert(deleteTestContainers(cli), chk.IsNil) - - const n = 5 - const pageSize = 2 - - // Create test containers - created := []string{} - for i := 0; i < n; i++ { - name := randContainer() - c.Assert(cli.CreateContainer(name, ContainerAccessTypePrivate), chk.IsNil) - created = append(created, name) - } - sort.Strings(created) - - // Defer test container deletions - defer func() { - var wg sync.WaitGroup - for _, cnt := range created { - wg.Add(1) - go func(name string) { - c.Assert(cli.DeleteContainer(name), chk.IsNil) - wg.Done() - }(cnt) - } - wg.Wait() - }() - - // Paginate results - seen := []string{} - marker := "" - for { - resp, err := cli.ListContainers(ListContainersParameters{ - Prefix: testContainerPrefix, - MaxResults: pageSize, - Marker: marker}) - c.Assert(err, chk.IsNil) - - containers := resp.Containers - if len(containers) > pageSize { - c.Fatalf("Got a bigger page. Expected: %d, got: %d", pageSize, len(containers)) - } - - for _, c := range containers { - seen = append(seen, c.Name) - } - - marker = resp.NextMarker - if marker == "" || len(containers) == 0 { - break - } - } - - c.Assert(seen, chk.DeepEquals, created) -} - -func (s *StorageBlobSuite) TestContainerExists(c *chk.C) { - cnt := randContainer() - cli := getBlobClient(c) - ok, err := cli.ContainerExists(cnt) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypeBlob), chk.IsNil) - defer cli.DeleteContainer(cnt) - - ok, err = cli.ContainerExists(cnt) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -func (s *StorageBlobSuite) TestCreateContainerDeleteContainer(c *chk.C) { - cnt := randContainer() - cli := getBlobClient(c) - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - c.Assert(cli.DeleteContainer(cnt), chk.IsNil) -} - -func (s *StorageBlobSuite) TestCreateContainerIfNotExists(c *chk.C) { - cnt := randContainer() - cli := getBlobClient(c) - defer cli.DeleteContainer(cnt) - - // First create - ok, err := cli.CreateContainerIfNotExists(cnt, ContainerAccessTypePrivate) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) - - // Second create, should not give errors - ok, err = cli.CreateContainerIfNotExists(cnt, ContainerAccessTypePrivate) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) -} - -func (s *StorageBlobSuite) TestDeleteContainerIfExists(c *chk.C) { - cnt := randContainer() - cli := getBlobClient(c) - - // Nonexisting container - c.Assert(cli.DeleteContainer(cnt), chk.NotNil) - - ok, err := cli.DeleteContainerIfExists(cnt) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - // Existing container - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - ok, err = cli.DeleteContainerIfExists(cnt) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -func (s *StorageBlobSuite) TestBlobExists(c *chk.C) { - cnt := randContainer() - blob := randString(20) - cli := getBlobClient(c) - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypeBlob), chk.IsNil) - defer cli.DeleteContainer(cnt) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte("Hello!")), chk.IsNil) - defer cli.DeleteBlob(cnt, blob) - - ok, err := cli.BlobExists(cnt, blob+".foo") - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - ok, err = cli.BlobExists(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -func (s *StorageBlobSuite) TestGetBlobURL(c *chk.C) { - api, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - cli := api.GetBlobService() - - c.Assert(cli.GetBlobURL("c", "nested/blob"), chk.Equals, "https://foo.blob.core.windows.net/c/nested/blob") - c.Assert(cli.GetBlobURL("", "blob"), chk.Equals, "https://foo.blob.core.windows.net/$root/blob") - c.Assert(cli.GetBlobURL("", "nested/blob"), chk.Equals, "https://foo.blob.core.windows.net/$root/nested/blob") -} - -func (s *StorageBlobSuite) TestBlobCopy(c *chk.C) { - if testing.Short() { - c.Skip("skipping blob copy in short mode, no SLA on async operation") - } - - cli := getBlobClient(c) - cnt := randContainer() - src := randString(20) - dst := randString(20) - body := []byte(randString(1024)) - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - c.Assert(cli.putSingleBlockBlob(cnt, src, body), chk.IsNil) - defer cli.DeleteBlob(cnt, src) - - c.Assert(cli.CopyBlob(cnt, dst, cli.GetBlobURL(cnt, src)), chk.IsNil) - defer cli.DeleteBlob(cnt, dst) - - blobBody, err := cli.GetBlob(cnt, dst) - c.Assert(err, chk.IsNil) - - b, err := ioutil.ReadAll(blobBody) - defer blobBody.Close() - c.Assert(err, chk.IsNil) - c.Assert(b, chk.DeepEquals, body) -} - -func (s *StorageBlobSuite) TestDeleteBlobIfExists(c *chk.C) { - cnt := randContainer() - blob := randString(20) - - cli := getBlobClient(c) - c.Assert(cli.DeleteBlob(cnt, blob), chk.NotNil) - - ok, err := cli.DeleteBlobIfExists(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) -} - -func (s *StorageBlobSuite) TestGetBlobProperties(c *chk.C) { - cnt := randContainer() - blob := randString(20) - contents := randString(64) - - cli := getBlobClient(c) - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.DeleteContainer(cnt) - - // Nonexisting blob - _, err := cli.GetBlobProperties(cnt, blob) - c.Assert(err, chk.NotNil) - - // Put the blob - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte(contents)), chk.IsNil) - - // Get blob properties - props, err := cli.GetBlobProperties(cnt, blob) - c.Assert(err, chk.IsNil) - - c.Assert(props.ContentLength, chk.Equals, int64(len(contents))) - c.Assert(props.BlobType, chk.Equals, BlobTypeBlock) -} - -func (s *StorageBlobSuite) TestListBlobsPagination(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.DeleteContainer(cnt) - - blobs := []string{} - const n = 5 - const pageSize = 2 - for i := 0; i < n; i++ { - name := randString(20) - c.Assert(cli.putSingleBlockBlob(cnt, name, []byte("Hello, world!")), chk.IsNil) - blobs = append(blobs, name) - } - sort.Strings(blobs) - - // Paginate - seen := []string{} - marker := "" - for { - resp, err := cli.ListBlobs(cnt, ListBlobsParameters{ - MaxResults: pageSize, - Marker: marker}) - c.Assert(err, chk.IsNil) - - for _, v := range resp.Blobs { - seen = append(seen, v.Name) - } - - marker = resp.NextMarker - if marker == "" || len(resp.Blobs) == 0 { - break - } - } - - // Compare - c.Assert(seen, chk.DeepEquals, blobs) -} - -func (s *StorageBlobSuite) TestGetAndSetMetadata(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randString(20) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - - m, err := cli.GetBlobMetadata(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(m, chk.Not(chk.Equals), nil) - c.Assert(len(m), chk.Equals, 0) - - mPut := map[string]string{ - "foo": "bar", - "bar_baz": "waz qux", - } - - err = cli.SetBlobMetadata(cnt, blob, mPut) - c.Assert(err, chk.IsNil) - - m, err = cli.GetBlobMetadata(cnt, blob) - c.Assert(err, chk.IsNil) - c.Check(m, chk.DeepEquals, mPut) - - // Case munging - - mPutUpper := map[string]string{ - "Foo": "different bar", - "bar_BAZ": "different waz qux", - } - mExpectLower := map[string]string{ - "foo": "different bar", - "bar_baz": "different waz qux", - } - - err = cli.SetBlobMetadata(cnt, blob, mPutUpper) - c.Assert(err, chk.IsNil) - - m, err = cli.GetBlobMetadata(cnt, blob) - c.Assert(err, chk.IsNil) - c.Check(m, chk.DeepEquals, mExpectLower) -} - -func (s *StorageBlobSuite) TestPutEmptyBlockBlob(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randString(20) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - - props, err := cli.GetBlobProperties(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(props.ContentLength, chk.Not(chk.Equals), 0) -} - -func (s *StorageBlobSuite) TestGetBlobRange(c *chk.C) { - cnt := randContainer() - blob := randString(20) - body := "0123456789" - - cli := getBlobClient(c) - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypeBlob), chk.IsNil) - defer cli.DeleteContainer(cnt) - - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte(body)), chk.IsNil) - defer cli.DeleteBlob(cnt, blob) - - // Read 1-3 - for _, r := range []struct { - rangeStr string - expected string - }{ - {"0-", body}, - {"1-3", body[1 : 3+1]}, - {"3-", body[3:]}, - } { - resp, err := cli.GetBlobRange(cnt, blob, r.rangeStr) - c.Assert(err, chk.IsNil) - blobBody, err := ioutil.ReadAll(resp) - c.Assert(err, chk.IsNil) - - str := string(blobBody) - c.Assert(str, chk.Equals, r.expected) - } -} - -func (s *StorageBlobSuite) TestCreateBlockBlobFromReader(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - name := randString(20) - data := randBytes(8888) - c.Assert(cli.CreateBlockBlobFromReader(cnt, name, uint64(len(data)), bytes.NewReader(data), nil), chk.IsNil) - - body, err := cli.GetBlob(cnt, name) - c.Assert(err, chk.IsNil) - gotData, err := ioutil.ReadAll(body) - body.Close() - - c.Assert(err, chk.IsNil) - c.Assert(gotData, chk.DeepEquals, data) -} - -func (s *StorageBlobSuite) TestCreateBlockBlobFromReaderWithShortData(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - name := randString(20) - data := randBytes(8888) - err := cli.CreateBlockBlobFromReader(cnt, name, 9999, bytes.NewReader(data), nil) - c.Assert(err, chk.Not(chk.IsNil)) - - _, err = cli.GetBlob(cnt, name) - // Upload was incomplete: blob should not have been created. - c.Assert(err, chk.Not(chk.IsNil)) -} - -func (s *StorageBlobSuite) TestPutBlock(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randString(20) - chunk := []byte(randString(1024)) - blockID := base64.StdEncoding.EncodeToString([]byte("foo")) - c.Assert(cli.PutBlock(cnt, blob, blockID, chunk), chk.IsNil) -} - -func (s *StorageBlobSuite) TestGetBlockList_PutBlockList(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randString(20) - chunk := []byte(randString(1024)) - blockID := base64.StdEncoding.EncodeToString([]byte("foo")) - - // Put one block - c.Assert(cli.PutBlock(cnt, blob, blockID, chunk), chk.IsNil) - defer cli.deleteBlob(cnt, blob) - - // Get committed blocks - committed, err := cli.GetBlockList(cnt, blob, BlockListTypeCommitted) - c.Assert(err, chk.IsNil) - - if len(committed.CommittedBlocks) > 0 { - c.Fatal("There are committed blocks") - } - - // Get uncommitted blocks - uncommitted, err := cli.GetBlockList(cnt, blob, BlockListTypeUncommitted) - c.Assert(err, chk.IsNil) - - c.Assert(len(uncommitted.UncommittedBlocks), chk.Equals, 1) - // Commit block list - c.Assert(cli.PutBlockList(cnt, blob, []Block{{blockID, BlockStatusUncommitted}}), chk.IsNil) - - // Get all blocks - all, err := cli.GetBlockList(cnt, blob, BlockListTypeAll) - c.Assert(err, chk.IsNil) - c.Assert(len(all.CommittedBlocks), chk.Equals, 1) - c.Assert(len(all.UncommittedBlocks), chk.Equals, 0) - - // Verify the block - thatBlock := all.CommittedBlocks[0] - c.Assert(thatBlock.Name, chk.Equals, blockID) - c.Assert(thatBlock.Size, chk.Equals, int64(len(chunk))) -} - -func (s *StorageBlobSuite) TestCreateBlockBlob(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randString(20) - c.Assert(cli.CreateBlockBlob(cnt, blob), chk.IsNil) - - // Verify - blocks, err := cli.GetBlockList(cnt, blob, BlockListTypeAll) - c.Assert(err, chk.IsNil) - c.Assert(len(blocks.CommittedBlocks), chk.Equals, 0) - c.Assert(len(blocks.UncommittedBlocks), chk.Equals, 0) -} - -func (s *StorageBlobSuite) TestPutPageBlob(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randString(20) - size := int64(10 * 1024 * 1024) - c.Assert(cli.PutPageBlob(cnt, blob, size, nil), chk.IsNil) - - // Verify - props, err := cli.GetBlobProperties(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(props.ContentLength, chk.Equals, size) - c.Assert(props.BlobType, chk.Equals, BlobTypePage) -} - -func (s *StorageBlobSuite) TestPutPagesUpdate(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randString(20) - size := int64(10 * 1024 * 1024) // larger than we'll use - c.Assert(cli.PutPageBlob(cnt, blob, size, nil), chk.IsNil) - - chunk1 := []byte(randString(1024)) - chunk2 := []byte(randString(512)) - - // Append chunks - c.Assert(cli.PutPage(cnt, blob, 0, int64(len(chunk1)-1), PageWriteTypeUpdate, chunk1), chk.IsNil) - c.Assert(cli.PutPage(cnt, blob, int64(len(chunk1)), int64(len(chunk1)+len(chunk2)-1), PageWriteTypeUpdate, chunk2), chk.IsNil) - - // Verify contents - out, err := cli.GetBlobRange(cnt, blob, fmt.Sprintf("%v-%v", 0, len(chunk1)+len(chunk2)-1)) - c.Assert(err, chk.IsNil) - defer out.Close() - blobContents, err := ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - c.Assert(blobContents, chk.DeepEquals, append(chunk1, chunk2...)) - out.Close() - - // Overwrite first half of chunk1 - chunk0 := []byte(randString(512)) - c.Assert(cli.PutPage(cnt, blob, 0, int64(len(chunk0)-1), PageWriteTypeUpdate, chunk0), chk.IsNil) - - // Verify contents - out, err = cli.GetBlobRange(cnt, blob, fmt.Sprintf("%v-%v", 0, len(chunk1)+len(chunk2)-1)) - c.Assert(err, chk.IsNil) - defer out.Close() - blobContents, err = ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - c.Assert(blobContents, chk.DeepEquals, append(append(chunk0, chunk1[512:]...), chunk2...)) -} - -func (s *StorageBlobSuite) TestPutPagesClear(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randString(20) - size := int64(10 * 1024 * 1024) // larger than we'll use - c.Assert(cli.PutPageBlob(cnt, blob, size, nil), chk.IsNil) - - // Put 0-2047 - chunk := []byte(randString(2048)) - c.Assert(cli.PutPage(cnt, blob, 0, 2047, PageWriteTypeUpdate, chunk), chk.IsNil) - - // Clear 512-1023 - c.Assert(cli.PutPage(cnt, blob, 512, 1023, PageWriteTypeClear, nil), chk.IsNil) - - // Verify contents - out, err := cli.GetBlobRange(cnt, blob, "0-2047") - c.Assert(err, chk.IsNil) - contents, err := ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - defer out.Close() - c.Assert(contents, chk.DeepEquals, append(append(chunk[:512], make([]byte, 512)...), chunk[1024:]...)) -} - -func (s *StorageBlobSuite) TestGetPageRanges(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randString(20) - size := int64(10 * 1024 * 1024) // larger than we'll use - c.Assert(cli.PutPageBlob(cnt, blob, size, nil), chk.IsNil) - - // Get page ranges on empty blob - out, err := cli.GetPageRanges(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(len(out.PageList), chk.Equals, 0) - - // Add 0-512 page - c.Assert(cli.PutPage(cnt, blob, 0, 511, PageWriteTypeUpdate, []byte(randString(512))), chk.IsNil) - - out, err = cli.GetPageRanges(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(len(out.PageList), chk.Equals, 1) - - // Add 1024-2048 - c.Assert(cli.PutPage(cnt, blob, 1024, 2047, PageWriteTypeUpdate, []byte(randString(1024))), chk.IsNil) - - out, err = cli.GetPageRanges(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(len(out.PageList), chk.Equals, 2) -} - -func deleteTestContainers(cli BlobStorageClient) error { - for { - resp, err := cli.ListContainers(ListContainersParameters{Prefix: testContainerPrefix}) - if err != nil { - return err - } - if len(resp.Containers) == 0 { - break - } - for _, c := range resp.Containers { - err = cli.DeleteContainer(c.Name) - if err != nil { - return err - } - } - } - return nil -} - -func (b BlobStorageClient) putSingleBlockBlob(container, name string, chunk []byte) error { - if len(chunk) > MaxBlobBlockSize { - return fmt.Errorf("storage: provided chunk (%d bytes) cannot fit into single-block blob (max %d bytes)", len(chunk), MaxBlobBlockSize) - } - - uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{}) - headers := b.client.getStandardHeaders() - headers["x-ms-blob-type"] = string(BlobTypeBlock) - headers["Content-Length"] = fmt.Sprintf("%v", len(chunk)) - - resp, err := b.client.exec("PUT", uri, headers, bytes.NewReader(chunk)) - if err != nil { - return err - } - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -func randContainer() string { - return testContainerPrefix + randString(32-len(testContainerPrefix)) -} - -func randString(n int) string { - if n <= 0 { - panic("negative number") - } - const alphanum = "0123456789abcdefghijklmnopqrstuvwxyz" - var bytes = make([]byte, n) - rand.Read(bytes) - for i, b := range bytes { - bytes[i] = alphanum[b%byte(len(alphanum))] - } - return string(bytes) -} - -func randBytes(n int) []byte { - data := make([]byte, n) - if _, err := io.ReadFull(rand.Reader, data); err != nil { - panic(err) - } - return data -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/client_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/client_test.go deleted file mode 100644 index 0c75a13b14..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/client_test.go +++ /dev/null @@ -1,156 +0,0 @@ -package storage - -import ( - "encoding/base64" - "net/url" - "os" - "testing" - - chk "github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/gopkg.in/check.v1" -) - -// Hook up gocheck to testing -func Test(t *testing.T) { chk.TestingT(t) } - -type StorageClientSuite struct{} - -var _ = chk.Suite(&StorageClientSuite{}) - -// getBasicClient returns a test client from storage credentials in the env -func getBasicClient(c *chk.C) Client { - name := os.Getenv("ACCOUNT_NAME") - if name == "" { - c.Fatal("ACCOUNT_NAME not set, need an empty storage account to test") - } - key := os.Getenv("ACCOUNT_KEY") - if key == "" { - c.Fatal("ACCOUNT_KEY not set") - } - cli, err := NewBasicClient(name, key) - c.Assert(err, chk.IsNil) - return cli -} - -func (s *StorageClientSuite) TestGetBaseURL_Basic_Https(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - c.Assert(cli.apiVersion, chk.Equals, DefaultAPIVersion) - c.Assert(err, chk.IsNil) - c.Assert(cli.getBaseURL("table"), chk.Equals, "https://foo.table.core.windows.net") -} - -func (s *StorageClientSuite) TestGetBaseURL_Custom_NoHttps(c *chk.C) { - apiVersion := "2015-01-01" // a non existing one - cli, err := NewClient("foo", "YmFy", "core.chinacloudapi.cn", apiVersion, false) - c.Assert(err, chk.IsNil) - c.Assert(cli.apiVersion, chk.Equals, apiVersion) - c.Assert(cli.getBaseURL("table"), chk.Equals, "http://foo.table.core.chinacloudapi.cn") -} - -func (s *StorageClientSuite) TestGetEndpoint_None(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - output := cli.getEndpoint(blobServiceName, "", url.Values{}) - c.Assert(output, chk.Equals, "https://foo.blob.core.windows.net/") -} - -func (s *StorageClientSuite) TestGetEndpoint_PathOnly(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - output := cli.getEndpoint(blobServiceName, "path", url.Values{}) - c.Assert(output, chk.Equals, "https://foo.blob.core.windows.net/path") -} - -func (s *StorageClientSuite) TestGetEndpoint_ParamsOnly(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - params := url.Values{} - params.Set("a", "b") - params.Set("c", "d") - output := cli.getEndpoint(blobServiceName, "", params) - c.Assert(output, chk.Equals, "https://foo.blob.core.windows.net/?a=b&c=d") -} - -func (s *StorageClientSuite) TestGetEndpoint_Mixed(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - params := url.Values{} - params.Set("a", "b") - params.Set("c", "d") - output := cli.getEndpoint(blobServiceName, "path", params) - c.Assert(output, chk.Equals, "https://foo.blob.core.windows.net/path?a=b&c=d") -} - -func (s *StorageClientSuite) Test_getStandardHeaders(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - - headers := cli.getStandardHeaders() - c.Assert(len(headers), chk.Equals, 2) - c.Assert(headers["x-ms-version"], chk.Equals, cli.apiVersion) - if _, ok := headers["x-ms-date"]; !ok { - c.Fatal("Missing date header") - } -} - -func (s *StorageClientSuite) Test_buildCanonicalizedResource(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - - type test struct{ url, expected string } - tests := []test{ - {"https://foo.blob.core.windows.net/path?a=b&c=d", "/foo/path\na:b\nc:d"}, - {"https://foo.blob.core.windows.net/?comp=list", "/foo/\ncomp:list"}, - {"https://foo.blob.core.windows.net/cnt/blob", "/foo/cnt/blob"}, - } - - for _, i := range tests { - out, err := cli.buildCanonicalizedResource(i.url) - c.Assert(err, chk.IsNil) - c.Assert(out, chk.Equals, i.expected) - } -} - -func (s *StorageClientSuite) Test_buildCanonicalizedHeader(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - - type test struct { - headers map[string]string - expected string - } - tests := []test{ - {map[string]string{}, ""}, - {map[string]string{"x-ms-foo": "bar"}, "x-ms-foo:bar"}, - {map[string]string{"foo:": "bar"}, ""}, - {map[string]string{"foo:": "bar", "x-ms-foo": "bar"}, "x-ms-foo:bar"}, - {map[string]string{ - "x-ms-version": "9999-99-99", - "x-ms-blob-type": "BlockBlob"}, "x-ms-blob-type:BlockBlob\nx-ms-version:9999-99-99"}} - - for _, i := range tests { - c.Assert(cli.buildCanonicalizedHeader(i.headers), chk.Equals, i.expected) - } -} - -func (s *StorageClientSuite) TestReturnsStorageServiceError(c *chk.C) { - // attempt to delete a nonexisting container - _, err := getBlobClient(c).deleteContainer(randContainer()) - c.Assert(err, chk.NotNil) - - v, ok := err.(AzureStorageServiceError) - c.Check(ok, chk.Equals, true) - c.Assert(v.StatusCode, chk.Equals, 404) - c.Assert(v.Code, chk.Equals, "ContainerNotFound") - c.Assert(v.Code, chk.Not(chk.Equals), "") -} - -func (s *StorageClientSuite) Test_createAuthorizationHeader(c *chk.C) { - key := base64.StdEncoding.EncodeToString([]byte("bar")) - cli, err := NewBasicClient("foo", key) - c.Assert(err, chk.IsNil) - - canonicalizedString := `foobarzoo` - expected := `SharedKey foo:h5U0ATVX6SpbFX1H6GNuxIMeXXCILLoIvhflPtuQZ30=` - c.Assert(cli.createAuthorizationHeader(canonicalizedString), chk.Equals, expected) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/file_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/file_test.go deleted file mode 100644 index 3993290302..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/file_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package storage - -import ( - chk "github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/gopkg.in/check.v1" -) - -type StorageFileSuite struct{} - -var _ = chk.Suite(&StorageFileSuite{}) - -func getFileClient(c *chk.C) FileServiceClient { - return getBasicClient(c).GetFileService() -} - -func (s *StorageFileSuite) Test_pathForFileShare(c *chk.C) { - c.Assert(pathForFileShare("foo"), chk.Equals, "/foo") -} - -func (s *StorageFileSuite) TestCreateShareDeleteShare(c *chk.C) { - cli := getFileClient(c) - name := randShare() - c.Assert(cli.CreateShare(name), chk.IsNil) - c.Assert(cli.DeleteShare(name), chk.IsNil) -} - -func (s *StorageFileSuite) TestCreateShareIfNotExists(c *chk.C) { - cli := getFileClient(c) - name := randShare() - defer cli.DeleteShare(name) - - // First create - ok, err := cli.CreateShareIfNotExists(name) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) - - // Second create, should not give errors - ok, err = cli.CreateShareIfNotExists(name) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) -} - -func (s *StorageFileSuite) TestDeleteShareIfNotExists(c *chk.C) { - cli := getFileClient(c) - name := randShare() - - // delete non-existing share - ok, err := cli.DeleteShareIfExists(name) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - c.Assert(cli.CreateShare(name), chk.IsNil) - - // delete existing share - ok, err = cli.DeleteShareIfExists(name) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -const testSharePrefix = "zzzzztest" - -func randShare() string { - return testSharePrefix + randString(32-len(testSharePrefix)) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/queue_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/queue_test.go deleted file mode 100644 index 19f809670c..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/queue_test.go +++ /dev/null @@ -1,132 +0,0 @@ -package storage - -import ( - "time" - - chk "github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/gopkg.in/check.v1" -) - -type StorageQueueSuite struct{} - -var _ = chk.Suite(&StorageQueueSuite{}) - -func getQueueClient(c *chk.C) QueueServiceClient { - return getBasicClient(c).GetQueueService() -} - -func (s *StorageQueueSuite) Test_pathForQueue(c *chk.C) { - c.Assert(pathForQueue("q"), chk.Equals, "/q") -} - -func (s *StorageQueueSuite) Test_pathForQueueMessages(c *chk.C) { - c.Assert(pathForQueueMessages("q"), chk.Equals, "/q/messages") -} - -func (s *StorageQueueSuite) Test_pathForMessage(c *chk.C) { - c.Assert(pathForMessage("q", "m"), chk.Equals, "/q/messages/m") -} - -func (s *StorageQueueSuite) TestCreateQueue_DeleteQueue(c *chk.C) { - cli := getQueueClient(c) - name := randString(20) - c.Assert(cli.CreateQueue(name), chk.IsNil) - c.Assert(cli.DeleteQueue(name), chk.IsNil) -} - -func (s *StorageQueueSuite) Test_GetMetadata_GetApproximateCount(c *chk.C) { - cli := getQueueClient(c) - name := randString(20) - c.Assert(cli.CreateQueue(name), chk.IsNil) - defer cli.DeleteQueue(name) - - qm, err := cli.GetMetadata(name) - c.Assert(err, chk.IsNil) - c.Assert(qm.ApproximateMessageCount, chk.Equals, 0) - - for ix := 0; ix < 3; ix++ { - err = cli.PutMessage(name, "foobar", PutMessageParameters{}) - c.Assert(err, chk.IsNil) - } - time.Sleep(1 * time.Second) - - qm, err = cli.GetMetadata(name) - c.Assert(err, chk.IsNil) - c.Assert(qm.ApproximateMessageCount, chk.Equals, 3) -} - -func (s *StorageQueueSuite) Test_SetMetadataGetMetadata_Roundtrips(c *chk.C) { - cli := getQueueClient(c) - name := randString(20) - c.Assert(cli.CreateQueue(name), chk.IsNil) - defer cli.DeleteQueue(name) - - metadata := make(map[string]string) - metadata["Foo1"] = "bar1" - metadata["fooBaz"] = "bar" - err := cli.SetMetadata(name, metadata) - c.Assert(err, chk.IsNil) - - qm, err := cli.GetMetadata(name) - c.Assert(err, chk.IsNil) - c.Assert(qm.UserDefinedMetadata["foo1"], chk.Equals, "bar1") - c.Assert(qm.UserDefinedMetadata["foobaz"], chk.Equals, "bar") -} - -func (s *StorageQueueSuite) TestQueueExists(c *chk.C) { - cli := getQueueClient(c) - ok, err := cli.QueueExists("nonexistent-queue") - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - name := randString(20) - c.Assert(cli.CreateQueue(name), chk.IsNil) - defer cli.DeleteQueue(name) - - ok, err = cli.QueueExists(name) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -func (s *StorageQueueSuite) TestPostMessage_PeekMessage_DeleteMessage(c *chk.C) { - q := randString(20) - cli := getQueueClient(c) - c.Assert(cli.CreateQueue(q), chk.IsNil) - defer cli.DeleteQueue(q) - - msg := randString(64 * 1024) // exercise max length - c.Assert(cli.PutMessage(q, msg, PutMessageParameters{}), chk.IsNil) - r, err := cli.PeekMessages(q, PeekMessagesParameters{}) - c.Assert(err, chk.IsNil) - c.Assert(len(r.QueueMessagesList), chk.Equals, 1) - c.Assert(r.QueueMessagesList[0].MessageText, chk.Equals, msg) -} - -func (s *StorageQueueSuite) TestGetMessages(c *chk.C) { - q := randString(20) - cli := getQueueClient(c) - c.Assert(cli.CreateQueue(q), chk.IsNil) - defer cli.DeleteQueue(q) - - n := 4 - for i := 0; i < n; i++ { - c.Assert(cli.PutMessage(q, randString(10), PutMessageParameters{}), chk.IsNil) - } - - r, err := cli.GetMessages(q, GetMessagesParameters{NumOfMessages: n}) - c.Assert(err, chk.IsNil) - c.Assert(len(r.QueueMessagesList), chk.Equals, n) -} - -func (s *StorageQueueSuite) TestDeleteMessages(c *chk.C) { - q := randString(20) - cli := getQueueClient(c) - c.Assert(cli.CreateQueue(q), chk.IsNil) - defer cli.DeleteQueue(q) - - c.Assert(cli.PutMessage(q, "message", PutMessageParameters{}), chk.IsNil) - r, err := cli.GetMessages(q, GetMessagesParameters{VisibilityTimeout: 1}) - c.Assert(err, chk.IsNil) - c.Assert(len(r.QueueMessagesList), chk.Equals, 1) - m := r.QueueMessagesList[0] - c.Assert(cli.DeleteMessage(q, m.MessageID, m.PopReceipt), chk.IsNil) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/util_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/util_test.go deleted file mode 100644 index 9acbe5537d..0000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/util_test.go +++ /dev/null @@ -1,69 +0,0 @@ -package storage - -import ( - "encoding/xml" - "io/ioutil" - "net/url" - "strings" - "time" - - chk "github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/gopkg.in/check.v1" -) - -func (s *StorageClientSuite) Test_timeRfc1123Formatted(c *chk.C) { - now := time.Now().UTC() - expectedLayout := "Mon, 02 Jan 2006 15:04:05 GMT" - c.Assert(timeRfc1123Formatted(now), chk.Equals, now.Format(expectedLayout)) -} - -func (s *StorageClientSuite) Test_mergeParams(c *chk.C) { - v1 := url.Values{ - "k1": {"v1"}, - "k2": {"v2"}} - v2 := url.Values{ - "k1": {"v11"}, - "k3": {"v3"}} - out := mergeParams(v1, v2) - c.Assert(out.Get("k1"), chk.Equals, "v1") - c.Assert(out.Get("k2"), chk.Equals, "v2") - c.Assert(out.Get("k3"), chk.Equals, "v3") - c.Assert(out["k1"], chk.DeepEquals, []string{"v1", "v11"}) -} - -func (s *StorageClientSuite) Test_prepareBlockListRequest(c *chk.C) { - empty := []Block{} - expected := `` - c.Assert(prepareBlockListRequest(empty), chk.DeepEquals, expected) - - blocks := []Block{{"foo", BlockStatusLatest}, {"bar", BlockStatusUncommitted}} - expected = `foobar` - c.Assert(prepareBlockListRequest(blocks), chk.DeepEquals, expected) -} - -func (s *StorageClientSuite) Test_xmlUnmarshal(c *chk.C) { - xml := ` - - myblob - ` - var blob Blob - body := ioutil.NopCloser(strings.NewReader(xml)) - c.Assert(xmlUnmarshal(body, &blob), chk.IsNil) - c.Assert(blob.Name, chk.Equals, "myblob") -} - -func (s *StorageClientSuite) Test_xmlMarshal(c *chk.C) { - type t struct { - XMLName xml.Name `xml:"S"` - Name string `xml:"Name"` - } - - b := t{Name: "myblob"} - expected := `myblob` - r, i, err := xmlMarshal(b) - c.Assert(err, chk.IsNil) - o, err := ioutil.ReadAll(r) - c.Assert(err, chk.IsNil) - out := string(o) - c.Assert(out, chk.Equals, expected) - c.Assert(i, chk.Equals, len(expected)) -} diff --git a/vendor/github.com/DreamItGetIT/statuscake/client_test.go b/vendor/github.com/DreamItGetIT/statuscake/client_test.go deleted file mode 100644 index 1a65f4946d..0000000000 --- a/vendor/github.com/DreamItGetIT/statuscake/client_test.go +++ /dev/null @@ -1,236 +0,0 @@ -package statuscake - -import ( - "bytes" - "io" - "io/ioutil" - "log" - "net/http" - "net/url" - "os" - "path/filepath" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestAuth_validate(t *testing.T) { - assert := assert.New(t) - require := require.New(t) - - auth := &Auth{} - err := auth.validate() - - require.NotNil(err) - assert.Contains(err.Error(), "Username is required") - assert.Contains(err.Error(), "Apikey is required") - - auth.Username = "foo" - err = auth.validate() - - require.NotNil(err) - assert.Equal("Apikey is required", err.Error()) - - auth.Apikey = "bar" - err = auth.validate() - assert.Nil(err) -} - -func TestClient(t *testing.T) { - require := require.New(t) - assert := assert.New(t) - - c, err := New(Auth{Username: "random-user", Apikey: "my-pass"}) - require.Nil(err) - - assert.Equal("random-user", c.username) - assert.Equal("my-pass", c.apiKey) -} - -func TestClient_newRequest(t *testing.T) { - assert := assert.New(t) - require := require.New(t) - - c, err := New(Auth{Username: "random-user", Apikey: "my-pass"}) - require.Nil(err) - - r, err := c.newRequest("GET", "/hello", nil, nil) - - require.Nil(err) - assert.Equal("GET", r.Method) - assert.Equal("https://www.statuscake.com/API/hello", r.URL.String()) - assert.Equal("random-user", r.Header.Get("Username")) - assert.Equal("my-pass", r.Header.Get("API")) -} - -func TestClient_doRequest(t *testing.T) { - assert := assert.New(t) - require := require.New(t) - - c, err := New(Auth{Username: "random-user", Apikey: "my-pass"}) - require.Nil(err) - - hc := &fakeHTTPClient{StatusCode: 200} - c.c = hc - - req, err := http.NewRequest("GET", "http://example.com/test", nil) - require.Nil(err) - - _, err = c.doRequest(req) - require.Nil(err) - - assert.Len(hc.requests, 1) - assert.Equal("http://example.com/test", hc.requests[0].URL.String()) -} - -func TestClient_doRequest_WithHTTPErrors(t *testing.T) { - assert := assert.New(t) - require := require.New(t) - - c, err := New(Auth{Username: "random-user", Apikey: "my-pass"}) - require.Nil(err) - - hc := &fakeHTTPClient{ - StatusCode: 500, - } - c.c = hc - - req, err := http.NewRequest("GET", "http://example.com/test", nil) - require.Nil(err) - - _, err = c.doRequest(req) - require.NotNil(err) - assert.IsType(&httpError{}, err) -} - -func TestClient_doRequest_HttpAuthenticationErrors(t *testing.T) { - assert := assert.New(t) - require := require.New(t) - - c, err := New(Auth{Username: "random-user", Apikey: "my-pass"}) - require.Nil(err) - - hc := &fakeHTTPClient{ - StatusCode: 200, - Fixture: "auth_error.json", - } - c.c = hc - - req, err := http.NewRequest("GET", "http://example.com/test", nil) - require.Nil(err) - - _, err = c.doRequest(req) - require.NotNil(err) - assert.IsType(&AuthenticationError{}, err) -} - -func TestClient_get(t *testing.T) { - require := require.New(t) - assert := assert.New(t) - - c, err := New(Auth{Username: "random-user", Apikey: "my-pass"}) - require.Nil(err) - - hc := &fakeHTTPClient{} - c.c = hc - - c.get("/hello", nil) - assert.Len(hc.requests, 1) - assert.Equal("GET", hc.requests[0].Method) - assert.Equal("https://www.statuscake.com/API/hello", hc.requests[0].URL.String()) -} - -func TestClient_put(t *testing.T) { - require := require.New(t) - assert := assert.New(t) - - c, err := New(Auth{Username: "random-user", Apikey: "my-pass"}) - require.Nil(err) - - hc := &fakeHTTPClient{} - c.c = hc - - v := url.Values{"foo": {"bar"}} - c.put("/hello", v) - assert.Len(hc.requests, 1) - assert.Equal("PUT", hc.requests[0].Method) - assert.Equal("https://www.statuscake.com/API/hello", hc.requests[0].URL.String()) - - b, err := ioutil.ReadAll(hc.requests[0].Body) - require.Nil(err) - assert.Equal("foo=bar", string(b)) -} - -func TestClient_delete(t *testing.T) { - require := require.New(t) - assert := assert.New(t) - - c, err := New(Auth{Username: "random-user", Apikey: "my-pass"}) - require.Nil(err) - - hc := &fakeHTTPClient{} - c.c = hc - - v := url.Values{"foo": {"bar"}} - c.delete("/hello", v) - assert.Len(hc.requests, 1) - assert.Equal("DELETE", hc.requests[0].Method) - assert.Equal("https://www.statuscake.com/API/hello?foo=bar", hc.requests[0].URL.String()) -} - -func TestClient_Tests(t *testing.T) { - require := require.New(t) - assert := assert.New(t) - - c, err := New(Auth{Username: "random-user", Apikey: "my-pass"}) - require.Nil(err) - - expected := &tests{ - client: c, - } - - assert.Equal(expected, c.Tests()) -} - -type fakeBody struct { - io.Reader -} - -func (f *fakeBody) Close() error { - return nil -} - -type fakeHTTPClient struct { - StatusCode int - Fixture string - requests []*http.Request -} - -func (c *fakeHTTPClient) Do(r *http.Request) (*http.Response, error) { - c.requests = append(c.requests, r) - var body []byte - - if c.Fixture != "" { - p := filepath.Join("fixtures", c.Fixture) - f, err := os.Open(p) - if err != nil { - log.Fatal(err) - } - defer f.Close() - - b, err := ioutil.ReadAll(f) - if err != nil { - log.Fatal(err) - } - - body = b - } - - resp := &http.Response{ - StatusCode: c.StatusCode, - Body: &fakeBody{Reader: bytes.NewReader(body)}, - } - - return resp, nil -} diff --git a/vendor/github.com/DreamItGetIT/statuscake/tests_test.go b/vendor/github.com/DreamItGetIT/statuscake/tests_test.go deleted file mode 100644 index b7147e2c2b..0000000000 --- a/vendor/github.com/DreamItGetIT/statuscake/tests_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package statuscake - -import ( - "log" - "net/http" - "net/url" - "os" - "path/filepath" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestTest_Validate(t *testing.T) { - assert := assert.New(t) - require := require.New(t) - - test := &Test{ - Timeout: 200, - Confirmation: 100, - Public: 200, - Virus: 200, - TestType: "FTP", - RealBrowser: 100, - TriggerRate: 100, - CheckRate: 100000, - WebsiteName: "", - WebsiteURL: "", - } - - err := test.Validate() - require.NotNil(err) - - message := err.Error() - assert.Contains(message, "WebsiteName is required") - assert.Contains(message, "WebsiteURL is required") - assert.Contains(message, "Timeout must be 0 or between 6 and 99") - assert.Contains(message, "Confirmation must be between 0 and 9") - assert.Contains(message, "CheckRate must be between 0 and 23999") - assert.Contains(message, "Public must be 0 or 1") - assert.Contains(message, "Virus must be 0 or 1") - assert.Contains(message, "TestType must be HTTP, TCP, or PING") - assert.Contains(message, "RealBrowser must be 0 or 1") - assert.Contains(message, "TriggerRate must be between 0 and 59") - - test.Timeout = 10 - test.Confirmation = 2 - test.Public = 1 - test.Virus = 1 - test.TestType = "HTTP" - test.RealBrowser = 1 - test.TriggerRate = 50 - test.CheckRate = 10 - test.WebsiteName = "Foo" - test.WebsiteURL = "http://example.com" - - err = test.Validate() - assert.Nil(err) -} - -func TestTest_ToURLValues(t *testing.T) { - assert := assert.New(t) - - test := &Test{ - TestID: 123, - Paused: true, - WebsiteName: "Foo Bar", - WebsiteURL: "http://example.com", - Port: 3000, - NodeLocations: []string{"foo", "bar"}, - Timeout: 11, - PingURL: "http://example.com/ping", - Confirmation: 1, - CheckRate: 500, - BasicUser: "myuser", - BasicPass: "mypass", - Public: 1, - LogoImage: "http://example.com/logo.jpg", - Branding: 1, - Virus: 1, - FindString: "hello", - DoNotFind: true, - TestType: "HTTP", - RealBrowser: 1, - TriggerRate: 50, - TestTags: "tag1,tag2", - StatusCodes: "500", - } - - expected := url.Values{ - "TestID": {"123"}, - "Paused": {"1"}, - "WebsiteName": {"Foo Bar"}, - "WebsiteURL": {"http://example.com"}, - "Port": {"3000"}, - "NodeLocations": {"foo,bar"}, - "Timeout": {"11"}, - "PingURL": {"http://example.com/ping"}, - "Confirmation": {"1"}, - "CheckRate": {"500"}, - "BasicUser": {"myuser"}, - "BasicPass": {"mypass"}, - "Public": {"1"}, - "LogoImage": {"http://example.com/logo.jpg"}, - "Branding": {"1"}, - "Virus": {"1"}, - "FindString": {"hello"}, - "DoNotFind": {"1"}, - "TestType": {"HTTP"}, - "RealBrowser": {"1"}, - "TriggerRate": {"50"}, - "TestTags": {"tag1,tag2"}, - "StatusCodes": {"500"}, - } - - assert.Equal(expected, test.ToURLValues()) - - test.TestID = 0 - delete(expected, "TestID") - - assert.Equal(expected.Encode(), test.ToURLValues().Encode()) -} - -func TestTests_All(t *testing.T) { - assert := assert.New(t) - require := require.New(t) - - c := &fakeAPIClient{ - fixture: "tests_all_ok.json", - } - tt := newTests(c) - tests, err := tt.All() - require.Nil(err) - - assert.Equal("/Tests", c.sentRequestPath) - assert.Equal("GET", c.sentRequestMethod) - assert.Nil(c.sentRequestValues) - assert.Len(tests, 2) - - expectedTest := &Test{ - TestID: 100, - Paused: false, - TestType: "HTTP", - WebsiteName: "www 1", - ContactID: 1, - Status: "Up", - Uptime: 100, - } - assert.Equal(expectedTest, tests[0]) - - expectedTest = &Test{ - TestID: 101, - Paused: true, - TestType: "HTTP", - WebsiteName: "www 2", - ContactID: 2, - Status: "Down", - Uptime: 0, - } - assert.Equal(expectedTest, tests[1]) -} - -func TestTests_Update_OK(t *testing.T) { - assert := assert.New(t) - require := require.New(t) - - c := &fakeAPIClient{ - fixture: "tests_update_ok.json", - } - tt := newTests(c) - - test1 := &Test{ - WebsiteName: "foo", - } - - test2, err := tt.Update(test1) - require.Nil(err) - - assert.Equal("/Tests/Update", c.sentRequestPath) - assert.Equal("PUT", c.sentRequestMethod) - assert.NotNil(c.sentRequestValues) - assert.NotNil(test2) - - assert.Equal(1234, test2.TestID) -} - -func TestTests_Update_Error(t *testing.T) { - assert := assert.New(t) - require := require.New(t) - - c := &fakeAPIClient{ - fixture: "tests_update_error.json", - } - tt := newTests(c) - - test1 := &Test{ - WebsiteName: "foo", - } - - test2, err := tt.Update(test1) - assert.Nil(test2) - - require.NotNil(err) - assert.IsType(&updateError{}, err) - assert.Contains(err.Error(), "issue a") -} - -func TestTests_Update_ErrorWithSliceOfIssues(t *testing.T) { - assert := assert.New(t) - require := require.New(t) - - c := &fakeAPIClient{ - fixture: "tests_update_error_slice_of_issues.json", - } - tt := newTests(c) - - test1 := &Test{ - WebsiteName: "foo", - } - - test2, err := tt.Update(test1) - assert.Nil(test2) - - require.NotNil(err) - assert.IsType(&updateError{}, err) - assert.Equal("hello, world", err.Error()) -} - -func TestTests_Delete_OK(t *testing.T) { - assert := assert.New(t) - require := require.New(t) - - c := &fakeAPIClient{ - fixture: "tests_delete_ok.json", - } - tt := newTests(c) - - err := tt.Delete(1234) - require.Nil(err) - - assert.Equal("/Tests/Details", c.sentRequestPath) - assert.Equal("DELETE", c.sentRequestMethod) - assert.Equal(url.Values{"TestID": {"1234"}}, c.sentRequestValues) -} - -func TestTests_Delete_Error(t *testing.T) { - assert := assert.New(t) - require := require.New(t) - - c := &fakeAPIClient{ - fixture: "tests_delete_error.json", - } - tt := newTests(c) - - err := tt.Delete(1234) - require.NotNil(err) - assert.Equal("this is an error", err.Error()) -} - -func TestTests_Detail_OK(t *testing.T) { - assert := assert.New(t) - require := require.New(t) - - c := &fakeAPIClient{ - fixture: "tests_detail_ok.json", - } - tt := newTests(c) - - test, err := tt.Detail(1234) - require.Nil(err) - - assert.Equal("/Tests/Details", c.sentRequestPath) - assert.Equal("GET", c.sentRequestMethod) - assert.Equal(url.Values{"TestID": {"1234"}}, c.sentRequestValues) - - assert.Equal(test.TestID, 6735) - assert.Equal(test.TestType, "HTTP") - assert.Equal(test.Paused, false) - assert.Equal(test.WebsiteName, "NL") - assert.Equal(test.ContactID, 536) - assert.Equal(test.Status, "Up") - assert.Equal(test.Uptime, 0.0) - assert.Equal(test.CheckRate, 60) - assert.Equal(test.Timeout, 40) - assert.Equal(test.LogoImage, "") - assert.Equal(test.WebsiteHost, "Various") - assert.Equal(test.FindString, "") - assert.Equal(test.DoNotFind, false) -} - -type fakeAPIClient struct { - sentRequestPath string - sentRequestMethod string - sentRequestValues url.Values - fixture string -} - -func (c *fakeAPIClient) put(path string, v url.Values) (*http.Response, error) { - return c.all("PUT", path, v) -} - -func (c *fakeAPIClient) delete(path string, v url.Values) (*http.Response, error) { - return c.all("DELETE", path, v) -} - -func (c *fakeAPIClient) get(path string, v url.Values) (*http.Response, error) { - return c.all("GET", path, v) -} - -func (c *fakeAPIClient) all(method string, path string, v url.Values) (*http.Response, error) { - c.sentRequestMethod = method - c.sentRequestPath = path - c.sentRequestValues = v - - p := filepath.Join("fixtures", c.fixture) - f, err := os.Open(p) - if err != nil { - log.Fatal(err) - } - - resp := &http.Response{ - Body: f, - } - - return resp, nil -} diff --git a/vendor/github.com/apparentlymart/go-cidr/LICENSE b/vendor/github.com/apparentlymart/go-cidr/LICENSE new file mode 100644 index 0000000000..2125378860 --- /dev/null +++ b/vendor/github.com/apparentlymart/go-cidr/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Martin Atkins + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/apparentlymart/go-cidr/cidr/cidr_test.go b/vendor/github.com/apparentlymart/go-cidr/cidr/cidr_test.go deleted file mode 100644 index f4095b4a0d..0000000000 --- a/vendor/github.com/apparentlymart/go-cidr/cidr/cidr_test.go +++ /dev/null @@ -1,238 +0,0 @@ -package cidr - -import ( - "fmt" - "net" - "testing" -) - -func TestSubnet(t *testing.T) { - type Case struct { - Base string - Bits int - Num int - Output string - Error bool - } - - cases := []Case{ - Case{ - Base: "192.168.2.0/20", - Bits: 4, - Num: 6, - Output: "192.168.6.0/24", - }, - Case{ - Base: "192.168.2.0/20", - Bits: 4, - Num: 0, - Output: "192.168.0.0/24", - }, - Case{ - Base: "192.168.0.0/31", - Bits: 1, - Num: 1, - Output: "192.168.0.1/32", - }, - Case{ - Base: "192.168.0.0/21", - Bits: 4, - Num: 7, - Output: "192.168.3.128/25", - }, - Case{ - Base: "fe80::/48", - Bits: 16, - Num: 6, - Output: "fe80:0:0:6::/64", - }, - Case{ - Base: "fe80::/49", - Bits: 16, - Num: 7, - Output: "fe80:0:0:3:8000::/65", - }, - Case{ - Base: "192.168.2.0/31", - Bits: 2, - Num: 0, - Error: true, // not enough bits to expand into - }, - Case{ - Base: "fe80::/126", - Bits: 4, - Num: 0, - Error: true, // not enough bits to expand into - }, - Case{ - Base: "192.168.2.0/24", - Bits: 4, - Num: 16, - Error: true, // can't fit 16 into 4 bits - }, - } - - for _, testCase := range cases { - _, base, _ := net.ParseCIDR(testCase.Base) - gotNet, err := Subnet(base, testCase.Bits, testCase.Num) - desc := fmt.Sprintf("Subnet(%#v,%#v,%#v)", testCase.Base, testCase.Bits, testCase.Num) - if err != nil { - if !testCase.Error { - t.Errorf("%s failed: %s", desc, err.Error()) - } - } else { - got := gotNet.String() - if testCase.Error { - t.Errorf("%s = %s; want error", desc, got) - } else { - if got != testCase.Output { - t.Errorf("%s = %s; want %s", desc, got, testCase.Output) - } - } - } - } -} - -func TestHost(t *testing.T) { - type Case struct { - Range string - Num int - Output string - Error bool - } - - cases := []Case{ - Case{ - Range: "192.168.2.0/20", - Num: 6, - Output: "192.168.0.6", - }, - Case{ - Range: "192.168.0.0/20", - Num: 257, - Output: "192.168.1.1", - }, - Case{ - Range: "192.168.1.0/24", - Num: 256, - Error: true, // only 0-255 will fit in 8 bits - }, - } - - for _, testCase := range cases { - _, network, _ := net.ParseCIDR(testCase.Range) - gotIP, err := Host(network, testCase.Num) - desc := fmt.Sprintf("Host(%#v,%#v)", testCase.Range, testCase.Num) - if err != nil { - if !testCase.Error { - t.Errorf("%s failed: %s", desc, err.Error()) - } - } else { - got := gotIP.String() - if testCase.Error { - t.Errorf("%s = %s; want error", desc, got) - } else { - if got != testCase.Output { - t.Errorf("%s = %s; want %s", desc, got, testCase.Output) - } - } - } - } -} - -func TestAddressRange(t *testing.T) { - type Case struct { - Range string - First string - Last string - } - - cases := []Case{ - Case{ - Range: "192.168.0.0/16", - First: "192.168.0.0", - Last: "192.168.255.255", - }, - Case{ - Range: "192.168.0.0/17", - First: "192.168.0.0", - Last: "192.168.127.255", - }, - Case{ - Range: "fe80::/64", - First: "fe80::", - Last: "fe80::ffff:ffff:ffff:ffff", - }, - } - - for _, testCase := range cases { - _, network, _ := net.ParseCIDR(testCase.Range) - firstIP, lastIP := AddressRange(network) - desc := fmt.Sprintf("AddressRange(%#v)", testCase.Range) - gotFirstIP := firstIP.String() - gotLastIP := lastIP.String() - if gotFirstIP != testCase.First { - t.Errorf("%s first is %s; want %s", desc, gotFirstIP, testCase.First) - } - if gotLastIP != testCase.Last { - t.Errorf("%s last is %s; want %s", desc, gotLastIP, testCase.Last) - } - } - -} - -func TestAddressCount(t *testing.T) { - type Case struct { - Range string - Count uint64 - } - - cases := []Case{ - Case{ - Range: "192.168.0.0/16", - Count: 65536, - }, - Case{ - Range: "192.168.0.0/17", - Count: 32768, - }, - Case{ - Range: "192.168.0.0/32", - Count: 1, - }, - Case{ - Range: "192.168.0.0/31", - Count: 2, - }, - Case{ - Range: "0.0.0.0/0", - Count: 4294967296, - }, - Case{ - Range: "0.0.0.0/1", - Count: 2147483648, - }, - Case{ - Range: "::/65", - Count: 9223372036854775808, - }, - Case{ - Range: "::/128", - Count: 1, - }, - Case{ - Range: "::/127", - Count: 2, - }, - } - - for _, testCase := range cases { - _, network, _ := net.ParseCIDR(testCase.Range) - gotCount := AddressCount(network) - desc := fmt.Sprintf("AddressCount(%#v)", testCase.Range) - if gotCount != testCase.Count { - t.Errorf("%s = %d; want %d", desc, gotCount, testCase.Count) - } - } - -} diff --git a/vendor/github.com/apparentlymart/go-rundeck-api/LICENSE b/vendor/github.com/apparentlymart/go-rundeck-api/LICENSE new file mode 100644 index 0000000000..35687787ed --- /dev/null +++ b/vendor/github.com/apparentlymart/go-rundeck-api/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Martin Atkins + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/apparentlymart/go-rundeck-api/rundeck/job_test.go b/vendor/github.com/apparentlymart/go-rundeck-api/rundeck/job_test.go deleted file mode 100644 index 3229a689d8..0000000000 --- a/vendor/github.com/apparentlymart/go-rundeck-api/rundeck/job_test.go +++ /dev/null @@ -1,113 +0,0 @@ -package rundeck - -import ( - "fmt" - "testing" -) - -func TestUnmarshalJobDetail(t *testing.T) { - testUnmarshalXML(t, []unmarshalTest{ - unmarshalTest{ - "with-config", - `bazascending`, - &JobDetail{}, - func (rv interface {}) error { - v := rv.(*JobDetail) - if v.ID != "baz" { - return fmt.Errorf("got ID %s, but expecting baz", v.ID) - } - if v.Dispatch.RankOrder != "ascending" { - return fmt.Errorf("Dispatch.RankOrder = \"%v\", but expecting \"ascending\"", v.Dispatch.RankOrder) - } - return nil - }, - }, - unmarshalTest{ - "with-empty-config", - ``, - &JobPlugin{}, - func (rv interface {}) error { - v := rv.(*JobPlugin) - if v.Type != "foo-plugin" { - return fmt.Errorf("got Type %s, but expecting foo-plugin", v.Type) - } - if len(v.Config) != 0 { - return fmt.Errorf("got %i Config values, but expecting 0", len(v.Config)) - } - return nil - }, - }, - }) -} - -func TestMarshalJobPlugin(t *testing.T) { - testMarshalXML(t, []marshalTest{ - marshalTest{ - "with-config", - JobPlugin{ - Type: "foo-plugin", - Config: map[string]string{ - "woo": "foo", - "bar": "baz", - }, - }, - ``, - }, - marshalTest{ - "with-empty-config", - JobPlugin{ - Type: "foo-plugin", - Config: map[string]string{}, - }, - ``, - }, - marshalTest{ - "with-zero-value-config", - JobPlugin{ - Type: "foo-plugin", - }, - ``, - }, - }) -} - -func TestUnmarshalJobPlugin(t *testing.T) { - testUnmarshalXML(t, []unmarshalTest{ - unmarshalTest{ - "with-config", - ``, - &JobPlugin{}, - func (rv interface {}) error { - v := rv.(*JobPlugin) - if v.Type != "foo-plugin" { - return fmt.Errorf("got Type %s, but expecting foo-plugin", v.Type) - } - if len(v.Config) != 2 { - return fmt.Errorf("got %v Config values, but expecting 2", len(v.Config)) - } - if v.Config["woo"] != "foo" { - return fmt.Errorf("Config[\"woo\"] = \"%s\", but expecting \"foo\"", v.Config["woo"]) - } - if v.Config["bar"] != "baz" { - return fmt.Errorf("Config[\"bar\"] = \"%s\", but expecting \"baz\"", v.Config["bar"]) - } - return nil - }, - }, - unmarshalTest{ - "with-empty-config", - ``, - &JobPlugin{}, - func (rv interface {}) error { - v := rv.(*JobPlugin) - if v.Type != "foo-plugin" { - return fmt.Errorf("got Type %s, but expecting foo-plugin", v.Type) - } - if len(v.Config) != 0 { - return fmt.Errorf("got %i Config values, but expecting 0", len(v.Config)) - } - return nil - }, - }, - }) -} diff --git a/vendor/github.com/armon/circbuf/circbuf_test.go b/vendor/github.com/armon/circbuf/circbuf_test.go deleted file mode 100644 index a3ed64269c..0000000000 --- a/vendor/github.com/armon/circbuf/circbuf_test.go +++ /dev/null @@ -1,198 +0,0 @@ -package circbuf - -import ( - "bytes" - "io" - "testing" -) - -func TestBuffer_Impl(t *testing.T) { - var _ io.Writer = &Buffer{} -} - -func TestBuffer_ShortWrite(t *testing.T) { - buf, err := NewBuffer(1024) - if err != nil { - t.Fatalf("err: %v", err) - } - - inp := []byte("hello world") - - n, err := buf.Write(inp) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != len(inp) { - t.Fatalf("bad: %v", n) - } - - if !bytes.Equal(buf.Bytes(), inp) { - t.Fatalf("bad: %v", buf.Bytes()) - } -} - -func TestBuffer_FullWrite(t *testing.T) { - inp := []byte("hello world") - - buf, err := NewBuffer(int64(len(inp))) - if err != nil { - t.Fatalf("err: %v", err) - } - - n, err := buf.Write(inp) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != len(inp) { - t.Fatalf("bad: %v", n) - } - - if !bytes.Equal(buf.Bytes(), inp) { - t.Fatalf("bad: %v", buf.Bytes()) - } -} - -func TestBuffer_LongWrite(t *testing.T) { - inp := []byte("hello world") - - buf, err := NewBuffer(6) - if err != nil { - t.Fatalf("err: %v", err) - } - - n, err := buf.Write(inp) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != len(inp) { - t.Fatalf("bad: %v", n) - } - - expect := []byte(" world") - if !bytes.Equal(buf.Bytes(), expect) { - t.Fatalf("bad: %s", buf.Bytes()) - } -} - -func TestBuffer_HugeWrite(t *testing.T) { - inp := []byte("hello world") - - buf, err := NewBuffer(3) - if err != nil { - t.Fatalf("err: %v", err) - } - - n, err := buf.Write(inp) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != len(inp) { - t.Fatalf("bad: %v", n) - } - - expect := []byte("rld") - if !bytes.Equal(buf.Bytes(), expect) { - t.Fatalf("bad: %s", buf.Bytes()) - } -} - -func TestBuffer_ManySmall(t *testing.T) { - inp := []byte("hello world") - - buf, err := NewBuffer(3) - if err != nil { - t.Fatalf("err: %v", err) - } - - for _, b := range inp { - n, err := buf.Write([]byte{b}) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != 1 { - t.Fatalf("bad: %v", n) - } - } - - expect := []byte("rld") - if !bytes.Equal(buf.Bytes(), expect) { - t.Fatalf("bad: %v", buf.Bytes()) - } -} - -func TestBuffer_MultiPart(t *testing.T) { - inputs := [][]byte{ - []byte("hello world\n"), - []byte("this is a test\n"), - []byte("my cool input\n"), - } - total := 0 - - buf, err := NewBuffer(16) - if err != nil { - t.Fatalf("err: %v", err) - } - - for _, b := range inputs { - total += len(b) - n, err := buf.Write(b) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != len(b) { - t.Fatalf("bad: %v", n) - } - } - - if int64(total) != buf.TotalWritten() { - t.Fatalf("bad total") - } - - expect := []byte("t\nmy cool input\n") - if !bytes.Equal(buf.Bytes(), expect) { - t.Fatalf("bad: %v", buf.Bytes()) - } -} - -func TestBuffer_Reset(t *testing.T) { - // Write a bunch of data - inputs := [][]byte{ - []byte("hello world\n"), - []byte("this is a test\n"), - []byte("my cool input\n"), - } - - buf, err := NewBuffer(4) - if err != nil { - t.Fatalf("err: %v", err) - } - - for _, b := range inputs { - n, err := buf.Write(b) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != len(b) { - t.Fatalf("bad: %v", n) - } - } - - // Reset it - buf.Reset() - - // Write more data - input := []byte("hello") - n, err := buf.Write(input) - if err != nil { - t.Fatalf("err: %s", err) - } - if n != len(input) { - t.Fatalf("bad: %v", n) - } - - // Test the output - expect := []byte("ello") - if !bytes.Equal(buf.Bytes(), expect) { - t.Fatalf("bad: %v", string(buf.Bytes())) - } -} diff --git a/vendor/github.com/armon/go-radix/radix_test.go b/vendor/github.com/armon/go-radix/radix_test.go deleted file mode 100644 index 300f0d4759..0000000000 --- a/vendor/github.com/armon/go-radix/radix_test.go +++ /dev/null @@ -1,319 +0,0 @@ -package radix - -import ( - crand "crypto/rand" - "fmt" - "reflect" - "sort" - "testing" -) - -func TestRadix(t *testing.T) { - var min, max string - inp := make(map[string]interface{}) - for i := 0; i < 1000; i++ { - gen := generateUUID() - inp[gen] = i - if gen < min || i == 0 { - min = gen - } - if gen > max || i == 0 { - max = gen - } - } - - r := NewFromMap(inp) - if r.Len() != len(inp) { - t.Fatalf("bad length: %v %v", r.Len(), len(inp)) - } - - r.Walk(func(k string, v interface{}) bool { - println(k) - return false - }) - - for k, v := range inp { - out, ok := r.Get(k) - if !ok { - t.Fatalf("missing key: %v", k) - } - if out != v { - t.Fatalf("value mis-match: %v %v", out, v) - } - } - - // Check min and max - outMin, _, _ := r.Minimum() - if outMin != min { - t.Fatalf("bad minimum: %v %v", outMin, min) - } - outMax, _, _ := r.Maximum() - if outMax != max { - t.Fatalf("bad maximum: %v %v", outMax, max) - } - - for k, v := range inp { - out, ok := r.Delete(k) - if !ok { - t.Fatalf("missing key: %v", k) - } - if out != v { - t.Fatalf("value mis-match: %v %v", out, v) - } - } - if r.Len() != 0 { - t.Fatalf("bad length: %v", r.Len()) - } -} - -func TestRoot(t *testing.T) { - r := New() - _, ok := r.Delete("") - if ok { - t.Fatalf("bad") - } - _, ok = r.Insert("", true) - if ok { - t.Fatalf("bad") - } - val, ok := r.Get("") - if !ok || val != true { - t.Fatalf("bad: %v", val) - } - val, ok = r.Delete("") - if !ok || val != true { - t.Fatalf("bad: %v", val) - } -} - -func TestDelete(t *testing.T) { - - r := New() - - s := []string{"", "A", "AB"} - - for _, ss := range s { - r.Insert(ss, true) - } - - for _, ss := range s { - _, ok := r.Delete(ss) - if !ok { - t.Fatalf("bad %q", ss) - } - } -} - -func TestLongestPrefix(t *testing.T) { - r := New() - - keys := []string{ - "", - "foo", - "foobar", - "foobarbaz", - "foobarbazzip", - "foozip", - } - for _, k := range keys { - r.Insert(k, nil) - } - if r.Len() != len(keys) { - t.Fatalf("bad len: %v %v", r.Len(), len(keys)) - } - - type exp struct { - inp string - out string - } - cases := []exp{ - {"a", ""}, - {"abc", ""}, - {"fo", ""}, - {"foo", "foo"}, - {"foob", "foo"}, - {"foobar", "foobar"}, - {"foobarba", "foobar"}, - {"foobarbaz", "foobarbaz"}, - {"foobarbazzi", "foobarbaz"}, - {"foobarbazzip", "foobarbazzip"}, - {"foozi", "foo"}, - {"foozip", "foozip"}, - {"foozipzap", "foozip"}, - } - for _, test := range cases { - m, _, ok := r.LongestPrefix(test.inp) - if !ok { - t.Fatalf("no match: %v", test) - } - if m != test.out { - t.Fatalf("mis-match: %v %v", m, test) - } - } -} - -func TestWalkPrefix(t *testing.T) { - r := New() - - keys := []string{ - "foobar", - "foo/bar/baz", - "foo/baz/bar", - "foo/zip/zap", - "zipzap", - } - for _, k := range keys { - r.Insert(k, nil) - } - if r.Len() != len(keys) { - t.Fatalf("bad len: %v %v", r.Len(), len(keys)) - } - - type exp struct { - inp string - out []string - } - cases := []exp{ - { - "f", - []string{"foobar", "foo/bar/baz", "foo/baz/bar", "foo/zip/zap"}, - }, - { - "foo", - []string{"foobar", "foo/bar/baz", "foo/baz/bar", "foo/zip/zap"}, - }, - { - "foob", - []string{"foobar"}, - }, - { - "foo/", - []string{"foo/bar/baz", "foo/baz/bar", "foo/zip/zap"}, - }, - { - "foo/b", - []string{"foo/bar/baz", "foo/baz/bar"}, - }, - { - "foo/ba", - []string{"foo/bar/baz", "foo/baz/bar"}, - }, - { - "foo/bar", - []string{"foo/bar/baz"}, - }, - { - "foo/bar/baz", - []string{"foo/bar/baz"}, - }, - { - "foo/bar/bazoo", - []string{}, - }, - { - "z", - []string{"zipzap"}, - }, - } - - for _, test := range cases { - out := []string{} - fn := func(s string, v interface{}) bool { - out = append(out, s) - return false - } - r.WalkPrefix(test.inp, fn) - sort.Strings(out) - sort.Strings(test.out) - if !reflect.DeepEqual(out, test.out) { - t.Fatalf("mis-match: %v %v", out, test.out) - } - } -} - -func TestWalkPath(t *testing.T) { - r := New() - - keys := []string{ - "foo", - "foo/bar", - "foo/bar/baz", - "foo/baz/bar", - "foo/zip/zap", - "zipzap", - } - for _, k := range keys { - r.Insert(k, nil) - } - if r.Len() != len(keys) { - t.Fatalf("bad len: %v %v", r.Len(), len(keys)) - } - - type exp struct { - inp string - out []string - } - cases := []exp{ - { - "f", - []string{}, - }, - { - "foo", - []string{"foo"}, - }, - { - "foo/", - []string{"foo"}, - }, - { - "foo/ba", - []string{"foo"}, - }, - { - "foo/bar", - []string{"foo", "foo/bar"}, - }, - { - "foo/bar/baz", - []string{"foo", "foo/bar", "foo/bar/baz"}, - }, - { - "foo/bar/bazoo", - []string{"foo", "foo/bar", "foo/bar/baz"}, - }, - { - "z", - []string{}, - }, - } - - for _, test := range cases { - out := []string{} - fn := func(s string, v interface{}) bool { - out = append(out, s) - return false - } - r.WalkPath(test.inp, fn) - sort.Strings(out) - sort.Strings(test.out) - if !reflect.DeepEqual(out, test.out) { - t.Fatalf("mis-match: %v %v", out, test.out) - } - } -} - -// generateUUID is used to generate a random UUID -func generateUUID() string { - buf := make([]byte, 16) - if _, err := crand.Read(buf); err != nil { - panic(fmt.Errorf("failed to read random bytes: %v", err)) - } - - return fmt.Sprintf("%08x-%04x-%04x-%04x-%12x", - buf[0:4], - buf[4:6], - buf[6:8], - buf[8:10], - buf[10:16]) -} diff --git a/vendor/github.com/aws/aws-sdk-go/LICENSE.txt b/vendor/github.com/aws/aws-sdk-go/LICENSE.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/aws/aws-sdk-go/NOTICE.txt b/vendor/github.com/aws/aws-sdk-go/NOTICE.txt new file mode 100644 index 0000000000..5f14d1162e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/NOTICE.txt @@ -0,0 +1,3 @@ +AWS SDK for Go +Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. +Copyright 2014-2015 Stripe, Inc. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go deleted file mode 100644 index 84b7e3f34a..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go +++ /dev/null @@ -1,233 +0,0 @@ -package awsutil_test - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "testing" - - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/stretchr/testify/assert" -) - -func ExampleCopy() { - type Foo struct { - A int - B []*string - } - - // Create the initial value - str1 := "hello" - str2 := "bye bye" - f1 := &Foo{A: 1, B: []*string{&str1, &str2}} - - // Do the copy - var f2 Foo - awsutil.Copy(&f2, f1) - - // Print the result - fmt.Println(awsutil.Prettify(f2)) - - // Output: - // { - // A: 1, - // B: ["hello","bye bye"] - // } -} - -func TestCopy(t *testing.T) { - type Foo struct { - A int - B []*string - C map[string]*int - } - - // Create the initial value - str1 := "hello" - str2 := "bye bye" - int1 := 1 - int2 := 2 - f1 := &Foo{ - A: 1, - B: []*string{&str1, &str2}, - C: map[string]*int{ - "A": &int1, - "B": &int2, - }, - } - - // Do the copy - var f2 Foo - awsutil.Copy(&f2, f1) - - // Values are equal - assert.Equal(t, f2.A, f1.A) - assert.Equal(t, f2.B, f1.B) - assert.Equal(t, f2.C, f1.C) - - // But pointers are not! - str3 := "nothello" - int3 := 57 - f2.A = 100 - f2.B[0] = &str3 - f2.C["B"] = &int3 - assert.NotEqual(t, f2.A, f1.A) - assert.NotEqual(t, f2.B, f1.B) - assert.NotEqual(t, f2.C, f1.C) -} - -func TestCopyNestedWithUnexported(t *testing.T) { - type Bar struct { - a int - B int - } - type Foo struct { - A string - B Bar - } - - f1 := &Foo{A: "string", B: Bar{a: 1, B: 2}} - - var f2 Foo - awsutil.Copy(&f2, f1) - - // Values match - assert.Equal(t, f2.A, f1.A) - assert.NotEqual(t, f2.B, f1.B) - assert.NotEqual(t, f2.B.a, f1.B.a) - assert.Equal(t, f2.B.B, f2.B.B) -} - -func TestCopyIgnoreNilMembers(t *testing.T) { - type Foo struct { - A *string - B []string - C map[string]string - } - - f := &Foo{} - assert.Nil(t, f.A) - assert.Nil(t, f.B) - assert.Nil(t, f.C) - - var f2 Foo - awsutil.Copy(&f2, f) - assert.Nil(t, f2.A) - assert.Nil(t, f2.B) - assert.Nil(t, f2.C) - - fcopy := awsutil.CopyOf(f) - f3 := fcopy.(*Foo) - assert.Nil(t, f3.A) - assert.Nil(t, f3.B) - assert.Nil(t, f3.C) -} - -func TestCopyPrimitive(t *testing.T) { - str := "hello" - var s string - awsutil.Copy(&s, &str) - assert.Equal(t, "hello", s) -} - -func TestCopyNil(t *testing.T) { - var s string - awsutil.Copy(&s, nil) - assert.Equal(t, "", s) -} - -func TestCopyReader(t *testing.T) { - var buf io.Reader = bytes.NewReader([]byte("hello world")) - var r io.Reader - awsutil.Copy(&r, buf) - b, err := ioutil.ReadAll(r) - assert.NoError(t, err) - assert.Equal(t, []byte("hello world"), b) - - // empty bytes because this is not a deep copy - b, err = ioutil.ReadAll(buf) - assert.NoError(t, err) - assert.Equal(t, []byte(""), b) -} - -func TestCopyDifferentStructs(t *testing.T) { - type SrcFoo struct { - A int - B []*string - C map[string]*int - SrcUnique string - SameNameDiffType int - unexportedPtr *int - ExportedPtr *int - } - type DstFoo struct { - A int - B []*string - C map[string]*int - DstUnique int - SameNameDiffType string - unexportedPtr *int - ExportedPtr *int - } - - // Create the initial value - str1 := "hello" - str2 := "bye bye" - int1 := 1 - int2 := 2 - f1 := &SrcFoo{ - A: 1, - B: []*string{&str1, &str2}, - C: map[string]*int{ - "A": &int1, - "B": &int2, - }, - SrcUnique: "unique", - SameNameDiffType: 1, - unexportedPtr: &int1, - ExportedPtr: &int2, - } - - // Do the copy - var f2 DstFoo - awsutil.Copy(&f2, f1) - - // Values are equal - assert.Equal(t, f2.A, f1.A) - assert.Equal(t, f2.B, f1.B) - assert.Equal(t, f2.C, f1.C) - assert.Equal(t, "unique", f1.SrcUnique) - assert.Equal(t, 1, f1.SameNameDiffType) - assert.Equal(t, 0, f2.DstUnique) - assert.Equal(t, "", f2.SameNameDiffType) - assert.Equal(t, int1, *f1.unexportedPtr) - assert.Nil(t, f2.unexportedPtr) - assert.Equal(t, int2, *f1.ExportedPtr) - assert.Equal(t, int2, *f2.ExportedPtr) -} - -func ExampleCopyOf() { - type Foo struct { - A int - B []*string - } - - // Create the initial value - str1 := "hello" - str2 := "bye bye" - f1 := &Foo{A: 1, B: []*string{&str1, &str2}} - - // Do the copy - v := awsutil.CopyOf(f1) - var f2 *Foo = v.(*Foo) - - // Print the result - fmt.Println(awsutil.Prettify(f2)) - - // Output: - // { - // A: 1, - // B: ["hello","bye bye"] - // } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal_test.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal_test.go deleted file mode 100644 index 7a5db6e49b..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal_test.go +++ /dev/null @@ -1,29 +0,0 @@ -package awsutil_test - -import ( - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/stretchr/testify/assert" -) - -func TestDeepEqual(t *testing.T) { - cases := []struct { - a, b interface{} - equal bool - }{ - {"a", "a", true}, - {"a", "b", false}, - {"a", aws.String(""), false}, - {"a", nil, false}, - {"a", aws.String("a"), true}, - {(*bool)(nil), (*bool)(nil), true}, - {(*bool)(nil), (*string)(nil), false}, - {nil, nil, true}, - } - - for i, c := range cases { - assert.Equal(t, c.equal, awsutil.DeepEqual(c.a, c.b), "%d, a:%v b:%v, %t", i, c.a, c.b, c.equal) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go deleted file mode 100644 index b2225566fa..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go +++ /dev/null @@ -1,142 +0,0 @@ -package awsutil_test - -import ( - "testing" - - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/stretchr/testify/assert" -) - -type Struct struct { - A []Struct - z []Struct - B *Struct - D *Struct - C string - E map[string]string -} - -var data = Struct{ - A: []Struct{{C: "value1"}, {C: "value2"}, {C: "value3"}}, - z: []Struct{{C: "value1"}, {C: "value2"}, {C: "value3"}}, - B: &Struct{B: &Struct{C: "terminal"}, D: &Struct{C: "terminal2"}}, - C: "initial", -} -var data2 = Struct{A: []Struct{ - {A: []Struct{{C: "1"}, {C: "1"}, {C: "1"}, {C: "1"}, {C: "1"}}}, - {A: []Struct{{C: "2"}, {C: "2"}, {C: "2"}, {C: "2"}, {C: "2"}}}, -}} - -func TestValueAtPathSuccess(t *testing.T) { - var testCases = []struct { - expect []interface{} - data interface{} - path string - }{ - {[]interface{}{"initial"}, data, "C"}, - {[]interface{}{"value1"}, data, "A[0].C"}, - {[]interface{}{"value2"}, data, "A[1].C"}, - {[]interface{}{"value3"}, data, "A[2].C"}, - {[]interface{}{"value3"}, data, "a[2].c"}, - {[]interface{}{"value3"}, data, "A[-1].C"}, - {[]interface{}{"value1", "value2", "value3"}, data, "A[].C"}, - {[]interface{}{"terminal"}, data, "B . B . C"}, - {[]interface{}{"initial"}, data, "A.D.X || C"}, - {[]interface{}{"initial"}, data, "A[0].B || C"}, - {[]interface{}{ - Struct{A: []Struct{{C: "1"}, {C: "1"}, {C: "1"}, {C: "1"}, {C: "1"}}}, - Struct{A: []Struct{{C: "2"}, {C: "2"}, {C: "2"}, {C: "2"}, {C: "2"}}}, - }, data2, "A"}, - } - for i, c := range testCases { - v, err := awsutil.ValuesAtPath(c.data, c.path) - assert.NoError(t, err, "case %d, expected no error, %s", i, c.path) - assert.Equal(t, c.expect, v, "case %d, %s", i, c.path) - } -} - -func TestValueAtPathFailure(t *testing.T) { - var testCases = []struct { - expect []interface{} - errContains string - data interface{} - path string - }{ - {nil, "", data, "C.x"}, - {nil, "SyntaxError: Invalid token: tDot", data, ".x"}, - {nil, "", data, "X.Y.Z"}, - {nil, "", data, "A[100].C"}, - {nil, "", data, "A[3].C"}, - {nil, "", data, "B.B.C.Z"}, - {nil, "", data, "z[-1].C"}, - {nil, "", nil, "A.B.C"}, - {[]interface{}{}, "", Struct{}, "A"}, - {nil, "", data, "A[0].B.C"}, - {nil, "", data, "D"}, - } - - for i, c := range testCases { - v, err := awsutil.ValuesAtPath(c.data, c.path) - if c.errContains != "" { - assert.Contains(t, err.Error(), c.errContains, "case %d, expected error, %s", i, c.path) - continue - } else { - assert.NoError(t, err, "case %d, expected no error, %s", i, c.path) - } - assert.Equal(t, c.expect, v, "case %d, %s", i, c.path) - } -} - -func TestSetValueAtPathSuccess(t *testing.T) { - var s Struct - awsutil.SetValueAtPath(&s, "C", "test1") - awsutil.SetValueAtPath(&s, "B.B.C", "test2") - awsutil.SetValueAtPath(&s, "B.D.C", "test3") - assert.Equal(t, "test1", s.C) - assert.Equal(t, "test2", s.B.B.C) - assert.Equal(t, "test3", s.B.D.C) - - awsutil.SetValueAtPath(&s, "B.*.C", "test0") - assert.Equal(t, "test0", s.B.B.C) - assert.Equal(t, "test0", s.B.D.C) - - var s2 Struct - awsutil.SetValueAtPath(&s2, "b.b.c", "test0") - assert.Equal(t, "test0", s2.B.B.C) - awsutil.SetValueAtPath(&s2, "A", []Struct{{}}) - assert.Equal(t, []Struct{{}}, s2.A) - - str := "foo" - - s3 := Struct{} - awsutil.SetValueAtPath(&s3, "b.b.c", str) - assert.Equal(t, "foo", s3.B.B.C) - - s3 = Struct{B: &Struct{B: &Struct{C: str}}} - awsutil.SetValueAtPath(&s3, "b.b.c", nil) - assert.Equal(t, "", s3.B.B.C) - - s3 = Struct{} - awsutil.SetValueAtPath(&s3, "b.b.c", nil) - assert.Equal(t, "", s3.B.B.C) - - s3 = Struct{} - awsutil.SetValueAtPath(&s3, "b.b.c", &str) - assert.Equal(t, "foo", s3.B.B.C) - - var s4 struct{ Name *string } - awsutil.SetValueAtPath(&s4, "Name", str) - assert.Equal(t, str, *s4.Name) - - s4 = struct{ Name *string }{} - awsutil.SetValueAtPath(&s4, "Name", nil) - assert.Equal(t, (*string)(nil), s4.Name) - - s4 = struct{ Name *string }{Name: &str} - awsutil.SetValueAtPath(&s4, "Name", nil) - assert.Equal(t, (*string)(nil), s4.Name) - - s4 = struct{ Name *string }{} - awsutil.SetValueAtPath(&s4, "Name", &str) - assert.Equal(t, str, *s4.Name) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/config_test.go b/vendor/github.com/aws/aws-sdk-go/aws/config_test.go deleted file mode 100644 index fe97a31fc7..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/config_test.go +++ /dev/null @@ -1,86 +0,0 @@ -package aws - -import ( - "net/http" - "reflect" - "testing" - - "github.com/aws/aws-sdk-go/aws/credentials" -) - -var testCredentials = credentials.NewStaticCredentials("AKID", "SECRET", "SESSION") - -var copyTestConfig = Config{ - Credentials: testCredentials, - Endpoint: String("CopyTestEndpoint"), - Region: String("COPY_TEST_AWS_REGION"), - DisableSSL: Bool(true), - HTTPClient: http.DefaultClient, - LogLevel: LogLevel(LogDebug), - Logger: NewDefaultLogger(), - MaxRetries: Int(3), - DisableParamValidation: Bool(true), - DisableComputeChecksums: Bool(true), - S3ForcePathStyle: Bool(true), -} - -func TestCopy(t *testing.T) { - want := copyTestConfig - got := copyTestConfig.Copy() - if !reflect.DeepEqual(*got, want) { - t.Errorf("Copy() = %+v", got) - t.Errorf(" want %+v", want) - } - - got.Region = String("other") - if got.Region == want.Region { - t.Errorf("Expect setting copy values not not reflect in source") - } -} - -func TestCopyReturnsNewInstance(t *testing.T) { - want := copyTestConfig - got := copyTestConfig.Copy() - if got == &want { - t.Errorf("Copy() = %p; want different instance as source %p", got, &want) - } -} - -var mergeTestZeroValueConfig = Config{} - -var mergeTestConfig = Config{ - Credentials: testCredentials, - Endpoint: String("MergeTestEndpoint"), - Region: String("MERGE_TEST_AWS_REGION"), - DisableSSL: Bool(true), - HTTPClient: http.DefaultClient, - LogLevel: LogLevel(LogDebug), - Logger: NewDefaultLogger(), - MaxRetries: Int(10), - DisableParamValidation: Bool(true), - DisableComputeChecksums: Bool(true), - S3ForcePathStyle: Bool(true), -} - -var mergeTests = []struct { - cfg *Config - in *Config - want *Config -}{ - {&Config{}, nil, &Config{}}, - {&Config{}, &mergeTestZeroValueConfig, &Config{}}, - {&Config{}, &mergeTestConfig, &mergeTestConfig}, -} - -func TestMerge(t *testing.T) { - for i, tt := range mergeTests { - got := tt.cfg.Copy() - got.MergeIn(tt.in) - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("Config %d %+v", i, tt.cfg) - t.Errorf(" Merge(%+v)", tt.in) - t.Errorf(" got %+v", got) - t.Errorf(" want %+v", tt.want) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/convert_types_test.go b/vendor/github.com/aws/aws-sdk-go/aws/convert_types_test.go deleted file mode 100644 index df7a3e5d2d..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/convert_types_test.go +++ /dev/null @@ -1,437 +0,0 @@ -package aws - -import ( - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -var testCasesStringSlice = [][]string{ - {"a", "b", "c", "d", "e"}, - {"a", "b", "", "", "e"}, -} - -func TestStringSlice(t *testing.T) { - for idx, in := range testCasesStringSlice { - if in == nil { - continue - } - out := StringSlice(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) - } - - out2 := StringValueSlice(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) - } -} - -var testCasesStringValueSlice = [][]*string{ - {String("a"), String("b"), nil, String("c")}, -} - -func TestStringValueSlice(t *testing.T) { - for idx, in := range testCasesStringValueSlice { - if in == nil { - continue - } - out := StringValueSlice(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - if in[i] == nil { - assert.Empty(t, out[i], "Unexpected value at idx %d", idx) - } else { - assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx) - } - } - - out2 := StringSlice(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - for i := range out2 { - if in[i] == nil { - assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx) - } else { - assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx) - } - } - } -} - -var testCasesStringMap = []map[string]string{ - {"a": "1", "b": "2", "c": "3"}, -} - -func TestStringMap(t *testing.T) { - for idx, in := range testCasesStringMap { - if in == nil { - continue - } - out := StringMap(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) - } - - out2 := StringValueMap(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) - } -} - -var testCasesBoolSlice = [][]bool{ - {true, true, false, false}, -} - -func TestBoolSlice(t *testing.T) { - for idx, in := range testCasesBoolSlice { - if in == nil { - continue - } - out := BoolSlice(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) - } - - out2 := BoolValueSlice(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) - } -} - -var testCasesBoolValueSlice = [][]*bool{} - -func TestBoolValueSlice(t *testing.T) { - for idx, in := range testCasesBoolValueSlice { - if in == nil { - continue - } - out := BoolValueSlice(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - if in[i] == nil { - assert.Empty(t, out[i], "Unexpected value at idx %d", idx) - } else { - assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx) - } - } - - out2 := BoolSlice(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - for i := range out2 { - if in[i] == nil { - assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx) - } else { - assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx) - } - } - } -} - -var testCasesBoolMap = []map[string]bool{ - {"a": true, "b": false, "c": true}, -} - -func TestBoolMap(t *testing.T) { - for idx, in := range testCasesBoolMap { - if in == nil { - continue - } - out := BoolMap(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) - } - - out2 := BoolValueMap(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) - } -} - -var testCasesIntSlice = [][]int{ - {1, 2, 3, 4}, -} - -func TestIntSlice(t *testing.T) { - for idx, in := range testCasesIntSlice { - if in == nil { - continue - } - out := IntSlice(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) - } - - out2 := IntValueSlice(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) - } -} - -var testCasesIntValueSlice = [][]*int{} - -func TestIntValueSlice(t *testing.T) { - for idx, in := range testCasesIntValueSlice { - if in == nil { - continue - } - out := IntValueSlice(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - if in[i] == nil { - assert.Empty(t, out[i], "Unexpected value at idx %d", idx) - } else { - assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx) - } - } - - out2 := IntSlice(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - for i := range out2 { - if in[i] == nil { - assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx) - } else { - assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx) - } - } - } -} - -var testCasesIntMap = []map[string]int{ - {"a": 3, "b": 2, "c": 1}, -} - -func TestIntMap(t *testing.T) { - for idx, in := range testCasesIntMap { - if in == nil { - continue - } - out := IntMap(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) - } - - out2 := IntValueMap(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) - } -} - -var testCasesInt64Slice = [][]int64{ - {1, 2, 3, 4}, -} - -func TestInt64Slice(t *testing.T) { - for idx, in := range testCasesInt64Slice { - if in == nil { - continue - } - out := Int64Slice(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) - } - - out2 := Int64ValueSlice(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) - } -} - -var testCasesInt64ValueSlice = [][]*int64{} - -func TestInt64ValueSlice(t *testing.T) { - for idx, in := range testCasesInt64ValueSlice { - if in == nil { - continue - } - out := Int64ValueSlice(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - if in[i] == nil { - assert.Empty(t, out[i], "Unexpected value at idx %d", idx) - } else { - assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx) - } - } - - out2 := Int64Slice(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - for i := range out2 { - if in[i] == nil { - assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx) - } else { - assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx) - } - } - } -} - -var testCasesInt64Map = []map[string]int64{ - {"a": 3, "b": 2, "c": 1}, -} - -func TestInt64Map(t *testing.T) { - for idx, in := range testCasesInt64Map { - if in == nil { - continue - } - out := Int64Map(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) - } - - out2 := Int64ValueMap(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) - } -} - -var testCasesFloat64Slice = [][]float64{ - {1, 2, 3, 4}, -} - -func TestFloat64Slice(t *testing.T) { - for idx, in := range testCasesFloat64Slice { - if in == nil { - continue - } - out := Float64Slice(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) - } - - out2 := Float64ValueSlice(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) - } -} - -var testCasesFloat64ValueSlice = [][]*float64{} - -func TestFloat64ValueSlice(t *testing.T) { - for idx, in := range testCasesFloat64ValueSlice { - if in == nil { - continue - } - out := Float64ValueSlice(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - if in[i] == nil { - assert.Empty(t, out[i], "Unexpected value at idx %d", idx) - } else { - assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx) - } - } - - out2 := Float64Slice(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - for i := range out2 { - if in[i] == nil { - assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx) - } else { - assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx) - } - } - } -} - -var testCasesFloat64Map = []map[string]float64{ - {"a": 3, "b": 2, "c": 1}, -} - -func TestFloat64Map(t *testing.T) { - for idx, in := range testCasesFloat64Map { - if in == nil { - continue - } - out := Float64Map(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) - } - - out2 := Float64ValueMap(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) - } -} - -var testCasesTimeSlice = [][]time.Time{ - {time.Now(), time.Now().AddDate(100, 0, 0)}, -} - -func TestTimeSlice(t *testing.T) { - for idx, in := range testCasesTimeSlice { - if in == nil { - continue - } - out := TimeSlice(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) - } - - out2 := TimeValueSlice(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) - } -} - -var testCasesTimeValueSlice = [][]*time.Time{} - -func TestTimeValueSlice(t *testing.T) { - for idx, in := range testCasesTimeValueSlice { - if in == nil { - continue - } - out := TimeValueSlice(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - if in[i] == nil { - assert.Empty(t, out[i], "Unexpected value at idx %d", idx) - } else { - assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx) - } - } - - out2 := TimeSlice(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - for i := range out2 { - if in[i] == nil { - assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx) - } else { - assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx) - } - } - } -} - -var testCasesTimeMap = []map[string]time.Time{ - {"a": time.Now().AddDate(-100, 0, 0), "b": time.Now()}, -} - -func TestTimeMap(t *testing.T) { - for idx, in := range testCasesTimeMap { - if in == nil { - continue - } - out := TimeMap(in) - assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) - for i := range out { - assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) - } - - out2 := TimeValueMap(out) - assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) - assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go deleted file mode 100644 index f08950694c..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go +++ /dev/null @@ -1,113 +0,0 @@ -package corehandlers_test - -import ( - "fmt" - "net/http" - "os" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/corehandlers" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting" -) - -func TestValidateEndpointHandler(t *testing.T) { - os.Clearenv() - - svc := awstesting.NewClient(aws.NewConfig().WithRegion("us-west-2")) - svc.Handlers.Clear() - svc.Handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler) - - req := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - err := req.Build() - - assert.NoError(t, err) -} - -func TestValidateEndpointHandlerErrorRegion(t *testing.T) { - os.Clearenv() - - svc := awstesting.NewClient() - svc.Handlers.Clear() - svc.Handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler) - - req := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - err := req.Build() - - assert.Error(t, err) - assert.Equal(t, aws.ErrMissingRegion, err) -} - -type mockCredsProvider struct { - expired bool - retrieveCalled bool -} - -func (m *mockCredsProvider) Retrieve() (credentials.Value, error) { - m.retrieveCalled = true - return credentials.Value{ProviderName: "mockCredsProvider"}, nil -} - -func (m *mockCredsProvider) IsExpired() bool { - return m.expired -} - -func TestAfterRetryRefreshCreds(t *testing.T) { - os.Clearenv() - credProvider := &mockCredsProvider{} - - svc := awstesting.NewClient(&aws.Config{ - Credentials: credentials.NewCredentials(credProvider), - MaxRetries: aws.Int(1), - }) - - svc.Handlers.Clear() - svc.Handlers.ValidateResponse.PushBack(func(r *request.Request) { - r.Error = awserr.New("UnknownError", "", nil) - r.HTTPResponse = &http.Response{StatusCode: 400} - }) - svc.Handlers.UnmarshalError.PushBack(func(r *request.Request) { - r.Error = awserr.New("ExpiredTokenException", "", nil) - }) - svc.Handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler) - - assert.True(t, svc.Config.Credentials.IsExpired(), "Expect to start out expired") - assert.False(t, credProvider.retrieveCalled) - - req := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - req.Send() - - assert.True(t, svc.Config.Credentials.IsExpired()) - assert.False(t, credProvider.retrieveCalled) - - _, err := svc.Config.Credentials.Get() - assert.NoError(t, err) - assert.True(t, credProvider.retrieveCalled) -} - -type testSendHandlerTransport struct{} - -func (t *testSendHandlerTransport) RoundTrip(r *http.Request) (*http.Response, error) { - return nil, fmt.Errorf("mock error") -} - -func TestSendHandlerError(t *testing.T) { - svc := awstesting.NewClient(&aws.Config{ - HTTPClient: &http.Client{ - Transport: &testSendHandlerTransport{}, - }, - }) - svc.Handlers.Clear() - svc.Handlers.Send.PushBackNamed(corehandlers.SendHandler) - r := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - - r.Send() - - assert.Error(t, r.Error) - assert.NotNil(t, r.HTTPResponse) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go deleted file mode 100644 index e10debca5f..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go +++ /dev/null @@ -1,129 +0,0 @@ -package corehandlers_test - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/corehandlers" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/stretchr/testify/require" -) - -var testSvc = func() *client.Client { - s := &client.Client{ - Config: aws.Config{}, - ClientInfo: metadata.ClientInfo{ - ServiceName: "mock-service", - APIVersion: "2015-01-01", - }, - } - return s -}() - -type StructShape struct { - RequiredList []*ConditionalStructShape `required:"true"` - RequiredMap map[string]*ConditionalStructShape `required:"true"` - RequiredBool *bool `required:"true"` - OptionalStruct *ConditionalStructShape - - hiddenParameter *string - _ struct{} -} - -type ConditionalStructShape struct { - Name *string `required:"true"` - _ struct{} -} - -func TestNoErrors(t *testing.T) { - input := &StructShape{ - RequiredList: []*ConditionalStructShape{}, - RequiredMap: map[string]*ConditionalStructShape{ - "key1": {Name: aws.String("Name")}, - "key2": {Name: aws.String("Name")}, - }, - RequiredBool: aws.Bool(true), - OptionalStruct: &ConditionalStructShape{Name: aws.String("Name")}, - } - - req := testSvc.NewRequest(&request.Operation{}, input, nil) - corehandlers.ValidateParametersHandler.Fn(req) - require.NoError(t, req.Error) -} - -func TestMissingRequiredParameters(t *testing.T) { - input := &StructShape{} - req := testSvc.NewRequest(&request.Operation{}, input, nil) - corehandlers.ValidateParametersHandler.Fn(req) - - require.Error(t, req.Error) - assert.Equal(t, "InvalidParameter", req.Error.(awserr.Error).Code()) - assert.Equal(t, "3 validation errors:\n- missing required parameter: RequiredList\n- missing required parameter: RequiredMap\n- missing required parameter: RequiredBool", req.Error.(awserr.Error).Message()) -} - -func TestNestedMissingRequiredParameters(t *testing.T) { - input := &StructShape{ - RequiredList: []*ConditionalStructShape{{}}, - RequiredMap: map[string]*ConditionalStructShape{ - "key1": {Name: aws.String("Name")}, - "key2": {}, - }, - RequiredBool: aws.Bool(true), - OptionalStruct: &ConditionalStructShape{}, - } - - req := testSvc.NewRequest(&request.Operation{}, input, nil) - corehandlers.ValidateParametersHandler.Fn(req) - - require.Error(t, req.Error) - assert.Equal(t, "InvalidParameter", req.Error.(awserr.Error).Code()) - assert.Equal(t, "3 validation errors:\n- missing required parameter: RequiredList[0].Name\n- missing required parameter: RequiredMap[\"key2\"].Name\n- missing required parameter: OptionalStruct.Name", req.Error.(awserr.Error).Message()) -} - -type testInput struct { - StringField string `min:"5"` - PtrStrField *string `min:"2"` - ListField []string `min:"3"` - MapField map[string]string `min:"4"` -} - -var testsFieldMin = []struct { - err awserr.Error - in testInput -}{ - { - err: awserr.New("InvalidParameter", "1 validation errors:\n- field too short, minimum length 5: StringField", nil), - in: testInput{StringField: "abcd"}, - }, - { - err: awserr.New("InvalidParameter", "2 validation errors:\n- field too short, minimum length 5: StringField\n- field too short, minimum length 3: ListField", nil), - in: testInput{StringField: "abcd", ListField: []string{"a", "b"}}, - }, - { - err: awserr.New("InvalidParameter", "3 validation errors:\n- field too short, minimum length 5: StringField\n- field too short, minimum length 3: ListField\n- field too short, minimum length 4: MapField", nil), - in: testInput{StringField: "abcd", ListField: []string{"a", "b"}, MapField: map[string]string{"a": "a", "b": "b"}}, - }, - { - err: awserr.New("InvalidParameter", "1 validation errors:\n- field too short, minimum length 2: PtrStrField", nil), - in: testInput{StringField: "abcde", PtrStrField: aws.String("v")}, - }, - { - err: nil, - in: testInput{StringField: "abcde", PtrStrField: aws.String("value"), - ListField: []string{"a", "b", "c"}, MapField: map[string]string{"a": "a", "b": "b", "c": "c", "d": "d"}}, - }, -} - -func TestValidateFieldMinParameter(t *testing.T) { - for i, c := range testsFieldMin { - req := testSvc.NewRequest(&request.Operation{}, &c.in, nil) - corehandlers.ValidateParametersHandler.Fn(req) - - require.Equal(t, c.err, req.Error, "%d case failed", i) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider_test.go deleted file mode 100644 index 3b393a2ed1..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider_test.go +++ /dev/null @@ -1,154 +0,0 @@ -package credentials - -import ( - "testing" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/stretchr/testify/assert" -) - -type secondStubProvider struct { - creds Value - expired bool - err error -} - -func (s *secondStubProvider) Retrieve() (Value, error) { - s.expired = false - s.creds.ProviderName = "secondStubProvider" - return s.creds, s.err -} -func (s *secondStubProvider) IsExpired() bool { - return s.expired -} - -func TestChainProviderWithNames(t *testing.T) { - p := &ChainProvider{ - Providers: []Provider{ - &stubProvider{err: awserr.New("FirstError", "first provider error", nil)}, - &stubProvider{err: awserr.New("SecondError", "second provider error", nil)}, - &secondStubProvider{ - creds: Value{ - AccessKeyID: "AKIF", - SecretAccessKey: "NOSECRET", - SessionToken: "", - }, - }, - &stubProvider{ - creds: Value{ - AccessKeyID: "AKID", - SecretAccessKey: "SECRET", - SessionToken: "", - }, - }, - }, - } - - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - assert.Equal(t, "secondStubProvider", creds.ProviderName, "Expect provider name to match") - - // Also check credentials - assert.Equal(t, "AKIF", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "NOSECRET", creds.SecretAccessKey, "Expect secret access key to match") - assert.Empty(t, creds.SessionToken, "Expect session token to be empty") - -} - -func TestChainProviderGet(t *testing.T) { - p := &ChainProvider{ - Providers: []Provider{ - &stubProvider{err: awserr.New("FirstError", "first provider error", nil)}, - &stubProvider{err: awserr.New("SecondError", "second provider error", nil)}, - &stubProvider{ - creds: Value{ - AccessKeyID: "AKID", - SecretAccessKey: "SECRET", - SessionToken: "", - }, - }, - }, - } - - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - assert.Equal(t, "AKID", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "SECRET", creds.SecretAccessKey, "Expect secret access key to match") - assert.Empty(t, creds.SessionToken, "Expect session token to be empty") -} - -func TestChainProviderIsExpired(t *testing.T) { - stubProvider := &stubProvider{expired: true} - p := &ChainProvider{ - Providers: []Provider{ - stubProvider, - }, - } - - assert.True(t, p.IsExpired(), "Expect expired to be true before any Retrieve") - _, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - assert.False(t, p.IsExpired(), "Expect not expired after retrieve") - - stubProvider.expired = true - assert.True(t, p.IsExpired(), "Expect return of expired provider") - - _, err = p.Retrieve() - assert.False(t, p.IsExpired(), "Expect not expired after retrieve") -} - -func TestChainProviderWithNoProvider(t *testing.T) { - p := &ChainProvider{ - Providers: []Provider{}, - } - - assert.True(t, p.IsExpired(), "Expect expired with no providers") - _, err := p.Retrieve() - assert.Equal(t, - ErrNoValidProvidersFoundInChain, - err, - "Expect no providers error returned") -} - -func TestChainProviderWithNoValidProvider(t *testing.T) { - errs := []error{ - awserr.New("FirstError", "first provider error", nil), - awserr.New("SecondError", "second provider error", nil), - } - p := &ChainProvider{ - Providers: []Provider{ - &stubProvider{err: errs[0]}, - &stubProvider{err: errs[1]}, - }, - } - - assert.True(t, p.IsExpired(), "Expect expired with no providers") - _, err := p.Retrieve() - - assert.Equal(t, - ErrNoValidProvidersFoundInChain, - err, - "Expect no providers error returned") -} - -func TestChainProviderWithNoValidProviderWithVerboseEnabled(t *testing.T) { - errs := []error{ - awserr.New("FirstError", "first provider error", nil), - awserr.New("SecondError", "second provider error", nil), - } - p := &ChainProvider{ - VerboseErrors: true, - Providers: []Provider{ - &stubProvider{err: errs[0]}, - &stubProvider{err: errs[1]}, - }, - } - - assert.True(t, p.IsExpired(), "Expect expired with no providers") - _, err := p.Retrieve() - - assert.Equal(t, - awserr.NewBatchError("NoCredentialProviders", "no valid providers in chain", errs), - err, - "Expect no providers error returned") -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials_test.go deleted file mode 100644 index 7b79ba985f..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials_test.go +++ /dev/null @@ -1,73 +0,0 @@ -package credentials - -import ( - "testing" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/stretchr/testify/assert" -) - -type stubProvider struct { - creds Value - expired bool - err error -} - -func (s *stubProvider) Retrieve() (Value, error) { - s.expired = false - s.creds.ProviderName = "stubProvider" - return s.creds, s.err -} -func (s *stubProvider) IsExpired() bool { - return s.expired -} - -func TestCredentialsGet(t *testing.T) { - c := NewCredentials(&stubProvider{ - creds: Value{ - AccessKeyID: "AKID", - SecretAccessKey: "SECRET", - SessionToken: "", - }, - expired: true, - }) - - creds, err := c.Get() - assert.Nil(t, err, "Expected no error") - assert.Equal(t, "AKID", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "SECRET", creds.SecretAccessKey, "Expect secret access key to match") - assert.Empty(t, creds.SessionToken, "Expect session token to be empty") -} - -func TestCredentialsGetWithError(t *testing.T) { - c := NewCredentials(&stubProvider{err: awserr.New("provider error", "", nil), expired: true}) - - _, err := c.Get() - assert.Equal(t, "provider error", err.(awserr.Error).Code(), "Expected provider error") -} - -func TestCredentialsExpire(t *testing.T) { - stub := &stubProvider{} - c := NewCredentials(stub) - - stub.expired = false - assert.True(t, c.IsExpired(), "Expected to start out expired") - c.Expire() - assert.True(t, c.IsExpired(), "Expected to be expired") - - c.forceRefresh = false - assert.False(t, c.IsExpired(), "Expected not to be expired") - - stub.expired = true - assert.True(t, c.IsExpired(), "Expected to be expired") -} - -func TestCredentialsGetWithProviderName(t *testing.T) { - stub := &stubProvider{} - - c := NewCredentials(stub) - - creds, err := c.Get() - assert.Nil(t, err, "Expected no error") - assert.Equal(t, creds.ProviderName, "stubProvider", "Expected provider name to match") -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go deleted file mode 100644 index da3d8ed3ec..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go +++ /dev/null @@ -1,159 +0,0 @@ -package ec2rolecreds_test - -import ( - "fmt" - "net/http" - "net/http/httptest" - "testing" - "time" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" - "github.com/aws/aws-sdk-go/aws/ec2metadata" - "github.com/aws/aws-sdk-go/aws/session" -) - -const credsRespTmpl = `{ - "Code": "Success", - "Type": "AWS-HMAC", - "AccessKeyId" : "accessKey", - "SecretAccessKey" : "secret", - "Token" : "token", - "Expiration" : "%s", - "LastUpdated" : "2009-11-23T0:00:00Z" -}` - -const credsFailRespTmpl = `{ - "Code": "ErrorCode", - "Message": "ErrorMsg", - "LastUpdated": "2009-11-23T0:00:00Z" -}` - -func initTestServer(expireOn string, failAssume bool) *httptest.Server { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.URL.Path == "/latest/meta-data/iam/security-credentials" { - fmt.Fprintln(w, "RoleName") - } else if r.URL.Path == "/latest/meta-data/iam/security-credentials/RoleName" { - if failAssume { - fmt.Fprintf(w, credsFailRespTmpl) - } else { - fmt.Fprintf(w, credsRespTmpl, expireOn) - } - } else { - http.Error(w, "bad request", http.StatusBadRequest) - } - })) - - return server -} - -func TestEC2RoleProvider(t *testing.T) { - server := initTestServer("2014-12-16T01:51:37Z", false) - defer server.Close() - - p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), - } - - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error, %v", err) - - assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "token", creds.SessionToken, "Expect session token to match") -} - -func TestEC2RoleProviderFailAssume(t *testing.T) { - server := initTestServer("2014-12-16T01:51:37Z", true) - defer server.Close() - - p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), - } - - creds, err := p.Retrieve() - assert.Error(t, err, "Expect error") - - e := err.(awserr.Error) - assert.Equal(t, "ErrorCode", e.Code()) - assert.Equal(t, "ErrorMsg", e.Message()) - assert.Nil(t, e.OrigErr()) - - assert.Equal(t, "", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "", creds.SessionToken, "Expect session token to match") -} - -func TestEC2RoleProviderIsExpired(t *testing.T) { - server := initTestServer("2014-12-16T01:51:37Z", false) - defer server.Close() - - p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), - } - p.CurrentTime = func() time.Time { - return time.Date(2014, 12, 15, 21, 26, 0, 0, time.UTC) - } - - assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.") - - _, err := p.Retrieve() - assert.Nil(t, err, "Expect no error, %v", err) - - assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.") - - p.CurrentTime = func() time.Time { - return time.Date(3014, 12, 15, 21, 26, 0, 0, time.UTC) - } - - assert.True(t, p.IsExpired(), "Expect creds to be expired.") -} - -func TestEC2RoleProviderExpiryWindowIsExpired(t *testing.T) { - server := initTestServer("2014-12-16T01:51:37Z", false) - defer server.Close() - - p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), - ExpiryWindow: time.Hour * 1, - } - p.CurrentTime = func() time.Time { - return time.Date(2014, 12, 15, 0, 51, 37, 0, time.UTC) - } - - assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.") - - _, err := p.Retrieve() - assert.Nil(t, err, "Expect no error, %v", err) - - assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.") - - p.CurrentTime = func() time.Time { - return time.Date(2014, 12, 16, 0, 55, 37, 0, time.UTC) - } - - assert.True(t, p.IsExpired(), "Expect creds to be expired.") -} - -func BenchmarkEC3RoleProvider(b *testing.B) { - server := initTestServer("2014-12-16T01:51:37Z", false) - defer server.Close() - - p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), - } - _, err := p.Retrieve() - if err != nil { - b.Fatal(err) - } - - b.ResetTimer() - for i := 0; i < b.N; i++ { - if _, err := p.Retrieve(); err != nil { - b.Fatal(err) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider_test.go deleted file mode 100644 index 53f6ce256e..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package credentials - -import ( - "github.com/stretchr/testify/assert" - "os" - "testing" -) - -func TestEnvProviderRetrieve(t *testing.T) { - os.Clearenv() - os.Setenv("AWS_ACCESS_KEY_ID", "access") - os.Setenv("AWS_SECRET_ACCESS_KEY", "secret") - os.Setenv("AWS_SESSION_TOKEN", "token") - - e := EnvProvider{} - creds, err := e.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "access", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "token", creds.SessionToken, "Expect session token to match") -} - -func TestEnvProviderIsExpired(t *testing.T) { - os.Clearenv() - os.Setenv("AWS_ACCESS_KEY_ID", "access") - os.Setenv("AWS_SECRET_ACCESS_KEY", "secret") - os.Setenv("AWS_SESSION_TOKEN", "token") - - e := EnvProvider{} - - assert.True(t, e.IsExpired(), "Expect creds to be expired before retrieve.") - - _, err := e.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.False(t, e.IsExpired(), "Expect creds to not be expired after retrieve.") -} - -func TestEnvProviderNoAccessKeyID(t *testing.T) { - os.Clearenv() - os.Setenv("AWS_SECRET_ACCESS_KEY", "secret") - - e := EnvProvider{} - creds, err := e.Retrieve() - assert.Equal(t, ErrAccessKeyIDNotFound, err, "ErrAccessKeyIDNotFound expected, but was %#v error: %#v", creds, err) -} - -func TestEnvProviderNoSecretAccessKey(t *testing.T) { - os.Clearenv() - os.Setenv("AWS_ACCESS_KEY_ID", "access") - - e := EnvProvider{} - creds, err := e.Retrieve() - assert.Equal(t, ErrSecretAccessKeyNotFound, err, "ErrSecretAccessKeyNotFound expected, but was %#v error: %#v", creds, err) -} - -func TestEnvProviderAlternateNames(t *testing.T) { - os.Clearenv() - os.Setenv("AWS_ACCESS_KEY", "access") - os.Setenv("AWS_SECRET_KEY", "secret") - - e := EnvProvider{} - creds, err := e.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "access", creds.AccessKeyID, "Expected access key ID") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expected secret access key") - assert.Empty(t, creds.SessionToken, "Expected no token") -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go deleted file mode 100644 index 6b4093a156..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go +++ /dev/null @@ -1,116 +0,0 @@ -package credentials - -import ( - "os" - "path/filepath" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestSharedCredentialsProvider(t *testing.T) { - os.Clearenv() - - p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""} - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "token", creds.SessionToken, "Expect session token to match") -} - -func TestSharedCredentialsProviderIsExpired(t *testing.T) { - os.Clearenv() - - p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""} - - assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve") - - _, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve") -} - -func TestSharedCredentialsProviderWithAWS_SHARED_CREDENTIALS_FILE(t *testing.T) { - os.Clearenv() - os.Setenv("AWS_SHARED_CREDENTIALS_FILE", "example.ini") - p := SharedCredentialsProvider{} - creds, err := p.Retrieve() - - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "token", creds.SessionToken, "Expect session token to match") -} - -func TestSharedCredentialsProviderWithAWS_SHARED_CREDENTIALS_FILEAbsPath(t *testing.T) { - os.Clearenv() - wd, err := os.Getwd() - assert.NoError(t, err) - os.Setenv("AWS_SHARED_CREDENTIALS_FILE", filepath.Join(wd, "example.ini")) - p := SharedCredentialsProvider{} - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "token", creds.SessionToken, "Expect session token to match") -} - -func TestSharedCredentialsProviderWithAWS_PROFILE(t *testing.T) { - os.Clearenv() - os.Setenv("AWS_PROFILE", "no_token") - - p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""} - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Empty(t, creds.SessionToken, "Expect no token") -} - -func TestSharedCredentialsProviderWithoutTokenFromProfile(t *testing.T) { - os.Clearenv() - - p := SharedCredentialsProvider{Filename: "example.ini", Profile: "no_token"} - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Empty(t, creds.SessionToken, "Expect no token") -} - -func TestSharedCredentialsProviderColonInCredFile(t *testing.T) { - os.Clearenv() - - p := SharedCredentialsProvider{Filename: "example.ini", Profile: "with_colon"} - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Empty(t, creds.SessionToken, "Expect no token") -} - -func BenchmarkSharedCredentialsProvider(b *testing.B) { - os.Clearenv() - - p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""} - _, err := p.Retrieve() - if err != nil { - b.Fatal(err) - } - - b.ResetTimer() - for i := 0; i < b.N; i++ { - _, err := p.Retrieve() - if err != nil { - b.Fatal(err) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider_test.go deleted file mode 100644 index ea01236962..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package credentials - -import ( - "github.com/stretchr/testify/assert" - "testing" -) - -func TestStaticProviderGet(t *testing.T) { - s := StaticProvider{ - Value: Value{ - AccessKeyID: "AKID", - SecretAccessKey: "SECRET", - SessionToken: "", - }, - } - - creds, err := s.Retrieve() - assert.Nil(t, err, "Expect no error") - assert.Equal(t, "AKID", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "SECRET", creds.SecretAccessKey, "Expect secret access key to match") - assert.Empty(t, creds.SessionToken, "Expect no session token") -} - -func TestStaticProviderIsExpired(t *testing.T) { - s := StaticProvider{ - Value: Value{ - AccessKeyID: "AKID", - SecretAccessKey: "SECRET", - SessionToken: "", - }, - } - - assert.False(t, s.IsExpired(), "Expect static credentials to never expire") -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go deleted file mode 100644 index 6bd6e91973..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package stscreds - -import ( - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/sts" - "github.com/stretchr/testify/assert" -) - -type stubSTS struct { -} - -func (s *stubSTS) AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) { - expiry := time.Now().Add(60 * time.Minute) - return &sts.AssumeRoleOutput{ - Credentials: &sts.Credentials{ - // Just reflect the role arn to the provider. - AccessKeyId: input.RoleArn, - SecretAccessKey: aws.String("assumedSecretAccessKey"), - SessionToken: aws.String("assumedSessionToken"), - Expiration: &expiry, - }, - }, nil -} - -func TestAssumeRoleProvider(t *testing.T) { - stub := &stubSTS{} - p := &AssumeRoleProvider{ - Client: stub, - RoleARN: "roleARN", - } - - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "roleARN", creds.AccessKeyID, "Expect access key ID to be reflected role ARN") - assert.Equal(t, "assumedSecretAccessKey", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "assumedSessionToken", creds.SessionToken, "Expect session token to match") -} - -func BenchmarkAssumeRoleProvider(b *testing.B) { - stub := &stubSTS{} - p := &AssumeRoleProvider{ - Client: stub, - RoleARN: "roleARN", - } - - b.ResetTimer() - for i := 0; i < b.N; i++ { - if _, err := p.Retrieve(); err != nil { - b.Fatal(err) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go deleted file mode 100644 index c3c92972b7..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go +++ /dev/null @@ -1,101 +0,0 @@ -package ec2metadata_test - -import ( - "bytes" - "io/ioutil" - "net/http" - "net/http/httptest" - "path" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/ec2metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" -) - -func initTestServer(path string, resp string) *httptest.Server { - return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.RequestURI != path { - http.Error(w, "not found", http.StatusNotFound) - return - } - - w.Write([]byte(resp)) - })) -} - -func TestEndpoint(t *testing.T) { - c := ec2metadata.New(session.New()) - op := &request.Operation{ - Name: "GetMetadata", - HTTPMethod: "GET", - HTTPPath: path.Join("/", "meta-data", "testpath"), - } - - req := c.NewRequest(op, nil, nil) - assert.Equal(t, "http://169.254.169.254/latest", req.ClientInfo.Endpoint) - assert.Equal(t, "http://169.254.169.254/latest/meta-data/testpath", req.HTTPRequest.URL.String()) -} - -func TestGetMetadata(t *testing.T) { - server := initTestServer( - "/latest/meta-data/some/path", - "success", // real response includes suffix - ) - defer server.Close() - c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) - - resp, err := c.GetMetadata("some/path") - - assert.NoError(t, err) - assert.Equal(t, "success", resp) -} - -func TestGetRegion(t *testing.T) { - server := initTestServer( - "/latest/meta-data/placement/availability-zone", - "us-west-2a", // real response includes suffix - ) - defer server.Close() - c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) - - region, err := c.Region() - - assert.NoError(t, err) - assert.Equal(t, "us-west-2", region) -} - -func TestMetadataAvailable(t *testing.T) { - server := initTestServer( - "/latest/meta-data/instance-id", - "instance-id", - ) - defer server.Close() - c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) - - available := c.Available() - - assert.True(t, available) -} - -func TestMetadataNotAvailable(t *testing.T) { - c := ec2metadata.New(session.New()) - c.Handlers.Send.Clear() - c.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &http.Response{ - StatusCode: int(0), - Status: http.StatusText(int(0)), - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - } - r.Error = awserr.New("RequestError", "send request failed", nil) - r.Retryable = aws.Bool(true) // network errors are retryable - }) - - available := c.Available() - - assert.False(t, available) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go deleted file mode 100644 index d10ecb303b..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package ec2metadata_test - -import ( - "net/http" - "net/http/httptest" - "sync" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/ec2metadata" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/stretchr/testify/assert" -) - -func TestClientOverrideDefaultHTTPClientTimeout(t *testing.T) { - svc := ec2metadata.New(session.New()) - - assert.NotEqual(t, http.DefaultClient, svc.Config.HTTPClient) - assert.Equal(t, 5*time.Second, svc.Config.HTTPClient.Timeout) -} - -func TestClientNotOverrideDefaultHTTPClientTimeout(t *testing.T) { - origClient := *http.DefaultClient - http.DefaultClient.Transport = &http.Transport{} - defer func() { - http.DefaultClient = &origClient - }() - - svc := ec2metadata.New(session.New()) - - assert.Equal(t, http.DefaultClient, svc.Config.HTTPClient) - - tr, ok := svc.Config.HTTPClient.Transport.(*http.Transport) - assert.True(t, ok) - assert.NotNil(t, tr) - assert.Nil(t, tr.Dial) -} - -func TestClientDisableOverrideDefaultHTTPClientTimeout(t *testing.T) { - svc := ec2metadata.New(session.New(aws.NewConfig().WithEC2MetadataDisableTimeoutOverride(true))) - - assert.Equal(t, http.DefaultClient, svc.Config.HTTPClient) -} - -func TestClientOverrideDefaultHTTPClientTimeoutRace(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("us-east-1a")) - })) - - cfg := aws.NewConfig().WithEndpoint(server.URL) - runEC2MetadataClients(t, cfg, 100) -} - -func TestClientOverrideDefaultHTTPClientTimeoutRaceWithTransport(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("us-east-1a")) - })) - - cfg := aws.NewConfig().WithEndpoint(server.URL).WithHTTPClient(&http.Client{ - Transport: http.DefaultTransport, - }) - - runEC2MetadataClients(t, cfg, 100) -} - -func runEC2MetadataClients(t *testing.T, cfg *aws.Config, atOnce int) { - var wg sync.WaitGroup - wg.Add(atOnce) - for i := 0; i < atOnce; i++ { - go func() { - svc := ec2metadata.New(session.New(), cfg) - _, err := svc.Region() - assert.NoError(t, err) - wg.Done() - }() - } - wg.Wait() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go deleted file mode 100644 index 16a1418283..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package request_test - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" -) - -func TestHandlerList(t *testing.T) { - s := "" - r := &request.Request{} - l := request.HandlerList{} - l.PushBack(func(r *request.Request) { - s += "a" - r.Data = s - }) - l.Run(r) - assert.Equal(t, "a", s) - assert.Equal(t, "a", r.Data) -} - -func TestMultipleHandlers(t *testing.T) { - r := &request.Request{} - l := request.HandlerList{} - l.PushBack(func(r *request.Request) { r.Data = nil }) - l.PushFront(func(r *request.Request) { r.Data = aws.Bool(true) }) - l.Run(r) - if r.Data != nil { - t.Error("Expected handler to execute") - } -} - -func TestNamedHandlers(t *testing.T) { - l := request.HandlerList{} - named := request.NamedHandler{Name: "Name", Fn: func(r *request.Request) {}} - named2 := request.NamedHandler{Name: "NotName", Fn: func(r *request.Request) {}} - l.PushBackNamed(named) - l.PushBackNamed(named) - l.PushBackNamed(named2) - l.PushBack(func(r *request.Request) {}) - assert.Equal(t, 4, l.Len()) - l.Remove(named) - assert.Equal(t, 2, l.Len()) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go deleted file mode 100644 index 725ea25cbd..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go +++ /dev/null @@ -1,455 +0,0 @@ -package request_test - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/dynamodb" - "github.com/aws/aws-sdk-go/service/route53" - "github.com/aws/aws-sdk-go/service/s3" -) - -// Use DynamoDB methods for simplicity -func TestPaginationQueryPage(t *testing.T) { - db := dynamodb.New(unit.Session) - tokens, pages, numPages, gotToEnd := []map[string]*dynamodb.AttributeValue{}, []map[string]*dynamodb.AttributeValue{}, 0, false - - reqNum := 0 - resps := []*dynamodb.QueryOutput{ - { - LastEvaluatedKey: map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key1")}}, - Count: aws.Int64(1), - Items: []map[string]*dynamodb.AttributeValue{ - { - "key": {S: aws.String("key1")}, - }, - }, - }, - { - LastEvaluatedKey: map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key2")}}, - Count: aws.Int64(1), - Items: []map[string]*dynamodb.AttributeValue{ - { - "key": {S: aws.String("key2")}, - }, - }, - }, - { - LastEvaluatedKey: map[string]*dynamodb.AttributeValue{}, - Count: aws.Int64(1), - Items: []map[string]*dynamodb.AttributeValue{ - { - "key": {S: aws.String("key3")}, - }, - }, - }, - } - - db.Handlers.Send.Clear() // mock sending - db.Handlers.Unmarshal.Clear() - db.Handlers.UnmarshalMeta.Clear() - db.Handlers.ValidateResponse.Clear() - db.Handlers.Build.PushBack(func(r *request.Request) { - in := r.Params.(*dynamodb.QueryInput) - if in == nil { - tokens = append(tokens, nil) - } else if len(in.ExclusiveStartKey) != 0 { - tokens = append(tokens, in.ExclusiveStartKey) - } - }) - db.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = resps[reqNum] - reqNum++ - }) - - params := &dynamodb.QueryInput{ - Limit: aws.Int64(2), - TableName: aws.String("tablename"), - } - err := db.QueryPages(params, func(p *dynamodb.QueryOutput, last bool) bool { - numPages++ - for _, item := range p.Items { - pages = append(pages, item) - } - if last { - if gotToEnd { - assert.Fail(t, "last=true happened twice") - } - gotToEnd = true - } - return true - }) - assert.Nil(t, err) - - assert.Equal(t, - []map[string]*dynamodb.AttributeValue{ - {"key": {S: aws.String("key1")}}, - {"key": {S: aws.String("key2")}}, - }, tokens) - assert.Equal(t, - []map[string]*dynamodb.AttributeValue{ - {"key": {S: aws.String("key1")}}, - {"key": {S: aws.String("key2")}}, - {"key": {S: aws.String("key3")}}, - }, pages) - assert.Equal(t, 3, numPages) - assert.True(t, gotToEnd) - assert.Nil(t, params.ExclusiveStartKey) -} - -// Use DynamoDB methods for simplicity -func TestPagination(t *testing.T) { - db := dynamodb.New(unit.Session) - tokens, pages, numPages, gotToEnd := []string{}, []string{}, 0, false - - reqNum := 0 - resps := []*dynamodb.ListTablesOutput{ - {TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")}, - {TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")}, - {TableNames: []*string{aws.String("Table5")}}, - } - - db.Handlers.Send.Clear() // mock sending - db.Handlers.Unmarshal.Clear() - db.Handlers.UnmarshalMeta.Clear() - db.Handlers.ValidateResponse.Clear() - db.Handlers.Build.PushBack(func(r *request.Request) { - in := r.Params.(*dynamodb.ListTablesInput) - if in == nil { - tokens = append(tokens, "") - } else if in.ExclusiveStartTableName != nil { - tokens = append(tokens, *in.ExclusiveStartTableName) - } - }) - db.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = resps[reqNum] - reqNum++ - }) - - params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)} - err := db.ListTablesPages(params, func(p *dynamodb.ListTablesOutput, last bool) bool { - numPages++ - for _, t := range p.TableNames { - pages = append(pages, *t) - } - if last { - if gotToEnd { - assert.Fail(t, "last=true happened twice") - } - gotToEnd = true - } - return true - }) - - assert.Equal(t, []string{"Table2", "Table4"}, tokens) - assert.Equal(t, []string{"Table1", "Table2", "Table3", "Table4", "Table5"}, pages) - assert.Equal(t, 3, numPages) - assert.True(t, gotToEnd) - assert.Nil(t, err) - assert.Nil(t, params.ExclusiveStartTableName) -} - -// Use DynamoDB methods for simplicity -func TestPaginationEachPage(t *testing.T) { - db := dynamodb.New(unit.Session) - tokens, pages, numPages, gotToEnd := []string{}, []string{}, 0, false - - reqNum := 0 - resps := []*dynamodb.ListTablesOutput{ - {TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")}, - {TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")}, - {TableNames: []*string{aws.String("Table5")}}, - } - - db.Handlers.Send.Clear() // mock sending - db.Handlers.Unmarshal.Clear() - db.Handlers.UnmarshalMeta.Clear() - db.Handlers.ValidateResponse.Clear() - db.Handlers.Build.PushBack(func(r *request.Request) { - in := r.Params.(*dynamodb.ListTablesInput) - if in == nil { - tokens = append(tokens, "") - } else if in.ExclusiveStartTableName != nil { - tokens = append(tokens, *in.ExclusiveStartTableName) - } - }) - db.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = resps[reqNum] - reqNum++ - }) - - params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)} - req, _ := db.ListTablesRequest(params) - err := req.EachPage(func(p interface{}, last bool) bool { - numPages++ - for _, t := range p.(*dynamodb.ListTablesOutput).TableNames { - pages = append(pages, *t) - } - if last { - if gotToEnd { - assert.Fail(t, "last=true happened twice") - } - gotToEnd = true - } - - return true - }) - - assert.Equal(t, []string{"Table2", "Table4"}, tokens) - assert.Equal(t, []string{"Table1", "Table2", "Table3", "Table4", "Table5"}, pages) - assert.Equal(t, 3, numPages) - assert.True(t, gotToEnd) - assert.Nil(t, err) -} - -// Use DynamoDB methods for simplicity -func TestPaginationEarlyExit(t *testing.T) { - db := dynamodb.New(unit.Session) - numPages, gotToEnd := 0, false - - reqNum := 0 - resps := []*dynamodb.ListTablesOutput{ - {TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")}, - {TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")}, - {TableNames: []*string{aws.String("Table5")}}, - } - - db.Handlers.Send.Clear() // mock sending - db.Handlers.Unmarshal.Clear() - db.Handlers.UnmarshalMeta.Clear() - db.Handlers.ValidateResponse.Clear() - db.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = resps[reqNum] - reqNum++ - }) - - params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)} - err := db.ListTablesPages(params, func(p *dynamodb.ListTablesOutput, last bool) bool { - numPages++ - if numPages == 2 { - return false - } - if last { - if gotToEnd { - assert.Fail(t, "last=true happened twice") - } - gotToEnd = true - } - return true - }) - - assert.Equal(t, 2, numPages) - assert.False(t, gotToEnd) - assert.Nil(t, err) -} - -func TestSkipPagination(t *testing.T) { - client := s3.New(unit.Session) - client.Handlers.Send.Clear() // mock sending - client.Handlers.Unmarshal.Clear() - client.Handlers.UnmarshalMeta.Clear() - client.Handlers.ValidateResponse.Clear() - client.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = &s3.HeadBucketOutput{} - }) - - req, _ := client.HeadBucketRequest(&s3.HeadBucketInput{Bucket: aws.String("bucket")}) - - numPages, gotToEnd := 0, false - req.EachPage(func(p interface{}, last bool) bool { - numPages++ - if last { - gotToEnd = true - } - return true - }) - assert.Equal(t, 1, numPages) - assert.True(t, gotToEnd) -} - -// Use S3 for simplicity -func TestPaginationTruncation(t *testing.T) { - client := s3.New(unit.Session) - - reqNum := 0 - resps := []*s3.ListObjectsOutput{ - {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key1")}}}, - {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key2")}}}, - {IsTruncated: aws.Bool(false), Contents: []*s3.Object{{Key: aws.String("Key3")}}}, - {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key4")}}}, - } - - client.Handlers.Send.Clear() // mock sending - client.Handlers.Unmarshal.Clear() - client.Handlers.UnmarshalMeta.Clear() - client.Handlers.ValidateResponse.Clear() - client.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = resps[reqNum] - reqNum++ - }) - - params := &s3.ListObjectsInput{Bucket: aws.String("bucket")} - - results := []string{} - err := client.ListObjectsPages(params, func(p *s3.ListObjectsOutput, last bool) bool { - results = append(results, *p.Contents[0].Key) - return true - }) - - assert.Equal(t, []string{"Key1", "Key2", "Key3"}, results) - assert.Nil(t, err) - - // Try again without truncation token at all - reqNum = 0 - resps[1].IsTruncated = nil - resps[2].IsTruncated = aws.Bool(true) - results = []string{} - err = client.ListObjectsPages(params, func(p *s3.ListObjectsOutput, last bool) bool { - results = append(results, *p.Contents[0].Key) - return true - }) - - assert.Equal(t, []string{"Key1", "Key2"}, results) - assert.Nil(t, err) -} - -func TestPaginationNilToken(t *testing.T) { - client := route53.New(unit.Session) - - reqNum := 0 - resps := []*route53.ListResourceRecordSetsOutput{ - { - ResourceRecordSets: []*route53.ResourceRecordSet{ - {Name: aws.String("first.example.com.")}, - }, - IsTruncated: aws.Bool(true), - NextRecordName: aws.String("second.example.com."), - NextRecordType: aws.String("MX"), - NextRecordIdentifier: aws.String("second"), - MaxItems: aws.String("1"), - }, - { - ResourceRecordSets: []*route53.ResourceRecordSet{ - {Name: aws.String("second.example.com.")}, - }, - IsTruncated: aws.Bool(true), - NextRecordName: aws.String("third.example.com."), - NextRecordType: aws.String("MX"), - MaxItems: aws.String("1"), - }, - { - ResourceRecordSets: []*route53.ResourceRecordSet{ - {Name: aws.String("third.example.com.")}, - }, - IsTruncated: aws.Bool(false), - MaxItems: aws.String("1"), - }, - } - client.Handlers.Send.Clear() // mock sending - client.Handlers.Unmarshal.Clear() - client.Handlers.UnmarshalMeta.Clear() - client.Handlers.ValidateResponse.Clear() - - idents := []string{} - client.Handlers.Build.PushBack(func(r *request.Request) { - p := r.Params.(*route53.ListResourceRecordSetsInput) - idents = append(idents, aws.StringValue(p.StartRecordIdentifier)) - - }) - client.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = resps[reqNum] - reqNum++ - }) - - params := &route53.ListResourceRecordSetsInput{ - HostedZoneId: aws.String("id-zone"), - } - - results := []string{} - err := client.ListResourceRecordSetsPages(params, func(p *route53.ListResourceRecordSetsOutput, last bool) bool { - results = append(results, *p.ResourceRecordSets[0].Name) - return true - }) - - assert.NoError(t, err) - assert.Equal(t, []string{"", "second", ""}, idents) - assert.Equal(t, []string{"first.example.com.", "second.example.com.", "third.example.com."}, results) -} - -// Benchmarks -var benchResps = []*dynamodb.ListTablesOutput{ - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE")}}, -} - -var benchDb = func() *dynamodb.DynamoDB { - db := dynamodb.New(unit.Session) - db.Handlers.Send.Clear() // mock sending - db.Handlers.Unmarshal.Clear() - db.Handlers.UnmarshalMeta.Clear() - db.Handlers.ValidateResponse.Clear() - return db -} - -func BenchmarkCodegenIterator(b *testing.B) { - reqNum := 0 - db := benchDb() - db.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = benchResps[reqNum] - reqNum++ - }) - - input := &dynamodb.ListTablesInput{Limit: aws.Int64(2)} - iter := func(fn func(*dynamodb.ListTablesOutput, bool) bool) error { - page, _ := db.ListTablesRequest(input) - for ; page != nil; page = page.NextPage() { - page.Send() - out := page.Data.(*dynamodb.ListTablesOutput) - if result := fn(out, !page.HasNextPage()); page.Error != nil || !result { - return page.Error - } - } - return nil - } - - for i := 0; i < b.N; i++ { - reqNum = 0 - iter(func(p *dynamodb.ListTablesOutput, last bool) bool { - return true - }) - } -} - -func BenchmarkEachPageIterator(b *testing.B) { - reqNum := 0 - db := benchDb() - db.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = benchResps[reqNum] - reqNum++ - }) - - input := &dynamodb.ListTablesInput{Limit: aws.Int64(2)} - for i := 0; i < b.N; i++ { - reqNum = 0 - req, _ := db.ListTablesRequest(input) - req.EachPage(func(p interface{}, last bool) bool { - return true - }) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go deleted file mode 100644 index 4828dff7fd..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go +++ /dev/null @@ -1,261 +0,0 @@ -package request_test - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "io/ioutil" - "net/http" - "runtime" - "testing" - "time" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting" -) - -type testData struct { - Data string -} - -func body(str string) io.ReadCloser { - return ioutil.NopCloser(bytes.NewReader([]byte(str))) -} - -func unmarshal(req *request.Request) { - defer req.HTTPResponse.Body.Close() - if req.Data != nil { - json.NewDecoder(req.HTTPResponse.Body).Decode(req.Data) - } - return -} - -func unmarshalError(req *request.Request) { - bodyBytes, err := ioutil.ReadAll(req.HTTPResponse.Body) - if err != nil { - req.Error = awserr.New("UnmarshaleError", req.HTTPResponse.Status, err) - return - } - if len(bodyBytes) == 0 { - req.Error = awserr.NewRequestFailure( - awserr.New("UnmarshaleError", req.HTTPResponse.Status, fmt.Errorf("empty body")), - req.HTTPResponse.StatusCode, - "", - ) - return - } - var jsonErr jsonErrorResponse - if err := json.Unmarshal(bodyBytes, &jsonErr); err != nil { - req.Error = awserr.New("UnmarshaleError", "JSON unmarshal", err) - return - } - req.Error = awserr.NewRequestFailure( - awserr.New(jsonErr.Code, jsonErr.Message, nil), - req.HTTPResponse.StatusCode, - "", - ) -} - -type jsonErrorResponse struct { - Code string `json:"__type"` - Message string `json:"message"` -} - -// test that retries occur for 5xx status codes -func TestRequestRecoverRetry5xx(t *testing.T) { - reqNum := 0 - reqs := []http.Response{ - {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - {StatusCode: 501, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - {StatusCode: 200, Body: body(`{"data":"valid"}`)}, - } - - s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10)) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &reqs[reqNum] - reqNum++ - }) - out := &testData{} - r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) - err := r.Send() - assert.Nil(t, err) - assert.Equal(t, 2, int(r.RetryCount)) - assert.Equal(t, "valid", out.Data) -} - -// test that retries occur for 4xx status codes with a response type that can be retried - see `shouldRetry` -func TestRequestRecoverRetry4xxRetryable(t *testing.T) { - reqNum := 0 - reqs := []http.Response{ - {StatusCode: 400, Body: body(`{"__type":"Throttling","message":"Rate exceeded."}`)}, - {StatusCode: 429, Body: body(`{"__type":"ProvisionedThroughputExceededException","message":"Rate exceeded."}`)}, - {StatusCode: 200, Body: body(`{"data":"valid"}`)}, - } - - s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10)) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &reqs[reqNum] - reqNum++ - }) - out := &testData{} - r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) - err := r.Send() - assert.Nil(t, err) - assert.Equal(t, 2, int(r.RetryCount)) - assert.Equal(t, "valid", out.Data) -} - -// test that retries don't occur for 4xx status codes with a response type that can't be retried -func TestRequest4xxUnretryable(t *testing.T) { - s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10)) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &http.Response{StatusCode: 401, Body: body(`{"__type":"SignatureDoesNotMatch","message":"Signature does not match."}`)} - }) - out := &testData{} - r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) - err := r.Send() - assert.NotNil(t, err) - if e, ok := err.(awserr.RequestFailure); ok { - assert.Equal(t, 401, e.StatusCode()) - } else { - assert.Fail(t, "Expected error to be a service failure") - } - assert.Equal(t, "SignatureDoesNotMatch", err.(awserr.Error).Code()) - assert.Equal(t, "Signature does not match.", err.(awserr.Error).Message()) - assert.Equal(t, 0, int(r.RetryCount)) -} - -func TestRequestExhaustRetries(t *testing.T) { - delays := []time.Duration{} - sleepDelay := func(delay time.Duration) { - delays = append(delays, delay) - } - - reqNum := 0 - reqs := []http.Response{ - {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - } - - s := awstesting.NewClient(aws.NewConfig().WithSleepDelay(sleepDelay)) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &reqs[reqNum] - reqNum++ - }) - r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - err := r.Send() - assert.NotNil(t, err) - if e, ok := err.(awserr.RequestFailure); ok { - assert.Equal(t, 500, e.StatusCode()) - } else { - assert.Fail(t, "Expected error to be a service failure") - } - assert.Equal(t, "UnknownError", err.(awserr.Error).Code()) - assert.Equal(t, "An error occurred.", err.(awserr.Error).Message()) - assert.Equal(t, 3, int(r.RetryCount)) - - expectDelays := []struct{ min, max time.Duration }{{30, 59}, {60, 118}, {120, 236}} - for i, v := range delays { - min := expectDelays[i].min * time.Millisecond - max := expectDelays[i].max * time.Millisecond - assert.True(t, min <= v && v <= max, - "Expect delay to be within range, i:%d, v:%s, min:%s, max:%s", i, v, min, max) - } -} - -// test that the request is retried after the credentials are expired. -func TestRequestRecoverExpiredCreds(t *testing.T) { - reqNum := 0 - reqs := []http.Response{ - {StatusCode: 400, Body: body(`{"__type":"ExpiredTokenException","message":"expired token"}`)}, - {StatusCode: 200, Body: body(`{"data":"valid"}`)}, - } - - s := awstesting.NewClient(&aws.Config{MaxRetries: aws.Int(10), Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "")}) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - - credExpiredBeforeRetry := false - credExpiredAfterRetry := false - - s.Handlers.AfterRetry.PushBack(func(r *request.Request) { - credExpiredAfterRetry = r.Config.Credentials.IsExpired() - }) - - s.Handlers.Sign.Clear() - s.Handlers.Sign.PushBack(func(r *request.Request) { - r.Config.Credentials.Get() - }) - s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &reqs[reqNum] - reqNum++ - }) - out := &testData{} - r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) - err := r.Send() - assert.Nil(t, err) - - assert.False(t, credExpiredBeforeRetry, "Expect valid creds before retry check") - assert.True(t, credExpiredAfterRetry, "Expect expired creds after retry check") - assert.False(t, s.Config.Credentials.IsExpired(), "Expect valid creds after cred expired recovery") - - assert.Equal(t, 1, int(r.RetryCount)) - assert.Equal(t, "valid", out.Data) -} - -func TestMakeAddtoUserAgentHandler(t *testing.T) { - fn := request.MakeAddToUserAgentHandler("name", "version", "extra1", "extra2") - r := &request.Request{HTTPRequest: &http.Request{Header: http.Header{}}} - r.HTTPRequest.Header.Set("User-Agent", "foo/bar") - fn(r) - - assert.Equal(t, "foo/bar name/version (extra1; extra2)", r.HTTPRequest.Header.Get("User-Agent")) -} - -func TestMakeAddtoUserAgentFreeFormHandler(t *testing.T) { - fn := request.MakeAddToUserAgentFreeFormHandler("name/version (extra1; extra2)") - r := &request.Request{HTTPRequest: &http.Request{Header: http.Header{}}} - r.HTTPRequest.Header.Set("User-Agent", "foo/bar") - fn(r) - - assert.Equal(t, "foo/bar name/version (extra1; extra2)", r.HTTPRequest.Header.Get("User-Agent")) -} - -func TestRequestUserAgent(t *testing.T) { - s := awstesting.NewClient(&aws.Config{Region: aws.String("us-east-1")}) - // s.Handlers.Validate.Clear() - - req := s.NewRequest(&request.Operation{Name: "Operation"}, nil, &testData{}) - req.HTTPRequest.Header.Set("User-Agent", "foo/bar") - assert.NoError(t, req.Build()) - - expectUA := fmt.Sprintf("foo/bar %s/%s (%s; %s; %s)", - aws.SDKName, aws.SDKVersion, runtime.Version(), runtime.GOOS, runtime.GOARCH) - assert.Equal(t, expectUA, req.HTTPRequest.Header.Get("User-Agent")) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go deleted file mode 100644 index e56c02fc66..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package session_test - -import ( - "net/http" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" -) - -func TestNewDefaultSession(t *testing.T) { - s := session.New(&aws.Config{Region: aws.String("region")}) - - assert.Equal(t, "region", *s.Config.Region) - assert.Equal(t, http.DefaultClient, s.Config.HTTPClient) - assert.NotNil(t, s.Config.Logger) - assert.Equal(t, aws.LogOff, *s.Config.LogLevel) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/types_test.go b/vendor/github.com/aws/aws-sdk-go/aws/types_test.go deleted file mode 100644 index a4ed20e7d2..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/types_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package aws - -import ( - "math/rand" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestWriteAtBuffer(t *testing.T) { - b := &WriteAtBuffer{} - - n, err := b.WriteAt([]byte{1}, 0) - assert.NoError(t, err) - assert.Equal(t, 1, n) - - n, err = b.WriteAt([]byte{1, 1, 1}, 5) - assert.NoError(t, err) - assert.Equal(t, 3, n) - - n, err = b.WriteAt([]byte{2}, 1) - assert.NoError(t, err) - assert.Equal(t, 1, n) - - n, err = b.WriteAt([]byte{3}, 2) - assert.NoError(t, err) - assert.Equal(t, 1, n) - - assert.Equal(t, []byte{1, 2, 3, 0, 0, 1, 1, 1}, b.Bytes()) -} - -func BenchmarkWriteAtBuffer(b *testing.B) { - buf := &WriteAtBuffer{} - r := rand.New(rand.NewSource(1)) - - b.ResetTimer() - for i := 0; i < b.N; i++ { - to := r.Intn(10) * 4096 - bs := make([]byte, to) - buf.WriteAt(bs, r.Int63n(10)*4096) - } -} - -func BenchmarkWriteAtBufferParallel(b *testing.B) { - buf := &WriteAtBuffer{} - r := rand.New(rand.NewSource(1)) - - b.ResetTimer() - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - to := r.Intn(10) * 4096 - bs := make([]byte, to) - buf.WriteAt(bs, r.Int63n(10)*4096) - } - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints_test.go b/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints_test.go deleted file mode 100644 index 2add48890b..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package endpoints_test - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/private/endpoints" -) - -func TestGenericEndpoint(t *testing.T) { - name := "service" - region := "mock-region-1" - - ep, sr := endpoints.EndpointForRegion(name, region, false) - assert.Equal(t, fmt.Sprintf("https://%s.%s.amazonaws.com", name, region), ep) - assert.Empty(t, sr) -} - -func TestGlobalEndpoints(t *testing.T) { - region := "mock-region-1" - svcs := []string{"cloudfront", "iam", "importexport", "route53", "sts", "waf"} - - for _, name := range svcs { - ep, sr := endpoints.EndpointForRegion(name, region, false) - assert.Equal(t, fmt.Sprintf("https://%s.amazonaws.com", name), ep) - assert.Equal(t, "us-east-1", sr) - } -} - -func TestServicesInCN(t *testing.T) { - region := "cn-north-1" - svcs := []string{"cloudfront", "iam", "importexport", "route53", "sts", "s3", "waf"} - - for _, name := range svcs { - ep, sr := endpoints.EndpointForRegion(name, region, false) - assert.Equal(t, fmt.Sprintf("https://%s.%s.amazonaws.com.cn", name, region), ep) - assert.Empty(t, sr) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_bench_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_bench_test.go deleted file mode 100644 index e135b93601..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_bench_test.go +++ /dev/null @@ -1,85 +0,0 @@ -// +build bench - -package ec2query_test - -import ( - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/protocol/ec2query" - "github.com/aws/aws-sdk-go/service/ec2" -) - -func BenchmarkEC2QueryBuild_Complex_ec2AuthorizeSecurityGroupEgress(b *testing.B) { - params := &ec2.AuthorizeSecurityGroupEgressInput{ - GroupId: aws.String("String"), // Required - CidrIp: aws.String("String"), - DryRun: aws.Bool(true), - FromPort: aws.Int64(1), - IpPermissions: []*ec2.IpPermission{ - { // Required - FromPort: aws.Int64(1), - IpProtocol: aws.String("String"), - IpRanges: []*ec2.IpRange{ - { // Required - CidrIp: aws.String("String"), - }, - // More values... - }, - PrefixListIds: []*ec2.PrefixListId{ - { // Required - PrefixListId: aws.String("String"), - }, - // More values... - }, - ToPort: aws.Int64(1), - UserIdGroupPairs: []*ec2.UserIdGroupPair{ - { // Required - GroupId: aws.String("String"), - GroupName: aws.String("String"), - UserId: aws.String("String"), - }, - // More values... - }, - }, - // More values... - }, - IpProtocol: aws.String("String"), - SourceSecurityGroupName: aws.String("String"), - SourceSecurityGroupOwnerId: aws.String("String"), - ToPort: aws.Int64(1), - } - - benchEC2QueryBuild(b, "AuthorizeSecurityGroupEgress", params) -} - -func BenchmarkEC2QueryBuild_Simple_ec2AttachNetworkInterface(b *testing.B) { - params := &ec2.AttachNetworkInterfaceInput{ - DeviceIndex: aws.Int64(1), // Required - InstanceId: aws.String("String"), // Required - NetworkInterfaceId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - - benchEC2QueryBuild(b, "AttachNetworkInterface", params) -} - -func benchEC2QueryBuild(b *testing.B, opName string, params interface{}) { - svc := awstesting.NewClient() - svc.ServiceName = "ec2" - svc.APIVersion = "2015-04-15" - - for i := 0; i < b.N; i++ { - r := svc.NewRequest(&request.Operation{ - Name: opName, - HTTPMethod: "POST", - HTTPPath: "/", - }, params, nil) - ec2query.Build(r) - if r.Error != nil { - b.Fatal("Unexpected error", r.Error) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_test.go deleted file mode 100644 index 5ada8421c2..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_test.go +++ /dev/null @@ -1,983 +0,0 @@ -package ec2query_test - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "io" - "io/ioutil" - "net/http" - "net/url" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/protocol/ec2query" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" - "github.com/aws/aws-sdk-go/private/signer/v4" - "github.com/aws/aws-sdk-go/private/util" - "github.com/stretchr/testify/assert" -) - -var _ bytes.Buffer // always import bytes -var _ http.Request -var _ json.Marshaler -var _ time.Time -var _ xmlutil.XMLNode -var _ xml.Attr -var _ = awstesting.GenerateAssertions -var _ = ioutil.Discard -var _ = util.Trim("") -var _ = url.Values{} -var _ = io.EOF -var _ = aws.String - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService1ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService1ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService1ProtocolTest client from just a session. -// svc := inputservice1protocoltest.New(mySession) -// -// // Create a InputService1ProtocolTest client with additional configuration -// svc := inputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService1ProtocolTest { - c := p.ClientConfig("inputservice1protocoltest", cfgs...) - return newInputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService1ProtocolTest { - svc := &InputService1ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice1protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService1ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService1TestCaseOperation1 = "OperationName" - -// InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputService1TestCaseOperation1Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService1TestCaseOperation1, - } - - if input == nil { - input = &InputService1TestShapeInputService1TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService1TestShapeInputService1TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputService1TestCaseOperation1Input) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) { - req, out := c.InputService1TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService1TestShapeInputService1TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Bar *string `type:"string"` - - Foo *string `type:"string"` -} - -type InputService1TestShapeInputService1TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService2ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService2ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService2ProtocolTest client from just a session. -// svc := inputservice2protocoltest.New(mySession) -// -// // Create a InputService2ProtocolTest client with additional configuration -// svc := inputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService2ProtocolTest { - c := p.ClientConfig("inputservice2protocoltest", cfgs...) - return newInputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService2ProtocolTest { - svc := &InputService2ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice2protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService2ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService2TestCaseOperation1 = "OperationName" - -// InputService2TestCaseOperation1Request generates a request for the InputService2TestCaseOperation1 operation. -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputService2TestCaseOperation1Input) (req *request.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService2TestCaseOperation1, - } - - if input == nil { - input = &InputService2TestShapeInputService2TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService2TestShapeInputService2TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputService2TestCaseOperation1Input) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) { - req, out := c.InputService2TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService2TestShapeInputService2TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Bar *string `locationName:"barLocationName" type:"string"` - - Foo *string `type:"string"` - - Yuck *string `locationName:"yuckLocationName" queryName:"yuckQueryName" type:"string"` -} - -type InputService2TestShapeInputService2TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService3ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService3ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService3ProtocolTest client from just a session. -// svc := inputservice3protocoltest.New(mySession) -// -// // Create a InputService3ProtocolTest client with additional configuration -// svc := inputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService3ProtocolTest { - c := p.ClientConfig("inputservice3protocoltest", cfgs...) - return newInputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService3ProtocolTest { - svc := &InputService3ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice3protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService3ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService3TestCaseOperation1 = "OperationName" - -// InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputService3TestCaseOperation1Input) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService3TestCaseOperation1, - } - - if input == nil { - input = &InputService3TestShapeInputService3TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService3TestShapeInputService3TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputService3TestCaseOperation1Input) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) { - req, out := c.InputService3TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService3TestShapeInputService3TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - StructArg *InputService3TestShapeStructType `locationName:"Struct" type:"structure"` -} - -type InputService3TestShapeInputService3TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService3TestShapeStructType struct { - _ struct{} `type:"structure"` - - ScalarArg *string `locationName:"Scalar" type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService4ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService4ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService4ProtocolTest client from just a session. -// svc := inputservice4protocoltest.New(mySession) -// -// // Create a InputService4ProtocolTest client with additional configuration -// svc := inputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService4ProtocolTest { - c := p.ClientConfig("inputservice4protocoltest", cfgs...) - return newInputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService4ProtocolTest { - svc := &InputService4ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice4protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService4ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService4TestCaseOperation1 = "OperationName" - -// InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputService4TestCaseOperation1Input) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService4TestCaseOperation1, - } - - if input == nil { - input = &InputService4TestShapeInputService4TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService4TestShapeInputService4TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputService4TestCaseOperation1Input) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) { - req, out := c.InputService4TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService4TestShapeInputService4TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - ListArg []*string `type:"list"` -} - -type InputService4TestShapeInputService4TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService5ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService5ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService5ProtocolTest client from just a session. -// svc := inputservice5protocoltest.New(mySession) -// -// // Create a InputService5ProtocolTest client with additional configuration -// svc := inputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService5ProtocolTest { - c := p.ClientConfig("inputservice5protocoltest", cfgs...) - return newInputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService5ProtocolTest { - svc := &InputService5ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice5protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService5ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService5TestCaseOperation1 = "OperationName" - -// InputService5TestCaseOperation1Request generates a request for the InputService5TestCaseOperation1 operation. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputService5TestCaseOperation1Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation1, - } - - if input == nil { - input = &InputService5TestShapeInputService5TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService5TestShapeInputService5TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputService5TestCaseOperation1Input) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) { - req, out := c.InputService5TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService5TestShapeInputService5TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - ListArg []*string `locationName:"ListMemberName" locationNameList:"item" type:"list"` -} - -type InputService5TestShapeInputService5TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService6ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService6ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService6ProtocolTest client from just a session. -// svc := inputservice6protocoltest.New(mySession) -// -// // Create a InputService6ProtocolTest client with additional configuration -// svc := inputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService6ProtocolTest { - c := p.ClientConfig("inputservice6protocoltest", cfgs...) - return newInputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService6ProtocolTest { - svc := &InputService6ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice6protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService6ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService6TestCaseOperation1 = "OperationName" - -// InputService6TestCaseOperation1Request generates a request for the InputService6TestCaseOperation1 operation. -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputService6TestCaseOperation1Input) (req *request.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService6TestCaseOperation1, - } - - if input == nil { - input = &InputService6TestShapeInputService6TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService6TestShapeInputService6TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputService6TestCaseOperation1Input) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) { - req, out := c.InputService6TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService6TestShapeInputService6TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - ListArg []*string `locationName:"ListMemberName" queryName:"ListQueryName" locationNameList:"item" type:"list"` -} - -type InputService6TestShapeInputService6TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService7ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService7ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService7ProtocolTest client from just a session. -// svc := inputservice7protocoltest.New(mySession) -// -// // Create a InputService7ProtocolTest client with additional configuration -// svc := inputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService7ProtocolTest { - c := p.ClientConfig("inputservice7protocoltest", cfgs...) - return newInputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService7ProtocolTest { - svc := &InputService7ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice7protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService7ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService7TestCaseOperation1 = "OperationName" - -// InputService7TestCaseOperation1Request generates a request for the InputService7TestCaseOperation1 operation. -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputService7TestCaseOperation1Input) (req *request.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService7TestCaseOperation1, - } - - if input == nil { - input = &InputService7TestShapeInputService7TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService7TestShapeInputService7TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputService7TestCaseOperation1Input) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) { - req, out := c.InputService7TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService7TestShapeInputService7TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - BlobArg []byte `type:"blob"` -} - -type InputService7TestShapeInputService7TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService8ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService8ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService8ProtocolTest client from just a session. -// svc := inputservice8protocoltest.New(mySession) -// -// // Create a InputService8ProtocolTest client with additional configuration -// svc := inputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService8ProtocolTest { - c := p.ClientConfig("inputservice8protocoltest", cfgs...) - return newInputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService8ProtocolTest { - svc := &InputService8ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice8protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService8ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService8TestCaseOperation1 = "OperationName" - -// InputService8TestCaseOperation1Request generates a request for the InputService8TestCaseOperation1 operation. -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputService8TestCaseOperation1Input) (req *request.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService8TestCaseOperation1, - } - - if input == nil { - input = &InputService8TestShapeInputService8TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService8TestShapeInputService8TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputService8TestCaseOperation1Input) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) { - req, out := c.InputService8TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService8TestShapeInputService8TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - TimeArg *time.Time `type:"timestamp" timestampFormat:"iso8601"` -} - -type InputService8TestShapeInputService8TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// -// Tests begin here -// - -func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService1TestShapeInputService1TestCaseOperation1Input{ - Bar: aws.String("val2"), - Foo: aws.String("val1"), - } - req, _ := svc.InputService1TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - ec2query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&Bar=val2&Foo=val1&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService2ProtocolTestStructureWithLocationNameAndQueryNameAppliedToMembersCase1(t *testing.T) { - sess := session.New() - svc := NewInputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService2TestShapeInputService2TestCaseOperation1Input{ - Bar: aws.String("val2"), - Foo: aws.String("val1"), - Yuck: aws.String("val3"), - } - req, _ := svc.InputService2TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - ec2query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&BarLocationName=val2&Foo=val1&Version=2014-01-01&yuckQueryName=val3`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService3ProtocolTestNestedStructureMembersCase1(t *testing.T) { - sess := session.New() - svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService3TestShapeInputService3TestCaseOperation1Input{ - StructArg: &InputService3TestShapeStructType{ - ScalarArg: aws.String("foo"), - }, - } - req, _ := svc.InputService3TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - ec2query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&Struct.Scalar=foo&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService4ProtocolTestListTypesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService4TestShapeInputService4TestCaseOperation1Input{ - ListArg: []*string{ - aws.String("foo"), - aws.String("bar"), - aws.String("baz"), - }, - } - req, _ := svc.InputService4TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - ec2query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&ListArg.1=foo&ListArg.2=bar&ListArg.3=baz&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService5ProtocolTestListWithLocationNameAppliedToMemberCase1(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService5TestShapeInputService5TestCaseOperation1Input{ - ListArg: []*string{ - aws.String("a"), - aws.String("b"), - aws.String("c"), - }, - } - req, _ := svc.InputService5TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - ec2query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&ListMemberName.1=a&ListMemberName.2=b&ListMemberName.3=c&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService6ProtocolTestListWithLocationNameAndQueryNameCase1(t *testing.T) { - sess := session.New() - svc := NewInputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService6TestShapeInputService6TestCaseOperation1Input{ - ListArg: []*string{ - aws.String("a"), - aws.String("b"), - aws.String("c"), - }, - } - req, _ := svc.InputService6TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - ec2query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&ListQueryName.1=a&ListQueryName.2=b&ListQueryName.3=c&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService7ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService7TestShapeInputService7TestCaseOperation1Input{ - BlobArg: []byte("foo"), - } - req, _ := svc.InputService7TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - ec2query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&BlobArg=Zm9v&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService8ProtocolTestTimestampValuesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService8TestShapeInputService8TestCaseOperation1Input{ - TimeArg: aws.Time(time.Unix(1422172800, 0)), - } - req, _ := svc.InputService8TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - ec2query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&TimeArg=2015-01-25T08%3A00%3A00Z&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal_test.go deleted file mode 100644 index 938c184ca6..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal_test.go +++ /dev/null @@ -1,1056 +0,0 @@ -package ec2query_test - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "io" - "io/ioutil" - "net/http" - "net/url" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/protocol/ec2query" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" - "github.com/aws/aws-sdk-go/private/signer/v4" - "github.com/aws/aws-sdk-go/private/util" - "github.com/stretchr/testify/assert" -) - -var _ bytes.Buffer // always import bytes -var _ http.Request -var _ json.Marshaler -var _ time.Time -var _ xmlutil.XMLNode -var _ xml.Attr -var _ = awstesting.GenerateAssertions -var _ = ioutil.Discard -var _ = util.Trim("") -var _ = url.Values{} -var _ = io.EOF -var _ = aws.String - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService1ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService1ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService1ProtocolTest client from just a session. -// svc := outputservice1protocoltest.New(mySession) -// -// // Create a OutputService1ProtocolTest client with additional configuration -// svc := outputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService1ProtocolTest { - c := p.ClientConfig("outputservice1protocoltest", cfgs...) - return newOutputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService1ProtocolTest { - svc := &OutputService1ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice1protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService1ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService1TestCaseOperation1 = "OperationName" - -// OutputService1TestCaseOperation1Request generates a request for the OutputService1TestCaseOperation1 operation. -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService1TestCaseOperation1, - } - - if input == nil { - input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService1TestShapeOutputService1TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) { - req, out := c.OutputService1TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService1TestShapeOutputService1TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService1TestShapeOutputService1TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Char *string `type:"character"` - - Double *float64 `type:"double"` - - FalseBool *bool `type:"boolean"` - - Float *float64 `type:"float"` - - Long *int64 `type:"long"` - - Num *int64 `locationName:"FooNum" type:"integer"` - - Str *string `type:"string"` - - TrueBool *bool `type:"boolean"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService2ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService2ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService2ProtocolTest client from just a session. -// svc := outputservice2protocoltest.New(mySession) -// -// // Create a OutputService2ProtocolTest client with additional configuration -// svc := outputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService2ProtocolTest { - c := p.ClientConfig("outputservice2protocoltest", cfgs...) - return newOutputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService2ProtocolTest { - svc := &OutputService2ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice2protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService2ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService2TestCaseOperation1 = "OperationName" - -// OutputService2TestCaseOperation1Request generates a request for the OutputService2TestCaseOperation1 operation. -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *request.Request, output *OutputService2TestShapeOutputService2TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService2TestCaseOperation1, - } - - if input == nil { - input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService2TestShapeOutputService2TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) { - req, out := c.OutputService2TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService2TestShapeOutputService2TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService2TestShapeOutputService2TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Blob []byte `type:"blob"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService3ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService3ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService3ProtocolTest client from just a session. -// svc := outputservice3protocoltest.New(mySession) -// -// // Create a OutputService3ProtocolTest client with additional configuration -// svc := outputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService3ProtocolTest { - c := p.ClientConfig("outputservice3protocoltest", cfgs...) - return newOutputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService3ProtocolTest { - svc := &OutputService3ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice3protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService3ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService3TestCaseOperation1 = "OperationName" - -// OutputService3TestCaseOperation1Request generates a request for the OutputService3TestCaseOperation1 operation. -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *request.Request, output *OutputService3TestShapeOutputService3TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService3TestCaseOperation1, - } - - if input == nil { - input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService3TestShapeOutputService3TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) { - req, out := c.OutputService3TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService3TestShapeOutputService3TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService3TestShapeOutputService3TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `type:"list"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService4ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService4ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService4ProtocolTest client from just a session. -// svc := outputservice4protocoltest.New(mySession) -// -// // Create a OutputService4ProtocolTest client with additional configuration -// svc := outputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService4ProtocolTest { - c := p.ClientConfig("outputservice4protocoltest", cfgs...) - return newOutputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService4ProtocolTest { - svc := &OutputService4ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice4protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService4ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService4TestCaseOperation1 = "OperationName" - -// OutputService4TestCaseOperation1Request generates a request for the OutputService4TestCaseOperation1 operation. -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *request.Request, output *OutputService4TestShapeOutputService4TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService4TestCaseOperation1, - } - - if input == nil { - input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService4TestShapeOutputService4TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputService4TestCaseOperation1Output, error) { - req, out := c.OutputService4TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService4TestShapeOutputService4TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService4TestShapeOutputService4TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `locationNameList:"item" type:"list"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService5ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService5ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService5ProtocolTest client from just a session. -// svc := outputservice5protocoltest.New(mySession) -// -// // Create a OutputService5ProtocolTest client with additional configuration -// svc := outputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService5ProtocolTest { - c := p.ClientConfig("outputservice5protocoltest", cfgs...) - return newOutputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService5ProtocolTest { - svc := &OutputService5ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice5protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService5ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService5TestCaseOperation1 = "OperationName" - -// OutputService5TestCaseOperation1Request generates a request for the OutputService5TestCaseOperation1 operation. -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *request.Request, output *OutputService5TestShapeOutputService5TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService5TestCaseOperation1, - } - - if input == nil { - input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService5TestShapeOutputService5TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) { - req, out := c.OutputService5TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService5TestShapeOutputService5TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService5TestShapeOutputService5TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `type:"list" flattened:"true"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService6ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService6ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService6ProtocolTest client from just a session. -// svc := outputservice6protocoltest.New(mySession) -// -// // Create a OutputService6ProtocolTest client with additional configuration -// svc := outputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService6ProtocolTest { - c := p.ClientConfig("outputservice6protocoltest", cfgs...) - return newOutputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService6ProtocolTest { - svc := &OutputService6ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice6protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService6ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService6TestCaseOperation1 = "OperationName" - -// OutputService6TestCaseOperation1Request generates a request for the OutputService6TestCaseOperation1 operation. -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *request.Request, output *OutputService6TestShapeOutputService6TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService6TestCaseOperation1, - } - - if input == nil { - input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService6TestShapeOutputService6TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) { - req, out := c.OutputService6TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService6TestShapeOutputService6TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService6TestShapeOutputService6TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Map map[string]*OutputService6TestShapeStructureType `type:"map"` -} - -type OutputService6TestShapeStructureType struct { - _ struct{} `type:"structure"` - - Foo *string `locationName:"foo" type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService7ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService7ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService7ProtocolTest client from just a session. -// svc := outputservice7protocoltest.New(mySession) -// -// // Create a OutputService7ProtocolTest client with additional configuration -// svc := outputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService7ProtocolTest { - c := p.ClientConfig("outputservice7protocoltest", cfgs...) - return newOutputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService7ProtocolTest { - svc := &OutputService7ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice7protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService7ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService7TestCaseOperation1 = "OperationName" - -// OutputService7TestCaseOperation1Request generates a request for the OutputService7TestCaseOperation1 operation. -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *request.Request, output *OutputService7TestShapeOutputService7TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService7TestCaseOperation1, - } - - if input == nil { - input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService7TestShapeOutputService7TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) { - req, out := c.OutputService7TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService7TestShapeOutputService7TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService7TestShapeOutputService7TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Map map[string]*string `type:"map" flattened:"true"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService8ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService8ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService8ProtocolTest client from just a session. -// svc := outputservice8protocoltest.New(mySession) -// -// // Create a OutputService8ProtocolTest client with additional configuration -// svc := outputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService8ProtocolTest { - c := p.ClientConfig("outputservice8protocoltest", cfgs...) - return newOutputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService8ProtocolTest { - svc := &OutputService8ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice8protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService8ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService8TestCaseOperation1 = "OperationName" - -// OutputService8TestCaseOperation1Request generates a request for the OutputService8TestCaseOperation1 operation. -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *request.Request, output *OutputService8TestShapeOutputService8TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService8TestCaseOperation1, - } - - if input == nil { - input = &OutputService8TestShapeOutputService8TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService8TestShapeOutputService8TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (*OutputService8TestShapeOutputService8TestCaseOperation1Output, error) { - req, out := c.OutputService8TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService8TestShapeOutputService8TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService8TestShapeOutputService8TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Map map[string]*string `locationNameKey:"foo" locationNameValue:"bar" type:"map" flattened:"true"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService9ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService9ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService9ProtocolTest client from just a session. -// svc := outputservice9protocoltest.New(mySession) -// -// // Create a OutputService9ProtocolTest client with additional configuration -// svc := outputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService9ProtocolTest { - c := p.ClientConfig("outputservice9protocoltest", cfgs...) - return newOutputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService9ProtocolTest { - svc := &OutputService9ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice9protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService9ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService9TestCaseOperation1 = "OperationName" - -// OutputService9TestCaseOperation1Request generates a request for the OutputService9TestCaseOperation1 operation. -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *request.Request, output *OutputService9TestShapeOutputService9TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService9TestCaseOperation1, - } - - if input == nil { - input = &OutputService9TestShapeOutputService9TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService9TestShapeOutputService9TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (*OutputService9TestShapeOutputService9TestCaseOperation1Output, error) { - req, out := c.OutputService9TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService9TestShapeOutputService9TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService9TestShapeOutputService9TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Foo *string `type:"string"` -} - -// -// Tests begin here -// - -func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("myname123falsetrue1.21.3200arequest-id")) - req, out := svc.OutputService1TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - ec2query.UnmarshalMeta(req) - ec2query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "a", *out.Char) - assert.Equal(t, 1.3, *out.Double) - assert.Equal(t, false, *out.FalseBool) - assert.Equal(t, 1.2, *out.Float) - assert.Equal(t, int64(200), *out.Long) - assert.Equal(t, int64(123), *out.Num) - assert.Equal(t, "myname", *out.Str) - assert.Equal(t, true, *out.TrueBool) - -} - -func TestOutputService2ProtocolTestBlobCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("dmFsdWU=requestid")) - req, out := svc.OutputService2TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - ec2query.UnmarshalMeta(req) - ec2query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "value", string(out.Blob)) - -} - -func TestOutputService3ProtocolTestListsCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc123requestid")) - req, out := svc.OutputService3TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - ec2query.UnmarshalMeta(req) - ec2query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "abc", *out.ListMember[0]) - assert.Equal(t, "123", *out.ListMember[1]) - -} - -func TestOutputService4ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc123requestid")) - req, out := svc.OutputService4TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - ec2query.UnmarshalMeta(req) - ec2query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "abc", *out.ListMember[0]) - assert.Equal(t, "123", *out.ListMember[1]) - -} - -func TestOutputService5ProtocolTestFlattenedListCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc123requestid")) - req, out := svc.OutputService5TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - ec2query.UnmarshalMeta(req) - ec2query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "abc", *out.ListMember[0]) - assert.Equal(t, "123", *out.ListMember[1]) - -} - -func TestOutputService6ProtocolTestNormalMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) - req, out := svc.OutputService6TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - ec2query.UnmarshalMeta(req) - ec2query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "bam", *out.Map["baz"].Foo) - assert.Equal(t, "bar", *out.Map["qux"].Foo) - -} - -func TestOutputService7ProtocolTestFlattenedMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) - req, out := svc.OutputService7TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - ec2query.UnmarshalMeta(req) - ec2query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "bam", *out.Map["baz"]) - assert.Equal(t, "bar", *out.Map["qux"]) - -} - -func TestOutputService8ProtocolTestNamedMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) - req, out := svc.OutputService8TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - ec2query.UnmarshalMeta(req) - ec2query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "bam", *out.Map["baz"]) - assert.Equal(t, "bar", *out.Map["qux"]) - -} - -func TestOutputService9ProtocolTestEmptyStringCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("requestid")) - req, out := svc.OutputService9TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - ec2query.UnmarshalMeta(req) - ec2query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "", *out.Foo) - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build_test.go deleted file mode 100644 index cb9cc458ff..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build_test.go +++ /dev/null @@ -1,100 +0,0 @@ -package jsonutil_test - -import ( - "encoding/json" - "testing" - "time" - - "github.com/aws/aws-sdk-go/private/protocol/json/jsonutil" - "github.com/stretchr/testify/assert" -) - -func S(s string) *string { - return &s -} - -func D(s int64) *int64 { - return &s -} - -func F(s float64) *float64 { - return &s -} - -func T(s time.Time) *time.Time { - return &s -} - -type J struct { - S *string - SS []string - D *int64 - F *float64 - T *time.Time -} - -var jsonTests = []struct { - in interface{} - out string - err string -}{ - { - J{}, - `{}`, - ``, - }, - { - J{ - S: S("str"), - SS: []string{"A", "B", "C"}, - D: D(123), - F: F(4.56), - T: T(time.Unix(987, 0)), - }, - `{"S":"str","SS":["A","B","C"],"D":123,"F":4.56,"T":987}`, - ``, - }, - { - J{ - S: S(`"''"`), - }, - `{"S":"\"''\""}`, - ``, - }, - { - J{ - S: S("\x00føø\u00FF\n\\\"\r\t\b\f"), - }, - `{"S":"\u0000føøÿ\n\\\"\r\t\b\f"}`, - ``, - }, -} - -func TestBuildJSON(t *testing.T) { - for _, test := range jsonTests { - out, err := jsonutil.BuildJSON(test.in) - if test.err != "" { - assert.Error(t, err) - assert.Contains(t, err.Error(), test.err) - } else { - assert.NoError(t, err) - assert.Equal(t, string(out), test.out) - } - } -} - -func BenchmarkBuildJSON(b *testing.B) { - for i := 0; i < b.N; i++ { - for _, test := range jsonTests { - jsonutil.BuildJSON(test.in) - } - } -} - -func BenchmarkStdlibJSON(b *testing.B) { - for i := 0; i < b.N; i++ { - for _, test := range jsonTests { - json.Marshal(test.in) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/build_bench_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/build_bench_test.go deleted file mode 100644 index 563caa05cf..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/build_bench_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// +build bench - -package jsonrpc_test - -import ( - "bytes" - "encoding/json" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/protocol/json/jsonutil" - "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" - "github.com/aws/aws-sdk-go/service/dynamodb" - "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute" -) - -func BenchmarkJSONRPCBuild_Simple_dynamodbPutItem(b *testing.B) { - svc := awstesting.NewClient() - - params := getDynamodbPutItemParams(b) - - for i := 0; i < b.N; i++ { - r := svc.NewRequest(&request.Operation{Name: "Operation"}, params, nil) - jsonrpc.Build(r) - if r.Error != nil { - b.Fatal("Unexpected error", r.Error) - } - } -} - -func BenchmarkJSONUtilBuild_Simple_dynamodbPutItem(b *testing.B) { - svc := awstesting.NewClient() - - params := getDynamodbPutItemParams(b) - - for i := 0; i < b.N; i++ { - r := svc.NewRequest(&request.Operation{Name: "Operation"}, params, nil) - _, err := jsonutil.BuildJSON(r.Params) - if err != nil { - b.Fatal("Unexpected error", err) - } - } -} - -func BenchmarkEncodingJSONMarshal_Simple_dynamodbPutItem(b *testing.B) { - params := getDynamodbPutItemParams(b) - - for i := 0; i < b.N; i++ { - buf := &bytes.Buffer{} - encoder := json.NewEncoder(buf) - if err := encoder.Encode(params); err != nil { - b.Fatal("Unexpected error", err) - } - } -} - -func getDynamodbPutItemParams(b *testing.B) *dynamodb.PutItemInput { - av, err := dynamodbattribute.ConvertToMap(struct { - Key string - Data string - }{Key: "MyKey", Data: "MyData"}) - if err != nil { - b.Fatal("benchPutItem, expect no ConvertToMap errors", err) - } - return &dynamodb.PutItemInput{ - Item: av, - TableName: aws.String("tablename"), - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/build_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/build_test.go deleted file mode 100644 index 24bf4b0460..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/build_test.go +++ /dev/null @@ -1,1152 +0,0 @@ -package jsonrpc_test - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "io" - "io/ioutil" - "net/http" - "net/url" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" - "github.com/aws/aws-sdk-go/private/signer/v4" - "github.com/aws/aws-sdk-go/private/util" - "github.com/stretchr/testify/assert" -) - -var _ bytes.Buffer // always import bytes -var _ http.Request -var _ json.Marshaler -var _ time.Time -var _ xmlutil.XMLNode -var _ xml.Attr -var _ = awstesting.GenerateAssertions -var _ = ioutil.Discard -var _ = util.Trim("") -var _ = url.Values{} -var _ = io.EOF -var _ = aws.String - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService1ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService1ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService1ProtocolTest client from just a session. -// svc := inputservice1protocoltest.New(mySession) -// -// // Create a InputService1ProtocolTest client with additional configuration -// svc := inputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService1ProtocolTest { - c := p.ClientConfig("inputservice1protocoltest", cfgs...) - return newInputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService1ProtocolTest { - svc := &InputService1ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice1protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "1.1", - TargetPrefix: "com.amazonaws.foo", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService1ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService1TestCaseOperation1 = "OperationName" - -// InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputService1TestCaseOperation1Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService1TestCaseOperation1, - HTTPMethod: "POST", - } - - if input == nil { - input = &InputService1TestShapeInputService1TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService1TestShapeInputService1TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputService1TestCaseOperation1Input) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) { - req, out := c.InputService1TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService1TestShapeInputService1TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Name *string `type:"string"` -} - -type InputService1TestShapeInputService1TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService2ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService2ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService2ProtocolTest client from just a session. -// svc := inputservice2protocoltest.New(mySession) -// -// // Create a InputService2ProtocolTest client with additional configuration -// svc := inputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService2ProtocolTest { - c := p.ClientConfig("inputservice2protocoltest", cfgs...) - return newInputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService2ProtocolTest { - svc := &InputService2ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice2protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "1.1", - TargetPrefix: "com.amazonaws.foo", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService2ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService2TestCaseOperation1 = "OperationName" - -// InputService2TestCaseOperation1Request generates a request for the InputService2TestCaseOperation1 operation. -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputService2TestCaseOperation1Input) (req *request.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService2TestCaseOperation1, - } - - if input == nil { - input = &InputService2TestShapeInputService2TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService2TestShapeInputService2TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputService2TestCaseOperation1Input) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) { - req, out := c.InputService2TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService2TestShapeInputService2TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - TimeArg *time.Time `type:"timestamp" timestampFormat:"unix"` -} - -type InputService2TestShapeInputService2TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService3ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService3ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService3ProtocolTest client from just a session. -// svc := inputservice3protocoltest.New(mySession) -// -// // Create a InputService3ProtocolTest client with additional configuration -// svc := inputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService3ProtocolTest { - c := p.ClientConfig("inputservice3protocoltest", cfgs...) - return newInputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService3ProtocolTest { - svc := &InputService3ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice3protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "1.1", - TargetPrefix: "com.amazonaws.foo", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService3ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService3TestCaseOperation1 = "OperationName" - -// InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputShape) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService3TestCaseOperation1, - } - - if input == nil { - input = &InputService3TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService3TestShapeInputService3TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputShape) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) { - req, out := c.InputService3TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService3TestCaseOperation2 = "OperationName" - -// InputService3TestCaseOperation2Request generates a request for the InputService3TestCaseOperation2 operation. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation2Request(input *InputService3TestShapeInputShape) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService3TestCaseOperation2, - } - - if input == nil { - input = &InputService3TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService3TestShapeInputService3TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService3ProtocolTest) InputService3TestCaseOperation2(input *InputService3TestShapeInputShape) (*InputService3TestShapeInputService3TestCaseOperation2Output, error) { - req, out := c.InputService3TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -type InputService3TestShapeInputService3TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService3TestShapeInputService3TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService3TestShapeInputShape struct { - _ struct{} `type:"structure"` - - BlobArg []byte `type:"blob"` - - BlobMap map[string][]byte `type:"map"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService4ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService4ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService4ProtocolTest client from just a session. -// svc := inputservice4protocoltest.New(mySession) -// -// // Create a InputService4ProtocolTest client with additional configuration -// svc := inputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService4ProtocolTest { - c := p.ClientConfig("inputservice4protocoltest", cfgs...) - return newInputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService4ProtocolTest { - svc := &InputService4ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice4protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "1.1", - TargetPrefix: "com.amazonaws.foo", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService4ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService4TestCaseOperation1 = "OperationName" - -// InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputService4TestCaseOperation1Input) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService4TestCaseOperation1, - HTTPMethod: "POST", - } - - if input == nil { - input = &InputService4TestShapeInputService4TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService4TestShapeInputService4TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputService4TestCaseOperation1Input) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) { - req, out := c.InputService4TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService4TestShapeInputService4TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - ListParam [][]byte `type:"list"` -} - -type InputService4TestShapeInputService4TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService5ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService5ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService5ProtocolTest client from just a session. -// svc := inputservice5protocoltest.New(mySession) -// -// // Create a InputService5ProtocolTest client with additional configuration -// svc := inputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService5ProtocolTest { - c := p.ClientConfig("inputservice5protocoltest", cfgs...) - return newInputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService5ProtocolTest { - svc := &InputService5ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice5protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "1.1", - TargetPrefix: "com.amazonaws.foo", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService5ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService5TestCaseOperation1 = "OperationName" - -// InputService5TestCaseOperation1Request generates a request for the InputService5TestCaseOperation1 operation. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputShape) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation1, - } - - if input == nil { - input = &InputService5TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService5TestShapeInputService5TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputShape) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) { - req, out := c.InputService5TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService5TestCaseOperation2 = "OperationName" - -// InputService5TestCaseOperation2Request generates a request for the InputService5TestCaseOperation2 operation. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation2Request(input *InputService5TestShapeInputShape) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation2, - } - - if input == nil { - input = &InputService5TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService5TestShapeInputService5TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService5ProtocolTest) InputService5TestCaseOperation2(input *InputService5TestShapeInputShape) (*InputService5TestShapeInputService5TestCaseOperation2Output, error) { - req, out := c.InputService5TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -const opInputService5TestCaseOperation3 = "OperationName" - -// InputService5TestCaseOperation3Request generates a request for the InputService5TestCaseOperation3 operation. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation3Request(input *InputService5TestShapeInputShape) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation3Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation3, - } - - if input == nil { - input = &InputService5TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService5TestShapeInputService5TestCaseOperation3Output{} - req.Data = output - return -} - -func (c *InputService5ProtocolTest) InputService5TestCaseOperation3(input *InputService5TestShapeInputShape) (*InputService5TestShapeInputService5TestCaseOperation3Output, error) { - req, out := c.InputService5TestCaseOperation3Request(input) - err := req.Send() - return out, err -} - -const opInputService5TestCaseOperation4 = "OperationName" - -// InputService5TestCaseOperation4Request generates a request for the InputService5TestCaseOperation4 operation. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation4Request(input *InputService5TestShapeInputShape) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation4Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation4, - } - - if input == nil { - input = &InputService5TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService5TestShapeInputService5TestCaseOperation4Output{} - req.Data = output - return -} - -func (c *InputService5ProtocolTest) InputService5TestCaseOperation4(input *InputService5TestShapeInputShape) (*InputService5TestShapeInputService5TestCaseOperation4Output, error) { - req, out := c.InputService5TestCaseOperation4Request(input) - err := req.Send() - return out, err -} - -const opInputService5TestCaseOperation5 = "OperationName" - -// InputService5TestCaseOperation5Request generates a request for the InputService5TestCaseOperation5 operation. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation5Request(input *InputService5TestShapeInputShape) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation5Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation5, - } - - if input == nil { - input = &InputService5TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService5TestShapeInputService5TestCaseOperation5Output{} - req.Data = output - return -} - -func (c *InputService5ProtocolTest) InputService5TestCaseOperation5(input *InputService5TestShapeInputShape) (*InputService5TestShapeInputService5TestCaseOperation5Output, error) { - req, out := c.InputService5TestCaseOperation5Request(input) - err := req.Send() - return out, err -} - -const opInputService5TestCaseOperation6 = "OperationName" - -// InputService5TestCaseOperation6Request generates a request for the InputService5TestCaseOperation6 operation. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation6Request(input *InputService5TestShapeInputShape) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation6Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation6, - } - - if input == nil { - input = &InputService5TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService5TestShapeInputService5TestCaseOperation6Output{} - req.Data = output - return -} - -func (c *InputService5ProtocolTest) InputService5TestCaseOperation6(input *InputService5TestShapeInputShape) (*InputService5TestShapeInputService5TestCaseOperation6Output, error) { - req, out := c.InputService5TestCaseOperation6Request(input) - err := req.Send() - return out, err -} - -type InputService5TestShapeInputService5TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService5TestShapeInputService5TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService5TestShapeInputService5TestCaseOperation3Output struct { - _ struct{} `type:"structure"` -} - -type InputService5TestShapeInputService5TestCaseOperation4Output struct { - _ struct{} `type:"structure"` -} - -type InputService5TestShapeInputService5TestCaseOperation5Output struct { - _ struct{} `type:"structure"` -} - -type InputService5TestShapeInputService5TestCaseOperation6Output struct { - _ struct{} `type:"structure"` -} - -type InputService5TestShapeInputShape struct { - _ struct{} `type:"structure"` - - RecursiveStruct *InputService5TestShapeRecursiveStructType `type:"structure"` -} - -type InputService5TestShapeRecursiveStructType struct { - _ struct{} `type:"structure"` - - NoRecurse *string `type:"string"` - - RecursiveList []*InputService5TestShapeRecursiveStructType `type:"list"` - - RecursiveMap map[string]*InputService5TestShapeRecursiveStructType `type:"map"` - - RecursiveStruct *InputService5TestShapeRecursiveStructType `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService6ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService6ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService6ProtocolTest client from just a session. -// svc := inputservice6protocoltest.New(mySession) -// -// // Create a InputService6ProtocolTest client with additional configuration -// svc := inputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService6ProtocolTest { - c := p.ClientConfig("inputservice6protocoltest", cfgs...) - return newInputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService6ProtocolTest { - svc := &InputService6ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice6protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "1.1", - TargetPrefix: "com.amazonaws.foo", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService6ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService6TestCaseOperation1 = "OperationName" - -// InputService6TestCaseOperation1Request generates a request for the InputService6TestCaseOperation1 operation. -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputService6TestCaseOperation1Input) (req *request.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService6TestCaseOperation1, - HTTPMethod: "POST", - } - - if input == nil { - input = &InputService6TestShapeInputService6TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService6TestShapeInputService6TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputService6TestCaseOperation1Input) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) { - req, out := c.InputService6TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService6TestShapeInputService6TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Map map[string]*string `type:"map"` -} - -type InputService6TestShapeInputService6TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// -// Tests begin here -// - -func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService1TestShapeInputService1TestCaseOperation1Input{ - Name: aws.String("myname"), - } - req, _ := svc.InputService1TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"Name":"myname"}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) - assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) - -} - -func TestInputService2ProtocolTestTimestampValuesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService2TestShapeInputService2TestCaseOperation1Input{ - TimeArg: aws.Time(time.Unix(1422172800, 0)), - } - req, _ := svc.InputService2TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"TimeArg":1422172800}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) - assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) - -} - -func TestInputService3ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService3TestShapeInputShape{ - BlobArg: []byte("foo"), - } - req, _ := svc.InputService3TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"BlobArg":"Zm9v"}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) - assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) - -} - -func TestInputService3ProtocolTestBase64EncodedBlobsCase2(t *testing.T) { - sess := session.New() - svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService3TestShapeInputShape{ - BlobMap: map[string][]byte{ - "key1": []byte("foo"), - "key2": []byte("bar"), - }, - } - req, _ := svc.InputService3TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"BlobMap":{"key1":"Zm9v","key2":"YmFy"}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) - assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) - -} - -func TestInputService4ProtocolTestNestedBlobsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService4TestShapeInputService4TestCaseOperation1Input{ - ListParam: [][]byte{ - []byte("foo"), - []byte("bar"), - }, - } - req, _ := svc.InputService4TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"ListParam":["Zm9v","YmFy"]}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) - assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) - -} - -func TestInputService5ProtocolTestRecursiveShapesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService5TestShapeInputShape{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - } - req, _ := svc.InputService5TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"NoRecurse":"foo"}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) - assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) - -} - -func TestInputService5ProtocolTestRecursiveShapesCase2(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService5TestShapeInputShape{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - } - req, _ := svc.InputService5TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveStruct":{"NoRecurse":"foo"}}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) - assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) - -} - -func TestInputService5ProtocolTestRecursiveShapesCase3(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService5TestShapeInputShape{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - }, - }, - } - req, _ := svc.InputService5TestCaseOperation3Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveStruct":{"RecursiveStruct":{"RecursiveStruct":{"NoRecurse":"foo"}}}}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) - assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) - -} - -func TestInputService5ProtocolTestRecursiveShapesCase4(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService5TestShapeInputShape{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - RecursiveList: []*InputService5TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - NoRecurse: aws.String("bar"), - }, - }, - }, - } - req, _ := svc.InputService5TestCaseOperation4Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveList":[{"NoRecurse":"foo"},{"NoRecurse":"bar"}]}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) - assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) - -} - -func TestInputService5ProtocolTestRecursiveShapesCase5(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService5TestShapeInputShape{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - RecursiveList: []*InputService5TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - NoRecurse: aws.String("bar"), - }, - }, - }, - }, - } - req, _ := svc.InputService5TestCaseOperation5Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveList":[{"NoRecurse":"foo"},{"RecursiveStruct":{"NoRecurse":"bar"}}]}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) - assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) - -} - -func TestInputService5ProtocolTestRecursiveShapesCase6(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService5TestShapeInputShape{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - RecursiveMap: map[string]*InputService5TestShapeRecursiveStructType{ - "bar": { - NoRecurse: aws.String("bar"), - }, - "foo": { - NoRecurse: aws.String("foo"), - }, - }, - }, - } - req, _ := svc.InputService5TestCaseOperation6Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveMap":{"foo":{"NoRecurse":"foo"},"bar":{"NoRecurse":"bar"}}}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) - assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) - -} - -func TestInputService6ProtocolTestEmptyMapsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService6TestShapeInputService6TestCaseOperation1Input{ - Map: map[string]*string{}, - } - req, _ := svc.InputService6TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"Map":{}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) - assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/unmarshal_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/unmarshal_test.go deleted file mode 100644 index 4e804ffe19..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/unmarshal_test.go +++ /dev/null @@ -1,812 +0,0 @@ -package jsonrpc_test - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "io" - "io/ioutil" - "net/http" - "net/url" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" - "github.com/aws/aws-sdk-go/private/signer/v4" - "github.com/aws/aws-sdk-go/private/util" - "github.com/stretchr/testify/assert" -) - -var _ bytes.Buffer // always import bytes -var _ http.Request -var _ json.Marshaler -var _ time.Time -var _ xmlutil.XMLNode -var _ xml.Attr -var _ = awstesting.GenerateAssertions -var _ = ioutil.Discard -var _ = util.Trim("") -var _ = url.Values{} -var _ = io.EOF -var _ = aws.String - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService1ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService1ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService1ProtocolTest client from just a session. -// svc := outputservice1protocoltest.New(mySession) -// -// // Create a OutputService1ProtocolTest client with additional configuration -// svc := outputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService1ProtocolTest { - c := p.ClientConfig("outputservice1protocoltest", cfgs...) - return newOutputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService1ProtocolTest { - svc := &OutputService1ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice1protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "", - TargetPrefix: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService1ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService1TestCaseOperation1 = "OperationName" - -// OutputService1TestCaseOperation1Request generates a request for the OutputService1TestCaseOperation1 operation. -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService1TestCaseOperation1, - } - - if input == nil { - input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService1TestShapeOutputService1TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) { - req, out := c.OutputService1TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService1TestShapeOutputService1TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService1TestShapeOutputService1TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Char *string `type:"character"` - - Double *float64 `type:"double"` - - FalseBool *bool `type:"boolean"` - - Float *float64 `type:"float"` - - Long *int64 `type:"long"` - - Num *int64 `type:"integer"` - - Str *string `type:"string"` - - TrueBool *bool `type:"boolean"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService2ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService2ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService2ProtocolTest client from just a session. -// svc := outputservice2protocoltest.New(mySession) -// -// // Create a OutputService2ProtocolTest client with additional configuration -// svc := outputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService2ProtocolTest { - c := p.ClientConfig("outputservice2protocoltest", cfgs...) - return newOutputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService2ProtocolTest { - svc := &OutputService2ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice2protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "", - TargetPrefix: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService2ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService2TestCaseOperation1 = "OperationName" - -// OutputService2TestCaseOperation1Request generates a request for the OutputService2TestCaseOperation1 operation. -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *request.Request, output *OutputService2TestShapeOutputService2TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService2TestCaseOperation1, - } - - if input == nil { - input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService2TestShapeOutputService2TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) { - req, out := c.OutputService2TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService2TestShapeBlobContainer struct { - _ struct{} `type:"structure"` - - Foo []byte `locationName:"foo" type:"blob"` -} - -type OutputService2TestShapeOutputService2TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService2TestShapeOutputService2TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - BlobMember []byte `type:"blob"` - - StructMember *OutputService2TestShapeBlobContainer `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService3ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService3ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService3ProtocolTest client from just a session. -// svc := outputservice3protocoltest.New(mySession) -// -// // Create a OutputService3ProtocolTest client with additional configuration -// svc := outputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService3ProtocolTest { - c := p.ClientConfig("outputservice3protocoltest", cfgs...) - return newOutputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService3ProtocolTest { - svc := &OutputService3ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice3protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "", - TargetPrefix: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService3ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService3TestCaseOperation1 = "OperationName" - -// OutputService3TestCaseOperation1Request generates a request for the OutputService3TestCaseOperation1 operation. -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *request.Request, output *OutputService3TestShapeOutputService3TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService3TestCaseOperation1, - } - - if input == nil { - input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService3TestShapeOutputService3TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) { - req, out := c.OutputService3TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService3TestShapeOutputService3TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService3TestShapeOutputService3TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - StructMember *OutputService3TestShapeTimeContainer `type:"structure"` - - TimeMember *time.Time `type:"timestamp" timestampFormat:"unix"` -} - -type OutputService3TestShapeTimeContainer struct { - _ struct{} `type:"structure"` - - Foo *time.Time `locationName:"foo" type:"timestamp" timestampFormat:"unix"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService4ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService4ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService4ProtocolTest client from just a session. -// svc := outputservice4protocoltest.New(mySession) -// -// // Create a OutputService4ProtocolTest client with additional configuration -// svc := outputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService4ProtocolTest { - c := p.ClientConfig("outputservice4protocoltest", cfgs...) - return newOutputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService4ProtocolTest { - svc := &OutputService4ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice4protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "", - TargetPrefix: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService4ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService4TestCaseOperation1 = "OperationName" - -// OutputService4TestCaseOperation1Request generates a request for the OutputService4TestCaseOperation1 operation. -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *request.Request, output *OutputService4TestShapeOutputShape) { - op := &request.Operation{ - Name: opOutputService4TestCaseOperation1, - } - - if input == nil { - input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService4TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputShape, error) { - req, out := c.OutputService4TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opOutputService4TestCaseOperation2 = "OperationName" - -// OutputService4TestCaseOperation2Request generates a request for the OutputService4TestCaseOperation2 operation. -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation2Request(input *OutputService4TestShapeOutputService4TestCaseOperation2Input) (req *request.Request, output *OutputService4TestShapeOutputShape) { - op := &request.Operation{ - Name: opOutputService4TestCaseOperation2, - } - - if input == nil { - input = &OutputService4TestShapeOutputService4TestCaseOperation2Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService4TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation2(input *OutputService4TestShapeOutputService4TestCaseOperation2Input) (*OutputService4TestShapeOutputShape, error) { - req, out := c.OutputService4TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -type OutputService4TestShapeOutputService4TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService4TestShapeOutputService4TestCaseOperation2Input struct { - _ struct{} `type:"structure"` -} - -type OutputService4TestShapeOutputShape struct { - _ struct{} `type:"structure"` - - ListMember []*string `type:"list"` - - ListMemberMap []map[string]*string `type:"list"` - - ListMemberStruct []*OutputService4TestShapeStructType `type:"list"` -} - -type OutputService4TestShapeStructType struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService5ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService5ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService5ProtocolTest client from just a session. -// svc := outputservice5protocoltest.New(mySession) -// -// // Create a OutputService5ProtocolTest client with additional configuration -// svc := outputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService5ProtocolTest { - c := p.ClientConfig("outputservice5protocoltest", cfgs...) - return newOutputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService5ProtocolTest { - svc := &OutputService5ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice5protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "", - TargetPrefix: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService5ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService5TestCaseOperation1 = "OperationName" - -// OutputService5TestCaseOperation1Request generates a request for the OutputService5TestCaseOperation1 operation. -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *request.Request, output *OutputService5TestShapeOutputService5TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService5TestCaseOperation1, - } - - if input == nil { - input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService5TestShapeOutputService5TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) { - req, out := c.OutputService5TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService5TestShapeOutputService5TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService5TestShapeOutputService5TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - MapMember map[string][]*int64 `type:"map"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService6ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService6ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService6ProtocolTest client from just a session. -// svc := outputservice6protocoltest.New(mySession) -// -// // Create a OutputService6ProtocolTest client with additional configuration -// svc := outputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService6ProtocolTest { - c := p.ClientConfig("outputservice6protocoltest", cfgs...) - return newOutputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService6ProtocolTest { - svc := &OutputService6ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice6protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "", - TargetPrefix: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService6ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService6TestCaseOperation1 = "OperationName" - -// OutputService6TestCaseOperation1Request generates a request for the OutputService6TestCaseOperation1 operation. -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *request.Request, output *OutputService6TestShapeOutputService6TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService6TestCaseOperation1, - } - - if input == nil { - input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService6TestShapeOutputService6TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) { - req, out := c.OutputService6TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService6TestShapeOutputService6TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService6TestShapeOutputService6TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - StrType *string `type:"string"` -} - -// -// Tests begin here -// - -func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"Str\": \"myname\", \"Num\": 123, \"FalseBool\": false, \"TrueBool\": true, \"Float\": 1.2, \"Double\": 1.3, \"Long\": 200, \"Char\": \"a\"}")) - req, out := svc.OutputService1TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - jsonrpc.UnmarshalMeta(req) - jsonrpc.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "a", *out.Char) - assert.Equal(t, 1.3, *out.Double) - assert.Equal(t, false, *out.FalseBool) - assert.Equal(t, 1.2, *out.Float) - assert.Equal(t, int64(200), *out.Long) - assert.Equal(t, int64(123), *out.Num) - assert.Equal(t, "myname", *out.Str) - assert.Equal(t, true, *out.TrueBool) - -} - -func TestOutputService2ProtocolTestBlobMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"BlobMember\": \"aGkh\", \"StructMember\": {\"foo\": \"dGhlcmUh\"}}")) - req, out := svc.OutputService2TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - jsonrpc.UnmarshalMeta(req) - jsonrpc.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "hi!", string(out.BlobMember)) - assert.Equal(t, "there!", string(out.StructMember.Foo)) - -} - -func TestOutputService3ProtocolTestTimestampMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"TimeMember\": 1398796238, \"StructMember\": {\"foo\": 1398796238}}")) - req, out := svc.OutputService3TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - jsonrpc.UnmarshalMeta(req) - jsonrpc.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, time.Unix(1.398796238e+09, 0).UTC().String(), out.StructMember.Foo.String()) - assert.Equal(t, time.Unix(1.398796238e+09, 0).UTC().String(), out.TimeMember.String()) - -} - -func TestOutputService4ProtocolTestListsCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"ListMember\": [\"a\", \"b\"]}")) - req, out := svc.OutputService4TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - jsonrpc.UnmarshalMeta(req) - jsonrpc.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "a", *out.ListMember[0]) - assert.Equal(t, "b", *out.ListMember[1]) - -} - -func TestOutputService4ProtocolTestListsCase2(t *testing.T) { - sess := session.New() - svc := NewOutputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"ListMember\": [\"a\", null], \"ListMemberMap\": [{}, null, null, {}], \"ListMemberStruct\": [{}, null, null, {}]}")) - req, out := svc.OutputService4TestCaseOperation2Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - jsonrpc.UnmarshalMeta(req) - jsonrpc.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "a", *out.ListMember[0]) - assert.Nil(t, out.ListMember[1]) - assert.Nil(t, out.ListMemberMap[1]) - assert.Nil(t, out.ListMemberMap[2]) - assert.Nil(t, out.ListMemberStruct[1]) - assert.Nil(t, out.ListMemberStruct[2]) - -} - -func TestOutputService5ProtocolTestMapsCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"MapMember\": {\"a\": [1, 2], \"b\": [3, 4]}}")) - req, out := svc.OutputService5TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - jsonrpc.UnmarshalMeta(req) - jsonrpc.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, int64(1), *out.MapMember["a"][0]) - assert.Equal(t, int64(2), *out.MapMember["a"][1]) - assert.Equal(t, int64(3), *out.MapMember["b"][0]) - assert.Equal(t, int64(4), *out.MapMember["b"][1]) - -} - -func TestOutputService6ProtocolTestIgnoresExtraDataCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"foo\": \"bar\"}")) - req, out := svc.OutputService6TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - jsonrpc.UnmarshalMeta(req) - jsonrpc.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go deleted file mode 100644 index 6588d8f9cb..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go +++ /dev/null @@ -1,1999 +0,0 @@ -package query_test - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "io" - "io/ioutil" - "net/http" - "net/url" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/protocol/query" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" - "github.com/aws/aws-sdk-go/private/signer/v4" - "github.com/aws/aws-sdk-go/private/util" - "github.com/stretchr/testify/assert" -) - -var _ bytes.Buffer // always import bytes -var _ http.Request -var _ json.Marshaler -var _ time.Time -var _ xmlutil.XMLNode -var _ xml.Attr -var _ = awstesting.GenerateAssertions -var _ = ioutil.Discard -var _ = util.Trim("") -var _ = url.Values{} -var _ = io.EOF -var _ = aws.String - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService1ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService1ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService1ProtocolTest client from just a session. -// svc := inputservice1protocoltest.New(mySession) -// -// // Create a InputService1ProtocolTest client with additional configuration -// svc := inputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService1ProtocolTest { - c := p.ClientConfig("inputservice1protocoltest", cfgs...) - return newInputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService1ProtocolTest { - svc := &InputService1ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice1protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService1ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService1TestCaseOperation1 = "OperationName" - -// InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputShape) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService1TestCaseOperation1, - } - - if input == nil { - input = &InputService1TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService1TestShapeInputService1TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputShape) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) { - req, out := c.InputService1TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService1TestCaseOperation2 = "OperationName" - -// InputService1TestCaseOperation2Request generates a request for the InputService1TestCaseOperation2 operation. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation2Request(input *InputService1TestShapeInputShape) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService1TestCaseOperation2, - } - - if input == nil { - input = &InputService1TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService1TestShapeInputService1TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService1ProtocolTest) InputService1TestCaseOperation2(input *InputService1TestShapeInputShape) (*InputService1TestShapeInputService1TestCaseOperation2Output, error) { - req, out := c.InputService1TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -const opInputService1TestCaseOperation3 = "OperationName" - -// InputService1TestCaseOperation3Request generates a request for the InputService1TestCaseOperation3 operation. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation3Request(input *InputService1TestShapeInputShape) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation3Output) { - op := &request.Operation{ - Name: opInputService1TestCaseOperation3, - } - - if input == nil { - input = &InputService1TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService1TestShapeInputService1TestCaseOperation3Output{} - req.Data = output - return -} - -func (c *InputService1ProtocolTest) InputService1TestCaseOperation3(input *InputService1TestShapeInputShape) (*InputService1TestShapeInputService1TestCaseOperation3Output, error) { - req, out := c.InputService1TestCaseOperation3Request(input) - err := req.Send() - return out, err -} - -type InputService1TestShapeInputService1TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService1TestShapeInputService1TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService1TestShapeInputService1TestCaseOperation3Output struct { - _ struct{} `type:"structure"` -} - -type InputService1TestShapeInputShape struct { - _ struct{} `type:"structure"` - - Bar *string `type:"string"` - - Baz *bool `type:"boolean"` - - Foo *string `type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService2ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService2ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService2ProtocolTest client from just a session. -// svc := inputservice2protocoltest.New(mySession) -// -// // Create a InputService2ProtocolTest client with additional configuration -// svc := inputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService2ProtocolTest { - c := p.ClientConfig("inputservice2protocoltest", cfgs...) - return newInputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService2ProtocolTest { - svc := &InputService2ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice2protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService2ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService2TestCaseOperation1 = "OperationName" - -// InputService2TestCaseOperation1Request generates a request for the InputService2TestCaseOperation1 operation. -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputService2TestCaseOperation1Input) (req *request.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService2TestCaseOperation1, - } - - if input == nil { - input = &InputService2TestShapeInputService2TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService2TestShapeInputService2TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputService2TestCaseOperation1Input) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) { - req, out := c.InputService2TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService2TestShapeInputService2TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - StructArg *InputService2TestShapeStructType `type:"structure"` -} - -type InputService2TestShapeInputService2TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService2TestShapeStructType struct { - _ struct{} `type:"structure"` - - ScalarArg *string `type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService3ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService3ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService3ProtocolTest client from just a session. -// svc := inputservice3protocoltest.New(mySession) -// -// // Create a InputService3ProtocolTest client with additional configuration -// svc := inputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService3ProtocolTest { - c := p.ClientConfig("inputservice3protocoltest", cfgs...) - return newInputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService3ProtocolTest { - svc := &InputService3ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice3protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService3ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService3TestCaseOperation1 = "OperationName" - -// InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputShape) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService3TestCaseOperation1, - } - - if input == nil { - input = &InputService3TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService3TestShapeInputService3TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputShape) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) { - req, out := c.InputService3TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService3TestCaseOperation2 = "OperationName" - -// InputService3TestCaseOperation2Request generates a request for the InputService3TestCaseOperation2 operation. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation2Request(input *InputService3TestShapeInputShape) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService3TestCaseOperation2, - } - - if input == nil { - input = &InputService3TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService3TestShapeInputService3TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService3ProtocolTest) InputService3TestCaseOperation2(input *InputService3TestShapeInputShape) (*InputService3TestShapeInputService3TestCaseOperation2Output, error) { - req, out := c.InputService3TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -type InputService3TestShapeInputService3TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService3TestShapeInputService3TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService3TestShapeInputShape struct { - _ struct{} `type:"structure"` - - ListArg []*string `type:"list"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService4ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService4ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService4ProtocolTest client from just a session. -// svc := inputservice4protocoltest.New(mySession) -// -// // Create a InputService4ProtocolTest client with additional configuration -// svc := inputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService4ProtocolTest { - c := p.ClientConfig("inputservice4protocoltest", cfgs...) - return newInputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService4ProtocolTest { - svc := &InputService4ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice4protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService4ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService4TestCaseOperation1 = "OperationName" - -// InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputShape) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService4TestCaseOperation1, - } - - if input == nil { - input = &InputService4TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService4TestShapeInputService4TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputShape) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) { - req, out := c.InputService4TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService4TestCaseOperation2 = "OperationName" - -// InputService4TestCaseOperation2Request generates a request for the InputService4TestCaseOperation2 operation. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation2Request(input *InputService4TestShapeInputShape) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService4TestCaseOperation2, - } - - if input == nil { - input = &InputService4TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService4TestShapeInputService4TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService4ProtocolTest) InputService4TestCaseOperation2(input *InputService4TestShapeInputShape) (*InputService4TestShapeInputService4TestCaseOperation2Output, error) { - req, out := c.InputService4TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -type InputService4TestShapeInputService4TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService4TestShapeInputService4TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService4TestShapeInputShape struct { - _ struct{} `type:"structure"` - - ListArg []*string `type:"list" flattened:"true"` - - NamedListArg []*string `locationNameList:"Foo" type:"list" flattened:"true"` - - ScalarArg *string `type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService5ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService5ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService5ProtocolTest client from just a session. -// svc := inputservice5protocoltest.New(mySession) -// -// // Create a InputService5ProtocolTest client with additional configuration -// svc := inputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService5ProtocolTest { - c := p.ClientConfig("inputservice5protocoltest", cfgs...) - return newInputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService5ProtocolTest { - svc := &InputService5ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice5protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService5ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService5TestCaseOperation1 = "OperationName" - -// InputService5TestCaseOperation1Request generates a request for the InputService5TestCaseOperation1 operation. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputService5TestCaseOperation1Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation1, - } - - if input == nil { - input = &InputService5TestShapeInputService5TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService5TestShapeInputService5TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputService5TestCaseOperation1Input) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) { - req, out := c.InputService5TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService5TestShapeInputService5TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - MapArg map[string]*string `type:"map" flattened:"true"` -} - -type InputService5TestShapeInputService5TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService6ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService6ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService6ProtocolTest client from just a session. -// svc := inputservice6protocoltest.New(mySession) -// -// // Create a InputService6ProtocolTest client with additional configuration -// svc := inputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService6ProtocolTest { - c := p.ClientConfig("inputservice6protocoltest", cfgs...) - return newInputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService6ProtocolTest { - svc := &InputService6ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice6protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService6ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService6TestCaseOperation1 = "OperationName" - -// InputService6TestCaseOperation1Request generates a request for the InputService6TestCaseOperation1 operation. -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputService6TestCaseOperation1Input) (req *request.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService6TestCaseOperation1, - } - - if input == nil { - input = &InputService6TestShapeInputService6TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService6TestShapeInputService6TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputService6TestCaseOperation1Input) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) { - req, out := c.InputService6TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService6TestShapeInputService6TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - ListArg []*string `locationNameList:"item" type:"list"` -} - -type InputService6TestShapeInputService6TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService7ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService7ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService7ProtocolTest client from just a session. -// svc := inputservice7protocoltest.New(mySession) -// -// // Create a InputService7ProtocolTest client with additional configuration -// svc := inputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService7ProtocolTest { - c := p.ClientConfig("inputservice7protocoltest", cfgs...) - return newInputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService7ProtocolTest { - svc := &InputService7ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice7protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService7ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService7TestCaseOperation1 = "OperationName" - -// InputService7TestCaseOperation1Request generates a request for the InputService7TestCaseOperation1 operation. -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputService7TestCaseOperation1Input) (req *request.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService7TestCaseOperation1, - } - - if input == nil { - input = &InputService7TestShapeInputService7TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService7TestShapeInputService7TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputService7TestCaseOperation1Input) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) { - req, out := c.InputService7TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService7TestShapeInputService7TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - ListArg []*string `locationNameList:"ListArgLocation" type:"list" flattened:"true"` - - ScalarArg *string `type:"string"` -} - -type InputService7TestShapeInputService7TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService8ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService8ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService8ProtocolTest client from just a session. -// svc := inputservice8protocoltest.New(mySession) -// -// // Create a InputService8ProtocolTest client with additional configuration -// svc := inputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService8ProtocolTest { - c := p.ClientConfig("inputservice8protocoltest", cfgs...) - return newInputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService8ProtocolTest { - svc := &InputService8ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice8protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService8ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService8TestCaseOperation1 = "OperationName" - -// InputService8TestCaseOperation1Request generates a request for the InputService8TestCaseOperation1 operation. -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputService8TestCaseOperation1Input) (req *request.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService8TestCaseOperation1, - } - - if input == nil { - input = &InputService8TestShapeInputService8TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService8TestShapeInputService8TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputService8TestCaseOperation1Input) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) { - req, out := c.InputService8TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService8TestShapeInputService8TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - MapArg map[string]*string `type:"map"` -} - -type InputService8TestShapeInputService8TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService9ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService9ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService9ProtocolTest client from just a session. -// svc := inputservice9protocoltest.New(mySession) -// -// // Create a InputService9ProtocolTest client with additional configuration -// svc := inputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService9ProtocolTest { - c := p.ClientConfig("inputservice9protocoltest", cfgs...) - return newInputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService9ProtocolTest { - svc := &InputService9ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice9protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService9ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService9TestCaseOperation1 = "OperationName" - -// InputService9TestCaseOperation1Request generates a request for the InputService9TestCaseOperation1 operation. -func (c *InputService9ProtocolTest) InputService9TestCaseOperation1Request(input *InputService9TestShapeInputService9TestCaseOperation1Input) (req *request.Request, output *InputService9TestShapeInputService9TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService9TestCaseOperation1, - } - - if input == nil { - input = &InputService9TestShapeInputService9TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService9TestShapeInputService9TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService9ProtocolTest) InputService9TestCaseOperation1(input *InputService9TestShapeInputService9TestCaseOperation1Input) (*InputService9TestShapeInputService9TestCaseOperation1Output, error) { - req, out := c.InputService9TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService9TestShapeInputService9TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - MapArg map[string]*string `locationNameKey:"TheKey" locationNameValue:"TheValue" type:"map"` -} - -type InputService9TestShapeInputService9TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService10ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService10ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService10ProtocolTest client from just a session. -// svc := inputservice10protocoltest.New(mySession) -// -// // Create a InputService10ProtocolTest client with additional configuration -// svc := inputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService10ProtocolTest { - c := p.ClientConfig("inputservice10protocoltest", cfgs...) - return newInputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService10ProtocolTest { - svc := &InputService10ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice10protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService10ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService10TestCaseOperation1 = "OperationName" - -// InputService10TestCaseOperation1Request generates a request for the InputService10TestCaseOperation1 operation. -func (c *InputService10ProtocolTest) InputService10TestCaseOperation1Request(input *InputService10TestShapeInputService10TestCaseOperation1Input) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService10TestCaseOperation1, - } - - if input == nil { - input = &InputService10TestShapeInputService10TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService10TestShapeInputService10TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService10ProtocolTest) InputService10TestCaseOperation1(input *InputService10TestShapeInputService10TestCaseOperation1Input) (*InputService10TestShapeInputService10TestCaseOperation1Output, error) { - req, out := c.InputService10TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService10TestShapeInputService10TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - BlobArg []byte `type:"blob"` -} - -type InputService10TestShapeInputService10TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService11ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService11ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService11ProtocolTest client from just a session. -// svc := inputservice11protocoltest.New(mySession) -// -// // Create a InputService11ProtocolTest client with additional configuration -// svc := inputservice11protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService11ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService11ProtocolTest { - c := p.ClientConfig("inputservice11protocoltest", cfgs...) - return newInputService11ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService11ProtocolTest { - svc := &InputService11ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice11protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService11ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService11TestCaseOperation1 = "OperationName" - -// InputService11TestCaseOperation1Request generates a request for the InputService11TestCaseOperation1 operation. -func (c *InputService11ProtocolTest) InputService11TestCaseOperation1Request(input *InputService11TestShapeInputService11TestCaseOperation1Input) (req *request.Request, output *InputService11TestShapeInputService11TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService11TestCaseOperation1, - } - - if input == nil { - input = &InputService11TestShapeInputService11TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService11TestShapeInputService11TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService11ProtocolTest) InputService11TestCaseOperation1(input *InputService11TestShapeInputService11TestCaseOperation1Input) (*InputService11TestShapeInputService11TestCaseOperation1Output, error) { - req, out := c.InputService11TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService11TestShapeInputService11TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - TimeArg *time.Time `type:"timestamp" timestampFormat:"iso8601"` -} - -type InputService11TestShapeInputService11TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService12ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService12ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService12ProtocolTest client from just a session. -// svc := inputservice12protocoltest.New(mySession) -// -// // Create a InputService12ProtocolTest client with additional configuration -// svc := inputservice12protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService12ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService12ProtocolTest { - c := p.ClientConfig("inputservice12protocoltest", cfgs...) - return newInputService12ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService12ProtocolTest { - svc := &InputService12ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice12protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService12ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService12TestCaseOperation1 = "OperationName" - -// InputService12TestCaseOperation1Request generates a request for the InputService12TestCaseOperation1 operation. -func (c *InputService12ProtocolTest) InputService12TestCaseOperation1Request(input *InputService12TestShapeInputShape) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService12TestCaseOperation1, - } - - if input == nil { - input = &InputService12TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService12TestShapeInputService12TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService12ProtocolTest) InputService12TestCaseOperation1(input *InputService12TestShapeInputShape) (*InputService12TestShapeInputService12TestCaseOperation1Output, error) { - req, out := c.InputService12TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService12TestCaseOperation2 = "OperationName" - -// InputService12TestCaseOperation2Request generates a request for the InputService12TestCaseOperation2 operation. -func (c *InputService12ProtocolTest) InputService12TestCaseOperation2Request(input *InputService12TestShapeInputShape) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService12TestCaseOperation2, - } - - if input == nil { - input = &InputService12TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService12TestShapeInputService12TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService12ProtocolTest) InputService12TestCaseOperation2(input *InputService12TestShapeInputShape) (*InputService12TestShapeInputService12TestCaseOperation2Output, error) { - req, out := c.InputService12TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -const opInputService12TestCaseOperation3 = "OperationName" - -// InputService12TestCaseOperation3Request generates a request for the InputService12TestCaseOperation3 operation. -func (c *InputService12ProtocolTest) InputService12TestCaseOperation3Request(input *InputService12TestShapeInputShape) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation3Output) { - op := &request.Operation{ - Name: opInputService12TestCaseOperation3, - } - - if input == nil { - input = &InputService12TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService12TestShapeInputService12TestCaseOperation3Output{} - req.Data = output - return -} - -func (c *InputService12ProtocolTest) InputService12TestCaseOperation3(input *InputService12TestShapeInputShape) (*InputService12TestShapeInputService12TestCaseOperation3Output, error) { - req, out := c.InputService12TestCaseOperation3Request(input) - err := req.Send() - return out, err -} - -const opInputService12TestCaseOperation4 = "OperationName" - -// InputService12TestCaseOperation4Request generates a request for the InputService12TestCaseOperation4 operation. -func (c *InputService12ProtocolTest) InputService12TestCaseOperation4Request(input *InputService12TestShapeInputShape) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation4Output) { - op := &request.Operation{ - Name: opInputService12TestCaseOperation4, - } - - if input == nil { - input = &InputService12TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService12TestShapeInputService12TestCaseOperation4Output{} - req.Data = output - return -} - -func (c *InputService12ProtocolTest) InputService12TestCaseOperation4(input *InputService12TestShapeInputShape) (*InputService12TestShapeInputService12TestCaseOperation4Output, error) { - req, out := c.InputService12TestCaseOperation4Request(input) - err := req.Send() - return out, err -} - -const opInputService12TestCaseOperation5 = "OperationName" - -// InputService12TestCaseOperation5Request generates a request for the InputService12TestCaseOperation5 operation. -func (c *InputService12ProtocolTest) InputService12TestCaseOperation5Request(input *InputService12TestShapeInputShape) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation5Output) { - op := &request.Operation{ - Name: opInputService12TestCaseOperation5, - } - - if input == nil { - input = &InputService12TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService12TestShapeInputService12TestCaseOperation5Output{} - req.Data = output - return -} - -func (c *InputService12ProtocolTest) InputService12TestCaseOperation5(input *InputService12TestShapeInputShape) (*InputService12TestShapeInputService12TestCaseOperation5Output, error) { - req, out := c.InputService12TestCaseOperation5Request(input) - err := req.Send() - return out, err -} - -const opInputService12TestCaseOperation6 = "OperationName" - -// InputService12TestCaseOperation6Request generates a request for the InputService12TestCaseOperation6 operation. -func (c *InputService12ProtocolTest) InputService12TestCaseOperation6Request(input *InputService12TestShapeInputShape) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation6Output) { - op := &request.Operation{ - Name: opInputService12TestCaseOperation6, - } - - if input == nil { - input = &InputService12TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService12TestShapeInputService12TestCaseOperation6Output{} - req.Data = output - return -} - -func (c *InputService12ProtocolTest) InputService12TestCaseOperation6(input *InputService12TestShapeInputShape) (*InputService12TestShapeInputService12TestCaseOperation6Output, error) { - req, out := c.InputService12TestCaseOperation6Request(input) - err := req.Send() - return out, err -} - -type InputService12TestShapeInputService12TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService12TestShapeInputService12TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService12TestShapeInputService12TestCaseOperation3Output struct { - _ struct{} `type:"structure"` -} - -type InputService12TestShapeInputService12TestCaseOperation4Output struct { - _ struct{} `type:"structure"` -} - -type InputService12TestShapeInputService12TestCaseOperation5Output struct { - _ struct{} `type:"structure"` -} - -type InputService12TestShapeInputService12TestCaseOperation6Output struct { - _ struct{} `type:"structure"` -} - -type InputService12TestShapeInputShape struct { - _ struct{} `type:"structure"` - - RecursiveStruct *InputService12TestShapeRecursiveStructType `type:"structure"` -} - -type InputService12TestShapeRecursiveStructType struct { - _ struct{} `type:"structure"` - - NoRecurse *string `type:"string"` - - RecursiveList []*InputService12TestShapeRecursiveStructType `type:"list"` - - RecursiveMap map[string]*InputService12TestShapeRecursiveStructType `type:"map"` - - RecursiveStruct *InputService12TestShapeRecursiveStructType `type:"structure"` -} - -// -// Tests begin here -// - -func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService1TestShapeInputShape{ - Bar: aws.String("val2"), - Foo: aws.String("val1"), - } - req, _ := svc.InputService1TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&Bar=val2&Foo=val1&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService1ProtocolTestScalarMembersCase2(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService1TestShapeInputShape{ - Baz: aws.Bool(true), - } - req, _ := svc.InputService1TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&Baz=true&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService1ProtocolTestScalarMembersCase3(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService1TestShapeInputShape{ - Baz: aws.Bool(false), - } - req, _ := svc.InputService1TestCaseOperation3Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&Baz=false&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService2ProtocolTestNestedStructureMembersCase1(t *testing.T) { - sess := session.New() - svc := NewInputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService2TestShapeInputService2TestCaseOperation1Input{ - StructArg: &InputService2TestShapeStructType{ - ScalarArg: aws.String("foo"), - }, - } - req, _ := svc.InputService2TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&StructArg.ScalarArg=foo&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService3ProtocolTestListTypesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService3TestShapeInputShape{ - ListArg: []*string{ - aws.String("foo"), - aws.String("bar"), - aws.String("baz"), - }, - } - req, _ := svc.InputService3TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&ListArg.member.1=foo&ListArg.member.2=bar&ListArg.member.3=baz&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService3ProtocolTestListTypesCase2(t *testing.T) { - sess := session.New() - svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService3TestShapeInputShape{ - ListArg: []*string{}, - } - req, _ := svc.InputService3TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&ListArg=&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService4ProtocolTestFlattenedListCase1(t *testing.T) { - sess := session.New() - svc := NewInputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService4TestShapeInputShape{ - ListArg: []*string{ - aws.String("a"), - aws.String("b"), - aws.String("c"), - }, - ScalarArg: aws.String("foo"), - } - req, _ := svc.InputService4TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&ListArg.1=a&ListArg.2=b&ListArg.3=c&ScalarArg=foo&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService4ProtocolTestFlattenedListCase2(t *testing.T) { - sess := session.New() - svc := NewInputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService4TestShapeInputShape{ - NamedListArg: []*string{ - aws.String("a"), - }, - } - req, _ := svc.InputService4TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&Foo.1=a&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService5ProtocolTestSerializeFlattenedMapTypeCase1(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService5TestShapeInputService5TestCaseOperation1Input{ - MapArg: map[string]*string{ - "key1": aws.String("val1"), - "key2": aws.String("val2"), - }, - } - req, _ := svc.InputService5TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&MapArg.1.key=key1&MapArg.1.value=val1&MapArg.2.key=key2&MapArg.2.value=val2&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService6ProtocolTestNonFlattenedListWithLocationNameCase1(t *testing.T) { - sess := session.New() - svc := NewInputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService6TestShapeInputService6TestCaseOperation1Input{ - ListArg: []*string{ - aws.String("a"), - aws.String("b"), - aws.String("c"), - }, - } - req, _ := svc.InputService6TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&ListArg.item.1=a&ListArg.item.2=b&ListArg.item.3=c&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService7ProtocolTestFlattenedListWithLocationNameCase1(t *testing.T) { - sess := session.New() - svc := NewInputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService7TestShapeInputService7TestCaseOperation1Input{ - ListArg: []*string{ - aws.String("a"), - aws.String("b"), - aws.String("c"), - }, - ScalarArg: aws.String("foo"), - } - req, _ := svc.InputService7TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&ListArgLocation.1=a&ListArgLocation.2=b&ListArgLocation.3=c&ScalarArg=foo&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService8ProtocolTestSerializeMapTypeCase1(t *testing.T) { - sess := session.New() - svc := NewInputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService8TestShapeInputService8TestCaseOperation1Input{ - MapArg: map[string]*string{ - "key1": aws.String("val1"), - "key2": aws.String("val2"), - }, - } - req, _ := svc.InputService8TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&MapArg.entry.1.key=key1&MapArg.entry.1.value=val1&MapArg.entry.2.key=key2&MapArg.entry.2.value=val2&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService9ProtocolTestSerializeMapTypeWithLocationNameCase1(t *testing.T) { - sess := session.New() - svc := NewInputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService9TestShapeInputService9TestCaseOperation1Input{ - MapArg: map[string]*string{ - "key1": aws.String("val1"), - "key2": aws.String("val2"), - }, - } - req, _ := svc.InputService9TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&MapArg.entry.1.TheKey=key1&MapArg.entry.1.TheValue=val1&MapArg.entry.2.TheKey=key2&MapArg.entry.2.TheValue=val2&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService10ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService10ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService10TestShapeInputService10TestCaseOperation1Input{ - BlobArg: []byte("foo"), - } - req, _ := svc.InputService10TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&BlobArg=Zm9v&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService11ProtocolTestTimestampValuesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService11ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService11TestShapeInputService11TestCaseOperation1Input{ - TimeArg: aws.Time(time.Unix(1422172800, 0)), - } - req, _ := svc.InputService11TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&TimeArg=2015-01-25T08%3A00%3A00Z&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService12ProtocolTestRecursiveShapesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService12TestShapeInputShape{ - RecursiveStruct: &InputService12TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - } - req, _ := svc.InputService12TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.NoRecurse=foo&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService12ProtocolTestRecursiveShapesCase2(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService12TestShapeInputShape{ - RecursiveStruct: &InputService12TestShapeRecursiveStructType{ - RecursiveStruct: &InputService12TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - } - req, _ := svc.InputService12TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveStruct.NoRecurse=foo&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService12ProtocolTestRecursiveShapesCase3(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService12TestShapeInputShape{ - RecursiveStruct: &InputService12TestShapeRecursiveStructType{ - RecursiveStruct: &InputService12TestShapeRecursiveStructType{ - RecursiveStruct: &InputService12TestShapeRecursiveStructType{ - RecursiveStruct: &InputService12TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - }, - }, - } - req, _ := svc.InputService12TestCaseOperation3Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveStruct.RecursiveStruct.RecursiveStruct.NoRecurse=foo&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService12ProtocolTestRecursiveShapesCase4(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService12TestShapeInputShape{ - RecursiveStruct: &InputService12TestShapeRecursiveStructType{ - RecursiveList: []*InputService12TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - NoRecurse: aws.String("bar"), - }, - }, - }, - } - req, _ := svc.InputService12TestCaseOperation4Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveList.member.1.NoRecurse=foo&RecursiveStruct.RecursiveList.member.2.NoRecurse=bar&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService12ProtocolTestRecursiveShapesCase5(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService12TestShapeInputShape{ - RecursiveStruct: &InputService12TestShapeRecursiveStructType{ - RecursiveList: []*InputService12TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - RecursiveStruct: &InputService12TestShapeRecursiveStructType{ - NoRecurse: aws.String("bar"), - }, - }, - }, - }, - } - req, _ := svc.InputService12TestCaseOperation5Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveList.member.1.NoRecurse=foo&RecursiveStruct.RecursiveList.member.2.RecursiveStruct.NoRecurse=bar&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService12ProtocolTestRecursiveShapesCase6(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService12TestShapeInputShape{ - RecursiveStruct: &InputService12TestShapeRecursiveStructType{ - RecursiveMap: map[string]*InputService12TestShapeRecursiveStructType{ - "bar": { - NoRecurse: aws.String("bar"), - }, - "foo": { - NoRecurse: aws.String("foo"), - }, - }, - }, - } - req, _ := svc.InputService12TestCaseOperation6Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveMap.entry.1.key=foo&RecursiveStruct.RecursiveMap.entry.1.value.NoRecurse=foo&RecursiveStruct.RecursiveMap.entry.2.key=bar&RecursiveStruct.RecursiveMap.entry.2.value.NoRecurse=bar&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go deleted file mode 100644 index 75022e21c7..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go +++ /dev/null @@ -1,1746 +0,0 @@ -package query_test - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "io" - "io/ioutil" - "net/http" - "net/url" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/protocol/query" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" - "github.com/aws/aws-sdk-go/private/signer/v4" - "github.com/aws/aws-sdk-go/private/util" - "github.com/stretchr/testify/assert" -) - -var _ bytes.Buffer // always import bytes -var _ http.Request -var _ json.Marshaler -var _ time.Time -var _ xmlutil.XMLNode -var _ xml.Attr -var _ = awstesting.GenerateAssertions -var _ = ioutil.Discard -var _ = util.Trim("") -var _ = url.Values{} -var _ = io.EOF -var _ = aws.String - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService1ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService1ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService1ProtocolTest client from just a session. -// svc := outputservice1protocoltest.New(mySession) -// -// // Create a OutputService1ProtocolTest client with additional configuration -// svc := outputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService1ProtocolTest { - c := p.ClientConfig("outputservice1protocoltest", cfgs...) - return newOutputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService1ProtocolTest { - svc := &OutputService1ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice1protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService1ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService1TestCaseOperation1 = "OperationName" - -// OutputService1TestCaseOperation1Request generates a request for the OutputService1TestCaseOperation1 operation. -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService1TestCaseOperation1, - } - - if input == nil { - input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService1TestShapeOutputService1TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) { - req, out := c.OutputService1TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService1TestShapeOutputService1TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService1TestShapeOutputService1TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Char *string `type:"character"` - - Double *float64 `type:"double"` - - FalseBool *bool `type:"boolean"` - - Float *float64 `type:"float"` - - Long *int64 `type:"long"` - - Num *int64 `locationName:"FooNum" type:"integer"` - - Str *string `type:"string"` - - Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - TrueBool *bool `type:"boolean"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService2ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService2ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService2ProtocolTest client from just a session. -// svc := outputservice2protocoltest.New(mySession) -// -// // Create a OutputService2ProtocolTest client with additional configuration -// svc := outputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService2ProtocolTest { - c := p.ClientConfig("outputservice2protocoltest", cfgs...) - return newOutputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService2ProtocolTest { - svc := &OutputService2ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice2protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService2ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService2TestCaseOperation1 = "OperationName" - -// OutputService2TestCaseOperation1Request generates a request for the OutputService2TestCaseOperation1 operation. -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *request.Request, output *OutputService2TestShapeOutputService2TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService2TestCaseOperation1, - } - - if input == nil { - input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService2TestShapeOutputService2TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) { - req, out := c.OutputService2TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService2TestShapeOutputService2TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService2TestShapeOutputService2TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Num *int64 `type:"integer"` - - Str *string `type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService3ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService3ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService3ProtocolTest client from just a session. -// svc := outputservice3protocoltest.New(mySession) -// -// // Create a OutputService3ProtocolTest client with additional configuration -// svc := outputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService3ProtocolTest { - c := p.ClientConfig("outputservice3protocoltest", cfgs...) - return newOutputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService3ProtocolTest { - svc := &OutputService3ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice3protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService3ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService3TestCaseOperation1 = "OperationName" - -// OutputService3TestCaseOperation1Request generates a request for the OutputService3TestCaseOperation1 operation. -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *request.Request, output *OutputService3TestShapeOutputService3TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService3TestCaseOperation1, - } - - if input == nil { - input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService3TestShapeOutputService3TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) { - req, out := c.OutputService3TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService3TestShapeOutputService3TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService3TestShapeOutputService3TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Blob []byte `type:"blob"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService4ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService4ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService4ProtocolTest client from just a session. -// svc := outputservice4protocoltest.New(mySession) -// -// // Create a OutputService4ProtocolTest client with additional configuration -// svc := outputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService4ProtocolTest { - c := p.ClientConfig("outputservice4protocoltest", cfgs...) - return newOutputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService4ProtocolTest { - svc := &OutputService4ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice4protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService4ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService4TestCaseOperation1 = "OperationName" - -// OutputService4TestCaseOperation1Request generates a request for the OutputService4TestCaseOperation1 operation. -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *request.Request, output *OutputService4TestShapeOutputService4TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService4TestCaseOperation1, - } - - if input == nil { - input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService4TestShapeOutputService4TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputService4TestCaseOperation1Output, error) { - req, out := c.OutputService4TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService4TestShapeOutputService4TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService4TestShapeOutputService4TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `type:"list"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService5ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService5ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService5ProtocolTest client from just a session. -// svc := outputservice5protocoltest.New(mySession) -// -// // Create a OutputService5ProtocolTest client with additional configuration -// svc := outputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService5ProtocolTest { - c := p.ClientConfig("outputservice5protocoltest", cfgs...) - return newOutputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService5ProtocolTest { - svc := &OutputService5ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice5protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService5ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService5TestCaseOperation1 = "OperationName" - -// OutputService5TestCaseOperation1Request generates a request for the OutputService5TestCaseOperation1 operation. -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *request.Request, output *OutputService5TestShapeOutputService5TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService5TestCaseOperation1, - } - - if input == nil { - input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService5TestShapeOutputService5TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) { - req, out := c.OutputService5TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService5TestShapeOutputService5TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService5TestShapeOutputService5TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `locationNameList:"item" type:"list"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService6ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService6ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService6ProtocolTest client from just a session. -// svc := outputservice6protocoltest.New(mySession) -// -// // Create a OutputService6ProtocolTest client with additional configuration -// svc := outputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService6ProtocolTest { - c := p.ClientConfig("outputservice6protocoltest", cfgs...) - return newOutputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService6ProtocolTest { - svc := &OutputService6ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice6protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService6ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService6TestCaseOperation1 = "OperationName" - -// OutputService6TestCaseOperation1Request generates a request for the OutputService6TestCaseOperation1 operation. -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *request.Request, output *OutputService6TestShapeOutputService6TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService6TestCaseOperation1, - } - - if input == nil { - input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService6TestShapeOutputService6TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) { - req, out := c.OutputService6TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService6TestShapeOutputService6TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService6TestShapeOutputService6TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `type:"list" flattened:"true"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService7ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService7ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService7ProtocolTest client from just a session. -// svc := outputservice7protocoltest.New(mySession) -// -// // Create a OutputService7ProtocolTest client with additional configuration -// svc := outputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService7ProtocolTest { - c := p.ClientConfig("outputservice7protocoltest", cfgs...) - return newOutputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService7ProtocolTest { - svc := &OutputService7ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice7protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService7ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService7TestCaseOperation1 = "OperationName" - -// OutputService7TestCaseOperation1Request generates a request for the OutputService7TestCaseOperation1 operation. -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *request.Request, output *OutputService7TestShapeOutputService7TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService7TestCaseOperation1, - } - - if input == nil { - input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService7TestShapeOutputService7TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) { - req, out := c.OutputService7TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService7TestShapeOutputService7TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService7TestShapeOutputService7TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `type:"list" flattened:"true"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService8ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService8ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService8ProtocolTest client from just a session. -// svc := outputservice8protocoltest.New(mySession) -// -// // Create a OutputService8ProtocolTest client with additional configuration -// svc := outputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService8ProtocolTest { - c := p.ClientConfig("outputservice8protocoltest", cfgs...) - return newOutputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService8ProtocolTest { - svc := &OutputService8ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice8protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService8ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService8TestCaseOperation1 = "OperationName" - -// OutputService8TestCaseOperation1Request generates a request for the OutputService8TestCaseOperation1 operation. -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *request.Request, output *OutputService8TestShapeOutputService8TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService8TestCaseOperation1, - } - - if input == nil { - input = &OutputService8TestShapeOutputService8TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService8TestShapeOutputService8TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (*OutputService8TestShapeOutputService8TestCaseOperation1Output, error) { - req, out := c.OutputService8TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService8TestShapeOutputService8TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService8TestShapeOutputService8TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - List []*OutputService8TestShapeStructureShape `type:"list"` -} - -type OutputService8TestShapeStructureShape struct { - _ struct{} `type:"structure"` - - Bar *string `type:"string"` - - Baz *string `type:"string"` - - Foo *string `type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService9ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService9ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService9ProtocolTest client from just a session. -// svc := outputservice9protocoltest.New(mySession) -// -// // Create a OutputService9ProtocolTest client with additional configuration -// svc := outputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService9ProtocolTest { - c := p.ClientConfig("outputservice9protocoltest", cfgs...) - return newOutputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService9ProtocolTest { - svc := &OutputService9ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice9protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService9ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService9TestCaseOperation1 = "OperationName" - -// OutputService9TestCaseOperation1Request generates a request for the OutputService9TestCaseOperation1 operation. -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *request.Request, output *OutputService9TestShapeOutputService9TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService9TestCaseOperation1, - } - - if input == nil { - input = &OutputService9TestShapeOutputService9TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService9TestShapeOutputService9TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (*OutputService9TestShapeOutputService9TestCaseOperation1Output, error) { - req, out := c.OutputService9TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService9TestShapeOutputService9TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService9TestShapeOutputService9TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - List []*OutputService9TestShapeStructureShape `type:"list" flattened:"true"` -} - -type OutputService9TestShapeStructureShape struct { - _ struct{} `type:"structure"` - - Bar *string `type:"string"` - - Baz *string `type:"string"` - - Foo *string `type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService10ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService10ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService10ProtocolTest client from just a session. -// svc := outputservice10protocoltest.New(mySession) -// -// // Create a OutputService10ProtocolTest client with additional configuration -// svc := outputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService10ProtocolTest { - c := p.ClientConfig("outputservice10protocoltest", cfgs...) - return newOutputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService10ProtocolTest { - svc := &OutputService10ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice10protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService10ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService10TestCaseOperation1 = "OperationName" - -// OutputService10TestCaseOperation1Request generates a request for the OutputService10TestCaseOperation1 operation. -func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1Request(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (req *request.Request, output *OutputService10TestShapeOutputService10TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService10TestCaseOperation1, - } - - if input == nil { - input = &OutputService10TestShapeOutputService10TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService10TestShapeOutputService10TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (*OutputService10TestShapeOutputService10TestCaseOperation1Output, error) { - req, out := c.OutputService10TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService10TestShapeOutputService10TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService10TestShapeOutputService10TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - List []*string `locationNameList:"NamedList" type:"list" flattened:"true"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService11ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService11ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService11ProtocolTest client from just a session. -// svc := outputservice11protocoltest.New(mySession) -// -// // Create a OutputService11ProtocolTest client with additional configuration -// svc := outputservice11protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService11ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService11ProtocolTest { - c := p.ClientConfig("outputservice11protocoltest", cfgs...) - return newOutputService11ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService11ProtocolTest { - svc := &OutputService11ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice11protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService11ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService11TestCaseOperation1 = "OperationName" - -// OutputService11TestCaseOperation1Request generates a request for the OutputService11TestCaseOperation1 operation. -func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1Request(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (req *request.Request, output *OutputService11TestShapeOutputService11TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService11TestCaseOperation1, - } - - if input == nil { - input = &OutputService11TestShapeOutputService11TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService11TestShapeOutputService11TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (*OutputService11TestShapeOutputService11TestCaseOperation1Output, error) { - req, out := c.OutputService11TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService11TestShapeOutputService11TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService11TestShapeOutputService11TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Map map[string]*OutputService11TestShapeStructType `type:"map"` -} - -type OutputService11TestShapeStructType struct { - _ struct{} `type:"structure"` - - Foo *string `locationName:"foo" type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService12ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService12ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService12ProtocolTest client from just a session. -// svc := outputservice12protocoltest.New(mySession) -// -// // Create a OutputService12ProtocolTest client with additional configuration -// svc := outputservice12protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService12ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService12ProtocolTest { - c := p.ClientConfig("outputservice12protocoltest", cfgs...) - return newOutputService12ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService12ProtocolTest { - svc := &OutputService12ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice12protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService12ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService12TestCaseOperation1 = "OperationName" - -// OutputService12TestCaseOperation1Request generates a request for the OutputService12TestCaseOperation1 operation. -func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1Request(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (req *request.Request, output *OutputService12TestShapeOutputService12TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService12TestCaseOperation1, - } - - if input == nil { - input = &OutputService12TestShapeOutputService12TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService12TestShapeOutputService12TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (*OutputService12TestShapeOutputService12TestCaseOperation1Output, error) { - req, out := c.OutputService12TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService12TestShapeOutputService12TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService12TestShapeOutputService12TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Map map[string]*string `type:"map" flattened:"true"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService13ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService13ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService13ProtocolTest client from just a session. -// svc := outputservice13protocoltest.New(mySession) -// -// // Create a OutputService13ProtocolTest client with additional configuration -// svc := outputservice13protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService13ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService13ProtocolTest { - c := p.ClientConfig("outputservice13protocoltest", cfgs...) - return newOutputService13ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService13ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService13ProtocolTest { - svc := &OutputService13ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice13protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService13ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService13ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService13TestCaseOperation1 = "OperationName" - -// OutputService13TestCaseOperation1Request generates a request for the OutputService13TestCaseOperation1 operation. -func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1Request(input *OutputService13TestShapeOutputService13TestCaseOperation1Input) (req *request.Request, output *OutputService13TestShapeOutputService13TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService13TestCaseOperation1, - } - - if input == nil { - input = &OutputService13TestShapeOutputService13TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService13TestShapeOutputService13TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1(input *OutputService13TestShapeOutputService13TestCaseOperation1Input) (*OutputService13TestShapeOutputService13TestCaseOperation1Output, error) { - req, out := c.OutputService13TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService13TestShapeOutputService13TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService13TestShapeOutputService13TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Map map[string]*string `locationName:"Attribute" locationNameKey:"Name" locationNameValue:"Value" type:"map" flattened:"true"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService14ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService14ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService14ProtocolTest client from just a session. -// svc := outputservice14protocoltest.New(mySession) -// -// // Create a OutputService14ProtocolTest client with additional configuration -// svc := outputservice14protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService14ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService14ProtocolTest { - c := p.ClientConfig("outputservice14protocoltest", cfgs...) - return newOutputService14ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService14ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService14ProtocolTest { - svc := &OutputService14ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice14protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService14ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService14ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService14TestCaseOperation1 = "OperationName" - -// OutputService14TestCaseOperation1Request generates a request for the OutputService14TestCaseOperation1 operation. -func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1Request(input *OutputService14TestShapeOutputService14TestCaseOperation1Input) (req *request.Request, output *OutputService14TestShapeOutputService14TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService14TestCaseOperation1, - } - - if input == nil { - input = &OutputService14TestShapeOutputService14TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService14TestShapeOutputService14TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1(input *OutputService14TestShapeOutputService14TestCaseOperation1Input) (*OutputService14TestShapeOutputService14TestCaseOperation1Output, error) { - req, out := c.OutputService14TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService14TestShapeOutputService14TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService14TestShapeOutputService14TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Map map[string]*string `locationNameKey:"foo" locationNameValue:"bar" type:"map" flattened:"true"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService15ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService15ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService15ProtocolTest client from just a session. -// svc := outputservice15protocoltest.New(mySession) -// -// // Create a OutputService15ProtocolTest client with additional configuration -// svc := outputservice15protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService15ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService15ProtocolTest { - c := p.ClientConfig("outputservice15protocoltest", cfgs...) - return newOutputService15ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService15ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService15ProtocolTest { - svc := &OutputService15ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice15protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService15ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService15ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService15TestCaseOperation1 = "OperationName" - -// OutputService15TestCaseOperation1Request generates a request for the OutputService15TestCaseOperation1 operation. -func (c *OutputService15ProtocolTest) OutputService15TestCaseOperation1Request(input *OutputService15TestShapeOutputService15TestCaseOperation1Input) (req *request.Request, output *OutputService15TestShapeOutputService15TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService15TestCaseOperation1, - } - - if input == nil { - input = &OutputService15TestShapeOutputService15TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService15TestShapeOutputService15TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService15ProtocolTest) OutputService15TestCaseOperation1(input *OutputService15TestShapeOutputService15TestCaseOperation1Input) (*OutputService15TestShapeOutputService15TestCaseOperation1Output, error) { - req, out := c.OutputService15TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService15TestShapeOutputService15TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService15TestShapeOutputService15TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Foo *string `type:"string"` -} - -// -// Tests begin here -// - -func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("myname123falsetrue1.21.3200a2015-01-25T08:00:00Zrequest-id")) - req, out := svc.OutputService1TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "a", *out.Char) - assert.Equal(t, 1.3, *out.Double) - assert.Equal(t, false, *out.FalseBool) - assert.Equal(t, 1.2, *out.Float) - assert.Equal(t, int64(200), *out.Long) - assert.Equal(t, int64(123), *out.Num) - assert.Equal(t, "myname", *out.Str) - assert.Equal(t, time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.String()) - assert.Equal(t, true, *out.TrueBool) - -} - -func TestOutputService2ProtocolTestNotAllMembersInResponseCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("mynamerequest-id")) - req, out := svc.OutputService2TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "myname", *out.Str) - -} - -func TestOutputService3ProtocolTestBlobCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("dmFsdWU=requestid")) - req, out := svc.OutputService3TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "value", string(out.Blob)) - -} - -func TestOutputService4ProtocolTestListsCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc123requestid")) - req, out := svc.OutputService4TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "abc", *out.ListMember[0]) - assert.Equal(t, "123", *out.ListMember[1]) - -} - -func TestOutputService5ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc123requestid")) - req, out := svc.OutputService5TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "abc", *out.ListMember[0]) - assert.Equal(t, "123", *out.ListMember[1]) - -} - -func TestOutputService6ProtocolTestFlattenedListCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc123requestid")) - req, out := svc.OutputService6TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "abc", *out.ListMember[0]) - assert.Equal(t, "123", *out.ListMember[1]) - -} - -func TestOutputService7ProtocolTestFlattenedSingleElementListCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abcrequestid")) - req, out := svc.OutputService7TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "abc", *out.ListMember[0]) - -} - -func TestOutputService8ProtocolTestListOfStructuresCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("firstfoofirstbarfirstbazsecondfoosecondbarsecondbazrequestid")) - req, out := svc.OutputService8TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "firstbar", *out.List[0].Bar) - assert.Equal(t, "firstbaz", *out.List[0].Baz) - assert.Equal(t, "firstfoo", *out.List[0].Foo) - assert.Equal(t, "secondbar", *out.List[1].Bar) - assert.Equal(t, "secondbaz", *out.List[1].Baz) - assert.Equal(t, "secondfoo", *out.List[1].Foo) - -} - -func TestOutputService9ProtocolTestFlattenedListOfStructuresCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("firstfoofirstbarfirstbazsecondfoosecondbarsecondbazrequestid")) - req, out := svc.OutputService9TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "firstbar", *out.List[0].Bar) - assert.Equal(t, "firstbaz", *out.List[0].Baz) - assert.Equal(t, "firstfoo", *out.List[0].Foo) - assert.Equal(t, "secondbar", *out.List[1].Bar) - assert.Equal(t, "secondbaz", *out.List[1].Baz) - assert.Equal(t, "secondfoo", *out.List[1].Foo) - -} - -func TestOutputService10ProtocolTestFlattenedListWithLocationNameCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService10ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abrequestid")) - req, out := svc.OutputService10TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "a", *out.List[0]) - assert.Equal(t, "b", *out.List[1]) - -} - -func TestOutputService11ProtocolTestNormalMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService11ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) - req, out := svc.OutputService11TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "bam", *out.Map["baz"].Foo) - assert.Equal(t, "bar", *out.Map["qux"].Foo) - -} - -func TestOutputService12ProtocolTestFlattenedMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) - req, out := svc.OutputService12TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "bam", *out.Map["baz"]) - assert.Equal(t, "bar", *out.Map["qux"]) - -} - -func TestOutputService13ProtocolTestFlattenedMapInShapeDefinitionCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService13ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarrequestid")) - req, out := svc.OutputService13TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "bar", *out.Map["qux"]) - -} - -func TestOutputService14ProtocolTestNamedMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService14ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) - req, out := svc.OutputService14TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "bam", *out.Map["baz"]) - assert.Equal(t, "bar", *out.Map["qux"]) - -} - -func TestOutputService15ProtocolTestEmptyStringCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService15ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("requestid")) - req, out := svc.OutputService15TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "", *out.Foo) - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/build_bench_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/build_bench_test.go deleted file mode 100644 index 31e1d6c04c..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/build_bench_test.go +++ /dev/null @@ -1,356 +0,0 @@ -// +build bench - -package restjson_test - -import ( - "bytes" - "encoding/json" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/protocol/rest" - "github.com/aws/aws-sdk-go/private/protocol/restjson" - "github.com/aws/aws-sdk-go/service/elastictranscoder" -) - -func BenchmarkRESTJSONBuild_Complex_elastictranscoderCreateJobInput(b *testing.B) { - svc := awstesting.NewClient() - svc.ServiceName = "elastictranscoder" - svc.APIVersion = "2012-09-25" - - for i := 0; i < b.N; i++ { - r := svc.NewRequest(&request.Operation{Name: "CreateJobInput"}, restjsonBuildParms, nil) - restjson.Build(r) - if r.Error != nil { - b.Fatal("Unexpected error", r.Error) - } - } -} - -func BenchmarkRESTBuild_Complex_elastictranscoderCreateJobInput(b *testing.B) { - svc := awstesting.NewClient() - svc.ServiceName = "elastictranscoder" - svc.APIVersion = "2012-09-25" - - for i := 0; i < b.N; i++ { - r := svc.NewRequest(&request.Operation{Name: "CreateJobInput"}, restjsonBuildParms, nil) - rest.Build(r) - if r.Error != nil { - b.Fatal("Unexpected error", r.Error) - } - } -} - -func BenchmarkEncodingJSONMarshal_Complex_elastictranscoderCreateJobInput(b *testing.B) { - params := restjsonBuildParms - - for i := 0; i < b.N; i++ { - buf := &bytes.Buffer{} - encoder := json.NewEncoder(buf) - if err := encoder.Encode(params); err != nil { - b.Fatal("Unexpected error", err) - } - } -} - -func BenchmarkRESTJSONBuild_Simple_elastictranscoderListJobsByPipeline(b *testing.B) { - svc := awstesting.NewClient() - svc.ServiceName = "elastictranscoder" - svc.APIVersion = "2012-09-25" - - params := &elastictranscoder.ListJobsByPipelineInput{ - PipelineId: aws.String("Id"), // Required - Ascending: aws.String("Ascending"), - PageToken: aws.String("Id"), - } - - for i := 0; i < b.N; i++ { - r := svc.NewRequest(&request.Operation{Name: "ListJobsByPipeline"}, params, nil) - restjson.Build(r) - if r.Error != nil { - b.Fatal("Unexpected error", r.Error) - } - } -} - -func BenchmarkRESTBuild_Simple_elastictranscoderListJobsByPipeline(b *testing.B) { - svc := awstesting.NewClient() - svc.ServiceName = "elastictranscoder" - svc.APIVersion = "2012-09-25" - - params := &elastictranscoder.ListJobsByPipelineInput{ - PipelineId: aws.String("Id"), // Required - Ascending: aws.String("Ascending"), - PageToken: aws.String("Id"), - } - - for i := 0; i < b.N; i++ { - r := svc.NewRequest(&request.Operation{Name: "ListJobsByPipeline"}, params, nil) - rest.Build(r) - if r.Error != nil { - b.Fatal("Unexpected error", r.Error) - } - } -} - -func BenchmarkEncodingJSONMarshal_Simple_elastictranscoderListJobsByPipeline(b *testing.B) { - params := &elastictranscoder.ListJobsByPipelineInput{ - PipelineId: aws.String("Id"), // Required - Ascending: aws.String("Ascending"), - PageToken: aws.String("Id"), - } - - for i := 0; i < b.N; i++ { - buf := &bytes.Buffer{} - encoder := json.NewEncoder(buf) - if err := encoder.Encode(params); err != nil { - b.Fatal("Unexpected error", err) - } - } -} - -var restjsonBuildParms = &elastictranscoder.CreateJobInput{ - Input: &elastictranscoder.JobInput{ // Required - AspectRatio: aws.String("AspectRatio"), - Container: aws.String("JobContainer"), - DetectedProperties: &elastictranscoder.DetectedProperties{ - DurationMillis: aws.Int64(1), - FileSize: aws.Int64(1), - FrameRate: aws.String("FloatString"), - Height: aws.Int64(1), - Width: aws.Int64(1), - }, - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - FrameRate: aws.String("FrameRate"), - Interlaced: aws.String("Interlaced"), - Key: aws.String("Key"), - Resolution: aws.String("Resolution"), - }, - PipelineId: aws.String("Id"), // Required - Output: &elastictranscoder.CreateJobOutput{ - AlbumArt: &elastictranscoder.JobAlbumArt{ - Artwork: []*elastictranscoder.Artwork{ - { // Required - AlbumArtFormat: aws.String("JpgOrPng"), - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - InputKey: aws.String("WatermarkKey"), - MaxHeight: aws.String("DigitsOrAuto"), - MaxWidth: aws.String("DigitsOrAuto"), - PaddingPolicy: aws.String("PaddingPolicy"), - SizingPolicy: aws.String("SizingPolicy"), - }, - // More values... - }, - MergePolicy: aws.String("MergePolicy"), - }, - Captions: &elastictranscoder.Captions{ - CaptionFormats: []*elastictranscoder.CaptionFormat{ - { // Required - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - Format: aws.String("CaptionFormatFormat"), - Pattern: aws.String("CaptionFormatPattern"), - }, - // More values... - }, - CaptionSources: []*elastictranscoder.CaptionSource{ - { // Required - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - Key: aws.String("Key"), - Label: aws.String("Name"), - Language: aws.String("Key"), - TimeOffset: aws.String("TimeOffset"), - }, - // More values... - }, - MergePolicy: aws.String("CaptionMergePolicy"), - }, - Composition: []*elastictranscoder.Clip{ - { // Required - TimeSpan: &elastictranscoder.TimeSpan{ - Duration: aws.String("Time"), - StartTime: aws.String("Time"), - }, - }, - // More values... - }, - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - Key: aws.String("Key"), - PresetId: aws.String("Id"), - Rotate: aws.String("Rotate"), - SegmentDuration: aws.String("FloatString"), - ThumbnailEncryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - ThumbnailPattern: aws.String("ThumbnailPattern"), - Watermarks: []*elastictranscoder.JobWatermark{ - { // Required - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - InputKey: aws.String("WatermarkKey"), - PresetWatermarkId: aws.String("PresetWatermarkId"), - }, - // More values... - }, - }, - OutputKeyPrefix: aws.String("Key"), - Outputs: []*elastictranscoder.CreateJobOutput{ - { // Required - AlbumArt: &elastictranscoder.JobAlbumArt{ - Artwork: []*elastictranscoder.Artwork{ - { // Required - AlbumArtFormat: aws.String("JpgOrPng"), - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - InputKey: aws.String("WatermarkKey"), - MaxHeight: aws.String("DigitsOrAuto"), - MaxWidth: aws.String("DigitsOrAuto"), - PaddingPolicy: aws.String("PaddingPolicy"), - SizingPolicy: aws.String("SizingPolicy"), - }, - // More values... - }, - MergePolicy: aws.String("MergePolicy"), - }, - Captions: &elastictranscoder.Captions{ - CaptionFormats: []*elastictranscoder.CaptionFormat{ - { // Required - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - Format: aws.String("CaptionFormatFormat"), - Pattern: aws.String("CaptionFormatPattern"), - }, - // More values... - }, - CaptionSources: []*elastictranscoder.CaptionSource{ - { // Required - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - Key: aws.String("Key"), - Label: aws.String("Name"), - Language: aws.String("Key"), - TimeOffset: aws.String("TimeOffset"), - }, - // More values... - }, - MergePolicy: aws.String("CaptionMergePolicy"), - }, - Composition: []*elastictranscoder.Clip{ - { // Required - TimeSpan: &elastictranscoder.TimeSpan{ - Duration: aws.String("Time"), - StartTime: aws.String("Time"), - }, - }, - // More values... - }, - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - Key: aws.String("Key"), - PresetId: aws.String("Id"), - Rotate: aws.String("Rotate"), - SegmentDuration: aws.String("FloatString"), - ThumbnailEncryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - ThumbnailPattern: aws.String("ThumbnailPattern"), - Watermarks: []*elastictranscoder.JobWatermark{ - { // Required - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - InputKey: aws.String("WatermarkKey"), - PresetWatermarkId: aws.String("PresetWatermarkId"), - }, - // More values... - }, - }, - // More values... - }, - Playlists: []*elastictranscoder.CreateJobPlaylist{ - { // Required - Format: aws.String("PlaylistFormat"), - HlsContentProtection: &elastictranscoder.HlsContentProtection{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - KeyStoragePolicy: aws.String("KeyStoragePolicy"), - LicenseAcquisitionUrl: aws.String("ZeroTo512String"), - Method: aws.String("HlsContentProtectionMethod"), - }, - Name: aws.String("Filename"), - OutputKeys: []*string{ - aws.String("Key"), // Required - // More values... - }, - PlayReadyDrm: &elastictranscoder.PlayReadyDrm{ - Format: aws.String("PlayReadyDrmFormatString"), - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("NonEmptyBase64EncodedString"), - KeyId: aws.String("KeyIdGuid"), - KeyMd5: aws.String("NonEmptyBase64EncodedString"), - LicenseAcquisitionUrl: aws.String("OneTo512String"), - }, - }, - // More values... - }, - UserMetadata: map[string]*string{ - "Key": aws.String("String"), // Required - // More values... - }, -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/build_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/build_test.go deleted file mode 100644 index 54f6df0f0b..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/build_test.go +++ /dev/null @@ -1,2371 +0,0 @@ -package restjson_test - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "io" - "io/ioutil" - "net/http" - "net/url" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/protocol/restjson" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" - "github.com/aws/aws-sdk-go/private/signer/v4" - "github.com/aws/aws-sdk-go/private/util" - "github.com/stretchr/testify/assert" -) - -var _ bytes.Buffer // always import bytes -var _ http.Request -var _ json.Marshaler -var _ time.Time -var _ xmlutil.XMLNode -var _ xml.Attr -var _ = awstesting.GenerateAssertions -var _ = ioutil.Discard -var _ = util.Trim("") -var _ = url.Values{} -var _ = io.EOF -var _ = aws.String - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService1ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService1ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService1ProtocolTest client from just a session. -// svc := inputservice1protocoltest.New(mySession) -// -// // Create a InputService1ProtocolTest client with additional configuration -// svc := inputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService1ProtocolTest { - c := p.ClientConfig("inputservice1protocoltest", cfgs...) - return newInputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService1ProtocolTest { - svc := &InputService1ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice1protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService1ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService1TestCaseOperation1 = "OperationName" - -// InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputService1TestCaseOperation1Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService1TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService1TestShapeInputService1TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService1TestShapeInputService1TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputService1TestCaseOperation1Input) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) { - req, out := c.InputService1TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService1TestShapeInputService1TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - PipelineId *string `location:"uri" type:"string"` -} - -type InputService1TestShapeInputService1TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService2ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService2ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService2ProtocolTest client from just a session. -// svc := inputservice2protocoltest.New(mySession) -// -// // Create a InputService2ProtocolTest client with additional configuration -// svc := inputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService2ProtocolTest { - c := p.ClientConfig("inputservice2protocoltest", cfgs...) - return newInputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService2ProtocolTest { - svc := &InputService2ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice2protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService2ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService2TestCaseOperation1 = "OperationName" - -// InputService2TestCaseOperation1Request generates a request for the InputService2TestCaseOperation1 operation. -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputService2TestCaseOperation1Input) (req *request.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService2TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService2TestShapeInputService2TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService2TestShapeInputService2TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputService2TestCaseOperation1Input) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) { - req, out := c.InputService2TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService2TestShapeInputService2TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Foo *string `location:"uri" locationName:"PipelineId" type:"string"` -} - -type InputService2TestShapeInputService2TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService3ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService3ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService3ProtocolTest client from just a session. -// svc := inputservice3protocoltest.New(mySession) -// -// // Create a InputService3ProtocolTest client with additional configuration -// svc := inputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService3ProtocolTest { - c := p.ClientConfig("inputservice3protocoltest", cfgs...) - return newInputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService3ProtocolTest { - svc := &InputService3ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice3protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService3ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService3TestCaseOperation1 = "OperationName" - -// InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputService3TestCaseOperation1Input) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService3TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService3TestShapeInputService3TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService3TestShapeInputService3TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputService3TestCaseOperation1Input) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) { - req, out := c.InputService3TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService3TestShapeInputService3TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - PipelineId *string `location:"uri" type:"string"` - - QueryDoc map[string]*string `location:"querystring" type:"map"` -} - -type InputService3TestShapeInputService3TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService4ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService4ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService4ProtocolTest client from just a session. -// svc := inputservice4protocoltest.New(mySession) -// -// // Create a InputService4ProtocolTest client with additional configuration -// svc := inputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService4ProtocolTest { - c := p.ClientConfig("inputservice4protocoltest", cfgs...) - return newInputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService4ProtocolTest { - svc := &InputService4ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice4protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService4ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService4TestCaseOperation1 = "OperationName" - -// InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputService4TestCaseOperation1Input) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService4TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService4TestShapeInputService4TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService4TestShapeInputService4TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputService4TestCaseOperation1Input) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) { - req, out := c.InputService4TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService4TestShapeInputService4TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - PipelineId *string `location:"uri" type:"string"` - - QueryDoc map[string][]*string `location:"querystring" type:"map"` -} - -type InputService4TestShapeInputService4TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService5ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService5ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService5ProtocolTest client from just a session. -// svc := inputservice5protocoltest.New(mySession) -// -// // Create a InputService5ProtocolTest client with additional configuration -// svc := inputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService5ProtocolTest { - c := p.ClientConfig("inputservice5protocoltest", cfgs...) - return newInputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService5ProtocolTest { - svc := &InputService5ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice5protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService5ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService5TestCaseOperation1 = "OperationName" - -// InputService5TestCaseOperation1Request generates a request for the InputService5TestCaseOperation1 operation. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputService5TestCaseOperation1Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService5TestShapeInputService5TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService5TestShapeInputService5TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputService5TestCaseOperation1Input) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) { - req, out := c.InputService5TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService5TestShapeInputService5TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Ascending *string `location:"querystring" locationName:"Ascending" type:"string"` - - PageToken *string `location:"querystring" locationName:"PageToken" type:"string"` - - PipelineId *string `location:"uri" locationName:"PipelineId" type:"string"` -} - -type InputService5TestShapeInputService5TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService6ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService6ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService6ProtocolTest client from just a session. -// svc := inputservice6protocoltest.New(mySession) -// -// // Create a InputService6ProtocolTest client with additional configuration -// svc := inputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService6ProtocolTest { - c := p.ClientConfig("inputservice6protocoltest", cfgs...) - return newInputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService6ProtocolTest { - svc := &InputService6ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice6protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService6ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService6TestCaseOperation1 = "OperationName" - -// InputService6TestCaseOperation1Request generates a request for the InputService6TestCaseOperation1 operation. -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputService6TestCaseOperation1Input) (req *request.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService6TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService6TestShapeInputService6TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService6TestShapeInputService6TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputService6TestCaseOperation1Input) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) { - req, out := c.InputService6TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService6TestShapeInputService6TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Ascending *string `location:"querystring" locationName:"Ascending" type:"string"` - - Config *InputService6TestShapeStructType `type:"structure"` - - PageToken *string `location:"querystring" locationName:"PageToken" type:"string"` - - PipelineId *string `location:"uri" locationName:"PipelineId" type:"string"` -} - -type InputService6TestShapeInputService6TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService6TestShapeStructType struct { - _ struct{} `type:"structure"` - - A *string `type:"string"` - - B *string `type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService7ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService7ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService7ProtocolTest client from just a session. -// svc := inputservice7protocoltest.New(mySession) -// -// // Create a InputService7ProtocolTest client with additional configuration -// svc := inputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService7ProtocolTest { - c := p.ClientConfig("inputservice7protocoltest", cfgs...) - return newInputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService7ProtocolTest { - svc := &InputService7ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice7protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService7ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService7TestCaseOperation1 = "OperationName" - -// InputService7TestCaseOperation1Request generates a request for the InputService7TestCaseOperation1 operation. -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputService7TestCaseOperation1Input) (req *request.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService7TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService7TestShapeInputService7TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService7TestShapeInputService7TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputService7TestCaseOperation1Input) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) { - req, out := c.InputService7TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService7TestShapeInputService7TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Ascending *string `location:"querystring" locationName:"Ascending" type:"string"` - - Checksum *string `location:"header" locationName:"x-amz-checksum" type:"string"` - - Config *InputService7TestShapeStructType `type:"structure"` - - PageToken *string `location:"querystring" locationName:"PageToken" type:"string"` - - PipelineId *string `location:"uri" locationName:"PipelineId" type:"string"` -} - -type InputService7TestShapeInputService7TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService7TestShapeStructType struct { - _ struct{} `type:"structure"` - - A *string `type:"string"` - - B *string `type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService8ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService8ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService8ProtocolTest client from just a session. -// svc := inputservice8protocoltest.New(mySession) -// -// // Create a InputService8ProtocolTest client with additional configuration -// svc := inputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService8ProtocolTest { - c := p.ClientConfig("inputservice8protocoltest", cfgs...) - return newInputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService8ProtocolTest { - svc := &InputService8ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice8protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService8ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService8TestCaseOperation1 = "OperationName" - -// InputService8TestCaseOperation1Request generates a request for the InputService8TestCaseOperation1 operation. -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputService8TestCaseOperation1Input) (req *request.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService8TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/vaults/{vaultName}/archives", - } - - if input == nil { - input = &InputService8TestShapeInputService8TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService8TestShapeInputService8TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputService8TestCaseOperation1Input) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) { - req, out := c.InputService8TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService8TestShapeInputService8TestCaseOperation1Input struct { - _ struct{} `type:"structure" payload:"Body"` - - Body io.ReadSeeker `locationName:"body" type:"blob"` - - Checksum *string `location:"header" locationName:"x-amz-sha256-tree-hash" type:"string"` - - VaultName *string `location:"uri" locationName:"vaultName" type:"string" required:"true"` -} - -type InputService8TestShapeInputService8TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService9ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService9ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService9ProtocolTest client from just a session. -// svc := inputservice9protocoltest.New(mySession) -// -// // Create a InputService9ProtocolTest client with additional configuration -// svc := inputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService9ProtocolTest { - c := p.ClientConfig("inputservice9protocoltest", cfgs...) - return newInputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService9ProtocolTest { - svc := &InputService9ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice9protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService9ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService9TestCaseOperation1 = "OperationName" - -// InputService9TestCaseOperation1Request generates a request for the InputService9TestCaseOperation1 operation. -func (c *InputService9ProtocolTest) InputService9TestCaseOperation1Request(input *InputService9TestShapeInputService9TestCaseOperation1Input) (req *request.Request, output *InputService9TestShapeInputService9TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService9TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService9TestShapeInputService9TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService9TestShapeInputService9TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService9ProtocolTest) InputService9TestCaseOperation1(input *InputService9TestShapeInputService9TestCaseOperation1Input) (*InputService9TestShapeInputService9TestCaseOperation1Output, error) { - req, out := c.InputService9TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService9TestShapeInputService9TestCaseOperation1Input struct { - _ struct{} `type:"structure" payload:"Foo"` - - Foo *string `locationName:"foo" type:"string"` -} - -type InputService9TestShapeInputService9TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService10ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService10ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService10ProtocolTest client from just a session. -// svc := inputservice10protocoltest.New(mySession) -// -// // Create a InputService10ProtocolTest client with additional configuration -// svc := inputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService10ProtocolTest { - c := p.ClientConfig("inputservice10protocoltest", cfgs...) - return newInputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService10ProtocolTest { - svc := &InputService10ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice10protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService10ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService10TestCaseOperation1 = "OperationName" - -// InputService10TestCaseOperation1Request generates a request for the InputService10TestCaseOperation1 operation. -func (c *InputService10ProtocolTest) InputService10TestCaseOperation1Request(input *InputService10TestShapeInputShape) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService10TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService10TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService10TestShapeInputService10TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService10ProtocolTest) InputService10TestCaseOperation1(input *InputService10TestShapeInputShape) (*InputService10TestShapeInputService10TestCaseOperation1Output, error) { - req, out := c.InputService10TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService10TestCaseOperation2 = "OperationName" - -// InputService10TestCaseOperation2Request generates a request for the InputService10TestCaseOperation2 operation. -func (c *InputService10ProtocolTest) InputService10TestCaseOperation2Request(input *InputService10TestShapeInputShape) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService10TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService10TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService10TestShapeInputService10TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService10ProtocolTest) InputService10TestCaseOperation2(input *InputService10TestShapeInputShape) (*InputService10TestShapeInputService10TestCaseOperation2Output, error) { - req, out := c.InputService10TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -type InputService10TestShapeInputService10TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService10TestShapeInputService10TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService10TestShapeInputShape struct { - _ struct{} `type:"structure" payload:"Foo"` - - Foo []byte `locationName:"foo" type:"blob"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService11ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService11ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService11ProtocolTest client from just a session. -// svc := inputservice11protocoltest.New(mySession) -// -// // Create a InputService11ProtocolTest client with additional configuration -// svc := inputservice11protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService11ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService11ProtocolTest { - c := p.ClientConfig("inputservice11protocoltest", cfgs...) - return newInputService11ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService11ProtocolTest { - svc := &InputService11ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice11protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService11ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService11TestCaseOperation1 = "OperationName" - -// InputService11TestCaseOperation1Request generates a request for the InputService11TestCaseOperation1 operation. -func (c *InputService11ProtocolTest) InputService11TestCaseOperation1Request(input *InputService11TestShapeInputShape) (req *request.Request, output *InputService11TestShapeInputService11TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService11TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService11TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService11TestShapeInputService11TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService11ProtocolTest) InputService11TestCaseOperation1(input *InputService11TestShapeInputShape) (*InputService11TestShapeInputService11TestCaseOperation1Output, error) { - req, out := c.InputService11TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService11TestCaseOperation2 = "OperationName" - -// InputService11TestCaseOperation2Request generates a request for the InputService11TestCaseOperation2 operation. -func (c *InputService11ProtocolTest) InputService11TestCaseOperation2Request(input *InputService11TestShapeInputShape) (req *request.Request, output *InputService11TestShapeInputService11TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService11TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService11TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService11TestShapeInputService11TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService11ProtocolTest) InputService11TestCaseOperation2(input *InputService11TestShapeInputShape) (*InputService11TestShapeInputService11TestCaseOperation2Output, error) { - req, out := c.InputService11TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -type InputService11TestShapeFooShape struct { - _ struct{} `locationName:"foo" type:"structure"` - - Baz *string `locationName:"baz" type:"string"` -} - -type InputService11TestShapeInputService11TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService11TestShapeInputService11TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService11TestShapeInputShape struct { - _ struct{} `type:"structure" payload:"Foo"` - - Foo *InputService11TestShapeFooShape `locationName:"foo" type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService12ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService12ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService12ProtocolTest client from just a session. -// svc := inputservice12protocoltest.New(mySession) -// -// // Create a InputService12ProtocolTest client with additional configuration -// svc := inputservice12protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService12ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService12ProtocolTest { - c := p.ClientConfig("inputservice12protocoltest", cfgs...) - return newInputService12ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService12ProtocolTest { - svc := &InputService12ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice12protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService12ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService12TestCaseOperation1 = "OperationName" - -// InputService12TestCaseOperation1Request generates a request for the InputService12TestCaseOperation1 operation. -func (c *InputService12ProtocolTest) InputService12TestCaseOperation1Request(input *InputService12TestShapeInputShape) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService12TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService12TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService12TestShapeInputService12TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService12ProtocolTest) InputService12TestCaseOperation1(input *InputService12TestShapeInputShape) (*InputService12TestShapeInputService12TestCaseOperation1Output, error) { - req, out := c.InputService12TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService12TestCaseOperation2 = "OperationName" - -// InputService12TestCaseOperation2Request generates a request for the InputService12TestCaseOperation2 operation. -func (c *InputService12ProtocolTest) InputService12TestCaseOperation2Request(input *InputService12TestShapeInputShape) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService12TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/path?abc=mno", - } - - if input == nil { - input = &InputService12TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService12TestShapeInputService12TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService12ProtocolTest) InputService12TestCaseOperation2(input *InputService12TestShapeInputShape) (*InputService12TestShapeInputService12TestCaseOperation2Output, error) { - req, out := c.InputService12TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -type InputService12TestShapeInputService12TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService12TestShapeInputService12TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService12TestShapeInputShape struct { - _ struct{} `type:"structure"` - - Foo *string `location:"querystring" locationName:"param-name" type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService13ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService13ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService13ProtocolTest client from just a session. -// svc := inputservice13protocoltest.New(mySession) -// -// // Create a InputService13ProtocolTest client with additional configuration -// svc := inputservice13protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService13ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService13ProtocolTest { - c := p.ClientConfig("inputservice13protocoltest", cfgs...) - return newInputService13ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService13ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService13ProtocolTest { - svc := &InputService13ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice13protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService13ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService13ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService13TestCaseOperation1 = "OperationName" - -// InputService13TestCaseOperation1Request generates a request for the InputService13TestCaseOperation1 operation. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation1Request(input *InputService13TestShapeInputShape) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService13TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService13TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService13TestShapeInputService13TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService13ProtocolTest) InputService13TestCaseOperation1(input *InputService13TestShapeInputShape) (*InputService13TestShapeInputService13TestCaseOperation1Output, error) { - req, out := c.InputService13TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService13TestCaseOperation2 = "OperationName" - -// InputService13TestCaseOperation2Request generates a request for the InputService13TestCaseOperation2 operation. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation2Request(input *InputService13TestShapeInputShape) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService13TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService13TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService13TestShapeInputService13TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService13ProtocolTest) InputService13TestCaseOperation2(input *InputService13TestShapeInputShape) (*InputService13TestShapeInputService13TestCaseOperation2Output, error) { - req, out := c.InputService13TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -const opInputService13TestCaseOperation3 = "OperationName" - -// InputService13TestCaseOperation3Request generates a request for the InputService13TestCaseOperation3 operation. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation3Request(input *InputService13TestShapeInputShape) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation3Output) { - op := &request.Operation{ - Name: opInputService13TestCaseOperation3, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService13TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService13TestShapeInputService13TestCaseOperation3Output{} - req.Data = output - return -} - -func (c *InputService13ProtocolTest) InputService13TestCaseOperation3(input *InputService13TestShapeInputShape) (*InputService13TestShapeInputService13TestCaseOperation3Output, error) { - req, out := c.InputService13TestCaseOperation3Request(input) - err := req.Send() - return out, err -} - -const opInputService13TestCaseOperation4 = "OperationName" - -// InputService13TestCaseOperation4Request generates a request for the InputService13TestCaseOperation4 operation. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation4Request(input *InputService13TestShapeInputShape) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation4Output) { - op := &request.Operation{ - Name: opInputService13TestCaseOperation4, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService13TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService13TestShapeInputService13TestCaseOperation4Output{} - req.Data = output - return -} - -func (c *InputService13ProtocolTest) InputService13TestCaseOperation4(input *InputService13TestShapeInputShape) (*InputService13TestShapeInputService13TestCaseOperation4Output, error) { - req, out := c.InputService13TestCaseOperation4Request(input) - err := req.Send() - return out, err -} - -const opInputService13TestCaseOperation5 = "OperationName" - -// InputService13TestCaseOperation5Request generates a request for the InputService13TestCaseOperation5 operation. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation5Request(input *InputService13TestShapeInputShape) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation5Output) { - op := &request.Operation{ - Name: opInputService13TestCaseOperation5, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService13TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService13TestShapeInputService13TestCaseOperation5Output{} - req.Data = output - return -} - -func (c *InputService13ProtocolTest) InputService13TestCaseOperation5(input *InputService13TestShapeInputShape) (*InputService13TestShapeInputService13TestCaseOperation5Output, error) { - req, out := c.InputService13TestCaseOperation5Request(input) - err := req.Send() - return out, err -} - -const opInputService13TestCaseOperation6 = "OperationName" - -// InputService13TestCaseOperation6Request generates a request for the InputService13TestCaseOperation6 operation. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation6Request(input *InputService13TestShapeInputShape) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation6Output) { - op := &request.Operation{ - Name: opInputService13TestCaseOperation6, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService13TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService13TestShapeInputService13TestCaseOperation6Output{} - req.Data = output - return -} - -func (c *InputService13ProtocolTest) InputService13TestCaseOperation6(input *InputService13TestShapeInputShape) (*InputService13TestShapeInputService13TestCaseOperation6Output, error) { - req, out := c.InputService13TestCaseOperation6Request(input) - err := req.Send() - return out, err -} - -type InputService13TestShapeInputService13TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService13TestShapeInputService13TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService13TestShapeInputService13TestCaseOperation3Output struct { - _ struct{} `type:"structure"` -} - -type InputService13TestShapeInputService13TestCaseOperation4Output struct { - _ struct{} `type:"structure"` -} - -type InputService13TestShapeInputService13TestCaseOperation5Output struct { - _ struct{} `type:"structure"` -} - -type InputService13TestShapeInputService13TestCaseOperation6Output struct { - _ struct{} `type:"structure"` -} - -type InputService13TestShapeInputShape struct { - _ struct{} `type:"structure"` - - RecursiveStruct *InputService13TestShapeRecursiveStructType `type:"structure"` -} - -type InputService13TestShapeRecursiveStructType struct { - _ struct{} `type:"structure"` - - NoRecurse *string `type:"string"` - - RecursiveList []*InputService13TestShapeRecursiveStructType `type:"list"` - - RecursiveMap map[string]*InputService13TestShapeRecursiveStructType `type:"map"` - - RecursiveStruct *InputService13TestShapeRecursiveStructType `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService14ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService14ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService14ProtocolTest client from just a session. -// svc := inputservice14protocoltest.New(mySession) -// -// // Create a InputService14ProtocolTest client with additional configuration -// svc := inputservice14protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService14ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService14ProtocolTest { - c := p.ClientConfig("inputservice14protocoltest", cfgs...) - return newInputService14ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService14ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService14ProtocolTest { - svc := &InputService14ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice14protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService14ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService14ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService14TestCaseOperation1 = "OperationName" - -// InputService14TestCaseOperation1Request generates a request for the InputService14TestCaseOperation1 operation. -func (c *InputService14ProtocolTest) InputService14TestCaseOperation1Request(input *InputService14TestShapeInputShape) (req *request.Request, output *InputService14TestShapeInputService14TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService14TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService14TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService14TestShapeInputService14TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService14ProtocolTest) InputService14TestCaseOperation1(input *InputService14TestShapeInputShape) (*InputService14TestShapeInputService14TestCaseOperation1Output, error) { - req, out := c.InputService14TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService14TestCaseOperation2 = "OperationName" - -// InputService14TestCaseOperation2Request generates a request for the InputService14TestCaseOperation2 operation. -func (c *InputService14ProtocolTest) InputService14TestCaseOperation2Request(input *InputService14TestShapeInputShape) (req *request.Request, output *InputService14TestShapeInputService14TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService14TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService14TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService14TestShapeInputService14TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService14ProtocolTest) InputService14TestCaseOperation2(input *InputService14TestShapeInputShape) (*InputService14TestShapeInputService14TestCaseOperation2Output, error) { - req, out := c.InputService14TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -type InputService14TestShapeInputService14TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService14TestShapeInputService14TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService14TestShapeInputShape struct { - _ struct{} `type:"structure"` - - TimeArg *time.Time `type:"timestamp" timestampFormat:"unix"` - - TimeArgInHeader *time.Time `location:"header" locationName:"x-amz-timearg" type:"timestamp" timestampFormat:"rfc822"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService15ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService15ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService15ProtocolTest client from just a session. -// svc := inputservice15protocoltest.New(mySession) -// -// // Create a InputService15ProtocolTest client with additional configuration -// svc := inputservice15protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService15ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService15ProtocolTest { - c := p.ClientConfig("inputservice15protocoltest", cfgs...) - return newInputService15ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService15ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService15ProtocolTest { - svc := &InputService15ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice15protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService15ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService15ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService15TestCaseOperation1 = "OperationName" - -// InputService15TestCaseOperation1Request generates a request for the InputService15TestCaseOperation1 operation. -func (c *InputService15ProtocolTest) InputService15TestCaseOperation1Request(input *InputService15TestShapeInputService15TestCaseOperation1Input) (req *request.Request, output *InputService15TestShapeInputService15TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService15TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService15TestShapeInputService15TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService15TestShapeInputService15TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService15ProtocolTest) InputService15TestCaseOperation1(input *InputService15TestShapeInputService15TestCaseOperation1Input) (*InputService15TestShapeInputService15TestCaseOperation1Output, error) { - req, out := c.InputService15TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService15TestShapeInputService15TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - TimeArg *time.Time `locationName:"timestamp_location" type:"timestamp" timestampFormat:"unix"` -} - -type InputService15TestShapeInputService15TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// -// Tests begin here -// - -func TestInputService1ProtocolTestURIParameterOnlyWithNoLocationNameCase1(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService1TestShapeInputService1TestCaseOperation1Input{ - PipelineId: aws.String("foo"), - } - req, _ := svc.InputService1TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/foo", r.URL.String()) - - // assert headers - -} - -func TestInputService2ProtocolTestURIParameterOnlyWithLocationNameCase1(t *testing.T) { - sess := session.New() - svc := NewInputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService2TestShapeInputService2TestCaseOperation1Input{ - Foo: aws.String("bar"), - } - req, _ := svc.InputService2TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/bar", r.URL.String()) - - // assert headers - -} - -func TestInputService3ProtocolTestStringToStringMapsInQuerystringCase1(t *testing.T) { - sess := session.New() - svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService3TestShapeInputService3TestCaseOperation1Input{ - PipelineId: aws.String("foo"), - QueryDoc: map[string]*string{ - "bar": aws.String("baz"), - "fizz": aws.String("buzz"), - }, - } - req, _ := svc.InputService3TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/foo?bar=baz&fizz=buzz", r.URL.String()) - - // assert headers - -} - -func TestInputService4ProtocolTestStringToStringListMapsInQuerystringCase1(t *testing.T) { - sess := session.New() - svc := NewInputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService4TestShapeInputService4TestCaseOperation1Input{ - PipelineId: aws.String("id"), - QueryDoc: map[string][]*string{ - "fizz": { - aws.String("buzz"), - aws.String("pop"), - }, - "foo": { - aws.String("bar"), - aws.String("baz"), - }, - }, - } - req, _ := svc.InputService4TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/id?foo=bar&foo=baz&fizz=buzz&fizz=pop", r.URL.String()) - - // assert headers - -} - -func TestInputService5ProtocolTestURIParameterAndQuerystringParamsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService5TestShapeInputService5TestCaseOperation1Input{ - Ascending: aws.String("true"), - PageToken: aws.String("bar"), - PipelineId: aws.String("foo"), - } - req, _ := svc.InputService5TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/foo?Ascending=true&PageToken=bar", r.URL.String()) - - // assert headers - -} - -func TestInputService6ProtocolTestURIParameterQuerystringParamsAndJSONBodyCase1(t *testing.T) { - sess := session.New() - svc := NewInputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService6TestShapeInputService6TestCaseOperation1Input{ - Ascending: aws.String("true"), - Config: &InputService6TestShapeStructType{ - A: aws.String("one"), - B: aws.String("two"), - }, - PageToken: aws.String("bar"), - PipelineId: aws.String("foo"), - } - req, _ := svc.InputService6TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"Config":{"A":"one","B":"two"}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/foo?Ascending=true&PageToken=bar", r.URL.String()) - - // assert headers - -} - -func TestInputService7ProtocolTestURIParameterQuerystringParamsHeadersAndJSONBodyCase1(t *testing.T) { - sess := session.New() - svc := NewInputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService7TestShapeInputService7TestCaseOperation1Input{ - Ascending: aws.String("true"), - Checksum: aws.String("12345"), - Config: &InputService7TestShapeStructType{ - A: aws.String("one"), - B: aws.String("two"), - }, - PageToken: aws.String("bar"), - PipelineId: aws.String("foo"), - } - req, _ := svc.InputService7TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"Config":{"A":"one","B":"two"}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/foo?Ascending=true&PageToken=bar", r.URL.String()) - - // assert headers - assert.Equal(t, "12345", r.Header.Get("x-amz-checksum")) - -} - -func TestInputService8ProtocolTestStreamingPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewInputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService8TestShapeInputService8TestCaseOperation1Input{ - Body: aws.ReadSeekCloser(bytes.NewBufferString("contents")), - Checksum: aws.String("foo"), - VaultName: aws.String("name"), - } - req, _ := svc.InputService8TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - assert.Equal(t, `contents`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/vaults/name/archives", r.URL.String()) - - // assert headers - assert.Equal(t, "foo", r.Header.Get("x-amz-sha256-tree-hash")) - -} - -func TestInputService9ProtocolTestStringPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewInputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService9TestShapeInputService9TestCaseOperation1Input{ - Foo: aws.String("bar"), - } - req, _ := svc.InputService9TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - assert.Equal(t, `bar`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService10ProtocolTestBlobPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewInputService10ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService10TestShapeInputShape{ - Foo: []byte("bar"), - } - req, _ := svc.InputService10TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - assert.Equal(t, `bar`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService10ProtocolTestBlobPayloadCase2(t *testing.T) { - sess := session.New() - svc := NewInputService10ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService10TestShapeInputShape{} - req, _ := svc.InputService10TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService11ProtocolTestStructurePayloadCase1(t *testing.T) { - sess := session.New() - svc := NewInputService11ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService11TestShapeInputShape{ - Foo: &InputService11TestShapeFooShape{ - Baz: aws.String("bar"), - }, - } - req, _ := svc.InputService11TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"baz":"bar"}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService11ProtocolTestStructurePayloadCase2(t *testing.T) { - sess := session.New() - svc := NewInputService11ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService11TestShapeInputShape{} - req, _ := svc.InputService11TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService12ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService12TestShapeInputShape{} - req, _ := svc.InputService12TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService12ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase2(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService12TestShapeInputShape{ - Foo: aws.String(""), - } - req, _ := svc.InputService12TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/path?abc=mno¶m-name=", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestRecursiveShapesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService13ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService13TestShapeInputShape{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - } - req, _ := svc.InputService13TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"NoRecurse":"foo"}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestRecursiveShapesCase2(t *testing.T) { - sess := session.New() - svc := NewInputService13ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService13TestShapeInputShape{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - } - req, _ := svc.InputService13TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveStruct":{"NoRecurse":"foo"}}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestRecursiveShapesCase3(t *testing.T) { - sess := session.New() - svc := NewInputService13ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService13TestShapeInputShape{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - }, - }, - } - req, _ := svc.InputService13TestCaseOperation3Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveStruct":{"RecursiveStruct":{"RecursiveStruct":{"NoRecurse":"foo"}}}}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestRecursiveShapesCase4(t *testing.T) { - sess := session.New() - svc := NewInputService13ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService13TestShapeInputShape{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - RecursiveList: []*InputService13TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - NoRecurse: aws.String("bar"), - }, - }, - }, - } - req, _ := svc.InputService13TestCaseOperation4Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveList":[{"NoRecurse":"foo"},{"NoRecurse":"bar"}]}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestRecursiveShapesCase5(t *testing.T) { - sess := session.New() - svc := NewInputService13ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService13TestShapeInputShape{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - RecursiveList: []*InputService13TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - NoRecurse: aws.String("bar"), - }, - }, - }, - }, - } - req, _ := svc.InputService13TestCaseOperation5Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveList":[{"NoRecurse":"foo"},{"RecursiveStruct":{"NoRecurse":"bar"}}]}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestRecursiveShapesCase6(t *testing.T) { - sess := session.New() - svc := NewInputService13ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService13TestShapeInputShape{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - RecursiveMap: map[string]*InputService13TestShapeRecursiveStructType{ - "bar": { - NoRecurse: aws.String("bar"), - }, - "foo": { - NoRecurse: aws.String("foo"), - }, - }, - }, - } - req, _ := svc.InputService13TestCaseOperation6Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveMap":{"foo":{"NoRecurse":"foo"},"bar":{"NoRecurse":"bar"}}}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService14ProtocolTestTimestampValuesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService14ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService14TestShapeInputShape{ - TimeArg: aws.Time(time.Unix(1422172800, 0)), - } - req, _ := svc.InputService14TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"TimeArg":1422172800}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService14ProtocolTestTimestampValuesCase2(t *testing.T) { - sess := session.New() - svc := NewInputService14ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService14TestShapeInputShape{ - TimeArgInHeader: aws.Time(time.Unix(1422172800, 0)), - } - req, _ := svc.InputService14TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - assert.Equal(t, "Sun, 25 Jan 2015 08:00:00 GMT", r.Header.Get("x-amz-timearg")) - -} - -func TestInputService15ProtocolTestNamedLocationsInJSONBodyCase1(t *testing.T) { - sess := session.New() - svc := NewInputService15ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService15TestShapeInputService15TestCaseOperation1Input{ - TimeArg: aws.Time(time.Unix(1422172800, 0)), - } - req, _ := svc.InputService15TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"timestamp_location":1422172800}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/unmarshal_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/unmarshal_test.go deleted file mode 100644 index 7069e01641..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/unmarshal_test.go +++ /dev/null @@ -1,1321 +0,0 @@ -package restjson_test - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "io" - "io/ioutil" - "net/http" - "net/url" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/protocol/restjson" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" - "github.com/aws/aws-sdk-go/private/signer/v4" - "github.com/aws/aws-sdk-go/private/util" - "github.com/stretchr/testify/assert" -) - -var _ bytes.Buffer // always import bytes -var _ http.Request -var _ json.Marshaler -var _ time.Time -var _ xmlutil.XMLNode -var _ xml.Attr -var _ = awstesting.GenerateAssertions -var _ = ioutil.Discard -var _ = util.Trim("") -var _ = url.Values{} -var _ = io.EOF -var _ = aws.String - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService1ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService1ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService1ProtocolTest client from just a session. -// svc := outputservice1protocoltest.New(mySession) -// -// // Create a OutputService1ProtocolTest client with additional configuration -// svc := outputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService1ProtocolTest { - c := p.ClientConfig("outputservice1protocoltest", cfgs...) - return newOutputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService1ProtocolTest { - svc := &OutputService1ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice1protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService1ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService1TestCaseOperation1 = "OperationName" - -// OutputService1TestCaseOperation1Request generates a request for the OutputService1TestCaseOperation1 operation. -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService1TestCaseOperation1, - } - - if input == nil { - input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService1TestShapeOutputService1TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) { - req, out := c.OutputService1TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService1TestShapeOutputService1TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService1TestShapeOutputService1TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Char *string `type:"character"` - - Double *float64 `type:"double"` - - FalseBool *bool `type:"boolean"` - - Float *float64 `type:"float"` - - ImaHeader *string `location:"header" type:"string"` - - ImaHeaderLocation *string `location:"header" locationName:"X-Foo" type:"string"` - - Long *int64 `type:"long"` - - Num *int64 `type:"integer"` - - Status *int64 `location:"statusCode" type:"integer"` - - Str *string `type:"string"` - - TrueBool *bool `type:"boolean"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService2ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService2ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService2ProtocolTest client from just a session. -// svc := outputservice2protocoltest.New(mySession) -// -// // Create a OutputService2ProtocolTest client with additional configuration -// svc := outputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService2ProtocolTest { - c := p.ClientConfig("outputservice2protocoltest", cfgs...) - return newOutputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService2ProtocolTest { - svc := &OutputService2ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice2protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService2ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService2TestCaseOperation1 = "OperationName" - -// OutputService2TestCaseOperation1Request generates a request for the OutputService2TestCaseOperation1 operation. -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *request.Request, output *OutputService2TestShapeOutputService2TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService2TestCaseOperation1, - } - - if input == nil { - input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService2TestShapeOutputService2TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) { - req, out := c.OutputService2TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService2TestShapeBlobContainer struct { - _ struct{} `type:"structure"` - - Foo []byte `locationName:"foo" type:"blob"` -} - -type OutputService2TestShapeOutputService2TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService2TestShapeOutputService2TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - BlobMember []byte `type:"blob"` - - StructMember *OutputService2TestShapeBlobContainer `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService3ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService3ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService3ProtocolTest client from just a session. -// svc := outputservice3protocoltest.New(mySession) -// -// // Create a OutputService3ProtocolTest client with additional configuration -// svc := outputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService3ProtocolTest { - c := p.ClientConfig("outputservice3protocoltest", cfgs...) - return newOutputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService3ProtocolTest { - svc := &OutputService3ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice3protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService3ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService3TestCaseOperation1 = "OperationName" - -// OutputService3TestCaseOperation1Request generates a request for the OutputService3TestCaseOperation1 operation. -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *request.Request, output *OutputService3TestShapeOutputService3TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService3TestCaseOperation1, - } - - if input == nil { - input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService3TestShapeOutputService3TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) { - req, out := c.OutputService3TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService3TestShapeOutputService3TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService3TestShapeOutputService3TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - StructMember *OutputService3TestShapeTimeContainer `type:"structure"` - - TimeMember *time.Time `type:"timestamp" timestampFormat:"unix"` -} - -type OutputService3TestShapeTimeContainer struct { - _ struct{} `type:"structure"` - - Foo *time.Time `locationName:"foo" type:"timestamp" timestampFormat:"unix"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService4ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService4ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService4ProtocolTest client from just a session. -// svc := outputservice4protocoltest.New(mySession) -// -// // Create a OutputService4ProtocolTest client with additional configuration -// svc := outputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService4ProtocolTest { - c := p.ClientConfig("outputservice4protocoltest", cfgs...) - return newOutputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService4ProtocolTest { - svc := &OutputService4ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice4protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService4ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService4TestCaseOperation1 = "OperationName" - -// OutputService4TestCaseOperation1Request generates a request for the OutputService4TestCaseOperation1 operation. -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *request.Request, output *OutputService4TestShapeOutputService4TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService4TestCaseOperation1, - } - - if input == nil { - input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService4TestShapeOutputService4TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputService4TestCaseOperation1Output, error) { - req, out := c.OutputService4TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService4TestShapeOutputService4TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService4TestShapeOutputService4TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `type:"list"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService5ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService5ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService5ProtocolTest client from just a session. -// svc := outputservice5protocoltest.New(mySession) -// -// // Create a OutputService5ProtocolTest client with additional configuration -// svc := outputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService5ProtocolTest { - c := p.ClientConfig("outputservice5protocoltest", cfgs...) - return newOutputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService5ProtocolTest { - svc := &OutputService5ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice5protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService5ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService5TestCaseOperation1 = "OperationName" - -// OutputService5TestCaseOperation1Request generates a request for the OutputService5TestCaseOperation1 operation. -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *request.Request, output *OutputService5TestShapeOutputService5TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService5TestCaseOperation1, - } - - if input == nil { - input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService5TestShapeOutputService5TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) { - req, out := c.OutputService5TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService5TestShapeOutputService5TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService5TestShapeOutputService5TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*OutputService5TestShapeSingleStruct `type:"list"` -} - -type OutputService5TestShapeSingleStruct struct { - _ struct{} `type:"structure"` - - Foo *string `type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService6ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService6ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService6ProtocolTest client from just a session. -// svc := outputservice6protocoltest.New(mySession) -// -// // Create a OutputService6ProtocolTest client with additional configuration -// svc := outputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService6ProtocolTest { - c := p.ClientConfig("outputservice6protocoltest", cfgs...) - return newOutputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService6ProtocolTest { - svc := &OutputService6ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice6protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService6ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService6TestCaseOperation1 = "OperationName" - -// OutputService6TestCaseOperation1Request generates a request for the OutputService6TestCaseOperation1 operation. -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *request.Request, output *OutputService6TestShapeOutputService6TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService6TestCaseOperation1, - } - - if input == nil { - input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService6TestShapeOutputService6TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) { - req, out := c.OutputService6TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService6TestShapeOutputService6TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService6TestShapeOutputService6TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - MapMember map[string][]*int64 `type:"map"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService7ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService7ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService7ProtocolTest client from just a session. -// svc := outputservice7protocoltest.New(mySession) -// -// // Create a OutputService7ProtocolTest client with additional configuration -// svc := outputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService7ProtocolTest { - c := p.ClientConfig("outputservice7protocoltest", cfgs...) - return newOutputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService7ProtocolTest { - svc := &OutputService7ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice7protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService7ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService7TestCaseOperation1 = "OperationName" - -// OutputService7TestCaseOperation1Request generates a request for the OutputService7TestCaseOperation1 operation. -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *request.Request, output *OutputService7TestShapeOutputService7TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService7TestCaseOperation1, - } - - if input == nil { - input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService7TestShapeOutputService7TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) { - req, out := c.OutputService7TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService7TestShapeOutputService7TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService7TestShapeOutputService7TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - MapMember map[string]*time.Time `type:"map"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService8ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService8ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService8ProtocolTest client from just a session. -// svc := outputservice8protocoltest.New(mySession) -// -// // Create a OutputService8ProtocolTest client with additional configuration -// svc := outputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService8ProtocolTest { - c := p.ClientConfig("outputservice8protocoltest", cfgs...) - return newOutputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService8ProtocolTest { - svc := &OutputService8ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice8protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService8ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService8TestCaseOperation1 = "OperationName" - -// OutputService8TestCaseOperation1Request generates a request for the OutputService8TestCaseOperation1 operation. -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *request.Request, output *OutputService8TestShapeOutputService8TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService8TestCaseOperation1, - } - - if input == nil { - input = &OutputService8TestShapeOutputService8TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService8TestShapeOutputService8TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (*OutputService8TestShapeOutputService8TestCaseOperation1Output, error) { - req, out := c.OutputService8TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService8TestShapeOutputService8TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService8TestShapeOutputService8TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - StrType *string `type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService9ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService9ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService9ProtocolTest client from just a session. -// svc := outputservice9protocoltest.New(mySession) -// -// // Create a OutputService9ProtocolTest client with additional configuration -// svc := outputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService9ProtocolTest { - c := p.ClientConfig("outputservice9protocoltest", cfgs...) - return newOutputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService9ProtocolTest { - svc := &OutputService9ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice9protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService9ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService9TestCaseOperation1 = "OperationName" - -// OutputService9TestCaseOperation1Request generates a request for the OutputService9TestCaseOperation1 operation. -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *request.Request, output *OutputService9TestShapeOutputService9TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService9TestCaseOperation1, - } - - if input == nil { - input = &OutputService9TestShapeOutputService9TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService9TestShapeOutputService9TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (*OutputService9TestShapeOutputService9TestCaseOperation1Output, error) { - req, out := c.OutputService9TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService9TestShapeOutputService9TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService9TestShapeOutputService9TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - AllHeaders map[string]*string `location:"headers" type:"map"` - - PrefixedHeaders map[string]*string `location:"headers" locationName:"X-" type:"map"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService10ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService10ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService10ProtocolTest client from just a session. -// svc := outputservice10protocoltest.New(mySession) -// -// // Create a OutputService10ProtocolTest client with additional configuration -// svc := outputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService10ProtocolTest { - c := p.ClientConfig("outputservice10protocoltest", cfgs...) - return newOutputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService10ProtocolTest { - svc := &OutputService10ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice10protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService10ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService10TestCaseOperation1 = "OperationName" - -// OutputService10TestCaseOperation1Request generates a request for the OutputService10TestCaseOperation1 operation. -func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1Request(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (req *request.Request, output *OutputService10TestShapeOutputService10TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService10TestCaseOperation1, - } - - if input == nil { - input = &OutputService10TestShapeOutputService10TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService10TestShapeOutputService10TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (*OutputService10TestShapeOutputService10TestCaseOperation1Output, error) { - req, out := c.OutputService10TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService10TestShapeBodyStructure struct { - _ struct{} `type:"structure"` - - Foo *string `type:"string"` -} - -type OutputService10TestShapeOutputService10TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService10TestShapeOutputService10TestCaseOperation1Output struct { - _ struct{} `type:"structure" payload:"Data"` - - Data *OutputService10TestShapeBodyStructure `type:"structure"` - - Header *string `location:"header" locationName:"X-Foo" type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService11ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService11ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService11ProtocolTest client from just a session. -// svc := outputservice11protocoltest.New(mySession) -// -// // Create a OutputService11ProtocolTest client with additional configuration -// svc := outputservice11protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService11ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService11ProtocolTest { - c := p.ClientConfig("outputservice11protocoltest", cfgs...) - return newOutputService11ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService11ProtocolTest { - svc := &OutputService11ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice11protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService11ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService11TestCaseOperation1 = "OperationName" - -// OutputService11TestCaseOperation1Request generates a request for the OutputService11TestCaseOperation1 operation. -func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1Request(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (req *request.Request, output *OutputService11TestShapeOutputService11TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService11TestCaseOperation1, - } - - if input == nil { - input = &OutputService11TestShapeOutputService11TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService11TestShapeOutputService11TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (*OutputService11TestShapeOutputService11TestCaseOperation1Output, error) { - req, out := c.OutputService11TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService11TestShapeOutputService11TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService11TestShapeOutputService11TestCaseOperation1Output struct { - _ struct{} `type:"structure" payload:"Stream"` - - Stream []byte `type:"blob"` -} - -// -// Tests begin here -// - -func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"Str\": \"myname\", \"Num\": 123, \"FalseBool\": false, \"TrueBool\": true, \"Float\": 1.2, \"Double\": 1.3, \"Long\": 200, \"Char\": \"a\"}")) - req, out := svc.OutputService1TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("ImaHeader", "test") - req.HTTPResponse.Header.Set("X-Foo", "abc") - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "a", *out.Char) - assert.Equal(t, 1.3, *out.Double) - assert.Equal(t, false, *out.FalseBool) - assert.Equal(t, 1.2, *out.Float) - assert.Equal(t, "test", *out.ImaHeader) - assert.Equal(t, "abc", *out.ImaHeaderLocation) - assert.Equal(t, int64(200), *out.Long) - assert.Equal(t, int64(123), *out.Num) - assert.Equal(t, int64(200), *out.Status) - assert.Equal(t, "myname", *out.Str) - assert.Equal(t, true, *out.TrueBool) - -} - -func TestOutputService2ProtocolTestBlobMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"BlobMember\": \"aGkh\", \"StructMember\": {\"foo\": \"dGhlcmUh\"}}")) - req, out := svc.OutputService2TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "hi!", string(out.BlobMember)) - assert.Equal(t, "there!", string(out.StructMember.Foo)) - -} - -func TestOutputService3ProtocolTestTimestampMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"TimeMember\": 1398796238, \"StructMember\": {\"foo\": 1398796238}}")) - req, out := svc.OutputService3TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, time.Unix(1.398796238e+09, 0).UTC().String(), out.StructMember.Foo.String()) - assert.Equal(t, time.Unix(1.398796238e+09, 0).UTC().String(), out.TimeMember.String()) - -} - -func TestOutputService4ProtocolTestListsCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"ListMember\": [\"a\", \"b\"]}")) - req, out := svc.OutputService4TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "a", *out.ListMember[0]) - assert.Equal(t, "b", *out.ListMember[1]) - -} - -func TestOutputService5ProtocolTestListsWithStructureMemberCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"ListMember\": [{\"Foo\": \"a\"}, {\"Foo\": \"b\"}]}")) - req, out := svc.OutputService5TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "a", *out.ListMember[0].Foo) - assert.Equal(t, "b", *out.ListMember[1].Foo) - -} - -func TestOutputService6ProtocolTestMapsCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"MapMember\": {\"a\": [1, 2], \"b\": [3, 4]}}")) - req, out := svc.OutputService6TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, int64(1), *out.MapMember["a"][0]) - assert.Equal(t, int64(2), *out.MapMember["a"][1]) - assert.Equal(t, int64(3), *out.MapMember["b"][0]) - assert.Equal(t, int64(4), *out.MapMember["b"][1]) - -} - -func TestOutputService7ProtocolTestComplexMapValuesCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"MapMember\": {\"a\": 1398796238, \"b\": 1398796238}}")) - req, out := svc.OutputService7TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, time.Unix(1.398796238e+09, 0).UTC().String(), out.MapMember["a"].String()) - assert.Equal(t, time.Unix(1.398796238e+09, 0).UTC().String(), out.MapMember["b"].String()) - -} - -func TestOutputService8ProtocolTestIgnoresExtraDataCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"foo\": \"bar\"}")) - req, out := svc.OutputService8TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - -} - -func TestOutputService9ProtocolTestSupportsHeaderMapsCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{}")) - req, out := svc.OutputService9TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("Content-Length", "10") - req.HTTPResponse.Header.Set("X-Bam", "boo") - req.HTTPResponse.Header.Set("X-Foo", "bar") - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "10", *out.AllHeaders["Content-Length"]) - assert.Equal(t, "boo", *out.AllHeaders["X-Bam"]) - assert.Equal(t, "bar", *out.AllHeaders["X-Foo"]) - assert.Equal(t, "boo", *out.PrefixedHeaders["Bam"]) - assert.Equal(t, "bar", *out.PrefixedHeaders["Foo"]) - -} - -func TestOutputService10ProtocolTestJSONPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService10ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"Foo\": \"abc\"}")) - req, out := svc.OutputService10TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("X-Foo", "baz") - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "abc", *out.Data.Foo) - assert.Equal(t, "baz", *out.Header) - -} - -func TestOutputService11ProtocolTestStreamingPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService11ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc")) - req, out := svc.OutputService11TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "abc", string(out.Stream)) - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_bench_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_bench_test.go deleted file mode 100644 index 081716739d..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_bench_test.go +++ /dev/null @@ -1,246 +0,0 @@ -// +build bench - -package restxml_test - -import ( - "testing" - - "bytes" - "encoding/xml" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/protocol/restxml" - "github.com/aws/aws-sdk-go/service/cloudfront" -) - -func BenchmarkRESTXMLBuild_Complex_cloudfrontCreateDistribution(b *testing.B) { - params := restxmlBuildCreateDistroParms - - op := &request.Operation{ - Name: "CreateDistribution", - HTTPMethod: "POST", - HTTPPath: "/2015-04-17/distribution/{DistributionId}/invalidation", - } - - benchRESTXMLBuild(b, op, params) -} - -func BenchmarkRESTXMLBuild_Simple_cloudfrontDeleteStreamingDistribution(b *testing.B) { - params := &cloudfront.DeleteDistributionInput{ - Id: aws.String("string"), // Required - IfMatch: aws.String("string"), - } - op := &request.Operation{ - Name: "DeleteStreamingDistribution", - HTTPMethod: "DELETE", - HTTPPath: "/2015-04-17/streaming-distribution/{Id}", - } - benchRESTXMLBuild(b, op, params) -} - -func BenchmarkEncodingXMLMarshal_Simple_cloudfrontDeleteStreamingDistribution(b *testing.B) { - params := &cloudfront.DeleteDistributionInput{ - Id: aws.String("string"), // Required - IfMatch: aws.String("string"), - } - - for i := 0; i < b.N; i++ { - buf := &bytes.Buffer{} - encoder := xml.NewEncoder(buf) - if err := encoder.Encode(params); err != nil { - b.Fatal("Unexpected error", err) - } - } -} - -func benchRESTXMLBuild(b *testing.B, op *request.Operation, params interface{}) { - svc := awstesting.NewClient() - svc.ServiceName = "cloudfront" - svc.APIVersion = "2015-04-17" - - for i := 0; i < b.N; i++ { - r := svc.NewRequest(op, params, nil) - restxml.Build(r) - if r.Error != nil { - b.Fatal("Unexpected error", r.Error) - } - } -} - -var restxmlBuildCreateDistroParms = &cloudfront.CreateDistributionInput{ - DistributionConfig: &cloudfront.DistributionConfig{ // Required - CallerReference: aws.String("string"), // Required - Comment: aws.String("string"), // Required - DefaultCacheBehavior: &cloudfront.DefaultCacheBehavior{ // Required - ForwardedValues: &cloudfront.ForwardedValues{ // Required - Cookies: &cloudfront.CookiePreference{ // Required - Forward: aws.String("ItemSelection"), // Required - WhitelistedNames: &cloudfront.CookieNames{ - Quantity: aws.Int64(1), // Required - Items: []*string{ - aws.String("string"), // Required - // More values... - }, - }, - }, - QueryString: aws.Bool(true), // Required - Headers: &cloudfront.Headers{ - Quantity: aws.Int64(1), // Required - Items: []*string{ - aws.String("string"), // Required - // More values... - }, - }, - }, - MinTTL: aws.Int64(1), // Required - TargetOriginId: aws.String("string"), // Required - TrustedSigners: &cloudfront.TrustedSigners{ // Required - Enabled: aws.Bool(true), // Required - Quantity: aws.Int64(1), // Required - Items: []*string{ - aws.String("string"), // Required - // More values... - }, - }, - ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required - AllowedMethods: &cloudfront.AllowedMethods{ - Items: []*string{ // Required - aws.String("Method"), // Required - // More values... - }, - Quantity: aws.Int64(1), // Required - CachedMethods: &cloudfront.CachedMethods{ - Items: []*string{ // Required - aws.String("Method"), // Required - // More values... - }, - Quantity: aws.Int64(1), // Required - }, - }, - DefaultTTL: aws.Int64(1), - MaxTTL: aws.Int64(1), - SmoothStreaming: aws.Bool(true), - }, - Enabled: aws.Bool(true), // Required - Origins: &cloudfront.Origins{ // Required - Quantity: aws.Int64(1), // Required - Items: []*cloudfront.Origin{ - { // Required - DomainName: aws.String("string"), // Required - Id: aws.String("string"), // Required - CustomOriginConfig: &cloudfront.CustomOriginConfig{ - HTTPPort: aws.Int64(1), // Required - HTTPSPort: aws.Int64(1), // Required - OriginProtocolPolicy: aws.String("OriginProtocolPolicy"), // Required - }, - OriginPath: aws.String("string"), - S3OriginConfig: &cloudfront.S3OriginConfig{ - OriginAccessIdentity: aws.String("string"), // Required - }, - }, - // More values... - }, - }, - Aliases: &cloudfront.Aliases{ - Quantity: aws.Int64(1), // Required - Items: []*string{ - aws.String("string"), // Required - // More values... - }, - }, - CacheBehaviors: &cloudfront.CacheBehaviors{ - Quantity: aws.Int64(1), // Required - Items: []*cloudfront.CacheBehavior{ - { // Required - ForwardedValues: &cloudfront.ForwardedValues{ // Required - Cookies: &cloudfront.CookiePreference{ // Required - Forward: aws.String("ItemSelection"), // Required - WhitelistedNames: &cloudfront.CookieNames{ - Quantity: aws.Int64(1), // Required - Items: []*string{ - aws.String("string"), // Required - // More values... - }, - }, - }, - QueryString: aws.Bool(true), // Required - Headers: &cloudfront.Headers{ - Quantity: aws.Int64(1), // Required - Items: []*string{ - aws.String("string"), // Required - // More values... - }, - }, - }, - MinTTL: aws.Int64(1), // Required - PathPattern: aws.String("string"), // Required - TargetOriginId: aws.String("string"), // Required - TrustedSigners: &cloudfront.TrustedSigners{ // Required - Enabled: aws.Bool(true), // Required - Quantity: aws.Int64(1), // Required - Items: []*string{ - aws.String("string"), // Required - // More values... - }, - }, - ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required - AllowedMethods: &cloudfront.AllowedMethods{ - Items: []*string{ // Required - aws.String("Method"), // Required - // More values... - }, - Quantity: aws.Int64(1), // Required - CachedMethods: &cloudfront.CachedMethods{ - Items: []*string{ // Required - aws.String("Method"), // Required - // More values... - }, - Quantity: aws.Int64(1), // Required - }, - }, - DefaultTTL: aws.Int64(1), - MaxTTL: aws.Int64(1), - SmoothStreaming: aws.Bool(true), - }, - // More values... - }, - }, - CustomErrorResponses: &cloudfront.CustomErrorResponses{ - Quantity: aws.Int64(1), // Required - Items: []*cloudfront.CustomErrorResponse{ - { // Required - ErrorCode: aws.Int64(1), // Required - ErrorCachingMinTTL: aws.Int64(1), - ResponseCode: aws.String("string"), - ResponsePagePath: aws.String("string"), - }, - // More values... - }, - }, - DefaultRootObject: aws.String("string"), - Logging: &cloudfront.LoggingConfig{ - Bucket: aws.String("string"), // Required - Enabled: aws.Bool(true), // Required - IncludeCookies: aws.Bool(true), // Required - Prefix: aws.String("string"), // Required - }, - PriceClass: aws.String("PriceClass"), - Restrictions: &cloudfront.Restrictions{ - GeoRestriction: &cloudfront.GeoRestriction{ // Required - Quantity: aws.Int64(1), // Required - RestrictionType: aws.String("GeoRestrictionType"), // Required - Items: []*string{ - aws.String("string"), // Required - // More values... - }, - }, - }, - ViewerCertificate: &cloudfront.ViewerCertificate{ - CloudFrontDefaultCertificate: aws.Bool(true), - IAMCertificateId: aws.String("string"), - MinimumProtocolVersion: aws.String("MinimumProtocolVersion"), - SSLSupportMethod: aws.String("SSLSupportMethod"), - }, - }, -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_test.go deleted file mode 100644 index 8e08bcc23c..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_test.go +++ /dev/null @@ -1,3338 +0,0 @@ -package restxml_test - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "io" - "io/ioutil" - "net/http" - "net/url" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/protocol/restxml" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" - "github.com/aws/aws-sdk-go/private/signer/v4" - "github.com/aws/aws-sdk-go/private/util" - "github.com/stretchr/testify/assert" -) - -var _ bytes.Buffer // always import bytes -var _ http.Request -var _ json.Marshaler -var _ time.Time -var _ xmlutil.XMLNode -var _ xml.Attr -var _ = awstesting.GenerateAssertions -var _ = ioutil.Discard -var _ = util.Trim("") -var _ = url.Values{} -var _ = io.EOF -var _ = aws.String - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService1ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService1ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService1ProtocolTest client from just a session. -// svc := inputservice1protocoltest.New(mySession) -// -// // Create a InputService1ProtocolTest client with additional configuration -// svc := inputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService1ProtocolTest { - c := p.ClientConfig("inputservice1protocoltest", cfgs...) - return newInputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService1ProtocolTest { - svc := &InputService1ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice1protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService1ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService1TestCaseOperation1 = "OperationName" - -// InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputShape) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService1TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService1TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService1TestShapeInputService1TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputShape) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) { - req, out := c.InputService1TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService1TestCaseOperation2 = "OperationName" - -// InputService1TestCaseOperation2Request generates a request for the InputService1TestCaseOperation2 operation. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation2Request(input *InputService1TestShapeInputShape) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService1TestCaseOperation2, - HTTPMethod: "PUT", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService1TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService1TestShapeInputService1TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService1ProtocolTest) InputService1TestCaseOperation2(input *InputService1TestShapeInputShape) (*InputService1TestShapeInputService1TestCaseOperation2Output, error) { - req, out := c.InputService1TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -const opInputService1TestCaseOperation3 = "OperationName" - -// InputService1TestCaseOperation3Request generates a request for the InputService1TestCaseOperation3 operation. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation3Request(input *InputService1TestShapeInputService1TestCaseOperation3Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation3Output) { - op := &request.Operation{ - Name: opInputService1TestCaseOperation3, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService1TestShapeInputService1TestCaseOperation3Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService1TestShapeInputService1TestCaseOperation3Output{} - req.Data = output - return -} - -func (c *InputService1ProtocolTest) InputService1TestCaseOperation3(input *InputService1TestShapeInputService1TestCaseOperation3Input) (*InputService1TestShapeInputService1TestCaseOperation3Output, error) { - req, out := c.InputService1TestCaseOperation3Request(input) - err := req.Send() - return out, err -} - -type InputService1TestShapeInputService1TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService1TestShapeInputService1TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService1TestShapeInputService1TestCaseOperation3Input struct { - _ struct{} `type:"structure"` -} - -type InputService1TestShapeInputService1TestCaseOperation3Output struct { - _ struct{} `type:"structure"` -} - -type InputService1TestShapeInputShape struct { - _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - Description *string `type:"string"` - - Name *string `type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService2ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService2ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService2ProtocolTest client from just a session. -// svc := inputservice2protocoltest.New(mySession) -// -// // Create a InputService2ProtocolTest client with additional configuration -// svc := inputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService2ProtocolTest { - c := p.ClientConfig("inputservice2protocoltest", cfgs...) - return newInputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService2ProtocolTest { - svc := &InputService2ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice2protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService2ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService2TestCaseOperation1 = "OperationName" - -// InputService2TestCaseOperation1Request generates a request for the InputService2TestCaseOperation1 operation. -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputService2TestCaseOperation1Input) (req *request.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService2TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService2TestShapeInputService2TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService2TestShapeInputService2TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputService2TestCaseOperation1Input) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) { - req, out := c.InputService2TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService2TestShapeInputService2TestCaseOperation1Input struct { - _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - First *bool `type:"boolean"` - - Fourth *int64 `type:"integer"` - - Second *bool `type:"boolean"` - - Third *float64 `type:"float"` -} - -type InputService2TestShapeInputService2TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService3ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService3ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService3ProtocolTest client from just a session. -// svc := inputservice3protocoltest.New(mySession) -// -// // Create a InputService3ProtocolTest client with additional configuration -// svc := inputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService3ProtocolTest { - c := p.ClientConfig("inputservice3protocoltest", cfgs...) - return newInputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService3ProtocolTest { - svc := &InputService3ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice3protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService3ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService3TestCaseOperation1 = "OperationName" - -// InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputShape) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService3TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService3TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService3TestShapeInputService3TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputShape) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) { - req, out := c.InputService3TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService3TestCaseOperation2 = "OperationName" - -// InputService3TestCaseOperation2Request generates a request for the InputService3TestCaseOperation2 operation. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation2Request(input *InputService3TestShapeInputShape) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService3TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService3TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService3TestShapeInputService3TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService3ProtocolTest) InputService3TestCaseOperation2(input *InputService3TestShapeInputShape) (*InputService3TestShapeInputService3TestCaseOperation2Output, error) { - req, out := c.InputService3TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -type InputService3TestShapeInputService3TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService3TestShapeInputService3TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService3TestShapeInputShape struct { - _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - Description *string `type:"string"` - - SubStructure *InputService3TestShapeSubStructure `type:"structure"` -} - -type InputService3TestShapeSubStructure struct { - _ struct{} `type:"structure"` - - Bar *string `type:"string"` - - Foo *string `type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService4ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService4ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService4ProtocolTest client from just a session. -// svc := inputservice4protocoltest.New(mySession) -// -// // Create a InputService4ProtocolTest client with additional configuration -// svc := inputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService4ProtocolTest { - c := p.ClientConfig("inputservice4protocoltest", cfgs...) - return newInputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService4ProtocolTest { - svc := &InputService4ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice4protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService4ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService4TestCaseOperation1 = "OperationName" - -// InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputService4TestCaseOperation1Input) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService4TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService4TestShapeInputService4TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService4TestShapeInputService4TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputService4TestCaseOperation1Input) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) { - req, out := c.InputService4TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService4TestShapeInputService4TestCaseOperation1Input struct { - _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - Description *string `type:"string"` - - SubStructure *InputService4TestShapeSubStructure `type:"structure"` -} - -type InputService4TestShapeInputService4TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService4TestShapeSubStructure struct { - _ struct{} `type:"structure"` - - Bar *string `type:"string"` - - Foo *string `type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService5ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService5ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService5ProtocolTest client from just a session. -// svc := inputservice5protocoltest.New(mySession) -// -// // Create a InputService5ProtocolTest client with additional configuration -// svc := inputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService5ProtocolTest { - c := p.ClientConfig("inputservice5protocoltest", cfgs...) - return newInputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService5ProtocolTest { - svc := &InputService5ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice5protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService5ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService5TestCaseOperation1 = "OperationName" - -// InputService5TestCaseOperation1Request generates a request for the InputService5TestCaseOperation1 operation. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputService5TestCaseOperation1Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService5TestShapeInputService5TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService5TestShapeInputService5TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputService5TestCaseOperation1Input) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) { - req, out := c.InputService5TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService5TestShapeInputService5TestCaseOperation1Input struct { - _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - ListParam []*string `type:"list"` -} - -type InputService5TestShapeInputService5TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService6ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService6ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService6ProtocolTest client from just a session. -// svc := inputservice6protocoltest.New(mySession) -// -// // Create a InputService6ProtocolTest client with additional configuration -// svc := inputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService6ProtocolTest { - c := p.ClientConfig("inputservice6protocoltest", cfgs...) - return newInputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService6ProtocolTest { - svc := &InputService6ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice6protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService6ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService6TestCaseOperation1 = "OperationName" - -// InputService6TestCaseOperation1Request generates a request for the InputService6TestCaseOperation1 operation. -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputService6TestCaseOperation1Input) (req *request.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService6TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService6TestShapeInputService6TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService6TestShapeInputService6TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputService6TestCaseOperation1Input) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) { - req, out := c.InputService6TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService6TestShapeInputService6TestCaseOperation1Input struct { - _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - ListParam []*string `locationName:"AlternateName" locationNameList:"NotMember" type:"list"` -} - -type InputService6TestShapeInputService6TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService7ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService7ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService7ProtocolTest client from just a session. -// svc := inputservice7protocoltest.New(mySession) -// -// // Create a InputService7ProtocolTest client with additional configuration -// svc := inputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService7ProtocolTest { - c := p.ClientConfig("inputservice7protocoltest", cfgs...) - return newInputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService7ProtocolTest { - svc := &InputService7ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice7protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService7ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService7TestCaseOperation1 = "OperationName" - -// InputService7TestCaseOperation1Request generates a request for the InputService7TestCaseOperation1 operation. -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputService7TestCaseOperation1Input) (req *request.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService7TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService7TestShapeInputService7TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService7TestShapeInputService7TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputService7TestCaseOperation1Input) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) { - req, out := c.InputService7TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService7TestShapeInputService7TestCaseOperation1Input struct { - _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - ListParam []*string `type:"list" flattened:"true"` -} - -type InputService7TestShapeInputService7TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService8ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService8ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService8ProtocolTest client from just a session. -// svc := inputservice8protocoltest.New(mySession) -// -// // Create a InputService8ProtocolTest client with additional configuration -// svc := inputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService8ProtocolTest { - c := p.ClientConfig("inputservice8protocoltest", cfgs...) - return newInputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService8ProtocolTest { - svc := &InputService8ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice8protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService8ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService8TestCaseOperation1 = "OperationName" - -// InputService8TestCaseOperation1Request generates a request for the InputService8TestCaseOperation1 operation. -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputService8TestCaseOperation1Input) (req *request.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService8TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService8TestShapeInputService8TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService8TestShapeInputService8TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputService8TestCaseOperation1Input) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) { - req, out := c.InputService8TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService8TestShapeInputService8TestCaseOperation1Input struct { - _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - ListParam []*string `locationName:"item" type:"list" flattened:"true"` -} - -type InputService8TestShapeInputService8TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService9ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService9ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService9ProtocolTest client from just a session. -// svc := inputservice9protocoltest.New(mySession) -// -// // Create a InputService9ProtocolTest client with additional configuration -// svc := inputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService9ProtocolTest { - c := p.ClientConfig("inputservice9protocoltest", cfgs...) - return newInputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService9ProtocolTest { - svc := &InputService9ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice9protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService9ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService9TestCaseOperation1 = "OperationName" - -// InputService9TestCaseOperation1Request generates a request for the InputService9TestCaseOperation1 operation. -func (c *InputService9ProtocolTest) InputService9TestCaseOperation1Request(input *InputService9TestShapeInputService9TestCaseOperation1Input) (req *request.Request, output *InputService9TestShapeInputService9TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService9TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService9TestShapeInputService9TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService9TestShapeInputService9TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService9ProtocolTest) InputService9TestCaseOperation1(input *InputService9TestShapeInputService9TestCaseOperation1Input) (*InputService9TestShapeInputService9TestCaseOperation1Output, error) { - req, out := c.InputService9TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService9TestShapeInputService9TestCaseOperation1Input struct { - _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - ListParam []*InputService9TestShapeSingleFieldStruct `locationName:"item" type:"list" flattened:"true"` -} - -type InputService9TestShapeInputService9TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService9TestShapeSingleFieldStruct struct { - _ struct{} `type:"structure"` - - Element *string `locationName:"value" type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService10ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService10ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService10ProtocolTest client from just a session. -// svc := inputservice10protocoltest.New(mySession) -// -// // Create a InputService10ProtocolTest client with additional configuration -// svc := inputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService10ProtocolTest { - c := p.ClientConfig("inputservice10protocoltest", cfgs...) - return newInputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService10ProtocolTest { - svc := &InputService10ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice10protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService10ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService10TestCaseOperation1 = "OperationName" - -// InputService10TestCaseOperation1Request generates a request for the InputService10TestCaseOperation1 operation. -func (c *InputService10ProtocolTest) InputService10TestCaseOperation1Request(input *InputService10TestShapeInputService10TestCaseOperation1Input) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService10TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService10TestShapeInputService10TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService10TestShapeInputService10TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService10ProtocolTest) InputService10TestCaseOperation1(input *InputService10TestShapeInputService10TestCaseOperation1Input) (*InputService10TestShapeInputService10TestCaseOperation1Output, error) { - req, out := c.InputService10TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService10TestShapeInputService10TestCaseOperation1Input struct { - _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - StructureParam *InputService10TestShapeStructureShape `type:"structure"` -} - -type InputService10TestShapeInputService10TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService10TestShapeStructureShape struct { - _ struct{} `type:"structure"` - - B []byte `locationName:"b" type:"blob"` - - T *time.Time `locationName:"t" type:"timestamp" timestampFormat:"iso8601"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService11ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService11ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService11ProtocolTest client from just a session. -// svc := inputservice11protocoltest.New(mySession) -// -// // Create a InputService11ProtocolTest client with additional configuration -// svc := inputservice11protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService11ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService11ProtocolTest { - c := p.ClientConfig("inputservice11protocoltest", cfgs...) - return newInputService11ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService11ProtocolTest { - svc := &InputService11ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice11protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService11ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService11TestCaseOperation1 = "OperationName" - -// InputService11TestCaseOperation1Request generates a request for the InputService11TestCaseOperation1 operation. -func (c *InputService11ProtocolTest) InputService11TestCaseOperation1Request(input *InputService11TestShapeInputService11TestCaseOperation1Input) (req *request.Request, output *InputService11TestShapeInputService11TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService11TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService11TestShapeInputService11TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService11TestShapeInputService11TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService11ProtocolTest) InputService11TestCaseOperation1(input *InputService11TestShapeInputService11TestCaseOperation1Input) (*InputService11TestShapeInputService11TestCaseOperation1Output, error) { - req, out := c.InputService11TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService11TestShapeInputService11TestCaseOperation1Input struct { - _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - Foo map[string]*string `location:"headers" locationName:"x-foo-" type:"map"` -} - -type InputService11TestShapeInputService11TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService12ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService12ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService12ProtocolTest client from just a session. -// svc := inputservice12protocoltest.New(mySession) -// -// // Create a InputService12ProtocolTest client with additional configuration -// svc := inputservice12protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService12ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService12ProtocolTest { - c := p.ClientConfig("inputservice12protocoltest", cfgs...) - return newInputService12ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService12ProtocolTest { - svc := &InputService12ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice12protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService12ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService12TestCaseOperation1 = "OperationName" - -// InputService12TestCaseOperation1Request generates a request for the InputService12TestCaseOperation1 operation. -func (c *InputService12ProtocolTest) InputService12TestCaseOperation1Request(input *InputService12TestShapeInputService12TestCaseOperation1Input) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService12TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService12TestShapeInputService12TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService12TestShapeInputService12TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService12ProtocolTest) InputService12TestCaseOperation1(input *InputService12TestShapeInputService12TestCaseOperation1Input) (*InputService12TestShapeInputService12TestCaseOperation1Output, error) { - req, out := c.InputService12TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService12TestShapeInputService12TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - PipelineId *string `location:"uri" type:"string"` - - QueryDoc map[string]*string `location:"querystring" type:"map"` -} - -type InputService12TestShapeInputService12TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService13ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService13ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService13ProtocolTest client from just a session. -// svc := inputservice13protocoltest.New(mySession) -// -// // Create a InputService13ProtocolTest client with additional configuration -// svc := inputservice13protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService13ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService13ProtocolTest { - c := p.ClientConfig("inputservice13protocoltest", cfgs...) - return newInputService13ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService13ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService13ProtocolTest { - svc := &InputService13ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice13protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService13ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService13ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService13TestCaseOperation1 = "OperationName" - -// InputService13TestCaseOperation1Request generates a request for the InputService13TestCaseOperation1 operation. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation1Request(input *InputService13TestShapeInputService13TestCaseOperation1Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService13TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService13TestShapeInputService13TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService13TestShapeInputService13TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService13ProtocolTest) InputService13TestCaseOperation1(input *InputService13TestShapeInputService13TestCaseOperation1Input) (*InputService13TestShapeInputService13TestCaseOperation1Output, error) { - req, out := c.InputService13TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService13TestShapeInputService13TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - PipelineId *string `location:"uri" type:"string"` - - QueryDoc map[string][]*string `location:"querystring" type:"map"` -} - -type InputService13TestShapeInputService13TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService14ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService14ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService14ProtocolTest client from just a session. -// svc := inputservice14protocoltest.New(mySession) -// -// // Create a InputService14ProtocolTest client with additional configuration -// svc := inputservice14protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService14ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService14ProtocolTest { - c := p.ClientConfig("inputservice14protocoltest", cfgs...) - return newInputService14ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService14ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService14ProtocolTest { - svc := &InputService14ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice14protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService14ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService14ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService14TestCaseOperation1 = "OperationName" - -// InputService14TestCaseOperation1Request generates a request for the InputService14TestCaseOperation1 operation. -func (c *InputService14ProtocolTest) InputService14TestCaseOperation1Request(input *InputService14TestShapeInputService14TestCaseOperation1Input) (req *request.Request, output *InputService14TestShapeInputService14TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService14TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService14TestShapeInputService14TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService14TestShapeInputService14TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService14ProtocolTest) InputService14TestCaseOperation1(input *InputService14TestShapeInputService14TestCaseOperation1Input) (*InputService14TestShapeInputService14TestCaseOperation1Output, error) { - req, out := c.InputService14TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService14TestShapeInputService14TestCaseOperation1Input struct { - _ struct{} `type:"structure" payload:"Foo"` - - Foo *string `locationName:"foo" type:"string"` -} - -type InputService14TestShapeInputService14TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService15ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService15ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService15ProtocolTest client from just a session. -// svc := inputservice15protocoltest.New(mySession) -// -// // Create a InputService15ProtocolTest client with additional configuration -// svc := inputservice15protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService15ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService15ProtocolTest { - c := p.ClientConfig("inputservice15protocoltest", cfgs...) - return newInputService15ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService15ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService15ProtocolTest { - svc := &InputService15ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice15protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService15ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService15ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService15TestCaseOperation1 = "OperationName" - -// InputService15TestCaseOperation1Request generates a request for the InputService15TestCaseOperation1 operation. -func (c *InputService15ProtocolTest) InputService15TestCaseOperation1Request(input *InputService15TestShapeInputShape) (req *request.Request, output *InputService15TestShapeInputService15TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService15TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService15TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService15TestShapeInputService15TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService15ProtocolTest) InputService15TestCaseOperation1(input *InputService15TestShapeInputShape) (*InputService15TestShapeInputService15TestCaseOperation1Output, error) { - req, out := c.InputService15TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService15TestCaseOperation2 = "OperationName" - -// InputService15TestCaseOperation2Request generates a request for the InputService15TestCaseOperation2 operation. -func (c *InputService15ProtocolTest) InputService15TestCaseOperation2Request(input *InputService15TestShapeInputShape) (req *request.Request, output *InputService15TestShapeInputService15TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService15TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService15TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService15TestShapeInputService15TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService15ProtocolTest) InputService15TestCaseOperation2(input *InputService15TestShapeInputShape) (*InputService15TestShapeInputService15TestCaseOperation2Output, error) { - req, out := c.InputService15TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -type InputService15TestShapeInputService15TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService15TestShapeInputService15TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService15TestShapeInputShape struct { - _ struct{} `type:"structure" payload:"Foo"` - - Foo []byte `locationName:"foo" type:"blob"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService16ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService16ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService16ProtocolTest client from just a session. -// svc := inputservice16protocoltest.New(mySession) -// -// // Create a InputService16ProtocolTest client with additional configuration -// svc := inputservice16protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService16ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService16ProtocolTest { - c := p.ClientConfig("inputservice16protocoltest", cfgs...) - return newInputService16ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService16ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService16ProtocolTest { - svc := &InputService16ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice16protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService16ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService16ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService16TestCaseOperation1 = "OperationName" - -// InputService16TestCaseOperation1Request generates a request for the InputService16TestCaseOperation1 operation. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation1Request(input *InputService16TestShapeInputShape) (req *request.Request, output *InputService16TestShapeInputService16TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService16TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService16TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService16TestShapeInputService16TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService16ProtocolTest) InputService16TestCaseOperation1(input *InputService16TestShapeInputShape) (*InputService16TestShapeInputService16TestCaseOperation1Output, error) { - req, out := c.InputService16TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService16TestCaseOperation2 = "OperationName" - -// InputService16TestCaseOperation2Request generates a request for the InputService16TestCaseOperation2 operation. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation2Request(input *InputService16TestShapeInputShape) (req *request.Request, output *InputService16TestShapeInputService16TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService16TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService16TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService16TestShapeInputService16TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService16ProtocolTest) InputService16TestCaseOperation2(input *InputService16TestShapeInputShape) (*InputService16TestShapeInputService16TestCaseOperation2Output, error) { - req, out := c.InputService16TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -const opInputService16TestCaseOperation3 = "OperationName" - -// InputService16TestCaseOperation3Request generates a request for the InputService16TestCaseOperation3 operation. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation3Request(input *InputService16TestShapeInputShape) (req *request.Request, output *InputService16TestShapeInputService16TestCaseOperation3Output) { - op := &request.Operation{ - Name: opInputService16TestCaseOperation3, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService16TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService16TestShapeInputService16TestCaseOperation3Output{} - req.Data = output - return -} - -func (c *InputService16ProtocolTest) InputService16TestCaseOperation3(input *InputService16TestShapeInputShape) (*InputService16TestShapeInputService16TestCaseOperation3Output, error) { - req, out := c.InputService16TestCaseOperation3Request(input) - err := req.Send() - return out, err -} - -const opInputService16TestCaseOperation4 = "OperationName" - -// InputService16TestCaseOperation4Request generates a request for the InputService16TestCaseOperation4 operation. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation4Request(input *InputService16TestShapeInputShape) (req *request.Request, output *InputService16TestShapeInputService16TestCaseOperation4Output) { - op := &request.Operation{ - Name: opInputService16TestCaseOperation4, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService16TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService16TestShapeInputService16TestCaseOperation4Output{} - req.Data = output - return -} - -func (c *InputService16ProtocolTest) InputService16TestCaseOperation4(input *InputService16TestShapeInputShape) (*InputService16TestShapeInputService16TestCaseOperation4Output, error) { - req, out := c.InputService16TestCaseOperation4Request(input) - err := req.Send() - return out, err -} - -type InputService16TestShapeFooShape struct { - _ struct{} `locationName:"foo" type:"structure"` - - Baz *string `locationName:"baz" type:"string"` -} - -type InputService16TestShapeInputService16TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService16TestShapeInputService16TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService16TestShapeInputService16TestCaseOperation3Output struct { - _ struct{} `type:"structure"` -} - -type InputService16TestShapeInputService16TestCaseOperation4Output struct { - _ struct{} `type:"structure"` -} - -type InputService16TestShapeInputShape struct { - _ struct{} `type:"structure" payload:"Foo"` - - Foo *InputService16TestShapeFooShape `locationName:"foo" type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService17ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService17ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService17ProtocolTest client from just a session. -// svc := inputservice17protocoltest.New(mySession) -// -// // Create a InputService17ProtocolTest client with additional configuration -// svc := inputservice17protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService17ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService17ProtocolTest { - c := p.ClientConfig("inputservice17protocoltest", cfgs...) - return newInputService17ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService17ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService17ProtocolTest { - svc := &InputService17ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice17protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService17ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService17ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService17TestCaseOperation1 = "OperationName" - -// InputService17TestCaseOperation1Request generates a request for the InputService17TestCaseOperation1 operation. -func (c *InputService17ProtocolTest) InputService17TestCaseOperation1Request(input *InputService17TestShapeInputService17TestCaseOperation1Input) (req *request.Request, output *InputService17TestShapeInputService17TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService17TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService17TestShapeInputService17TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService17TestShapeInputService17TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService17ProtocolTest) InputService17TestCaseOperation1(input *InputService17TestShapeInputService17TestCaseOperation1Input) (*InputService17TestShapeInputService17TestCaseOperation1Output, error) { - req, out := c.InputService17TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService17TestShapeGrant struct { - _ struct{} `locationName:"Grant" type:"structure"` - - Grantee *InputService17TestShapeGrantee `type:"structure"` -} - -type InputService17TestShapeGrantee struct { - _ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` - - EmailAddress *string `type:"string"` - - Type *string `locationName:"xsi:type" type:"string" xmlAttribute:"true"` -} - -type InputService17TestShapeInputService17TestCaseOperation1Input struct { - _ struct{} `type:"structure" payload:"Grant"` - - Grant *InputService17TestShapeGrant `locationName:"Grant" type:"structure"` -} - -type InputService17TestShapeInputService17TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService18ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService18ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService18ProtocolTest client from just a session. -// svc := inputservice18protocoltest.New(mySession) -// -// // Create a InputService18ProtocolTest client with additional configuration -// svc := inputservice18protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService18ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService18ProtocolTest { - c := p.ClientConfig("inputservice18protocoltest", cfgs...) - return newInputService18ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService18ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService18ProtocolTest { - svc := &InputService18ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice18protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService18ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService18ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService18TestCaseOperation1 = "OperationName" - -// InputService18TestCaseOperation1Request generates a request for the InputService18TestCaseOperation1 operation. -func (c *InputService18ProtocolTest) InputService18TestCaseOperation1Request(input *InputService18TestShapeInputService18TestCaseOperation1Input) (req *request.Request, output *InputService18TestShapeInputService18TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService18TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &InputService18TestShapeInputService18TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService18TestShapeInputService18TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService18ProtocolTest) InputService18TestCaseOperation1(input *InputService18TestShapeInputService18TestCaseOperation1Input) (*InputService18TestShapeInputService18TestCaseOperation1Output, error) { - req, out := c.InputService18TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService18TestShapeInputService18TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Bucket *string `location:"uri" type:"string"` - - Key *string `location:"uri" type:"string"` -} - -type InputService18TestShapeInputService18TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService19ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService19ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService19ProtocolTest client from just a session. -// svc := inputservice19protocoltest.New(mySession) -// -// // Create a InputService19ProtocolTest client with additional configuration -// svc := inputservice19protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService19ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService19ProtocolTest { - c := p.ClientConfig("inputservice19protocoltest", cfgs...) - return newInputService19ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService19ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService19ProtocolTest { - svc := &InputService19ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice19protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService19ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService19ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService19TestCaseOperation1 = "OperationName" - -// InputService19TestCaseOperation1Request generates a request for the InputService19TestCaseOperation1 operation. -func (c *InputService19ProtocolTest) InputService19TestCaseOperation1Request(input *InputService19TestShapeInputShape) (req *request.Request, output *InputService19TestShapeInputService19TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService19TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService19TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService19TestShapeInputService19TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService19ProtocolTest) InputService19TestCaseOperation1(input *InputService19TestShapeInputShape) (*InputService19TestShapeInputService19TestCaseOperation1Output, error) { - req, out := c.InputService19TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService19TestCaseOperation2 = "OperationName" - -// InputService19TestCaseOperation2Request generates a request for the InputService19TestCaseOperation2 operation. -func (c *InputService19ProtocolTest) InputService19TestCaseOperation2Request(input *InputService19TestShapeInputShape) (req *request.Request, output *InputService19TestShapeInputService19TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService19TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/path?abc=mno", - } - - if input == nil { - input = &InputService19TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService19TestShapeInputService19TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService19ProtocolTest) InputService19TestCaseOperation2(input *InputService19TestShapeInputShape) (*InputService19TestShapeInputService19TestCaseOperation2Output, error) { - req, out := c.InputService19TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -type InputService19TestShapeInputService19TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService19TestShapeInputService19TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService19TestShapeInputShape struct { - _ struct{} `type:"structure"` - - Foo *string `location:"querystring" locationName:"param-name" type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService20ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService20ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService20ProtocolTest client from just a session. -// svc := inputservice20protocoltest.New(mySession) -// -// // Create a InputService20ProtocolTest client with additional configuration -// svc := inputservice20protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService20ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService20ProtocolTest { - c := p.ClientConfig("inputservice20protocoltest", cfgs...) - return newInputService20ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService20ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService20ProtocolTest { - svc := &InputService20ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice20protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService20ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService20ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService20TestCaseOperation1 = "OperationName" - -// InputService20TestCaseOperation1Request generates a request for the InputService20TestCaseOperation1 operation. -func (c *InputService20ProtocolTest) InputService20TestCaseOperation1Request(input *InputService20TestShapeInputShape) (req *request.Request, output *InputService20TestShapeInputService20TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService20TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService20TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService20TestShapeInputService20TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService20ProtocolTest) InputService20TestCaseOperation1(input *InputService20TestShapeInputShape) (*InputService20TestShapeInputService20TestCaseOperation1Output, error) { - req, out := c.InputService20TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opInputService20TestCaseOperation2 = "OperationName" - -// InputService20TestCaseOperation2Request generates a request for the InputService20TestCaseOperation2 operation. -func (c *InputService20ProtocolTest) InputService20TestCaseOperation2Request(input *InputService20TestShapeInputShape) (req *request.Request, output *InputService20TestShapeInputService20TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService20TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService20TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService20TestShapeInputService20TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService20ProtocolTest) InputService20TestCaseOperation2(input *InputService20TestShapeInputShape) (*InputService20TestShapeInputService20TestCaseOperation2Output, error) { - req, out := c.InputService20TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -const opInputService20TestCaseOperation3 = "OperationName" - -// InputService20TestCaseOperation3Request generates a request for the InputService20TestCaseOperation3 operation. -func (c *InputService20ProtocolTest) InputService20TestCaseOperation3Request(input *InputService20TestShapeInputShape) (req *request.Request, output *InputService20TestShapeInputService20TestCaseOperation3Output) { - op := &request.Operation{ - Name: opInputService20TestCaseOperation3, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService20TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService20TestShapeInputService20TestCaseOperation3Output{} - req.Data = output - return -} - -func (c *InputService20ProtocolTest) InputService20TestCaseOperation3(input *InputService20TestShapeInputShape) (*InputService20TestShapeInputService20TestCaseOperation3Output, error) { - req, out := c.InputService20TestCaseOperation3Request(input) - err := req.Send() - return out, err -} - -const opInputService20TestCaseOperation4 = "OperationName" - -// InputService20TestCaseOperation4Request generates a request for the InputService20TestCaseOperation4 operation. -func (c *InputService20ProtocolTest) InputService20TestCaseOperation4Request(input *InputService20TestShapeInputShape) (req *request.Request, output *InputService20TestShapeInputService20TestCaseOperation4Output) { - op := &request.Operation{ - Name: opInputService20TestCaseOperation4, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService20TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService20TestShapeInputService20TestCaseOperation4Output{} - req.Data = output - return -} - -func (c *InputService20ProtocolTest) InputService20TestCaseOperation4(input *InputService20TestShapeInputShape) (*InputService20TestShapeInputService20TestCaseOperation4Output, error) { - req, out := c.InputService20TestCaseOperation4Request(input) - err := req.Send() - return out, err -} - -const opInputService20TestCaseOperation5 = "OperationName" - -// InputService20TestCaseOperation5Request generates a request for the InputService20TestCaseOperation5 operation. -func (c *InputService20ProtocolTest) InputService20TestCaseOperation5Request(input *InputService20TestShapeInputShape) (req *request.Request, output *InputService20TestShapeInputService20TestCaseOperation5Output) { - op := &request.Operation{ - Name: opInputService20TestCaseOperation5, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService20TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService20TestShapeInputService20TestCaseOperation5Output{} - req.Data = output - return -} - -func (c *InputService20ProtocolTest) InputService20TestCaseOperation5(input *InputService20TestShapeInputShape) (*InputService20TestShapeInputService20TestCaseOperation5Output, error) { - req, out := c.InputService20TestCaseOperation5Request(input) - err := req.Send() - return out, err -} - -const opInputService20TestCaseOperation6 = "OperationName" - -// InputService20TestCaseOperation6Request generates a request for the InputService20TestCaseOperation6 operation. -func (c *InputService20ProtocolTest) InputService20TestCaseOperation6Request(input *InputService20TestShapeInputShape) (req *request.Request, output *InputService20TestShapeInputService20TestCaseOperation6Output) { - op := &request.Operation{ - Name: opInputService20TestCaseOperation6, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService20TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService20TestShapeInputService20TestCaseOperation6Output{} - req.Data = output - return -} - -func (c *InputService20ProtocolTest) InputService20TestCaseOperation6(input *InputService20TestShapeInputShape) (*InputService20TestShapeInputService20TestCaseOperation6Output, error) { - req, out := c.InputService20TestCaseOperation6Request(input) - err := req.Send() - return out, err -} - -type InputService20TestShapeInputService20TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService20TestShapeInputService20TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService20TestShapeInputService20TestCaseOperation3Output struct { - _ struct{} `type:"structure"` -} - -type InputService20TestShapeInputService20TestCaseOperation4Output struct { - _ struct{} `type:"structure"` -} - -type InputService20TestShapeInputService20TestCaseOperation5Output struct { - _ struct{} `type:"structure"` -} - -type InputService20TestShapeInputService20TestCaseOperation6Output struct { - _ struct{} `type:"structure"` -} - -type InputService20TestShapeInputShape struct { - _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - RecursiveStruct *InputService20TestShapeRecursiveStructType `type:"structure"` -} - -type InputService20TestShapeRecursiveStructType struct { - _ struct{} `type:"structure"` - - NoRecurse *string `type:"string"` - - RecursiveList []*InputService20TestShapeRecursiveStructType `type:"list"` - - RecursiveMap map[string]*InputService20TestShapeRecursiveStructType `type:"map"` - - RecursiveStruct *InputService20TestShapeRecursiveStructType `type:"structure"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type InputService21ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService21ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService21ProtocolTest client from just a session. -// svc := inputservice21protocoltest.New(mySession) -// -// // Create a InputService21ProtocolTest client with additional configuration -// svc := inputservice21protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService21ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService21ProtocolTest { - c := p.ClientConfig("inputservice21protocoltest", cfgs...) - return newInputService21ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService21ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService21ProtocolTest { - svc := &InputService21ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice21protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a InputService21ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService21ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService21TestCaseOperation1 = "OperationName" - -// InputService21TestCaseOperation1Request generates a request for the InputService21TestCaseOperation1 operation. -func (c *InputService21ProtocolTest) InputService21TestCaseOperation1Request(input *InputService21TestShapeInputService21TestCaseOperation1Input) (req *request.Request, output *InputService21TestShapeInputService21TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService21TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService21TestShapeInputService21TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &InputService21TestShapeInputService21TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService21ProtocolTest) InputService21TestCaseOperation1(input *InputService21TestShapeInputService21TestCaseOperation1Input) (*InputService21TestShapeInputService21TestCaseOperation1Output, error) { - req, out := c.InputService21TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type InputService21TestShapeInputService21TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - TimeArgInHeader *time.Time `location:"header" locationName:"x-amz-timearg" type:"timestamp" timestampFormat:"rfc822"` -} - -type InputService21TestShapeInputService21TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// -// Tests begin here -// - -func TestInputService1ProtocolTestBasicXMLSerializationCase1(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService1TestShapeInputShape{ - Description: aws.String("bar"), - Name: aws.String("foo"), - } - req, _ := svc.InputService1TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `barfoo`, util.Trim(string(body)), InputService1TestShapeInputShape{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService1ProtocolTestBasicXMLSerializationCase2(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService1TestShapeInputShape{ - Description: aws.String("bar"), - Name: aws.String("foo"), - } - req, _ := svc.InputService1TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `barfoo`, util.Trim(string(body)), InputService1TestShapeInputShape{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService1ProtocolTestBasicXMLSerializationCase3(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService1TestShapeInputService1TestCaseOperation3Input{} - req, _ := svc.InputService1TestCaseOperation3Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService2ProtocolTestSerializeOtherScalarTypesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService2TestShapeInputService2TestCaseOperation1Input{ - First: aws.Bool(true), - Fourth: aws.Int64(3), - Second: aws.Bool(false), - Third: aws.Float64(1.2), - } - req, _ := svc.InputService2TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `true3false1.2`, util.Trim(string(body)), InputService2TestShapeInputService2TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService3ProtocolTestNestedStructuresCase1(t *testing.T) { - sess := session.New() - svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService3TestShapeInputShape{ - Description: aws.String("baz"), - SubStructure: &InputService3TestShapeSubStructure{ - Bar: aws.String("b"), - Foo: aws.String("a"), - }, - } - req, _ := svc.InputService3TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `bazba`, util.Trim(string(body)), InputService3TestShapeInputShape{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService3ProtocolTestNestedStructuresCase2(t *testing.T) { - sess := session.New() - svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService3TestShapeInputShape{ - Description: aws.String("baz"), - SubStructure: &InputService3TestShapeSubStructure{ - Foo: aws.String("a"), - }, - } - req, _ := svc.InputService3TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `baza`, util.Trim(string(body)), InputService3TestShapeInputShape{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService4ProtocolTestNestedStructuresCase1(t *testing.T) { - sess := session.New() - svc := NewInputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService4TestShapeInputService4TestCaseOperation1Input{ - Description: aws.String("baz"), - SubStructure: &InputService4TestShapeSubStructure{}, - } - req, _ := svc.InputService4TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `baz`, util.Trim(string(body)), InputService4TestShapeInputService4TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService5ProtocolTestNonFlattenedListsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService5TestShapeInputService5TestCaseOperation1Input{ - ListParam: []*string{ - aws.String("one"), - aws.String("two"), - aws.String("three"), - }, - } - req, _ := svc.InputService5TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `onetwothree`, util.Trim(string(body)), InputService5TestShapeInputService5TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService6ProtocolTestNonFlattenedListsWithLocationNameCase1(t *testing.T) { - sess := session.New() - svc := NewInputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService6TestShapeInputService6TestCaseOperation1Input{ - ListParam: []*string{ - aws.String("one"), - aws.String("two"), - aws.String("three"), - }, - } - req, _ := svc.InputService6TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `onetwothree`, util.Trim(string(body)), InputService6TestShapeInputService6TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService7ProtocolTestFlattenedListsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService7TestShapeInputService7TestCaseOperation1Input{ - ListParam: []*string{ - aws.String("one"), - aws.String("two"), - aws.String("three"), - }, - } - req, _ := svc.InputService7TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `onetwothree`, util.Trim(string(body)), InputService7TestShapeInputService7TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService8ProtocolTestFlattenedListsWithLocationNameCase1(t *testing.T) { - sess := session.New() - svc := NewInputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService8TestShapeInputService8TestCaseOperation1Input{ - ListParam: []*string{ - aws.String("one"), - aws.String("two"), - aws.String("three"), - }, - } - req, _ := svc.InputService8TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `onetwothree`, util.Trim(string(body)), InputService8TestShapeInputService8TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService9ProtocolTestListOfStructuresCase1(t *testing.T) { - sess := session.New() - svc := NewInputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService9TestShapeInputService9TestCaseOperation1Input{ - ListParam: []*InputService9TestShapeSingleFieldStruct{ - { - Element: aws.String("one"), - }, - { - Element: aws.String("two"), - }, - { - Element: aws.String("three"), - }, - }, - } - req, _ := svc.InputService9TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `onetwothree`, util.Trim(string(body)), InputService9TestShapeInputService9TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService10ProtocolTestBlobAndTimestampShapesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService10ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService10TestShapeInputService10TestCaseOperation1Input{ - StructureParam: &InputService10TestShapeStructureShape{ - B: []byte("foo"), - T: aws.Time(time.Unix(1422172800, 0)), - }, - } - req, _ := svc.InputService10TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `Zm9v2015-01-25T08:00:00Z`, util.Trim(string(body)), InputService10TestShapeInputService10TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService11ProtocolTestHeaderMapsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService11ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService11TestShapeInputService11TestCaseOperation1Input{ - Foo: map[string]*string{ - "a": aws.String("b"), - "c": aws.String("d"), - }, - } - req, _ := svc.InputService11TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - assert.Equal(t, "b", r.Header.Get("x-foo-a")) - assert.Equal(t, "d", r.Header.Get("x-foo-c")) - -} - -func TestInputService12ProtocolTestStringToStringMapsInQuerystringCase1(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService12TestShapeInputService12TestCaseOperation1Input{ - PipelineId: aws.String("foo"), - QueryDoc: map[string]*string{ - "bar": aws.String("baz"), - "fizz": aws.String("buzz"), - }, - } - req, _ := svc.InputService12TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/foo?bar=baz&fizz=buzz", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestStringToStringListMapsInQuerystringCase1(t *testing.T) { - sess := session.New() - svc := NewInputService13ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService13TestShapeInputService13TestCaseOperation1Input{ - PipelineId: aws.String("id"), - QueryDoc: map[string][]*string{ - "fizz": { - aws.String("buzz"), - aws.String("pop"), - }, - "foo": { - aws.String("bar"), - aws.String("baz"), - }, - }, - } - req, _ := svc.InputService13TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/id?foo=bar&foo=baz&fizz=buzz&fizz=pop", r.URL.String()) - - // assert headers - -} - -func TestInputService14ProtocolTestStringPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewInputService14ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService14TestShapeInputService14TestCaseOperation1Input{ - Foo: aws.String("bar"), - } - req, _ := svc.InputService14TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, `bar`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService15ProtocolTestBlobPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewInputService15ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService15TestShapeInputShape{ - Foo: []byte("bar"), - } - req, _ := svc.InputService15TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, `bar`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService15ProtocolTestBlobPayloadCase2(t *testing.T) { - sess := session.New() - svc := NewInputService15ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService15TestShapeInputShape{} - req, _ := svc.InputService15TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService16ProtocolTestStructurePayloadCase1(t *testing.T) { - sess := session.New() - svc := NewInputService16ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService16TestShapeInputShape{ - Foo: &InputService16TestShapeFooShape{ - Baz: aws.String("bar"), - }, - } - req, _ := svc.InputService16TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `bar`, util.Trim(string(body)), InputService16TestShapeInputShape{}) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService16ProtocolTestStructurePayloadCase2(t *testing.T) { - sess := session.New() - svc := NewInputService16ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService16TestShapeInputShape{} - req, _ := svc.InputService16TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService16ProtocolTestStructurePayloadCase3(t *testing.T) { - sess := session.New() - svc := NewInputService16ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService16TestShapeInputShape{ - Foo: &InputService16TestShapeFooShape{}, - } - req, _ := svc.InputService16TestCaseOperation3Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, ``, util.Trim(string(body)), InputService16TestShapeInputShape{}) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService16ProtocolTestStructurePayloadCase4(t *testing.T) { - sess := session.New() - svc := NewInputService16ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService16TestShapeInputShape{} - req, _ := svc.InputService16TestCaseOperation4Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService17ProtocolTestXMLAttributeCase1(t *testing.T) { - sess := session.New() - svc := NewInputService17ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService17TestShapeInputService17TestCaseOperation1Input{ - Grant: &InputService17TestShapeGrant{ - Grantee: &InputService17TestShapeGrantee{ - EmailAddress: aws.String("foo@example.com"), - Type: aws.String("CanonicalUser"), - }, - }, - } - req, _ := svc.InputService17TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `foo@example.com`, util.Trim(string(body)), InputService17TestShapeInputService17TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService18ProtocolTestGreedyKeysCase1(t *testing.T) { - sess := session.New() - svc := NewInputService18ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService18TestShapeInputService18TestCaseOperation1Input{ - Bucket: aws.String("my/bucket"), - Key: aws.String("testing /123"), - } - req, _ := svc.InputService18TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/my%2Fbucket/testing%20/123", r.URL.String()) - - // assert headers - -} - -func TestInputService19ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService19ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService19TestShapeInputShape{} - req, _ := svc.InputService19TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService19ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase2(t *testing.T) { - sess := session.New() - svc := NewInputService19ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService19TestShapeInputShape{ - Foo: aws.String(""), - } - req, _ := svc.InputService19TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/path?abc=mno¶m-name=", r.URL.String()) - - // assert headers - -} - -func TestInputService20ProtocolTestRecursiveShapesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService20ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService20TestShapeInputShape{ - RecursiveStruct: &InputService20TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - } - req, _ := svc.InputService20TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `foo`, util.Trim(string(body)), InputService20TestShapeInputShape{}) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService20ProtocolTestRecursiveShapesCase2(t *testing.T) { - sess := session.New() - svc := NewInputService20ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService20TestShapeInputShape{ - RecursiveStruct: &InputService20TestShapeRecursiveStructType{ - RecursiveStruct: &InputService20TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - } - req, _ := svc.InputService20TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `foo`, util.Trim(string(body)), InputService20TestShapeInputShape{}) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService20ProtocolTestRecursiveShapesCase3(t *testing.T) { - sess := session.New() - svc := NewInputService20ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService20TestShapeInputShape{ - RecursiveStruct: &InputService20TestShapeRecursiveStructType{ - RecursiveStruct: &InputService20TestShapeRecursiveStructType{ - RecursiveStruct: &InputService20TestShapeRecursiveStructType{ - RecursiveStruct: &InputService20TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - }, - }, - } - req, _ := svc.InputService20TestCaseOperation3Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `foo`, util.Trim(string(body)), InputService20TestShapeInputShape{}) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService20ProtocolTestRecursiveShapesCase4(t *testing.T) { - sess := session.New() - svc := NewInputService20ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService20TestShapeInputShape{ - RecursiveStruct: &InputService20TestShapeRecursiveStructType{ - RecursiveList: []*InputService20TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - NoRecurse: aws.String("bar"), - }, - }, - }, - } - req, _ := svc.InputService20TestCaseOperation4Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `foobar`, util.Trim(string(body)), InputService20TestShapeInputShape{}) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService20ProtocolTestRecursiveShapesCase5(t *testing.T) { - sess := session.New() - svc := NewInputService20ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService20TestShapeInputShape{ - RecursiveStruct: &InputService20TestShapeRecursiveStructType{ - RecursiveList: []*InputService20TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - RecursiveStruct: &InputService20TestShapeRecursiveStructType{ - NoRecurse: aws.String("bar"), - }, - }, - }, - }, - } - req, _ := svc.InputService20TestCaseOperation5Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `foobar`, util.Trim(string(body)), InputService20TestShapeInputShape{}) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService20ProtocolTestRecursiveShapesCase6(t *testing.T) { - sess := session.New() - svc := NewInputService20ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService20TestShapeInputShape{ - RecursiveStruct: &InputService20TestShapeRecursiveStructType{ - RecursiveMap: map[string]*InputService20TestShapeRecursiveStructType{ - "bar": { - NoRecurse: aws.String("bar"), - }, - "foo": { - NoRecurse: aws.String("foo"), - }, - }, - }, - } - req, _ := svc.InputService20TestCaseOperation6Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - awstesting.AssertXML(t, `foofoobarbar`, util.Trim(string(body)), InputService20TestShapeInputShape{}) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService21ProtocolTestTimestampInHeaderCase1(t *testing.T) { - sess := session.New() - svc := NewInputService21ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - input := &InputService21TestShapeInputService21TestCaseOperation1Input{ - TimeArgInHeader: aws.Time(time.Unix(1422172800, 0)), - } - req, _ := svc.InputService21TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - assert.Equal(t, "Sun, 25 Jan 2015 08:00:00 GMT", r.Header.Get("x-amz-timearg")) - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/unmarshal_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/unmarshal_test.go deleted file mode 100644 index 0cf44db876..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/unmarshal_test.go +++ /dev/null @@ -1,1498 +0,0 @@ -package restxml_test - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "io" - "io/ioutil" - "net/http" - "net/url" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/protocol/restxml" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" - "github.com/aws/aws-sdk-go/private/signer/v4" - "github.com/aws/aws-sdk-go/private/util" - "github.com/stretchr/testify/assert" -) - -var _ bytes.Buffer // always import bytes -var _ http.Request -var _ json.Marshaler -var _ time.Time -var _ xmlutil.XMLNode -var _ xml.Attr -var _ = awstesting.GenerateAssertions -var _ = ioutil.Discard -var _ = util.Trim("") -var _ = url.Values{} -var _ = io.EOF -var _ = aws.String - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService1ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService1ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService1ProtocolTest client from just a session. -// svc := outputservice1protocoltest.New(mySession) -// -// // Create a OutputService1ProtocolTest client with additional configuration -// svc := outputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService1ProtocolTest { - c := p.ClientConfig("outputservice1protocoltest", cfgs...) - return newOutputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService1ProtocolTest { - svc := &OutputService1ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice1protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService1ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService1TestCaseOperation1 = "OperationName" - -// OutputService1TestCaseOperation1Request generates a request for the OutputService1TestCaseOperation1 operation. -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *request.Request, output *OutputService1TestShapeOutputShape) { - op := &request.Operation{ - Name: opOutputService1TestCaseOperation1, - } - - if input == nil { - input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService1TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputShape, error) { - req, out := c.OutputService1TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -const opOutputService1TestCaseOperation2 = "OperationName" - -// OutputService1TestCaseOperation2Request generates a request for the OutputService1TestCaseOperation2 operation. -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation2Request(input *OutputService1TestShapeOutputService1TestCaseOperation2Input) (req *request.Request, output *OutputService1TestShapeOutputShape) { - op := &request.Operation{ - Name: opOutputService1TestCaseOperation2, - } - - if input == nil { - input = &OutputService1TestShapeOutputService1TestCaseOperation2Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService1TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation2(input *OutputService1TestShapeOutputService1TestCaseOperation2Input) (*OutputService1TestShapeOutputShape, error) { - req, out := c.OutputService1TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -type OutputService1TestShapeOutputService1TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService1TestShapeOutputService1TestCaseOperation2Input struct { - _ struct{} `type:"structure"` -} - -type OutputService1TestShapeOutputShape struct { - _ struct{} `type:"structure"` - - Char *string `type:"character"` - - Double *float64 `type:"double"` - - FalseBool *bool `type:"boolean"` - - Float *float64 `type:"float"` - - ImaHeader *string `location:"header" type:"string"` - - ImaHeaderLocation *string `location:"header" locationName:"X-Foo" type:"string"` - - Long *int64 `type:"long"` - - Num *int64 `locationName:"FooNum" type:"integer"` - - Str *string `type:"string"` - - Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - TrueBool *bool `type:"boolean"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService2ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService2ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService2ProtocolTest client from just a session. -// svc := outputservice2protocoltest.New(mySession) -// -// // Create a OutputService2ProtocolTest client with additional configuration -// svc := outputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService2ProtocolTest { - c := p.ClientConfig("outputservice2protocoltest", cfgs...) - return newOutputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService2ProtocolTest { - svc := &OutputService2ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice2protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService2ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService2TestCaseOperation1 = "OperationName" - -// OutputService2TestCaseOperation1Request generates a request for the OutputService2TestCaseOperation1 operation. -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *request.Request, output *OutputService2TestShapeOutputService2TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService2TestCaseOperation1, - } - - if input == nil { - input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService2TestShapeOutputService2TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) { - req, out := c.OutputService2TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService2TestShapeOutputService2TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService2TestShapeOutputService2TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Blob []byte `type:"blob"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService3ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService3ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService3ProtocolTest client from just a session. -// svc := outputservice3protocoltest.New(mySession) -// -// // Create a OutputService3ProtocolTest client with additional configuration -// svc := outputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService3ProtocolTest { - c := p.ClientConfig("outputservice3protocoltest", cfgs...) - return newOutputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService3ProtocolTest { - svc := &OutputService3ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice3protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService3ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService3TestCaseOperation1 = "OperationName" - -// OutputService3TestCaseOperation1Request generates a request for the OutputService3TestCaseOperation1 operation. -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *request.Request, output *OutputService3TestShapeOutputService3TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService3TestCaseOperation1, - } - - if input == nil { - input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService3TestShapeOutputService3TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) { - req, out := c.OutputService3TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService3TestShapeOutputService3TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService3TestShapeOutputService3TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `type:"list"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService4ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService4ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService4ProtocolTest client from just a session. -// svc := outputservice4protocoltest.New(mySession) -// -// // Create a OutputService4ProtocolTest client with additional configuration -// svc := outputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService4ProtocolTest { - c := p.ClientConfig("outputservice4protocoltest", cfgs...) - return newOutputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService4ProtocolTest { - svc := &OutputService4ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice4protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService4ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService4TestCaseOperation1 = "OperationName" - -// OutputService4TestCaseOperation1Request generates a request for the OutputService4TestCaseOperation1 operation. -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *request.Request, output *OutputService4TestShapeOutputService4TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService4TestCaseOperation1, - } - - if input == nil { - input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService4TestShapeOutputService4TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputService4TestCaseOperation1Output, error) { - req, out := c.OutputService4TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService4TestShapeOutputService4TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService4TestShapeOutputService4TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `locationNameList:"item" type:"list"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService5ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService5ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService5ProtocolTest client from just a session. -// svc := outputservice5protocoltest.New(mySession) -// -// // Create a OutputService5ProtocolTest client with additional configuration -// svc := outputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService5ProtocolTest { - c := p.ClientConfig("outputservice5protocoltest", cfgs...) - return newOutputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService5ProtocolTest { - svc := &OutputService5ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice5protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService5ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService5TestCaseOperation1 = "OperationName" - -// OutputService5TestCaseOperation1Request generates a request for the OutputService5TestCaseOperation1 operation. -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *request.Request, output *OutputService5TestShapeOutputService5TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService5TestCaseOperation1, - } - - if input == nil { - input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService5TestShapeOutputService5TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) { - req, out := c.OutputService5TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService5TestShapeOutputService5TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService5TestShapeOutputService5TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `type:"list" flattened:"true"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService6ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService6ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService6ProtocolTest client from just a session. -// svc := outputservice6protocoltest.New(mySession) -// -// // Create a OutputService6ProtocolTest client with additional configuration -// svc := outputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService6ProtocolTest { - c := p.ClientConfig("outputservice6protocoltest", cfgs...) - return newOutputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService6ProtocolTest { - svc := &OutputService6ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice6protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService6ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService6TestCaseOperation1 = "OperationName" - -// OutputService6TestCaseOperation1Request generates a request for the OutputService6TestCaseOperation1 operation. -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *request.Request, output *OutputService6TestShapeOutputService6TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService6TestCaseOperation1, - } - - if input == nil { - input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService6TestShapeOutputService6TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) { - req, out := c.OutputService6TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService6TestShapeOutputService6TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService6TestShapeOutputService6TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Map map[string]*OutputService6TestShapeSingleStructure `type:"map"` -} - -type OutputService6TestShapeSingleStructure struct { - _ struct{} `type:"structure"` - - Foo *string `locationName:"foo" type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService7ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService7ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService7ProtocolTest client from just a session. -// svc := outputservice7protocoltest.New(mySession) -// -// // Create a OutputService7ProtocolTest client with additional configuration -// svc := outputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService7ProtocolTest { - c := p.ClientConfig("outputservice7protocoltest", cfgs...) - return newOutputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService7ProtocolTest { - svc := &OutputService7ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice7protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService7ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService7TestCaseOperation1 = "OperationName" - -// OutputService7TestCaseOperation1Request generates a request for the OutputService7TestCaseOperation1 operation. -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *request.Request, output *OutputService7TestShapeOutputService7TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService7TestCaseOperation1, - } - - if input == nil { - input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService7TestShapeOutputService7TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) { - req, out := c.OutputService7TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService7TestShapeOutputService7TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService7TestShapeOutputService7TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Map map[string]*string `type:"map" flattened:"true"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService8ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService8ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService8ProtocolTest client from just a session. -// svc := outputservice8protocoltest.New(mySession) -// -// // Create a OutputService8ProtocolTest client with additional configuration -// svc := outputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService8ProtocolTest { - c := p.ClientConfig("outputservice8protocoltest", cfgs...) - return newOutputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService8ProtocolTest { - svc := &OutputService8ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice8protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService8ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService8TestCaseOperation1 = "OperationName" - -// OutputService8TestCaseOperation1Request generates a request for the OutputService8TestCaseOperation1 operation. -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *request.Request, output *OutputService8TestShapeOutputService8TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService8TestCaseOperation1, - } - - if input == nil { - input = &OutputService8TestShapeOutputService8TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService8TestShapeOutputService8TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (*OutputService8TestShapeOutputService8TestCaseOperation1Output, error) { - req, out := c.OutputService8TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService8TestShapeOutputService8TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService8TestShapeOutputService8TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Map map[string]*string `locationNameKey:"foo" locationNameValue:"bar" type:"map"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService9ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService9ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService9ProtocolTest client from just a session. -// svc := outputservice9protocoltest.New(mySession) -// -// // Create a OutputService9ProtocolTest client with additional configuration -// svc := outputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService9ProtocolTest { - c := p.ClientConfig("outputservice9protocoltest", cfgs...) - return newOutputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService9ProtocolTest { - svc := &OutputService9ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice9protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService9ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService9TestCaseOperation1 = "OperationName" - -// OutputService9TestCaseOperation1Request generates a request for the OutputService9TestCaseOperation1 operation. -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *request.Request, output *OutputService9TestShapeOutputService9TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService9TestCaseOperation1, - } - - if input == nil { - input = &OutputService9TestShapeOutputService9TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService9TestShapeOutputService9TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (*OutputService9TestShapeOutputService9TestCaseOperation1Output, error) { - req, out := c.OutputService9TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService9TestShapeOutputService9TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService9TestShapeOutputService9TestCaseOperation1Output struct { - _ struct{} `type:"structure" payload:"Data"` - - Data *OutputService9TestShapeSingleStructure `type:"structure"` - - Header *string `location:"header" locationName:"X-Foo" type:"string"` -} - -type OutputService9TestShapeSingleStructure struct { - _ struct{} `type:"structure"` - - Foo *string `type:"string"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService10ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService10ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService10ProtocolTest client from just a session. -// svc := outputservice10protocoltest.New(mySession) -// -// // Create a OutputService10ProtocolTest client with additional configuration -// svc := outputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService10ProtocolTest { - c := p.ClientConfig("outputservice10protocoltest", cfgs...) - return newOutputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService10ProtocolTest { - svc := &OutputService10ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice10protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService10ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService10TestCaseOperation1 = "OperationName" - -// OutputService10TestCaseOperation1Request generates a request for the OutputService10TestCaseOperation1 operation. -func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1Request(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (req *request.Request, output *OutputService10TestShapeOutputService10TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService10TestCaseOperation1, - } - - if input == nil { - input = &OutputService10TestShapeOutputService10TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService10TestShapeOutputService10TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (*OutputService10TestShapeOutputService10TestCaseOperation1Output, error) { - req, out := c.OutputService10TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService10TestShapeOutputService10TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService10TestShapeOutputService10TestCaseOperation1Output struct { - _ struct{} `type:"structure" payload:"Stream"` - - Stream []byte `type:"blob"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService11ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService11ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService11ProtocolTest client from just a session. -// svc := outputservice11protocoltest.New(mySession) -// -// // Create a OutputService11ProtocolTest client with additional configuration -// svc := outputservice11protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService11ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService11ProtocolTest { - c := p.ClientConfig("outputservice11protocoltest", cfgs...) - return newOutputService11ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService11ProtocolTest { - svc := &OutputService11ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice11protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService11ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService11TestCaseOperation1 = "OperationName" - -// OutputService11TestCaseOperation1Request generates a request for the OutputService11TestCaseOperation1 operation. -func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1Request(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (req *request.Request, output *OutputService11TestShapeOutputService11TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService11TestCaseOperation1, - } - - if input == nil { - input = &OutputService11TestShapeOutputService11TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService11TestShapeOutputService11TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (*OutputService11TestShapeOutputService11TestCaseOperation1Output, error) { - req, out := c.OutputService11TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService11TestShapeOutputService11TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService11TestShapeOutputService11TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Char *string `location:"header" locationName:"x-char" type:"character"` - - Double *float64 `location:"header" locationName:"x-double" type:"double"` - - FalseBool *bool `location:"header" locationName:"x-false-bool" type:"boolean"` - - Float *float64 `location:"header" locationName:"x-float" type:"float"` - - Integer *int64 `location:"header" locationName:"x-int" type:"integer"` - - Long *int64 `location:"header" locationName:"x-long" type:"long"` - - Str *string `location:"header" locationName:"x-str" type:"string"` - - Timestamp *time.Time `location:"header" locationName:"x-timestamp" type:"timestamp" timestampFormat:"iso8601"` - - TrueBool *bool `location:"header" locationName:"x-true-bool" type:"boolean"` -} - -//The service client's operations are safe to be used concurrently. -// It is not safe to mutate any of the client's properties though. -type OutputService12ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService12ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService12ProtocolTest client from just a session. -// svc := outputservice12protocoltest.New(mySession) -// -// // Create a OutputService12ProtocolTest client with additional configuration -// svc := outputservice12protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService12ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService12ProtocolTest { - c := p.ClientConfig("outputservice12protocoltest", cfgs...) - return newOutputService12ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService12ProtocolTest { - svc := &OutputService12ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice12protocoltest", - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return svc -} - -// newRequest creates a new request for a OutputService12ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService12TestCaseOperation1 = "OperationName" - -// OutputService12TestCaseOperation1Request generates a request for the OutputService12TestCaseOperation1 operation. -func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1Request(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (req *request.Request, output *OutputService12TestShapeOutputService12TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService12TestCaseOperation1, - } - - if input == nil { - input = &OutputService12TestShapeOutputService12TestCaseOperation1Input{} - } - - req = c.newRequest(op, input, output) - output = &OutputService12TestShapeOutputService12TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (*OutputService12TestShapeOutputService12TestCaseOperation1Output, error) { - req, out := c.OutputService12TestCaseOperation1Request(input) - err := req.Send() - return out, err -} - -type OutputService12TestShapeOutputService12TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService12TestShapeOutputService12TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Foo *string `type:"string"` -} - -// -// Tests begin here -// - -func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("myname123falsetrue1.21.3200a2015-01-25T08:00:00Z")) - req, out := svc.OutputService1TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("ImaHeader", "test") - req.HTTPResponse.Header.Set("X-Foo", "abc") - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "a", *out.Char) - assert.Equal(t, 1.3, *out.Double) - assert.Equal(t, false, *out.FalseBool) - assert.Equal(t, 1.2, *out.Float) - assert.Equal(t, "test", *out.ImaHeader) - assert.Equal(t, "abc", *out.ImaHeaderLocation) - assert.Equal(t, int64(200), *out.Long) - assert.Equal(t, int64(123), *out.Num) - assert.Equal(t, "myname", *out.Str) - assert.Equal(t, time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.String()) - assert.Equal(t, true, *out.TrueBool) - -} - -func TestOutputService1ProtocolTestScalarMembersCase2(t *testing.T) { - sess := session.New() - svc := NewOutputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("123falsetrue1.21.3200a2015-01-25T08:00:00Z")) - req, out := svc.OutputService1TestCaseOperation2Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("ImaHeader", "test") - req.HTTPResponse.Header.Set("X-Foo", "abc") - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "a", *out.Char) - assert.Equal(t, 1.3, *out.Double) - assert.Equal(t, false, *out.FalseBool) - assert.Equal(t, 1.2, *out.Float) - assert.Equal(t, "test", *out.ImaHeader) - assert.Equal(t, "abc", *out.ImaHeaderLocation) - assert.Equal(t, int64(200), *out.Long) - assert.Equal(t, int64(123), *out.Num) - assert.Equal(t, "", *out.Str) - assert.Equal(t, time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.String()) - assert.Equal(t, true, *out.TrueBool) - -} - -func TestOutputService2ProtocolTestBlobCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("dmFsdWU=")) - req, out := svc.OutputService2TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "value", string(out.Blob)) - -} - -func TestOutputService3ProtocolTestListsCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc123")) - req, out := svc.OutputService3TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "abc", *out.ListMember[0]) - assert.Equal(t, "123", *out.ListMember[1]) - -} - -func TestOutputService4ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc123")) - req, out := svc.OutputService4TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "abc", *out.ListMember[0]) - assert.Equal(t, "123", *out.ListMember[1]) - -} - -func TestOutputService5ProtocolTestFlattenedListCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc123")) - req, out := svc.OutputService5TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "abc", *out.ListMember[0]) - assert.Equal(t, "123", *out.ListMember[1]) - -} - -func TestOutputService6ProtocolTestNormalMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarbazbam")) - req, out := svc.OutputService6TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "bam", *out.Map["baz"].Foo) - assert.Equal(t, "bar", *out.Map["qux"].Foo) - -} - -func TestOutputService7ProtocolTestFlattenedMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarbazbam")) - req, out := svc.OutputService7TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "bam", *out.Map["baz"]) - assert.Equal(t, "bar", *out.Map["qux"]) - -} - -func TestOutputService8ProtocolTestNamedMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarbazbam")) - req, out := svc.OutputService8TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "bam", *out.Map["baz"]) - assert.Equal(t, "bar", *out.Map["qux"]) - -} - -func TestOutputService9ProtocolTestXMLPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc")) - req, out := svc.OutputService9TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("X-Foo", "baz") - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "abc", *out.Data.Foo) - assert.Equal(t, "baz", *out.Header) - -} - -func TestOutputService10ProtocolTestStreamingPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService10ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc")) - req, out := svc.OutputService10TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "abc", string(out.Stream)) - -} - -func TestOutputService11ProtocolTestScalarMembersInHeadersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService11ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("")) - req, out := svc.OutputService11TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("x-char", "a") - req.HTTPResponse.Header.Set("x-double", "1.5") - req.HTTPResponse.Header.Set("x-false-bool", "false") - req.HTTPResponse.Header.Set("x-float", "1.5") - req.HTTPResponse.Header.Set("x-int", "1") - req.HTTPResponse.Header.Set("x-long", "100") - req.HTTPResponse.Header.Set("x-str", "string") - req.HTTPResponse.Header.Set("x-timestamp", "Sun, 25 Jan 2015 08:00:00 GMT") - req.HTTPResponse.Header.Set("x-true-bool", "true") - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "a", *out.Char) - assert.Equal(t, 1.5, *out.Double) - assert.Equal(t, false, *out.FalseBool) - assert.Equal(t, 1.5, *out.Float) - assert.Equal(t, int64(1), *out.Integer) - assert.Equal(t, int64(100), *out.Long) - assert.Equal(t, "string", *out.Str) - assert.Equal(t, time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.String()) - assert.Equal(t, true, *out.TrueBool) - -} - -func TestOutputService12ProtocolTestEmptyStringCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("requestid")) - req, out := svc.OutputService12TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "", *out.Foo) - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/signer/v4/functional_test.go b/vendor/github.com/aws/aws-sdk-go/private/signer/v4/functional_test.go deleted file mode 100644 index c2cee6bbcb..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/signer/v4/functional_test.go +++ /dev/null @@ -1,77 +0,0 @@ -package v4_test - -import ( - "net/http" - "net/url" - "testing" - "time" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" -) - -func TestPresignHandler(t *testing.T) { - svc := s3.New(unit.Session) - req, _ := svc.PutObjectRequest(&s3.PutObjectInput{ - Bucket: aws.String("bucket"), - Key: aws.String("key"), - ContentDisposition: aws.String("a+b c$d"), - ACL: aws.String("public-read"), - }) - req.Time = time.Unix(0, 0) - urlstr, err := req.Presign(5 * time.Minute) - - assert.NoError(t, err) - - expectedDate := "19700101T000000Z" - expectedHeaders := "content-disposition;host;x-amz-acl" - expectedSig := "2d76a414208c0eac2a23ef9c834db9635ecd5a0fbb447a00ad191f82d854f55b" - expectedCred := "AKID/19700101/mock-region/s3/aws4_request" - - u, _ := url.Parse(urlstr) - urlQ := u.Query() - assert.Equal(t, expectedSig, urlQ.Get("X-Amz-Signature")) - assert.Equal(t, expectedCred, urlQ.Get("X-Amz-Credential")) - assert.Equal(t, expectedHeaders, urlQ.Get("X-Amz-SignedHeaders")) - assert.Equal(t, expectedDate, urlQ.Get("X-Amz-Date")) - assert.Equal(t, "300", urlQ.Get("X-Amz-Expires")) - - assert.NotContains(t, urlstr, "+") // + encoded as %20 -} - -func TestPresignRequest(t *testing.T) { - svc := s3.New(unit.Session) - req, _ := svc.PutObjectRequest(&s3.PutObjectInput{ - Bucket: aws.String("bucket"), - Key: aws.String("key"), - ContentDisposition: aws.String("a+b c$d"), - ACL: aws.String("public-read"), - }) - req.Time = time.Unix(0, 0) - urlstr, headers, err := req.PresignRequest(5 * time.Minute) - - assert.NoError(t, err) - - expectedDate := "19700101T000000Z" - expectedHeaders := "content-disposition;host;x-amz-acl" - expectedSig := "2d76a414208c0eac2a23ef9c834db9635ecd5a0fbb447a00ad191f82d854f55b" - expectedCred := "AKID/19700101/mock-region/s3/aws4_request" - expectedHeaderMap := http.Header{ - "x-amz-acl": []string{"public-read"}, - "content-disposition": []string{"a+b c$d"}, - } - - u, _ := url.Parse(urlstr) - urlQ := u.Query() - assert.Equal(t, expectedSig, urlQ.Get("X-Amz-Signature")) - assert.Equal(t, expectedCred, urlQ.Get("X-Amz-Credential")) - assert.Equal(t, expectedHeaders, urlQ.Get("X-Amz-SignedHeaders")) - assert.Equal(t, expectedDate, urlQ.Get("X-Amz-Date")) - assert.Equal(t, expectedHeaderMap, headers) - assert.Equal(t, "300", urlQ.Get("X-Amz-Expires")) - - assert.NotContains(t, urlstr, "+") // + encoded as %20 -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/signer/v4/header_rules_test.go b/vendor/github.com/aws/aws-sdk-go/private/signer/v4/header_rules_test.go deleted file mode 100644 index 7dfddc87e5..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/signer/v4/header_rules_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package v4 - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestRuleCheckWhitelist(t *testing.T) { - w := whitelist{ - mapRule{ - "Cache-Control": struct{}{}, - }, - } - - assert.True(t, w.IsValid("Cache-Control")) - assert.False(t, w.IsValid("Cache-")) -} - -func TestRuleCheckBlacklist(t *testing.T) { - b := blacklist{ - mapRule{ - "Cache-Control": struct{}{}, - }, - } - - assert.False(t, b.IsValid("Cache-Control")) - assert.True(t, b.IsValid("Cache-")) -} - -func TestRuleCheckPattern(t *testing.T) { - p := patterns{"X-Amz-Meta-"} - - assert.True(t, p.IsValid("X-Amz-Meta-")) - assert.True(t, p.IsValid("X-Amz-Meta-Star")) - assert.False(t, p.IsValid("Cache-")) -} - -func TestRuleComplexWhitelist(t *testing.T) { - w := rules{ - whitelist{ - mapRule{ - "Cache-Control": struct{}{}, - }, - }, - patterns{"X-Amz-Meta-"}, - } - - r := rules{ - inclusiveRules{patterns{"X-Amz-"}, blacklist{w}}, - } - - assert.True(t, r.IsValid("X-Amz-Blah")) - assert.False(t, r.IsValid("X-Amz-Meta-")) - assert.False(t, r.IsValid("X-Amz-Meta-Star")) - assert.False(t, r.IsValid("Cache-Control")) -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/signer/v4/v4_test.go b/vendor/github.com/aws/aws-sdk-go/private/signer/v4/v4_test.go deleted file mode 100644 index a417a64b4c..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/signer/v4/v4_test.go +++ /dev/null @@ -1,255 +0,0 @@ -package v4 - -import ( - "net/http" - "strings" - "testing" - "time" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting" -) - -func buildSigner(serviceName string, region string, signTime time.Time, expireTime time.Duration, body string) signer { - endpoint := "https://" + serviceName + "." + region + ".amazonaws.com" - reader := strings.NewReader(body) - req, _ := http.NewRequest("POST", endpoint, reader) - req.URL.Opaque = "//example.org/bucket/key-._~,!@#$%^&*()" - req.Header.Add("X-Amz-Target", "prefix.Operation") - req.Header.Add("Content-Type", "application/x-amz-json-1.0") - req.Header.Add("Content-Length", string(len(body))) - req.Header.Add("X-Amz-Meta-Other-Header", "some-value=!@#$%^&* (+)") - - return signer{ - Request: req, - Time: signTime, - ExpireTime: expireTime, - Query: req.URL.Query(), - Body: reader, - ServiceName: serviceName, - Region: region, - Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"), - } -} - -func removeWS(text string) string { - text = strings.Replace(text, " ", "", -1) - text = strings.Replace(text, "\n", "", -1) - text = strings.Replace(text, "\t", "", -1) - return text -} - -func assertEqual(t *testing.T, expected, given string) { - if removeWS(expected) != removeWS(given) { - t.Errorf("\nExpected: %s\nGiven: %s", expected, given) - } -} - -func TestPresignRequest(t *testing.T) { - signer := buildSigner("dynamodb", "us-east-1", time.Unix(0, 0), 300*time.Second, "{}") - signer.sign() - - expectedDate := "19700101T000000Z" - expectedHeaders := "content-type;host;x-amz-meta-other-header" - expectedSig := "4fe8944ddd3e83a32bc874955e734e5a349116bfce2d4f43171e0f7572b842f6" - expectedCred := "AKID/19700101/us-east-1/dynamodb/aws4_request" - expectedTarget := "prefix.Operation" - - q := signer.Request.URL.Query() - assert.Equal(t, expectedSig, q.Get("X-Amz-Signature")) - assert.Equal(t, expectedCred, q.Get("X-Amz-Credential")) - assert.Equal(t, expectedHeaders, q.Get("X-Amz-SignedHeaders")) - assert.Equal(t, expectedDate, q.Get("X-Amz-Date")) - assert.Empty(t, q.Get("X-Amz-Meta-Other-Header")) - assert.Equal(t, expectedTarget, q.Get("X-Amz-Target")) -} - -func TestSignRequest(t *testing.T) { - signer := buildSigner("dynamodb", "us-east-1", time.Unix(0, 0), 0, "{}") - signer.sign() - - expectedDate := "19700101T000000Z" - expectedSig := "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/dynamodb/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-meta-other-header;x-amz-security-token;x-amz-target, Signature=5d3983fb3de907bdc2f3a6951d968e510f0252a8358c038f7680aa02374eeb67" - - q := signer.Request.Header - assert.Equal(t, expectedSig, q.Get("Authorization")) - assert.Equal(t, expectedDate, q.Get("X-Amz-Date")) -} - -func TestSignEmptyBody(t *testing.T) { - signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "") - signer.Body = nil - signer.sign() - hash := signer.Request.Header.Get("X-Amz-Content-Sha256") - assert.Equal(t, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", hash) -} - -func TestSignBody(t *testing.T) { - signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "hello") - signer.sign() - hash := signer.Request.Header.Get("X-Amz-Content-Sha256") - assert.Equal(t, "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash) -} - -func TestSignSeekedBody(t *testing.T) { - signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, " hello") - signer.Body.Read(make([]byte, 3)) // consume first 3 bytes so body is now "hello" - signer.sign() - hash := signer.Request.Header.Get("X-Amz-Content-Sha256") - assert.Equal(t, "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash) - - start, _ := signer.Body.Seek(0, 1) - assert.Equal(t, int64(3), start) -} - -func TestPresignEmptyBodyS3(t *testing.T) { - signer := buildSigner("s3", "us-east-1", time.Now(), 5*time.Minute, "hello") - signer.sign() - hash := signer.Request.Header.Get("X-Amz-Content-Sha256") - assert.Equal(t, "UNSIGNED-PAYLOAD", hash) -} - -func TestSignPrecomputedBodyChecksum(t *testing.T) { - signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "hello") - signer.Request.Header.Set("X-Amz-Content-Sha256", "PRECOMPUTED") - signer.sign() - hash := signer.Request.Header.Get("X-Amz-Content-Sha256") - assert.Equal(t, "PRECOMPUTED", hash) -} - -func TestAnonymousCredentials(t *testing.T) { - svc := awstesting.NewClient(&aws.Config{Credentials: credentials.AnonymousCredentials}) - r := svc.NewRequest( - &request.Operation{ - Name: "BatchGetItem", - HTTPMethod: "POST", - HTTPPath: "/", - }, - nil, - nil, - ) - Sign(r) - - urlQ := r.HTTPRequest.URL.Query() - assert.Empty(t, urlQ.Get("X-Amz-Signature")) - assert.Empty(t, urlQ.Get("X-Amz-Credential")) - assert.Empty(t, urlQ.Get("X-Amz-SignedHeaders")) - assert.Empty(t, urlQ.Get("X-Amz-Date")) - - hQ := r.HTTPRequest.Header - assert.Empty(t, hQ.Get("Authorization")) - assert.Empty(t, hQ.Get("X-Amz-Date")) -} - -func TestIgnoreResignRequestWithValidCreds(t *testing.T) { - svc := awstesting.NewClient(&aws.Config{ - Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"), - Region: aws.String("us-west-2"), - }) - r := svc.NewRequest( - &request.Operation{ - Name: "BatchGetItem", - HTTPMethod: "POST", - HTTPPath: "/", - }, - nil, - nil, - ) - - Sign(r) - sig := r.HTTPRequest.Header.Get("Authorization") - - Sign(r) - assert.Equal(t, sig, r.HTTPRequest.Header.Get("Authorization")) -} - -func TestIgnorePreResignRequestWithValidCreds(t *testing.T) { - svc := awstesting.NewClient(&aws.Config{ - Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"), - Region: aws.String("us-west-2"), - }) - r := svc.NewRequest( - &request.Operation{ - Name: "BatchGetItem", - HTTPMethod: "POST", - HTTPPath: "/", - }, - nil, - nil, - ) - r.ExpireTime = time.Minute * 10 - - Sign(r) - sig := r.HTTPRequest.Header.Get("X-Amz-Signature") - - Sign(r) - assert.Equal(t, sig, r.HTTPRequest.Header.Get("X-Amz-Signature")) -} - -func TestResignRequestExpiredCreds(t *testing.T) { - creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION") - svc := awstesting.NewClient(&aws.Config{Credentials: creds}) - r := svc.NewRequest( - &request.Operation{ - Name: "BatchGetItem", - HTTPMethod: "POST", - HTTPPath: "/", - }, - nil, - nil, - ) - Sign(r) - querySig := r.HTTPRequest.Header.Get("Authorization") - - creds.Expire() - - Sign(r) - assert.NotEqual(t, querySig, r.HTTPRequest.Header.Get("Authorization")) -} - -func TestPreResignRequestExpiredCreds(t *testing.T) { - provider := &credentials.StaticProvider{Value: credentials.Value{ - AccessKeyID: "AKID", - SecretAccessKey: "SECRET", - SessionToken: "SESSION", - }} - creds := credentials.NewCredentials(provider) - svc := awstesting.NewClient(&aws.Config{Credentials: creds}) - r := svc.NewRequest( - &request.Operation{ - Name: "BatchGetItem", - HTTPMethod: "POST", - HTTPPath: "/", - }, - nil, - nil, - ) - r.ExpireTime = time.Minute * 10 - - Sign(r) - querySig := r.HTTPRequest.URL.Query().Get("X-Amz-Signature") - - creds.Expire() - r.Time = time.Now().Add(time.Hour * 48) - - Sign(r) - assert.NotEqual(t, querySig, r.HTTPRequest.URL.Query().Get("X-Amz-Signature")) -} - -func BenchmarkPresignRequest(b *testing.B) { - signer := buildSigner("dynamodb", "us-east-1", time.Now(), 300*time.Second, "{}") - for i := 0; i < b.N; i++ { - signer.sign() - } -} - -func BenchmarkSignRequest(b *testing.B) { - signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "{}") - for i := 0; i < b.N; i++ { - signer.sign() - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/waiter/waiter_test.go b/vendor/github.com/aws/aws-sdk-go/private/waiter/waiter_test.go deleted file mode 100644 index 28fac2595f..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/waiter/waiter_test.go +++ /dev/null @@ -1,401 +0,0 @@ -package waiter_test - -import ( - "bytes" - "io/ioutil" - "net/http" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/waiter" -) - -type mockClient struct { - *client.Client -} -type MockInput struct{} -type MockOutput struct { - States []*MockState -} -type MockState struct { - State *string -} - -func (c *mockClient) MockRequest(input *MockInput) (*request.Request, *MockOutput) { - op := &request.Operation{ - Name: "Mock", - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &MockInput{} - } - - output := &MockOutput{} - req := c.NewRequest(op, input, output) - req.Data = output - return req, output -} - -func TestWaiterPathAll(t *testing.T) { - svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ - Region: aws.String("mock-region"), - })} - svc.Handlers.Send.Clear() // mock sending - svc.Handlers.Unmarshal.Clear() - svc.Handlers.UnmarshalMeta.Clear() - svc.Handlers.ValidateResponse.Clear() - - reqNum := 0 - resps := []*MockOutput{ - { // Request 1 - States: []*MockState{ - {State: aws.String("pending")}, - {State: aws.String("pending")}, - }, - }, - { // Request 2 - States: []*MockState{ - {State: aws.String("running")}, - {State: aws.String("pending")}, - }, - }, - { // Request 3 - States: []*MockState{ - {State: aws.String("running")}, - {State: aws.String("running")}, - }, - }, - } - - numBuiltReq := 0 - svc.Handlers.Build.PushBack(func(r *request.Request) { - numBuiltReq++ - }) - svc.Handlers.Unmarshal.PushBack(func(r *request.Request) { - if reqNum >= len(resps) { - assert.Fail(t, "too many polling requests made") - return - } - r.Data = resps[reqNum] - reqNum++ - }) - - waiterCfg := waiter.Config{ - Operation: "Mock", - Delay: 0, - MaxAttempts: 10, - Acceptors: []waiter.WaitAcceptor{ - { - State: "success", - Matcher: "pathAll", - Argument: "States[].State", - Expected: "running", - }, - }, - } - w := waiter.Waiter{ - Client: svc, - Input: &MockInput{}, - Config: waiterCfg, - } - - err := w.Wait() - assert.NoError(t, err) - assert.Equal(t, 3, numBuiltReq) - assert.Equal(t, 3, reqNum) -} - -func TestWaiterPath(t *testing.T) { - svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ - Region: aws.String("mock-region"), - })} - svc.Handlers.Send.Clear() // mock sending - svc.Handlers.Unmarshal.Clear() - svc.Handlers.UnmarshalMeta.Clear() - svc.Handlers.ValidateResponse.Clear() - - reqNum := 0 - resps := []*MockOutput{ - { // Request 1 - States: []*MockState{ - {State: aws.String("pending")}, - {State: aws.String("pending")}, - }, - }, - { // Request 2 - States: []*MockState{ - {State: aws.String("running")}, - {State: aws.String("pending")}, - }, - }, - { // Request 3 - States: []*MockState{ - {State: aws.String("running")}, - {State: aws.String("running")}, - }, - }, - } - - numBuiltReq := 0 - svc.Handlers.Build.PushBack(func(r *request.Request) { - numBuiltReq++ - }) - svc.Handlers.Unmarshal.PushBack(func(r *request.Request) { - if reqNum >= len(resps) { - assert.Fail(t, "too many polling requests made") - return - } - r.Data = resps[reqNum] - reqNum++ - }) - - waiterCfg := waiter.Config{ - Operation: "Mock", - Delay: 0, - MaxAttempts: 10, - Acceptors: []waiter.WaitAcceptor{ - { - State: "success", - Matcher: "path", - Argument: "States[].State", - Expected: "running", - }, - }, - } - w := waiter.Waiter{ - Client: svc, - Input: &MockInput{}, - Config: waiterCfg, - } - - err := w.Wait() - assert.NoError(t, err) - assert.Equal(t, 3, numBuiltReq) - assert.Equal(t, 3, reqNum) -} - -func TestWaiterFailure(t *testing.T) { - svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ - Region: aws.String("mock-region"), - })} - svc.Handlers.Send.Clear() // mock sending - svc.Handlers.Unmarshal.Clear() - svc.Handlers.UnmarshalMeta.Clear() - svc.Handlers.ValidateResponse.Clear() - - reqNum := 0 - resps := []*MockOutput{ - { // Request 1 - States: []*MockState{ - {State: aws.String("pending")}, - {State: aws.String("pending")}, - }, - }, - { // Request 2 - States: []*MockState{ - {State: aws.String("running")}, - {State: aws.String("pending")}, - }, - }, - { // Request 3 - States: []*MockState{ - {State: aws.String("running")}, - {State: aws.String("stopping")}, - }, - }, - } - - numBuiltReq := 0 - svc.Handlers.Build.PushBack(func(r *request.Request) { - numBuiltReq++ - }) - svc.Handlers.Unmarshal.PushBack(func(r *request.Request) { - if reqNum >= len(resps) { - assert.Fail(t, "too many polling requests made") - return - } - r.Data = resps[reqNum] - reqNum++ - }) - - waiterCfg := waiter.Config{ - Operation: "Mock", - Delay: 0, - MaxAttempts: 10, - Acceptors: []waiter.WaitAcceptor{ - { - State: "success", - Matcher: "pathAll", - Argument: "States[].State", - Expected: "running", - }, - { - State: "failure", - Matcher: "pathAny", - Argument: "States[].State", - Expected: "stopping", - }, - }, - } - w := waiter.Waiter{ - Client: svc, - Input: &MockInput{}, - Config: waiterCfg, - } - - err := w.Wait().(awserr.Error) - assert.Error(t, err) - assert.Equal(t, "ResourceNotReady", err.Code()) - assert.Equal(t, "failed waiting for successful resource state", err.Message()) - assert.Equal(t, 3, numBuiltReq) - assert.Equal(t, 3, reqNum) -} - -func TestWaiterError(t *testing.T) { - svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ - Region: aws.String("mock-region"), - })} - svc.Handlers.Send.Clear() // mock sending - svc.Handlers.Unmarshal.Clear() - svc.Handlers.UnmarshalMeta.Clear() - svc.Handlers.UnmarshalError.Clear() - svc.Handlers.ValidateResponse.Clear() - - reqNum := 0 - resps := []*MockOutput{ - { // Request 1 - States: []*MockState{ - {State: aws.String("pending")}, - {State: aws.String("pending")}, - }, - }, - { // Request 2, error case - }, - { // Request 3 - States: []*MockState{ - {State: aws.String("running")}, - {State: aws.String("running")}, - }, - }, - } - - numBuiltReq := 0 - svc.Handlers.Build.PushBack(func(r *request.Request) { - numBuiltReq++ - }) - svc.Handlers.Send.PushBack(func(r *request.Request) { - code := 200 - if reqNum == 1 { - code = 400 - } - r.HTTPResponse = &http.Response{ - StatusCode: code, - Status: http.StatusText(code), - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - } - }) - svc.Handlers.Unmarshal.PushBack(func(r *request.Request) { - if reqNum >= len(resps) { - assert.Fail(t, "too many polling requests made") - return - } - r.Data = resps[reqNum] - reqNum++ - }) - svc.Handlers.UnmarshalMeta.PushBack(func(r *request.Request) { - if reqNum == 1 { - r.Error = awserr.New("MockException", "mock exception message", nil) - // If there was an error unmarshal error will be called instead of unmarshal - // need to increment count here also - reqNum++ - } - }) - - waiterCfg := waiter.Config{ - Operation: "Mock", - Delay: 0, - MaxAttempts: 10, - Acceptors: []waiter.WaitAcceptor{ - { - State: "success", - Matcher: "pathAll", - Argument: "States[].State", - Expected: "running", - }, - { - State: "retry", - Matcher: "error", - Argument: "", - Expected: "MockException", - }, - }, - } - w := waiter.Waiter{ - Client: svc, - Input: &MockInput{}, - Config: waiterCfg, - } - - err := w.Wait() - assert.NoError(t, err) - assert.Equal(t, 3, numBuiltReq) - assert.Equal(t, 3, reqNum) -} - -func TestWaiterStatus(t *testing.T) { - svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ - Region: aws.String("mock-region"), - })} - svc.Handlers.Send.Clear() // mock sending - svc.Handlers.Unmarshal.Clear() - svc.Handlers.UnmarshalMeta.Clear() - svc.Handlers.ValidateResponse.Clear() - - reqNum := 0 - svc.Handlers.Build.PushBack(func(r *request.Request) { - reqNum++ - }) - svc.Handlers.Send.PushBack(func(r *request.Request) { - code := 200 - if reqNum == 3 { - code = 404 - r.Error = awserr.New("NotFound", "Not Found", nil) - } - r.HTTPResponse = &http.Response{ - StatusCode: code, - Status: http.StatusText(code), - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - } - }) - - waiterCfg := waiter.Config{ - Operation: "Mock", - Delay: 0, - MaxAttempts: 10, - Acceptors: []waiter.WaitAcceptor{ - { - State: "success", - Matcher: "status", - Argument: "", - Expected: 404, - }, - }, - } - w := waiter.Waiter{ - Client: svc, - Input: &MockInput{}, - Config: waiterCfg, - } - - err := w.Wait() - assert.NoError(t, err) - assert.Equal(t, 3, reqNum) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/autoscaling/examples_test.go deleted file mode 100644 index 8a9cb6e428..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/examples_test.go +++ /dev/null @@ -1,1207 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package autoscaling_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/autoscaling" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleAutoScaling_AttachInstances() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.AttachInstancesInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - InstanceIds: []*string{ - aws.String("XmlStringMaxLen19"), // Required - // More values... - }, - } - resp, err := svc.AttachInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_AttachLoadBalancers() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.AttachLoadBalancersInput{ - AutoScalingGroupName: aws.String("ResourceName"), - LoadBalancerNames: []*string{ - aws.String("XmlStringMaxLen255"), // Required - // More values... - }, - } - resp, err := svc.AttachLoadBalancers(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_CompleteLifecycleAction() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.CompleteLifecycleActionInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - LifecycleActionResult: aws.String("LifecycleActionResult"), // Required - LifecycleActionToken: aws.String("LifecycleActionToken"), // Required - LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required - } - resp, err := svc.CompleteLifecycleAction(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_CreateAutoScalingGroup() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.CreateAutoScalingGroupInput{ - AutoScalingGroupName: aws.String("XmlStringMaxLen255"), // Required - MaxSize: aws.Int64(1), // Required - MinSize: aws.Int64(1), // Required - AvailabilityZones: []*string{ - aws.String("XmlStringMaxLen255"), // Required - // More values... - }, - DefaultCooldown: aws.Int64(1), - DesiredCapacity: aws.Int64(1), - HealthCheckGracePeriod: aws.Int64(1), - HealthCheckType: aws.String("XmlStringMaxLen32"), - InstanceId: aws.String("XmlStringMaxLen19"), - LaunchConfigurationName: aws.String("ResourceName"), - LoadBalancerNames: []*string{ - aws.String("XmlStringMaxLen255"), // Required - // More values... - }, - NewInstancesProtectedFromScaleIn: aws.Bool(true), - PlacementGroup: aws.String("XmlStringMaxLen255"), - Tags: []*autoscaling.Tag{ - { // Required - Key: aws.String("TagKey"), // Required - PropagateAtLaunch: aws.Bool(true), - ResourceId: aws.String("XmlString"), - ResourceType: aws.String("XmlString"), - Value: aws.String("TagValue"), - }, - // More values... - }, - TerminationPolicies: []*string{ - aws.String("XmlStringMaxLen1600"), // Required - // More values... - }, - VPCZoneIdentifier: aws.String("XmlStringMaxLen255"), - } - resp, err := svc.CreateAutoScalingGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_CreateLaunchConfiguration() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.CreateLaunchConfigurationInput{ - LaunchConfigurationName: aws.String("XmlStringMaxLen255"), // Required - AssociatePublicIpAddress: aws.Bool(true), - BlockDeviceMappings: []*autoscaling.BlockDeviceMapping{ - { // Required - DeviceName: aws.String("XmlStringMaxLen255"), // Required - Ebs: &autoscaling.Ebs{ - DeleteOnTermination: aws.Bool(true), - Encrypted: aws.Bool(true), - Iops: aws.Int64(1), - SnapshotId: aws.String("XmlStringMaxLen255"), - VolumeSize: aws.Int64(1), - VolumeType: aws.String("BlockDeviceEbsVolumeType"), - }, - NoDevice: aws.Bool(true), - VirtualName: aws.String("XmlStringMaxLen255"), - }, - // More values... - }, - ClassicLinkVPCId: aws.String("XmlStringMaxLen255"), - ClassicLinkVPCSecurityGroups: []*string{ - aws.String("XmlStringMaxLen255"), // Required - // More values... - }, - EbsOptimized: aws.Bool(true), - IamInstanceProfile: aws.String("XmlStringMaxLen1600"), - ImageId: aws.String("XmlStringMaxLen255"), - InstanceId: aws.String("XmlStringMaxLen19"), - InstanceMonitoring: &autoscaling.InstanceMonitoring{ - Enabled: aws.Bool(true), - }, - InstanceType: aws.String("XmlStringMaxLen255"), - KernelId: aws.String("XmlStringMaxLen255"), - KeyName: aws.String("XmlStringMaxLen255"), - PlacementTenancy: aws.String("XmlStringMaxLen64"), - RamdiskId: aws.String("XmlStringMaxLen255"), - SecurityGroups: []*string{ - aws.String("XmlString"), // Required - // More values... - }, - SpotPrice: aws.String("SpotPrice"), - UserData: aws.String("XmlStringUserData"), - } - resp, err := svc.CreateLaunchConfiguration(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_CreateOrUpdateTags() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.CreateOrUpdateTagsInput{ - Tags: []*autoscaling.Tag{ // Required - { // Required - Key: aws.String("TagKey"), // Required - PropagateAtLaunch: aws.Bool(true), - ResourceId: aws.String("XmlString"), - ResourceType: aws.String("XmlString"), - Value: aws.String("TagValue"), - }, - // More values... - }, - } - resp, err := svc.CreateOrUpdateTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DeleteAutoScalingGroup() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DeleteAutoScalingGroupInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - ForceDelete: aws.Bool(true), - } - resp, err := svc.DeleteAutoScalingGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DeleteLaunchConfiguration() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DeleteLaunchConfigurationInput{ - LaunchConfigurationName: aws.String("ResourceName"), // Required - } - resp, err := svc.DeleteLaunchConfiguration(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DeleteLifecycleHook() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DeleteLifecycleHookInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required - } - resp, err := svc.DeleteLifecycleHook(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DeleteNotificationConfiguration() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DeleteNotificationConfigurationInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - TopicARN: aws.String("ResourceName"), // Required - } - resp, err := svc.DeleteNotificationConfiguration(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DeletePolicy() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DeletePolicyInput{ - PolicyName: aws.String("ResourceName"), // Required - AutoScalingGroupName: aws.String("ResourceName"), - } - resp, err := svc.DeletePolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DeleteScheduledAction() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DeleteScheduledActionInput{ - ScheduledActionName: aws.String("ResourceName"), // Required - AutoScalingGroupName: aws.String("ResourceName"), - } - resp, err := svc.DeleteScheduledAction(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DeleteTags() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DeleteTagsInput{ - Tags: []*autoscaling.Tag{ // Required - { // Required - Key: aws.String("TagKey"), // Required - PropagateAtLaunch: aws.Bool(true), - ResourceId: aws.String("XmlString"), - ResourceType: aws.String("XmlString"), - Value: aws.String("TagValue"), - }, - // More values... - }, - } - resp, err := svc.DeleteTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribeAccountLimits() { - svc := autoscaling.New(session.New()) - - var params *autoscaling.DescribeAccountLimitsInput - resp, err := svc.DescribeAccountLimits(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribeAdjustmentTypes() { - svc := autoscaling.New(session.New()) - - var params *autoscaling.DescribeAdjustmentTypesInput - resp, err := svc.DescribeAdjustmentTypes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribeAutoScalingGroups() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DescribeAutoScalingGroupsInput{ - AutoScalingGroupNames: []*string{ - aws.String("ResourceName"), // Required - // More values... - }, - MaxRecords: aws.Int64(1), - NextToken: aws.String("XmlString"), - } - resp, err := svc.DescribeAutoScalingGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribeAutoScalingInstances() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DescribeAutoScalingInstancesInput{ - InstanceIds: []*string{ - aws.String("XmlStringMaxLen19"), // Required - // More values... - }, - MaxRecords: aws.Int64(1), - NextToken: aws.String("XmlString"), - } - resp, err := svc.DescribeAutoScalingInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribeAutoScalingNotificationTypes() { - svc := autoscaling.New(session.New()) - - var params *autoscaling.DescribeAutoScalingNotificationTypesInput - resp, err := svc.DescribeAutoScalingNotificationTypes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribeLaunchConfigurations() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DescribeLaunchConfigurationsInput{ - LaunchConfigurationNames: []*string{ - aws.String("ResourceName"), // Required - // More values... - }, - MaxRecords: aws.Int64(1), - NextToken: aws.String("XmlString"), - } - resp, err := svc.DescribeLaunchConfigurations(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribeLifecycleHookTypes() { - svc := autoscaling.New(session.New()) - - var params *autoscaling.DescribeLifecycleHookTypesInput - resp, err := svc.DescribeLifecycleHookTypes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribeLifecycleHooks() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DescribeLifecycleHooksInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - LifecycleHookNames: []*string{ - aws.String("AsciiStringMaxLen255"), // Required - // More values... - }, - } - resp, err := svc.DescribeLifecycleHooks(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribeLoadBalancers() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DescribeLoadBalancersInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - MaxRecords: aws.Int64(1), - NextToken: aws.String("XmlString"), - } - resp, err := svc.DescribeLoadBalancers(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribeMetricCollectionTypes() { - svc := autoscaling.New(session.New()) - - var params *autoscaling.DescribeMetricCollectionTypesInput - resp, err := svc.DescribeMetricCollectionTypes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribeNotificationConfigurations() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DescribeNotificationConfigurationsInput{ - AutoScalingGroupNames: []*string{ - aws.String("ResourceName"), // Required - // More values... - }, - MaxRecords: aws.Int64(1), - NextToken: aws.String("XmlString"), - } - resp, err := svc.DescribeNotificationConfigurations(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribePolicies() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DescribePoliciesInput{ - AutoScalingGroupName: aws.String("ResourceName"), - MaxRecords: aws.Int64(1), - NextToken: aws.String("XmlString"), - PolicyNames: []*string{ - aws.String("ResourceName"), // Required - // More values... - }, - PolicyTypes: []*string{ - aws.String("XmlStringMaxLen64"), // Required - // More values... - }, - } - resp, err := svc.DescribePolicies(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribeScalingActivities() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DescribeScalingActivitiesInput{ - ActivityIds: []*string{ - aws.String("XmlString"), // Required - // More values... - }, - AutoScalingGroupName: aws.String("ResourceName"), - MaxRecords: aws.Int64(1), - NextToken: aws.String("XmlString"), - } - resp, err := svc.DescribeScalingActivities(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribeScalingProcessTypes() { - svc := autoscaling.New(session.New()) - - var params *autoscaling.DescribeScalingProcessTypesInput - resp, err := svc.DescribeScalingProcessTypes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribeScheduledActions() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DescribeScheduledActionsInput{ - AutoScalingGroupName: aws.String("ResourceName"), - EndTime: aws.Time(time.Now()), - MaxRecords: aws.Int64(1), - NextToken: aws.String("XmlString"), - ScheduledActionNames: []*string{ - aws.String("ResourceName"), // Required - // More values... - }, - StartTime: aws.Time(time.Now()), - } - resp, err := svc.DescribeScheduledActions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribeTags() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DescribeTagsInput{ - Filters: []*autoscaling.Filter{ - { // Required - Name: aws.String("XmlString"), - Values: []*string{ - aws.String("XmlString"), // Required - // More values... - }, - }, - // More values... - }, - MaxRecords: aws.Int64(1), - NextToken: aws.String("XmlString"), - } - resp, err := svc.DescribeTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DescribeTerminationPolicyTypes() { - svc := autoscaling.New(session.New()) - - var params *autoscaling.DescribeTerminationPolicyTypesInput - resp, err := svc.DescribeTerminationPolicyTypes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DetachInstances() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DetachInstancesInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - ShouldDecrementDesiredCapacity: aws.Bool(true), // Required - InstanceIds: []*string{ - aws.String("XmlStringMaxLen19"), // Required - // More values... - }, - } - resp, err := svc.DetachInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DetachLoadBalancers() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DetachLoadBalancersInput{ - AutoScalingGroupName: aws.String("ResourceName"), - LoadBalancerNames: []*string{ - aws.String("XmlStringMaxLen255"), // Required - // More values... - }, - } - resp, err := svc.DetachLoadBalancers(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_DisableMetricsCollection() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.DisableMetricsCollectionInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - Metrics: []*string{ - aws.String("XmlStringMaxLen255"), // Required - // More values... - }, - } - resp, err := svc.DisableMetricsCollection(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_EnableMetricsCollection() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.EnableMetricsCollectionInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - Granularity: aws.String("XmlStringMaxLen255"), // Required - Metrics: []*string{ - aws.String("XmlStringMaxLen255"), // Required - // More values... - }, - } - resp, err := svc.EnableMetricsCollection(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_EnterStandby() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.EnterStandbyInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - ShouldDecrementDesiredCapacity: aws.Bool(true), // Required - InstanceIds: []*string{ - aws.String("XmlStringMaxLen19"), // Required - // More values... - }, - } - resp, err := svc.EnterStandby(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_ExecutePolicy() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.ExecutePolicyInput{ - PolicyName: aws.String("ResourceName"), // Required - AutoScalingGroupName: aws.String("ResourceName"), - BreachThreshold: aws.Float64(1.0), - HonorCooldown: aws.Bool(true), - MetricValue: aws.Float64(1.0), - } - resp, err := svc.ExecutePolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_ExitStandby() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.ExitStandbyInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - InstanceIds: []*string{ - aws.String("XmlStringMaxLen19"), // Required - // More values... - }, - } - resp, err := svc.ExitStandby(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_PutLifecycleHook() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.PutLifecycleHookInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required - DefaultResult: aws.String("LifecycleActionResult"), - HeartbeatTimeout: aws.Int64(1), - LifecycleTransition: aws.String("LifecycleTransition"), - NotificationMetadata: aws.String("XmlStringMaxLen1023"), - NotificationTargetARN: aws.String("ResourceName"), - RoleARN: aws.String("ResourceName"), - } - resp, err := svc.PutLifecycleHook(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_PutNotificationConfiguration() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.PutNotificationConfigurationInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - NotificationTypes: []*string{ // Required - aws.String("XmlStringMaxLen255"), // Required - // More values... - }, - TopicARN: aws.String("ResourceName"), // Required - } - resp, err := svc.PutNotificationConfiguration(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_PutScalingPolicy() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.PutScalingPolicyInput{ - AdjustmentType: aws.String("XmlStringMaxLen255"), // Required - AutoScalingGroupName: aws.String("ResourceName"), // Required - PolicyName: aws.String("XmlStringMaxLen255"), // Required - Cooldown: aws.Int64(1), - EstimatedInstanceWarmup: aws.Int64(1), - MetricAggregationType: aws.String("XmlStringMaxLen32"), - MinAdjustmentMagnitude: aws.Int64(1), - MinAdjustmentStep: aws.Int64(1), - PolicyType: aws.String("XmlStringMaxLen64"), - ScalingAdjustment: aws.Int64(1), - StepAdjustments: []*autoscaling.StepAdjustment{ - { // Required - ScalingAdjustment: aws.Int64(1), // Required - MetricIntervalLowerBound: aws.Float64(1.0), - MetricIntervalUpperBound: aws.Float64(1.0), - }, - // More values... - }, - } - resp, err := svc.PutScalingPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_PutScheduledUpdateGroupAction() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.PutScheduledUpdateGroupActionInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - ScheduledActionName: aws.String("XmlStringMaxLen255"), // Required - DesiredCapacity: aws.Int64(1), - EndTime: aws.Time(time.Now()), - MaxSize: aws.Int64(1), - MinSize: aws.Int64(1), - Recurrence: aws.String("XmlStringMaxLen255"), - StartTime: aws.Time(time.Now()), - Time: aws.Time(time.Now()), - } - resp, err := svc.PutScheduledUpdateGroupAction(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_RecordLifecycleActionHeartbeat() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.RecordLifecycleActionHeartbeatInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - LifecycleActionToken: aws.String("LifecycleActionToken"), // Required - LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required - } - resp, err := svc.RecordLifecycleActionHeartbeat(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_ResumeProcesses() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.ScalingProcessQuery{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - ScalingProcesses: []*string{ - aws.String("XmlStringMaxLen255"), // Required - // More values... - }, - } - resp, err := svc.ResumeProcesses(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_SetDesiredCapacity() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.SetDesiredCapacityInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - DesiredCapacity: aws.Int64(1), // Required - HonorCooldown: aws.Bool(true), - } - resp, err := svc.SetDesiredCapacity(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_SetInstanceHealth() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.SetInstanceHealthInput{ - HealthStatus: aws.String("XmlStringMaxLen32"), // Required - InstanceId: aws.String("XmlStringMaxLen19"), // Required - ShouldRespectGracePeriod: aws.Bool(true), - } - resp, err := svc.SetInstanceHealth(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_SetInstanceProtection() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.SetInstanceProtectionInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - InstanceIds: []*string{ // Required - aws.String("XmlStringMaxLen19"), // Required - // More values... - }, - ProtectedFromScaleIn: aws.Bool(true), // Required - } - resp, err := svc.SetInstanceProtection(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_SuspendProcesses() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.ScalingProcessQuery{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - ScalingProcesses: []*string{ - aws.String("XmlStringMaxLen255"), // Required - // More values... - }, - } - resp, err := svc.SuspendProcesses(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_TerminateInstanceInAutoScalingGroup() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.TerminateInstanceInAutoScalingGroupInput{ - InstanceId: aws.String("XmlStringMaxLen19"), // Required - ShouldDecrementDesiredCapacity: aws.Bool(true), // Required - } - resp, err := svc.TerminateInstanceInAutoScalingGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleAutoScaling_UpdateAutoScalingGroup() { - svc := autoscaling.New(session.New()) - - params := &autoscaling.UpdateAutoScalingGroupInput{ - AutoScalingGroupName: aws.String("ResourceName"), // Required - AvailabilityZones: []*string{ - aws.String("XmlStringMaxLen255"), // Required - // More values... - }, - DefaultCooldown: aws.Int64(1), - DesiredCapacity: aws.Int64(1), - HealthCheckGracePeriod: aws.Int64(1), - HealthCheckType: aws.String("XmlStringMaxLen32"), - LaunchConfigurationName: aws.String("ResourceName"), - MaxSize: aws.Int64(1), - MinSize: aws.Int64(1), - NewInstancesProtectedFromScaleIn: aws.Bool(true), - PlacementGroup: aws.String("XmlStringMaxLen255"), - TerminationPolicies: []*string{ - aws.String("XmlStringMaxLen1600"), // Required - // More values... - }, - VPCZoneIdentifier: aws.String("XmlStringMaxLen255"), - } - resp, err := svc.UpdateAutoScalingGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudformation/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/cloudformation/examples_test.go deleted file mode 100644 index d2c86d93a7..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudformation/examples_test.go +++ /dev/null @@ -1,465 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package cloudformation_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/cloudformation" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleCloudFormation_CancelUpdateStack() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.CancelUpdateStackInput{ - StackName: aws.String("StackName"), // Required - } - resp, err := svc.CancelUpdateStack(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_ContinueUpdateRollback() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.ContinueUpdateRollbackInput{ - StackName: aws.String("StackNameOrId"), // Required - } - resp, err := svc.ContinueUpdateRollback(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_CreateStack() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.CreateStackInput{ - StackName: aws.String("StackName"), // Required - Capabilities: []*string{ - aws.String("Capability"), // Required - // More values... - }, - DisableRollback: aws.Bool(true), - NotificationARNs: []*string{ - aws.String("NotificationARN"), // Required - // More values... - }, - OnFailure: aws.String("OnFailure"), - Parameters: []*cloudformation.Parameter{ - { // Required - ParameterKey: aws.String("ParameterKey"), - ParameterValue: aws.String("ParameterValue"), - UsePreviousValue: aws.Bool(true), - }, - // More values... - }, - ResourceTypes: []*string{ - aws.String("ResourceType"), // Required - // More values... - }, - StackPolicyBody: aws.String("StackPolicyBody"), - StackPolicyURL: aws.String("StackPolicyURL"), - Tags: []*cloudformation.Tag{ - { // Required - Key: aws.String("TagKey"), - Value: aws.String("TagValue"), - }, - // More values... - }, - TemplateBody: aws.String("TemplateBody"), - TemplateURL: aws.String("TemplateURL"), - TimeoutInMinutes: aws.Int64(1), - } - resp, err := svc.CreateStack(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_DeleteStack() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.DeleteStackInput{ - StackName: aws.String("StackName"), // Required - } - resp, err := svc.DeleteStack(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_DescribeAccountLimits() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.DescribeAccountLimitsInput{ - NextToken: aws.String("NextToken"), - } - resp, err := svc.DescribeAccountLimits(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_DescribeStackEvents() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.DescribeStackEventsInput{ - NextToken: aws.String("NextToken"), - StackName: aws.String("StackName"), - } - resp, err := svc.DescribeStackEvents(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_DescribeStackResource() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.DescribeStackResourceInput{ - LogicalResourceId: aws.String("LogicalResourceId"), // Required - StackName: aws.String("StackName"), // Required - } - resp, err := svc.DescribeStackResource(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_DescribeStackResources() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.DescribeStackResourcesInput{ - LogicalResourceId: aws.String("LogicalResourceId"), - PhysicalResourceId: aws.String("PhysicalResourceId"), - StackName: aws.String("StackName"), - } - resp, err := svc.DescribeStackResources(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_DescribeStacks() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.DescribeStacksInput{ - NextToken: aws.String("NextToken"), - StackName: aws.String("StackName"), - } - resp, err := svc.DescribeStacks(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_EstimateTemplateCost() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.EstimateTemplateCostInput{ - Parameters: []*cloudformation.Parameter{ - { // Required - ParameterKey: aws.String("ParameterKey"), - ParameterValue: aws.String("ParameterValue"), - UsePreviousValue: aws.Bool(true), - }, - // More values... - }, - TemplateBody: aws.String("TemplateBody"), - TemplateURL: aws.String("TemplateURL"), - } - resp, err := svc.EstimateTemplateCost(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_GetStackPolicy() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.GetStackPolicyInput{ - StackName: aws.String("StackName"), // Required - } - resp, err := svc.GetStackPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_GetTemplate() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.GetTemplateInput{ - StackName: aws.String("StackName"), // Required - } - resp, err := svc.GetTemplate(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_GetTemplateSummary() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.GetTemplateSummaryInput{ - StackName: aws.String("StackNameOrId"), - TemplateBody: aws.String("TemplateBody"), - TemplateURL: aws.String("TemplateURL"), - } - resp, err := svc.GetTemplateSummary(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_ListStackResources() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.ListStackResourcesInput{ - StackName: aws.String("StackName"), // Required - NextToken: aws.String("NextToken"), - } - resp, err := svc.ListStackResources(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_ListStacks() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.ListStacksInput{ - NextToken: aws.String("NextToken"), - StackStatusFilter: []*string{ - aws.String("StackStatus"), // Required - // More values... - }, - } - resp, err := svc.ListStacks(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_SetStackPolicy() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.SetStackPolicyInput{ - StackName: aws.String("StackName"), // Required - StackPolicyBody: aws.String("StackPolicyBody"), - StackPolicyURL: aws.String("StackPolicyURL"), - } - resp, err := svc.SetStackPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_SignalResource() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.SignalResourceInput{ - LogicalResourceId: aws.String("LogicalResourceId"), // Required - StackName: aws.String("StackNameOrId"), // Required - Status: aws.String("ResourceSignalStatus"), // Required - UniqueId: aws.String("ResourceSignalUniqueId"), // Required - } - resp, err := svc.SignalResource(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_UpdateStack() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.UpdateStackInput{ - StackName: aws.String("StackName"), // Required - Capabilities: []*string{ - aws.String("Capability"), // Required - // More values... - }, - NotificationARNs: []*string{ - aws.String("NotificationARN"), // Required - // More values... - }, - Parameters: []*cloudformation.Parameter{ - { // Required - ParameterKey: aws.String("ParameterKey"), - ParameterValue: aws.String("ParameterValue"), - UsePreviousValue: aws.Bool(true), - }, - // More values... - }, - ResourceTypes: []*string{ - aws.String("ResourceType"), // Required - // More values... - }, - StackPolicyBody: aws.String("StackPolicyBody"), - StackPolicyDuringUpdateBody: aws.String("StackPolicyDuringUpdateBody"), - StackPolicyDuringUpdateURL: aws.String("StackPolicyDuringUpdateURL"), - StackPolicyURL: aws.String("StackPolicyURL"), - TemplateBody: aws.String("TemplateBody"), - TemplateURL: aws.String("TemplateURL"), - UsePreviousTemplate: aws.Bool(true), - } - resp, err := svc.UpdateStack(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudFormation_ValidateTemplate() { - svc := cloudformation.New(session.New()) - - params := &cloudformation.ValidateTemplateInput{ - TemplateBody: aws.String("TemplateBody"), - TemplateURL: aws.String("TemplateURL"), - } - resp, err := svc.ValidateTemplate(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudtrail/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/cloudtrail/examples_test.go deleted file mode 100644 index 2a78c44e70..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudtrail/examples_test.go +++ /dev/null @@ -1,296 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package cloudtrail_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/cloudtrail" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleCloudTrail_AddTags() { - svc := cloudtrail.New(session.New()) - - params := &cloudtrail.AddTagsInput{ - ResourceId: aws.String("String"), // Required - TagsList: []*cloudtrail.Tag{ - { // Required - Key: aws.String("String"), // Required - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.AddTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudTrail_CreateTrail() { - svc := cloudtrail.New(session.New()) - - params := &cloudtrail.CreateTrailInput{ - Name: aws.String("String"), // Required - S3BucketName: aws.String("String"), // Required - CloudWatchLogsLogGroupArn: aws.String("String"), - CloudWatchLogsRoleArn: aws.String("String"), - EnableLogFileValidation: aws.Bool(true), - IncludeGlobalServiceEvents: aws.Bool(true), - IsMultiRegionTrail: aws.Bool(true), - KmsKeyId: aws.String("String"), - S3KeyPrefix: aws.String("String"), - SnsTopicName: aws.String("String"), - } - resp, err := svc.CreateTrail(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudTrail_DeleteTrail() { - svc := cloudtrail.New(session.New()) - - params := &cloudtrail.DeleteTrailInput{ - Name: aws.String("String"), // Required - } - resp, err := svc.DeleteTrail(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudTrail_DescribeTrails() { - svc := cloudtrail.New(session.New()) - - params := &cloudtrail.DescribeTrailsInput{ - IncludeShadowTrails: aws.Bool(true), - TrailNameList: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeTrails(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudTrail_GetTrailStatus() { - svc := cloudtrail.New(session.New()) - - params := &cloudtrail.GetTrailStatusInput{ - Name: aws.String("String"), // Required - } - resp, err := svc.GetTrailStatus(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudTrail_ListPublicKeys() { - svc := cloudtrail.New(session.New()) - - params := &cloudtrail.ListPublicKeysInput{ - EndTime: aws.Time(time.Now()), - NextToken: aws.String("String"), - StartTime: aws.Time(time.Now()), - } - resp, err := svc.ListPublicKeys(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudTrail_ListTags() { - svc := cloudtrail.New(session.New()) - - params := &cloudtrail.ListTagsInput{ - ResourceIdList: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - NextToken: aws.String("String"), - } - resp, err := svc.ListTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudTrail_LookupEvents() { - svc := cloudtrail.New(session.New()) - - params := &cloudtrail.LookupEventsInput{ - EndTime: aws.Time(time.Now()), - LookupAttributes: []*cloudtrail.LookupAttribute{ - { // Required - AttributeKey: aws.String("LookupAttributeKey"), // Required - AttributeValue: aws.String("String"), // Required - }, - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("NextToken"), - StartTime: aws.Time(time.Now()), - } - resp, err := svc.LookupEvents(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudTrail_RemoveTags() { - svc := cloudtrail.New(session.New()) - - params := &cloudtrail.RemoveTagsInput{ - ResourceId: aws.String("String"), // Required - TagsList: []*cloudtrail.Tag{ - { // Required - Key: aws.String("String"), // Required - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.RemoveTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudTrail_StartLogging() { - svc := cloudtrail.New(session.New()) - - params := &cloudtrail.StartLoggingInput{ - Name: aws.String("String"), // Required - } - resp, err := svc.StartLogging(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudTrail_StopLogging() { - svc := cloudtrail.New(session.New()) - - params := &cloudtrail.StopLoggingInput{ - Name: aws.String("String"), // Required - } - resp, err := svc.StopLogging(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudTrail_UpdateTrail() { - svc := cloudtrail.New(session.New()) - - params := &cloudtrail.UpdateTrailInput{ - Name: aws.String("String"), // Required - CloudWatchLogsLogGroupArn: aws.String("String"), - CloudWatchLogsRoleArn: aws.String("String"), - EnableLogFileValidation: aws.Bool(true), - IncludeGlobalServiceEvents: aws.Bool(true), - IsMultiRegionTrail: aws.Bool(true), - KmsKeyId: aws.String("String"), - S3BucketName: aws.String("String"), - S3KeyPrefix: aws.String("String"), - SnsTopicName: aws.String("String"), - } - resp, err := svc.UpdateTrail(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/examples_test.go deleted file mode 100644 index 07b010852b..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/examples_test.go +++ /dev/null @@ -1,337 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package cloudwatch_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/cloudwatch" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleCloudWatch_DeleteAlarms() { - svc := cloudwatch.New(session.New()) - - params := &cloudwatch.DeleteAlarmsInput{ - AlarmNames: []*string{ // Required - aws.String("AlarmName"), // Required - // More values... - }, - } - resp, err := svc.DeleteAlarms(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatch_DescribeAlarmHistory() { - svc := cloudwatch.New(session.New()) - - params := &cloudwatch.DescribeAlarmHistoryInput{ - AlarmName: aws.String("AlarmName"), - EndDate: aws.Time(time.Now()), - HistoryItemType: aws.String("HistoryItemType"), - MaxRecords: aws.Int64(1), - NextToken: aws.String("NextToken"), - StartDate: aws.Time(time.Now()), - } - resp, err := svc.DescribeAlarmHistory(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatch_DescribeAlarms() { - svc := cloudwatch.New(session.New()) - - params := &cloudwatch.DescribeAlarmsInput{ - ActionPrefix: aws.String("ActionPrefix"), - AlarmNamePrefix: aws.String("AlarmNamePrefix"), - AlarmNames: []*string{ - aws.String("AlarmName"), // Required - // More values... - }, - MaxRecords: aws.Int64(1), - NextToken: aws.String("NextToken"), - StateValue: aws.String("StateValue"), - } - resp, err := svc.DescribeAlarms(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatch_DescribeAlarmsForMetric() { - svc := cloudwatch.New(session.New()) - - params := &cloudwatch.DescribeAlarmsForMetricInput{ - MetricName: aws.String("MetricName"), // Required - Namespace: aws.String("Namespace"), // Required - Dimensions: []*cloudwatch.Dimension{ - { // Required - Name: aws.String("DimensionName"), // Required - Value: aws.String("DimensionValue"), // Required - }, - // More values... - }, - Period: aws.Int64(1), - Statistic: aws.String("Statistic"), - Unit: aws.String("StandardUnit"), - } - resp, err := svc.DescribeAlarmsForMetric(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatch_DisableAlarmActions() { - svc := cloudwatch.New(session.New()) - - params := &cloudwatch.DisableAlarmActionsInput{ - AlarmNames: []*string{ // Required - aws.String("AlarmName"), // Required - // More values... - }, - } - resp, err := svc.DisableAlarmActions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatch_EnableAlarmActions() { - svc := cloudwatch.New(session.New()) - - params := &cloudwatch.EnableAlarmActionsInput{ - AlarmNames: []*string{ // Required - aws.String("AlarmName"), // Required - // More values... - }, - } - resp, err := svc.EnableAlarmActions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatch_GetMetricStatistics() { - svc := cloudwatch.New(session.New()) - - params := &cloudwatch.GetMetricStatisticsInput{ - EndTime: aws.Time(time.Now()), // Required - MetricName: aws.String("MetricName"), // Required - Namespace: aws.String("Namespace"), // Required - Period: aws.Int64(1), // Required - StartTime: aws.Time(time.Now()), // Required - Statistics: []*string{ // Required - aws.String("Statistic"), // Required - // More values... - }, - Dimensions: []*cloudwatch.Dimension{ - { // Required - Name: aws.String("DimensionName"), // Required - Value: aws.String("DimensionValue"), // Required - }, - // More values... - }, - Unit: aws.String("StandardUnit"), - } - resp, err := svc.GetMetricStatistics(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatch_ListMetrics() { - svc := cloudwatch.New(session.New()) - - params := &cloudwatch.ListMetricsInput{ - Dimensions: []*cloudwatch.DimensionFilter{ - { // Required - Name: aws.String("DimensionName"), // Required - Value: aws.String("DimensionValue"), - }, - // More values... - }, - MetricName: aws.String("MetricName"), - Namespace: aws.String("Namespace"), - NextToken: aws.String("NextToken"), - } - resp, err := svc.ListMetrics(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatch_PutMetricAlarm() { - svc := cloudwatch.New(session.New()) - - params := &cloudwatch.PutMetricAlarmInput{ - AlarmName: aws.String("AlarmName"), // Required - ComparisonOperator: aws.String("ComparisonOperator"), // Required - EvaluationPeriods: aws.Int64(1), // Required - MetricName: aws.String("MetricName"), // Required - Namespace: aws.String("Namespace"), // Required - Period: aws.Int64(1), // Required - Statistic: aws.String("Statistic"), // Required - Threshold: aws.Float64(1.0), // Required - ActionsEnabled: aws.Bool(true), - AlarmActions: []*string{ - aws.String("ResourceName"), // Required - // More values... - }, - AlarmDescription: aws.String("AlarmDescription"), - Dimensions: []*cloudwatch.Dimension{ - { // Required - Name: aws.String("DimensionName"), // Required - Value: aws.String("DimensionValue"), // Required - }, - // More values... - }, - InsufficientDataActions: []*string{ - aws.String("ResourceName"), // Required - // More values... - }, - OKActions: []*string{ - aws.String("ResourceName"), // Required - // More values... - }, - Unit: aws.String("StandardUnit"), - } - resp, err := svc.PutMetricAlarm(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatch_PutMetricData() { - svc := cloudwatch.New(session.New()) - - params := &cloudwatch.PutMetricDataInput{ - MetricData: []*cloudwatch.MetricDatum{ // Required - { // Required - MetricName: aws.String("MetricName"), // Required - Dimensions: []*cloudwatch.Dimension{ - { // Required - Name: aws.String("DimensionName"), // Required - Value: aws.String("DimensionValue"), // Required - }, - // More values... - }, - StatisticValues: &cloudwatch.StatisticSet{ - Maximum: aws.Float64(1.0), // Required - Minimum: aws.Float64(1.0), // Required - SampleCount: aws.Float64(1.0), // Required - Sum: aws.Float64(1.0), // Required - }, - Timestamp: aws.Time(time.Now()), - Unit: aws.String("StandardUnit"), - Value: aws.Float64(1.0), - }, - // More values... - }, - Namespace: aws.String("Namespace"), // Required - } - resp, err := svc.PutMetricData(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatch_SetAlarmState() { - svc := cloudwatch.New(session.New()) - - params := &cloudwatch.SetAlarmStateInput{ - AlarmName: aws.String("AlarmName"), // Required - StateReason: aws.String("StateReason"), // Required - StateValue: aws.String("StateValue"), // Required - StateReasonData: aws.String("StateReasonData"), - } - resp, err := svc.SetAlarmState(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/examples_test.go deleted file mode 100644 index 13c56fc888..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/examples_test.go +++ /dev/null @@ -1,566 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package cloudwatchlogs_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/cloudwatchlogs" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleCloudWatchLogs_CancelExportTask() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.CancelExportTaskInput{ - TaskId: aws.String("ExportTaskId"), // Required - } - resp, err := svc.CancelExportTask(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_CreateExportTask() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.CreateExportTaskInput{ - Destination: aws.String("ExportDestinationBucket"), // Required - From: aws.Int64(1), // Required - LogGroupName: aws.String("LogGroupName"), // Required - To: aws.Int64(1), // Required - DestinationPrefix: aws.String("ExportDestinationPrefix"), - LogStreamNamePrefix: aws.String("LogStreamName"), - TaskName: aws.String("ExportTaskName"), - } - resp, err := svc.CreateExportTask(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_CreateLogGroup() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.CreateLogGroupInput{ - LogGroupName: aws.String("LogGroupName"), // Required - } - resp, err := svc.CreateLogGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_CreateLogStream() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.CreateLogStreamInput{ - LogGroupName: aws.String("LogGroupName"), // Required - LogStreamName: aws.String("LogStreamName"), // Required - } - resp, err := svc.CreateLogStream(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_DeleteDestination() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.DeleteDestinationInput{ - DestinationName: aws.String("DestinationName"), // Required - } - resp, err := svc.DeleteDestination(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_DeleteLogGroup() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.DeleteLogGroupInput{ - LogGroupName: aws.String("LogGroupName"), // Required - } - resp, err := svc.DeleteLogGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_DeleteLogStream() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.DeleteLogStreamInput{ - LogGroupName: aws.String("LogGroupName"), // Required - LogStreamName: aws.String("LogStreamName"), // Required - } - resp, err := svc.DeleteLogStream(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_DeleteMetricFilter() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.DeleteMetricFilterInput{ - FilterName: aws.String("FilterName"), // Required - LogGroupName: aws.String("LogGroupName"), // Required - } - resp, err := svc.DeleteMetricFilter(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_DeleteRetentionPolicy() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.DeleteRetentionPolicyInput{ - LogGroupName: aws.String("LogGroupName"), // Required - } - resp, err := svc.DeleteRetentionPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_DeleteSubscriptionFilter() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.DeleteSubscriptionFilterInput{ - FilterName: aws.String("FilterName"), // Required - LogGroupName: aws.String("LogGroupName"), // Required - } - resp, err := svc.DeleteSubscriptionFilter(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_DescribeDestinations() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.DescribeDestinationsInput{ - DestinationNamePrefix: aws.String("DestinationName"), - Limit: aws.Int64(1), - NextToken: aws.String("NextToken"), - } - resp, err := svc.DescribeDestinations(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_DescribeExportTasks() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.DescribeExportTasksInput{ - Limit: aws.Int64(1), - NextToken: aws.String("NextToken"), - StatusCode: aws.String("ExportTaskStatusCode"), - TaskId: aws.String("ExportTaskId"), - } - resp, err := svc.DescribeExportTasks(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_DescribeLogGroups() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.DescribeLogGroupsInput{ - Limit: aws.Int64(1), - LogGroupNamePrefix: aws.String("LogGroupName"), - NextToken: aws.String("NextToken"), - } - resp, err := svc.DescribeLogGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_DescribeLogStreams() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.DescribeLogStreamsInput{ - LogGroupName: aws.String("LogGroupName"), // Required - Descending: aws.Bool(true), - Limit: aws.Int64(1), - LogStreamNamePrefix: aws.String("LogStreamName"), - NextToken: aws.String("NextToken"), - OrderBy: aws.String("OrderBy"), - } - resp, err := svc.DescribeLogStreams(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_DescribeMetricFilters() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.DescribeMetricFiltersInput{ - LogGroupName: aws.String("LogGroupName"), // Required - FilterNamePrefix: aws.String("FilterName"), - Limit: aws.Int64(1), - NextToken: aws.String("NextToken"), - } - resp, err := svc.DescribeMetricFilters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_DescribeSubscriptionFilters() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.DescribeSubscriptionFiltersInput{ - LogGroupName: aws.String("LogGroupName"), // Required - FilterNamePrefix: aws.String("FilterName"), - Limit: aws.Int64(1), - NextToken: aws.String("NextToken"), - } - resp, err := svc.DescribeSubscriptionFilters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_FilterLogEvents() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.FilterLogEventsInput{ - LogGroupName: aws.String("LogGroupName"), // Required - EndTime: aws.Int64(1), - FilterPattern: aws.String("FilterPattern"), - Interleaved: aws.Bool(true), - Limit: aws.Int64(1), - LogStreamNames: []*string{ - aws.String("LogStreamName"), // Required - // More values... - }, - NextToken: aws.String("NextToken"), - StartTime: aws.Int64(1), - } - resp, err := svc.FilterLogEvents(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_GetLogEvents() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.GetLogEventsInput{ - LogGroupName: aws.String("LogGroupName"), // Required - LogStreamName: aws.String("LogStreamName"), // Required - EndTime: aws.Int64(1), - Limit: aws.Int64(1), - NextToken: aws.String("NextToken"), - StartFromHead: aws.Bool(true), - StartTime: aws.Int64(1), - } - resp, err := svc.GetLogEvents(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_PutDestination() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.PutDestinationInput{ - DestinationName: aws.String("DestinationName"), // Required - RoleArn: aws.String("RoleArn"), // Required - TargetArn: aws.String("TargetArn"), // Required - } - resp, err := svc.PutDestination(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_PutDestinationPolicy() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.PutDestinationPolicyInput{ - AccessPolicy: aws.String("AccessPolicy"), // Required - DestinationName: aws.String("DestinationName"), // Required - } - resp, err := svc.PutDestinationPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_PutLogEvents() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.PutLogEventsInput{ - LogEvents: []*cloudwatchlogs.InputLogEvent{ // Required - { // Required - Message: aws.String("EventMessage"), // Required - Timestamp: aws.Int64(1), // Required - }, - // More values... - }, - LogGroupName: aws.String("LogGroupName"), // Required - LogStreamName: aws.String("LogStreamName"), // Required - SequenceToken: aws.String("SequenceToken"), - } - resp, err := svc.PutLogEvents(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_PutMetricFilter() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.PutMetricFilterInput{ - FilterName: aws.String("FilterName"), // Required - FilterPattern: aws.String("FilterPattern"), // Required - LogGroupName: aws.String("LogGroupName"), // Required - MetricTransformations: []*cloudwatchlogs.MetricTransformation{ // Required - { // Required - MetricName: aws.String("MetricName"), // Required - MetricNamespace: aws.String("MetricNamespace"), // Required - MetricValue: aws.String("MetricValue"), // Required - }, - // More values... - }, - } - resp, err := svc.PutMetricFilter(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_PutRetentionPolicy() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.PutRetentionPolicyInput{ - LogGroupName: aws.String("LogGroupName"), // Required - RetentionInDays: aws.Int64(1), // Required - } - resp, err := svc.PutRetentionPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_PutSubscriptionFilter() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.PutSubscriptionFilterInput{ - DestinationArn: aws.String("DestinationArn"), // Required - FilterName: aws.String("FilterName"), // Required - FilterPattern: aws.String("FilterPattern"), // Required - LogGroupName: aws.String("LogGroupName"), // Required - RoleArn: aws.String("RoleArn"), - } - resp, err := svc.PutSubscriptionFilter(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCloudWatchLogs_TestMetricFilter() { - svc := cloudwatchlogs.New(session.New()) - - params := &cloudwatchlogs.TestMetricFilterInput{ - FilterPattern: aws.String("FilterPattern"), // Required - LogEventMessages: []*string{ // Required - aws.String("EventMessage"), // Required - // More values... - }, - } - resp, err := svc.TestMetricFilter(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/codecommit/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/codecommit/examples_test.go deleted file mode 100644 index b320b97370..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/codecommit/examples_test.go +++ /dev/null @@ -1,238 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package codecommit_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/codecommit" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleCodeCommit_BatchGetRepositories() { - svc := codecommit.New(session.New()) - - params := &codecommit.BatchGetRepositoriesInput{ - RepositoryNames: []*string{ // Required - aws.String("RepositoryName"), // Required - // More values... - }, - } - resp, err := svc.BatchGetRepositories(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeCommit_CreateBranch() { - svc := codecommit.New(session.New()) - - params := &codecommit.CreateBranchInput{ - BranchName: aws.String("BranchName"), // Required - CommitId: aws.String("CommitId"), // Required - RepositoryName: aws.String("RepositoryName"), // Required - } - resp, err := svc.CreateBranch(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeCommit_CreateRepository() { - svc := codecommit.New(session.New()) - - params := &codecommit.CreateRepositoryInput{ - RepositoryName: aws.String("RepositoryName"), // Required - RepositoryDescription: aws.String("RepositoryDescription"), - } - resp, err := svc.CreateRepository(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeCommit_DeleteRepository() { - svc := codecommit.New(session.New()) - - params := &codecommit.DeleteRepositoryInput{ - RepositoryName: aws.String("RepositoryName"), // Required - } - resp, err := svc.DeleteRepository(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeCommit_GetBranch() { - svc := codecommit.New(session.New()) - - params := &codecommit.GetBranchInput{ - BranchName: aws.String("BranchName"), - RepositoryName: aws.String("RepositoryName"), - } - resp, err := svc.GetBranch(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeCommit_GetRepository() { - svc := codecommit.New(session.New()) - - params := &codecommit.GetRepositoryInput{ - RepositoryName: aws.String("RepositoryName"), // Required - } - resp, err := svc.GetRepository(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeCommit_ListBranches() { - svc := codecommit.New(session.New()) - - params := &codecommit.ListBranchesInput{ - RepositoryName: aws.String("RepositoryName"), // Required - NextToken: aws.String("NextToken"), - } - resp, err := svc.ListBranches(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeCommit_ListRepositories() { - svc := codecommit.New(session.New()) - - params := &codecommit.ListRepositoriesInput{ - NextToken: aws.String("NextToken"), - Order: aws.String("OrderEnum"), - SortBy: aws.String("SortByEnum"), - } - resp, err := svc.ListRepositories(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeCommit_UpdateDefaultBranch() { - svc := codecommit.New(session.New()) - - params := &codecommit.UpdateDefaultBranchInput{ - DefaultBranchName: aws.String("BranchName"), // Required - RepositoryName: aws.String("RepositoryName"), // Required - } - resp, err := svc.UpdateDefaultBranch(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeCommit_UpdateRepositoryDescription() { - svc := codecommit.New(session.New()) - - params := &codecommit.UpdateRepositoryDescriptionInput{ - RepositoryName: aws.String("RepositoryName"), // Required - RepositoryDescription: aws.String("RepositoryDescription"), - } - resp, err := svc.UpdateRepositoryDescription(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeCommit_UpdateRepositoryName() { - svc := codecommit.New(session.New()) - - params := &codecommit.UpdateRepositoryNameInput{ - NewName: aws.String("RepositoryName"), // Required - OldName: aws.String("RepositoryName"), // Required - } - resp, err := svc.UpdateRepositoryName(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/codedeploy/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/codedeploy/examples_test.go deleted file mode 100644 index cb1658f819..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/codedeploy/examples_test.go +++ /dev/null @@ -1,787 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package codedeploy_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/codedeploy" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleCodeDeploy_AddTagsToOnPremisesInstances() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.AddTagsToOnPremisesInstancesInput{ - InstanceNames: []*string{ // Required - aws.String("InstanceName"), // Required - // More values... - }, - Tags: []*codedeploy.Tag{ // Required - { // Required - Key: aws.String("Key"), - Value: aws.String("Value"), - }, - // More values... - }, - } - resp, err := svc.AddTagsToOnPremisesInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_BatchGetApplications() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.BatchGetApplicationsInput{ - ApplicationNames: []*string{ - aws.String("ApplicationName"), // Required - // More values... - }, - } - resp, err := svc.BatchGetApplications(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_BatchGetDeployments() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.BatchGetDeploymentsInput{ - DeploymentIds: []*string{ - aws.String("DeploymentId"), // Required - // More values... - }, - } - resp, err := svc.BatchGetDeployments(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_BatchGetOnPremisesInstances() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.BatchGetOnPremisesInstancesInput{ - InstanceNames: []*string{ - aws.String("InstanceName"), // Required - // More values... - }, - } - resp, err := svc.BatchGetOnPremisesInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_CreateApplication() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.CreateApplicationInput{ - ApplicationName: aws.String("ApplicationName"), // Required - } - resp, err := svc.CreateApplication(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_CreateDeployment() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.CreateDeploymentInput{ - ApplicationName: aws.String("ApplicationName"), // Required - DeploymentConfigName: aws.String("DeploymentConfigName"), - DeploymentGroupName: aws.String("DeploymentGroupName"), - Description: aws.String("Description"), - IgnoreApplicationStopFailures: aws.Bool(true), - Revision: &codedeploy.RevisionLocation{ - GitHubLocation: &codedeploy.GitHubLocation{ - CommitId: aws.String("CommitId"), - Repository: aws.String("Repository"), - }, - RevisionType: aws.String("RevisionLocationType"), - S3Location: &codedeploy.S3Location{ - Bucket: aws.String("S3Bucket"), - BundleType: aws.String("BundleType"), - ETag: aws.String("ETag"), - Key: aws.String("S3Key"), - Version: aws.String("VersionId"), - }, - }, - } - resp, err := svc.CreateDeployment(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_CreateDeploymentConfig() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.CreateDeploymentConfigInput{ - DeploymentConfigName: aws.String("DeploymentConfigName"), // Required - MinimumHealthyHosts: &codedeploy.MinimumHealthyHosts{ - Type: aws.String("MinimumHealthyHostsType"), - Value: aws.Int64(1), - }, - } - resp, err := svc.CreateDeploymentConfig(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_CreateDeploymentGroup() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.CreateDeploymentGroupInput{ - ApplicationName: aws.String("ApplicationName"), // Required - DeploymentGroupName: aws.String("DeploymentGroupName"), // Required - ServiceRoleArn: aws.String("Role"), // Required - AutoScalingGroups: []*string{ - aws.String("AutoScalingGroupName"), // Required - // More values... - }, - DeploymentConfigName: aws.String("DeploymentConfigName"), - Ec2TagFilters: []*codedeploy.EC2TagFilter{ - { // Required - Key: aws.String("Key"), - Type: aws.String("EC2TagFilterType"), - Value: aws.String("Value"), - }, - // More values... - }, - OnPremisesInstanceTagFilters: []*codedeploy.TagFilter{ - { // Required - Key: aws.String("Key"), - Type: aws.String("TagFilterType"), - Value: aws.String("Value"), - }, - // More values... - }, - } - resp, err := svc.CreateDeploymentGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_DeleteApplication() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.DeleteApplicationInput{ - ApplicationName: aws.String("ApplicationName"), // Required - } - resp, err := svc.DeleteApplication(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_DeleteDeploymentConfig() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.DeleteDeploymentConfigInput{ - DeploymentConfigName: aws.String("DeploymentConfigName"), // Required - } - resp, err := svc.DeleteDeploymentConfig(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_DeleteDeploymentGroup() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.DeleteDeploymentGroupInput{ - ApplicationName: aws.String("ApplicationName"), // Required - DeploymentGroupName: aws.String("DeploymentGroupName"), // Required - } - resp, err := svc.DeleteDeploymentGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_DeregisterOnPremisesInstance() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.DeregisterOnPremisesInstanceInput{ - InstanceName: aws.String("InstanceName"), // Required - } - resp, err := svc.DeregisterOnPremisesInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_GetApplication() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.GetApplicationInput{ - ApplicationName: aws.String("ApplicationName"), // Required - } - resp, err := svc.GetApplication(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_GetApplicationRevision() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.GetApplicationRevisionInput{ - ApplicationName: aws.String("ApplicationName"), // Required - Revision: &codedeploy.RevisionLocation{ // Required - GitHubLocation: &codedeploy.GitHubLocation{ - CommitId: aws.String("CommitId"), - Repository: aws.String("Repository"), - }, - RevisionType: aws.String("RevisionLocationType"), - S3Location: &codedeploy.S3Location{ - Bucket: aws.String("S3Bucket"), - BundleType: aws.String("BundleType"), - ETag: aws.String("ETag"), - Key: aws.String("S3Key"), - Version: aws.String("VersionId"), - }, - }, - } - resp, err := svc.GetApplicationRevision(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_GetDeployment() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.GetDeploymentInput{ - DeploymentId: aws.String("DeploymentId"), // Required - } - resp, err := svc.GetDeployment(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_GetDeploymentConfig() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.GetDeploymentConfigInput{ - DeploymentConfigName: aws.String("DeploymentConfigName"), // Required - } - resp, err := svc.GetDeploymentConfig(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_GetDeploymentGroup() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.GetDeploymentGroupInput{ - ApplicationName: aws.String("ApplicationName"), // Required - DeploymentGroupName: aws.String("DeploymentGroupName"), // Required - } - resp, err := svc.GetDeploymentGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_GetDeploymentInstance() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.GetDeploymentInstanceInput{ - DeploymentId: aws.String("DeploymentId"), // Required - InstanceId: aws.String("InstanceId"), // Required - } - resp, err := svc.GetDeploymentInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_GetOnPremisesInstance() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.GetOnPremisesInstanceInput{ - InstanceName: aws.String("InstanceName"), // Required - } - resp, err := svc.GetOnPremisesInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_ListApplicationRevisions() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.ListApplicationRevisionsInput{ - ApplicationName: aws.String("ApplicationName"), // Required - Deployed: aws.String("ListStateFilterAction"), - NextToken: aws.String("NextToken"), - S3Bucket: aws.String("S3Bucket"), - S3KeyPrefix: aws.String("S3Key"), - SortBy: aws.String("ApplicationRevisionSortBy"), - SortOrder: aws.String("SortOrder"), - } - resp, err := svc.ListApplicationRevisions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_ListApplications() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.ListApplicationsInput{ - NextToken: aws.String("NextToken"), - } - resp, err := svc.ListApplications(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_ListDeploymentConfigs() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.ListDeploymentConfigsInput{ - NextToken: aws.String("NextToken"), - } - resp, err := svc.ListDeploymentConfigs(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_ListDeploymentGroups() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.ListDeploymentGroupsInput{ - ApplicationName: aws.String("ApplicationName"), // Required - NextToken: aws.String("NextToken"), - } - resp, err := svc.ListDeploymentGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_ListDeploymentInstances() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.ListDeploymentInstancesInput{ - DeploymentId: aws.String("DeploymentId"), // Required - InstanceStatusFilter: []*string{ - aws.String("InstanceStatus"), // Required - // More values... - }, - NextToken: aws.String("NextToken"), - } - resp, err := svc.ListDeploymentInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_ListDeployments() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.ListDeploymentsInput{ - ApplicationName: aws.String("ApplicationName"), - CreateTimeRange: &codedeploy.TimeRange{ - End: aws.Time(time.Now()), - Start: aws.Time(time.Now()), - }, - DeploymentGroupName: aws.String("DeploymentGroupName"), - IncludeOnlyStatuses: []*string{ - aws.String("DeploymentStatus"), // Required - // More values... - }, - NextToken: aws.String("NextToken"), - } - resp, err := svc.ListDeployments(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_ListOnPremisesInstances() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.ListOnPremisesInstancesInput{ - NextToken: aws.String("NextToken"), - RegistrationStatus: aws.String("RegistrationStatus"), - TagFilters: []*codedeploy.TagFilter{ - { // Required - Key: aws.String("Key"), - Type: aws.String("TagFilterType"), - Value: aws.String("Value"), - }, - // More values... - }, - } - resp, err := svc.ListOnPremisesInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_RegisterApplicationRevision() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.RegisterApplicationRevisionInput{ - ApplicationName: aws.String("ApplicationName"), // Required - Revision: &codedeploy.RevisionLocation{ // Required - GitHubLocation: &codedeploy.GitHubLocation{ - CommitId: aws.String("CommitId"), - Repository: aws.String("Repository"), - }, - RevisionType: aws.String("RevisionLocationType"), - S3Location: &codedeploy.S3Location{ - Bucket: aws.String("S3Bucket"), - BundleType: aws.String("BundleType"), - ETag: aws.String("ETag"), - Key: aws.String("S3Key"), - Version: aws.String("VersionId"), - }, - }, - Description: aws.String("Description"), - } - resp, err := svc.RegisterApplicationRevision(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_RegisterOnPremisesInstance() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.RegisterOnPremisesInstanceInput{ - IamUserArn: aws.String("IamUserArn"), // Required - InstanceName: aws.String("InstanceName"), // Required - } - resp, err := svc.RegisterOnPremisesInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_RemoveTagsFromOnPremisesInstances() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.RemoveTagsFromOnPremisesInstancesInput{ - InstanceNames: []*string{ // Required - aws.String("InstanceName"), // Required - // More values... - }, - Tags: []*codedeploy.Tag{ // Required - { // Required - Key: aws.String("Key"), - Value: aws.String("Value"), - }, - // More values... - }, - } - resp, err := svc.RemoveTagsFromOnPremisesInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_StopDeployment() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.StopDeploymentInput{ - DeploymentId: aws.String("DeploymentId"), // Required - } - resp, err := svc.StopDeployment(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_UpdateApplication() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.UpdateApplicationInput{ - ApplicationName: aws.String("ApplicationName"), - NewApplicationName: aws.String("ApplicationName"), - } - resp, err := svc.UpdateApplication(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleCodeDeploy_UpdateDeploymentGroup() { - svc := codedeploy.New(session.New()) - - params := &codedeploy.UpdateDeploymentGroupInput{ - ApplicationName: aws.String("ApplicationName"), // Required - CurrentDeploymentGroupName: aws.String("DeploymentGroupName"), // Required - AutoScalingGroups: []*string{ - aws.String("AutoScalingGroupName"), // Required - // More values... - }, - DeploymentConfigName: aws.String("DeploymentConfigName"), - Ec2TagFilters: []*codedeploy.EC2TagFilter{ - { // Required - Key: aws.String("Key"), - Type: aws.String("EC2TagFilterType"), - Value: aws.String("Value"), - }, - // More values... - }, - NewDeploymentGroupName: aws.String("DeploymentGroupName"), - OnPremisesInstanceTagFilters: []*codedeploy.TagFilter{ - { // Required - Key: aws.String("Key"), - Type: aws.String("TagFilterType"), - Value: aws.String("Value"), - }, - // More values... - }, - ServiceRoleArn: aws.String("Role"), - } - resp, err := svc.UpdateDeploymentGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/directoryservice/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/directoryservice/examples_test.go deleted file mode 100644 index 06071ae474..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/directoryservice/examples_test.go +++ /dev/null @@ -1,532 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package directoryservice_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/directoryservice" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleDirectoryService_ConnectDirectory() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.ConnectDirectoryInput{ - ConnectSettings: &directoryservice.DirectoryConnectSettings{ // Required - CustomerDnsIps: []*string{ // Required - aws.String("IpAddr"), // Required - // More values... - }, - CustomerUserName: aws.String("UserName"), // Required - SubnetIds: []*string{ // Required - aws.String("SubnetId"), // Required - // More values... - }, - VpcId: aws.String("VpcId"), // Required - }, - Name: aws.String("DirectoryName"), // Required - Password: aws.String("ConnectPassword"), // Required - Size: aws.String("DirectorySize"), // Required - Description: aws.String("Description"), - ShortName: aws.String("DirectoryShortName"), - } - resp, err := svc.ConnectDirectory(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_CreateAlias() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.CreateAliasInput{ - Alias: aws.String("AliasName"), // Required - DirectoryId: aws.String("DirectoryId"), // Required - } - resp, err := svc.CreateAlias(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_CreateComputer() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.CreateComputerInput{ - ComputerName: aws.String("ComputerName"), // Required - DirectoryId: aws.String("DirectoryId"), // Required - Password: aws.String("ComputerPassword"), // Required - ComputerAttributes: []*directoryservice.Attribute{ - { // Required - Name: aws.String("AttributeName"), - Value: aws.String("AttributeValue"), - }, - // More values... - }, - OrganizationalUnitDistinguishedName: aws.String("OrganizationalUnitDN"), - } - resp, err := svc.CreateComputer(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_CreateDirectory() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.CreateDirectoryInput{ - Name: aws.String("DirectoryName"), // Required - Password: aws.String("Password"), // Required - Size: aws.String("DirectorySize"), // Required - Description: aws.String("Description"), - ShortName: aws.String("DirectoryShortName"), - VpcSettings: &directoryservice.DirectoryVpcSettings{ - SubnetIds: []*string{ // Required - aws.String("SubnetId"), // Required - // More values... - }, - VpcId: aws.String("VpcId"), // Required - }, - } - resp, err := svc.CreateDirectory(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_CreateMicrosoftAD() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.CreateMicrosoftADInput{ - Name: aws.String("DirectoryName"), // Required - Password: aws.String("Password"), // Required - VpcSettings: &directoryservice.DirectoryVpcSettings{ // Required - SubnetIds: []*string{ // Required - aws.String("SubnetId"), // Required - // More values... - }, - VpcId: aws.String("VpcId"), // Required - }, - Description: aws.String("Description"), - ShortName: aws.String("DirectoryShortName"), - } - resp, err := svc.CreateMicrosoftAD(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_CreateSnapshot() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.CreateSnapshotInput{ - DirectoryId: aws.String("DirectoryId"), // Required - Name: aws.String("SnapshotName"), - } - resp, err := svc.CreateSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_CreateTrust() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.CreateTrustInput{ - DirectoryId: aws.String("DirectoryId"), // Required - RemoteDomainName: aws.String("RemoteDomainName"), // Required - TrustDirection: aws.String("TrustDirection"), // Required - TrustPassword: aws.String("TrustPassword"), // Required - TrustType: aws.String("TrustType"), - } - resp, err := svc.CreateTrust(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_DeleteDirectory() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.DeleteDirectoryInput{ - DirectoryId: aws.String("DirectoryId"), // Required - } - resp, err := svc.DeleteDirectory(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_DeleteSnapshot() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.DeleteSnapshotInput{ - SnapshotId: aws.String("SnapshotId"), // Required - } - resp, err := svc.DeleteSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_DeleteTrust() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.DeleteTrustInput{ - TrustId: aws.String("TrustId"), // Required - } - resp, err := svc.DeleteTrust(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_DescribeDirectories() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.DescribeDirectoriesInput{ - DirectoryIds: []*string{ - aws.String("DirectoryId"), // Required - // More values... - }, - Limit: aws.Int64(1), - NextToken: aws.String("NextToken"), - } - resp, err := svc.DescribeDirectories(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_DescribeSnapshots() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.DescribeSnapshotsInput{ - DirectoryId: aws.String("DirectoryId"), - Limit: aws.Int64(1), - NextToken: aws.String("NextToken"), - SnapshotIds: []*string{ - aws.String("SnapshotId"), // Required - // More values... - }, - } - resp, err := svc.DescribeSnapshots(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_DescribeTrusts() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.DescribeTrustsInput{ - DirectoryId: aws.String("DirectoryId"), - Limit: aws.Int64(1), - NextToken: aws.String("NextToken"), - TrustIds: []*string{ - aws.String("TrustId"), // Required - // More values... - }, - } - resp, err := svc.DescribeTrusts(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_DisableRadius() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.DisableRadiusInput{ - DirectoryId: aws.String("DirectoryId"), // Required - } - resp, err := svc.DisableRadius(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_DisableSso() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.DisableSsoInput{ - DirectoryId: aws.String("DirectoryId"), // Required - Password: aws.String("ConnectPassword"), - UserName: aws.String("UserName"), - } - resp, err := svc.DisableSso(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_EnableRadius() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.EnableRadiusInput{ - DirectoryId: aws.String("DirectoryId"), // Required - RadiusSettings: &directoryservice.RadiusSettings{ // Required - AuthenticationProtocol: aws.String("RadiusAuthenticationProtocol"), - DisplayLabel: aws.String("RadiusDisplayLabel"), - RadiusPort: aws.Int64(1), - RadiusRetries: aws.Int64(1), - RadiusServers: []*string{ - aws.String("Server"), // Required - // More values... - }, - RadiusTimeout: aws.Int64(1), - SharedSecret: aws.String("RadiusSharedSecret"), - UseSameUsername: aws.Bool(true), - }, - } - resp, err := svc.EnableRadius(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_EnableSso() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.EnableSsoInput{ - DirectoryId: aws.String("DirectoryId"), // Required - Password: aws.String("ConnectPassword"), - UserName: aws.String("UserName"), - } - resp, err := svc.EnableSso(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_GetDirectoryLimits() { - svc := directoryservice.New(session.New()) - - var params *directoryservice.GetDirectoryLimitsInput - resp, err := svc.GetDirectoryLimits(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_GetSnapshotLimits() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.GetSnapshotLimitsInput{ - DirectoryId: aws.String("DirectoryId"), // Required - } - resp, err := svc.GetSnapshotLimits(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_RestoreFromSnapshot() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.RestoreFromSnapshotInput{ - SnapshotId: aws.String("SnapshotId"), // Required - } - resp, err := svc.RestoreFromSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_UpdateRadius() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.UpdateRadiusInput{ - DirectoryId: aws.String("DirectoryId"), // Required - RadiusSettings: &directoryservice.RadiusSettings{ // Required - AuthenticationProtocol: aws.String("RadiusAuthenticationProtocol"), - DisplayLabel: aws.String("RadiusDisplayLabel"), - RadiusPort: aws.Int64(1), - RadiusRetries: aws.Int64(1), - RadiusServers: []*string{ - aws.String("Server"), // Required - // More values... - }, - RadiusTimeout: aws.Int64(1), - SharedSecret: aws.String("RadiusSharedSecret"), - UseSameUsername: aws.Bool(true), - }, - } - resp, err := svc.UpdateRadius(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDirectoryService_VerifyTrust() { - svc := directoryservice.New(session.New()) - - params := &directoryservice.VerifyTrustInput{ - TrustId: aws.String("TrustId"), // Required - } - resp, err := svc.VerifyTrust(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/customizations_test.go b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/customizations_test.go deleted file mode 100644 index 194b517947..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/customizations_test.go +++ /dev/null @@ -1,106 +0,0 @@ -package dynamodb_test - -import ( - "bytes" - "io/ioutil" - "net/http" - "os" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/dynamodb" -) - -var db *dynamodb.DynamoDB - -func TestMain(m *testing.M) { - db = dynamodb.New(unit.Session, &aws.Config{ - MaxRetries: aws.Int(2), - }) - db.Handlers.Send.Clear() // mock sending - - os.Exit(m.Run()) -} - -func mockCRCResponse(svc *dynamodb.DynamoDB, status int, body, crc string) (req *request.Request) { - header := http.Header{} - header.Set("x-amz-crc32", crc) - - req, _ = svc.ListTablesRequest(nil) - req.Handlers.Send.PushBack(func(*request.Request) { - req.HTTPResponse = &http.Response{ - ContentLength: int64(len(body)), - StatusCode: status, - Body: ioutil.NopCloser(bytes.NewReader([]byte(body))), - Header: header, - } - }) - req.Send() - return -} - -func TestDefaultRetryRules(t *testing.T) { - d := dynamodb.New(unit.Session, &aws.Config{MaxRetries: aws.Int(-1)}) - assert.Equal(t, d.MaxRetries(), 10) -} - -func TestCustomRetryRules(t *testing.T) { - d := dynamodb.New(unit.Session, &aws.Config{MaxRetries: aws.Int(2)}) - assert.Equal(t, d.MaxRetries(), 2) -} - -func TestValidateCRC32NoHeaderSkip(t *testing.T) { - req := mockCRCResponse(db, 200, "{}", "") - assert.NoError(t, req.Error) -} - -func TestValidateCRC32InvalidHeaderSkip(t *testing.T) { - req := mockCRCResponse(db, 200, "{}", "ABC") - assert.NoError(t, req.Error) -} - -func TestValidateCRC32AlreadyErrorSkip(t *testing.T) { - req := mockCRCResponse(db, 400, "{}", "1234") - assert.Error(t, req.Error) - - assert.NotEqual(t, "CRC32CheckFailed", req.Error.(awserr.Error).Code()) -} - -func TestValidateCRC32IsValid(t *testing.T) { - req := mockCRCResponse(db, 200, `{"TableNames":["A"]}`, "3090163698") - assert.NoError(t, req.Error) - - // CRC check does not affect output parsing - out := req.Data.(*dynamodb.ListTablesOutput) - assert.Equal(t, "A", *out.TableNames[0]) -} - -func TestValidateCRC32DoesNotMatch(t *testing.T) { - req := mockCRCResponse(db, 200, "{}", "1234") - assert.Error(t, req.Error) - - assert.Equal(t, "CRC32CheckFailed", req.Error.(awserr.Error).Code()) - assert.Equal(t, 2, req.RetryCount) -} - -func TestValidateCRC32DoesNotMatchNoComputeChecksum(t *testing.T) { - svc := dynamodb.New(unit.Session, &aws.Config{ - MaxRetries: aws.Int(2), - DisableComputeChecksums: aws.Bool(true), - }) - svc.Handlers.Send.Clear() // mock sending - - req := mockCRCResponse(svc, 200, `{"TableNames":["A"]}`, "1234") - assert.NoError(t, req.Error) - - assert.Equal(t, 0, int(req.RetryCount)) - - // CRC check disabled. Does not affect output parsing - out := req.Data.(*dynamodb.ListTablesOutput) - assert.Equal(t, "A", *out.TableNames[0]) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/converter_test.go b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/converter_test.go deleted file mode 100644 index 2b536f0391..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/converter_test.go +++ /dev/null @@ -1,488 +0,0 @@ -package dynamodbattribute - -import ( - "math" - "reflect" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/service/dynamodb" -) - -type mySimpleStruct struct { - String string - Int int - Uint uint - Float32 float32 - Float64 float64 - Bool bool - Null *interface{} -} - -type myComplexStruct struct { - Simple []mySimpleStruct -} - -type converterTestInput struct { - input interface{} - expected interface{} - err awserr.Error - inputType string // "enum" of types -} - -var trueValue = true -var falseValue = false - -var converterScalarInputs = []converterTestInput{ - { - input: nil, - expected: &dynamodb.AttributeValue{NULL: &trueValue}, - }, - { - input: "some string", - expected: &dynamodb.AttributeValue{S: aws.String("some string")}, - }, - { - input: true, - expected: &dynamodb.AttributeValue{BOOL: &trueValue}, - }, - { - input: false, - expected: &dynamodb.AttributeValue{BOOL: &falseValue}, - }, - { - input: 3.14, - expected: &dynamodb.AttributeValue{N: aws.String("3.14")}, - }, - { - input: math.MaxFloat32, - expected: &dynamodb.AttributeValue{N: aws.String("340282346638528860000000000000000000000")}, - }, - { - input: math.MaxFloat64, - expected: &dynamodb.AttributeValue{N: aws.String("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")}, - }, - { - input: 12, - expected: &dynamodb.AttributeValue{N: aws.String("12")}, - }, - { - input: mySimpleStruct{}, - expected: &dynamodb.AttributeValue{ - M: map[string]*dynamodb.AttributeValue{ - "Bool": {BOOL: &falseValue}, - "Float32": {N: aws.String("0")}, - "Float64": {N: aws.String("0")}, - "Int": {N: aws.String("0")}, - "Null": {NULL: &trueValue}, - "String": {S: aws.String("")}, - "Uint": {N: aws.String("0")}, - }, - }, - inputType: "mySimpleStruct", - }, -} - -var converterMapTestInputs = []converterTestInput{ - // Scalar tests - { - input: nil, - err: awserr.New("SerializationError", "in must be a map[string]interface{} or struct, got ", nil), - }, - { - input: map[string]interface{}{"string": "some string"}, - expected: map[string]*dynamodb.AttributeValue{"string": {S: aws.String("some string")}}, - }, - { - input: map[string]interface{}{"bool": true}, - expected: map[string]*dynamodb.AttributeValue{"bool": {BOOL: &trueValue}}, - }, - { - input: map[string]interface{}{"bool": false}, - expected: map[string]*dynamodb.AttributeValue{"bool": {BOOL: &falseValue}}, - }, - { - input: map[string]interface{}{"null": nil}, - expected: map[string]*dynamodb.AttributeValue{"null": {NULL: &trueValue}}, - }, - { - input: map[string]interface{}{"float": 3.14}, - expected: map[string]*dynamodb.AttributeValue{"float": {N: aws.String("3.14")}}, - }, - { - input: map[string]interface{}{"float": math.MaxFloat32}, - expected: map[string]*dynamodb.AttributeValue{"float": {N: aws.String("340282346638528860000000000000000000000")}}, - }, - { - input: map[string]interface{}{"float": math.MaxFloat64}, - expected: map[string]*dynamodb.AttributeValue{"float": {N: aws.String("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")}}, - }, - { - input: map[string]interface{}{"int": int(12)}, - expected: map[string]*dynamodb.AttributeValue{"int": {N: aws.String("12")}}, - }, - // List - { - input: map[string]interface{}{"list": []interface{}{"a string", 12, 3.14, true, nil, false}}, - expected: map[string]*dynamodb.AttributeValue{ - "list": { - L: []*dynamodb.AttributeValue{ - {S: aws.String("a string")}, - {N: aws.String("12")}, - {N: aws.String("3.14")}, - {BOOL: &trueValue}, - {NULL: &trueValue}, - {BOOL: &falseValue}, - }, - }, - }, - }, - // Map - { - input: map[string]interface{}{"map": map[string]interface{}{"nestedint": 12}}, - expected: map[string]*dynamodb.AttributeValue{ - "map": { - M: map[string]*dynamodb.AttributeValue{ - "nestedint": { - N: aws.String("12"), - }, - }, - }, - }, - }, - // Structs - { - input: mySimpleStruct{}, - expected: map[string]*dynamodb.AttributeValue{ - "Bool": {BOOL: &falseValue}, - "Float32": {N: aws.String("0")}, - "Float64": {N: aws.String("0")}, - "Int": {N: aws.String("0")}, - "Null": {NULL: &trueValue}, - "String": {S: aws.String("")}, - "Uint": {N: aws.String("0")}, - }, - inputType: "mySimpleStruct", - }, - { - input: myComplexStruct{}, - expected: map[string]*dynamodb.AttributeValue{ - "Simple": {NULL: &trueValue}, - }, - inputType: "myComplexStruct", - }, - { - input: myComplexStruct{Simple: []mySimpleStruct{{Int: -2}, {Uint: 5}}}, - expected: map[string]*dynamodb.AttributeValue{ - "Simple": { - L: []*dynamodb.AttributeValue{ - { - M: map[string]*dynamodb.AttributeValue{ - "Bool": {BOOL: &falseValue}, - "Float32": {N: aws.String("0")}, - "Float64": {N: aws.String("0")}, - "Int": {N: aws.String("-2")}, - "Null": {NULL: &trueValue}, - "String": {S: aws.String("")}, - "Uint": {N: aws.String("0")}, - }, - }, - { - M: map[string]*dynamodb.AttributeValue{ - "Bool": {BOOL: &falseValue}, - "Float32": {N: aws.String("0")}, - "Float64": {N: aws.String("0")}, - "Int": {N: aws.String("0")}, - "Null": {NULL: &trueValue}, - "String": {S: aws.String("")}, - "Uint": {N: aws.String("5")}, - }, - }, - }, - }, - }, - inputType: "myComplexStruct", - }, -} - -var converterListTestInputs = []converterTestInput{ - { - input: nil, - err: awserr.New("SerializationError", "in must be an array or slice, got ", nil), - }, - { - input: []interface{}{}, - expected: []*dynamodb.AttributeValue{}, - }, - { - input: []interface{}{"a string", 12, 3.14, true, nil, false}, - expected: []*dynamodb.AttributeValue{ - {S: aws.String("a string")}, - {N: aws.String("12")}, - {N: aws.String("3.14")}, - {BOOL: &trueValue}, - {NULL: &trueValue}, - {BOOL: &falseValue}, - }, - }, - { - input: []mySimpleStruct{{}}, - expected: []*dynamodb.AttributeValue{ - { - M: map[string]*dynamodb.AttributeValue{ - "Bool": {BOOL: &falseValue}, - "Float32": {N: aws.String("0")}, - "Float64": {N: aws.String("0")}, - "Int": {N: aws.String("0")}, - "Null": {NULL: &trueValue}, - "String": {S: aws.String("")}, - "Uint": {N: aws.String("0")}, - }, - }, - }, - inputType: "mySimpleStruct", - }, -} - -func TestConvertTo(t *testing.T) { - for _, test := range converterScalarInputs { - testConvertTo(t, test) - } -} - -func testConvertTo(t *testing.T, test converterTestInput) { - actual, err := ConvertTo(test.input) - if test.err != nil { - if err == nil { - t.Errorf("ConvertTo with input %#v retured %#v, expected error `%s`", test.input, actual, test.err) - } else if err.Error() != test.err.Error() { - t.Errorf("ConvertTo with input %#v retured error `%s`, expected error `%s`", test.input, err, test.err) - } - } else { - if err != nil { - t.Errorf("ConvertTo with input %#v retured error `%s`", test.input, err) - } - compareObjects(t, test.expected, actual) - } -} - -func TestConvertFrom(t *testing.T) { - // Using the same inputs from TestConvertTo, test the reverse mapping. - for _, test := range converterScalarInputs { - if test.expected != nil { - testConvertFrom(t, test) - } - } -} - -func testConvertFrom(t *testing.T, test converterTestInput) { - switch test.inputType { - case "mySimpleStruct": - var actual mySimpleStruct - if err := ConvertFrom(test.expected.(*dynamodb.AttributeValue), &actual); err != nil { - t.Errorf("ConvertFrom with input %#v retured error `%s`", test.expected, err) - } - compareObjects(t, test.input, actual) - case "myComplexStruct": - var actual myComplexStruct - if err := ConvertFrom(test.expected.(*dynamodb.AttributeValue), &actual); err != nil { - t.Errorf("ConvertFrom with input %#v retured error `%s`", test.expected, err) - } - compareObjects(t, test.input, actual) - default: - var actual interface{} - if err := ConvertFrom(test.expected.(*dynamodb.AttributeValue), &actual); err != nil { - t.Errorf("ConvertFrom with input %#v retured error `%s`", test.expected, err) - } - compareObjects(t, test.input, actual) - } -} - -func TestConvertFromError(t *testing.T) { - // Test that we get an error using ConvertFrom to convert to a map. - var actual map[string]interface{} - expected := awserr.New("SerializationError", `v must be a non-nil pointer to an interface{} or struct, got *map[string]interface {}`, nil).Error() - if err := ConvertFrom(nil, &actual); err == nil { - t.Errorf("ConvertFrom with input %#v returned no error, expected error `%s`", nil, expected) - } else if err.Error() != expected { - t.Errorf("ConvertFrom with input %#v returned error `%s`, expected error `%s`", nil, err, expected) - } - - // Test that we get an error using ConvertFrom to convert to a list. - var actual2 []interface{} - expected = awserr.New("SerializationError", `v must be a non-nil pointer to an interface{} or struct, got *[]interface {}`, nil).Error() - if err := ConvertFrom(nil, &actual2); err == nil { - t.Errorf("ConvertFrom with input %#v returned no error, expected error `%s`", nil, expected) - } else if err.Error() != expected { - t.Errorf("ConvertFrom with input %#v returned error `%s`, expected error `%s`", nil, err, expected) - } -} - -func TestConvertToMap(t *testing.T) { - for _, test := range converterMapTestInputs { - testConvertToMap(t, test) - } -} - -func testConvertToMap(t *testing.T, test converterTestInput) { - actual, err := ConvertToMap(test.input) - if test.err != nil { - if err == nil { - t.Errorf("ConvertToMap with input %#v retured %#v, expected error `%s`", test.input, actual, test.err) - } else if err.Error() != test.err.Error() { - t.Errorf("ConvertToMap with input %#v retured error `%s`, expected error `%s`", test.input, err, test.err) - } - } else { - if err != nil { - t.Errorf("ConvertToMap with input %#v retured error `%s`", test.input, err) - } - compareObjects(t, test.expected, actual) - } -} - -func TestConvertFromMap(t *testing.T) { - // Using the same inputs from TestConvertToMap, test the reverse mapping. - for _, test := range converterMapTestInputs { - if test.expected != nil { - testConvertFromMap(t, test) - } - } -} - -func testConvertFromMap(t *testing.T, test converterTestInput) { - switch test.inputType { - case "mySimpleStruct": - var actual mySimpleStruct - if err := ConvertFromMap(test.expected.(map[string]*dynamodb.AttributeValue), &actual); err != nil { - t.Errorf("ConvertFromMap with input %#v retured error `%s`", test.expected, err) - } - compareObjects(t, test.input, actual) - case "myComplexStruct": - var actual myComplexStruct - if err := ConvertFromMap(test.expected.(map[string]*dynamodb.AttributeValue), &actual); err != nil { - t.Errorf("ConvertFromMap with input %#v retured error `%s`", test.expected, err) - } - compareObjects(t, test.input, actual) - default: - var actual map[string]interface{} - if err := ConvertFromMap(test.expected.(map[string]*dynamodb.AttributeValue), &actual); err != nil { - t.Errorf("ConvertFromMap with input %#v retured error `%s`", test.expected, err) - } - compareObjects(t, test.input, actual) - } -} - -func TestConvertFromMapError(t *testing.T) { - // Test that we get an error using ConvertFromMap to convert to an interface{}. - var actual interface{} - expected := awserr.New("SerializationError", `v must be a non-nil pointer to a map[string]interface{} or struct, got *interface {}`, nil).Error() - if err := ConvertFromMap(nil, &actual); err == nil { - t.Errorf("ConvertFromMap with input %#v returned no error, expected error `%s`", nil, expected) - } else if err.Error() != expected { - t.Errorf("ConvertFromMap with input %#v returned error `%s`, expected error `%s`", nil, err, expected) - } - - // Test that we get an error using ConvertFromMap to convert to a slice. - var actual2 []interface{} - expected = awserr.New("SerializationError", `v must be a non-nil pointer to a map[string]interface{} or struct, got *[]interface {}`, nil).Error() - if err := ConvertFromMap(nil, &actual2); err == nil { - t.Errorf("ConvertFromMap with input %#v returned no error, expected error `%s`", nil, expected) - } else if err.Error() != expected { - t.Errorf("ConvertFromMap with input %#v returned error `%s`, expected error `%s`", nil, err, expected) - } -} - -func TestConvertToList(t *testing.T) { - for _, test := range converterListTestInputs { - testConvertToList(t, test) - } -} - -func testConvertToList(t *testing.T, test converterTestInput) { - actual, err := ConvertToList(test.input) - if test.err != nil { - if err == nil { - t.Errorf("ConvertToList with input %#v retured %#v, expected error `%s`", test.input, actual, test.err) - } else if err.Error() != test.err.Error() { - t.Errorf("ConvertToList with input %#v retured error `%s`, expected error `%s`", test.input, err, test.err) - } - } else { - if err != nil { - t.Errorf("ConvertToList with input %#v retured error `%s`", test.input, err) - } - compareObjects(t, test.expected, actual) - } -} - -func TestConvertFromList(t *testing.T) { - // Using the same inputs from TestConvertToList, test the reverse mapping. - for _, test := range converterListTestInputs { - if test.expected != nil { - testConvertFromList(t, test) - } - } -} - -func testConvertFromList(t *testing.T, test converterTestInput) { - switch test.inputType { - case "mySimpleStruct": - var actual []mySimpleStruct - if err := ConvertFromList(test.expected.([]*dynamodb.AttributeValue), &actual); err != nil { - t.Errorf("ConvertFromList with input %#v retured error `%s`", test.expected, err) - } - compareObjects(t, test.input, actual) - case "myComplexStruct": - var actual []myComplexStruct - if err := ConvertFromList(test.expected.([]*dynamodb.AttributeValue), &actual); err != nil { - t.Errorf("ConvertFromList with input %#v retured error `%s`", test.expected, err) - } - compareObjects(t, test.input, actual) - default: - var actual []interface{} - if err := ConvertFromList(test.expected.([]*dynamodb.AttributeValue), &actual); err != nil { - t.Errorf("ConvertFromList with input %#v retured error `%s`", test.expected, err) - } - compareObjects(t, test.input, actual) - } -} - -func TestConvertFromListError(t *testing.T) { - // Test that we get an error using ConvertFromList to convert to a map. - var actual map[string]interface{} - expected := awserr.New("SerializationError", `v must be a non-nil pointer to an array or slice, got *map[string]interface {}`, nil).Error() - if err := ConvertFromList(nil, &actual); err == nil { - t.Errorf("ConvertFromList with input %#v returned no error, expected error `%s`", nil, expected) - } else if err.Error() != expected { - t.Errorf("ConvertFromList with input %#v returned error `%s`, expected error `%s`", nil, err, expected) - } - - // Test that we get an error using ConvertFromList to convert to a struct. - var actual2 myComplexStruct - expected = awserr.New("SerializationError", `v must be a non-nil pointer to an array or slice, got *dynamodbattribute.myComplexStruct`, nil).Error() - if err := ConvertFromList(nil, &actual2); err == nil { - t.Errorf("ConvertFromList with input %#v returned no error, expected error `%s`", nil, expected) - } else if err.Error() != expected { - t.Errorf("ConvertFromList with input %#v returned error `%s`, expected error `%s`", nil, err, expected) - } - - // Test that we get an error using ConvertFromList to convert to an interface{}. - var actual3 interface{} - expected = awserr.New("SerializationError", `v must be a non-nil pointer to an array or slice, got *interface {}`, nil).Error() - if err := ConvertFromList(nil, &actual3); err == nil { - t.Errorf("ConvertFromList with input %#v returned no error, expected error `%s`", nil, expected) - } else if err.Error() != expected { - t.Errorf("ConvertFromList with input %#v returned error `%s`, expected error `%s`", nil, err, expected) - } -} - -func compareObjects(t *testing.T, expected interface{}, actual interface{}) { - if !reflect.DeepEqual(expected, actual) { - t.Errorf("\nExpected %s:\n%s\nActual %s:\n%s\n", - reflect.ValueOf(expected).Kind(), - awsutil.Prettify(expected), - reflect.ValueOf(actual).Kind(), - awsutil.Prettify(actual)) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/examples_test.go deleted file mode 100644 index e4fcedfcb8..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/examples_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package dynamodbattribute_test - -import ( - "fmt" - "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute" - "reflect" -) - -func ExampleConvertTo() { - type Record struct { - MyField string - Letters []string - Numbers []int - } - - r := Record{ - MyField: "MyFieldValue", - Letters: []string{"a", "b", "c", "d"}, - Numbers: []int{1, 2, 3}, - } - av, err := dynamodbattribute.ConvertTo(r) - fmt.Println("err", err) - fmt.Println("MyField", av.M["MyField"]) - fmt.Println("Letters", av.M["Letters"]) - fmt.Println("Numbers", av.M["Numbers"]) - - // Output: - // err - // MyField { - // S: "MyFieldValue" - // } - // Letters { - // L: [ - // { - // S: "a" - // }, - // { - // S: "b" - // }, - // { - // S: "c" - // }, - // { - // S: "d" - // } - // ] - // } - // Numbers { - // L: [{ - // N: "1" - // },{ - // N: "2" - // },{ - // N: "3" - // }] - // } -} - -func ExampleConvertFrom() { - type Record struct { - MyField string - Letters []string - A2Num map[string]int - } - - r := Record{ - MyField: "MyFieldValue", - Letters: []string{"a", "b", "c", "d"}, - A2Num: map[string]int{"a": 1, "b": 2, "c": 3}, - } - av, err := dynamodbattribute.ConvertTo(r) - - r2 := Record{} - err = dynamodbattribute.ConvertFrom(av, &r2) - fmt.Println(err, reflect.DeepEqual(r, r2)) - - // Output: - // true -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/examples_test.go deleted file mode 100644 index 79db6a5eec..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/examples_test.go +++ /dev/null @@ -1,1336 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package dynamodb_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/dynamodb" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleDynamoDB_BatchGetItem() { - svc := dynamodb.New(session.New()) - - params := &dynamodb.BatchGetItemInput{ - RequestItems: map[string]*dynamodb.KeysAndAttributes{ // Required - "Key": { // Required - Keys: []map[string]*dynamodb.AttributeValue{ // Required - { // Required - "Key": { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - // More values... - }, - AttributesToGet: []*string{ - aws.String("AttributeName"), // Required - // More values... - }, - ConsistentRead: aws.Bool(true), - ExpressionAttributeNames: map[string]*string{ - "Key": aws.String("AttributeName"), // Required - // More values... - }, - ProjectionExpression: aws.String("ProjectionExpression"), - }, - // More values... - }, - ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"), - } - resp, err := svc.BatchGetItem(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDynamoDB_BatchWriteItem() { - svc := dynamodb.New(session.New()) - - params := &dynamodb.BatchWriteItemInput{ - RequestItems: map[string][]*dynamodb.WriteRequest{ // Required - "Key": { // Required - { // Required - DeleteRequest: &dynamodb.DeleteRequest{ - Key: map[string]*dynamodb.AttributeValue{ // Required - "Key": { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - }, - PutRequest: &dynamodb.PutRequest{ - Item: map[string]*dynamodb.AttributeValue{ // Required - "Key": { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - }, - }, - // More values... - }, - // More values... - }, - ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"), - ReturnItemCollectionMetrics: aws.String("ReturnItemCollectionMetrics"), - } - resp, err := svc.BatchWriteItem(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDynamoDB_CreateTable() { - svc := dynamodb.New(session.New()) - - params := &dynamodb.CreateTableInput{ - AttributeDefinitions: []*dynamodb.AttributeDefinition{ // Required - { // Required - AttributeName: aws.String("KeySchemaAttributeName"), // Required - AttributeType: aws.String("ScalarAttributeType"), // Required - }, - // More values... - }, - KeySchema: []*dynamodb.KeySchemaElement{ // Required - { // Required - AttributeName: aws.String("KeySchemaAttributeName"), // Required - KeyType: aws.String("KeyType"), // Required - }, - // More values... - }, - ProvisionedThroughput: &dynamodb.ProvisionedThroughput{ // Required - ReadCapacityUnits: aws.Int64(1), // Required - WriteCapacityUnits: aws.Int64(1), // Required - }, - TableName: aws.String("TableName"), // Required - GlobalSecondaryIndexes: []*dynamodb.GlobalSecondaryIndex{ - { // Required - IndexName: aws.String("IndexName"), // Required - KeySchema: []*dynamodb.KeySchemaElement{ // Required - { // Required - AttributeName: aws.String("KeySchemaAttributeName"), // Required - KeyType: aws.String("KeyType"), // Required - }, - // More values... - }, - Projection: &dynamodb.Projection{ // Required - NonKeyAttributes: []*string{ - aws.String("NonKeyAttributeName"), // Required - // More values... - }, - ProjectionType: aws.String("ProjectionType"), - }, - ProvisionedThroughput: &dynamodb.ProvisionedThroughput{ // Required - ReadCapacityUnits: aws.Int64(1), // Required - WriteCapacityUnits: aws.Int64(1), // Required - }, - }, - // More values... - }, - LocalSecondaryIndexes: []*dynamodb.LocalSecondaryIndex{ - { // Required - IndexName: aws.String("IndexName"), // Required - KeySchema: []*dynamodb.KeySchemaElement{ // Required - { // Required - AttributeName: aws.String("KeySchemaAttributeName"), // Required - KeyType: aws.String("KeyType"), // Required - }, - // More values... - }, - Projection: &dynamodb.Projection{ // Required - NonKeyAttributes: []*string{ - aws.String("NonKeyAttributeName"), // Required - // More values... - }, - ProjectionType: aws.String("ProjectionType"), - }, - }, - // More values... - }, - StreamSpecification: &dynamodb.StreamSpecification{ - StreamEnabled: aws.Bool(true), - StreamViewType: aws.String("StreamViewType"), - }, - } - resp, err := svc.CreateTable(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDynamoDB_DeleteItem() { - svc := dynamodb.New(session.New()) - - params := &dynamodb.DeleteItemInput{ - Key: map[string]*dynamodb.AttributeValue{ // Required - "Key": { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - TableName: aws.String("TableName"), // Required - ConditionExpression: aws.String("ConditionExpression"), - ConditionalOperator: aws.String("ConditionalOperator"), - Expected: map[string]*dynamodb.ExpectedAttributeValue{ - "Key": { // Required - AttributeValueList: []*dynamodb.AttributeValue{ - { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - ComparisonOperator: aws.String("ComparisonOperator"), - Exists: aws.Bool(true), - Value: &dynamodb.AttributeValue{ - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - }, - // More values... - }, - ExpressionAttributeNames: map[string]*string{ - "Key": aws.String("AttributeName"), // Required - // More values... - }, - ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"), - ReturnItemCollectionMetrics: aws.String("ReturnItemCollectionMetrics"), - ReturnValues: aws.String("ReturnValue"), - } - resp, err := svc.DeleteItem(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDynamoDB_DeleteTable() { - svc := dynamodb.New(session.New()) - - params := &dynamodb.DeleteTableInput{ - TableName: aws.String("TableName"), // Required - } - resp, err := svc.DeleteTable(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDynamoDB_DescribeTable() { - svc := dynamodb.New(session.New()) - - params := &dynamodb.DescribeTableInput{ - TableName: aws.String("TableName"), // Required - } - resp, err := svc.DescribeTable(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDynamoDB_GetItem() { - svc := dynamodb.New(session.New()) - - params := &dynamodb.GetItemInput{ - Key: map[string]*dynamodb.AttributeValue{ // Required - "Key": { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - TableName: aws.String("TableName"), // Required - AttributesToGet: []*string{ - aws.String("AttributeName"), // Required - // More values... - }, - ConsistentRead: aws.Bool(true), - ExpressionAttributeNames: map[string]*string{ - "Key": aws.String("AttributeName"), // Required - // More values... - }, - ProjectionExpression: aws.String("ProjectionExpression"), - ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"), - } - resp, err := svc.GetItem(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDynamoDB_ListTables() { - svc := dynamodb.New(session.New()) - - params := &dynamodb.ListTablesInput{ - ExclusiveStartTableName: aws.String("TableName"), - Limit: aws.Int64(1), - } - resp, err := svc.ListTables(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDynamoDB_PutItem() { - svc := dynamodb.New(session.New()) - - params := &dynamodb.PutItemInput{ - Item: map[string]*dynamodb.AttributeValue{ // Required - "Key": { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - TableName: aws.String("TableName"), // Required - ConditionExpression: aws.String("ConditionExpression"), - ConditionalOperator: aws.String("ConditionalOperator"), - Expected: map[string]*dynamodb.ExpectedAttributeValue{ - "Key": { // Required - AttributeValueList: []*dynamodb.AttributeValue{ - { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - ComparisonOperator: aws.String("ComparisonOperator"), - Exists: aws.Bool(true), - Value: &dynamodb.AttributeValue{ - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - }, - // More values... - }, - ExpressionAttributeNames: map[string]*string{ - "Key": aws.String("AttributeName"), // Required - // More values... - }, - ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"), - ReturnItemCollectionMetrics: aws.String("ReturnItemCollectionMetrics"), - ReturnValues: aws.String("ReturnValue"), - } - resp, err := svc.PutItem(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDynamoDB_Query() { - svc := dynamodb.New(session.New()) - - params := &dynamodb.QueryInput{ - TableName: aws.String("TableName"), // Required - AttributesToGet: []*string{ - aws.String("AttributeName"), // Required - // More values... - }, - ConditionalOperator: aws.String("ConditionalOperator"), - ConsistentRead: aws.Bool(true), - ExclusiveStartKey: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - ExpressionAttributeNames: map[string]*string{ - "Key": aws.String("AttributeName"), // Required - // More values... - }, - ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - FilterExpression: aws.String("ConditionExpression"), - IndexName: aws.String("IndexName"), - KeyConditionExpression: aws.String("KeyExpression"), - KeyConditions: map[string]*dynamodb.Condition{ - "Key": { // Required - ComparisonOperator: aws.String("ComparisonOperator"), // Required - AttributeValueList: []*dynamodb.AttributeValue{ - { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - }, - // More values... - }, - Limit: aws.Int64(1), - ProjectionExpression: aws.String("ProjectionExpression"), - QueryFilter: map[string]*dynamodb.Condition{ - "Key": { // Required - ComparisonOperator: aws.String("ComparisonOperator"), // Required - AttributeValueList: []*dynamodb.AttributeValue{ - { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - }, - // More values... - }, - ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"), - ScanIndexForward: aws.Bool(true), - Select: aws.String("Select"), - } - resp, err := svc.Query(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDynamoDB_Scan() { - svc := dynamodb.New(session.New()) - - params := &dynamodb.ScanInput{ - TableName: aws.String("TableName"), // Required - AttributesToGet: []*string{ - aws.String("AttributeName"), // Required - // More values... - }, - ConditionalOperator: aws.String("ConditionalOperator"), - ConsistentRead: aws.Bool(true), - ExclusiveStartKey: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - ExpressionAttributeNames: map[string]*string{ - "Key": aws.String("AttributeName"), // Required - // More values... - }, - ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - FilterExpression: aws.String("ConditionExpression"), - IndexName: aws.String("IndexName"), - Limit: aws.Int64(1), - ProjectionExpression: aws.String("ProjectionExpression"), - ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"), - ScanFilter: map[string]*dynamodb.Condition{ - "Key": { // Required - ComparisonOperator: aws.String("ComparisonOperator"), // Required - AttributeValueList: []*dynamodb.AttributeValue{ - { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - }, - // More values... - }, - Segment: aws.Int64(1), - Select: aws.String("Select"), - TotalSegments: aws.Int64(1), - } - resp, err := svc.Scan(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDynamoDB_UpdateItem() { - svc := dynamodb.New(session.New()) - - params := &dynamodb.UpdateItemInput{ - Key: map[string]*dynamodb.AttributeValue{ // Required - "Key": { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - TableName: aws.String("TableName"), // Required - AttributeUpdates: map[string]*dynamodb.AttributeValueUpdate{ - "Key": { // Required - Action: aws.String("AttributeAction"), - Value: &dynamodb.AttributeValue{ - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - }, - // More values... - }, - ConditionExpression: aws.String("ConditionExpression"), - ConditionalOperator: aws.String("ConditionalOperator"), - Expected: map[string]*dynamodb.ExpectedAttributeValue{ - "Key": { // Required - AttributeValueList: []*dynamodb.AttributeValue{ - { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - ComparisonOperator: aws.String("ComparisonOperator"), - Exists: aws.Bool(true), - Value: &dynamodb.AttributeValue{ - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - }, - // More values... - }, - ExpressionAttributeNames: map[string]*string{ - "Key": aws.String("AttributeName"), // Required - // More values... - }, - ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - B: []byte("PAYLOAD"), - BOOL: aws.Bool(true), - BS: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - L: []*dynamodb.AttributeValue{ - { // Required - // Recursive values... - }, - // More values... - }, - M: map[string]*dynamodb.AttributeValue{ - "Key": { // Required - // Recursive values... - }, - // More values... - }, - N: aws.String("NumberAttributeValue"), - NS: []*string{ - aws.String("NumberAttributeValue"), // Required - // More values... - }, - NULL: aws.Bool(true), - S: aws.String("StringAttributeValue"), - SS: []*string{ - aws.String("StringAttributeValue"), // Required - // More values... - }, - }, - // More values... - }, - ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"), - ReturnItemCollectionMetrics: aws.String("ReturnItemCollectionMetrics"), - ReturnValues: aws.String("ReturnValue"), - UpdateExpression: aws.String("UpdateExpression"), - } - resp, err := svc.UpdateItem(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleDynamoDB_UpdateTable() { - svc := dynamodb.New(session.New()) - - params := &dynamodb.UpdateTableInput{ - TableName: aws.String("TableName"), // Required - AttributeDefinitions: []*dynamodb.AttributeDefinition{ - { // Required - AttributeName: aws.String("KeySchemaAttributeName"), // Required - AttributeType: aws.String("ScalarAttributeType"), // Required - }, - // More values... - }, - GlobalSecondaryIndexUpdates: []*dynamodb.GlobalSecondaryIndexUpdate{ - { // Required - Create: &dynamodb.CreateGlobalSecondaryIndexAction{ - IndexName: aws.String("IndexName"), // Required - KeySchema: []*dynamodb.KeySchemaElement{ // Required - { // Required - AttributeName: aws.String("KeySchemaAttributeName"), // Required - KeyType: aws.String("KeyType"), // Required - }, - // More values... - }, - Projection: &dynamodb.Projection{ // Required - NonKeyAttributes: []*string{ - aws.String("NonKeyAttributeName"), // Required - // More values... - }, - ProjectionType: aws.String("ProjectionType"), - }, - ProvisionedThroughput: &dynamodb.ProvisionedThroughput{ // Required - ReadCapacityUnits: aws.Int64(1), // Required - WriteCapacityUnits: aws.Int64(1), // Required - }, - }, - Delete: &dynamodb.DeleteGlobalSecondaryIndexAction{ - IndexName: aws.String("IndexName"), // Required - }, - Update: &dynamodb.UpdateGlobalSecondaryIndexAction{ - IndexName: aws.String("IndexName"), // Required - ProvisionedThroughput: &dynamodb.ProvisionedThroughput{ // Required - ReadCapacityUnits: aws.Int64(1), // Required - WriteCapacityUnits: aws.Int64(1), // Required - }, - }, - }, - // More values... - }, - ProvisionedThroughput: &dynamodb.ProvisionedThroughput{ - ReadCapacityUnits: aws.Int64(1), // Required - WriteCapacityUnits: aws.Int64(1), // Required - }, - StreamSpecification: &dynamodb.StreamSpecification{ - StreamEnabled: aws.Bool(true), - StreamViewType: aws.String("StreamViewType"), - }, - } - resp, err := svc.UpdateTable(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go deleted file mode 100644 index 195d9b55b8..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go +++ /dev/null @@ -1,35 +0,0 @@ -package ec2_test - -import ( - "io/ioutil" - "net/url" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/ec2" - "github.com/stretchr/testify/assert" -) - -func TestCopySnapshotPresignedURL(t *testing.T) { - svc := ec2.New(unit.Session, &aws.Config{Region: aws.String("us-west-2")}) - - assert.NotPanics(t, func() { - // Doesn't panic on nil input - req, _ := svc.CopySnapshotRequest(nil) - req.Sign() - }) - - req, _ := svc.CopySnapshotRequest(&ec2.CopySnapshotInput{ - SourceRegion: aws.String("us-west-1"), - SourceSnapshotId: aws.String("snap-id"), - }) - req.Sign() - - b, _ := ioutil.ReadAll(req.HTTPRequest.Body) - q, _ := url.ParseQuery(string(b)) - u, _ := url.QueryUnescape(q.Get("PresignedUrl")) - assert.Equal(t, "us-west-2", q.Get("DestinationRegion")) - assert.Equal(t, "us-west-1", q.Get("SourceRegion")) - assert.Regexp(t, `^https://ec2\.us-west-1\.amazonaws\.com/.+&DestinationRegion=us-west-2`, u) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/examples_test.go deleted file mode 100644 index a834cf82b9..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/examples_test.go +++ /dev/null @@ -1,5695 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package ec2_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/ec2" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleEC2_AcceptVpcPeeringConnection() { - svc := ec2.New(session.New()) - - params := &ec2.AcceptVpcPeeringConnectionInput{ - DryRun: aws.Bool(true), - VpcPeeringConnectionId: aws.String("String"), - } - resp, err := svc.AcceptVpcPeeringConnection(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_AllocateAddress() { - svc := ec2.New(session.New()) - - params := &ec2.AllocateAddressInput{ - Domain: aws.String("DomainType"), - DryRun: aws.Bool(true), - } - resp, err := svc.AllocateAddress(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_AllocateHosts() { - svc := ec2.New(session.New()) - - params := &ec2.AllocateHostsInput{ - AvailabilityZone: aws.String("String"), // Required - InstanceType: aws.String("String"), // Required - Quantity: aws.Int64(1), // Required - AutoPlacement: aws.String("AutoPlacement"), - ClientToken: aws.String("String"), - } - resp, err := svc.AllocateHosts(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_AssignPrivateIpAddresses() { - svc := ec2.New(session.New()) - - params := &ec2.AssignPrivateIpAddressesInput{ - NetworkInterfaceId: aws.String("String"), // Required - AllowReassignment: aws.Bool(true), - PrivateIpAddresses: []*string{ - aws.String("String"), // Required - // More values... - }, - SecondaryPrivateIpAddressCount: aws.Int64(1), - } - resp, err := svc.AssignPrivateIpAddresses(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_AssociateAddress() { - svc := ec2.New(session.New()) - - params := &ec2.AssociateAddressInput{ - AllocationId: aws.String("String"), - AllowReassociation: aws.Bool(true), - DryRun: aws.Bool(true), - InstanceId: aws.String("String"), - NetworkInterfaceId: aws.String("String"), - PrivateIpAddress: aws.String("String"), - PublicIp: aws.String("String"), - } - resp, err := svc.AssociateAddress(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_AssociateDhcpOptions() { - svc := ec2.New(session.New()) - - params := &ec2.AssociateDhcpOptionsInput{ - DhcpOptionsId: aws.String("String"), // Required - VpcId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.AssociateDhcpOptions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_AssociateRouteTable() { - svc := ec2.New(session.New()) - - params := &ec2.AssociateRouteTableInput{ - RouteTableId: aws.String("String"), // Required - SubnetId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.AssociateRouteTable(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_AttachClassicLinkVpc() { - svc := ec2.New(session.New()) - - params := &ec2.AttachClassicLinkVpcInput{ - Groups: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - InstanceId: aws.String("String"), // Required - VpcId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.AttachClassicLinkVpc(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_AttachInternetGateway() { - svc := ec2.New(session.New()) - - params := &ec2.AttachInternetGatewayInput{ - InternetGatewayId: aws.String("String"), // Required - VpcId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.AttachInternetGateway(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_AttachNetworkInterface() { - svc := ec2.New(session.New()) - - params := &ec2.AttachNetworkInterfaceInput{ - DeviceIndex: aws.Int64(1), // Required - InstanceId: aws.String("String"), // Required - NetworkInterfaceId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.AttachNetworkInterface(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_AttachVolume() { - svc := ec2.New(session.New()) - - params := &ec2.AttachVolumeInput{ - Device: aws.String("String"), // Required - InstanceId: aws.String("String"), // Required - VolumeId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.AttachVolume(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_AttachVpnGateway() { - svc := ec2.New(session.New()) - - params := &ec2.AttachVpnGatewayInput{ - VpcId: aws.String("String"), // Required - VpnGatewayId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.AttachVpnGateway(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_AuthorizeSecurityGroupEgress() { - svc := ec2.New(session.New()) - - params := &ec2.AuthorizeSecurityGroupEgressInput{ - GroupId: aws.String("String"), // Required - CidrIp: aws.String("String"), - DryRun: aws.Bool(true), - FromPort: aws.Int64(1), - IpPermissions: []*ec2.IpPermission{ - { // Required - FromPort: aws.Int64(1), - IpProtocol: aws.String("String"), - IpRanges: []*ec2.IpRange{ - { // Required - CidrIp: aws.String("String"), - }, - // More values... - }, - PrefixListIds: []*ec2.PrefixListId{ - { // Required - PrefixListId: aws.String("String"), - }, - // More values... - }, - ToPort: aws.Int64(1), - UserIdGroupPairs: []*ec2.UserIdGroupPair{ - { // Required - GroupId: aws.String("String"), - GroupName: aws.String("String"), - UserId: aws.String("String"), - }, - // More values... - }, - }, - // More values... - }, - IpProtocol: aws.String("String"), - SourceSecurityGroupName: aws.String("String"), - SourceSecurityGroupOwnerId: aws.String("String"), - ToPort: aws.Int64(1), - } - resp, err := svc.AuthorizeSecurityGroupEgress(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_AuthorizeSecurityGroupIngress() { - svc := ec2.New(session.New()) - - params := &ec2.AuthorizeSecurityGroupIngressInput{ - CidrIp: aws.String("String"), - DryRun: aws.Bool(true), - FromPort: aws.Int64(1), - GroupId: aws.String("String"), - GroupName: aws.String("String"), - IpPermissions: []*ec2.IpPermission{ - { // Required - FromPort: aws.Int64(1), - IpProtocol: aws.String("String"), - IpRanges: []*ec2.IpRange{ - { // Required - CidrIp: aws.String("String"), - }, - // More values... - }, - PrefixListIds: []*ec2.PrefixListId{ - { // Required - PrefixListId: aws.String("String"), - }, - // More values... - }, - ToPort: aws.Int64(1), - UserIdGroupPairs: []*ec2.UserIdGroupPair{ - { // Required - GroupId: aws.String("String"), - GroupName: aws.String("String"), - UserId: aws.String("String"), - }, - // More values... - }, - }, - // More values... - }, - IpProtocol: aws.String("String"), - SourceSecurityGroupName: aws.String("String"), - SourceSecurityGroupOwnerId: aws.String("String"), - ToPort: aws.Int64(1), - } - resp, err := svc.AuthorizeSecurityGroupIngress(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_BundleInstance() { - svc := ec2.New(session.New()) - - params := &ec2.BundleInstanceInput{ - InstanceId: aws.String("String"), // Required - Storage: &ec2.Storage{ // Required - S3: &ec2.S3Storage{ - AWSAccessKeyId: aws.String("String"), - Bucket: aws.String("String"), - Prefix: aws.String("String"), - UploadPolicy: []byte("PAYLOAD"), - UploadPolicySignature: aws.String("String"), - }, - }, - DryRun: aws.Bool(true), - } - resp, err := svc.BundleInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CancelBundleTask() { - svc := ec2.New(session.New()) - - params := &ec2.CancelBundleTaskInput{ - BundleId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.CancelBundleTask(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CancelConversionTask() { - svc := ec2.New(session.New()) - - params := &ec2.CancelConversionTaskInput{ - ConversionTaskId: aws.String("String"), // Required - DryRun: aws.Bool(true), - ReasonMessage: aws.String("String"), - } - resp, err := svc.CancelConversionTask(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CancelExportTask() { - svc := ec2.New(session.New()) - - params := &ec2.CancelExportTaskInput{ - ExportTaskId: aws.String("String"), // Required - } - resp, err := svc.CancelExportTask(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CancelImportTask() { - svc := ec2.New(session.New()) - - params := &ec2.CancelImportTaskInput{ - CancelReason: aws.String("String"), - DryRun: aws.Bool(true), - ImportTaskId: aws.String("String"), - } - resp, err := svc.CancelImportTask(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CancelReservedInstancesListing() { - svc := ec2.New(session.New()) - - params := &ec2.CancelReservedInstancesListingInput{ - ReservedInstancesListingId: aws.String("String"), // Required - } - resp, err := svc.CancelReservedInstancesListing(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CancelSpotFleetRequests() { - svc := ec2.New(session.New()) - - params := &ec2.CancelSpotFleetRequestsInput{ - SpotFleetRequestIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - TerminateInstances: aws.Bool(true), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.CancelSpotFleetRequests(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CancelSpotInstanceRequests() { - svc := ec2.New(session.New()) - - params := &ec2.CancelSpotInstanceRequestsInput{ - SpotInstanceRequestIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - DryRun: aws.Bool(true), - } - resp, err := svc.CancelSpotInstanceRequests(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ConfirmProductInstance() { - svc := ec2.New(session.New()) - - params := &ec2.ConfirmProductInstanceInput{ - InstanceId: aws.String("String"), // Required - ProductCode: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.ConfirmProductInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CopyImage() { - svc := ec2.New(session.New()) - - params := &ec2.CopyImageInput{ - Name: aws.String("String"), // Required - SourceImageId: aws.String("String"), // Required - SourceRegion: aws.String("String"), // Required - ClientToken: aws.String("String"), - Description: aws.String("String"), - DryRun: aws.Bool(true), - Encrypted: aws.Bool(true), - KmsKeyId: aws.String("String"), - } - resp, err := svc.CopyImage(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CopySnapshot() { - svc := ec2.New(session.New()) - - params := &ec2.CopySnapshotInput{ - SourceRegion: aws.String("String"), // Required - SourceSnapshotId: aws.String("String"), // Required - Description: aws.String("String"), - DestinationRegion: aws.String("String"), - DryRun: aws.Bool(true), - Encrypted: aws.Bool(true), - KmsKeyId: aws.String("String"), - PresignedUrl: aws.String("String"), - } - resp, err := svc.CopySnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateCustomerGateway() { - svc := ec2.New(session.New()) - - params := &ec2.CreateCustomerGatewayInput{ - BgpAsn: aws.Int64(1), // Required - PublicIp: aws.String("String"), // Required - Type: aws.String("GatewayType"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.CreateCustomerGateway(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateDhcpOptions() { - svc := ec2.New(session.New()) - - params := &ec2.CreateDhcpOptionsInput{ - DhcpConfigurations: []*ec2.NewDhcpConfiguration{ // Required - { // Required - Key: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - DryRun: aws.Bool(true), - } - resp, err := svc.CreateDhcpOptions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateFlowLogs() { - svc := ec2.New(session.New()) - - params := &ec2.CreateFlowLogsInput{ - DeliverLogsPermissionArn: aws.String("String"), // Required - LogGroupName: aws.String("String"), // Required - ResourceIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - ResourceType: aws.String("FlowLogsResourceType"), // Required - TrafficType: aws.String("TrafficType"), // Required - ClientToken: aws.String("String"), - } - resp, err := svc.CreateFlowLogs(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateImage() { - svc := ec2.New(session.New()) - - params := &ec2.CreateImageInput{ - InstanceId: aws.String("String"), // Required - Name: aws.String("String"), // Required - BlockDeviceMappings: []*ec2.BlockDeviceMapping{ - { // Required - DeviceName: aws.String("String"), - Ebs: &ec2.EbsBlockDevice{ - DeleteOnTermination: aws.Bool(true), - Encrypted: aws.Bool(true), - Iops: aws.Int64(1), - SnapshotId: aws.String("String"), - VolumeSize: aws.Int64(1), - VolumeType: aws.String("VolumeType"), - }, - NoDevice: aws.String("String"), - VirtualName: aws.String("String"), - }, - // More values... - }, - Description: aws.String("String"), - DryRun: aws.Bool(true), - NoReboot: aws.Bool(true), - } - resp, err := svc.CreateImage(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateInstanceExportTask() { - svc := ec2.New(session.New()) - - params := &ec2.CreateInstanceExportTaskInput{ - InstanceId: aws.String("String"), // Required - Description: aws.String("String"), - ExportToS3Task: &ec2.ExportToS3TaskSpecification{ - ContainerFormat: aws.String("ContainerFormat"), - DiskImageFormat: aws.String("DiskImageFormat"), - S3Bucket: aws.String("String"), - S3Prefix: aws.String("String"), - }, - TargetEnvironment: aws.String("ExportEnvironment"), - } - resp, err := svc.CreateInstanceExportTask(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateInternetGateway() { - svc := ec2.New(session.New()) - - params := &ec2.CreateInternetGatewayInput{ - DryRun: aws.Bool(true), - } - resp, err := svc.CreateInternetGateway(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateKeyPair() { - svc := ec2.New(session.New()) - - params := &ec2.CreateKeyPairInput{ - KeyName: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.CreateKeyPair(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateNatGateway() { - svc := ec2.New(session.New()) - - params := &ec2.CreateNatGatewayInput{ - AllocationId: aws.String("String"), // Required - SubnetId: aws.String("String"), // Required - ClientToken: aws.String("String"), - } - resp, err := svc.CreateNatGateway(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateNetworkAcl() { - svc := ec2.New(session.New()) - - params := &ec2.CreateNetworkAclInput{ - VpcId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.CreateNetworkAcl(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateNetworkAclEntry() { - svc := ec2.New(session.New()) - - params := &ec2.CreateNetworkAclEntryInput{ - CidrBlock: aws.String("String"), // Required - Egress: aws.Bool(true), // Required - NetworkAclId: aws.String("String"), // Required - Protocol: aws.String("String"), // Required - RuleAction: aws.String("RuleAction"), // Required - RuleNumber: aws.Int64(1), // Required - DryRun: aws.Bool(true), - IcmpTypeCode: &ec2.IcmpTypeCode{ - Code: aws.Int64(1), - Type: aws.Int64(1), - }, - PortRange: &ec2.PortRange{ - From: aws.Int64(1), - To: aws.Int64(1), - }, - } - resp, err := svc.CreateNetworkAclEntry(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateNetworkInterface() { - svc := ec2.New(session.New()) - - params := &ec2.CreateNetworkInterfaceInput{ - SubnetId: aws.String("String"), // Required - Description: aws.String("String"), - DryRun: aws.Bool(true), - Groups: []*string{ - aws.String("String"), // Required - // More values... - }, - PrivateIpAddress: aws.String("String"), - PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{ - { // Required - PrivateIpAddress: aws.String("String"), // Required - Primary: aws.Bool(true), - }, - // More values... - }, - SecondaryPrivateIpAddressCount: aws.Int64(1), - } - resp, err := svc.CreateNetworkInterface(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreatePlacementGroup() { - svc := ec2.New(session.New()) - - params := &ec2.CreatePlacementGroupInput{ - GroupName: aws.String("String"), // Required - Strategy: aws.String("PlacementStrategy"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.CreatePlacementGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateReservedInstancesListing() { - svc := ec2.New(session.New()) - - params := &ec2.CreateReservedInstancesListingInput{ - ClientToken: aws.String("String"), // Required - InstanceCount: aws.Int64(1), // Required - PriceSchedules: []*ec2.PriceScheduleSpecification{ // Required - { // Required - CurrencyCode: aws.String("CurrencyCodeValues"), - Price: aws.Float64(1.0), - Term: aws.Int64(1), - }, - // More values... - }, - ReservedInstancesId: aws.String("String"), // Required - } - resp, err := svc.CreateReservedInstancesListing(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateRoute() { - svc := ec2.New(session.New()) - - params := &ec2.CreateRouteInput{ - DestinationCidrBlock: aws.String("String"), // Required - RouteTableId: aws.String("String"), // Required - DryRun: aws.Bool(true), - GatewayId: aws.String("String"), - InstanceId: aws.String("String"), - NatGatewayId: aws.String("String"), - NetworkInterfaceId: aws.String("String"), - VpcPeeringConnectionId: aws.String("String"), - } - resp, err := svc.CreateRoute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateRouteTable() { - svc := ec2.New(session.New()) - - params := &ec2.CreateRouteTableInput{ - VpcId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.CreateRouteTable(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateSecurityGroup() { - svc := ec2.New(session.New()) - - params := &ec2.CreateSecurityGroupInput{ - Description: aws.String("String"), // Required - GroupName: aws.String("String"), // Required - DryRun: aws.Bool(true), - VpcId: aws.String("String"), - } - resp, err := svc.CreateSecurityGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateSnapshot() { - svc := ec2.New(session.New()) - - params := &ec2.CreateSnapshotInput{ - VolumeId: aws.String("String"), // Required - Description: aws.String("String"), - DryRun: aws.Bool(true), - } - resp, err := svc.CreateSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateSpotDatafeedSubscription() { - svc := ec2.New(session.New()) - - params := &ec2.CreateSpotDatafeedSubscriptionInput{ - Bucket: aws.String("String"), // Required - DryRun: aws.Bool(true), - Prefix: aws.String("String"), - } - resp, err := svc.CreateSpotDatafeedSubscription(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateSubnet() { - svc := ec2.New(session.New()) - - params := &ec2.CreateSubnetInput{ - CidrBlock: aws.String("String"), // Required - VpcId: aws.String("String"), // Required - AvailabilityZone: aws.String("String"), - DryRun: aws.Bool(true), - } - resp, err := svc.CreateSubnet(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateTags() { - svc := ec2.New(session.New()) - - params := &ec2.CreateTagsInput{ - Resources: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - Tags: []*ec2.Tag{ // Required - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - DryRun: aws.Bool(true), - } - resp, err := svc.CreateTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateVolume() { - svc := ec2.New(session.New()) - - params := &ec2.CreateVolumeInput{ - AvailabilityZone: aws.String("String"), // Required - DryRun: aws.Bool(true), - Encrypted: aws.Bool(true), - Iops: aws.Int64(1), - KmsKeyId: aws.String("String"), - Size: aws.Int64(1), - SnapshotId: aws.String("String"), - VolumeType: aws.String("VolumeType"), - } - resp, err := svc.CreateVolume(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateVpc() { - svc := ec2.New(session.New()) - - params := &ec2.CreateVpcInput{ - CidrBlock: aws.String("String"), // Required - DryRun: aws.Bool(true), - InstanceTenancy: aws.String("Tenancy"), - } - resp, err := svc.CreateVpc(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateVpcEndpoint() { - svc := ec2.New(session.New()) - - params := &ec2.CreateVpcEndpointInput{ - ServiceName: aws.String("String"), // Required - VpcId: aws.String("String"), // Required - ClientToken: aws.String("String"), - DryRun: aws.Bool(true), - PolicyDocument: aws.String("String"), - RouteTableIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.CreateVpcEndpoint(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateVpcPeeringConnection() { - svc := ec2.New(session.New()) - - params := &ec2.CreateVpcPeeringConnectionInput{ - DryRun: aws.Bool(true), - PeerOwnerId: aws.String("String"), - PeerVpcId: aws.String("String"), - VpcId: aws.String("String"), - } - resp, err := svc.CreateVpcPeeringConnection(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateVpnConnection() { - svc := ec2.New(session.New()) - - params := &ec2.CreateVpnConnectionInput{ - CustomerGatewayId: aws.String("String"), // Required - Type: aws.String("String"), // Required - VpnGatewayId: aws.String("String"), // Required - DryRun: aws.Bool(true), - Options: &ec2.VpnConnectionOptionsSpecification{ - StaticRoutesOnly: aws.Bool(true), - }, - } - resp, err := svc.CreateVpnConnection(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateVpnConnectionRoute() { - svc := ec2.New(session.New()) - - params := &ec2.CreateVpnConnectionRouteInput{ - DestinationCidrBlock: aws.String("String"), // Required - VpnConnectionId: aws.String("String"), // Required - } - resp, err := svc.CreateVpnConnectionRoute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_CreateVpnGateway() { - svc := ec2.New(session.New()) - - params := &ec2.CreateVpnGatewayInput{ - Type: aws.String("GatewayType"), // Required - AvailabilityZone: aws.String("String"), - DryRun: aws.Bool(true), - } - resp, err := svc.CreateVpnGateway(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteCustomerGateway() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteCustomerGatewayInput{ - CustomerGatewayId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteCustomerGateway(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteDhcpOptions() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteDhcpOptionsInput{ - DhcpOptionsId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteDhcpOptions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteFlowLogs() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteFlowLogsInput{ - FlowLogIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DeleteFlowLogs(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteInternetGateway() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteInternetGatewayInput{ - InternetGatewayId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteInternetGateway(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteKeyPair() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteKeyPairInput{ - KeyName: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteKeyPair(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteNatGateway() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteNatGatewayInput{ - NatGatewayId: aws.String("String"), // Required - } - resp, err := svc.DeleteNatGateway(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteNetworkAcl() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteNetworkAclInput{ - NetworkAclId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteNetworkAcl(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteNetworkAclEntry() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteNetworkAclEntryInput{ - Egress: aws.Bool(true), // Required - NetworkAclId: aws.String("String"), // Required - RuleNumber: aws.Int64(1), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteNetworkAclEntry(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteNetworkInterface() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteNetworkInterfaceInput{ - NetworkInterfaceId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteNetworkInterface(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeletePlacementGroup() { - svc := ec2.New(session.New()) - - params := &ec2.DeletePlacementGroupInput{ - GroupName: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeletePlacementGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteRoute() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteRouteInput{ - DestinationCidrBlock: aws.String("String"), // Required - RouteTableId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteRoute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteRouteTable() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteRouteTableInput{ - RouteTableId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteRouteTable(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteSecurityGroup() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteSecurityGroupInput{ - DryRun: aws.Bool(true), - GroupId: aws.String("String"), - GroupName: aws.String("String"), - } - resp, err := svc.DeleteSecurityGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteSnapshot() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteSnapshotInput{ - SnapshotId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteSpotDatafeedSubscription() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteSpotDatafeedSubscriptionInput{ - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteSpotDatafeedSubscription(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteSubnet() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteSubnetInput{ - SubnetId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteSubnet(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteTags() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteTagsInput{ - Resources: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - DryRun: aws.Bool(true), - Tags: []*ec2.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.DeleteTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteVolume() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteVolumeInput{ - VolumeId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteVolume(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteVpc() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteVpcInput{ - VpcId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteVpc(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteVpcEndpoints() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteVpcEndpointsInput{ - VpcEndpointIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteVpcEndpoints(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteVpcPeeringConnection() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteVpcPeeringConnectionInput{ - VpcPeeringConnectionId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteVpcPeeringConnection(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteVpnConnection() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteVpnConnectionInput{ - VpnConnectionId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteVpnConnection(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteVpnConnectionRoute() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteVpnConnectionRouteInput{ - DestinationCidrBlock: aws.String("String"), // Required - VpnConnectionId: aws.String("String"), // Required - } - resp, err := svc.DeleteVpnConnectionRoute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeleteVpnGateway() { - svc := ec2.New(session.New()) - - params := &ec2.DeleteVpnGatewayInput{ - VpnGatewayId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteVpnGateway(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DeregisterImage() { - svc := ec2.New(session.New()) - - params := &ec2.DeregisterImageInput{ - ImageId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeregisterImage(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeAccountAttributes() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeAccountAttributesInput{ - AttributeNames: []*string{ - aws.String("AccountAttributeName"), // Required - // More values... - }, - DryRun: aws.Bool(true), - } - resp, err := svc.DescribeAccountAttributes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeAddresses() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeAddressesInput{ - AllocationIds: []*string{ - aws.String("String"), // Required - // More values... - }, - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - PublicIps: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeAddresses(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeAvailabilityZones() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeAvailabilityZonesInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - ZoneNames: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeAvailabilityZones(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeBundleTasks() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeBundleTasksInput{ - BundleIds: []*string{ - aws.String("String"), // Required - // More values... - }, - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - } - resp, err := svc.DescribeBundleTasks(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeClassicLinkInstances() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeClassicLinkInstancesInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - InstanceIds: []*string{ - aws.String("String"), // Required - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.DescribeClassicLinkInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeConversionTasks() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeConversionTasksInput{ - ConversionTaskIds: []*string{ - aws.String("String"), // Required - // More values... - }, - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - } - resp, err := svc.DescribeConversionTasks(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeCustomerGateways() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeCustomerGatewaysInput{ - CustomerGatewayIds: []*string{ - aws.String("String"), // Required - // More values... - }, - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - } - resp, err := svc.DescribeCustomerGateways(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeDhcpOptions() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeDhcpOptionsInput{ - DhcpOptionsIds: []*string{ - aws.String("String"), // Required - // More values... - }, - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - } - resp, err := svc.DescribeDhcpOptions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeExportTasks() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeExportTasksInput{ - ExportTaskIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeExportTasks(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeFlowLogs() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeFlowLogsInput{ - Filter: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - FlowLogIds: []*string{ - aws.String("String"), // Required - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.DescribeFlowLogs(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeHosts() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeHostsInput{ - Filter: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - HostIds: []*string{ - aws.String("String"), // Required - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.DescribeHosts(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeIdFormat() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeIdFormatInput{ - Resource: aws.String("String"), - } - resp, err := svc.DescribeIdFormat(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeImageAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeImageAttributeInput{ - Attribute: aws.String("ImageAttributeName"), // Required - ImageId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DescribeImageAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeImages() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeImagesInput{ - DryRun: aws.Bool(true), - ExecutableUsers: []*string{ - aws.String("String"), // Required - // More values... - }, - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - ImageIds: []*string{ - aws.String("String"), // Required - // More values... - }, - Owners: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeImages(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeImportImageTasks() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeImportImageTasksInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - ImportTaskIds: []*string{ - aws.String("String"), // Required - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.DescribeImportImageTasks(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeImportSnapshotTasks() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeImportSnapshotTasksInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - ImportTaskIds: []*string{ - aws.String("String"), // Required - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.DescribeImportSnapshotTasks(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeInstanceAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeInstanceAttributeInput{ - Attribute: aws.String("InstanceAttributeName"), // Required - InstanceId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DescribeInstanceAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeInstanceStatus() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeInstanceStatusInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - IncludeAllInstances: aws.Bool(true), - InstanceIds: []*string{ - aws.String("String"), // Required - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.DescribeInstanceStatus(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeInstances() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeInstancesInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - InstanceIds: []*string{ - aws.String("String"), // Required - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.DescribeInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeInternetGateways() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeInternetGatewaysInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - InternetGatewayIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeInternetGateways(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeKeyPairs() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeKeyPairsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - KeyNames: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeKeyPairs(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeMovingAddresses() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeMovingAddressesInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - PublicIps: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeMovingAddresses(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeNatGateways() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeNatGatewaysInput{ - Filter: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - MaxResults: aws.Int64(1), - NatGatewayIds: []*string{ - aws.String("String"), // Required - // More values... - }, - NextToken: aws.String("String"), - } - resp, err := svc.DescribeNatGateways(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeNetworkAcls() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeNetworkAclsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - NetworkAclIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeNetworkAcls(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeNetworkInterfaceAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeNetworkInterfaceAttributeInput{ - NetworkInterfaceId: aws.String("String"), // Required - Attribute: aws.String("NetworkInterfaceAttribute"), - DryRun: aws.Bool(true), - } - resp, err := svc.DescribeNetworkInterfaceAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeNetworkInterfaces() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeNetworkInterfacesInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - NetworkInterfaceIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeNetworkInterfaces(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribePlacementGroups() { - svc := ec2.New(session.New()) - - params := &ec2.DescribePlacementGroupsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - GroupNames: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribePlacementGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribePrefixLists() { - svc := ec2.New(session.New()) - - params := &ec2.DescribePrefixListsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - PrefixListIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribePrefixLists(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeRegions() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeRegionsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - RegionNames: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeRegions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeReservedInstances() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeReservedInstancesInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - OfferingType: aws.String("OfferingTypeValues"), - ReservedInstancesIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeReservedInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeReservedInstancesListings() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeReservedInstancesListingsInput{ - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - ReservedInstancesId: aws.String("String"), - ReservedInstancesListingId: aws.String("String"), - } - resp, err := svc.DescribeReservedInstancesListings(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeReservedInstancesModifications() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeReservedInstancesModificationsInput{ - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - NextToken: aws.String("String"), - ReservedInstancesModificationIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeReservedInstancesModifications(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeReservedInstancesOfferings() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeReservedInstancesOfferingsInput{ - AvailabilityZone: aws.String("String"), - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - IncludeMarketplace: aws.Bool(true), - InstanceTenancy: aws.String("Tenancy"), - InstanceType: aws.String("InstanceType"), - MaxDuration: aws.Int64(1), - MaxInstanceCount: aws.Int64(1), - MaxResults: aws.Int64(1), - MinDuration: aws.Int64(1), - NextToken: aws.String("String"), - OfferingType: aws.String("OfferingTypeValues"), - ProductDescription: aws.String("RIProductDescription"), - ReservedInstancesOfferingIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeReservedInstancesOfferings(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeRouteTables() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeRouteTablesInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - RouteTableIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeRouteTables(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeScheduledInstanceAvailability() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeScheduledInstanceAvailabilityInput{ - FirstSlotStartTimeRange: &ec2.SlotDateTimeRangeRequest{ // Required - EarliestTime: aws.Time(time.Now()), // Required - LatestTime: aws.Time(time.Now()), // Required - }, - Recurrence: &ec2.ScheduledInstanceRecurrenceRequest{ // Required - Frequency: aws.String("String"), - Interval: aws.Int64(1), - OccurrenceDays: []*int64{ - aws.Int64(1), // Required - // More values... - }, - OccurrenceRelativeToEnd: aws.Bool(true), - OccurrenceUnit: aws.String("String"), - }, - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - MaxResults: aws.Int64(1), - MaxSlotDurationInHours: aws.Int64(1), - MinSlotDurationInHours: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.DescribeScheduledInstanceAvailability(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeScheduledInstances() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeScheduledInstancesInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - ScheduledInstanceIds: []*string{ - aws.String("String"), // Required - // More values... - }, - SlotStartTimeRange: &ec2.SlotStartTimeRangeRequest{ - EarliestTime: aws.Time(time.Now()), - LatestTime: aws.Time(time.Now()), - }, - } - resp, err := svc.DescribeScheduledInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeSecurityGroups() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeSecurityGroupsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - GroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - GroupNames: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeSecurityGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeSnapshotAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeSnapshotAttributeInput{ - Attribute: aws.String("SnapshotAttributeName"), // Required - SnapshotId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DescribeSnapshotAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeSnapshots() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeSnapshotsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - OwnerIds: []*string{ - aws.String("String"), // Required - // More values... - }, - RestorableByUserIds: []*string{ - aws.String("String"), // Required - // More values... - }, - SnapshotIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeSnapshots(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeSpotDatafeedSubscription() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeSpotDatafeedSubscriptionInput{ - DryRun: aws.Bool(true), - } - resp, err := svc.DescribeSpotDatafeedSubscription(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeSpotFleetInstances() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeSpotFleetInstancesInput{ - SpotFleetRequestId: aws.String("String"), // Required - DryRun: aws.Bool(true), - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.DescribeSpotFleetInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeSpotFleetRequestHistory() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeSpotFleetRequestHistoryInput{ - SpotFleetRequestId: aws.String("String"), // Required - StartTime: aws.Time(time.Now()), // Required - DryRun: aws.Bool(true), - EventType: aws.String("EventType"), - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.DescribeSpotFleetRequestHistory(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeSpotFleetRequests() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeSpotFleetRequestsInput{ - DryRun: aws.Bool(true), - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - SpotFleetRequestIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeSpotFleetRequests(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeSpotInstanceRequests() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeSpotInstanceRequestsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - SpotInstanceRequestIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeSpotInstanceRequests(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeSpotPriceHistory() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeSpotPriceHistoryInput{ - AvailabilityZone: aws.String("String"), - DryRun: aws.Bool(true), - EndTime: aws.Time(time.Now()), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - InstanceTypes: []*string{ - aws.String("InstanceType"), // Required - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - ProductDescriptions: []*string{ - aws.String("String"), // Required - // More values... - }, - StartTime: aws.Time(time.Now()), - } - resp, err := svc.DescribeSpotPriceHistory(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeSubnets() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeSubnetsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - SubnetIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeSubnets(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeTags() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeTagsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.DescribeTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeVolumeAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeVolumeAttributeInput{ - VolumeId: aws.String("String"), // Required - Attribute: aws.String("VolumeAttributeName"), - DryRun: aws.Bool(true), - } - resp, err := svc.DescribeVolumeAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeVolumeStatus() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeVolumeStatusInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - VolumeIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeVolumeStatus(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeVolumes() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeVolumesInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - VolumeIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeVolumes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeVpcAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeVpcAttributeInput{ - Attribute: aws.String("VpcAttributeName"), // Required - VpcId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DescribeVpcAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeVpcClassicLink() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeVpcClassicLinkInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - VpcIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeVpcClassicLink(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeVpcClassicLinkDnsSupport() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeVpcClassicLinkDnsSupportInput{ - MaxResults: aws.Int64(1), - NextToken: aws.String("NextToken"), - VpcIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeVpcClassicLinkDnsSupport(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeVpcEndpointServices() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeVpcEndpointServicesInput{ - DryRun: aws.Bool(true), - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.DescribeVpcEndpointServices(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeVpcEndpoints() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeVpcEndpointsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - VpcEndpointIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeVpcEndpoints(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeVpcPeeringConnections() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeVpcPeeringConnectionsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - VpcPeeringConnectionIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeVpcPeeringConnections(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeVpcs() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeVpcsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - VpcIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeVpcs(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeVpnConnections() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeVpnConnectionsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - VpnConnectionIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeVpnConnections(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DescribeVpnGateways() { - svc := ec2.New(session.New()) - - params := &ec2.DescribeVpnGatewaysInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - VpnGatewayIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeVpnGateways(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DetachClassicLinkVpc() { - svc := ec2.New(session.New()) - - params := &ec2.DetachClassicLinkVpcInput{ - InstanceId: aws.String("String"), // Required - VpcId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DetachClassicLinkVpc(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DetachInternetGateway() { - svc := ec2.New(session.New()) - - params := &ec2.DetachInternetGatewayInput{ - InternetGatewayId: aws.String("String"), // Required - VpcId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DetachInternetGateway(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DetachNetworkInterface() { - svc := ec2.New(session.New()) - - params := &ec2.DetachNetworkInterfaceInput{ - AttachmentId: aws.String("String"), // Required - DryRun: aws.Bool(true), - Force: aws.Bool(true), - } - resp, err := svc.DetachNetworkInterface(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DetachVolume() { - svc := ec2.New(session.New()) - - params := &ec2.DetachVolumeInput{ - VolumeId: aws.String("String"), // Required - Device: aws.String("String"), - DryRun: aws.Bool(true), - Force: aws.Bool(true), - InstanceId: aws.String("String"), - } - resp, err := svc.DetachVolume(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DetachVpnGateway() { - svc := ec2.New(session.New()) - - params := &ec2.DetachVpnGatewayInput{ - VpcId: aws.String("String"), // Required - VpnGatewayId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DetachVpnGateway(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DisableVgwRoutePropagation() { - svc := ec2.New(session.New()) - - params := &ec2.DisableVgwRoutePropagationInput{ - GatewayId: aws.String("String"), // Required - RouteTableId: aws.String("String"), // Required - } - resp, err := svc.DisableVgwRoutePropagation(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DisableVpcClassicLink() { - svc := ec2.New(session.New()) - - params := &ec2.DisableVpcClassicLinkInput{ - VpcId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DisableVpcClassicLink(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DisableVpcClassicLinkDnsSupport() { - svc := ec2.New(session.New()) - - params := &ec2.DisableVpcClassicLinkDnsSupportInput{ - VpcId: aws.String("String"), - } - resp, err := svc.DisableVpcClassicLinkDnsSupport(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DisassociateAddress() { - svc := ec2.New(session.New()) - - params := &ec2.DisassociateAddressInput{ - AssociationId: aws.String("String"), - DryRun: aws.Bool(true), - PublicIp: aws.String("String"), - } - resp, err := svc.DisassociateAddress(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_DisassociateRouteTable() { - svc := ec2.New(session.New()) - - params := &ec2.DisassociateRouteTableInput{ - AssociationId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DisassociateRouteTable(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_EnableVgwRoutePropagation() { - svc := ec2.New(session.New()) - - params := &ec2.EnableVgwRoutePropagationInput{ - GatewayId: aws.String("String"), // Required - RouteTableId: aws.String("String"), // Required - } - resp, err := svc.EnableVgwRoutePropagation(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_EnableVolumeIO() { - svc := ec2.New(session.New()) - - params := &ec2.EnableVolumeIOInput{ - VolumeId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.EnableVolumeIO(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_EnableVpcClassicLink() { - svc := ec2.New(session.New()) - - params := &ec2.EnableVpcClassicLinkInput{ - VpcId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.EnableVpcClassicLink(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_EnableVpcClassicLinkDnsSupport() { - svc := ec2.New(session.New()) - - params := &ec2.EnableVpcClassicLinkDnsSupportInput{ - VpcId: aws.String("String"), - } - resp, err := svc.EnableVpcClassicLinkDnsSupport(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_GetConsoleOutput() { - svc := ec2.New(session.New()) - - params := &ec2.GetConsoleOutputInput{ - InstanceId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.GetConsoleOutput(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_GetPasswordData() { - svc := ec2.New(session.New()) - - params := &ec2.GetPasswordDataInput{ - InstanceId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.GetPasswordData(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ImportImage() { - svc := ec2.New(session.New()) - - params := &ec2.ImportImageInput{ - Architecture: aws.String("String"), - ClientData: &ec2.ClientData{ - Comment: aws.String("String"), - UploadEnd: aws.Time(time.Now()), - UploadSize: aws.Float64(1.0), - UploadStart: aws.Time(time.Now()), - }, - ClientToken: aws.String("String"), - Description: aws.String("String"), - DiskContainers: []*ec2.ImageDiskContainer{ - { // Required - Description: aws.String("String"), - DeviceName: aws.String("String"), - Format: aws.String("String"), - SnapshotId: aws.String("String"), - Url: aws.String("String"), - UserBucket: &ec2.UserBucket{ - S3Bucket: aws.String("String"), - S3Key: aws.String("String"), - }, - }, - // More values... - }, - DryRun: aws.Bool(true), - Hypervisor: aws.String("String"), - LicenseType: aws.String("String"), - Platform: aws.String("String"), - RoleName: aws.String("String"), - } - resp, err := svc.ImportImage(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ImportInstance() { - svc := ec2.New(session.New()) - - params := &ec2.ImportInstanceInput{ - Platform: aws.String("PlatformValues"), // Required - Description: aws.String("String"), - DiskImages: []*ec2.DiskImage{ - { // Required - Description: aws.String("String"), - Image: &ec2.DiskImageDetail{ - Bytes: aws.Int64(1), // Required - Format: aws.String("DiskImageFormat"), // Required - ImportManifestUrl: aws.String("String"), // Required - }, - Volume: &ec2.VolumeDetail{ - Size: aws.Int64(1), // Required - }, - }, - // More values... - }, - DryRun: aws.Bool(true), - LaunchSpecification: &ec2.ImportInstanceLaunchSpecification{ - AdditionalInfo: aws.String("String"), - Architecture: aws.String("ArchitectureValues"), - GroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - GroupNames: []*string{ - aws.String("String"), // Required - // More values... - }, - InstanceInitiatedShutdownBehavior: aws.String("ShutdownBehavior"), - InstanceType: aws.String("InstanceType"), - Monitoring: aws.Bool(true), - Placement: &ec2.Placement{ - Affinity: aws.String("String"), - AvailabilityZone: aws.String("String"), - GroupName: aws.String("String"), - HostId: aws.String("String"), - Tenancy: aws.String("Tenancy"), - }, - PrivateIpAddress: aws.String("String"), - SubnetId: aws.String("String"), - UserData: &ec2.UserData{ - Data: aws.String("String"), - }, - }, - } - resp, err := svc.ImportInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ImportKeyPair() { - svc := ec2.New(session.New()) - - params := &ec2.ImportKeyPairInput{ - KeyName: aws.String("String"), // Required - PublicKeyMaterial: []byte("PAYLOAD"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.ImportKeyPair(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ImportSnapshot() { - svc := ec2.New(session.New()) - - params := &ec2.ImportSnapshotInput{ - ClientData: &ec2.ClientData{ - Comment: aws.String("String"), - UploadEnd: aws.Time(time.Now()), - UploadSize: aws.Float64(1.0), - UploadStart: aws.Time(time.Now()), - }, - ClientToken: aws.String("String"), - Description: aws.String("String"), - DiskContainer: &ec2.SnapshotDiskContainer{ - Description: aws.String("String"), - Format: aws.String("String"), - Url: aws.String("String"), - UserBucket: &ec2.UserBucket{ - S3Bucket: aws.String("String"), - S3Key: aws.String("String"), - }, - }, - DryRun: aws.Bool(true), - RoleName: aws.String("String"), - } - resp, err := svc.ImportSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ImportVolume() { - svc := ec2.New(session.New()) - - params := &ec2.ImportVolumeInput{ - AvailabilityZone: aws.String("String"), // Required - Image: &ec2.DiskImageDetail{ // Required - Bytes: aws.Int64(1), // Required - Format: aws.String("DiskImageFormat"), // Required - ImportManifestUrl: aws.String("String"), // Required - }, - Volume: &ec2.VolumeDetail{ // Required - Size: aws.Int64(1), // Required - }, - Description: aws.String("String"), - DryRun: aws.Bool(true), - } - resp, err := svc.ImportVolume(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ModifyHosts() { - svc := ec2.New(session.New()) - - params := &ec2.ModifyHostsInput{ - AutoPlacement: aws.String("AutoPlacement"), // Required - HostIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.ModifyHosts(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ModifyIdFormat() { - svc := ec2.New(session.New()) - - params := &ec2.ModifyIdFormatInput{ - Resource: aws.String("String"), // Required - UseLongIds: aws.Bool(true), // Required - } - resp, err := svc.ModifyIdFormat(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ModifyImageAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.ModifyImageAttributeInput{ - ImageId: aws.String("String"), // Required - Attribute: aws.String("String"), - Description: &ec2.AttributeValue{ - Value: aws.String("String"), - }, - DryRun: aws.Bool(true), - LaunchPermission: &ec2.LaunchPermissionModifications{ - Add: []*ec2.LaunchPermission{ - { // Required - Group: aws.String("PermissionGroup"), - UserId: aws.String("String"), - }, - // More values... - }, - Remove: []*ec2.LaunchPermission{ - { // Required - Group: aws.String("PermissionGroup"), - UserId: aws.String("String"), - }, - // More values... - }, - }, - OperationType: aws.String("OperationType"), - ProductCodes: []*string{ - aws.String("String"), // Required - // More values... - }, - UserGroups: []*string{ - aws.String("String"), // Required - // More values... - }, - UserIds: []*string{ - aws.String("String"), // Required - // More values... - }, - Value: aws.String("String"), - } - resp, err := svc.ModifyImageAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ModifyInstanceAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.ModifyInstanceAttributeInput{ - InstanceId: aws.String("String"), // Required - Attribute: aws.String("InstanceAttributeName"), - BlockDeviceMappings: []*ec2.InstanceBlockDeviceMappingSpecification{ - { // Required - DeviceName: aws.String("String"), - Ebs: &ec2.EbsInstanceBlockDeviceSpecification{ - DeleteOnTermination: aws.Bool(true), - VolumeId: aws.String("String"), - }, - NoDevice: aws.String("String"), - VirtualName: aws.String("String"), - }, - // More values... - }, - DisableApiTermination: &ec2.AttributeBooleanValue{ - Value: aws.Bool(true), - }, - DryRun: aws.Bool(true), - EbsOptimized: &ec2.AttributeBooleanValue{ - Value: aws.Bool(true), - }, - Groups: []*string{ - aws.String("String"), // Required - // More values... - }, - InstanceInitiatedShutdownBehavior: &ec2.AttributeValue{ - Value: aws.String("String"), - }, - InstanceType: &ec2.AttributeValue{ - Value: aws.String("String"), - }, - Kernel: &ec2.AttributeValue{ - Value: aws.String("String"), - }, - Ramdisk: &ec2.AttributeValue{ - Value: aws.String("String"), - }, - SourceDestCheck: &ec2.AttributeBooleanValue{ - Value: aws.Bool(true), - }, - SriovNetSupport: &ec2.AttributeValue{ - Value: aws.String("String"), - }, - UserData: &ec2.BlobAttributeValue{ - Value: []byte("PAYLOAD"), - }, - Value: aws.String("String"), - } - resp, err := svc.ModifyInstanceAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ModifyInstancePlacement() { - svc := ec2.New(session.New()) - - params := &ec2.ModifyInstancePlacementInput{ - InstanceId: aws.String("String"), // Required - Affinity: aws.String("Affinity"), - HostId: aws.String("String"), - Tenancy: aws.String("HostTenancy"), - } - resp, err := svc.ModifyInstancePlacement(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ModifyNetworkInterfaceAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.ModifyNetworkInterfaceAttributeInput{ - NetworkInterfaceId: aws.String("String"), // Required - Attachment: &ec2.NetworkInterfaceAttachmentChanges{ - AttachmentId: aws.String("String"), - DeleteOnTermination: aws.Bool(true), - }, - Description: &ec2.AttributeValue{ - Value: aws.String("String"), - }, - DryRun: aws.Bool(true), - Groups: []*string{ - aws.String("String"), // Required - // More values... - }, - SourceDestCheck: &ec2.AttributeBooleanValue{ - Value: aws.Bool(true), - }, - } - resp, err := svc.ModifyNetworkInterfaceAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ModifyReservedInstances() { - svc := ec2.New(session.New()) - - params := &ec2.ModifyReservedInstancesInput{ - ReservedInstancesIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - TargetConfigurations: []*ec2.ReservedInstancesConfiguration{ // Required - { // Required - AvailabilityZone: aws.String("String"), - InstanceCount: aws.Int64(1), - InstanceType: aws.String("InstanceType"), - Platform: aws.String("String"), - }, - // More values... - }, - ClientToken: aws.String("String"), - } - resp, err := svc.ModifyReservedInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ModifySnapshotAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.ModifySnapshotAttributeInput{ - SnapshotId: aws.String("String"), // Required - Attribute: aws.String("SnapshotAttributeName"), - CreateVolumePermission: &ec2.CreateVolumePermissionModifications{ - Add: []*ec2.CreateVolumePermission{ - { // Required - Group: aws.String("PermissionGroup"), - UserId: aws.String("String"), - }, - // More values... - }, - Remove: []*ec2.CreateVolumePermission{ - { // Required - Group: aws.String("PermissionGroup"), - UserId: aws.String("String"), - }, - // More values... - }, - }, - DryRun: aws.Bool(true), - GroupNames: []*string{ - aws.String("String"), // Required - // More values... - }, - OperationType: aws.String("OperationType"), - UserIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.ModifySnapshotAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ModifySpotFleetRequest() { - svc := ec2.New(session.New()) - - params := &ec2.ModifySpotFleetRequestInput{ - SpotFleetRequestId: aws.String("String"), // Required - ExcessCapacityTerminationPolicy: aws.String("ExcessCapacityTerminationPolicy"), - TargetCapacity: aws.Int64(1), - } - resp, err := svc.ModifySpotFleetRequest(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ModifySubnetAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.ModifySubnetAttributeInput{ - SubnetId: aws.String("String"), // Required - MapPublicIpOnLaunch: &ec2.AttributeBooleanValue{ - Value: aws.Bool(true), - }, - } - resp, err := svc.ModifySubnetAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ModifyVolumeAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.ModifyVolumeAttributeInput{ - VolumeId: aws.String("String"), // Required - AutoEnableIO: &ec2.AttributeBooleanValue{ - Value: aws.Bool(true), - }, - DryRun: aws.Bool(true), - } - resp, err := svc.ModifyVolumeAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ModifyVpcAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.ModifyVpcAttributeInput{ - VpcId: aws.String("String"), // Required - EnableDnsHostnames: &ec2.AttributeBooleanValue{ - Value: aws.Bool(true), - }, - EnableDnsSupport: &ec2.AttributeBooleanValue{ - Value: aws.Bool(true), - }, - } - resp, err := svc.ModifyVpcAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ModifyVpcEndpoint() { - svc := ec2.New(session.New()) - - params := &ec2.ModifyVpcEndpointInput{ - VpcEndpointId: aws.String("String"), // Required - AddRouteTableIds: []*string{ - aws.String("String"), // Required - // More values... - }, - DryRun: aws.Bool(true), - PolicyDocument: aws.String("String"), - RemoveRouteTableIds: []*string{ - aws.String("String"), // Required - // More values... - }, - ResetPolicy: aws.Bool(true), - } - resp, err := svc.ModifyVpcEndpoint(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_MonitorInstances() { - svc := ec2.New(session.New()) - - params := &ec2.MonitorInstancesInput{ - InstanceIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - DryRun: aws.Bool(true), - } - resp, err := svc.MonitorInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_MoveAddressToVpc() { - svc := ec2.New(session.New()) - - params := &ec2.MoveAddressToVpcInput{ - PublicIp: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.MoveAddressToVpc(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_PurchaseReservedInstancesOffering() { - svc := ec2.New(session.New()) - - params := &ec2.PurchaseReservedInstancesOfferingInput{ - InstanceCount: aws.Int64(1), // Required - ReservedInstancesOfferingId: aws.String("String"), // Required - DryRun: aws.Bool(true), - LimitPrice: &ec2.ReservedInstanceLimitPrice{ - Amount: aws.Float64(1.0), - CurrencyCode: aws.String("CurrencyCodeValues"), - }, - } - resp, err := svc.PurchaseReservedInstancesOffering(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_PurchaseScheduledInstances() { - svc := ec2.New(session.New()) - - params := &ec2.PurchaseScheduledInstancesInput{ - PurchaseRequests: []*ec2.PurchaseRequest{ // Required - { // Required - InstanceCount: aws.Int64(1), - PurchaseToken: aws.String("String"), - }, - // More values... - }, - ClientToken: aws.String("String"), - DryRun: aws.Bool(true), - } - resp, err := svc.PurchaseScheduledInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_RebootInstances() { - svc := ec2.New(session.New()) - - params := &ec2.RebootInstancesInput{ - InstanceIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - DryRun: aws.Bool(true), - } - resp, err := svc.RebootInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_RegisterImage() { - svc := ec2.New(session.New()) - - params := &ec2.RegisterImageInput{ - Name: aws.String("String"), // Required - Architecture: aws.String("ArchitectureValues"), - BlockDeviceMappings: []*ec2.BlockDeviceMapping{ - { // Required - DeviceName: aws.String("String"), - Ebs: &ec2.EbsBlockDevice{ - DeleteOnTermination: aws.Bool(true), - Encrypted: aws.Bool(true), - Iops: aws.Int64(1), - SnapshotId: aws.String("String"), - VolumeSize: aws.Int64(1), - VolumeType: aws.String("VolumeType"), - }, - NoDevice: aws.String("String"), - VirtualName: aws.String("String"), - }, - // More values... - }, - Description: aws.String("String"), - DryRun: aws.Bool(true), - ImageLocation: aws.String("String"), - KernelId: aws.String("String"), - RamdiskId: aws.String("String"), - RootDeviceName: aws.String("String"), - SriovNetSupport: aws.String("String"), - VirtualizationType: aws.String("String"), - } - resp, err := svc.RegisterImage(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_RejectVpcPeeringConnection() { - svc := ec2.New(session.New()) - - params := &ec2.RejectVpcPeeringConnectionInput{ - VpcPeeringConnectionId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.RejectVpcPeeringConnection(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ReleaseAddress() { - svc := ec2.New(session.New()) - - params := &ec2.ReleaseAddressInput{ - AllocationId: aws.String("String"), - DryRun: aws.Bool(true), - PublicIp: aws.String("String"), - } - resp, err := svc.ReleaseAddress(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ReleaseHosts() { - svc := ec2.New(session.New()) - - params := &ec2.ReleaseHostsInput{ - HostIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.ReleaseHosts(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ReplaceNetworkAclAssociation() { - svc := ec2.New(session.New()) - - params := &ec2.ReplaceNetworkAclAssociationInput{ - AssociationId: aws.String("String"), // Required - NetworkAclId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.ReplaceNetworkAclAssociation(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ReplaceNetworkAclEntry() { - svc := ec2.New(session.New()) - - params := &ec2.ReplaceNetworkAclEntryInput{ - CidrBlock: aws.String("String"), // Required - Egress: aws.Bool(true), // Required - NetworkAclId: aws.String("String"), // Required - Protocol: aws.String("String"), // Required - RuleAction: aws.String("RuleAction"), // Required - RuleNumber: aws.Int64(1), // Required - DryRun: aws.Bool(true), - IcmpTypeCode: &ec2.IcmpTypeCode{ - Code: aws.Int64(1), - Type: aws.Int64(1), - }, - PortRange: &ec2.PortRange{ - From: aws.Int64(1), - To: aws.Int64(1), - }, - } - resp, err := svc.ReplaceNetworkAclEntry(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ReplaceRoute() { - svc := ec2.New(session.New()) - - params := &ec2.ReplaceRouteInput{ - DestinationCidrBlock: aws.String("String"), // Required - RouteTableId: aws.String("String"), // Required - DryRun: aws.Bool(true), - GatewayId: aws.String("String"), - InstanceId: aws.String("String"), - NatGatewayId: aws.String("String"), - NetworkInterfaceId: aws.String("String"), - VpcPeeringConnectionId: aws.String("String"), - } - resp, err := svc.ReplaceRoute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ReplaceRouteTableAssociation() { - svc := ec2.New(session.New()) - - params := &ec2.ReplaceRouteTableAssociationInput{ - AssociationId: aws.String("String"), // Required - RouteTableId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.ReplaceRouteTableAssociation(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ReportInstanceStatus() { - svc := ec2.New(session.New()) - - params := &ec2.ReportInstanceStatusInput{ - Instances: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - ReasonCodes: []*string{ // Required - aws.String("ReportInstanceReasonCodes"), // Required - // More values... - }, - Status: aws.String("ReportStatusType"), // Required - Description: aws.String("String"), - DryRun: aws.Bool(true), - EndTime: aws.Time(time.Now()), - StartTime: aws.Time(time.Now()), - } - resp, err := svc.ReportInstanceStatus(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_RequestSpotFleet() { - svc := ec2.New(session.New()) - - params := &ec2.RequestSpotFleetInput{ - SpotFleetRequestConfig: &ec2.SpotFleetRequestConfigData{ // Required - IamFleetRole: aws.String("String"), // Required - LaunchSpecifications: []*ec2.SpotFleetLaunchSpecification{ // Required - { // Required - AddressingType: aws.String("String"), - BlockDeviceMappings: []*ec2.BlockDeviceMapping{ - { // Required - DeviceName: aws.String("String"), - Ebs: &ec2.EbsBlockDevice{ - DeleteOnTermination: aws.Bool(true), - Encrypted: aws.Bool(true), - Iops: aws.Int64(1), - SnapshotId: aws.String("String"), - VolumeSize: aws.Int64(1), - VolumeType: aws.String("VolumeType"), - }, - NoDevice: aws.String("String"), - VirtualName: aws.String("String"), - }, - // More values... - }, - EbsOptimized: aws.Bool(true), - IamInstanceProfile: &ec2.IamInstanceProfileSpecification{ - Arn: aws.String("String"), - Name: aws.String("String"), - }, - ImageId: aws.String("String"), - InstanceType: aws.String("InstanceType"), - KernelId: aws.String("String"), - KeyName: aws.String("String"), - Monitoring: &ec2.SpotFleetMonitoring{ - Enabled: aws.Bool(true), - }, - NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{ - { // Required - AssociatePublicIpAddress: aws.Bool(true), - DeleteOnTermination: aws.Bool(true), - Description: aws.String("String"), - DeviceIndex: aws.Int64(1), - Groups: []*string{ - aws.String("String"), // Required - // More values... - }, - NetworkInterfaceId: aws.String("String"), - PrivateIpAddress: aws.String("String"), - PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{ - { // Required - PrivateIpAddress: aws.String("String"), // Required - Primary: aws.Bool(true), - }, - // More values... - }, - SecondaryPrivateIpAddressCount: aws.Int64(1), - SubnetId: aws.String("String"), - }, - // More values... - }, - Placement: &ec2.SpotPlacement{ - AvailabilityZone: aws.String("String"), - GroupName: aws.String("String"), - }, - RamdiskId: aws.String("String"), - SecurityGroups: []*ec2.GroupIdentifier{ - { // Required - GroupId: aws.String("String"), - GroupName: aws.String("String"), - }, - // More values... - }, - SpotPrice: aws.String("String"), - SubnetId: aws.String("String"), - UserData: aws.String("String"), - WeightedCapacity: aws.Float64(1.0), - }, - // More values... - }, - SpotPrice: aws.String("String"), // Required - TargetCapacity: aws.Int64(1), // Required - AllocationStrategy: aws.String("AllocationStrategy"), - ClientToken: aws.String("String"), - ExcessCapacityTerminationPolicy: aws.String("ExcessCapacityTerminationPolicy"), - TerminateInstancesWithExpiration: aws.Bool(true), - ValidFrom: aws.Time(time.Now()), - ValidUntil: aws.Time(time.Now()), - }, - DryRun: aws.Bool(true), - } - resp, err := svc.RequestSpotFleet(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_RequestSpotInstances() { - svc := ec2.New(session.New()) - - params := &ec2.RequestSpotInstancesInput{ - SpotPrice: aws.String("String"), // Required - AvailabilityZoneGroup: aws.String("String"), - BlockDurationMinutes: aws.Int64(1), - ClientToken: aws.String("String"), - DryRun: aws.Bool(true), - InstanceCount: aws.Int64(1), - LaunchGroup: aws.String("String"), - LaunchSpecification: &ec2.RequestSpotLaunchSpecification{ - AddressingType: aws.String("String"), - BlockDeviceMappings: []*ec2.BlockDeviceMapping{ - { // Required - DeviceName: aws.String("String"), - Ebs: &ec2.EbsBlockDevice{ - DeleteOnTermination: aws.Bool(true), - Encrypted: aws.Bool(true), - Iops: aws.Int64(1), - SnapshotId: aws.String("String"), - VolumeSize: aws.Int64(1), - VolumeType: aws.String("VolumeType"), - }, - NoDevice: aws.String("String"), - VirtualName: aws.String("String"), - }, - // More values... - }, - EbsOptimized: aws.Bool(true), - IamInstanceProfile: &ec2.IamInstanceProfileSpecification{ - Arn: aws.String("String"), - Name: aws.String("String"), - }, - ImageId: aws.String("String"), - InstanceType: aws.String("InstanceType"), - KernelId: aws.String("String"), - KeyName: aws.String("String"), - Monitoring: &ec2.RunInstancesMonitoringEnabled{ - Enabled: aws.Bool(true), // Required - }, - NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{ - { // Required - AssociatePublicIpAddress: aws.Bool(true), - DeleteOnTermination: aws.Bool(true), - Description: aws.String("String"), - DeviceIndex: aws.Int64(1), - Groups: []*string{ - aws.String("String"), // Required - // More values... - }, - NetworkInterfaceId: aws.String("String"), - PrivateIpAddress: aws.String("String"), - PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{ - { // Required - PrivateIpAddress: aws.String("String"), // Required - Primary: aws.Bool(true), - }, - // More values... - }, - SecondaryPrivateIpAddressCount: aws.Int64(1), - SubnetId: aws.String("String"), - }, - // More values... - }, - Placement: &ec2.SpotPlacement{ - AvailabilityZone: aws.String("String"), - GroupName: aws.String("String"), - }, - RamdiskId: aws.String("String"), - SecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - SecurityGroups: []*string{ - aws.String("String"), // Required - // More values... - }, - SubnetId: aws.String("String"), - UserData: aws.String("String"), - }, - Type: aws.String("SpotInstanceType"), - ValidFrom: aws.Time(time.Now()), - ValidUntil: aws.Time(time.Now()), - } - resp, err := svc.RequestSpotInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ResetImageAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.ResetImageAttributeInput{ - Attribute: aws.String("ResetImageAttributeName"), // Required - ImageId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.ResetImageAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ResetInstanceAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.ResetInstanceAttributeInput{ - Attribute: aws.String("InstanceAttributeName"), // Required - InstanceId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.ResetInstanceAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ResetNetworkInterfaceAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.ResetNetworkInterfaceAttributeInput{ - NetworkInterfaceId: aws.String("String"), // Required - DryRun: aws.Bool(true), - SourceDestCheck: aws.String("String"), - } - resp, err := svc.ResetNetworkInterfaceAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_ResetSnapshotAttribute() { - svc := ec2.New(session.New()) - - params := &ec2.ResetSnapshotAttributeInput{ - Attribute: aws.String("SnapshotAttributeName"), // Required - SnapshotId: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.ResetSnapshotAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_RestoreAddressToClassic() { - svc := ec2.New(session.New()) - - params := &ec2.RestoreAddressToClassicInput{ - PublicIp: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.RestoreAddressToClassic(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_RevokeSecurityGroupEgress() { - svc := ec2.New(session.New()) - - params := &ec2.RevokeSecurityGroupEgressInput{ - GroupId: aws.String("String"), // Required - CidrIp: aws.String("String"), - DryRun: aws.Bool(true), - FromPort: aws.Int64(1), - IpPermissions: []*ec2.IpPermission{ - { // Required - FromPort: aws.Int64(1), - IpProtocol: aws.String("String"), - IpRanges: []*ec2.IpRange{ - { // Required - CidrIp: aws.String("String"), - }, - // More values... - }, - PrefixListIds: []*ec2.PrefixListId{ - { // Required - PrefixListId: aws.String("String"), - }, - // More values... - }, - ToPort: aws.Int64(1), - UserIdGroupPairs: []*ec2.UserIdGroupPair{ - { // Required - GroupId: aws.String("String"), - GroupName: aws.String("String"), - UserId: aws.String("String"), - }, - // More values... - }, - }, - // More values... - }, - IpProtocol: aws.String("String"), - SourceSecurityGroupName: aws.String("String"), - SourceSecurityGroupOwnerId: aws.String("String"), - ToPort: aws.Int64(1), - } - resp, err := svc.RevokeSecurityGroupEgress(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_RevokeSecurityGroupIngress() { - svc := ec2.New(session.New()) - - params := &ec2.RevokeSecurityGroupIngressInput{ - CidrIp: aws.String("String"), - DryRun: aws.Bool(true), - FromPort: aws.Int64(1), - GroupId: aws.String("String"), - GroupName: aws.String("String"), - IpPermissions: []*ec2.IpPermission{ - { // Required - FromPort: aws.Int64(1), - IpProtocol: aws.String("String"), - IpRanges: []*ec2.IpRange{ - { // Required - CidrIp: aws.String("String"), - }, - // More values... - }, - PrefixListIds: []*ec2.PrefixListId{ - { // Required - PrefixListId: aws.String("String"), - }, - // More values... - }, - ToPort: aws.Int64(1), - UserIdGroupPairs: []*ec2.UserIdGroupPair{ - { // Required - GroupId: aws.String("String"), - GroupName: aws.String("String"), - UserId: aws.String("String"), - }, - // More values... - }, - }, - // More values... - }, - IpProtocol: aws.String("String"), - SourceSecurityGroupName: aws.String("String"), - SourceSecurityGroupOwnerId: aws.String("String"), - ToPort: aws.Int64(1), - } - resp, err := svc.RevokeSecurityGroupIngress(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_RunInstances() { - svc := ec2.New(session.New()) - - params := &ec2.RunInstancesInput{ - ImageId: aws.String("String"), // Required - MaxCount: aws.Int64(1), // Required - MinCount: aws.Int64(1), // Required - AdditionalInfo: aws.String("String"), - BlockDeviceMappings: []*ec2.BlockDeviceMapping{ - { // Required - DeviceName: aws.String("String"), - Ebs: &ec2.EbsBlockDevice{ - DeleteOnTermination: aws.Bool(true), - Encrypted: aws.Bool(true), - Iops: aws.Int64(1), - SnapshotId: aws.String("String"), - VolumeSize: aws.Int64(1), - VolumeType: aws.String("VolumeType"), - }, - NoDevice: aws.String("String"), - VirtualName: aws.String("String"), - }, - // More values... - }, - ClientToken: aws.String("String"), - DisableApiTermination: aws.Bool(true), - DryRun: aws.Bool(true), - EbsOptimized: aws.Bool(true), - IamInstanceProfile: &ec2.IamInstanceProfileSpecification{ - Arn: aws.String("String"), - Name: aws.String("String"), - }, - InstanceInitiatedShutdownBehavior: aws.String("ShutdownBehavior"), - InstanceType: aws.String("InstanceType"), - KernelId: aws.String("String"), - KeyName: aws.String("String"), - Monitoring: &ec2.RunInstancesMonitoringEnabled{ - Enabled: aws.Bool(true), // Required - }, - NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{ - { // Required - AssociatePublicIpAddress: aws.Bool(true), - DeleteOnTermination: aws.Bool(true), - Description: aws.String("String"), - DeviceIndex: aws.Int64(1), - Groups: []*string{ - aws.String("String"), // Required - // More values... - }, - NetworkInterfaceId: aws.String("String"), - PrivateIpAddress: aws.String("String"), - PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{ - { // Required - PrivateIpAddress: aws.String("String"), // Required - Primary: aws.Bool(true), - }, - // More values... - }, - SecondaryPrivateIpAddressCount: aws.Int64(1), - SubnetId: aws.String("String"), - }, - // More values... - }, - Placement: &ec2.Placement{ - Affinity: aws.String("String"), - AvailabilityZone: aws.String("String"), - GroupName: aws.String("String"), - HostId: aws.String("String"), - Tenancy: aws.String("Tenancy"), - }, - PrivateIpAddress: aws.String("String"), - RamdiskId: aws.String("String"), - SecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - SecurityGroups: []*string{ - aws.String("String"), // Required - // More values... - }, - SubnetId: aws.String("String"), - UserData: aws.String("String"), - } - resp, err := svc.RunInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_RunScheduledInstances() { - svc := ec2.New(session.New()) - - params := &ec2.RunScheduledInstancesInput{ - LaunchSpecification: &ec2.ScheduledInstancesLaunchSpecification{ // Required - ImageId: aws.String("String"), // Required - BlockDeviceMappings: []*ec2.ScheduledInstancesBlockDeviceMapping{ - { // Required - DeviceName: aws.String("String"), - Ebs: &ec2.ScheduledInstancesEbs{ - DeleteOnTermination: aws.Bool(true), - Encrypted: aws.Bool(true), - Iops: aws.Int64(1), - SnapshotId: aws.String("String"), - VolumeSize: aws.Int64(1), - VolumeType: aws.String("String"), - }, - NoDevice: aws.String("String"), - VirtualName: aws.String("String"), - }, - // More values... - }, - EbsOptimized: aws.Bool(true), - IamInstanceProfile: &ec2.ScheduledInstancesIamInstanceProfile{ - Arn: aws.String("String"), - Name: aws.String("String"), - }, - InstanceType: aws.String("String"), - KernelId: aws.String("String"), - KeyName: aws.String("String"), - Monitoring: &ec2.ScheduledInstancesMonitoring{ - Enabled: aws.Bool(true), - }, - NetworkInterfaces: []*ec2.ScheduledInstancesNetworkInterface{ - { // Required - AssociatePublicIpAddress: aws.Bool(true), - DeleteOnTermination: aws.Bool(true), - Description: aws.String("String"), - DeviceIndex: aws.Int64(1), - Groups: []*string{ - aws.String("String"), // Required - // More values... - }, - NetworkInterfaceId: aws.String("String"), - PrivateIpAddress: aws.String("String"), - PrivateIpAddressConfigs: []*ec2.ScheduledInstancesPrivateIpAddressConfig{ - { // Required - Primary: aws.Bool(true), - PrivateIpAddress: aws.String("String"), - }, - // More values... - }, - SecondaryPrivateIpAddressCount: aws.Int64(1), - SubnetId: aws.String("String"), - }, - // More values... - }, - Placement: &ec2.ScheduledInstancesPlacement{ - AvailabilityZone: aws.String("String"), - GroupName: aws.String("String"), - }, - RamdiskId: aws.String("String"), - SecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - SubnetId: aws.String("String"), - UserData: aws.String("String"), - }, - ScheduledInstanceId: aws.String("String"), // Required - ClientToken: aws.String("String"), - DryRun: aws.Bool(true), - InstanceCount: aws.Int64(1), - } - resp, err := svc.RunScheduledInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_StartInstances() { - svc := ec2.New(session.New()) - - params := &ec2.StartInstancesInput{ - InstanceIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - AdditionalInfo: aws.String("String"), - DryRun: aws.Bool(true), - } - resp, err := svc.StartInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_StopInstances() { - svc := ec2.New(session.New()) - - params := &ec2.StopInstancesInput{ - InstanceIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - DryRun: aws.Bool(true), - Force: aws.Bool(true), - } - resp, err := svc.StopInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_TerminateInstances() { - svc := ec2.New(session.New()) - - params := &ec2.TerminateInstancesInput{ - InstanceIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - DryRun: aws.Bool(true), - } - resp, err := svc.TerminateInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_UnassignPrivateIpAddresses() { - svc := ec2.New(session.New()) - - params := &ec2.UnassignPrivateIpAddressesInput{ - NetworkInterfaceId: aws.String("String"), // Required - PrivateIpAddresses: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.UnassignPrivateIpAddresses(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEC2_UnmonitorInstances() { - svc := ec2.New(session.New()) - - params := &ec2.UnmonitorInstancesInput{ - InstanceIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - DryRun: aws.Bool(true), - } - resp, err := svc.UnmonitorInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/ecr/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/ecr/examples_test.go deleted file mode 100644 index 95e088baee..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/ecr/examples_test.go +++ /dev/null @@ -1,376 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package ecr_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/ecr" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleECR_BatchCheckLayerAvailability() { - svc := ecr.New(session.New()) - - params := &ecr.BatchCheckLayerAvailabilityInput{ - LayerDigests: []*string{ // Required - aws.String("BatchedOperationLayerDigest"), // Required - // More values... - }, - RepositoryName: aws.String("RepositoryName"), // Required - RegistryId: aws.String("RegistryId"), - } - resp, err := svc.BatchCheckLayerAvailability(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECR_BatchDeleteImage() { - svc := ecr.New(session.New()) - - params := &ecr.BatchDeleteImageInput{ - ImageIds: []*ecr.ImageIdentifier{ // Required - { // Required - ImageDigest: aws.String("ImageDigest"), - ImageTag: aws.String("ImageTag"), - }, - // More values... - }, - RepositoryName: aws.String("RepositoryName"), // Required - RegistryId: aws.String("RegistryId"), - } - resp, err := svc.BatchDeleteImage(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECR_BatchGetImage() { - svc := ecr.New(session.New()) - - params := &ecr.BatchGetImageInput{ - ImageIds: []*ecr.ImageIdentifier{ // Required - { // Required - ImageDigest: aws.String("ImageDigest"), - ImageTag: aws.String("ImageTag"), - }, - // More values... - }, - RepositoryName: aws.String("RepositoryName"), // Required - RegistryId: aws.String("RegistryId"), - } - resp, err := svc.BatchGetImage(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECR_CompleteLayerUpload() { - svc := ecr.New(session.New()) - - params := &ecr.CompleteLayerUploadInput{ - LayerDigests: []*string{ // Required - aws.String("LayerDigest"), // Required - // More values... - }, - RepositoryName: aws.String("RepositoryName"), // Required - UploadId: aws.String("UploadId"), // Required - RegistryId: aws.String("RegistryId"), - } - resp, err := svc.CompleteLayerUpload(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECR_CreateRepository() { - svc := ecr.New(session.New()) - - params := &ecr.CreateRepositoryInput{ - RepositoryName: aws.String("RepositoryName"), // Required - } - resp, err := svc.CreateRepository(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECR_DeleteRepository() { - svc := ecr.New(session.New()) - - params := &ecr.DeleteRepositoryInput{ - RepositoryName: aws.String("RepositoryName"), // Required - Force: aws.Bool(true), - RegistryId: aws.String("RegistryId"), - } - resp, err := svc.DeleteRepository(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECR_DeleteRepositoryPolicy() { - svc := ecr.New(session.New()) - - params := &ecr.DeleteRepositoryPolicyInput{ - RepositoryName: aws.String("RepositoryName"), // Required - RegistryId: aws.String("RegistryId"), - } - resp, err := svc.DeleteRepositoryPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECR_DescribeRepositories() { - svc := ecr.New(session.New()) - - params := &ecr.DescribeRepositoriesInput{ - MaxResults: aws.Int64(1), - NextToken: aws.String("NextToken"), - RegistryId: aws.String("RegistryId"), - RepositoryNames: []*string{ - aws.String("RepositoryName"), // Required - // More values... - }, - } - resp, err := svc.DescribeRepositories(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECR_GetAuthorizationToken() { - svc := ecr.New(session.New()) - - params := &ecr.GetAuthorizationTokenInput{ - RegistryIds: []*string{ - aws.String("RegistryId"), // Required - // More values... - }, - } - resp, err := svc.GetAuthorizationToken(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECR_GetDownloadUrlForLayer() { - svc := ecr.New(session.New()) - - params := &ecr.GetDownloadUrlForLayerInput{ - LayerDigest: aws.String("LayerDigest"), // Required - RepositoryName: aws.String("RepositoryName"), // Required - RegistryId: aws.String("RegistryId"), - } - resp, err := svc.GetDownloadUrlForLayer(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECR_GetRepositoryPolicy() { - svc := ecr.New(session.New()) - - params := &ecr.GetRepositoryPolicyInput{ - RepositoryName: aws.String("RepositoryName"), // Required - RegistryId: aws.String("RegistryId"), - } - resp, err := svc.GetRepositoryPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECR_InitiateLayerUpload() { - svc := ecr.New(session.New()) - - params := &ecr.InitiateLayerUploadInput{ - RepositoryName: aws.String("RepositoryName"), // Required - RegistryId: aws.String("RegistryId"), - } - resp, err := svc.InitiateLayerUpload(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECR_ListImages() { - svc := ecr.New(session.New()) - - params := &ecr.ListImagesInput{ - RepositoryName: aws.String("RepositoryName"), // Required - MaxResults: aws.Int64(1), - NextToken: aws.String("NextToken"), - RegistryId: aws.String("RegistryId"), - } - resp, err := svc.ListImages(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECR_PutImage() { - svc := ecr.New(session.New()) - - params := &ecr.PutImageInput{ - ImageManifest: aws.String("ImageManifest"), // Required - RepositoryName: aws.String("RepositoryName"), // Required - RegistryId: aws.String("RegistryId"), - } - resp, err := svc.PutImage(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECR_SetRepositoryPolicy() { - svc := ecr.New(session.New()) - - params := &ecr.SetRepositoryPolicyInput{ - PolicyText: aws.String("RepositoryPolicyText"), // Required - RepositoryName: aws.String("RepositoryName"), // Required - Force: aws.Bool(true), - RegistryId: aws.String("RegistryId"), - } - resp, err := svc.SetRepositoryPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECR_UploadLayerPart() { - svc := ecr.New(session.New()) - - params := &ecr.UploadLayerPartInput{ - LayerPartBlob: []byte("PAYLOAD"), // Required - PartFirstByte: aws.Int64(1), // Required - PartLastByte: aws.Int64(1), // Required - RepositoryName: aws.String("RepositoryName"), // Required - UploadId: aws.String("UploadId"), // Required - RegistryId: aws.String("RegistryId"), - } - resp, err := svc.UploadLayerPart(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/ecs/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/ecs/examples_test.go deleted file mode 100644 index 2afd3a8af5..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/ecs/examples_test.go +++ /dev/null @@ -1,791 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package ecs_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/ecs" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleECS_CreateCluster() { - svc := ecs.New(session.New()) - - params := &ecs.CreateClusterInput{ - ClusterName: aws.String("String"), - } - resp, err := svc.CreateCluster(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_CreateService() { - svc := ecs.New(session.New()) - - params := &ecs.CreateServiceInput{ - DesiredCount: aws.Int64(1), // Required - ServiceName: aws.String("String"), // Required - TaskDefinition: aws.String("String"), // Required - ClientToken: aws.String("String"), - Cluster: aws.String("String"), - DeploymentConfiguration: &ecs.DeploymentConfiguration{ - MaximumPercent: aws.Int64(1), - MinimumHealthyPercent: aws.Int64(1), - }, - LoadBalancers: []*ecs.LoadBalancer{ - { // Required - ContainerName: aws.String("String"), - ContainerPort: aws.Int64(1), - LoadBalancerName: aws.String("String"), - }, - // More values... - }, - Role: aws.String("String"), - } - resp, err := svc.CreateService(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_DeleteCluster() { - svc := ecs.New(session.New()) - - params := &ecs.DeleteClusterInput{ - Cluster: aws.String("String"), // Required - } - resp, err := svc.DeleteCluster(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_DeleteService() { - svc := ecs.New(session.New()) - - params := &ecs.DeleteServiceInput{ - Service: aws.String("String"), // Required - Cluster: aws.String("String"), - } - resp, err := svc.DeleteService(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_DeregisterContainerInstance() { - svc := ecs.New(session.New()) - - params := &ecs.DeregisterContainerInstanceInput{ - ContainerInstance: aws.String("String"), // Required - Cluster: aws.String("String"), - Force: aws.Bool(true), - } - resp, err := svc.DeregisterContainerInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_DeregisterTaskDefinition() { - svc := ecs.New(session.New()) - - params := &ecs.DeregisterTaskDefinitionInput{ - TaskDefinition: aws.String("String"), // Required - } - resp, err := svc.DeregisterTaskDefinition(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_DescribeClusters() { - svc := ecs.New(session.New()) - - params := &ecs.DescribeClustersInput{ - Clusters: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeClusters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_DescribeContainerInstances() { - svc := ecs.New(session.New()) - - params := &ecs.DescribeContainerInstancesInput{ - ContainerInstances: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - Cluster: aws.String("String"), - } - resp, err := svc.DescribeContainerInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_DescribeServices() { - svc := ecs.New(session.New()) - - params := &ecs.DescribeServicesInput{ - Services: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - Cluster: aws.String("String"), - } - resp, err := svc.DescribeServices(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_DescribeTaskDefinition() { - svc := ecs.New(session.New()) - - params := &ecs.DescribeTaskDefinitionInput{ - TaskDefinition: aws.String("String"), // Required - } - resp, err := svc.DescribeTaskDefinition(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_DescribeTasks() { - svc := ecs.New(session.New()) - - params := &ecs.DescribeTasksInput{ - Tasks: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - Cluster: aws.String("String"), - } - resp, err := svc.DescribeTasks(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_DiscoverPollEndpoint() { - svc := ecs.New(session.New()) - - params := &ecs.DiscoverPollEndpointInput{ - Cluster: aws.String("String"), - ContainerInstance: aws.String("String"), - } - resp, err := svc.DiscoverPollEndpoint(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_ListClusters() { - svc := ecs.New(session.New()) - - params := &ecs.ListClustersInput{ - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.ListClusters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_ListContainerInstances() { - svc := ecs.New(session.New()) - - params := &ecs.ListContainerInstancesInput{ - Cluster: aws.String("String"), - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.ListContainerInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_ListServices() { - svc := ecs.New(session.New()) - - params := &ecs.ListServicesInput{ - Cluster: aws.String("String"), - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.ListServices(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_ListTaskDefinitionFamilies() { - svc := ecs.New(session.New()) - - params := &ecs.ListTaskDefinitionFamiliesInput{ - FamilyPrefix: aws.String("String"), - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.ListTaskDefinitionFamilies(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_ListTaskDefinitions() { - svc := ecs.New(session.New()) - - params := &ecs.ListTaskDefinitionsInput{ - FamilyPrefix: aws.String("String"), - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - Sort: aws.String("SortOrder"), - Status: aws.String("TaskDefinitionStatus"), - } - resp, err := svc.ListTaskDefinitions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_ListTasks() { - svc := ecs.New(session.New()) - - params := &ecs.ListTasksInput{ - Cluster: aws.String("String"), - ContainerInstance: aws.String("String"), - DesiredStatus: aws.String("DesiredStatus"), - Family: aws.String("String"), - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - ServiceName: aws.String("String"), - StartedBy: aws.String("String"), - } - resp, err := svc.ListTasks(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_RegisterContainerInstance() { - svc := ecs.New(session.New()) - - params := &ecs.RegisterContainerInstanceInput{ - Attributes: []*ecs.Attribute{ - { // Required - Name: aws.String("String"), // Required - Value: aws.String("String"), - }, - // More values... - }, - Cluster: aws.String("String"), - ContainerInstanceArn: aws.String("String"), - InstanceIdentityDocument: aws.String("String"), - InstanceIdentityDocumentSignature: aws.String("String"), - TotalResources: []*ecs.Resource{ - { // Required - DoubleValue: aws.Float64(1.0), - IntegerValue: aws.Int64(1), - LongValue: aws.Int64(1), - Name: aws.String("String"), - StringSetValue: []*string{ - aws.String("String"), // Required - // More values... - }, - Type: aws.String("String"), - }, - // More values... - }, - VersionInfo: &ecs.VersionInfo{ - AgentHash: aws.String("String"), - AgentVersion: aws.String("String"), - DockerVersion: aws.String("String"), - }, - } - resp, err := svc.RegisterContainerInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_RegisterTaskDefinition() { - svc := ecs.New(session.New()) - - params := &ecs.RegisterTaskDefinitionInput{ - ContainerDefinitions: []*ecs.ContainerDefinition{ // Required - { // Required - Command: []*string{ - aws.String("String"), // Required - // More values... - }, - Cpu: aws.Int64(1), - DisableNetworking: aws.Bool(true), - DnsSearchDomains: []*string{ - aws.String("String"), // Required - // More values... - }, - DnsServers: []*string{ - aws.String("String"), // Required - // More values... - }, - DockerLabels: map[string]*string{ - "Key": aws.String("String"), // Required - // More values... - }, - DockerSecurityOptions: []*string{ - aws.String("String"), // Required - // More values... - }, - EntryPoint: []*string{ - aws.String("String"), // Required - // More values... - }, - Environment: []*ecs.KeyValuePair{ - { // Required - Name: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - Essential: aws.Bool(true), - ExtraHosts: []*ecs.HostEntry{ - { // Required - Hostname: aws.String("String"), // Required - IpAddress: aws.String("String"), // Required - }, - // More values... - }, - Hostname: aws.String("String"), - Image: aws.String("String"), - Links: []*string{ - aws.String("String"), // Required - // More values... - }, - LogConfiguration: &ecs.LogConfiguration{ - LogDriver: aws.String("LogDriver"), // Required - Options: map[string]*string{ - "Key": aws.String("String"), // Required - // More values... - }, - }, - Memory: aws.Int64(1), - MountPoints: []*ecs.MountPoint{ - { // Required - ContainerPath: aws.String("String"), - ReadOnly: aws.Bool(true), - SourceVolume: aws.String("String"), - }, - // More values... - }, - Name: aws.String("String"), - PortMappings: []*ecs.PortMapping{ - { // Required - ContainerPort: aws.Int64(1), - HostPort: aws.Int64(1), - Protocol: aws.String("TransportProtocol"), - }, - // More values... - }, - Privileged: aws.Bool(true), - ReadonlyRootFilesystem: aws.Bool(true), - Ulimits: []*ecs.Ulimit{ - { // Required - HardLimit: aws.Int64(1), // Required - Name: aws.String("UlimitName"), // Required - SoftLimit: aws.Int64(1), // Required - }, - // More values... - }, - User: aws.String("String"), - VolumesFrom: []*ecs.VolumeFrom{ - { // Required - ReadOnly: aws.Bool(true), - SourceContainer: aws.String("String"), - }, - // More values... - }, - WorkingDirectory: aws.String("String"), - }, - // More values... - }, - Family: aws.String("String"), // Required - Volumes: []*ecs.Volume{ - { // Required - Host: &ecs.HostVolumeProperties{ - SourcePath: aws.String("String"), - }, - Name: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.RegisterTaskDefinition(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_RunTask() { - svc := ecs.New(session.New()) - - params := &ecs.RunTaskInput{ - TaskDefinition: aws.String("String"), // Required - Cluster: aws.String("String"), - Count: aws.Int64(1), - Overrides: &ecs.TaskOverride{ - ContainerOverrides: []*ecs.ContainerOverride{ - { // Required - Command: []*string{ - aws.String("String"), // Required - // More values... - }, - Environment: []*ecs.KeyValuePair{ - { // Required - Name: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - Name: aws.String("String"), - }, - // More values... - }, - }, - StartedBy: aws.String("String"), - } - resp, err := svc.RunTask(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_StartTask() { - svc := ecs.New(session.New()) - - params := &ecs.StartTaskInput{ - ContainerInstances: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - TaskDefinition: aws.String("String"), // Required - Cluster: aws.String("String"), - Overrides: &ecs.TaskOverride{ - ContainerOverrides: []*ecs.ContainerOverride{ - { // Required - Command: []*string{ - aws.String("String"), // Required - // More values... - }, - Environment: []*ecs.KeyValuePair{ - { // Required - Name: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - Name: aws.String("String"), - }, - // More values... - }, - }, - StartedBy: aws.String("String"), - } - resp, err := svc.StartTask(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_StopTask() { - svc := ecs.New(session.New()) - - params := &ecs.StopTaskInput{ - Task: aws.String("String"), // Required - Cluster: aws.String("String"), - Reason: aws.String("String"), - } - resp, err := svc.StopTask(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_SubmitContainerStateChange() { - svc := ecs.New(session.New()) - - params := &ecs.SubmitContainerStateChangeInput{ - Cluster: aws.String("String"), - ContainerName: aws.String("String"), - ExitCode: aws.Int64(1), - NetworkBindings: []*ecs.NetworkBinding{ - { // Required - BindIP: aws.String("String"), - ContainerPort: aws.Int64(1), - HostPort: aws.Int64(1), - Protocol: aws.String("TransportProtocol"), - }, - // More values... - }, - Reason: aws.String("String"), - Status: aws.String("String"), - Task: aws.String("String"), - } - resp, err := svc.SubmitContainerStateChange(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_SubmitTaskStateChange() { - svc := ecs.New(session.New()) - - params := &ecs.SubmitTaskStateChangeInput{ - Cluster: aws.String("String"), - Reason: aws.String("String"), - Status: aws.String("String"), - Task: aws.String("String"), - } - resp, err := svc.SubmitTaskStateChange(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_UpdateContainerAgent() { - svc := ecs.New(session.New()) - - params := &ecs.UpdateContainerAgentInput{ - ContainerInstance: aws.String("String"), // Required - Cluster: aws.String("String"), - } - resp, err := svc.UpdateContainerAgent(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleECS_UpdateService() { - svc := ecs.New(session.New()) - - params := &ecs.UpdateServiceInput{ - Service: aws.String("String"), // Required - Cluster: aws.String("String"), - DeploymentConfiguration: &ecs.DeploymentConfiguration{ - MaximumPercent: aws.Int64(1), - MinimumHealthyPercent: aws.Int64(1), - }, - DesiredCount: aws.Int64(1), - TaskDefinition: aws.String("String"), - } - resp, err := svc.UpdateService(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/efs/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/efs/examples_test.go deleted file mode 100644 index 85907f9361..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/efs/examples_test.go +++ /dev/null @@ -1,254 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package efs_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/efs" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleEFS_CreateFileSystem() { - svc := efs.New(session.New()) - - params := &efs.CreateFileSystemInput{ - CreationToken: aws.String("CreationToken"), // Required - } - resp, err := svc.CreateFileSystem(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEFS_CreateMountTarget() { - svc := efs.New(session.New()) - - params := &efs.CreateMountTargetInput{ - FileSystemId: aws.String("FileSystemId"), // Required - SubnetId: aws.String("SubnetId"), // Required - IpAddress: aws.String("IpAddress"), - SecurityGroups: []*string{ - aws.String("SecurityGroup"), // Required - // More values... - }, - } - resp, err := svc.CreateMountTarget(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEFS_CreateTags() { - svc := efs.New(session.New()) - - params := &efs.CreateTagsInput{ - FileSystemId: aws.String("FileSystemId"), // Required - Tags: []*efs.Tag{ // Required - { // Required - Key: aws.String("TagKey"), // Required - Value: aws.String("TagValue"), // Required - }, - // More values... - }, - } - resp, err := svc.CreateTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEFS_DeleteFileSystem() { - svc := efs.New(session.New()) - - params := &efs.DeleteFileSystemInput{ - FileSystemId: aws.String("FileSystemId"), // Required - } - resp, err := svc.DeleteFileSystem(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEFS_DeleteMountTarget() { - svc := efs.New(session.New()) - - params := &efs.DeleteMountTargetInput{ - MountTargetId: aws.String("MountTargetId"), // Required - } - resp, err := svc.DeleteMountTarget(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEFS_DeleteTags() { - svc := efs.New(session.New()) - - params := &efs.DeleteTagsInput{ - FileSystemId: aws.String("FileSystemId"), // Required - TagKeys: []*string{ // Required - aws.String("TagKey"), // Required - // More values... - }, - } - resp, err := svc.DeleteTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEFS_DescribeFileSystems() { - svc := efs.New(session.New()) - - params := &efs.DescribeFileSystemsInput{ - CreationToken: aws.String("CreationToken"), - FileSystemId: aws.String("FileSystemId"), - Marker: aws.String("Marker"), - MaxItems: aws.Int64(1), - } - resp, err := svc.DescribeFileSystems(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEFS_DescribeMountTargetSecurityGroups() { - svc := efs.New(session.New()) - - params := &efs.DescribeMountTargetSecurityGroupsInput{ - MountTargetId: aws.String("MountTargetId"), // Required - } - resp, err := svc.DescribeMountTargetSecurityGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEFS_DescribeMountTargets() { - svc := efs.New(session.New()) - - params := &efs.DescribeMountTargetsInput{ - FileSystemId: aws.String("FileSystemId"), - Marker: aws.String("Marker"), - MaxItems: aws.Int64(1), - MountTargetId: aws.String("MountTargetId"), - } - resp, err := svc.DescribeMountTargets(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEFS_DescribeTags() { - svc := efs.New(session.New()) - - params := &efs.DescribeTagsInput{ - FileSystemId: aws.String("FileSystemId"), // Required - Marker: aws.String("Marker"), - MaxItems: aws.Int64(1), - } - resp, err := svc.DescribeTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleEFS_ModifyMountTargetSecurityGroups() { - svc := efs.New(session.New()) - - params := &efs.ModifyMountTargetSecurityGroupsInput{ - MountTargetId: aws.String("MountTargetId"), // Required - SecurityGroups: []*string{ - aws.String("SecurityGroup"), // Required - // More values... - }, - } - resp, err := svc.ModifyMountTargetSecurityGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/elasticache/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/elasticache/examples_test.go deleted file mode 100644 index 886c755970..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elasticache/examples_test.go +++ /dev/null @@ -1,943 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package elasticache_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/elasticache" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleElastiCache_AddTagsToResource() { - svc := elasticache.New(session.New()) - - params := &elasticache.AddTagsToResourceInput{ - ResourceName: aws.String("String"), // Required - Tags: []*elasticache.Tag{ // Required - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.AddTagsToResource(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_AuthorizeCacheSecurityGroupIngress() { - svc := elasticache.New(session.New()) - - params := &elasticache.AuthorizeCacheSecurityGroupIngressInput{ - CacheSecurityGroupName: aws.String("String"), // Required - EC2SecurityGroupName: aws.String("String"), // Required - EC2SecurityGroupOwnerId: aws.String("String"), // Required - } - resp, err := svc.AuthorizeCacheSecurityGroupIngress(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_CopySnapshot() { - svc := elasticache.New(session.New()) - - params := &elasticache.CopySnapshotInput{ - SourceSnapshotName: aws.String("String"), // Required - TargetSnapshotName: aws.String("String"), // Required - } - resp, err := svc.CopySnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_CreateCacheCluster() { - svc := elasticache.New(session.New()) - - params := &elasticache.CreateCacheClusterInput{ - CacheClusterId: aws.String("String"), // Required - AZMode: aws.String("AZMode"), - AutoMinorVersionUpgrade: aws.Bool(true), - CacheNodeType: aws.String("String"), - CacheParameterGroupName: aws.String("String"), - CacheSecurityGroupNames: []*string{ - aws.String("String"), // Required - // More values... - }, - CacheSubnetGroupName: aws.String("String"), - Engine: aws.String("String"), - EngineVersion: aws.String("String"), - NotificationTopicArn: aws.String("String"), - NumCacheNodes: aws.Int64(1), - Port: aws.Int64(1), - PreferredAvailabilityZone: aws.String("String"), - PreferredAvailabilityZones: []*string{ - aws.String("String"), // Required - // More values... - }, - PreferredMaintenanceWindow: aws.String("String"), - ReplicationGroupId: aws.String("String"), - SecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - SnapshotArns: []*string{ - aws.String("String"), // Required - // More values... - }, - SnapshotName: aws.String("String"), - SnapshotRetentionLimit: aws.Int64(1), - SnapshotWindow: aws.String("String"), - Tags: []*elasticache.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateCacheCluster(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_CreateCacheParameterGroup() { - svc := elasticache.New(session.New()) - - params := &elasticache.CreateCacheParameterGroupInput{ - CacheParameterGroupFamily: aws.String("String"), // Required - CacheParameterGroupName: aws.String("String"), // Required - Description: aws.String("String"), // Required - } - resp, err := svc.CreateCacheParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_CreateCacheSecurityGroup() { - svc := elasticache.New(session.New()) - - params := &elasticache.CreateCacheSecurityGroupInput{ - CacheSecurityGroupName: aws.String("String"), // Required - Description: aws.String("String"), // Required - } - resp, err := svc.CreateCacheSecurityGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_CreateCacheSubnetGroup() { - svc := elasticache.New(session.New()) - - params := &elasticache.CreateCacheSubnetGroupInput{ - CacheSubnetGroupDescription: aws.String("String"), // Required - CacheSubnetGroupName: aws.String("String"), // Required - SubnetIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.CreateCacheSubnetGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_CreateReplicationGroup() { - svc := elasticache.New(session.New()) - - params := &elasticache.CreateReplicationGroupInput{ - ReplicationGroupDescription: aws.String("String"), // Required - ReplicationGroupId: aws.String("String"), // Required - AutoMinorVersionUpgrade: aws.Bool(true), - AutomaticFailoverEnabled: aws.Bool(true), - CacheNodeType: aws.String("String"), - CacheParameterGroupName: aws.String("String"), - CacheSecurityGroupNames: []*string{ - aws.String("String"), // Required - // More values... - }, - CacheSubnetGroupName: aws.String("String"), - Engine: aws.String("String"), - EngineVersion: aws.String("String"), - NotificationTopicArn: aws.String("String"), - NumCacheClusters: aws.Int64(1), - Port: aws.Int64(1), - PreferredCacheClusterAZs: []*string{ - aws.String("String"), // Required - // More values... - }, - PreferredMaintenanceWindow: aws.String("String"), - PrimaryClusterId: aws.String("String"), - SecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - SnapshotArns: []*string{ - aws.String("String"), // Required - // More values... - }, - SnapshotName: aws.String("String"), - SnapshotRetentionLimit: aws.Int64(1), - SnapshotWindow: aws.String("String"), - Tags: []*elasticache.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateReplicationGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_CreateSnapshot() { - svc := elasticache.New(session.New()) - - params := &elasticache.CreateSnapshotInput{ - CacheClusterId: aws.String("String"), // Required - SnapshotName: aws.String("String"), // Required - } - resp, err := svc.CreateSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DeleteCacheCluster() { - svc := elasticache.New(session.New()) - - params := &elasticache.DeleteCacheClusterInput{ - CacheClusterId: aws.String("String"), // Required - FinalSnapshotIdentifier: aws.String("String"), - } - resp, err := svc.DeleteCacheCluster(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DeleteCacheParameterGroup() { - svc := elasticache.New(session.New()) - - params := &elasticache.DeleteCacheParameterGroupInput{ - CacheParameterGroupName: aws.String("String"), // Required - } - resp, err := svc.DeleteCacheParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DeleteCacheSecurityGroup() { - svc := elasticache.New(session.New()) - - params := &elasticache.DeleteCacheSecurityGroupInput{ - CacheSecurityGroupName: aws.String("String"), // Required - } - resp, err := svc.DeleteCacheSecurityGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DeleteCacheSubnetGroup() { - svc := elasticache.New(session.New()) - - params := &elasticache.DeleteCacheSubnetGroupInput{ - CacheSubnetGroupName: aws.String("String"), // Required - } - resp, err := svc.DeleteCacheSubnetGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DeleteReplicationGroup() { - svc := elasticache.New(session.New()) - - params := &elasticache.DeleteReplicationGroupInput{ - ReplicationGroupId: aws.String("String"), // Required - FinalSnapshotIdentifier: aws.String("String"), - RetainPrimaryCluster: aws.Bool(true), - } - resp, err := svc.DeleteReplicationGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DeleteSnapshot() { - svc := elasticache.New(session.New()) - - params := &elasticache.DeleteSnapshotInput{ - SnapshotName: aws.String("String"), // Required - } - resp, err := svc.DeleteSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DescribeCacheClusters() { - svc := elasticache.New(session.New()) - - params := &elasticache.DescribeCacheClustersInput{ - CacheClusterId: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - ShowCacheNodeInfo: aws.Bool(true), - } - resp, err := svc.DescribeCacheClusters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DescribeCacheEngineVersions() { - svc := elasticache.New(session.New()) - - params := &elasticache.DescribeCacheEngineVersionsInput{ - CacheParameterGroupFamily: aws.String("String"), - DefaultOnly: aws.Bool(true), - Engine: aws.String("String"), - EngineVersion: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeCacheEngineVersions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DescribeCacheParameterGroups() { - svc := elasticache.New(session.New()) - - params := &elasticache.DescribeCacheParameterGroupsInput{ - CacheParameterGroupName: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeCacheParameterGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DescribeCacheParameters() { - svc := elasticache.New(session.New()) - - params := &elasticache.DescribeCacheParametersInput{ - CacheParameterGroupName: aws.String("String"), // Required - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - Source: aws.String("String"), - } - resp, err := svc.DescribeCacheParameters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DescribeCacheSecurityGroups() { - svc := elasticache.New(session.New()) - - params := &elasticache.DescribeCacheSecurityGroupsInput{ - CacheSecurityGroupName: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeCacheSecurityGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DescribeCacheSubnetGroups() { - svc := elasticache.New(session.New()) - - params := &elasticache.DescribeCacheSubnetGroupsInput{ - CacheSubnetGroupName: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeCacheSubnetGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DescribeEngineDefaultParameters() { - svc := elasticache.New(session.New()) - - params := &elasticache.DescribeEngineDefaultParametersInput{ - CacheParameterGroupFamily: aws.String("String"), // Required - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeEngineDefaultParameters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DescribeEvents() { - svc := elasticache.New(session.New()) - - params := &elasticache.DescribeEventsInput{ - Duration: aws.Int64(1), - EndTime: aws.Time(time.Now()), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - SourceIdentifier: aws.String("String"), - SourceType: aws.String("SourceType"), - StartTime: aws.Time(time.Now()), - } - resp, err := svc.DescribeEvents(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DescribeReplicationGroups() { - svc := elasticache.New(session.New()) - - params := &elasticache.DescribeReplicationGroupsInput{ - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - ReplicationGroupId: aws.String("String"), - } - resp, err := svc.DescribeReplicationGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DescribeReservedCacheNodes() { - svc := elasticache.New(session.New()) - - params := &elasticache.DescribeReservedCacheNodesInput{ - CacheNodeType: aws.String("String"), - Duration: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - OfferingType: aws.String("String"), - ProductDescription: aws.String("String"), - ReservedCacheNodeId: aws.String("String"), - ReservedCacheNodesOfferingId: aws.String("String"), - } - resp, err := svc.DescribeReservedCacheNodes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DescribeReservedCacheNodesOfferings() { - svc := elasticache.New(session.New()) - - params := &elasticache.DescribeReservedCacheNodesOfferingsInput{ - CacheNodeType: aws.String("String"), - Duration: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - OfferingType: aws.String("String"), - ProductDescription: aws.String("String"), - ReservedCacheNodesOfferingId: aws.String("String"), - } - resp, err := svc.DescribeReservedCacheNodesOfferings(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_DescribeSnapshots() { - svc := elasticache.New(session.New()) - - params := &elasticache.DescribeSnapshotsInput{ - CacheClusterId: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - SnapshotName: aws.String("String"), - SnapshotSource: aws.String("String"), - } - resp, err := svc.DescribeSnapshots(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_ListTagsForResource() { - svc := elasticache.New(session.New()) - - params := &elasticache.ListTagsForResourceInput{ - ResourceName: aws.String("String"), // Required - } - resp, err := svc.ListTagsForResource(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_ModifyCacheCluster() { - svc := elasticache.New(session.New()) - - params := &elasticache.ModifyCacheClusterInput{ - CacheClusterId: aws.String("String"), // Required - AZMode: aws.String("AZMode"), - ApplyImmediately: aws.Bool(true), - AutoMinorVersionUpgrade: aws.Bool(true), - CacheNodeIdsToRemove: []*string{ - aws.String("String"), // Required - // More values... - }, - CacheParameterGroupName: aws.String("String"), - CacheSecurityGroupNames: []*string{ - aws.String("String"), // Required - // More values... - }, - EngineVersion: aws.String("String"), - NewAvailabilityZones: []*string{ - aws.String("String"), // Required - // More values... - }, - NotificationTopicArn: aws.String("String"), - NotificationTopicStatus: aws.String("String"), - NumCacheNodes: aws.Int64(1), - PreferredMaintenanceWindow: aws.String("String"), - SecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - SnapshotRetentionLimit: aws.Int64(1), - SnapshotWindow: aws.String("String"), - } - resp, err := svc.ModifyCacheCluster(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_ModifyCacheParameterGroup() { - svc := elasticache.New(session.New()) - - params := &elasticache.ModifyCacheParameterGroupInput{ - CacheParameterGroupName: aws.String("String"), // Required - ParameterNameValues: []*elasticache.ParameterNameValue{ // Required - { // Required - ParameterName: aws.String("String"), - ParameterValue: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.ModifyCacheParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_ModifyCacheSubnetGroup() { - svc := elasticache.New(session.New()) - - params := &elasticache.ModifyCacheSubnetGroupInput{ - CacheSubnetGroupName: aws.String("String"), // Required - CacheSubnetGroupDescription: aws.String("String"), - SubnetIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.ModifyCacheSubnetGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_ModifyReplicationGroup() { - svc := elasticache.New(session.New()) - - params := &elasticache.ModifyReplicationGroupInput{ - ReplicationGroupId: aws.String("String"), // Required - ApplyImmediately: aws.Bool(true), - AutoMinorVersionUpgrade: aws.Bool(true), - AutomaticFailoverEnabled: aws.Bool(true), - CacheParameterGroupName: aws.String("String"), - CacheSecurityGroupNames: []*string{ - aws.String("String"), // Required - // More values... - }, - EngineVersion: aws.String("String"), - NotificationTopicArn: aws.String("String"), - NotificationTopicStatus: aws.String("String"), - PreferredMaintenanceWindow: aws.String("String"), - PrimaryClusterId: aws.String("String"), - ReplicationGroupDescription: aws.String("String"), - SecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - SnapshotRetentionLimit: aws.Int64(1), - SnapshotWindow: aws.String("String"), - SnapshottingClusterId: aws.String("String"), - } - resp, err := svc.ModifyReplicationGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_PurchaseReservedCacheNodesOffering() { - svc := elasticache.New(session.New()) - - params := &elasticache.PurchaseReservedCacheNodesOfferingInput{ - ReservedCacheNodesOfferingId: aws.String("String"), // Required - CacheNodeCount: aws.Int64(1), - ReservedCacheNodeId: aws.String("String"), - } - resp, err := svc.PurchaseReservedCacheNodesOffering(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_RebootCacheCluster() { - svc := elasticache.New(session.New()) - - params := &elasticache.RebootCacheClusterInput{ - CacheClusterId: aws.String("String"), // Required - CacheNodeIdsToReboot: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.RebootCacheCluster(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_RemoveTagsFromResource() { - svc := elasticache.New(session.New()) - - params := &elasticache.RemoveTagsFromResourceInput{ - ResourceName: aws.String("String"), // Required - TagKeys: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.RemoveTagsFromResource(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_ResetCacheParameterGroup() { - svc := elasticache.New(session.New()) - - params := &elasticache.ResetCacheParameterGroupInput{ - CacheParameterGroupName: aws.String("String"), // Required - ParameterNameValues: []*elasticache.ParameterNameValue{ // Required - { // Required - ParameterName: aws.String("String"), - ParameterValue: aws.String("String"), - }, - // More values... - }, - ResetAllParameters: aws.Bool(true), - } - resp, err := svc.ResetCacheParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElastiCache_RevokeCacheSecurityGroupIngress() { - svc := elasticache.New(session.New()) - - params := &elasticache.RevokeCacheSecurityGroupIngressInput{ - CacheSecurityGroupName: aws.String("String"), // Required - EC2SecurityGroupName: aws.String("String"), // Required - EC2SecurityGroupOwnerId: aws.String("String"), // Required - } - resp, err := svc.RevokeCacheSecurityGroupIngress(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/examples_test.go deleted file mode 100644 index 8ca0ea7fc2..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/examples_test.go +++ /dev/null @@ -1,262 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package elasticsearchservice_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/elasticsearchservice" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleElasticsearchService_AddTags() { - svc := elasticsearchservice.New(session.New()) - - params := &elasticsearchservice.AddTagsInput{ - ARN: aws.String("ARN"), // Required - TagList: []*elasticsearchservice.Tag{ // Required - { // Required - Key: aws.String("TagKey"), // Required - Value: aws.String("TagValue"), // Required - }, - // More values... - }, - } - resp, err := svc.AddTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElasticsearchService_CreateElasticsearchDomain() { - svc := elasticsearchservice.New(session.New()) - - params := &elasticsearchservice.CreateElasticsearchDomainInput{ - DomainName: aws.String("DomainName"), // Required - AccessPolicies: aws.String("PolicyDocument"), - AdvancedOptions: map[string]*string{ - "Key": aws.String("String"), // Required - // More values... - }, - EBSOptions: &elasticsearchservice.EBSOptions{ - EBSEnabled: aws.Bool(true), - Iops: aws.Int64(1), - VolumeSize: aws.Int64(1), - VolumeType: aws.String("VolumeType"), - }, - ElasticsearchClusterConfig: &elasticsearchservice.ElasticsearchClusterConfig{ - DedicatedMasterCount: aws.Int64(1), - DedicatedMasterEnabled: aws.Bool(true), - DedicatedMasterType: aws.String("ESPartitionInstanceType"), - InstanceCount: aws.Int64(1), - InstanceType: aws.String("ESPartitionInstanceType"), - ZoneAwarenessEnabled: aws.Bool(true), - }, - SnapshotOptions: &elasticsearchservice.SnapshotOptions{ - AutomatedSnapshotStartHour: aws.Int64(1), - }, - } - resp, err := svc.CreateElasticsearchDomain(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElasticsearchService_DeleteElasticsearchDomain() { - svc := elasticsearchservice.New(session.New()) - - params := &elasticsearchservice.DeleteElasticsearchDomainInput{ - DomainName: aws.String("DomainName"), // Required - } - resp, err := svc.DeleteElasticsearchDomain(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElasticsearchService_DescribeElasticsearchDomain() { - svc := elasticsearchservice.New(session.New()) - - params := &elasticsearchservice.DescribeElasticsearchDomainInput{ - DomainName: aws.String("DomainName"), // Required - } - resp, err := svc.DescribeElasticsearchDomain(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElasticsearchService_DescribeElasticsearchDomainConfig() { - svc := elasticsearchservice.New(session.New()) - - params := &elasticsearchservice.DescribeElasticsearchDomainConfigInput{ - DomainName: aws.String("DomainName"), // Required - } - resp, err := svc.DescribeElasticsearchDomainConfig(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElasticsearchService_DescribeElasticsearchDomains() { - svc := elasticsearchservice.New(session.New()) - - params := &elasticsearchservice.DescribeElasticsearchDomainsInput{ - DomainNames: []*string{ // Required - aws.String("DomainName"), // Required - // More values... - }, - } - resp, err := svc.DescribeElasticsearchDomains(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElasticsearchService_ListDomainNames() { - svc := elasticsearchservice.New(session.New()) - - var params *elasticsearchservice.ListDomainNamesInput - resp, err := svc.ListDomainNames(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElasticsearchService_ListTags() { - svc := elasticsearchservice.New(session.New()) - - params := &elasticsearchservice.ListTagsInput{ - ARN: aws.String("ARN"), // Required - } - resp, err := svc.ListTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElasticsearchService_RemoveTags() { - svc := elasticsearchservice.New(session.New()) - - params := &elasticsearchservice.RemoveTagsInput{ - ARN: aws.String("ARN"), // Required - TagKeys: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.RemoveTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleElasticsearchService_UpdateElasticsearchDomainConfig() { - svc := elasticsearchservice.New(session.New()) - - params := &elasticsearchservice.UpdateElasticsearchDomainConfigInput{ - DomainName: aws.String("DomainName"), // Required - AccessPolicies: aws.String("PolicyDocument"), - AdvancedOptions: map[string]*string{ - "Key": aws.String("String"), // Required - // More values... - }, - EBSOptions: &elasticsearchservice.EBSOptions{ - EBSEnabled: aws.Bool(true), - Iops: aws.Int64(1), - VolumeSize: aws.Int64(1), - VolumeType: aws.String("VolumeType"), - }, - ElasticsearchClusterConfig: &elasticsearchservice.ElasticsearchClusterConfig{ - DedicatedMasterCount: aws.Int64(1), - DedicatedMasterEnabled: aws.Bool(true), - DedicatedMasterType: aws.String("ESPartitionInstanceType"), - InstanceCount: aws.Int64(1), - InstanceType: aws.String("ESPartitionInstanceType"), - ZoneAwarenessEnabled: aws.Bool(true), - }, - SnapshotOptions: &elasticsearchservice.SnapshotOptions{ - AutomatedSnapshotStartHour: aws.Int64(1), - }, - } - resp, err := svc.UpdateElasticsearchDomainConfig(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/elb/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/elb/examples_test.go deleted file mode 100644 index d1da802e6c..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elb/examples_test.go +++ /dev/null @@ -1,722 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package elb_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/elb" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleELB_AddTags() { - svc := elb.New(session.New()) - - params := &elb.AddTagsInput{ - LoadBalancerNames: []*string{ // Required - aws.String("AccessPointName"), // Required - // More values... - }, - Tags: []*elb.Tag{ // Required - { // Required - Key: aws.String("TagKey"), // Required - Value: aws.String("TagValue"), - }, - // More values... - }, - } - resp, err := svc.AddTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_ApplySecurityGroupsToLoadBalancer() { - svc := elb.New(session.New()) - - params := &elb.ApplySecurityGroupsToLoadBalancerInput{ - LoadBalancerName: aws.String("AccessPointName"), // Required - SecurityGroups: []*string{ // Required - aws.String("SecurityGroupId"), // Required - // More values... - }, - } - resp, err := svc.ApplySecurityGroupsToLoadBalancer(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_AttachLoadBalancerToSubnets() { - svc := elb.New(session.New()) - - params := &elb.AttachLoadBalancerToSubnetsInput{ - LoadBalancerName: aws.String("AccessPointName"), // Required - Subnets: []*string{ // Required - aws.String("SubnetId"), // Required - // More values... - }, - } - resp, err := svc.AttachLoadBalancerToSubnets(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_ConfigureHealthCheck() { - svc := elb.New(session.New()) - - params := &elb.ConfigureHealthCheckInput{ - HealthCheck: &elb.HealthCheck{ // Required - HealthyThreshold: aws.Int64(1), // Required - Interval: aws.Int64(1), // Required - Target: aws.String("HealthCheckTarget"), // Required - Timeout: aws.Int64(1), // Required - UnhealthyThreshold: aws.Int64(1), // Required - }, - LoadBalancerName: aws.String("AccessPointName"), // Required - } - resp, err := svc.ConfigureHealthCheck(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_CreateAppCookieStickinessPolicy() { - svc := elb.New(session.New()) - - params := &elb.CreateAppCookieStickinessPolicyInput{ - CookieName: aws.String("CookieName"), // Required - LoadBalancerName: aws.String("AccessPointName"), // Required - PolicyName: aws.String("PolicyName"), // Required - } - resp, err := svc.CreateAppCookieStickinessPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_CreateLBCookieStickinessPolicy() { - svc := elb.New(session.New()) - - params := &elb.CreateLBCookieStickinessPolicyInput{ - LoadBalancerName: aws.String("AccessPointName"), // Required - PolicyName: aws.String("PolicyName"), // Required - CookieExpirationPeriod: aws.Int64(1), - } - resp, err := svc.CreateLBCookieStickinessPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_CreateLoadBalancer() { - svc := elb.New(session.New()) - - params := &elb.CreateLoadBalancerInput{ - Listeners: []*elb.Listener{ // Required - { // Required - InstancePort: aws.Int64(1), // Required - LoadBalancerPort: aws.Int64(1), // Required - Protocol: aws.String("Protocol"), // Required - InstanceProtocol: aws.String("Protocol"), - SSLCertificateId: aws.String("SSLCertificateId"), - }, - // More values... - }, - LoadBalancerName: aws.String("AccessPointName"), // Required - AvailabilityZones: []*string{ - aws.String("AvailabilityZone"), // Required - // More values... - }, - Scheme: aws.String("LoadBalancerScheme"), - SecurityGroups: []*string{ - aws.String("SecurityGroupId"), // Required - // More values... - }, - Subnets: []*string{ - aws.String("SubnetId"), // Required - // More values... - }, - Tags: []*elb.Tag{ - { // Required - Key: aws.String("TagKey"), // Required - Value: aws.String("TagValue"), - }, - // More values... - }, - } - resp, err := svc.CreateLoadBalancer(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_CreateLoadBalancerListeners() { - svc := elb.New(session.New()) - - params := &elb.CreateLoadBalancerListenersInput{ - Listeners: []*elb.Listener{ // Required - { // Required - InstancePort: aws.Int64(1), // Required - LoadBalancerPort: aws.Int64(1), // Required - Protocol: aws.String("Protocol"), // Required - InstanceProtocol: aws.String("Protocol"), - SSLCertificateId: aws.String("SSLCertificateId"), - }, - // More values... - }, - LoadBalancerName: aws.String("AccessPointName"), // Required - } - resp, err := svc.CreateLoadBalancerListeners(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_CreateLoadBalancerPolicy() { - svc := elb.New(session.New()) - - params := &elb.CreateLoadBalancerPolicyInput{ - LoadBalancerName: aws.String("AccessPointName"), // Required - PolicyName: aws.String("PolicyName"), // Required - PolicyTypeName: aws.String("PolicyTypeName"), // Required - PolicyAttributes: []*elb.PolicyAttribute{ - { // Required - AttributeName: aws.String("AttributeName"), - AttributeValue: aws.String("AttributeValue"), - }, - // More values... - }, - } - resp, err := svc.CreateLoadBalancerPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_DeleteLoadBalancer() { - svc := elb.New(session.New()) - - params := &elb.DeleteLoadBalancerInput{ - LoadBalancerName: aws.String("AccessPointName"), // Required - } - resp, err := svc.DeleteLoadBalancer(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_DeleteLoadBalancerListeners() { - svc := elb.New(session.New()) - - params := &elb.DeleteLoadBalancerListenersInput{ - LoadBalancerName: aws.String("AccessPointName"), // Required - LoadBalancerPorts: []*int64{ // Required - aws.Int64(1), // Required - // More values... - }, - } - resp, err := svc.DeleteLoadBalancerListeners(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_DeleteLoadBalancerPolicy() { - svc := elb.New(session.New()) - - params := &elb.DeleteLoadBalancerPolicyInput{ - LoadBalancerName: aws.String("AccessPointName"), // Required - PolicyName: aws.String("PolicyName"), // Required - } - resp, err := svc.DeleteLoadBalancerPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_DeregisterInstancesFromLoadBalancer() { - svc := elb.New(session.New()) - - params := &elb.DeregisterInstancesFromLoadBalancerInput{ - Instances: []*elb.Instance{ // Required - { // Required - InstanceId: aws.String("InstanceId"), - }, - // More values... - }, - LoadBalancerName: aws.String("AccessPointName"), // Required - } - resp, err := svc.DeregisterInstancesFromLoadBalancer(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_DescribeInstanceHealth() { - svc := elb.New(session.New()) - - params := &elb.DescribeInstanceHealthInput{ - LoadBalancerName: aws.String("AccessPointName"), // Required - Instances: []*elb.Instance{ - { // Required - InstanceId: aws.String("InstanceId"), - }, - // More values... - }, - } - resp, err := svc.DescribeInstanceHealth(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_DescribeLoadBalancerAttributes() { - svc := elb.New(session.New()) - - params := &elb.DescribeLoadBalancerAttributesInput{ - LoadBalancerName: aws.String("AccessPointName"), // Required - } - resp, err := svc.DescribeLoadBalancerAttributes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_DescribeLoadBalancerPolicies() { - svc := elb.New(session.New()) - - params := &elb.DescribeLoadBalancerPoliciesInput{ - LoadBalancerName: aws.String("AccessPointName"), - PolicyNames: []*string{ - aws.String("PolicyName"), // Required - // More values... - }, - } - resp, err := svc.DescribeLoadBalancerPolicies(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_DescribeLoadBalancerPolicyTypes() { - svc := elb.New(session.New()) - - params := &elb.DescribeLoadBalancerPolicyTypesInput{ - PolicyTypeNames: []*string{ - aws.String("PolicyTypeName"), // Required - // More values... - }, - } - resp, err := svc.DescribeLoadBalancerPolicyTypes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_DescribeLoadBalancers() { - svc := elb.New(session.New()) - - params := &elb.DescribeLoadBalancersInput{ - LoadBalancerNames: []*string{ - aws.String("AccessPointName"), // Required - // More values... - }, - Marker: aws.String("Marker"), - PageSize: aws.Int64(1), - } - resp, err := svc.DescribeLoadBalancers(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_DescribeTags() { - svc := elb.New(session.New()) - - params := &elb.DescribeTagsInput{ - LoadBalancerNames: []*string{ // Required - aws.String("AccessPointName"), // Required - // More values... - }, - } - resp, err := svc.DescribeTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_DetachLoadBalancerFromSubnets() { - svc := elb.New(session.New()) - - params := &elb.DetachLoadBalancerFromSubnetsInput{ - LoadBalancerName: aws.String("AccessPointName"), // Required - Subnets: []*string{ // Required - aws.String("SubnetId"), // Required - // More values... - }, - } - resp, err := svc.DetachLoadBalancerFromSubnets(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_DisableAvailabilityZonesForLoadBalancer() { - svc := elb.New(session.New()) - - params := &elb.DisableAvailabilityZonesForLoadBalancerInput{ - AvailabilityZones: []*string{ // Required - aws.String("AvailabilityZone"), // Required - // More values... - }, - LoadBalancerName: aws.String("AccessPointName"), // Required - } - resp, err := svc.DisableAvailabilityZonesForLoadBalancer(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_EnableAvailabilityZonesForLoadBalancer() { - svc := elb.New(session.New()) - - params := &elb.EnableAvailabilityZonesForLoadBalancerInput{ - AvailabilityZones: []*string{ // Required - aws.String("AvailabilityZone"), // Required - // More values... - }, - LoadBalancerName: aws.String("AccessPointName"), // Required - } - resp, err := svc.EnableAvailabilityZonesForLoadBalancer(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_ModifyLoadBalancerAttributes() { - svc := elb.New(session.New()) - - params := &elb.ModifyLoadBalancerAttributesInput{ - LoadBalancerAttributes: &elb.LoadBalancerAttributes{ // Required - AccessLog: &elb.AccessLog{ - Enabled: aws.Bool(true), // Required - EmitInterval: aws.Int64(1), - S3BucketName: aws.String("S3BucketName"), - S3BucketPrefix: aws.String("AccessLogPrefix"), - }, - AdditionalAttributes: []*elb.AdditionalAttribute{ - { // Required - Key: aws.String("StringVal"), - Value: aws.String("StringVal"), - }, - // More values... - }, - ConnectionDraining: &elb.ConnectionDraining{ - Enabled: aws.Bool(true), // Required - Timeout: aws.Int64(1), - }, - ConnectionSettings: &elb.ConnectionSettings{ - IdleTimeout: aws.Int64(1), // Required - }, - CrossZoneLoadBalancing: &elb.CrossZoneLoadBalancing{ - Enabled: aws.Bool(true), // Required - }, - }, - LoadBalancerName: aws.String("AccessPointName"), // Required - } - resp, err := svc.ModifyLoadBalancerAttributes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_RegisterInstancesWithLoadBalancer() { - svc := elb.New(session.New()) - - params := &elb.RegisterInstancesWithLoadBalancerInput{ - Instances: []*elb.Instance{ // Required - { // Required - InstanceId: aws.String("InstanceId"), - }, - // More values... - }, - LoadBalancerName: aws.String("AccessPointName"), // Required - } - resp, err := svc.RegisterInstancesWithLoadBalancer(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_RemoveTags() { - svc := elb.New(session.New()) - - params := &elb.RemoveTagsInput{ - LoadBalancerNames: []*string{ // Required - aws.String("AccessPointName"), // Required - // More values... - }, - Tags: []*elb.TagKeyOnly{ // Required - { // Required - Key: aws.String("TagKey"), - }, - // More values... - }, - } - resp, err := svc.RemoveTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_SetLoadBalancerListenerSSLCertificate() { - svc := elb.New(session.New()) - - params := &elb.SetLoadBalancerListenerSSLCertificateInput{ - LoadBalancerName: aws.String("AccessPointName"), // Required - LoadBalancerPort: aws.Int64(1), // Required - SSLCertificateId: aws.String("SSLCertificateId"), // Required - } - resp, err := svc.SetLoadBalancerListenerSSLCertificate(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_SetLoadBalancerPoliciesForBackendServer() { - svc := elb.New(session.New()) - - params := &elb.SetLoadBalancerPoliciesForBackendServerInput{ - InstancePort: aws.Int64(1), // Required - LoadBalancerName: aws.String("AccessPointName"), // Required - PolicyNames: []*string{ // Required - aws.String("PolicyName"), // Required - // More values... - }, - } - resp, err := svc.SetLoadBalancerPoliciesForBackendServer(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleELB_SetLoadBalancerPoliciesOfListener() { - svc := elb.New(session.New()) - - params := &elb.SetLoadBalancerPoliciesOfListenerInput{ - LoadBalancerName: aws.String("AccessPointName"), // Required - LoadBalancerPort: aws.Int64(1), // Required - PolicyNames: []*string{ // Required - aws.String("PolicyName"), // Required - // More values... - }, - } - resp, err := svc.SetLoadBalancerPoliciesOfListener(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/firehose/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/firehose/examples_test.go deleted file mode 100644 index 9cff4e0af4..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/firehose/examples_test.go +++ /dev/null @@ -1,249 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package firehose_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/firehose" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleFirehose_CreateDeliveryStream() { - svc := firehose.New(session.New()) - - params := &firehose.CreateDeliveryStreamInput{ - DeliveryStreamName: aws.String("DeliveryStreamName"), // Required - RedshiftDestinationConfiguration: &firehose.RedshiftDestinationConfiguration{ - ClusterJDBCURL: aws.String("ClusterJDBCURL"), // Required - CopyCommand: &firehose.CopyCommand{ // Required - DataTableName: aws.String("DataTableName"), // Required - CopyOptions: aws.String("CopyOptions"), - DataTableColumns: aws.String("DataTableColumns"), - }, - Password: aws.String("Password"), // Required - RoleARN: aws.String("RoleARN"), // Required - S3Configuration: &firehose.S3DestinationConfiguration{ // Required - BucketARN: aws.String("BucketARN"), // Required - RoleARN: aws.String("RoleARN"), // Required - BufferingHints: &firehose.BufferingHints{ - IntervalInSeconds: aws.Int64(1), - SizeInMBs: aws.Int64(1), - }, - CompressionFormat: aws.String("CompressionFormat"), - EncryptionConfiguration: &firehose.EncryptionConfiguration{ - KMSEncryptionConfig: &firehose.KMSEncryptionConfig{ - AWSKMSKeyARN: aws.String("AWSKMSKeyARN"), // Required - }, - NoEncryptionConfig: aws.String("NoEncryptionConfig"), - }, - Prefix: aws.String("Prefix"), - }, - Username: aws.String("Username"), // Required - }, - S3DestinationConfiguration: &firehose.S3DestinationConfiguration{ - BucketARN: aws.String("BucketARN"), // Required - RoleARN: aws.String("RoleARN"), // Required - BufferingHints: &firehose.BufferingHints{ - IntervalInSeconds: aws.Int64(1), - SizeInMBs: aws.Int64(1), - }, - CompressionFormat: aws.String("CompressionFormat"), - EncryptionConfiguration: &firehose.EncryptionConfiguration{ - KMSEncryptionConfig: &firehose.KMSEncryptionConfig{ - AWSKMSKeyARN: aws.String("AWSKMSKeyARN"), // Required - }, - NoEncryptionConfig: aws.String("NoEncryptionConfig"), - }, - Prefix: aws.String("Prefix"), - }, - } - resp, err := svc.CreateDeliveryStream(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleFirehose_DeleteDeliveryStream() { - svc := firehose.New(session.New()) - - params := &firehose.DeleteDeliveryStreamInput{ - DeliveryStreamName: aws.String("DeliveryStreamName"), // Required - } - resp, err := svc.DeleteDeliveryStream(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleFirehose_DescribeDeliveryStream() { - svc := firehose.New(session.New()) - - params := &firehose.DescribeDeliveryStreamInput{ - DeliveryStreamName: aws.String("DeliveryStreamName"), // Required - ExclusiveStartDestinationId: aws.String("DestinationId"), - Limit: aws.Int64(1), - } - resp, err := svc.DescribeDeliveryStream(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleFirehose_ListDeliveryStreams() { - svc := firehose.New(session.New()) - - params := &firehose.ListDeliveryStreamsInput{ - ExclusiveStartDeliveryStreamName: aws.String("DeliveryStreamName"), - Limit: aws.Int64(1), - } - resp, err := svc.ListDeliveryStreams(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleFirehose_PutRecord() { - svc := firehose.New(session.New()) - - params := &firehose.PutRecordInput{ - DeliveryStreamName: aws.String("DeliveryStreamName"), // Required - Record: &firehose.Record{ // Required - Data: []byte("PAYLOAD"), // Required - }, - } - resp, err := svc.PutRecord(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleFirehose_PutRecordBatch() { - svc := firehose.New(session.New()) - - params := &firehose.PutRecordBatchInput{ - DeliveryStreamName: aws.String("DeliveryStreamName"), // Required - Records: []*firehose.Record{ // Required - { // Required - Data: []byte("PAYLOAD"), // Required - }, - // More values... - }, - } - resp, err := svc.PutRecordBatch(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleFirehose_UpdateDestination() { - svc := firehose.New(session.New()) - - params := &firehose.UpdateDestinationInput{ - CurrentDeliveryStreamVersionId: aws.String("DeliveryStreamVersionId"), // Required - DeliveryStreamName: aws.String("DeliveryStreamName"), // Required - DestinationId: aws.String("DestinationId"), // Required - RedshiftDestinationUpdate: &firehose.RedshiftDestinationUpdate{ - ClusterJDBCURL: aws.String("ClusterJDBCURL"), - CopyCommand: &firehose.CopyCommand{ - DataTableName: aws.String("DataTableName"), // Required - CopyOptions: aws.String("CopyOptions"), - DataTableColumns: aws.String("DataTableColumns"), - }, - Password: aws.String("Password"), - RoleARN: aws.String("RoleARN"), - S3Update: &firehose.S3DestinationUpdate{ - BucketARN: aws.String("BucketARN"), - BufferingHints: &firehose.BufferingHints{ - IntervalInSeconds: aws.Int64(1), - SizeInMBs: aws.Int64(1), - }, - CompressionFormat: aws.String("CompressionFormat"), - EncryptionConfiguration: &firehose.EncryptionConfiguration{ - KMSEncryptionConfig: &firehose.KMSEncryptionConfig{ - AWSKMSKeyARN: aws.String("AWSKMSKeyARN"), // Required - }, - NoEncryptionConfig: aws.String("NoEncryptionConfig"), - }, - Prefix: aws.String("Prefix"), - RoleARN: aws.String("RoleARN"), - }, - Username: aws.String("Username"), - }, - S3DestinationUpdate: &firehose.S3DestinationUpdate{ - BucketARN: aws.String("BucketARN"), - BufferingHints: &firehose.BufferingHints{ - IntervalInSeconds: aws.Int64(1), - SizeInMBs: aws.Int64(1), - }, - CompressionFormat: aws.String("CompressionFormat"), - EncryptionConfiguration: &firehose.EncryptionConfiguration{ - KMSEncryptionConfig: &firehose.KMSEncryptionConfig{ - AWSKMSKeyARN: aws.String("AWSKMSKeyARN"), // Required - }, - NoEncryptionConfig: aws.String("NoEncryptionConfig"), - }, - Prefix: aws.String("Prefix"), - RoleARN: aws.String("RoleARN"), - }, - } - resp, err := svc.UpdateDestination(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/glacier/customizations_test.go b/vendor/github.com/aws/aws-sdk-go/service/glacier/customizations_test.go deleted file mode 100644 index 2825b81c7a..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/glacier/customizations_test.go +++ /dev/null @@ -1,77 +0,0 @@ -// +build !integration - -package glacier_test - -import ( - "bytes" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/glacier" -) - -var ( - payloadBuf = func() *bytes.Reader { - buf := make([]byte, 5767168) // 5.5MB buffer - for i := range buf { - buf[i] = '0' // Fill with zero characters - } - return bytes.NewReader(buf) - }() - - svc = glacier.New(unit.Session) -) - -func TestCustomizations(t *testing.T) { - req, _ := svc.UploadArchiveRequest(&glacier.UploadArchiveInput{ - VaultName: aws.String("vault"), - Body: payloadBuf, - }) - err := req.Build() - assert.NoError(t, err) - - // Sets API version - assert.Equal(t, req.ClientInfo.APIVersion, req.HTTPRequest.Header.Get("x-amz-glacier-version")) - - // Sets Account ID - v, _ := awsutil.ValuesAtPath(req.Params, "AccountId") - assert.Equal(t, "-", *(v[0].(*string))) - - // Computes checksums - linear := "68aff0c5a91aa0491752bfb96e3fef33eb74953804f6a2f7b708d5bcefa8ff6b" - tree := "154e26c78fd74d0c2c9b3cc4644191619dc4f2cd539ae2a74d5fd07957a3ee6a" - assert.Equal(t, linear, req.HTTPRequest.Header.Get("x-amz-content-sha256")) - assert.Equal(t, tree, req.HTTPRequest.Header.Get("x-amz-sha256-tree-hash")) -} - -func TestShortcircuitTreehash(t *testing.T) { - req, _ := svc.UploadArchiveRequest(&glacier.UploadArchiveInput{ - VaultName: aws.String("vault"), - Body: payloadBuf, - Checksum: aws.String("000"), - }) - err := req.Build() - assert.NoError(t, err) - - assert.Equal(t, "000", req.HTTPRequest.Header.Get("x-amz-sha256-tree-hash")) -} - -func TestFillAccountIDWithNilStruct(t *testing.T) { - req, _ := svc.ListVaultsRequest(nil) - err := req.Build() - assert.NoError(t, err) - - empty := "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - - // Sets Account ID - v, _ := awsutil.ValuesAtPath(req.Params, "AccountId") - assert.Equal(t, "-", *(v[0].(*string))) - - // Does not set tree hash - assert.Equal(t, empty, req.HTTPRequest.Header.Get("x-amz-content-sha256")) - assert.Equal(t, "", req.HTTPRequest.Header.Get("x-amz-sha256-tree-hash")) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/glacier/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/glacier/examples_test.go deleted file mode 100644 index 9384d3dae0..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/glacier/examples_test.go +++ /dev/null @@ -1,706 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package glacier_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/glacier" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleGlacier_AbortMultipartUpload() { - svc := glacier.New(session.New()) - - params := &glacier.AbortMultipartUploadInput{ - AccountId: aws.String("string"), // Required - UploadId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - } - resp, err := svc.AbortMultipartUpload(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_AbortVaultLock() { - svc := glacier.New(session.New()) - - params := &glacier.AbortVaultLockInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - } - resp, err := svc.AbortVaultLock(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_AddTagsToVault() { - svc := glacier.New(session.New()) - - params := &glacier.AddTagsToVaultInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - Tags: map[string]*string{ - "Key": aws.String("TagValue"), // Required - // More values... - }, - } - resp, err := svc.AddTagsToVault(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_CompleteMultipartUpload() { - svc := glacier.New(session.New()) - - params := &glacier.CompleteMultipartUploadInput{ - AccountId: aws.String("string"), // Required - UploadId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - ArchiveSize: aws.String("string"), - Checksum: aws.String("string"), - } - resp, err := svc.CompleteMultipartUpload(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_CompleteVaultLock() { - svc := glacier.New(session.New()) - - params := &glacier.CompleteVaultLockInput{ - AccountId: aws.String("string"), // Required - LockId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - } - resp, err := svc.CompleteVaultLock(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_CreateVault() { - svc := glacier.New(session.New()) - - params := &glacier.CreateVaultInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - } - resp, err := svc.CreateVault(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_DeleteArchive() { - svc := glacier.New(session.New()) - - params := &glacier.DeleteArchiveInput{ - AccountId: aws.String("string"), // Required - ArchiveId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - } - resp, err := svc.DeleteArchive(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_DeleteVault() { - svc := glacier.New(session.New()) - - params := &glacier.DeleteVaultInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - } - resp, err := svc.DeleteVault(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_DeleteVaultAccessPolicy() { - svc := glacier.New(session.New()) - - params := &glacier.DeleteVaultAccessPolicyInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - } - resp, err := svc.DeleteVaultAccessPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_DeleteVaultNotifications() { - svc := glacier.New(session.New()) - - params := &glacier.DeleteVaultNotificationsInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - } - resp, err := svc.DeleteVaultNotifications(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_DescribeJob() { - svc := glacier.New(session.New()) - - params := &glacier.DescribeJobInput{ - AccountId: aws.String("string"), // Required - JobId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - } - resp, err := svc.DescribeJob(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_DescribeVault() { - svc := glacier.New(session.New()) - - params := &glacier.DescribeVaultInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - } - resp, err := svc.DescribeVault(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_GetDataRetrievalPolicy() { - svc := glacier.New(session.New()) - - params := &glacier.GetDataRetrievalPolicyInput{ - AccountId: aws.String("string"), // Required - } - resp, err := svc.GetDataRetrievalPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_GetJobOutput() { - svc := glacier.New(session.New()) - - params := &glacier.GetJobOutputInput{ - AccountId: aws.String("string"), // Required - JobId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - Range: aws.String("string"), - } - resp, err := svc.GetJobOutput(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_GetVaultAccessPolicy() { - svc := glacier.New(session.New()) - - params := &glacier.GetVaultAccessPolicyInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - } - resp, err := svc.GetVaultAccessPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_GetVaultLock() { - svc := glacier.New(session.New()) - - params := &glacier.GetVaultLockInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - } - resp, err := svc.GetVaultLock(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_GetVaultNotifications() { - svc := glacier.New(session.New()) - - params := &glacier.GetVaultNotificationsInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - } - resp, err := svc.GetVaultNotifications(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_InitiateJob() { - svc := glacier.New(session.New()) - - params := &glacier.InitiateJobInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - JobParameters: &glacier.JobParameters{ - ArchiveId: aws.String("string"), - Description: aws.String("string"), - Format: aws.String("string"), - InventoryRetrievalParameters: &glacier.InventoryRetrievalJobInput{ - EndDate: aws.String("string"), - Limit: aws.String("string"), - Marker: aws.String("string"), - StartDate: aws.String("string"), - }, - RetrievalByteRange: aws.String("string"), - SNSTopic: aws.String("string"), - Type: aws.String("string"), - }, - } - resp, err := svc.InitiateJob(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_InitiateMultipartUpload() { - svc := glacier.New(session.New()) - - params := &glacier.InitiateMultipartUploadInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - ArchiveDescription: aws.String("string"), - PartSize: aws.String("string"), - } - resp, err := svc.InitiateMultipartUpload(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_InitiateVaultLock() { - svc := glacier.New(session.New()) - - params := &glacier.InitiateVaultLockInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - Policy: &glacier.VaultLockPolicy{ - Policy: aws.String("string"), - }, - } - resp, err := svc.InitiateVaultLock(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_ListJobs() { - svc := glacier.New(session.New()) - - params := &glacier.ListJobsInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - Completed: aws.String("string"), - Limit: aws.String("string"), - Marker: aws.String("string"), - Statuscode: aws.String("string"), - } - resp, err := svc.ListJobs(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_ListMultipartUploads() { - svc := glacier.New(session.New()) - - params := &glacier.ListMultipartUploadsInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - Limit: aws.String("string"), - Marker: aws.String("string"), - } - resp, err := svc.ListMultipartUploads(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_ListParts() { - svc := glacier.New(session.New()) - - params := &glacier.ListPartsInput{ - AccountId: aws.String("string"), // Required - UploadId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - Limit: aws.String("string"), - Marker: aws.String("string"), - } - resp, err := svc.ListParts(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_ListTagsForVault() { - svc := glacier.New(session.New()) - - params := &glacier.ListTagsForVaultInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - } - resp, err := svc.ListTagsForVault(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_ListVaults() { - svc := glacier.New(session.New()) - - params := &glacier.ListVaultsInput{ - AccountId: aws.String("string"), // Required - Limit: aws.String("string"), - Marker: aws.String("string"), - } - resp, err := svc.ListVaults(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_RemoveTagsFromVault() { - svc := glacier.New(session.New()) - - params := &glacier.RemoveTagsFromVaultInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - TagKeys: []*string{ - aws.String("string"), // Required - // More values... - }, - } - resp, err := svc.RemoveTagsFromVault(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_SetDataRetrievalPolicy() { - svc := glacier.New(session.New()) - - params := &glacier.SetDataRetrievalPolicyInput{ - AccountId: aws.String("string"), // Required - Policy: &glacier.DataRetrievalPolicy{ - Rules: []*glacier.DataRetrievalRule{ - { // Required - BytesPerHour: aws.Int64(1), - Strategy: aws.String("string"), - }, - // More values... - }, - }, - } - resp, err := svc.SetDataRetrievalPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_SetVaultAccessPolicy() { - svc := glacier.New(session.New()) - - params := &glacier.SetVaultAccessPolicyInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - Policy: &glacier.VaultAccessPolicy{ - Policy: aws.String("string"), - }, - } - resp, err := svc.SetVaultAccessPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_SetVaultNotifications() { - svc := glacier.New(session.New()) - - params := &glacier.SetVaultNotificationsInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - VaultNotificationConfig: &glacier.VaultNotificationConfig{ - Events: []*string{ - aws.String("string"), // Required - // More values... - }, - SNSTopic: aws.String("string"), - }, - } - resp, err := svc.SetVaultNotifications(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_UploadArchive() { - svc := glacier.New(session.New()) - - params := &glacier.UploadArchiveInput{ - AccountId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - ArchiveDescription: aws.String("string"), - Body: bytes.NewReader([]byte("PAYLOAD")), - Checksum: aws.String("string"), - } - resp, err := svc.UploadArchive(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleGlacier_UploadMultipartPart() { - svc := glacier.New(session.New()) - - params := &glacier.UploadMultipartPartInput{ - AccountId: aws.String("string"), // Required - UploadId: aws.String("string"), // Required - VaultName: aws.String("string"), // Required - Body: bytes.NewReader([]byte("PAYLOAD")), - Checksum: aws.String("string"), - Range: aws.String("string"), - } - resp, err := svc.UploadMultipartPart(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/glacier/treehash_test.go b/vendor/github.com/aws/aws-sdk-go/service/glacier/treehash_test.go deleted file mode 100644 index 970a083b96..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/glacier/treehash_test.go +++ /dev/null @@ -1,28 +0,0 @@ -package glacier_test - -import ( - "bytes" - "fmt" - - "github.com/aws/aws-sdk-go/service/glacier" -) - -func ExampleComputeHashes() { - buf := make([]byte, 5767168) // 5.5MB buffer - for i := range buf { - buf[i] = '0' // Fill with zero characters - } - - r := bytes.NewReader(buf) - h := glacier.ComputeHashes(r) - n, _ := r.Seek(0, 1) // Check position after checksumming - - fmt.Printf("linear: %x\n", h.LinearHash) - fmt.Printf("tree: %x\n", h.TreeHash) - fmt.Printf("pos: %d\n", n) - - // Output: - // linear: 68aff0c5a91aa0491752bfb96e3fef33eb74953804f6a2f7b708d5bcefa8ff6b - // tree: 154e26c78fd74d0c2c9b3cc4644191619dc4f2cd539ae2a74d5fd07957a3ee6a - // pos: 0 -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/iam/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/iam/examples_test.go deleted file mode 100644 index 1aebec8cd1..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/iam/examples_test.go +++ /dev/null @@ -1,2366 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package iam_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/iam" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleIAM_AddClientIDToOpenIDConnectProvider() { - svc := iam.New(session.New()) - - params := &iam.AddClientIDToOpenIDConnectProviderInput{ - ClientID: aws.String("clientIDType"), // Required - OpenIDConnectProviderArn: aws.String("arnType"), // Required - } - resp, err := svc.AddClientIDToOpenIDConnectProvider(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_AddRoleToInstanceProfile() { - svc := iam.New(session.New()) - - params := &iam.AddRoleToInstanceProfileInput{ - InstanceProfileName: aws.String("instanceProfileNameType"), // Required - RoleName: aws.String("roleNameType"), // Required - } - resp, err := svc.AddRoleToInstanceProfile(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_AddUserToGroup() { - svc := iam.New(session.New()) - - params := &iam.AddUserToGroupInput{ - GroupName: aws.String("groupNameType"), // Required - UserName: aws.String("existingUserNameType"), // Required - } - resp, err := svc.AddUserToGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_AttachGroupPolicy() { - svc := iam.New(session.New()) - - params := &iam.AttachGroupPolicyInput{ - GroupName: aws.String("groupNameType"), // Required - PolicyArn: aws.String("arnType"), // Required - } - resp, err := svc.AttachGroupPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_AttachRolePolicy() { - svc := iam.New(session.New()) - - params := &iam.AttachRolePolicyInput{ - PolicyArn: aws.String("arnType"), // Required - RoleName: aws.String("roleNameType"), // Required - } - resp, err := svc.AttachRolePolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_AttachUserPolicy() { - svc := iam.New(session.New()) - - params := &iam.AttachUserPolicyInput{ - PolicyArn: aws.String("arnType"), // Required - UserName: aws.String("userNameType"), // Required - } - resp, err := svc.AttachUserPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ChangePassword() { - svc := iam.New(session.New()) - - params := &iam.ChangePasswordInput{ - NewPassword: aws.String("passwordType"), // Required - OldPassword: aws.String("passwordType"), // Required - } - resp, err := svc.ChangePassword(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_CreateAccessKey() { - svc := iam.New(session.New()) - - params := &iam.CreateAccessKeyInput{ - UserName: aws.String("existingUserNameType"), - } - resp, err := svc.CreateAccessKey(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_CreateAccountAlias() { - svc := iam.New(session.New()) - - params := &iam.CreateAccountAliasInput{ - AccountAlias: aws.String("accountAliasType"), // Required - } - resp, err := svc.CreateAccountAlias(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_CreateGroup() { - svc := iam.New(session.New()) - - params := &iam.CreateGroupInput{ - GroupName: aws.String("groupNameType"), // Required - Path: aws.String("pathType"), - } - resp, err := svc.CreateGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_CreateInstanceProfile() { - svc := iam.New(session.New()) - - params := &iam.CreateInstanceProfileInput{ - InstanceProfileName: aws.String("instanceProfileNameType"), // Required - Path: aws.String("pathType"), - } - resp, err := svc.CreateInstanceProfile(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_CreateLoginProfile() { - svc := iam.New(session.New()) - - params := &iam.CreateLoginProfileInput{ - Password: aws.String("passwordType"), // Required - UserName: aws.String("userNameType"), // Required - PasswordResetRequired: aws.Bool(true), - } - resp, err := svc.CreateLoginProfile(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_CreateOpenIDConnectProvider() { - svc := iam.New(session.New()) - - params := &iam.CreateOpenIDConnectProviderInput{ - ThumbprintList: []*string{ // Required - aws.String("thumbprintType"), // Required - // More values... - }, - Url: aws.String("OpenIDConnectProviderUrlType"), // Required - ClientIDList: []*string{ - aws.String("clientIDType"), // Required - // More values... - }, - } - resp, err := svc.CreateOpenIDConnectProvider(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_CreatePolicy() { - svc := iam.New(session.New()) - - params := &iam.CreatePolicyInput{ - PolicyDocument: aws.String("policyDocumentType"), // Required - PolicyName: aws.String("policyNameType"), // Required - Description: aws.String("policyDescriptionType"), - Path: aws.String("policyPathType"), - } - resp, err := svc.CreatePolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_CreatePolicyVersion() { - svc := iam.New(session.New()) - - params := &iam.CreatePolicyVersionInput{ - PolicyArn: aws.String("arnType"), // Required - PolicyDocument: aws.String("policyDocumentType"), // Required - SetAsDefault: aws.Bool(true), - } - resp, err := svc.CreatePolicyVersion(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_CreateRole() { - svc := iam.New(session.New()) - - params := &iam.CreateRoleInput{ - AssumeRolePolicyDocument: aws.String("policyDocumentType"), // Required - RoleName: aws.String("roleNameType"), // Required - Path: aws.String("pathType"), - } - resp, err := svc.CreateRole(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_CreateSAMLProvider() { - svc := iam.New(session.New()) - - params := &iam.CreateSAMLProviderInput{ - Name: aws.String("SAMLProviderNameType"), // Required - SAMLMetadataDocument: aws.String("SAMLMetadataDocumentType"), // Required - } - resp, err := svc.CreateSAMLProvider(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_CreateUser() { - svc := iam.New(session.New()) - - params := &iam.CreateUserInput{ - UserName: aws.String("userNameType"), // Required - Path: aws.String("pathType"), - } - resp, err := svc.CreateUser(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_CreateVirtualMFADevice() { - svc := iam.New(session.New()) - - params := &iam.CreateVirtualMFADeviceInput{ - VirtualMFADeviceName: aws.String("virtualMFADeviceName"), // Required - Path: aws.String("pathType"), - } - resp, err := svc.CreateVirtualMFADevice(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeactivateMFADevice() { - svc := iam.New(session.New()) - - params := &iam.DeactivateMFADeviceInput{ - SerialNumber: aws.String("serialNumberType"), // Required - UserName: aws.String("existingUserNameType"), // Required - } - resp, err := svc.DeactivateMFADevice(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteAccessKey() { - svc := iam.New(session.New()) - - params := &iam.DeleteAccessKeyInput{ - AccessKeyId: aws.String("accessKeyIdType"), // Required - UserName: aws.String("existingUserNameType"), - } - resp, err := svc.DeleteAccessKey(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteAccountAlias() { - svc := iam.New(session.New()) - - params := &iam.DeleteAccountAliasInput{ - AccountAlias: aws.String("accountAliasType"), // Required - } - resp, err := svc.DeleteAccountAlias(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteAccountPasswordPolicy() { - svc := iam.New(session.New()) - - var params *iam.DeleteAccountPasswordPolicyInput - resp, err := svc.DeleteAccountPasswordPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteGroup() { - svc := iam.New(session.New()) - - params := &iam.DeleteGroupInput{ - GroupName: aws.String("groupNameType"), // Required - } - resp, err := svc.DeleteGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteGroupPolicy() { - svc := iam.New(session.New()) - - params := &iam.DeleteGroupPolicyInput{ - GroupName: aws.String("groupNameType"), // Required - PolicyName: aws.String("policyNameType"), // Required - } - resp, err := svc.DeleteGroupPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteInstanceProfile() { - svc := iam.New(session.New()) - - params := &iam.DeleteInstanceProfileInput{ - InstanceProfileName: aws.String("instanceProfileNameType"), // Required - } - resp, err := svc.DeleteInstanceProfile(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteLoginProfile() { - svc := iam.New(session.New()) - - params := &iam.DeleteLoginProfileInput{ - UserName: aws.String("userNameType"), // Required - } - resp, err := svc.DeleteLoginProfile(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteOpenIDConnectProvider() { - svc := iam.New(session.New()) - - params := &iam.DeleteOpenIDConnectProviderInput{ - OpenIDConnectProviderArn: aws.String("arnType"), // Required - } - resp, err := svc.DeleteOpenIDConnectProvider(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeletePolicy() { - svc := iam.New(session.New()) - - params := &iam.DeletePolicyInput{ - PolicyArn: aws.String("arnType"), // Required - } - resp, err := svc.DeletePolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeletePolicyVersion() { - svc := iam.New(session.New()) - - params := &iam.DeletePolicyVersionInput{ - PolicyArn: aws.String("arnType"), // Required - VersionId: aws.String("policyVersionIdType"), // Required - } - resp, err := svc.DeletePolicyVersion(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteRole() { - svc := iam.New(session.New()) - - params := &iam.DeleteRoleInput{ - RoleName: aws.String("roleNameType"), // Required - } - resp, err := svc.DeleteRole(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteRolePolicy() { - svc := iam.New(session.New()) - - params := &iam.DeleteRolePolicyInput{ - PolicyName: aws.String("policyNameType"), // Required - RoleName: aws.String("roleNameType"), // Required - } - resp, err := svc.DeleteRolePolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteSAMLProvider() { - svc := iam.New(session.New()) - - params := &iam.DeleteSAMLProviderInput{ - SAMLProviderArn: aws.String("arnType"), // Required - } - resp, err := svc.DeleteSAMLProvider(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteSSHPublicKey() { - svc := iam.New(session.New()) - - params := &iam.DeleteSSHPublicKeyInput{ - SSHPublicKeyId: aws.String("publicKeyIdType"), // Required - UserName: aws.String("userNameType"), // Required - } - resp, err := svc.DeleteSSHPublicKey(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteServerCertificate() { - svc := iam.New(session.New()) - - params := &iam.DeleteServerCertificateInput{ - ServerCertificateName: aws.String("serverCertificateNameType"), // Required - } - resp, err := svc.DeleteServerCertificate(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteSigningCertificate() { - svc := iam.New(session.New()) - - params := &iam.DeleteSigningCertificateInput{ - CertificateId: aws.String("certificateIdType"), // Required - UserName: aws.String("existingUserNameType"), - } - resp, err := svc.DeleteSigningCertificate(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteUser() { - svc := iam.New(session.New()) - - params := &iam.DeleteUserInput{ - UserName: aws.String("existingUserNameType"), // Required - } - resp, err := svc.DeleteUser(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteUserPolicy() { - svc := iam.New(session.New()) - - params := &iam.DeleteUserPolicyInput{ - PolicyName: aws.String("policyNameType"), // Required - UserName: aws.String("existingUserNameType"), // Required - } - resp, err := svc.DeleteUserPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DeleteVirtualMFADevice() { - svc := iam.New(session.New()) - - params := &iam.DeleteVirtualMFADeviceInput{ - SerialNumber: aws.String("serialNumberType"), // Required - } - resp, err := svc.DeleteVirtualMFADevice(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DetachGroupPolicy() { - svc := iam.New(session.New()) - - params := &iam.DetachGroupPolicyInput{ - GroupName: aws.String("groupNameType"), // Required - PolicyArn: aws.String("arnType"), // Required - } - resp, err := svc.DetachGroupPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DetachRolePolicy() { - svc := iam.New(session.New()) - - params := &iam.DetachRolePolicyInput{ - PolicyArn: aws.String("arnType"), // Required - RoleName: aws.String("roleNameType"), // Required - } - resp, err := svc.DetachRolePolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_DetachUserPolicy() { - svc := iam.New(session.New()) - - params := &iam.DetachUserPolicyInput{ - PolicyArn: aws.String("arnType"), // Required - UserName: aws.String("userNameType"), // Required - } - resp, err := svc.DetachUserPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_EnableMFADevice() { - svc := iam.New(session.New()) - - params := &iam.EnableMFADeviceInput{ - AuthenticationCode1: aws.String("authenticationCodeType"), // Required - AuthenticationCode2: aws.String("authenticationCodeType"), // Required - SerialNumber: aws.String("serialNumberType"), // Required - UserName: aws.String("existingUserNameType"), // Required - } - resp, err := svc.EnableMFADevice(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GenerateCredentialReport() { - svc := iam.New(session.New()) - - var params *iam.GenerateCredentialReportInput - resp, err := svc.GenerateCredentialReport(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetAccessKeyLastUsed() { - svc := iam.New(session.New()) - - params := &iam.GetAccessKeyLastUsedInput{ - AccessKeyId: aws.String("accessKeyIdType"), // Required - } - resp, err := svc.GetAccessKeyLastUsed(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetAccountAuthorizationDetails() { - svc := iam.New(session.New()) - - params := &iam.GetAccountAuthorizationDetailsInput{ - Filter: []*string{ - aws.String("EntityType"), // Required - // More values... - }, - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - } - resp, err := svc.GetAccountAuthorizationDetails(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetAccountPasswordPolicy() { - svc := iam.New(session.New()) - - var params *iam.GetAccountPasswordPolicyInput - resp, err := svc.GetAccountPasswordPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetAccountSummary() { - svc := iam.New(session.New()) - - var params *iam.GetAccountSummaryInput - resp, err := svc.GetAccountSummary(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetContextKeysForCustomPolicy() { - svc := iam.New(session.New()) - - params := &iam.GetContextKeysForCustomPolicyInput{ - PolicyInputList: []*string{ // Required - aws.String("policyDocumentType"), // Required - // More values... - }, - } - resp, err := svc.GetContextKeysForCustomPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetContextKeysForPrincipalPolicy() { - svc := iam.New(session.New()) - - params := &iam.GetContextKeysForPrincipalPolicyInput{ - PolicySourceArn: aws.String("arnType"), // Required - PolicyInputList: []*string{ - aws.String("policyDocumentType"), // Required - // More values... - }, - } - resp, err := svc.GetContextKeysForPrincipalPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetCredentialReport() { - svc := iam.New(session.New()) - - var params *iam.GetCredentialReportInput - resp, err := svc.GetCredentialReport(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetGroup() { - svc := iam.New(session.New()) - - params := &iam.GetGroupInput{ - GroupName: aws.String("groupNameType"), // Required - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - } - resp, err := svc.GetGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetGroupPolicy() { - svc := iam.New(session.New()) - - params := &iam.GetGroupPolicyInput{ - GroupName: aws.String("groupNameType"), // Required - PolicyName: aws.String("policyNameType"), // Required - } - resp, err := svc.GetGroupPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetInstanceProfile() { - svc := iam.New(session.New()) - - params := &iam.GetInstanceProfileInput{ - InstanceProfileName: aws.String("instanceProfileNameType"), // Required - } - resp, err := svc.GetInstanceProfile(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetLoginProfile() { - svc := iam.New(session.New()) - - params := &iam.GetLoginProfileInput{ - UserName: aws.String("userNameType"), // Required - } - resp, err := svc.GetLoginProfile(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetOpenIDConnectProvider() { - svc := iam.New(session.New()) - - params := &iam.GetOpenIDConnectProviderInput{ - OpenIDConnectProviderArn: aws.String("arnType"), // Required - } - resp, err := svc.GetOpenIDConnectProvider(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetPolicy() { - svc := iam.New(session.New()) - - params := &iam.GetPolicyInput{ - PolicyArn: aws.String("arnType"), // Required - } - resp, err := svc.GetPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetPolicyVersion() { - svc := iam.New(session.New()) - - params := &iam.GetPolicyVersionInput{ - PolicyArn: aws.String("arnType"), // Required - VersionId: aws.String("policyVersionIdType"), // Required - } - resp, err := svc.GetPolicyVersion(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetRole() { - svc := iam.New(session.New()) - - params := &iam.GetRoleInput{ - RoleName: aws.String("roleNameType"), // Required - } - resp, err := svc.GetRole(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetRolePolicy() { - svc := iam.New(session.New()) - - params := &iam.GetRolePolicyInput{ - PolicyName: aws.String("policyNameType"), // Required - RoleName: aws.String("roleNameType"), // Required - } - resp, err := svc.GetRolePolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetSAMLProvider() { - svc := iam.New(session.New()) - - params := &iam.GetSAMLProviderInput{ - SAMLProviderArn: aws.String("arnType"), // Required - } - resp, err := svc.GetSAMLProvider(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetSSHPublicKey() { - svc := iam.New(session.New()) - - params := &iam.GetSSHPublicKeyInput{ - Encoding: aws.String("encodingType"), // Required - SSHPublicKeyId: aws.String("publicKeyIdType"), // Required - UserName: aws.String("userNameType"), // Required - } - resp, err := svc.GetSSHPublicKey(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetServerCertificate() { - svc := iam.New(session.New()) - - params := &iam.GetServerCertificateInput{ - ServerCertificateName: aws.String("serverCertificateNameType"), // Required - } - resp, err := svc.GetServerCertificate(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetUser() { - svc := iam.New(session.New()) - - params := &iam.GetUserInput{ - UserName: aws.String("existingUserNameType"), - } - resp, err := svc.GetUser(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_GetUserPolicy() { - svc := iam.New(session.New()) - - params := &iam.GetUserPolicyInput{ - PolicyName: aws.String("policyNameType"), // Required - UserName: aws.String("existingUserNameType"), // Required - } - resp, err := svc.GetUserPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListAccessKeys() { - svc := iam.New(session.New()) - - params := &iam.ListAccessKeysInput{ - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - UserName: aws.String("existingUserNameType"), - } - resp, err := svc.ListAccessKeys(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListAccountAliases() { - svc := iam.New(session.New()) - - params := &iam.ListAccountAliasesInput{ - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - } - resp, err := svc.ListAccountAliases(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListAttachedGroupPolicies() { - svc := iam.New(session.New()) - - params := &iam.ListAttachedGroupPoliciesInput{ - GroupName: aws.String("groupNameType"), // Required - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - PathPrefix: aws.String("policyPathType"), - } - resp, err := svc.ListAttachedGroupPolicies(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListAttachedRolePolicies() { - svc := iam.New(session.New()) - - params := &iam.ListAttachedRolePoliciesInput{ - RoleName: aws.String("roleNameType"), // Required - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - PathPrefix: aws.String("policyPathType"), - } - resp, err := svc.ListAttachedRolePolicies(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListAttachedUserPolicies() { - svc := iam.New(session.New()) - - params := &iam.ListAttachedUserPoliciesInput{ - UserName: aws.String("userNameType"), // Required - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - PathPrefix: aws.String("policyPathType"), - } - resp, err := svc.ListAttachedUserPolicies(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListEntitiesForPolicy() { - svc := iam.New(session.New()) - - params := &iam.ListEntitiesForPolicyInput{ - PolicyArn: aws.String("arnType"), // Required - EntityFilter: aws.String("EntityType"), - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - PathPrefix: aws.String("pathType"), - } - resp, err := svc.ListEntitiesForPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListGroupPolicies() { - svc := iam.New(session.New()) - - params := &iam.ListGroupPoliciesInput{ - GroupName: aws.String("groupNameType"), // Required - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - } - resp, err := svc.ListGroupPolicies(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListGroups() { - svc := iam.New(session.New()) - - params := &iam.ListGroupsInput{ - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - PathPrefix: aws.String("pathPrefixType"), - } - resp, err := svc.ListGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListGroupsForUser() { - svc := iam.New(session.New()) - - params := &iam.ListGroupsForUserInput{ - UserName: aws.String("existingUserNameType"), // Required - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - } - resp, err := svc.ListGroupsForUser(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListInstanceProfiles() { - svc := iam.New(session.New()) - - params := &iam.ListInstanceProfilesInput{ - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - PathPrefix: aws.String("pathPrefixType"), - } - resp, err := svc.ListInstanceProfiles(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListInstanceProfilesForRole() { - svc := iam.New(session.New()) - - params := &iam.ListInstanceProfilesForRoleInput{ - RoleName: aws.String("roleNameType"), // Required - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - } - resp, err := svc.ListInstanceProfilesForRole(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListMFADevices() { - svc := iam.New(session.New()) - - params := &iam.ListMFADevicesInput{ - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - UserName: aws.String("existingUserNameType"), - } - resp, err := svc.ListMFADevices(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListOpenIDConnectProviders() { - svc := iam.New(session.New()) - - var params *iam.ListOpenIDConnectProvidersInput - resp, err := svc.ListOpenIDConnectProviders(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListPolicies() { - svc := iam.New(session.New()) - - params := &iam.ListPoliciesInput{ - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - OnlyAttached: aws.Bool(true), - PathPrefix: aws.String("policyPathType"), - Scope: aws.String("policyScopeType"), - } - resp, err := svc.ListPolicies(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListPolicyVersions() { - svc := iam.New(session.New()) - - params := &iam.ListPolicyVersionsInput{ - PolicyArn: aws.String("arnType"), // Required - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - } - resp, err := svc.ListPolicyVersions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListRolePolicies() { - svc := iam.New(session.New()) - - params := &iam.ListRolePoliciesInput{ - RoleName: aws.String("roleNameType"), // Required - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - } - resp, err := svc.ListRolePolicies(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListRoles() { - svc := iam.New(session.New()) - - params := &iam.ListRolesInput{ - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - PathPrefix: aws.String("pathPrefixType"), - } - resp, err := svc.ListRoles(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListSAMLProviders() { - svc := iam.New(session.New()) - - var params *iam.ListSAMLProvidersInput - resp, err := svc.ListSAMLProviders(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListSSHPublicKeys() { - svc := iam.New(session.New()) - - params := &iam.ListSSHPublicKeysInput{ - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - UserName: aws.String("userNameType"), - } - resp, err := svc.ListSSHPublicKeys(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListServerCertificates() { - svc := iam.New(session.New()) - - params := &iam.ListServerCertificatesInput{ - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - PathPrefix: aws.String("pathPrefixType"), - } - resp, err := svc.ListServerCertificates(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListSigningCertificates() { - svc := iam.New(session.New()) - - params := &iam.ListSigningCertificatesInput{ - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - UserName: aws.String("existingUserNameType"), - } - resp, err := svc.ListSigningCertificates(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListUserPolicies() { - svc := iam.New(session.New()) - - params := &iam.ListUserPoliciesInput{ - UserName: aws.String("existingUserNameType"), // Required - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - } - resp, err := svc.ListUserPolicies(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListUsers() { - svc := iam.New(session.New()) - - params := &iam.ListUsersInput{ - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - PathPrefix: aws.String("pathPrefixType"), - } - resp, err := svc.ListUsers(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ListVirtualMFADevices() { - svc := iam.New(session.New()) - - params := &iam.ListVirtualMFADevicesInput{ - AssignmentStatus: aws.String("assignmentStatusType"), - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - } - resp, err := svc.ListVirtualMFADevices(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_PutGroupPolicy() { - svc := iam.New(session.New()) - - params := &iam.PutGroupPolicyInput{ - GroupName: aws.String("groupNameType"), // Required - PolicyDocument: aws.String("policyDocumentType"), // Required - PolicyName: aws.String("policyNameType"), // Required - } - resp, err := svc.PutGroupPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_PutRolePolicy() { - svc := iam.New(session.New()) - - params := &iam.PutRolePolicyInput{ - PolicyDocument: aws.String("policyDocumentType"), // Required - PolicyName: aws.String("policyNameType"), // Required - RoleName: aws.String("roleNameType"), // Required - } - resp, err := svc.PutRolePolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_PutUserPolicy() { - svc := iam.New(session.New()) - - params := &iam.PutUserPolicyInput{ - PolicyDocument: aws.String("policyDocumentType"), // Required - PolicyName: aws.String("policyNameType"), // Required - UserName: aws.String("existingUserNameType"), // Required - } - resp, err := svc.PutUserPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_RemoveClientIDFromOpenIDConnectProvider() { - svc := iam.New(session.New()) - - params := &iam.RemoveClientIDFromOpenIDConnectProviderInput{ - ClientID: aws.String("clientIDType"), // Required - OpenIDConnectProviderArn: aws.String("arnType"), // Required - } - resp, err := svc.RemoveClientIDFromOpenIDConnectProvider(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_RemoveRoleFromInstanceProfile() { - svc := iam.New(session.New()) - - params := &iam.RemoveRoleFromInstanceProfileInput{ - InstanceProfileName: aws.String("instanceProfileNameType"), // Required - RoleName: aws.String("roleNameType"), // Required - } - resp, err := svc.RemoveRoleFromInstanceProfile(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_RemoveUserFromGroup() { - svc := iam.New(session.New()) - - params := &iam.RemoveUserFromGroupInput{ - GroupName: aws.String("groupNameType"), // Required - UserName: aws.String("existingUserNameType"), // Required - } - resp, err := svc.RemoveUserFromGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_ResyncMFADevice() { - svc := iam.New(session.New()) - - params := &iam.ResyncMFADeviceInput{ - AuthenticationCode1: aws.String("authenticationCodeType"), // Required - AuthenticationCode2: aws.String("authenticationCodeType"), // Required - SerialNumber: aws.String("serialNumberType"), // Required - UserName: aws.String("existingUserNameType"), // Required - } - resp, err := svc.ResyncMFADevice(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_SetDefaultPolicyVersion() { - svc := iam.New(session.New()) - - params := &iam.SetDefaultPolicyVersionInput{ - PolicyArn: aws.String("arnType"), // Required - VersionId: aws.String("policyVersionIdType"), // Required - } - resp, err := svc.SetDefaultPolicyVersion(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_SimulateCustomPolicy() { - svc := iam.New(session.New()) - - params := &iam.SimulateCustomPolicyInput{ - ActionNames: []*string{ // Required - aws.String("ActionNameType"), // Required - // More values... - }, - PolicyInputList: []*string{ // Required - aws.String("policyDocumentType"), // Required - // More values... - }, - CallerArn: aws.String("ResourceNameType"), - ContextEntries: []*iam.ContextEntry{ - { // Required - ContextKeyName: aws.String("ContextKeyNameType"), - ContextKeyType: aws.String("ContextKeyTypeEnum"), - ContextKeyValues: []*string{ - aws.String("ContextKeyValueType"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - ResourceArns: []*string{ - aws.String("ResourceNameType"), // Required - // More values... - }, - ResourceHandlingOption: aws.String("ResourceHandlingOptionType"), - ResourceOwner: aws.String("ResourceNameType"), - ResourcePolicy: aws.String("policyDocumentType"), - } - resp, err := svc.SimulateCustomPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_SimulatePrincipalPolicy() { - svc := iam.New(session.New()) - - params := &iam.SimulatePrincipalPolicyInput{ - ActionNames: []*string{ // Required - aws.String("ActionNameType"), // Required - // More values... - }, - PolicySourceArn: aws.String("arnType"), // Required - CallerArn: aws.String("ResourceNameType"), - ContextEntries: []*iam.ContextEntry{ - { // Required - ContextKeyName: aws.String("ContextKeyNameType"), - ContextKeyType: aws.String("ContextKeyTypeEnum"), - ContextKeyValues: []*string{ - aws.String("ContextKeyValueType"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("markerType"), - MaxItems: aws.Int64(1), - PolicyInputList: []*string{ - aws.String("policyDocumentType"), // Required - // More values... - }, - ResourceArns: []*string{ - aws.String("ResourceNameType"), // Required - // More values... - }, - ResourceHandlingOption: aws.String("ResourceHandlingOptionType"), - ResourceOwner: aws.String("ResourceNameType"), - ResourcePolicy: aws.String("policyDocumentType"), - } - resp, err := svc.SimulatePrincipalPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_UpdateAccessKey() { - svc := iam.New(session.New()) - - params := &iam.UpdateAccessKeyInput{ - AccessKeyId: aws.String("accessKeyIdType"), // Required - Status: aws.String("statusType"), // Required - UserName: aws.String("existingUserNameType"), - } - resp, err := svc.UpdateAccessKey(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_UpdateAccountPasswordPolicy() { - svc := iam.New(session.New()) - - params := &iam.UpdateAccountPasswordPolicyInput{ - AllowUsersToChangePassword: aws.Bool(true), - HardExpiry: aws.Bool(true), - MaxPasswordAge: aws.Int64(1), - MinimumPasswordLength: aws.Int64(1), - PasswordReusePrevention: aws.Int64(1), - RequireLowercaseCharacters: aws.Bool(true), - RequireNumbers: aws.Bool(true), - RequireSymbols: aws.Bool(true), - RequireUppercaseCharacters: aws.Bool(true), - } - resp, err := svc.UpdateAccountPasswordPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_UpdateAssumeRolePolicy() { - svc := iam.New(session.New()) - - params := &iam.UpdateAssumeRolePolicyInput{ - PolicyDocument: aws.String("policyDocumentType"), // Required - RoleName: aws.String("roleNameType"), // Required - } - resp, err := svc.UpdateAssumeRolePolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_UpdateGroup() { - svc := iam.New(session.New()) - - params := &iam.UpdateGroupInput{ - GroupName: aws.String("groupNameType"), // Required - NewGroupName: aws.String("groupNameType"), - NewPath: aws.String("pathType"), - } - resp, err := svc.UpdateGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_UpdateLoginProfile() { - svc := iam.New(session.New()) - - params := &iam.UpdateLoginProfileInput{ - UserName: aws.String("userNameType"), // Required - Password: aws.String("passwordType"), - PasswordResetRequired: aws.Bool(true), - } - resp, err := svc.UpdateLoginProfile(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_UpdateOpenIDConnectProviderThumbprint() { - svc := iam.New(session.New()) - - params := &iam.UpdateOpenIDConnectProviderThumbprintInput{ - OpenIDConnectProviderArn: aws.String("arnType"), // Required - ThumbprintList: []*string{ // Required - aws.String("thumbprintType"), // Required - // More values... - }, - } - resp, err := svc.UpdateOpenIDConnectProviderThumbprint(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_UpdateSAMLProvider() { - svc := iam.New(session.New()) - - params := &iam.UpdateSAMLProviderInput{ - SAMLMetadataDocument: aws.String("SAMLMetadataDocumentType"), // Required - SAMLProviderArn: aws.String("arnType"), // Required - } - resp, err := svc.UpdateSAMLProvider(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_UpdateSSHPublicKey() { - svc := iam.New(session.New()) - - params := &iam.UpdateSSHPublicKeyInput{ - SSHPublicKeyId: aws.String("publicKeyIdType"), // Required - Status: aws.String("statusType"), // Required - UserName: aws.String("userNameType"), // Required - } - resp, err := svc.UpdateSSHPublicKey(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_UpdateServerCertificate() { - svc := iam.New(session.New()) - - params := &iam.UpdateServerCertificateInput{ - ServerCertificateName: aws.String("serverCertificateNameType"), // Required - NewPath: aws.String("pathType"), - NewServerCertificateName: aws.String("serverCertificateNameType"), - } - resp, err := svc.UpdateServerCertificate(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_UpdateSigningCertificate() { - svc := iam.New(session.New()) - - params := &iam.UpdateSigningCertificateInput{ - CertificateId: aws.String("certificateIdType"), // Required - Status: aws.String("statusType"), // Required - UserName: aws.String("existingUserNameType"), - } - resp, err := svc.UpdateSigningCertificate(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_UpdateUser() { - svc := iam.New(session.New()) - - params := &iam.UpdateUserInput{ - UserName: aws.String("existingUserNameType"), // Required - NewPath: aws.String("pathType"), - NewUserName: aws.String("userNameType"), - } - resp, err := svc.UpdateUser(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_UploadSSHPublicKey() { - svc := iam.New(session.New()) - - params := &iam.UploadSSHPublicKeyInput{ - SSHPublicKeyBody: aws.String("publicKeyMaterialType"), // Required - UserName: aws.String("userNameType"), // Required - } - resp, err := svc.UploadSSHPublicKey(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_UploadServerCertificate() { - svc := iam.New(session.New()) - - params := &iam.UploadServerCertificateInput{ - CertificateBody: aws.String("certificateBodyType"), // Required - PrivateKey: aws.String("privateKeyType"), // Required - ServerCertificateName: aws.String("serverCertificateNameType"), // Required - CertificateChain: aws.String("certificateChainType"), - Path: aws.String("pathType"), - } - resp, err := svc.UploadServerCertificate(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleIAM_UploadSigningCertificate() { - svc := iam.New(session.New()) - - params := &iam.UploadSigningCertificateInput{ - CertificateBody: aws.String("certificateBodyType"), // Required - UserName: aws.String("existingUserNameType"), - } - resp, err := svc.UploadSigningCertificate(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/kinesis/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/kinesis/examples_test.go deleted file mode 100644 index ea90cea6f6..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/kinesis/examples_test.go +++ /dev/null @@ -1,337 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package kinesis_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/kinesis" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleKinesis_AddTagsToStream() { - svc := kinesis.New(session.New()) - - params := &kinesis.AddTagsToStreamInput{ - StreamName: aws.String("StreamName"), // Required - Tags: map[string]*string{ // Required - "Key": aws.String("TagValue"), // Required - // More values... - }, - } - resp, err := svc.AddTagsToStream(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleKinesis_CreateStream() { - svc := kinesis.New(session.New()) - - params := &kinesis.CreateStreamInput{ - ShardCount: aws.Int64(1), // Required - StreamName: aws.String("StreamName"), // Required - } - resp, err := svc.CreateStream(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleKinesis_DecreaseStreamRetentionPeriod() { - svc := kinesis.New(session.New()) - - params := &kinesis.DecreaseStreamRetentionPeriodInput{ - RetentionPeriodHours: aws.Int64(1), // Required - StreamName: aws.String("StreamName"), // Required - } - resp, err := svc.DecreaseStreamRetentionPeriod(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleKinesis_DeleteStream() { - svc := kinesis.New(session.New()) - - params := &kinesis.DeleteStreamInput{ - StreamName: aws.String("StreamName"), // Required - } - resp, err := svc.DeleteStream(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleKinesis_DescribeStream() { - svc := kinesis.New(session.New()) - - params := &kinesis.DescribeStreamInput{ - StreamName: aws.String("StreamName"), // Required - ExclusiveStartShardId: aws.String("ShardId"), - Limit: aws.Int64(1), - } - resp, err := svc.DescribeStream(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleKinesis_GetRecords() { - svc := kinesis.New(session.New()) - - params := &kinesis.GetRecordsInput{ - ShardIterator: aws.String("ShardIterator"), // Required - Limit: aws.Int64(1), - } - resp, err := svc.GetRecords(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleKinesis_GetShardIterator() { - svc := kinesis.New(session.New()) - - params := &kinesis.GetShardIteratorInput{ - ShardId: aws.String("ShardId"), // Required - ShardIteratorType: aws.String("ShardIteratorType"), // Required - StreamName: aws.String("StreamName"), // Required - StartingSequenceNumber: aws.String("SequenceNumber"), - } - resp, err := svc.GetShardIterator(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleKinesis_IncreaseStreamRetentionPeriod() { - svc := kinesis.New(session.New()) - - params := &kinesis.IncreaseStreamRetentionPeriodInput{ - RetentionPeriodHours: aws.Int64(1), // Required - StreamName: aws.String("StreamName"), // Required - } - resp, err := svc.IncreaseStreamRetentionPeriod(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleKinesis_ListStreams() { - svc := kinesis.New(session.New()) - - params := &kinesis.ListStreamsInput{ - ExclusiveStartStreamName: aws.String("StreamName"), - Limit: aws.Int64(1), - } - resp, err := svc.ListStreams(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleKinesis_ListTagsForStream() { - svc := kinesis.New(session.New()) - - params := &kinesis.ListTagsForStreamInput{ - StreamName: aws.String("StreamName"), // Required - ExclusiveStartTagKey: aws.String("TagKey"), - Limit: aws.Int64(1), - } - resp, err := svc.ListTagsForStream(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleKinesis_MergeShards() { - svc := kinesis.New(session.New()) - - params := &kinesis.MergeShardsInput{ - AdjacentShardToMerge: aws.String("ShardId"), // Required - ShardToMerge: aws.String("ShardId"), // Required - StreamName: aws.String("StreamName"), // Required - } - resp, err := svc.MergeShards(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleKinesis_PutRecord() { - svc := kinesis.New(session.New()) - - params := &kinesis.PutRecordInput{ - Data: []byte("PAYLOAD"), // Required - PartitionKey: aws.String("PartitionKey"), // Required - StreamName: aws.String("StreamName"), // Required - ExplicitHashKey: aws.String("HashKey"), - SequenceNumberForOrdering: aws.String("SequenceNumber"), - } - resp, err := svc.PutRecord(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleKinesis_PutRecords() { - svc := kinesis.New(session.New()) - - params := &kinesis.PutRecordsInput{ - Records: []*kinesis.PutRecordsRequestEntry{ // Required - { // Required - Data: []byte("PAYLOAD"), // Required - PartitionKey: aws.String("PartitionKey"), // Required - ExplicitHashKey: aws.String("HashKey"), - }, - // More values... - }, - StreamName: aws.String("StreamName"), // Required - } - resp, err := svc.PutRecords(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleKinesis_RemoveTagsFromStream() { - svc := kinesis.New(session.New()) - - params := &kinesis.RemoveTagsFromStreamInput{ - StreamName: aws.String("StreamName"), // Required - TagKeys: []*string{ // Required - aws.String("TagKey"), // Required - // More values... - }, - } - resp, err := svc.RemoveTagsFromStream(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleKinesis_SplitShard() { - svc := kinesis.New(session.New()) - - params := &kinesis.SplitShardInput{ - NewStartingHashKey: aws.String("HashKey"), // Required - ShardToSplit: aws.String("ShardId"), // Required - StreamName: aws.String("StreamName"), // Required - } - resp, err := svc.SplitShard(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/lambda/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/lambda/examples_test.go deleted file mode 100644 index 01566a2f54..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/lambda/examples_test.go +++ /dev/null @@ -1,539 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package lambda_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/lambda" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleLambda_AddPermission() { - svc := lambda.New(session.New()) - - params := &lambda.AddPermissionInput{ - Action: aws.String("Action"), // Required - FunctionName: aws.String("FunctionName"), // Required - Principal: aws.String("Principal"), // Required - StatementId: aws.String("StatementId"), // Required - Qualifier: aws.String("Qualifier"), - SourceAccount: aws.String("SourceOwner"), - SourceArn: aws.String("Arn"), - } - resp, err := svc.AddPermission(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_CreateAlias() { - svc := lambda.New(session.New()) - - params := &lambda.CreateAliasInput{ - FunctionName: aws.String("FunctionName"), // Required - FunctionVersion: aws.String("Version"), // Required - Name: aws.String("Alias"), // Required - Description: aws.String("Description"), - } - resp, err := svc.CreateAlias(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_CreateEventSourceMapping() { - svc := lambda.New(session.New()) - - params := &lambda.CreateEventSourceMappingInput{ - EventSourceArn: aws.String("Arn"), // Required - FunctionName: aws.String("FunctionName"), // Required - StartingPosition: aws.String("EventSourcePosition"), // Required - BatchSize: aws.Int64(1), - Enabled: aws.Bool(true), - } - resp, err := svc.CreateEventSourceMapping(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_CreateFunction() { - svc := lambda.New(session.New()) - - params := &lambda.CreateFunctionInput{ - Code: &lambda.FunctionCode{ // Required - S3Bucket: aws.String("S3Bucket"), - S3Key: aws.String("S3Key"), - S3ObjectVersion: aws.String("S3ObjectVersion"), - ZipFile: []byte("PAYLOAD"), - }, - FunctionName: aws.String("FunctionName"), // Required - Handler: aws.String("Handler"), // Required - Role: aws.String("RoleArn"), // Required - Runtime: aws.String("Runtime"), // Required - Description: aws.String("Description"), - MemorySize: aws.Int64(1), - Publish: aws.Bool(true), - Timeout: aws.Int64(1), - } - resp, err := svc.CreateFunction(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_DeleteAlias() { - svc := lambda.New(session.New()) - - params := &lambda.DeleteAliasInput{ - FunctionName: aws.String("FunctionName"), // Required - Name: aws.String("Alias"), // Required - } - resp, err := svc.DeleteAlias(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_DeleteEventSourceMapping() { - svc := lambda.New(session.New()) - - params := &lambda.DeleteEventSourceMappingInput{ - UUID: aws.String("String"), // Required - } - resp, err := svc.DeleteEventSourceMapping(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_DeleteFunction() { - svc := lambda.New(session.New()) - - params := &lambda.DeleteFunctionInput{ - FunctionName: aws.String("FunctionName"), // Required - Qualifier: aws.String("Qualifier"), - } - resp, err := svc.DeleteFunction(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_GetAlias() { - svc := lambda.New(session.New()) - - params := &lambda.GetAliasInput{ - FunctionName: aws.String("FunctionName"), // Required - Name: aws.String("Alias"), // Required - } - resp, err := svc.GetAlias(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_GetEventSourceMapping() { - svc := lambda.New(session.New()) - - params := &lambda.GetEventSourceMappingInput{ - UUID: aws.String("String"), // Required - } - resp, err := svc.GetEventSourceMapping(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_GetFunction() { - svc := lambda.New(session.New()) - - params := &lambda.GetFunctionInput{ - FunctionName: aws.String("FunctionName"), // Required - Qualifier: aws.String("Qualifier"), - } - resp, err := svc.GetFunction(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_GetFunctionConfiguration() { - svc := lambda.New(session.New()) - - params := &lambda.GetFunctionConfigurationInput{ - FunctionName: aws.String("FunctionName"), // Required - Qualifier: aws.String("Qualifier"), - } - resp, err := svc.GetFunctionConfiguration(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_GetPolicy() { - svc := lambda.New(session.New()) - - params := &lambda.GetPolicyInput{ - FunctionName: aws.String("FunctionName"), // Required - Qualifier: aws.String("Qualifier"), - } - resp, err := svc.GetPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_Invoke() { - svc := lambda.New(session.New()) - - params := &lambda.InvokeInput{ - FunctionName: aws.String("FunctionName"), // Required - ClientContext: aws.String("String"), - InvocationType: aws.String("InvocationType"), - LogType: aws.String("LogType"), - Payload: []byte("PAYLOAD"), - Qualifier: aws.String("Qualifier"), - } - resp, err := svc.Invoke(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_InvokeAsync() { - svc := lambda.New(session.New()) - - params := &lambda.InvokeAsyncInput{ - FunctionName: aws.String("FunctionName"), // Required - InvokeArgs: bytes.NewReader([]byte("PAYLOAD")), // Required - } - resp, err := svc.InvokeAsync(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_ListAliases() { - svc := lambda.New(session.New()) - - params := &lambda.ListAliasesInput{ - FunctionName: aws.String("FunctionName"), // Required - FunctionVersion: aws.String("Version"), - Marker: aws.String("String"), - MaxItems: aws.Int64(1), - } - resp, err := svc.ListAliases(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_ListEventSourceMappings() { - svc := lambda.New(session.New()) - - params := &lambda.ListEventSourceMappingsInput{ - EventSourceArn: aws.String("Arn"), - FunctionName: aws.String("FunctionName"), - Marker: aws.String("String"), - MaxItems: aws.Int64(1), - } - resp, err := svc.ListEventSourceMappings(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_ListFunctions() { - svc := lambda.New(session.New()) - - params := &lambda.ListFunctionsInput{ - Marker: aws.String("String"), - MaxItems: aws.Int64(1), - } - resp, err := svc.ListFunctions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_ListVersionsByFunction() { - svc := lambda.New(session.New()) - - params := &lambda.ListVersionsByFunctionInput{ - FunctionName: aws.String("FunctionName"), // Required - Marker: aws.String("String"), - MaxItems: aws.Int64(1), - } - resp, err := svc.ListVersionsByFunction(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_PublishVersion() { - svc := lambda.New(session.New()) - - params := &lambda.PublishVersionInput{ - FunctionName: aws.String("FunctionName"), // Required - CodeSha256: aws.String("String"), - Description: aws.String("Description"), - } - resp, err := svc.PublishVersion(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_RemovePermission() { - svc := lambda.New(session.New()) - - params := &lambda.RemovePermissionInput{ - FunctionName: aws.String("FunctionName"), // Required - StatementId: aws.String("StatementId"), // Required - Qualifier: aws.String("Qualifier"), - } - resp, err := svc.RemovePermission(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_UpdateAlias() { - svc := lambda.New(session.New()) - - params := &lambda.UpdateAliasInput{ - FunctionName: aws.String("FunctionName"), // Required - Name: aws.String("Alias"), // Required - Description: aws.String("Description"), - FunctionVersion: aws.String("Version"), - } - resp, err := svc.UpdateAlias(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_UpdateEventSourceMapping() { - svc := lambda.New(session.New()) - - params := &lambda.UpdateEventSourceMappingInput{ - UUID: aws.String("String"), // Required - BatchSize: aws.Int64(1), - Enabled: aws.Bool(true), - FunctionName: aws.String("FunctionName"), - } - resp, err := svc.UpdateEventSourceMapping(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_UpdateFunctionCode() { - svc := lambda.New(session.New()) - - params := &lambda.UpdateFunctionCodeInput{ - FunctionName: aws.String("FunctionName"), // Required - Publish: aws.Bool(true), - S3Bucket: aws.String("S3Bucket"), - S3Key: aws.String("S3Key"), - S3ObjectVersion: aws.String("S3ObjectVersion"), - ZipFile: []byte("PAYLOAD"), - } - resp, err := svc.UpdateFunctionCode(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleLambda_UpdateFunctionConfiguration() { - svc := lambda.New(session.New()) - - params := &lambda.UpdateFunctionConfigurationInput{ - FunctionName: aws.String("FunctionName"), // Required - Description: aws.String("Description"), - Handler: aws.String("Handler"), - MemorySize: aws.Int64(1), - Role: aws.String("RoleArn"), - Timeout: aws.Int64(1), - } - resp, err := svc.UpdateFunctionConfiguration(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/opsworks/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/opsworks/examples_test.go deleted file mode 100644 index 604caeb67f..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/opsworks/examples_test.go +++ /dev/null @@ -1,1890 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package opsworks_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/opsworks" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleOpsWorks_AssignInstance() { - svc := opsworks.New(session.New()) - - params := &opsworks.AssignInstanceInput{ - InstanceId: aws.String("String"), // Required - LayerIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.AssignInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_AssignVolume() { - svc := opsworks.New(session.New()) - - params := &opsworks.AssignVolumeInput{ - VolumeId: aws.String("String"), // Required - InstanceId: aws.String("String"), - } - resp, err := svc.AssignVolume(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_AssociateElasticIp() { - svc := opsworks.New(session.New()) - - params := &opsworks.AssociateElasticIpInput{ - ElasticIp: aws.String("String"), // Required - InstanceId: aws.String("String"), - } - resp, err := svc.AssociateElasticIp(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_AttachElasticLoadBalancer() { - svc := opsworks.New(session.New()) - - params := &opsworks.AttachElasticLoadBalancerInput{ - ElasticLoadBalancerName: aws.String("String"), // Required - LayerId: aws.String("String"), // Required - } - resp, err := svc.AttachElasticLoadBalancer(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_CloneStack() { - svc := opsworks.New(session.New()) - - params := &opsworks.CloneStackInput{ - ServiceRoleArn: aws.String("String"), // Required - SourceStackId: aws.String("String"), // Required - AgentVersion: aws.String("String"), - Attributes: map[string]*string{ - "Key": aws.String("String"), // Required - // More values... - }, - ChefConfiguration: &opsworks.ChefConfiguration{ - BerkshelfVersion: aws.String("String"), - ManageBerkshelf: aws.Bool(true), - }, - CloneAppIds: []*string{ - aws.String("String"), // Required - // More values... - }, - ClonePermissions: aws.Bool(true), - ConfigurationManager: &opsworks.StackConfigurationManager{ - Name: aws.String("String"), - Version: aws.String("String"), - }, - CustomCookbooksSource: &opsworks.Source{ - Password: aws.String("String"), - Revision: aws.String("String"), - SshKey: aws.String("String"), - Type: aws.String("SourceType"), - Url: aws.String("String"), - Username: aws.String("String"), - }, - CustomJson: aws.String("String"), - DefaultAvailabilityZone: aws.String("String"), - DefaultInstanceProfileArn: aws.String("String"), - DefaultOs: aws.String("String"), - DefaultRootDeviceType: aws.String("RootDeviceType"), - DefaultSshKeyName: aws.String("String"), - DefaultSubnetId: aws.String("String"), - HostnameTheme: aws.String("String"), - Name: aws.String("String"), - Region: aws.String("String"), - UseCustomCookbooks: aws.Bool(true), - UseOpsworksSecurityGroups: aws.Bool(true), - VpcId: aws.String("String"), - } - resp, err := svc.CloneStack(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_CreateApp() { - svc := opsworks.New(session.New()) - - params := &opsworks.CreateAppInput{ - Name: aws.String("String"), // Required - StackId: aws.String("String"), // Required - Type: aws.String("AppType"), // Required - AppSource: &opsworks.Source{ - Password: aws.String("String"), - Revision: aws.String("String"), - SshKey: aws.String("String"), - Type: aws.String("SourceType"), - Url: aws.String("String"), - Username: aws.String("String"), - }, - Attributes: map[string]*string{ - "Key": aws.String("String"), // Required - // More values... - }, - DataSources: []*opsworks.DataSource{ - { // Required - Arn: aws.String("String"), - DatabaseName: aws.String("String"), - Type: aws.String("String"), - }, - // More values... - }, - Description: aws.String("String"), - Domains: []*string{ - aws.String("String"), // Required - // More values... - }, - EnableSsl: aws.Bool(true), - Environment: []*opsworks.EnvironmentVariable{ - { // Required - Key: aws.String("String"), // Required - Value: aws.String("String"), // Required - Secure: aws.Bool(true), - }, - // More values... - }, - Shortname: aws.String("String"), - SslConfiguration: &opsworks.SslConfiguration{ - Certificate: aws.String("String"), // Required - PrivateKey: aws.String("String"), // Required - Chain: aws.String("String"), - }, - } - resp, err := svc.CreateApp(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_CreateDeployment() { - svc := opsworks.New(session.New()) - - params := &opsworks.CreateDeploymentInput{ - Command: &opsworks.DeploymentCommand{ // Required - Name: aws.String("DeploymentCommandName"), // Required - Args: map[string][]*string{ - "Key": { // Required - aws.String("String"), // Required - // More values... - }, - // More values... - }, - }, - StackId: aws.String("String"), // Required - AppId: aws.String("String"), - Comment: aws.String("String"), - CustomJson: aws.String("String"), - InstanceIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.CreateDeployment(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_CreateInstance() { - svc := opsworks.New(session.New()) - - params := &opsworks.CreateInstanceInput{ - InstanceType: aws.String("String"), // Required - LayerIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - StackId: aws.String("String"), // Required - AgentVersion: aws.String("String"), - AmiId: aws.String("String"), - Architecture: aws.String("Architecture"), - AutoScalingType: aws.String("AutoScalingType"), - AvailabilityZone: aws.String("String"), - BlockDeviceMappings: []*opsworks.BlockDeviceMapping{ - { // Required - DeviceName: aws.String("String"), - Ebs: &opsworks.EbsBlockDevice{ - DeleteOnTermination: aws.Bool(true), - Iops: aws.Int64(1), - SnapshotId: aws.String("String"), - VolumeSize: aws.Int64(1), - VolumeType: aws.String("VolumeType"), - }, - NoDevice: aws.String("String"), - VirtualName: aws.String("String"), - }, - // More values... - }, - EbsOptimized: aws.Bool(true), - Hostname: aws.String("String"), - InstallUpdatesOnBoot: aws.Bool(true), - Os: aws.String("String"), - RootDeviceType: aws.String("RootDeviceType"), - SshKeyName: aws.String("String"), - SubnetId: aws.String("String"), - VirtualizationType: aws.String("String"), - } - resp, err := svc.CreateInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_CreateLayer() { - svc := opsworks.New(session.New()) - - params := &opsworks.CreateLayerInput{ - Name: aws.String("String"), // Required - Shortname: aws.String("String"), // Required - StackId: aws.String("String"), // Required - Type: aws.String("LayerType"), // Required - Attributes: map[string]*string{ - "Key": aws.String("String"), // Required - // More values... - }, - AutoAssignElasticIps: aws.Bool(true), - AutoAssignPublicIps: aws.Bool(true), - CustomInstanceProfileArn: aws.String("String"), - CustomJson: aws.String("String"), - CustomRecipes: &opsworks.Recipes{ - Configure: []*string{ - aws.String("String"), // Required - // More values... - }, - Deploy: []*string{ - aws.String("String"), // Required - // More values... - }, - Setup: []*string{ - aws.String("String"), // Required - // More values... - }, - Shutdown: []*string{ - aws.String("String"), // Required - // More values... - }, - Undeploy: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - CustomSecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - EnableAutoHealing: aws.Bool(true), - InstallUpdatesOnBoot: aws.Bool(true), - LifecycleEventConfiguration: &opsworks.LifecycleEventConfiguration{ - Shutdown: &opsworks.ShutdownEventConfiguration{ - DelayUntilElbConnectionsDrained: aws.Bool(true), - ExecutionTimeout: aws.Int64(1), - }, - }, - Packages: []*string{ - aws.String("String"), // Required - // More values... - }, - UseEbsOptimizedInstances: aws.Bool(true), - VolumeConfigurations: []*opsworks.VolumeConfiguration{ - { // Required - MountPoint: aws.String("String"), // Required - NumberOfDisks: aws.Int64(1), // Required - Size: aws.Int64(1), // Required - Iops: aws.Int64(1), - RaidLevel: aws.Int64(1), - VolumeType: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateLayer(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_CreateStack() { - svc := opsworks.New(session.New()) - - params := &opsworks.CreateStackInput{ - DefaultInstanceProfileArn: aws.String("String"), // Required - Name: aws.String("String"), // Required - Region: aws.String("String"), // Required - ServiceRoleArn: aws.String("String"), // Required - AgentVersion: aws.String("String"), - Attributes: map[string]*string{ - "Key": aws.String("String"), // Required - // More values... - }, - ChefConfiguration: &opsworks.ChefConfiguration{ - BerkshelfVersion: aws.String("String"), - ManageBerkshelf: aws.Bool(true), - }, - ConfigurationManager: &opsworks.StackConfigurationManager{ - Name: aws.String("String"), - Version: aws.String("String"), - }, - CustomCookbooksSource: &opsworks.Source{ - Password: aws.String("String"), - Revision: aws.String("String"), - SshKey: aws.String("String"), - Type: aws.String("SourceType"), - Url: aws.String("String"), - Username: aws.String("String"), - }, - CustomJson: aws.String("String"), - DefaultAvailabilityZone: aws.String("String"), - DefaultOs: aws.String("String"), - DefaultRootDeviceType: aws.String("RootDeviceType"), - DefaultSshKeyName: aws.String("String"), - DefaultSubnetId: aws.String("String"), - HostnameTheme: aws.String("String"), - UseCustomCookbooks: aws.Bool(true), - UseOpsworksSecurityGroups: aws.Bool(true), - VpcId: aws.String("String"), - } - resp, err := svc.CreateStack(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_CreateUserProfile() { - svc := opsworks.New(session.New()) - - params := &opsworks.CreateUserProfileInput{ - IamUserArn: aws.String("String"), // Required - AllowSelfManagement: aws.Bool(true), - SshPublicKey: aws.String("String"), - SshUsername: aws.String("String"), - } - resp, err := svc.CreateUserProfile(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DeleteApp() { - svc := opsworks.New(session.New()) - - params := &opsworks.DeleteAppInput{ - AppId: aws.String("String"), // Required - } - resp, err := svc.DeleteApp(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DeleteInstance() { - svc := opsworks.New(session.New()) - - params := &opsworks.DeleteInstanceInput{ - InstanceId: aws.String("String"), // Required - DeleteElasticIp: aws.Bool(true), - DeleteVolumes: aws.Bool(true), - } - resp, err := svc.DeleteInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DeleteLayer() { - svc := opsworks.New(session.New()) - - params := &opsworks.DeleteLayerInput{ - LayerId: aws.String("String"), // Required - } - resp, err := svc.DeleteLayer(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DeleteStack() { - svc := opsworks.New(session.New()) - - params := &opsworks.DeleteStackInput{ - StackId: aws.String("String"), // Required - } - resp, err := svc.DeleteStack(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DeleteUserProfile() { - svc := opsworks.New(session.New()) - - params := &opsworks.DeleteUserProfileInput{ - IamUserArn: aws.String("String"), // Required - } - resp, err := svc.DeleteUserProfile(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DeregisterEcsCluster() { - svc := opsworks.New(session.New()) - - params := &opsworks.DeregisterEcsClusterInput{ - EcsClusterArn: aws.String("String"), // Required - } - resp, err := svc.DeregisterEcsCluster(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DeregisterElasticIp() { - svc := opsworks.New(session.New()) - - params := &opsworks.DeregisterElasticIpInput{ - ElasticIp: aws.String("String"), // Required - } - resp, err := svc.DeregisterElasticIp(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DeregisterInstance() { - svc := opsworks.New(session.New()) - - params := &opsworks.DeregisterInstanceInput{ - InstanceId: aws.String("String"), // Required - } - resp, err := svc.DeregisterInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DeregisterRdsDbInstance() { - svc := opsworks.New(session.New()) - - params := &opsworks.DeregisterRdsDbInstanceInput{ - RdsDbInstanceArn: aws.String("String"), // Required - } - resp, err := svc.DeregisterRdsDbInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DeregisterVolume() { - svc := opsworks.New(session.New()) - - params := &opsworks.DeregisterVolumeInput{ - VolumeId: aws.String("String"), // Required - } - resp, err := svc.DeregisterVolume(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeAgentVersions() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeAgentVersionsInput{ - ConfigurationManager: &opsworks.StackConfigurationManager{ - Name: aws.String("String"), - Version: aws.String("String"), - }, - StackId: aws.String("String"), - } - resp, err := svc.DescribeAgentVersions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeApps() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeAppsInput{ - AppIds: []*string{ - aws.String("String"), // Required - // More values... - }, - StackId: aws.String("String"), - } - resp, err := svc.DescribeApps(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeCommands() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeCommandsInput{ - CommandIds: []*string{ - aws.String("String"), // Required - // More values... - }, - DeploymentId: aws.String("String"), - InstanceId: aws.String("String"), - } - resp, err := svc.DescribeCommands(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeDeployments() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeDeploymentsInput{ - AppId: aws.String("String"), - DeploymentIds: []*string{ - aws.String("String"), // Required - // More values... - }, - StackId: aws.String("String"), - } - resp, err := svc.DescribeDeployments(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeEcsClusters() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeEcsClustersInput{ - EcsClusterArns: []*string{ - aws.String("String"), // Required - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - StackId: aws.String("String"), - } - resp, err := svc.DescribeEcsClusters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeElasticIps() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeElasticIpsInput{ - InstanceId: aws.String("String"), - Ips: []*string{ - aws.String("String"), // Required - // More values... - }, - StackId: aws.String("String"), - } - resp, err := svc.DescribeElasticIps(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeElasticLoadBalancers() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeElasticLoadBalancersInput{ - LayerIds: []*string{ - aws.String("String"), // Required - // More values... - }, - StackId: aws.String("String"), - } - resp, err := svc.DescribeElasticLoadBalancers(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeInstances() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeInstancesInput{ - InstanceIds: []*string{ - aws.String("String"), // Required - // More values... - }, - LayerId: aws.String("String"), - StackId: aws.String("String"), - } - resp, err := svc.DescribeInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeLayers() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeLayersInput{ - LayerIds: []*string{ - aws.String("String"), // Required - // More values... - }, - StackId: aws.String("String"), - } - resp, err := svc.DescribeLayers(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeLoadBasedAutoScaling() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeLoadBasedAutoScalingInput{ - LayerIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeLoadBasedAutoScaling(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeMyUserProfile() { - svc := opsworks.New(session.New()) - - var params *opsworks.DescribeMyUserProfileInput - resp, err := svc.DescribeMyUserProfile(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribePermissions() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribePermissionsInput{ - IamUserArn: aws.String("String"), - StackId: aws.String("String"), - } - resp, err := svc.DescribePermissions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeRaidArrays() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeRaidArraysInput{ - InstanceId: aws.String("String"), - RaidArrayIds: []*string{ - aws.String("String"), // Required - // More values... - }, - StackId: aws.String("String"), - } - resp, err := svc.DescribeRaidArrays(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeRdsDbInstances() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeRdsDbInstancesInput{ - StackId: aws.String("String"), // Required - RdsDbInstanceArns: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeRdsDbInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeServiceErrors() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeServiceErrorsInput{ - InstanceId: aws.String("String"), - ServiceErrorIds: []*string{ - aws.String("String"), // Required - // More values... - }, - StackId: aws.String("String"), - } - resp, err := svc.DescribeServiceErrors(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeStackProvisioningParameters() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeStackProvisioningParametersInput{ - StackId: aws.String("String"), // Required - } - resp, err := svc.DescribeStackProvisioningParameters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeStackSummary() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeStackSummaryInput{ - StackId: aws.String("String"), // Required - } - resp, err := svc.DescribeStackSummary(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeStacks() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeStacksInput{ - StackIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeStacks(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeTimeBasedAutoScaling() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeTimeBasedAutoScalingInput{ - InstanceIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeTimeBasedAutoScaling(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeUserProfiles() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeUserProfilesInput{ - IamUserArns: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeUserProfiles(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DescribeVolumes() { - svc := opsworks.New(session.New()) - - params := &opsworks.DescribeVolumesInput{ - InstanceId: aws.String("String"), - RaidArrayId: aws.String("String"), - StackId: aws.String("String"), - VolumeIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeVolumes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DetachElasticLoadBalancer() { - svc := opsworks.New(session.New()) - - params := &opsworks.DetachElasticLoadBalancerInput{ - ElasticLoadBalancerName: aws.String("String"), // Required - LayerId: aws.String("String"), // Required - } - resp, err := svc.DetachElasticLoadBalancer(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_DisassociateElasticIp() { - svc := opsworks.New(session.New()) - - params := &opsworks.DisassociateElasticIpInput{ - ElasticIp: aws.String("String"), // Required - } - resp, err := svc.DisassociateElasticIp(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_GetHostnameSuggestion() { - svc := opsworks.New(session.New()) - - params := &opsworks.GetHostnameSuggestionInput{ - LayerId: aws.String("String"), // Required - } - resp, err := svc.GetHostnameSuggestion(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_GrantAccess() { - svc := opsworks.New(session.New()) - - params := &opsworks.GrantAccessInput{ - InstanceId: aws.String("String"), // Required - ValidForInMinutes: aws.Int64(1), - } - resp, err := svc.GrantAccess(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_RebootInstance() { - svc := opsworks.New(session.New()) - - params := &opsworks.RebootInstanceInput{ - InstanceId: aws.String("String"), // Required - } - resp, err := svc.RebootInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_RegisterEcsCluster() { - svc := opsworks.New(session.New()) - - params := &opsworks.RegisterEcsClusterInput{ - EcsClusterArn: aws.String("String"), // Required - StackId: aws.String("String"), // Required - } - resp, err := svc.RegisterEcsCluster(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_RegisterElasticIp() { - svc := opsworks.New(session.New()) - - params := &opsworks.RegisterElasticIpInput{ - ElasticIp: aws.String("String"), // Required - StackId: aws.String("String"), // Required - } - resp, err := svc.RegisterElasticIp(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_RegisterInstance() { - svc := opsworks.New(session.New()) - - params := &opsworks.RegisterInstanceInput{ - StackId: aws.String("String"), // Required - Hostname: aws.String("String"), - InstanceIdentity: &opsworks.InstanceIdentity{ - Document: aws.String("String"), - Signature: aws.String("String"), - }, - PrivateIp: aws.String("String"), - PublicIp: aws.String("String"), - RsaPublicKey: aws.String("String"), - RsaPublicKeyFingerprint: aws.String("String"), - } - resp, err := svc.RegisterInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_RegisterRdsDbInstance() { - svc := opsworks.New(session.New()) - - params := &opsworks.RegisterRdsDbInstanceInput{ - DbPassword: aws.String("String"), // Required - DbUser: aws.String("String"), // Required - RdsDbInstanceArn: aws.String("String"), // Required - StackId: aws.String("String"), // Required - } - resp, err := svc.RegisterRdsDbInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_RegisterVolume() { - svc := opsworks.New(session.New()) - - params := &opsworks.RegisterVolumeInput{ - StackId: aws.String("String"), // Required - Ec2VolumeId: aws.String("String"), - } - resp, err := svc.RegisterVolume(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_SetLoadBasedAutoScaling() { - svc := opsworks.New(session.New()) - - params := &opsworks.SetLoadBasedAutoScalingInput{ - LayerId: aws.String("String"), // Required - DownScaling: &opsworks.AutoScalingThresholds{ - Alarms: []*string{ - aws.String("String"), // Required - // More values... - }, - CpuThreshold: aws.Float64(1.0), - IgnoreMetricsTime: aws.Int64(1), - InstanceCount: aws.Int64(1), - LoadThreshold: aws.Float64(1.0), - MemoryThreshold: aws.Float64(1.0), - ThresholdsWaitTime: aws.Int64(1), - }, - Enable: aws.Bool(true), - UpScaling: &opsworks.AutoScalingThresholds{ - Alarms: []*string{ - aws.String("String"), // Required - // More values... - }, - CpuThreshold: aws.Float64(1.0), - IgnoreMetricsTime: aws.Int64(1), - InstanceCount: aws.Int64(1), - LoadThreshold: aws.Float64(1.0), - MemoryThreshold: aws.Float64(1.0), - ThresholdsWaitTime: aws.Int64(1), - }, - } - resp, err := svc.SetLoadBasedAutoScaling(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_SetPermission() { - svc := opsworks.New(session.New()) - - params := &opsworks.SetPermissionInput{ - IamUserArn: aws.String("String"), // Required - StackId: aws.String("String"), // Required - AllowSsh: aws.Bool(true), - AllowSudo: aws.Bool(true), - Level: aws.String("String"), - } - resp, err := svc.SetPermission(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_SetTimeBasedAutoScaling() { - svc := opsworks.New(session.New()) - - params := &opsworks.SetTimeBasedAutoScalingInput{ - InstanceId: aws.String("String"), // Required - AutoScalingSchedule: &opsworks.WeeklyAutoScalingSchedule{ - Friday: map[string]*string{ - "Key": aws.String("Switch"), // Required - // More values... - }, - Monday: map[string]*string{ - "Key": aws.String("Switch"), // Required - // More values... - }, - Saturday: map[string]*string{ - "Key": aws.String("Switch"), // Required - // More values... - }, - Sunday: map[string]*string{ - "Key": aws.String("Switch"), // Required - // More values... - }, - Thursday: map[string]*string{ - "Key": aws.String("Switch"), // Required - // More values... - }, - Tuesday: map[string]*string{ - "Key": aws.String("Switch"), // Required - // More values... - }, - Wednesday: map[string]*string{ - "Key": aws.String("Switch"), // Required - // More values... - }, - }, - } - resp, err := svc.SetTimeBasedAutoScaling(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_StartInstance() { - svc := opsworks.New(session.New()) - - params := &opsworks.StartInstanceInput{ - InstanceId: aws.String("String"), // Required - } - resp, err := svc.StartInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_StartStack() { - svc := opsworks.New(session.New()) - - params := &opsworks.StartStackInput{ - StackId: aws.String("String"), // Required - } - resp, err := svc.StartStack(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_StopInstance() { - svc := opsworks.New(session.New()) - - params := &opsworks.StopInstanceInput{ - InstanceId: aws.String("String"), // Required - } - resp, err := svc.StopInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_StopStack() { - svc := opsworks.New(session.New()) - - params := &opsworks.StopStackInput{ - StackId: aws.String("String"), // Required - } - resp, err := svc.StopStack(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_UnassignInstance() { - svc := opsworks.New(session.New()) - - params := &opsworks.UnassignInstanceInput{ - InstanceId: aws.String("String"), // Required - } - resp, err := svc.UnassignInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_UnassignVolume() { - svc := opsworks.New(session.New()) - - params := &opsworks.UnassignVolumeInput{ - VolumeId: aws.String("String"), // Required - } - resp, err := svc.UnassignVolume(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_UpdateApp() { - svc := opsworks.New(session.New()) - - params := &opsworks.UpdateAppInput{ - AppId: aws.String("String"), // Required - AppSource: &opsworks.Source{ - Password: aws.String("String"), - Revision: aws.String("String"), - SshKey: aws.String("String"), - Type: aws.String("SourceType"), - Url: aws.String("String"), - Username: aws.String("String"), - }, - Attributes: map[string]*string{ - "Key": aws.String("String"), // Required - // More values... - }, - DataSources: []*opsworks.DataSource{ - { // Required - Arn: aws.String("String"), - DatabaseName: aws.String("String"), - Type: aws.String("String"), - }, - // More values... - }, - Description: aws.String("String"), - Domains: []*string{ - aws.String("String"), // Required - // More values... - }, - EnableSsl: aws.Bool(true), - Environment: []*opsworks.EnvironmentVariable{ - { // Required - Key: aws.String("String"), // Required - Value: aws.String("String"), // Required - Secure: aws.Bool(true), - }, - // More values... - }, - Name: aws.String("String"), - SslConfiguration: &opsworks.SslConfiguration{ - Certificate: aws.String("String"), // Required - PrivateKey: aws.String("String"), // Required - Chain: aws.String("String"), - }, - Type: aws.String("AppType"), - } - resp, err := svc.UpdateApp(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_UpdateElasticIp() { - svc := opsworks.New(session.New()) - - params := &opsworks.UpdateElasticIpInput{ - ElasticIp: aws.String("String"), // Required - Name: aws.String("String"), - } - resp, err := svc.UpdateElasticIp(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_UpdateInstance() { - svc := opsworks.New(session.New()) - - params := &opsworks.UpdateInstanceInput{ - InstanceId: aws.String("String"), // Required - AgentVersion: aws.String("String"), - AmiId: aws.String("String"), - Architecture: aws.String("Architecture"), - AutoScalingType: aws.String("AutoScalingType"), - EbsOptimized: aws.Bool(true), - Hostname: aws.String("String"), - InstallUpdatesOnBoot: aws.Bool(true), - InstanceType: aws.String("String"), - LayerIds: []*string{ - aws.String("String"), // Required - // More values... - }, - Os: aws.String("String"), - SshKeyName: aws.String("String"), - } - resp, err := svc.UpdateInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_UpdateLayer() { - svc := opsworks.New(session.New()) - - params := &opsworks.UpdateLayerInput{ - LayerId: aws.String("String"), // Required - Attributes: map[string]*string{ - "Key": aws.String("String"), // Required - // More values... - }, - AutoAssignElasticIps: aws.Bool(true), - AutoAssignPublicIps: aws.Bool(true), - CustomInstanceProfileArn: aws.String("String"), - CustomJson: aws.String("String"), - CustomRecipes: &opsworks.Recipes{ - Configure: []*string{ - aws.String("String"), // Required - // More values... - }, - Deploy: []*string{ - aws.String("String"), // Required - // More values... - }, - Setup: []*string{ - aws.String("String"), // Required - // More values... - }, - Shutdown: []*string{ - aws.String("String"), // Required - // More values... - }, - Undeploy: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - CustomSecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - EnableAutoHealing: aws.Bool(true), - InstallUpdatesOnBoot: aws.Bool(true), - LifecycleEventConfiguration: &opsworks.LifecycleEventConfiguration{ - Shutdown: &opsworks.ShutdownEventConfiguration{ - DelayUntilElbConnectionsDrained: aws.Bool(true), - ExecutionTimeout: aws.Int64(1), - }, - }, - Name: aws.String("String"), - Packages: []*string{ - aws.String("String"), // Required - // More values... - }, - Shortname: aws.String("String"), - UseEbsOptimizedInstances: aws.Bool(true), - VolumeConfigurations: []*opsworks.VolumeConfiguration{ - { // Required - MountPoint: aws.String("String"), // Required - NumberOfDisks: aws.Int64(1), // Required - Size: aws.Int64(1), // Required - Iops: aws.Int64(1), - RaidLevel: aws.Int64(1), - VolumeType: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.UpdateLayer(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_UpdateMyUserProfile() { - svc := opsworks.New(session.New()) - - params := &opsworks.UpdateMyUserProfileInput{ - SshPublicKey: aws.String("String"), - } - resp, err := svc.UpdateMyUserProfile(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_UpdateRdsDbInstance() { - svc := opsworks.New(session.New()) - - params := &opsworks.UpdateRdsDbInstanceInput{ - RdsDbInstanceArn: aws.String("String"), // Required - DbPassword: aws.String("String"), - DbUser: aws.String("String"), - } - resp, err := svc.UpdateRdsDbInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_UpdateStack() { - svc := opsworks.New(session.New()) - - params := &opsworks.UpdateStackInput{ - StackId: aws.String("String"), // Required - AgentVersion: aws.String("String"), - Attributes: map[string]*string{ - "Key": aws.String("String"), // Required - // More values... - }, - ChefConfiguration: &opsworks.ChefConfiguration{ - BerkshelfVersion: aws.String("String"), - ManageBerkshelf: aws.Bool(true), - }, - ConfigurationManager: &opsworks.StackConfigurationManager{ - Name: aws.String("String"), - Version: aws.String("String"), - }, - CustomCookbooksSource: &opsworks.Source{ - Password: aws.String("String"), - Revision: aws.String("String"), - SshKey: aws.String("String"), - Type: aws.String("SourceType"), - Url: aws.String("String"), - Username: aws.String("String"), - }, - CustomJson: aws.String("String"), - DefaultAvailabilityZone: aws.String("String"), - DefaultInstanceProfileArn: aws.String("String"), - DefaultOs: aws.String("String"), - DefaultRootDeviceType: aws.String("RootDeviceType"), - DefaultSshKeyName: aws.String("String"), - DefaultSubnetId: aws.String("String"), - HostnameTheme: aws.String("String"), - Name: aws.String("String"), - ServiceRoleArn: aws.String("String"), - UseCustomCookbooks: aws.Bool(true), - UseOpsworksSecurityGroups: aws.Bool(true), - } - resp, err := svc.UpdateStack(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_UpdateUserProfile() { - svc := opsworks.New(session.New()) - - params := &opsworks.UpdateUserProfileInput{ - IamUserArn: aws.String("String"), // Required - AllowSelfManagement: aws.Bool(true), - SshPublicKey: aws.String("String"), - SshUsername: aws.String("String"), - } - resp, err := svc.UpdateUserProfile(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleOpsWorks_UpdateVolume() { - svc := opsworks.New(session.New()) - - params := &opsworks.UpdateVolumeInput{ - VolumeId: aws.String("String"), // Required - MountPoint: aws.String("String"), - Name: aws.String("String"), - } - resp, err := svc.UpdateVolume(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/rds/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/rds/examples_test.go deleted file mode 100644 index 64e5b9a627..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/rds/examples_test.go +++ /dev/null @@ -1,2340 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package rds_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/rds" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleRDS_AddSourceIdentifierToSubscription() { - svc := rds.New(session.New()) - - params := &rds.AddSourceIdentifierToSubscriptionInput{ - SourceIdentifier: aws.String("String"), // Required - SubscriptionName: aws.String("String"), // Required - } - resp, err := svc.AddSourceIdentifierToSubscription(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_AddTagsToResource() { - svc := rds.New(session.New()) - - params := &rds.AddTagsToResourceInput{ - ResourceName: aws.String("String"), // Required - Tags: []*rds.Tag{ // Required - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.AddTagsToResource(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_ApplyPendingMaintenanceAction() { - svc := rds.New(session.New()) - - params := &rds.ApplyPendingMaintenanceActionInput{ - ApplyAction: aws.String("String"), // Required - OptInType: aws.String("String"), // Required - ResourceIdentifier: aws.String("String"), // Required - } - resp, err := svc.ApplyPendingMaintenanceAction(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_AuthorizeDBSecurityGroupIngress() { - svc := rds.New(session.New()) - - params := &rds.AuthorizeDBSecurityGroupIngressInput{ - DBSecurityGroupName: aws.String("String"), // Required - CIDRIP: aws.String("String"), - EC2SecurityGroupId: aws.String("String"), - EC2SecurityGroupName: aws.String("String"), - EC2SecurityGroupOwnerId: aws.String("String"), - } - resp, err := svc.AuthorizeDBSecurityGroupIngress(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_CopyDBClusterSnapshot() { - svc := rds.New(session.New()) - - params := &rds.CopyDBClusterSnapshotInput{ - SourceDBClusterSnapshotIdentifier: aws.String("String"), // Required - TargetDBClusterSnapshotIdentifier: aws.String("String"), // Required - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CopyDBClusterSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_CopyDBParameterGroup() { - svc := rds.New(session.New()) - - params := &rds.CopyDBParameterGroupInput{ - SourceDBParameterGroupIdentifier: aws.String("String"), // Required - TargetDBParameterGroupDescription: aws.String("String"), // Required - TargetDBParameterGroupIdentifier: aws.String("String"), // Required - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CopyDBParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_CopyDBSnapshot() { - svc := rds.New(session.New()) - - params := &rds.CopyDBSnapshotInput{ - SourceDBSnapshotIdentifier: aws.String("String"), // Required - TargetDBSnapshotIdentifier: aws.String("String"), // Required - CopyTags: aws.Bool(true), - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CopyDBSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_CopyOptionGroup() { - svc := rds.New(session.New()) - - params := &rds.CopyOptionGroupInput{ - SourceOptionGroupIdentifier: aws.String("String"), // Required - TargetOptionGroupDescription: aws.String("String"), // Required - TargetOptionGroupIdentifier: aws.String("String"), // Required - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CopyOptionGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_CreateDBCluster() { - svc := rds.New(session.New()) - - params := &rds.CreateDBClusterInput{ - DBClusterIdentifier: aws.String("String"), // Required - Engine: aws.String("String"), // Required - MasterUserPassword: aws.String("String"), // Required - MasterUsername: aws.String("String"), // Required - AvailabilityZones: []*string{ - aws.String("String"), // Required - // More values... - }, - BackupRetentionPeriod: aws.Int64(1), - CharacterSetName: aws.String("String"), - DBClusterParameterGroupName: aws.String("String"), - DBSubnetGroupName: aws.String("String"), - DatabaseName: aws.String("String"), - EngineVersion: aws.String("String"), - KmsKeyId: aws.String("String"), - OptionGroupName: aws.String("String"), - Port: aws.Int64(1), - PreferredBackupWindow: aws.String("String"), - PreferredMaintenanceWindow: aws.String("String"), - StorageEncrypted: aws.Bool(true), - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - VpcSecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.CreateDBCluster(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_CreateDBClusterParameterGroup() { - svc := rds.New(session.New()) - - params := &rds.CreateDBClusterParameterGroupInput{ - DBClusterParameterGroupName: aws.String("String"), // Required - DBParameterGroupFamily: aws.String("String"), // Required - Description: aws.String("String"), // Required - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateDBClusterParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_CreateDBClusterSnapshot() { - svc := rds.New(session.New()) - - params := &rds.CreateDBClusterSnapshotInput{ - DBClusterIdentifier: aws.String("String"), // Required - DBClusterSnapshotIdentifier: aws.String("String"), // Required - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateDBClusterSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_CreateDBInstance() { - svc := rds.New(session.New()) - - params := &rds.CreateDBInstanceInput{ - DBInstanceClass: aws.String("String"), // Required - DBInstanceIdentifier: aws.String("String"), // Required - Engine: aws.String("String"), // Required - AllocatedStorage: aws.Int64(1), - AutoMinorVersionUpgrade: aws.Bool(true), - AvailabilityZone: aws.String("String"), - BackupRetentionPeriod: aws.Int64(1), - CharacterSetName: aws.String("String"), - CopyTagsToSnapshot: aws.Bool(true), - DBClusterIdentifier: aws.String("String"), - DBName: aws.String("String"), - DBParameterGroupName: aws.String("String"), - DBSecurityGroups: []*string{ - aws.String("String"), // Required - // More values... - }, - DBSubnetGroupName: aws.String("String"), - EngineVersion: aws.String("String"), - Iops: aws.Int64(1), - KmsKeyId: aws.String("String"), - LicenseModel: aws.String("String"), - MasterUserPassword: aws.String("String"), - MasterUsername: aws.String("String"), - MonitoringInterval: aws.Int64(1), - MonitoringRoleArn: aws.String("String"), - MultiAZ: aws.Bool(true), - OptionGroupName: aws.String("String"), - Port: aws.Int64(1), - PreferredBackupWindow: aws.String("String"), - PreferredMaintenanceWindow: aws.String("String"), - PubliclyAccessible: aws.Bool(true), - StorageEncrypted: aws.Bool(true), - StorageType: aws.String("String"), - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - TdeCredentialArn: aws.String("String"), - TdeCredentialPassword: aws.String("String"), - VpcSecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.CreateDBInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_CreateDBInstanceReadReplica() { - svc := rds.New(session.New()) - - params := &rds.CreateDBInstanceReadReplicaInput{ - DBInstanceIdentifier: aws.String("String"), // Required - SourceDBInstanceIdentifier: aws.String("String"), // Required - AutoMinorVersionUpgrade: aws.Bool(true), - AvailabilityZone: aws.String("String"), - CopyTagsToSnapshot: aws.Bool(true), - DBInstanceClass: aws.String("String"), - DBSubnetGroupName: aws.String("String"), - Iops: aws.Int64(1), - MonitoringInterval: aws.Int64(1), - MonitoringRoleArn: aws.String("String"), - OptionGroupName: aws.String("String"), - Port: aws.Int64(1), - PubliclyAccessible: aws.Bool(true), - StorageType: aws.String("String"), - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateDBInstanceReadReplica(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_CreateDBParameterGroup() { - svc := rds.New(session.New()) - - params := &rds.CreateDBParameterGroupInput{ - DBParameterGroupFamily: aws.String("String"), // Required - DBParameterGroupName: aws.String("String"), // Required - Description: aws.String("String"), // Required - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateDBParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_CreateDBSecurityGroup() { - svc := rds.New(session.New()) - - params := &rds.CreateDBSecurityGroupInput{ - DBSecurityGroupDescription: aws.String("String"), // Required - DBSecurityGroupName: aws.String("String"), // Required - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateDBSecurityGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_CreateDBSnapshot() { - svc := rds.New(session.New()) - - params := &rds.CreateDBSnapshotInput{ - DBInstanceIdentifier: aws.String("String"), // Required - DBSnapshotIdentifier: aws.String("String"), // Required - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateDBSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_CreateDBSubnetGroup() { - svc := rds.New(session.New()) - - params := &rds.CreateDBSubnetGroupInput{ - DBSubnetGroupDescription: aws.String("String"), // Required - DBSubnetGroupName: aws.String("String"), // Required - SubnetIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateDBSubnetGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_CreateEventSubscription() { - svc := rds.New(session.New()) - - params := &rds.CreateEventSubscriptionInput{ - SnsTopicArn: aws.String("String"), // Required - SubscriptionName: aws.String("String"), // Required - Enabled: aws.Bool(true), - EventCategories: []*string{ - aws.String("String"), // Required - // More values... - }, - SourceIds: []*string{ - aws.String("String"), // Required - // More values... - }, - SourceType: aws.String("String"), - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateEventSubscription(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_CreateOptionGroup() { - svc := rds.New(session.New()) - - params := &rds.CreateOptionGroupInput{ - EngineName: aws.String("String"), // Required - MajorEngineVersion: aws.String("String"), // Required - OptionGroupDescription: aws.String("String"), // Required - OptionGroupName: aws.String("String"), // Required - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateOptionGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DeleteDBCluster() { - svc := rds.New(session.New()) - - params := &rds.DeleteDBClusterInput{ - DBClusterIdentifier: aws.String("String"), // Required - FinalDBSnapshotIdentifier: aws.String("String"), - SkipFinalSnapshot: aws.Bool(true), - } - resp, err := svc.DeleteDBCluster(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DeleteDBClusterParameterGroup() { - svc := rds.New(session.New()) - - params := &rds.DeleteDBClusterParameterGroupInput{ - DBClusterParameterGroupName: aws.String("String"), // Required - } - resp, err := svc.DeleteDBClusterParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DeleteDBClusterSnapshot() { - svc := rds.New(session.New()) - - params := &rds.DeleteDBClusterSnapshotInput{ - DBClusterSnapshotIdentifier: aws.String("String"), // Required - } - resp, err := svc.DeleteDBClusterSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DeleteDBInstance() { - svc := rds.New(session.New()) - - params := &rds.DeleteDBInstanceInput{ - DBInstanceIdentifier: aws.String("String"), // Required - FinalDBSnapshotIdentifier: aws.String("String"), - SkipFinalSnapshot: aws.Bool(true), - } - resp, err := svc.DeleteDBInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DeleteDBParameterGroup() { - svc := rds.New(session.New()) - - params := &rds.DeleteDBParameterGroupInput{ - DBParameterGroupName: aws.String("String"), // Required - } - resp, err := svc.DeleteDBParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DeleteDBSecurityGroup() { - svc := rds.New(session.New()) - - params := &rds.DeleteDBSecurityGroupInput{ - DBSecurityGroupName: aws.String("String"), // Required - } - resp, err := svc.DeleteDBSecurityGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DeleteDBSnapshot() { - svc := rds.New(session.New()) - - params := &rds.DeleteDBSnapshotInput{ - DBSnapshotIdentifier: aws.String("String"), // Required - } - resp, err := svc.DeleteDBSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DeleteDBSubnetGroup() { - svc := rds.New(session.New()) - - params := &rds.DeleteDBSubnetGroupInput{ - DBSubnetGroupName: aws.String("String"), // Required - } - resp, err := svc.DeleteDBSubnetGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DeleteEventSubscription() { - svc := rds.New(session.New()) - - params := &rds.DeleteEventSubscriptionInput{ - SubscriptionName: aws.String("String"), // Required - } - resp, err := svc.DeleteEventSubscription(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DeleteOptionGroup() { - svc := rds.New(session.New()) - - params := &rds.DeleteOptionGroupInput{ - OptionGroupName: aws.String("String"), // Required - } - resp, err := svc.DeleteOptionGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeAccountAttributes() { - svc := rds.New(session.New()) - - var params *rds.DescribeAccountAttributesInput - resp, err := svc.DescribeAccountAttributes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeCertificates() { - svc := rds.New(session.New()) - - params := &rds.DescribeCertificatesInput{ - CertificateIdentifier: aws.String("String"), - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeCertificates(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeDBClusterParameterGroups() { - svc := rds.New(session.New()) - - params := &rds.DescribeDBClusterParameterGroupsInput{ - DBClusterParameterGroupName: aws.String("String"), - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeDBClusterParameterGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeDBClusterParameters() { - svc := rds.New(session.New()) - - params := &rds.DescribeDBClusterParametersInput{ - DBClusterParameterGroupName: aws.String("String"), // Required - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - Source: aws.String("String"), - } - resp, err := svc.DescribeDBClusterParameters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeDBClusterSnapshots() { - svc := rds.New(session.New()) - - params := &rds.DescribeDBClusterSnapshotsInput{ - DBClusterIdentifier: aws.String("String"), - DBClusterSnapshotIdentifier: aws.String("String"), - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - SnapshotType: aws.String("String"), - } - resp, err := svc.DescribeDBClusterSnapshots(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeDBClusters() { - svc := rds.New(session.New()) - - params := &rds.DescribeDBClustersInput{ - DBClusterIdentifier: aws.String("String"), - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeDBClusters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeDBEngineVersions() { - svc := rds.New(session.New()) - - params := &rds.DescribeDBEngineVersionsInput{ - DBParameterGroupFamily: aws.String("String"), - DefaultOnly: aws.Bool(true), - Engine: aws.String("String"), - EngineVersion: aws.String("String"), - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - ListSupportedCharacterSets: aws.Bool(true), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeDBEngineVersions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeDBInstances() { - svc := rds.New(session.New()) - - params := &rds.DescribeDBInstancesInput{ - DBInstanceIdentifier: aws.String("String"), - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeDBInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeDBLogFiles() { - svc := rds.New(session.New()) - - params := &rds.DescribeDBLogFilesInput{ - DBInstanceIdentifier: aws.String("String"), // Required - FileLastWritten: aws.Int64(1), - FileSize: aws.Int64(1), - FilenameContains: aws.String("String"), - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeDBLogFiles(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeDBParameterGroups() { - svc := rds.New(session.New()) - - params := &rds.DescribeDBParameterGroupsInput{ - DBParameterGroupName: aws.String("String"), - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeDBParameterGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeDBParameters() { - svc := rds.New(session.New()) - - params := &rds.DescribeDBParametersInput{ - DBParameterGroupName: aws.String("String"), // Required - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - Source: aws.String("String"), - } - resp, err := svc.DescribeDBParameters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeDBSecurityGroups() { - svc := rds.New(session.New()) - - params := &rds.DescribeDBSecurityGroupsInput{ - DBSecurityGroupName: aws.String("String"), - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeDBSecurityGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeDBSnapshotAttributes() { - svc := rds.New(session.New()) - - params := &rds.DescribeDBSnapshotAttributesInput{ - DBSnapshotIdentifier: aws.String("String"), - } - resp, err := svc.DescribeDBSnapshotAttributes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeDBSnapshots() { - svc := rds.New(session.New()) - - params := &rds.DescribeDBSnapshotsInput{ - DBInstanceIdentifier: aws.String("String"), - DBSnapshotIdentifier: aws.String("String"), - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - IncludePublic: aws.Bool(true), - IncludeShared: aws.Bool(true), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - SnapshotType: aws.String("String"), - } - resp, err := svc.DescribeDBSnapshots(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeDBSubnetGroups() { - svc := rds.New(session.New()) - - params := &rds.DescribeDBSubnetGroupsInput{ - DBSubnetGroupName: aws.String("String"), - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeDBSubnetGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeEngineDefaultClusterParameters() { - svc := rds.New(session.New()) - - params := &rds.DescribeEngineDefaultClusterParametersInput{ - DBParameterGroupFamily: aws.String("String"), // Required - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeEngineDefaultClusterParameters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeEngineDefaultParameters() { - svc := rds.New(session.New()) - - params := &rds.DescribeEngineDefaultParametersInput{ - DBParameterGroupFamily: aws.String("String"), // Required - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeEngineDefaultParameters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeEventCategories() { - svc := rds.New(session.New()) - - params := &rds.DescribeEventCategoriesInput{ - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - SourceType: aws.String("String"), - } - resp, err := svc.DescribeEventCategories(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeEventSubscriptions() { - svc := rds.New(session.New()) - - params := &rds.DescribeEventSubscriptionsInput{ - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - SubscriptionName: aws.String("String"), - } - resp, err := svc.DescribeEventSubscriptions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeEvents() { - svc := rds.New(session.New()) - - params := &rds.DescribeEventsInput{ - Duration: aws.Int64(1), - EndTime: aws.Time(time.Now()), - EventCategories: []*string{ - aws.String("String"), // Required - // More values... - }, - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - SourceIdentifier: aws.String("String"), - SourceType: aws.String("SourceType"), - StartTime: aws.Time(time.Now()), - } - resp, err := svc.DescribeEvents(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeOptionGroupOptions() { - svc := rds.New(session.New()) - - params := &rds.DescribeOptionGroupOptionsInput{ - EngineName: aws.String("String"), // Required - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - MajorEngineVersion: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeOptionGroupOptions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeOptionGroups() { - svc := rds.New(session.New()) - - params := &rds.DescribeOptionGroupsInput{ - EngineName: aws.String("String"), - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - MajorEngineVersion: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - OptionGroupName: aws.String("String"), - } - resp, err := svc.DescribeOptionGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeOrderableDBInstanceOptions() { - svc := rds.New(session.New()) - - params := &rds.DescribeOrderableDBInstanceOptionsInput{ - Engine: aws.String("String"), // Required - DBInstanceClass: aws.String("String"), - EngineVersion: aws.String("String"), - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - LicenseModel: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - Vpc: aws.Bool(true), - } - resp, err := svc.DescribeOrderableDBInstanceOptions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribePendingMaintenanceActions() { - svc := rds.New(session.New()) - - params := &rds.DescribePendingMaintenanceActionsInput{ - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - ResourceIdentifier: aws.String("String"), - } - resp, err := svc.DescribePendingMaintenanceActions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeReservedDBInstances() { - svc := rds.New(session.New()) - - params := &rds.DescribeReservedDBInstancesInput{ - DBInstanceClass: aws.String("String"), - Duration: aws.String("String"), - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - MultiAZ: aws.Bool(true), - OfferingType: aws.String("String"), - ProductDescription: aws.String("String"), - ReservedDBInstanceId: aws.String("String"), - ReservedDBInstancesOfferingId: aws.String("String"), - } - resp, err := svc.DescribeReservedDBInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DescribeReservedDBInstancesOfferings() { - svc := rds.New(session.New()) - - params := &rds.DescribeReservedDBInstancesOfferingsInput{ - DBInstanceClass: aws.String("String"), - Duration: aws.String("String"), - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - MultiAZ: aws.Bool(true), - OfferingType: aws.String("String"), - ProductDescription: aws.String("String"), - ReservedDBInstancesOfferingId: aws.String("String"), - } - resp, err := svc.DescribeReservedDBInstancesOfferings(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_DownloadDBLogFilePortion() { - svc := rds.New(session.New()) - - params := &rds.DownloadDBLogFilePortionInput{ - DBInstanceIdentifier: aws.String("String"), // Required - LogFileName: aws.String("String"), // Required - Marker: aws.String("String"), - NumberOfLines: aws.Int64(1), - } - resp, err := svc.DownloadDBLogFilePortion(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_FailoverDBCluster() { - svc := rds.New(session.New()) - - params := &rds.FailoverDBClusterInput{ - DBClusterIdentifier: aws.String("String"), - } - resp, err := svc.FailoverDBCluster(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_ListTagsForResource() { - svc := rds.New(session.New()) - - params := &rds.ListTagsForResourceInput{ - ResourceName: aws.String("String"), // Required - Filters: []*rds.Filter{ - { // Required - Name: aws.String("String"), // Required - Values: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - } - resp, err := svc.ListTagsForResource(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_ModifyDBCluster() { - svc := rds.New(session.New()) - - params := &rds.ModifyDBClusterInput{ - DBClusterIdentifier: aws.String("String"), // Required - ApplyImmediately: aws.Bool(true), - BackupRetentionPeriod: aws.Int64(1), - DBClusterParameterGroupName: aws.String("String"), - MasterUserPassword: aws.String("String"), - NewDBClusterIdentifier: aws.String("String"), - OptionGroupName: aws.String("String"), - Port: aws.Int64(1), - PreferredBackupWindow: aws.String("String"), - PreferredMaintenanceWindow: aws.String("String"), - VpcSecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.ModifyDBCluster(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_ModifyDBClusterParameterGroup() { - svc := rds.New(session.New()) - - params := &rds.ModifyDBClusterParameterGroupInput{ - DBClusterParameterGroupName: aws.String("String"), // Required - Parameters: []*rds.Parameter{ // Required - { // Required - AllowedValues: aws.String("String"), - ApplyMethod: aws.String("ApplyMethod"), - ApplyType: aws.String("String"), - DataType: aws.String("String"), - Description: aws.String("String"), - IsModifiable: aws.Bool(true), - MinimumEngineVersion: aws.String("String"), - ParameterName: aws.String("String"), - ParameterValue: aws.String("String"), - Source: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.ModifyDBClusterParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_ModifyDBInstance() { - svc := rds.New(session.New()) - - params := &rds.ModifyDBInstanceInput{ - DBInstanceIdentifier: aws.String("String"), // Required - AllocatedStorage: aws.Int64(1), - AllowMajorVersionUpgrade: aws.Bool(true), - ApplyImmediately: aws.Bool(true), - AutoMinorVersionUpgrade: aws.Bool(true), - BackupRetentionPeriod: aws.Int64(1), - CACertificateIdentifier: aws.String("String"), - CopyTagsToSnapshot: aws.Bool(true), - DBInstanceClass: aws.String("String"), - DBParameterGroupName: aws.String("String"), - DBPortNumber: aws.Int64(1), - DBSecurityGroups: []*string{ - aws.String("String"), // Required - // More values... - }, - EngineVersion: aws.String("String"), - Iops: aws.Int64(1), - MasterUserPassword: aws.String("String"), - MonitoringInterval: aws.Int64(1), - MonitoringRoleArn: aws.String("String"), - MultiAZ: aws.Bool(true), - NewDBInstanceIdentifier: aws.String("String"), - OptionGroupName: aws.String("String"), - PreferredBackupWindow: aws.String("String"), - PreferredMaintenanceWindow: aws.String("String"), - PubliclyAccessible: aws.Bool(true), - StorageType: aws.String("String"), - TdeCredentialArn: aws.String("String"), - TdeCredentialPassword: aws.String("String"), - VpcSecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.ModifyDBInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_ModifyDBParameterGroup() { - svc := rds.New(session.New()) - - params := &rds.ModifyDBParameterGroupInput{ - DBParameterGroupName: aws.String("String"), // Required - Parameters: []*rds.Parameter{ // Required - { // Required - AllowedValues: aws.String("String"), - ApplyMethod: aws.String("ApplyMethod"), - ApplyType: aws.String("String"), - DataType: aws.String("String"), - Description: aws.String("String"), - IsModifiable: aws.Bool(true), - MinimumEngineVersion: aws.String("String"), - ParameterName: aws.String("String"), - ParameterValue: aws.String("String"), - Source: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.ModifyDBParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_ModifyDBSnapshotAttribute() { - svc := rds.New(session.New()) - - params := &rds.ModifyDBSnapshotAttributeInput{ - DBSnapshotIdentifier: aws.String("String"), // Required - AttributeName: aws.String("String"), - ValuesToAdd: []*string{ - aws.String("String"), // Required - // More values... - }, - ValuesToRemove: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.ModifyDBSnapshotAttribute(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_ModifyDBSubnetGroup() { - svc := rds.New(session.New()) - - params := &rds.ModifyDBSubnetGroupInput{ - DBSubnetGroupName: aws.String("String"), // Required - SubnetIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - DBSubnetGroupDescription: aws.String("String"), - } - resp, err := svc.ModifyDBSubnetGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_ModifyEventSubscription() { - svc := rds.New(session.New()) - - params := &rds.ModifyEventSubscriptionInput{ - SubscriptionName: aws.String("String"), // Required - Enabled: aws.Bool(true), - EventCategories: []*string{ - aws.String("String"), // Required - // More values... - }, - SnsTopicArn: aws.String("String"), - SourceType: aws.String("String"), - } - resp, err := svc.ModifyEventSubscription(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_ModifyOptionGroup() { - svc := rds.New(session.New()) - - params := &rds.ModifyOptionGroupInput{ - OptionGroupName: aws.String("String"), // Required - ApplyImmediately: aws.Bool(true), - OptionsToInclude: []*rds.OptionConfiguration{ - { // Required - OptionName: aws.String("String"), // Required - DBSecurityGroupMemberships: []*string{ - aws.String("String"), // Required - // More values... - }, - OptionSettings: []*rds.OptionSetting{ - { // Required - AllowedValues: aws.String("String"), - ApplyType: aws.String("String"), - DataType: aws.String("String"), - DefaultValue: aws.String("String"), - Description: aws.String("String"), - IsCollection: aws.Bool(true), - IsModifiable: aws.Bool(true), - Name: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - Port: aws.Int64(1), - VpcSecurityGroupMemberships: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - OptionsToRemove: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.ModifyOptionGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_PromoteReadReplica() { - svc := rds.New(session.New()) - - params := &rds.PromoteReadReplicaInput{ - DBInstanceIdentifier: aws.String("String"), // Required - BackupRetentionPeriod: aws.Int64(1), - PreferredBackupWindow: aws.String("String"), - } - resp, err := svc.PromoteReadReplica(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_PurchaseReservedDBInstancesOffering() { - svc := rds.New(session.New()) - - params := &rds.PurchaseReservedDBInstancesOfferingInput{ - ReservedDBInstancesOfferingId: aws.String("String"), // Required - DBInstanceCount: aws.Int64(1), - ReservedDBInstanceId: aws.String("String"), - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.PurchaseReservedDBInstancesOffering(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_RebootDBInstance() { - svc := rds.New(session.New()) - - params := &rds.RebootDBInstanceInput{ - DBInstanceIdentifier: aws.String("String"), // Required - ForceFailover: aws.Bool(true), - } - resp, err := svc.RebootDBInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_RemoveSourceIdentifierFromSubscription() { - svc := rds.New(session.New()) - - params := &rds.RemoveSourceIdentifierFromSubscriptionInput{ - SourceIdentifier: aws.String("String"), // Required - SubscriptionName: aws.String("String"), // Required - } - resp, err := svc.RemoveSourceIdentifierFromSubscription(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_RemoveTagsFromResource() { - svc := rds.New(session.New()) - - params := &rds.RemoveTagsFromResourceInput{ - ResourceName: aws.String("String"), // Required - TagKeys: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.RemoveTagsFromResource(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_ResetDBClusterParameterGroup() { - svc := rds.New(session.New()) - - params := &rds.ResetDBClusterParameterGroupInput{ - DBClusterParameterGroupName: aws.String("String"), // Required - Parameters: []*rds.Parameter{ - { // Required - AllowedValues: aws.String("String"), - ApplyMethod: aws.String("ApplyMethod"), - ApplyType: aws.String("String"), - DataType: aws.String("String"), - Description: aws.String("String"), - IsModifiable: aws.Bool(true), - MinimumEngineVersion: aws.String("String"), - ParameterName: aws.String("String"), - ParameterValue: aws.String("String"), - Source: aws.String("String"), - }, - // More values... - }, - ResetAllParameters: aws.Bool(true), - } - resp, err := svc.ResetDBClusterParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_ResetDBParameterGroup() { - svc := rds.New(session.New()) - - params := &rds.ResetDBParameterGroupInput{ - DBParameterGroupName: aws.String("String"), // Required - Parameters: []*rds.Parameter{ - { // Required - AllowedValues: aws.String("String"), - ApplyMethod: aws.String("ApplyMethod"), - ApplyType: aws.String("String"), - DataType: aws.String("String"), - Description: aws.String("String"), - IsModifiable: aws.Bool(true), - MinimumEngineVersion: aws.String("String"), - ParameterName: aws.String("String"), - ParameterValue: aws.String("String"), - Source: aws.String("String"), - }, - // More values... - }, - ResetAllParameters: aws.Bool(true), - } - resp, err := svc.ResetDBParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_RestoreDBClusterFromSnapshot() { - svc := rds.New(session.New()) - - params := &rds.RestoreDBClusterFromSnapshotInput{ - DBClusterIdentifier: aws.String("String"), // Required - Engine: aws.String("String"), // Required - SnapshotIdentifier: aws.String("String"), // Required - AvailabilityZones: []*string{ - aws.String("String"), // Required - // More values... - }, - DBSubnetGroupName: aws.String("String"), - DatabaseName: aws.String("String"), - EngineVersion: aws.String("String"), - KmsKeyId: aws.String("String"), - OptionGroupName: aws.String("String"), - Port: aws.Int64(1), - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - VpcSecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.RestoreDBClusterFromSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_RestoreDBClusterToPointInTime() { - svc := rds.New(session.New()) - - params := &rds.RestoreDBClusterToPointInTimeInput{ - DBClusterIdentifier: aws.String("String"), // Required - SourceDBClusterIdentifier: aws.String("String"), // Required - DBSubnetGroupName: aws.String("String"), - KmsKeyId: aws.String("String"), - OptionGroupName: aws.String("String"), - Port: aws.Int64(1), - RestoreToTime: aws.Time(time.Now()), - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - UseLatestRestorableTime: aws.Bool(true), - VpcSecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.RestoreDBClusterToPointInTime(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_RestoreDBInstanceFromDBSnapshot() { - svc := rds.New(session.New()) - - params := &rds.RestoreDBInstanceFromDBSnapshotInput{ - DBInstanceIdentifier: aws.String("String"), // Required - DBSnapshotIdentifier: aws.String("String"), // Required - AutoMinorVersionUpgrade: aws.Bool(true), - AvailabilityZone: aws.String("String"), - CopyTagsToSnapshot: aws.Bool(true), - DBInstanceClass: aws.String("String"), - DBName: aws.String("String"), - DBSubnetGroupName: aws.String("String"), - Engine: aws.String("String"), - Iops: aws.Int64(1), - LicenseModel: aws.String("String"), - MultiAZ: aws.Bool(true), - OptionGroupName: aws.String("String"), - Port: aws.Int64(1), - PubliclyAccessible: aws.Bool(true), - StorageType: aws.String("String"), - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - TdeCredentialArn: aws.String("String"), - TdeCredentialPassword: aws.String("String"), - } - resp, err := svc.RestoreDBInstanceFromDBSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_RestoreDBInstanceToPointInTime() { - svc := rds.New(session.New()) - - params := &rds.RestoreDBInstanceToPointInTimeInput{ - SourceDBInstanceIdentifier: aws.String("String"), // Required - TargetDBInstanceIdentifier: aws.String("String"), // Required - AutoMinorVersionUpgrade: aws.Bool(true), - AvailabilityZone: aws.String("String"), - CopyTagsToSnapshot: aws.Bool(true), - DBInstanceClass: aws.String("String"), - DBName: aws.String("String"), - DBSubnetGroupName: aws.String("String"), - Engine: aws.String("String"), - Iops: aws.Int64(1), - LicenseModel: aws.String("String"), - MultiAZ: aws.Bool(true), - OptionGroupName: aws.String("String"), - Port: aws.Int64(1), - PubliclyAccessible: aws.Bool(true), - RestoreTime: aws.Time(time.Now()), - StorageType: aws.String("String"), - Tags: []*rds.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - TdeCredentialArn: aws.String("String"), - TdeCredentialPassword: aws.String("String"), - UseLatestRestorableTime: aws.Bool(true), - } - resp, err := svc.RestoreDBInstanceToPointInTime(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRDS_RevokeDBSecurityGroupIngress() { - svc := rds.New(session.New()) - - params := &rds.RevokeDBSecurityGroupIngressInput{ - DBSecurityGroupName: aws.String("String"), // Required - CIDRIP: aws.String("String"), - EC2SecurityGroupId: aws.String("String"), - EC2SecurityGroupName: aws.String("String"), - EC2SecurityGroupOwnerId: aws.String("String"), - } - resp, err := svc.RevokeDBSecurityGroupIngress(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/redshift/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/redshift/examples_test.go deleted file mode 100644 index 21b65db689..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/redshift/examples_test.go +++ /dev/null @@ -1,1497 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package redshift_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/redshift" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleRedshift_AuthorizeClusterSecurityGroupIngress() { - svc := redshift.New(session.New()) - - params := &redshift.AuthorizeClusterSecurityGroupIngressInput{ - ClusterSecurityGroupName: aws.String("String"), // Required - CIDRIP: aws.String("String"), - EC2SecurityGroupName: aws.String("String"), - EC2SecurityGroupOwnerId: aws.String("String"), - } - resp, err := svc.AuthorizeClusterSecurityGroupIngress(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_AuthorizeSnapshotAccess() { - svc := redshift.New(session.New()) - - params := &redshift.AuthorizeSnapshotAccessInput{ - AccountWithRestoreAccess: aws.String("String"), // Required - SnapshotIdentifier: aws.String("String"), // Required - SnapshotClusterIdentifier: aws.String("String"), - } - resp, err := svc.AuthorizeSnapshotAccess(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_CopyClusterSnapshot() { - svc := redshift.New(session.New()) - - params := &redshift.CopyClusterSnapshotInput{ - SourceSnapshotIdentifier: aws.String("String"), // Required - TargetSnapshotIdentifier: aws.String("String"), // Required - SourceSnapshotClusterIdentifier: aws.String("String"), - } - resp, err := svc.CopyClusterSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_CreateCluster() { - svc := redshift.New(session.New()) - - params := &redshift.CreateClusterInput{ - ClusterIdentifier: aws.String("String"), // Required - MasterUserPassword: aws.String("String"), // Required - MasterUsername: aws.String("String"), // Required - NodeType: aws.String("String"), // Required - AllowVersionUpgrade: aws.Bool(true), - AutomatedSnapshotRetentionPeriod: aws.Int64(1), - AvailabilityZone: aws.String("String"), - ClusterParameterGroupName: aws.String("String"), - ClusterSecurityGroups: []*string{ - aws.String("String"), // Required - // More values... - }, - ClusterSubnetGroupName: aws.String("String"), - ClusterType: aws.String("String"), - ClusterVersion: aws.String("String"), - DBName: aws.String("String"), - ElasticIp: aws.String("String"), - Encrypted: aws.Bool(true), - HsmClientCertificateIdentifier: aws.String("String"), - HsmConfigurationIdentifier: aws.String("String"), - KmsKeyId: aws.String("String"), - NumberOfNodes: aws.Int64(1), - Port: aws.Int64(1), - PreferredMaintenanceWindow: aws.String("String"), - PubliclyAccessible: aws.Bool(true), - Tags: []*redshift.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - VpcSecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.CreateCluster(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_CreateClusterParameterGroup() { - svc := redshift.New(session.New()) - - params := &redshift.CreateClusterParameterGroupInput{ - Description: aws.String("String"), // Required - ParameterGroupFamily: aws.String("String"), // Required - ParameterGroupName: aws.String("String"), // Required - Tags: []*redshift.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateClusterParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_CreateClusterSecurityGroup() { - svc := redshift.New(session.New()) - - params := &redshift.CreateClusterSecurityGroupInput{ - ClusterSecurityGroupName: aws.String("String"), // Required - Description: aws.String("String"), // Required - Tags: []*redshift.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateClusterSecurityGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_CreateClusterSnapshot() { - svc := redshift.New(session.New()) - - params := &redshift.CreateClusterSnapshotInput{ - ClusterIdentifier: aws.String("String"), // Required - SnapshotIdentifier: aws.String("String"), // Required - Tags: []*redshift.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateClusterSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_CreateClusterSubnetGroup() { - svc := redshift.New(session.New()) - - params := &redshift.CreateClusterSubnetGroupInput{ - ClusterSubnetGroupName: aws.String("String"), // Required - Description: aws.String("String"), // Required - SubnetIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - Tags: []*redshift.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateClusterSubnetGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_CreateEventSubscription() { - svc := redshift.New(session.New()) - - params := &redshift.CreateEventSubscriptionInput{ - SnsTopicArn: aws.String("String"), // Required - SubscriptionName: aws.String("String"), // Required - Enabled: aws.Bool(true), - EventCategories: []*string{ - aws.String("String"), // Required - // More values... - }, - Severity: aws.String("String"), - SourceIds: []*string{ - aws.String("String"), // Required - // More values... - }, - SourceType: aws.String("String"), - Tags: []*redshift.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateEventSubscription(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_CreateHsmClientCertificate() { - svc := redshift.New(session.New()) - - params := &redshift.CreateHsmClientCertificateInput{ - HsmClientCertificateIdentifier: aws.String("String"), // Required - Tags: []*redshift.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateHsmClientCertificate(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_CreateHsmConfiguration() { - svc := redshift.New(session.New()) - - params := &redshift.CreateHsmConfigurationInput{ - Description: aws.String("String"), // Required - HsmConfigurationIdentifier: aws.String("String"), // Required - HsmIpAddress: aws.String("String"), // Required - HsmPartitionName: aws.String("String"), // Required - HsmPartitionPassword: aws.String("String"), // Required - HsmServerPublicCertificate: aws.String("String"), // Required - Tags: []*redshift.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateHsmConfiguration(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_CreateSnapshotCopyGrant() { - svc := redshift.New(session.New()) - - params := &redshift.CreateSnapshotCopyGrantInput{ - SnapshotCopyGrantName: aws.String("String"), // Required - KmsKeyId: aws.String("String"), - Tags: []*redshift.Tag{ - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateSnapshotCopyGrant(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_CreateTags() { - svc := redshift.New(session.New()) - - params := &redshift.CreateTagsInput{ - ResourceName: aws.String("String"), // Required - Tags: []*redshift.Tag{ // Required - { // Required - Key: aws.String("String"), - Value: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.CreateTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DeleteCluster() { - svc := redshift.New(session.New()) - - params := &redshift.DeleteClusterInput{ - ClusterIdentifier: aws.String("String"), // Required - FinalClusterSnapshotIdentifier: aws.String("String"), - SkipFinalClusterSnapshot: aws.Bool(true), - } - resp, err := svc.DeleteCluster(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DeleteClusterParameterGroup() { - svc := redshift.New(session.New()) - - params := &redshift.DeleteClusterParameterGroupInput{ - ParameterGroupName: aws.String("String"), // Required - } - resp, err := svc.DeleteClusterParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DeleteClusterSecurityGroup() { - svc := redshift.New(session.New()) - - params := &redshift.DeleteClusterSecurityGroupInput{ - ClusterSecurityGroupName: aws.String("String"), // Required - } - resp, err := svc.DeleteClusterSecurityGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DeleteClusterSnapshot() { - svc := redshift.New(session.New()) - - params := &redshift.DeleteClusterSnapshotInput{ - SnapshotIdentifier: aws.String("String"), // Required - SnapshotClusterIdentifier: aws.String("String"), - } - resp, err := svc.DeleteClusterSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DeleteClusterSubnetGroup() { - svc := redshift.New(session.New()) - - params := &redshift.DeleteClusterSubnetGroupInput{ - ClusterSubnetGroupName: aws.String("String"), // Required - } - resp, err := svc.DeleteClusterSubnetGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DeleteEventSubscription() { - svc := redshift.New(session.New()) - - params := &redshift.DeleteEventSubscriptionInput{ - SubscriptionName: aws.String("String"), // Required - } - resp, err := svc.DeleteEventSubscription(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DeleteHsmClientCertificate() { - svc := redshift.New(session.New()) - - params := &redshift.DeleteHsmClientCertificateInput{ - HsmClientCertificateIdentifier: aws.String("String"), // Required - } - resp, err := svc.DeleteHsmClientCertificate(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DeleteHsmConfiguration() { - svc := redshift.New(session.New()) - - params := &redshift.DeleteHsmConfigurationInput{ - HsmConfigurationIdentifier: aws.String("String"), // Required - } - resp, err := svc.DeleteHsmConfiguration(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DeleteSnapshotCopyGrant() { - svc := redshift.New(session.New()) - - params := &redshift.DeleteSnapshotCopyGrantInput{ - SnapshotCopyGrantName: aws.String("String"), // Required - } - resp, err := svc.DeleteSnapshotCopyGrant(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DeleteTags() { - svc := redshift.New(session.New()) - - params := &redshift.DeleteTagsInput{ - ResourceName: aws.String("String"), // Required - TagKeys: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DeleteTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeClusterParameterGroups() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeClusterParameterGroupsInput{ - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - ParameterGroupName: aws.String("String"), - TagKeys: []*string{ - aws.String("String"), // Required - // More values... - }, - TagValues: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeClusterParameterGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeClusterParameters() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeClusterParametersInput{ - ParameterGroupName: aws.String("String"), // Required - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - Source: aws.String("String"), - } - resp, err := svc.DescribeClusterParameters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeClusterSecurityGroups() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeClusterSecurityGroupsInput{ - ClusterSecurityGroupName: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - TagKeys: []*string{ - aws.String("String"), // Required - // More values... - }, - TagValues: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeClusterSecurityGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeClusterSnapshots() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeClusterSnapshotsInput{ - ClusterIdentifier: aws.String("String"), - EndTime: aws.Time(time.Now()), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - OwnerAccount: aws.String("String"), - SnapshotIdentifier: aws.String("String"), - SnapshotType: aws.String("String"), - StartTime: aws.Time(time.Now()), - TagKeys: []*string{ - aws.String("String"), // Required - // More values... - }, - TagValues: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeClusterSnapshots(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeClusterSubnetGroups() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeClusterSubnetGroupsInput{ - ClusterSubnetGroupName: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - TagKeys: []*string{ - aws.String("String"), // Required - // More values... - }, - TagValues: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeClusterSubnetGroups(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeClusterVersions() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeClusterVersionsInput{ - ClusterParameterGroupFamily: aws.String("String"), - ClusterVersion: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeClusterVersions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeClusters() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeClustersInput{ - ClusterIdentifier: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - TagKeys: []*string{ - aws.String("String"), // Required - // More values... - }, - TagValues: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeClusters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeDefaultClusterParameters() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeDefaultClusterParametersInput{ - ParameterGroupFamily: aws.String("String"), // Required - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - } - resp, err := svc.DescribeDefaultClusterParameters(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeEventCategories() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeEventCategoriesInput{ - SourceType: aws.String("String"), - } - resp, err := svc.DescribeEventCategories(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeEventSubscriptions() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeEventSubscriptionsInput{ - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - SubscriptionName: aws.String("String"), - } - resp, err := svc.DescribeEventSubscriptions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeEvents() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeEventsInput{ - Duration: aws.Int64(1), - EndTime: aws.Time(time.Now()), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - SourceIdentifier: aws.String("String"), - SourceType: aws.String("SourceType"), - StartTime: aws.Time(time.Now()), - } - resp, err := svc.DescribeEvents(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeHsmClientCertificates() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeHsmClientCertificatesInput{ - HsmClientCertificateIdentifier: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - TagKeys: []*string{ - aws.String("String"), // Required - // More values... - }, - TagValues: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeHsmClientCertificates(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeHsmConfigurations() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeHsmConfigurationsInput{ - HsmConfigurationIdentifier: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - TagKeys: []*string{ - aws.String("String"), // Required - // More values... - }, - TagValues: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeHsmConfigurations(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeLoggingStatus() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeLoggingStatusInput{ - ClusterIdentifier: aws.String("String"), // Required - } - resp, err := svc.DescribeLoggingStatus(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeOrderableClusterOptions() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeOrderableClusterOptionsInput{ - ClusterVersion: aws.String("String"), - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - NodeType: aws.String("String"), - } - resp, err := svc.DescribeOrderableClusterOptions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeReservedNodeOfferings() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeReservedNodeOfferingsInput{ - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - ReservedNodeOfferingId: aws.String("String"), - } - resp, err := svc.DescribeReservedNodeOfferings(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeReservedNodes() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeReservedNodesInput{ - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - ReservedNodeId: aws.String("String"), - } - resp, err := svc.DescribeReservedNodes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeResize() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeResizeInput{ - ClusterIdentifier: aws.String("String"), // Required - } - resp, err := svc.DescribeResize(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeSnapshotCopyGrants() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeSnapshotCopyGrantsInput{ - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - SnapshotCopyGrantName: aws.String("String"), - TagKeys: []*string{ - aws.String("String"), // Required - // More values... - }, - TagValues: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeSnapshotCopyGrants(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DescribeTags() { - svc := redshift.New(session.New()) - - params := &redshift.DescribeTagsInput{ - Marker: aws.String("String"), - MaxRecords: aws.Int64(1), - ResourceName: aws.String("String"), - ResourceType: aws.String("String"), - TagKeys: []*string{ - aws.String("String"), // Required - // More values... - }, - TagValues: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeTags(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DisableLogging() { - svc := redshift.New(session.New()) - - params := &redshift.DisableLoggingInput{ - ClusterIdentifier: aws.String("String"), // Required - } - resp, err := svc.DisableLogging(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_DisableSnapshotCopy() { - svc := redshift.New(session.New()) - - params := &redshift.DisableSnapshotCopyInput{ - ClusterIdentifier: aws.String("String"), // Required - } - resp, err := svc.DisableSnapshotCopy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_EnableLogging() { - svc := redshift.New(session.New()) - - params := &redshift.EnableLoggingInput{ - BucketName: aws.String("String"), // Required - ClusterIdentifier: aws.String("String"), // Required - S3KeyPrefix: aws.String("String"), - } - resp, err := svc.EnableLogging(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_EnableSnapshotCopy() { - svc := redshift.New(session.New()) - - params := &redshift.EnableSnapshotCopyInput{ - ClusterIdentifier: aws.String("String"), // Required - DestinationRegion: aws.String("String"), // Required - RetentionPeriod: aws.Int64(1), - SnapshotCopyGrantName: aws.String("String"), - } - resp, err := svc.EnableSnapshotCopy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_ModifyCluster() { - svc := redshift.New(session.New()) - - params := &redshift.ModifyClusterInput{ - ClusterIdentifier: aws.String("String"), // Required - AllowVersionUpgrade: aws.Bool(true), - AutomatedSnapshotRetentionPeriod: aws.Int64(1), - ClusterParameterGroupName: aws.String("String"), - ClusterSecurityGroups: []*string{ - aws.String("String"), // Required - // More values... - }, - ClusterType: aws.String("String"), - ClusterVersion: aws.String("String"), - HsmClientCertificateIdentifier: aws.String("String"), - HsmConfigurationIdentifier: aws.String("String"), - MasterUserPassword: aws.String("String"), - NewClusterIdentifier: aws.String("String"), - NodeType: aws.String("String"), - NumberOfNodes: aws.Int64(1), - PreferredMaintenanceWindow: aws.String("String"), - VpcSecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.ModifyCluster(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_ModifyClusterParameterGroup() { - svc := redshift.New(session.New()) - - params := &redshift.ModifyClusterParameterGroupInput{ - ParameterGroupName: aws.String("String"), // Required - Parameters: []*redshift.Parameter{ // Required - { // Required - AllowedValues: aws.String("String"), - ApplyType: aws.String("ParameterApplyType"), - DataType: aws.String("String"), - Description: aws.String("String"), - IsModifiable: aws.Bool(true), - MinimumEngineVersion: aws.String("String"), - ParameterName: aws.String("String"), - ParameterValue: aws.String("String"), - Source: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.ModifyClusterParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_ModifyClusterSubnetGroup() { - svc := redshift.New(session.New()) - - params := &redshift.ModifyClusterSubnetGroupInput{ - ClusterSubnetGroupName: aws.String("String"), // Required - SubnetIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - Description: aws.String("String"), - } - resp, err := svc.ModifyClusterSubnetGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_ModifyEventSubscription() { - svc := redshift.New(session.New()) - - params := &redshift.ModifyEventSubscriptionInput{ - SubscriptionName: aws.String("String"), // Required - Enabled: aws.Bool(true), - EventCategories: []*string{ - aws.String("String"), // Required - // More values... - }, - Severity: aws.String("String"), - SnsTopicArn: aws.String("String"), - SourceIds: []*string{ - aws.String("String"), // Required - // More values... - }, - SourceType: aws.String("String"), - } - resp, err := svc.ModifyEventSubscription(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_ModifySnapshotCopyRetentionPeriod() { - svc := redshift.New(session.New()) - - params := &redshift.ModifySnapshotCopyRetentionPeriodInput{ - ClusterIdentifier: aws.String("String"), // Required - RetentionPeriod: aws.Int64(1), // Required - } - resp, err := svc.ModifySnapshotCopyRetentionPeriod(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_PurchaseReservedNodeOffering() { - svc := redshift.New(session.New()) - - params := &redshift.PurchaseReservedNodeOfferingInput{ - ReservedNodeOfferingId: aws.String("String"), // Required - NodeCount: aws.Int64(1), - } - resp, err := svc.PurchaseReservedNodeOffering(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_RebootCluster() { - svc := redshift.New(session.New()) - - params := &redshift.RebootClusterInput{ - ClusterIdentifier: aws.String("String"), // Required - } - resp, err := svc.RebootCluster(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_ResetClusterParameterGroup() { - svc := redshift.New(session.New()) - - params := &redshift.ResetClusterParameterGroupInput{ - ParameterGroupName: aws.String("String"), // Required - Parameters: []*redshift.Parameter{ - { // Required - AllowedValues: aws.String("String"), - ApplyType: aws.String("ParameterApplyType"), - DataType: aws.String("String"), - Description: aws.String("String"), - IsModifiable: aws.Bool(true), - MinimumEngineVersion: aws.String("String"), - ParameterName: aws.String("String"), - ParameterValue: aws.String("String"), - Source: aws.String("String"), - }, - // More values... - }, - ResetAllParameters: aws.Bool(true), - } - resp, err := svc.ResetClusterParameterGroup(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_RestoreFromClusterSnapshot() { - svc := redshift.New(session.New()) - - params := &redshift.RestoreFromClusterSnapshotInput{ - ClusterIdentifier: aws.String("String"), // Required - SnapshotIdentifier: aws.String("String"), // Required - AllowVersionUpgrade: aws.Bool(true), - AutomatedSnapshotRetentionPeriod: aws.Int64(1), - AvailabilityZone: aws.String("String"), - ClusterParameterGroupName: aws.String("String"), - ClusterSecurityGroups: []*string{ - aws.String("String"), // Required - // More values... - }, - ClusterSubnetGroupName: aws.String("String"), - ElasticIp: aws.String("String"), - HsmClientCertificateIdentifier: aws.String("String"), - HsmConfigurationIdentifier: aws.String("String"), - KmsKeyId: aws.String("String"), - NodeType: aws.String("String"), - OwnerAccount: aws.String("String"), - Port: aws.Int64(1), - PreferredMaintenanceWindow: aws.String("String"), - PubliclyAccessible: aws.Bool(true), - SnapshotClusterIdentifier: aws.String("String"), - VpcSecurityGroupIds: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.RestoreFromClusterSnapshot(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_RevokeClusterSecurityGroupIngress() { - svc := redshift.New(session.New()) - - params := &redshift.RevokeClusterSecurityGroupIngressInput{ - ClusterSecurityGroupName: aws.String("String"), // Required - CIDRIP: aws.String("String"), - EC2SecurityGroupName: aws.String("String"), - EC2SecurityGroupOwnerId: aws.String("String"), - } - resp, err := svc.RevokeClusterSecurityGroupIngress(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_RevokeSnapshotAccess() { - svc := redshift.New(session.New()) - - params := &redshift.RevokeSnapshotAccessInput{ - AccountWithRestoreAccess: aws.String("String"), // Required - SnapshotIdentifier: aws.String("String"), // Required - SnapshotClusterIdentifier: aws.String("String"), - } - resp, err := svc.RevokeSnapshotAccess(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRedshift_RotateEncryptionKey() { - svc := redshift.New(session.New()) - - params := &redshift.RotateEncryptionKeyInput{ - ClusterIdentifier: aws.String("String"), // Required - } - resp, err := svc.RotateEncryptionKey(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/route53/customizations_test.go b/vendor/github.com/aws/aws-sdk-go/service/route53/customizations_test.go deleted file mode 100644 index 518790a24f..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/route53/customizations_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package route53_test - -import ( - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/route53" -) - -func TestBuildCorrectURI(t *testing.T) { - svc := route53.New(unit.Session) - svc.Handlers.Validate.Clear() - req, _ := svc.GetHostedZoneRequest(&route53.GetHostedZoneInput{ - Id: aws.String("/hostedzone/ABCDEFG"), - }) - - req.Build() - - awstesting.Match(t, `\/hostedzone\/ABCDEFG$`, req.HTTPRequest.URL.String()) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/route53/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/route53/examples_test.go deleted file mode 100644 index 9d179f5574..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/route53/examples_test.go +++ /dev/null @@ -1,1080 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package route53_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/route53" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleRoute53_AssociateVPCWithHostedZone() { - svc := route53.New(session.New()) - - params := &route53.AssociateVPCWithHostedZoneInput{ - HostedZoneId: aws.String("ResourceId"), // Required - VPC: &route53.VPC{ // Required - VPCId: aws.String("VPCId"), - VPCRegion: aws.String("VPCRegion"), - }, - Comment: aws.String("AssociateVPCComment"), - } - resp, err := svc.AssociateVPCWithHostedZone(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ChangeResourceRecordSets() { - svc := route53.New(session.New()) - - params := &route53.ChangeResourceRecordSetsInput{ - ChangeBatch: &route53.ChangeBatch{ // Required - Changes: []*route53.Change{ // Required - { // Required - Action: aws.String("ChangeAction"), // Required - ResourceRecordSet: &route53.ResourceRecordSet{ // Required - Name: aws.String("DNSName"), // Required - Type: aws.String("RRType"), // Required - AliasTarget: &route53.AliasTarget{ - DNSName: aws.String("DNSName"), // Required - EvaluateTargetHealth: aws.Bool(true), // Required - HostedZoneId: aws.String("ResourceId"), // Required - }, - Failover: aws.String("ResourceRecordSetFailover"), - GeoLocation: &route53.GeoLocation{ - ContinentCode: aws.String("GeoLocationContinentCode"), - CountryCode: aws.String("GeoLocationCountryCode"), - SubdivisionCode: aws.String("GeoLocationSubdivisionCode"), - }, - HealthCheckId: aws.String("HealthCheckId"), - Region: aws.String("ResourceRecordSetRegion"), - ResourceRecords: []*route53.ResourceRecord{ - { // Required - Value: aws.String("RData"), // Required - }, - // More values... - }, - SetIdentifier: aws.String("ResourceRecordSetIdentifier"), - TTL: aws.Int64(1), - TrafficPolicyInstanceId: aws.String("TrafficPolicyInstanceId"), - Weight: aws.Int64(1), - }, - }, - // More values... - }, - Comment: aws.String("ResourceDescription"), - }, - HostedZoneId: aws.String("ResourceId"), // Required - } - resp, err := svc.ChangeResourceRecordSets(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ChangeTagsForResource() { - svc := route53.New(session.New()) - - params := &route53.ChangeTagsForResourceInput{ - ResourceId: aws.String("TagResourceId"), // Required - ResourceType: aws.String("TagResourceType"), // Required - AddTags: []*route53.Tag{ - { // Required - Key: aws.String("TagKey"), - Value: aws.String("TagValue"), - }, - // More values... - }, - RemoveTagKeys: []*string{ - aws.String("TagKey"), // Required - // More values... - }, - } - resp, err := svc.ChangeTagsForResource(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_CreateHealthCheck() { - svc := route53.New(session.New()) - - params := &route53.CreateHealthCheckInput{ - CallerReference: aws.String("HealthCheckNonce"), // Required - HealthCheckConfig: &route53.HealthCheckConfig{ // Required - Type: aws.String("HealthCheckType"), // Required - ChildHealthChecks: []*string{ - aws.String("HealthCheckId"), // Required - // More values... - }, - FailureThreshold: aws.Int64(1), - FullyQualifiedDomainName: aws.String("FullyQualifiedDomainName"), - HealthThreshold: aws.Int64(1), - IPAddress: aws.String("IPAddress"), - Inverted: aws.Bool(true), - MeasureLatency: aws.Bool(true), - Port: aws.Int64(1), - RequestInterval: aws.Int64(1), - ResourcePath: aws.String("ResourcePath"), - SearchString: aws.String("SearchString"), - }, - } - resp, err := svc.CreateHealthCheck(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_CreateHostedZone() { - svc := route53.New(session.New()) - - params := &route53.CreateHostedZoneInput{ - CallerReference: aws.String("Nonce"), // Required - Name: aws.String("DNSName"), // Required - DelegationSetId: aws.String("ResourceId"), - HostedZoneConfig: &route53.HostedZoneConfig{ - Comment: aws.String("ResourceDescription"), - PrivateZone: aws.Bool(true), - }, - VPC: &route53.VPC{ - VPCId: aws.String("VPCId"), - VPCRegion: aws.String("VPCRegion"), - }, - } - resp, err := svc.CreateHostedZone(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_CreateReusableDelegationSet() { - svc := route53.New(session.New()) - - params := &route53.CreateReusableDelegationSetInput{ - CallerReference: aws.String("Nonce"), // Required - HostedZoneId: aws.String("ResourceId"), - } - resp, err := svc.CreateReusableDelegationSet(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_CreateTrafficPolicy() { - svc := route53.New(session.New()) - - params := &route53.CreateTrafficPolicyInput{ - Document: aws.String("TrafficPolicyDocument"), // Required - Name: aws.String("TrafficPolicyName"), // Required - Comment: aws.String("TrafficPolicyComment"), - } - resp, err := svc.CreateTrafficPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_CreateTrafficPolicyInstance() { - svc := route53.New(session.New()) - - params := &route53.CreateTrafficPolicyInstanceInput{ - HostedZoneId: aws.String("ResourceId"), // Required - Name: aws.String("DNSName"), // Required - TTL: aws.Int64(1), // Required - TrafficPolicyId: aws.String("TrafficPolicyId"), // Required - TrafficPolicyVersion: aws.Int64(1), // Required - } - resp, err := svc.CreateTrafficPolicyInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_CreateTrafficPolicyVersion() { - svc := route53.New(session.New()) - - params := &route53.CreateTrafficPolicyVersionInput{ - Document: aws.String("TrafficPolicyDocument"), // Required - Id: aws.String("TrafficPolicyId"), // Required - Comment: aws.String("TrafficPolicyComment"), - } - resp, err := svc.CreateTrafficPolicyVersion(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_DeleteHealthCheck() { - svc := route53.New(session.New()) - - params := &route53.DeleteHealthCheckInput{ - HealthCheckId: aws.String("HealthCheckId"), // Required - } - resp, err := svc.DeleteHealthCheck(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_DeleteHostedZone() { - svc := route53.New(session.New()) - - params := &route53.DeleteHostedZoneInput{ - Id: aws.String("ResourceId"), // Required - } - resp, err := svc.DeleteHostedZone(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_DeleteReusableDelegationSet() { - svc := route53.New(session.New()) - - params := &route53.DeleteReusableDelegationSetInput{ - Id: aws.String("ResourceId"), // Required - } - resp, err := svc.DeleteReusableDelegationSet(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_DeleteTrafficPolicy() { - svc := route53.New(session.New()) - - params := &route53.DeleteTrafficPolicyInput{ - Id: aws.String("TrafficPolicyId"), // Required - Version: aws.Int64(1), // Required - } - resp, err := svc.DeleteTrafficPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_DeleteTrafficPolicyInstance() { - svc := route53.New(session.New()) - - params := &route53.DeleteTrafficPolicyInstanceInput{ - Id: aws.String("TrafficPolicyInstanceId"), // Required - } - resp, err := svc.DeleteTrafficPolicyInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_DisassociateVPCFromHostedZone() { - svc := route53.New(session.New()) - - params := &route53.DisassociateVPCFromHostedZoneInput{ - HostedZoneId: aws.String("ResourceId"), // Required - VPC: &route53.VPC{ // Required - VPCId: aws.String("VPCId"), - VPCRegion: aws.String("VPCRegion"), - }, - Comment: aws.String("DisassociateVPCComment"), - } - resp, err := svc.DisassociateVPCFromHostedZone(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_GetChange() { - svc := route53.New(session.New()) - - params := &route53.GetChangeInput{ - Id: aws.String("ResourceId"), // Required - } - resp, err := svc.GetChange(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_GetChangeDetails() { - svc := route53.New(session.New()) - - params := &route53.GetChangeDetailsInput{ - Id: aws.String("ResourceId"), // Required - } - resp, err := svc.GetChangeDetails(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_GetCheckerIpRanges() { - svc := route53.New(session.New()) - - var params *route53.GetCheckerIpRangesInput - resp, err := svc.GetCheckerIpRanges(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_GetGeoLocation() { - svc := route53.New(session.New()) - - params := &route53.GetGeoLocationInput{ - ContinentCode: aws.String("GeoLocationContinentCode"), - CountryCode: aws.String("GeoLocationCountryCode"), - SubdivisionCode: aws.String("GeoLocationSubdivisionCode"), - } - resp, err := svc.GetGeoLocation(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_GetHealthCheck() { - svc := route53.New(session.New()) - - params := &route53.GetHealthCheckInput{ - HealthCheckId: aws.String("HealthCheckId"), // Required - } - resp, err := svc.GetHealthCheck(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_GetHealthCheckCount() { - svc := route53.New(session.New()) - - var params *route53.GetHealthCheckCountInput - resp, err := svc.GetHealthCheckCount(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_GetHealthCheckLastFailureReason() { - svc := route53.New(session.New()) - - params := &route53.GetHealthCheckLastFailureReasonInput{ - HealthCheckId: aws.String("HealthCheckId"), // Required - } - resp, err := svc.GetHealthCheckLastFailureReason(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_GetHealthCheckStatus() { - svc := route53.New(session.New()) - - params := &route53.GetHealthCheckStatusInput{ - HealthCheckId: aws.String("HealthCheckId"), // Required - } - resp, err := svc.GetHealthCheckStatus(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_GetHostedZone() { - svc := route53.New(session.New()) - - params := &route53.GetHostedZoneInput{ - Id: aws.String("ResourceId"), // Required - } - resp, err := svc.GetHostedZone(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_GetHostedZoneCount() { - svc := route53.New(session.New()) - - var params *route53.GetHostedZoneCountInput - resp, err := svc.GetHostedZoneCount(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_GetReusableDelegationSet() { - svc := route53.New(session.New()) - - params := &route53.GetReusableDelegationSetInput{ - Id: aws.String("ResourceId"), // Required - } - resp, err := svc.GetReusableDelegationSet(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_GetTrafficPolicy() { - svc := route53.New(session.New()) - - params := &route53.GetTrafficPolicyInput{ - Id: aws.String("TrafficPolicyId"), // Required - Version: aws.Int64(1), // Required - } - resp, err := svc.GetTrafficPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_GetTrafficPolicyInstance() { - svc := route53.New(session.New()) - - params := &route53.GetTrafficPolicyInstanceInput{ - Id: aws.String("TrafficPolicyInstanceId"), // Required - } - resp, err := svc.GetTrafficPolicyInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_GetTrafficPolicyInstanceCount() { - svc := route53.New(session.New()) - - var params *route53.GetTrafficPolicyInstanceCountInput - resp, err := svc.GetTrafficPolicyInstanceCount(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ListChangeBatchesByHostedZone() { - svc := route53.New(session.New()) - - params := &route53.ListChangeBatchesByHostedZoneInput{ - EndDate: aws.String("Date"), // Required - HostedZoneId: aws.String("ResourceId"), // Required - StartDate: aws.String("Date"), // Required - Marker: aws.String("PageMarker"), - MaxItems: aws.String("PageMaxItems"), - } - resp, err := svc.ListChangeBatchesByHostedZone(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ListChangeBatchesByRRSet() { - svc := route53.New(session.New()) - - params := &route53.ListChangeBatchesByRRSetInput{ - EndDate: aws.String("Date"), // Required - HostedZoneId: aws.String("ResourceId"), // Required - Name: aws.String("DNSName"), // Required - StartDate: aws.String("Date"), // Required - Type: aws.String("RRType"), // Required - Marker: aws.String("PageMarker"), - MaxItems: aws.String("PageMaxItems"), - SetIdentifier: aws.String("ResourceRecordSetIdentifier"), - } - resp, err := svc.ListChangeBatchesByRRSet(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ListGeoLocations() { - svc := route53.New(session.New()) - - params := &route53.ListGeoLocationsInput{ - MaxItems: aws.String("PageMaxItems"), - StartContinentCode: aws.String("GeoLocationContinentCode"), - StartCountryCode: aws.String("GeoLocationCountryCode"), - StartSubdivisionCode: aws.String("GeoLocationSubdivisionCode"), - } - resp, err := svc.ListGeoLocations(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ListHealthChecks() { - svc := route53.New(session.New()) - - params := &route53.ListHealthChecksInput{ - Marker: aws.String("PageMarker"), - MaxItems: aws.String("PageMaxItems"), - } - resp, err := svc.ListHealthChecks(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ListHostedZones() { - svc := route53.New(session.New()) - - params := &route53.ListHostedZonesInput{ - DelegationSetId: aws.String("ResourceId"), - Marker: aws.String("PageMarker"), - MaxItems: aws.String("PageMaxItems"), - } - resp, err := svc.ListHostedZones(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ListHostedZonesByName() { - svc := route53.New(session.New()) - - params := &route53.ListHostedZonesByNameInput{ - DNSName: aws.String("DNSName"), - HostedZoneId: aws.String("ResourceId"), - MaxItems: aws.String("PageMaxItems"), - } - resp, err := svc.ListHostedZonesByName(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ListResourceRecordSets() { - svc := route53.New(session.New()) - - params := &route53.ListResourceRecordSetsInput{ - HostedZoneId: aws.String("ResourceId"), // Required - MaxItems: aws.String("PageMaxItems"), - StartRecordIdentifier: aws.String("ResourceRecordSetIdentifier"), - StartRecordName: aws.String("DNSName"), - StartRecordType: aws.String("RRType"), - } - resp, err := svc.ListResourceRecordSets(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ListReusableDelegationSets() { - svc := route53.New(session.New()) - - params := &route53.ListReusableDelegationSetsInput{ - Marker: aws.String("PageMarker"), - MaxItems: aws.String("PageMaxItems"), - } - resp, err := svc.ListReusableDelegationSets(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ListTagsForResource() { - svc := route53.New(session.New()) - - params := &route53.ListTagsForResourceInput{ - ResourceId: aws.String("TagResourceId"), // Required - ResourceType: aws.String("TagResourceType"), // Required - } - resp, err := svc.ListTagsForResource(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ListTagsForResources() { - svc := route53.New(session.New()) - - params := &route53.ListTagsForResourcesInput{ - ResourceIds: []*string{ // Required - aws.String("TagResourceId"), // Required - // More values... - }, - ResourceType: aws.String("TagResourceType"), // Required - } - resp, err := svc.ListTagsForResources(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ListTrafficPolicies() { - svc := route53.New(session.New()) - - params := &route53.ListTrafficPoliciesInput{ - MaxItems: aws.String("PageMaxItems"), - TrafficPolicyIdMarker: aws.String("TrafficPolicyId"), - } - resp, err := svc.ListTrafficPolicies(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ListTrafficPolicyInstances() { - svc := route53.New(session.New()) - - params := &route53.ListTrafficPolicyInstancesInput{ - HostedZoneIdMarker: aws.String("ResourceId"), - MaxItems: aws.String("PageMaxItems"), - TrafficPolicyInstanceNameMarker: aws.String("DNSName"), - TrafficPolicyInstanceTypeMarker: aws.String("RRType"), - } - resp, err := svc.ListTrafficPolicyInstances(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ListTrafficPolicyInstancesByHostedZone() { - svc := route53.New(session.New()) - - params := &route53.ListTrafficPolicyInstancesByHostedZoneInput{ - HostedZoneId: aws.String("ResourceId"), // Required - MaxItems: aws.String("PageMaxItems"), - TrafficPolicyInstanceNameMarker: aws.String("DNSName"), - TrafficPolicyInstanceTypeMarker: aws.String("RRType"), - } - resp, err := svc.ListTrafficPolicyInstancesByHostedZone(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ListTrafficPolicyInstancesByPolicy() { - svc := route53.New(session.New()) - - params := &route53.ListTrafficPolicyInstancesByPolicyInput{ - TrafficPolicyId: aws.String("TrafficPolicyId"), // Required - TrafficPolicyVersion: aws.Int64(1), // Required - HostedZoneIdMarker: aws.String("ResourceId"), - MaxItems: aws.String("PageMaxItems"), - TrafficPolicyInstanceNameMarker: aws.String("DNSName"), - TrafficPolicyInstanceTypeMarker: aws.String("RRType"), - } - resp, err := svc.ListTrafficPolicyInstancesByPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_ListTrafficPolicyVersions() { - svc := route53.New(session.New()) - - params := &route53.ListTrafficPolicyVersionsInput{ - Id: aws.String("TrafficPolicyId"), // Required - MaxItems: aws.String("PageMaxItems"), - TrafficPolicyVersionMarker: aws.String("TrafficPolicyVersionMarker"), - } - resp, err := svc.ListTrafficPolicyVersions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_UpdateHealthCheck() { - svc := route53.New(session.New()) - - params := &route53.UpdateHealthCheckInput{ - HealthCheckId: aws.String("HealthCheckId"), // Required - ChildHealthChecks: []*string{ - aws.String("HealthCheckId"), // Required - // More values... - }, - FailureThreshold: aws.Int64(1), - FullyQualifiedDomainName: aws.String("FullyQualifiedDomainName"), - HealthCheckVersion: aws.Int64(1), - HealthThreshold: aws.Int64(1), - IPAddress: aws.String("IPAddress"), - Inverted: aws.Bool(true), - Port: aws.Int64(1), - ResourcePath: aws.String("ResourcePath"), - SearchString: aws.String("SearchString"), - } - resp, err := svc.UpdateHealthCheck(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_UpdateHostedZoneComment() { - svc := route53.New(session.New()) - - params := &route53.UpdateHostedZoneCommentInput{ - Id: aws.String("ResourceId"), // Required - Comment: aws.String("ResourceDescription"), - } - resp, err := svc.UpdateHostedZoneComment(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_UpdateTrafficPolicyComment() { - svc := route53.New(session.New()) - - params := &route53.UpdateTrafficPolicyCommentInput{ - Comment: aws.String("TrafficPolicyComment"), // Required - Id: aws.String("TrafficPolicyId"), // Required - Version: aws.Int64(1), // Required - } - resp, err := svc.UpdateTrafficPolicyComment(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleRoute53_UpdateTrafficPolicyInstance() { - svc := route53.New(session.New()) - - params := &route53.UpdateTrafficPolicyInstanceInput{ - Id: aws.String("TrafficPolicyInstanceId"), // Required - TTL: aws.Int64(1), // Required - TrafficPolicyId: aws.String("TrafficPolicyId"), // Required - TrafficPolicyVersion: aws.Int64(1), // Required - } - resp, err := svc.UpdateTrafficPolicyInstance(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location_test.go deleted file mode 100644 index 8ef61b0e5f..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package s3_test - -import ( - "bytes" - "io/ioutil" - "net/http" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" - "github.com/stretchr/testify/assert" -) - -var s3LocationTests = []struct { - body string - loc string -}{ - {``, ``}, - {`EU`, `EU`}, -} - -func TestGetBucketLocation(t *testing.T) { - for _, test := range s3LocationTests { - s := s3.New(unit.Session) - s.Handlers.Send.Clear() - s.Handlers.Send.PushBack(func(r *request.Request) { - reader := ioutil.NopCloser(bytes.NewReader([]byte(test.body))) - r.HTTPResponse = &http.Response{StatusCode: 200, Body: reader} - }) - - resp, err := s.GetBucketLocation(&s3.GetBucketLocationInput{Bucket: aws.String("bucket")}) - assert.NoError(t, err) - if test.loc == "" { - assert.Nil(t, resp.LocationConstraint) - } else { - assert.Equal(t, test.loc, *resp.LocationConstraint) - } - } -} - -func TestPopulateLocationConstraint(t *testing.T) { - s := s3.New(unit.Session) - in := &s3.CreateBucketInput{ - Bucket: aws.String("bucket"), - } - req, _ := s.CreateBucketRequest(in) - err := req.Build() - assert.NoError(t, err) - v, _ := awsutil.ValuesAtPath(req.Params, "CreateBucketConfiguration.LocationConstraint") - assert.Equal(t, "mock-region", *(v[0].(*string))) - assert.Nil(t, in.CreateBucketConfiguration) // don't modify original params -} - -func TestNoPopulateLocationConstraintIfProvided(t *testing.T) { - s := s3.New(unit.Session) - req, _ := s.CreateBucketRequest(&s3.CreateBucketInput{ - Bucket: aws.String("bucket"), - CreateBucketConfiguration: &s3.CreateBucketConfiguration{}, - }) - err := req.Build() - assert.NoError(t, err) - v, _ := awsutil.ValuesAtPath(req.Params, "CreateBucketConfiguration.LocationConstraint") - assert.Equal(t, 0, len(v)) -} - -func TestNoPopulateLocationConstraintIfClassic(t *testing.T) { - s := s3.New(unit.Session, &aws.Config{Region: aws.String("us-east-1")}) - req, _ := s.CreateBucketRequest(&s3.CreateBucketInput{ - Bucket: aws.String("bucket"), - }) - err := req.Build() - assert.NoError(t, err) - v, _ := awsutil.ValuesAtPath(req.Params, "CreateBucketConfiguration.LocationConstraint") - assert.Equal(t, 0, len(v)) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/customizations_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/customizations_test.go deleted file mode 100644 index 20a62d7ac6..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/customizations_test.go +++ /dev/null @@ -1,105 +0,0 @@ -package s3_test - -import ( - "crypto/md5" - "encoding/base64" - "io/ioutil" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" - "github.com/stretchr/testify/assert" -) - -func assertMD5(t *testing.T, req *request.Request) { - err := req.Build() - assert.NoError(t, err) - - b, _ := ioutil.ReadAll(req.HTTPRequest.Body) - out := md5.Sum(b) - assert.NotEmpty(t, b) - assert.Equal(t, base64.StdEncoding.EncodeToString(out[:]), req.HTTPRequest.Header.Get("Content-MD5")) -} - -func TestMD5InPutBucketCors(t *testing.T) { - svc := s3.New(unit.Session) - req, _ := svc.PutBucketCorsRequest(&s3.PutBucketCorsInput{ - Bucket: aws.String("bucketname"), - CORSConfiguration: &s3.CORSConfiguration{ - CORSRules: []*s3.CORSRule{ - { - AllowedMethods: []*string{aws.String("GET")}, - AllowedOrigins: []*string{aws.String("*")}, - }, - }, - }, - }) - assertMD5(t, req) -} - -func TestMD5InPutBucketLifecycle(t *testing.T) { - svc := s3.New(unit.Session) - req, _ := svc.PutBucketLifecycleRequest(&s3.PutBucketLifecycleInput{ - Bucket: aws.String("bucketname"), - LifecycleConfiguration: &s3.LifecycleConfiguration{ - Rules: []*s3.Rule{ - { - ID: aws.String("ID"), - Prefix: aws.String("Prefix"), - Status: aws.String("Enabled"), - }, - }, - }, - }) - assertMD5(t, req) -} - -func TestMD5InPutBucketPolicy(t *testing.T) { - svc := s3.New(unit.Session) - req, _ := svc.PutBucketPolicyRequest(&s3.PutBucketPolicyInput{ - Bucket: aws.String("bucketname"), - Policy: aws.String("{}"), - }) - assertMD5(t, req) -} - -func TestMD5InPutBucketTagging(t *testing.T) { - svc := s3.New(unit.Session) - req, _ := svc.PutBucketTaggingRequest(&s3.PutBucketTaggingInput{ - Bucket: aws.String("bucketname"), - Tagging: &s3.Tagging{ - TagSet: []*s3.Tag{ - {Key: aws.String("KEY"), Value: aws.String("VALUE")}, - }, - }, - }) - assertMD5(t, req) -} - -func TestMD5InDeleteObjects(t *testing.T) { - svc := s3.New(unit.Session) - req, _ := svc.DeleteObjectsRequest(&s3.DeleteObjectsInput{ - Bucket: aws.String("bucketname"), - Delete: &s3.Delete{ - Objects: []*s3.ObjectIdentifier{ - {Key: aws.String("key")}, - }, - }, - }) - assertMD5(t, req) -} - -func TestMD5InPutBucketLifecycleConfiguration(t *testing.T) { - svc := s3.New(unit.Session) - req, _ := svc.PutBucketLifecycleConfigurationRequest(&s3.PutBucketLifecycleConfigurationInput{ - Bucket: aws.String("bucketname"), - LifecycleConfiguration: &s3.BucketLifecycleConfiguration{ - Rules: []*s3.LifecycleRule{ - {Prefix: aws.String("prefix"), Status: aws.String(s3.ExpirationStatusEnabled)}, - }, - }, - }) - assertMD5(t, req) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/examples_test.go deleted file mode 100644 index 59697e6b12..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/examples_test.go +++ /dev/null @@ -1,1599 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package s3_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/s3" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleS3_AbortMultipartUpload() { - svc := s3.New(session.New()) - - params := &s3.AbortMultipartUploadInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - UploadId: aws.String("MultipartUploadId"), // Required - RequestPayer: aws.String("RequestPayer"), - } - resp, err := svc.AbortMultipartUpload(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_CompleteMultipartUpload() { - svc := s3.New(session.New()) - - params := &s3.CompleteMultipartUploadInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - UploadId: aws.String("MultipartUploadId"), // Required - MultipartUpload: &s3.CompletedMultipartUpload{ - Parts: []*s3.CompletedPart{ - { // Required - ETag: aws.String("ETag"), - PartNumber: aws.Int64(1), - }, - // More values... - }, - }, - RequestPayer: aws.String("RequestPayer"), - } - resp, err := svc.CompleteMultipartUpload(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_CopyObject() { - svc := s3.New(session.New()) - - params := &s3.CopyObjectInput{ - Bucket: aws.String("BucketName"), // Required - CopySource: aws.String("CopySource"), // Required - Key: aws.String("ObjectKey"), // Required - ACL: aws.String("ObjectCannedACL"), - CacheControl: aws.String("CacheControl"), - ContentDisposition: aws.String("ContentDisposition"), - ContentEncoding: aws.String("ContentEncoding"), - ContentLanguage: aws.String("ContentLanguage"), - ContentType: aws.String("ContentType"), - CopySourceIfMatch: aws.String("CopySourceIfMatch"), - CopySourceIfModifiedSince: aws.Time(time.Now()), - CopySourceIfNoneMatch: aws.String("CopySourceIfNoneMatch"), - CopySourceIfUnmodifiedSince: aws.Time(time.Now()), - CopySourceSSECustomerAlgorithm: aws.String("CopySourceSSECustomerAlgorithm"), - CopySourceSSECustomerKey: aws.String("CopySourceSSECustomerKey"), - CopySourceSSECustomerKeyMD5: aws.String("CopySourceSSECustomerKeyMD5"), - Expires: aws.Time(time.Now()), - GrantFullControl: aws.String("GrantFullControl"), - GrantRead: aws.String("GrantRead"), - GrantReadACP: aws.String("GrantReadACP"), - GrantWriteACP: aws.String("GrantWriteACP"), - Metadata: map[string]*string{ - "Key": aws.String("MetadataValue"), // Required - // More values... - }, - MetadataDirective: aws.String("MetadataDirective"), - RequestPayer: aws.String("RequestPayer"), - SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), - SSECustomerKey: aws.String("SSECustomerKey"), - SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), - SSEKMSKeyId: aws.String("SSEKMSKeyId"), - ServerSideEncryption: aws.String("ServerSideEncryption"), - StorageClass: aws.String("StorageClass"), - WebsiteRedirectLocation: aws.String("WebsiteRedirectLocation"), - } - resp, err := svc.CopyObject(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_CreateBucket() { - svc := s3.New(session.New()) - - params := &s3.CreateBucketInput{ - Bucket: aws.String("BucketName"), // Required - ACL: aws.String("BucketCannedACL"), - CreateBucketConfiguration: &s3.CreateBucketConfiguration{ - LocationConstraint: aws.String("BucketLocationConstraint"), - }, - GrantFullControl: aws.String("GrantFullControl"), - GrantRead: aws.String("GrantRead"), - GrantReadACP: aws.String("GrantReadACP"), - GrantWrite: aws.String("GrantWrite"), - GrantWriteACP: aws.String("GrantWriteACP"), - } - resp, err := svc.CreateBucket(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_CreateMultipartUpload() { - svc := s3.New(session.New()) - - params := &s3.CreateMultipartUploadInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - ACL: aws.String("ObjectCannedACL"), - CacheControl: aws.String("CacheControl"), - ContentDisposition: aws.String("ContentDisposition"), - ContentEncoding: aws.String("ContentEncoding"), - ContentLanguage: aws.String("ContentLanguage"), - ContentType: aws.String("ContentType"), - Expires: aws.Time(time.Now()), - GrantFullControl: aws.String("GrantFullControl"), - GrantRead: aws.String("GrantRead"), - GrantReadACP: aws.String("GrantReadACP"), - GrantWriteACP: aws.String("GrantWriteACP"), - Metadata: map[string]*string{ - "Key": aws.String("MetadataValue"), // Required - // More values... - }, - RequestPayer: aws.String("RequestPayer"), - SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), - SSECustomerKey: aws.String("SSECustomerKey"), - SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), - SSEKMSKeyId: aws.String("SSEKMSKeyId"), - ServerSideEncryption: aws.String("ServerSideEncryption"), - StorageClass: aws.String("StorageClass"), - WebsiteRedirectLocation: aws.String("WebsiteRedirectLocation"), - } - resp, err := svc.CreateMultipartUpload(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_DeleteBucket() { - svc := s3.New(session.New()) - - params := &s3.DeleteBucketInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.DeleteBucket(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_DeleteBucketCors() { - svc := s3.New(session.New()) - - params := &s3.DeleteBucketCorsInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.DeleteBucketCors(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_DeleteBucketLifecycle() { - svc := s3.New(session.New()) - - params := &s3.DeleteBucketLifecycleInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.DeleteBucketLifecycle(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_DeleteBucketPolicy() { - svc := s3.New(session.New()) - - params := &s3.DeleteBucketPolicyInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.DeleteBucketPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_DeleteBucketReplication() { - svc := s3.New(session.New()) - - params := &s3.DeleteBucketReplicationInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.DeleteBucketReplication(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_DeleteBucketTagging() { - svc := s3.New(session.New()) - - params := &s3.DeleteBucketTaggingInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.DeleteBucketTagging(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_DeleteBucketWebsite() { - svc := s3.New(session.New()) - - params := &s3.DeleteBucketWebsiteInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.DeleteBucketWebsite(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_DeleteObject() { - svc := s3.New(session.New()) - - params := &s3.DeleteObjectInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - MFA: aws.String("MFA"), - RequestPayer: aws.String("RequestPayer"), - VersionId: aws.String("ObjectVersionId"), - } - resp, err := svc.DeleteObject(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_DeleteObjects() { - svc := s3.New(session.New()) - - params := &s3.DeleteObjectsInput{ - Bucket: aws.String("BucketName"), // Required - Delete: &s3.Delete{ // Required - Objects: []*s3.ObjectIdentifier{ // Required - { // Required - Key: aws.String("ObjectKey"), // Required - VersionId: aws.String("ObjectVersionId"), - }, - // More values... - }, - Quiet: aws.Bool(true), - }, - MFA: aws.String("MFA"), - RequestPayer: aws.String("RequestPayer"), - } - resp, err := svc.DeleteObjects(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetBucketAcl() { - svc := s3.New(session.New()) - - params := &s3.GetBucketAclInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketAcl(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetBucketCors() { - svc := s3.New(session.New()) - - params := &s3.GetBucketCorsInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketCors(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetBucketLifecycle() { - svc := s3.New(session.New()) - - params := &s3.GetBucketLifecycleInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketLifecycle(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetBucketLifecycleConfiguration() { - svc := s3.New(session.New()) - - params := &s3.GetBucketLifecycleConfigurationInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketLifecycleConfiguration(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetBucketLocation() { - svc := s3.New(session.New()) - - params := &s3.GetBucketLocationInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketLocation(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetBucketLogging() { - svc := s3.New(session.New()) - - params := &s3.GetBucketLoggingInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketLogging(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetBucketNotification() { - svc := s3.New(session.New()) - - params := &s3.GetBucketNotificationConfigurationRequest{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketNotification(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetBucketNotificationConfiguration() { - svc := s3.New(session.New()) - - params := &s3.GetBucketNotificationConfigurationRequest{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketNotificationConfiguration(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetBucketPolicy() { - svc := s3.New(session.New()) - - params := &s3.GetBucketPolicyInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetBucketReplication() { - svc := s3.New(session.New()) - - params := &s3.GetBucketReplicationInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketReplication(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetBucketRequestPayment() { - svc := s3.New(session.New()) - - params := &s3.GetBucketRequestPaymentInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketRequestPayment(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetBucketTagging() { - svc := s3.New(session.New()) - - params := &s3.GetBucketTaggingInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketTagging(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetBucketVersioning() { - svc := s3.New(session.New()) - - params := &s3.GetBucketVersioningInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketVersioning(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetBucketWebsite() { - svc := s3.New(session.New()) - - params := &s3.GetBucketWebsiteInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketWebsite(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetObject() { - svc := s3.New(session.New()) - - params := &s3.GetObjectInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - IfMatch: aws.String("IfMatch"), - IfModifiedSince: aws.Time(time.Now()), - IfNoneMatch: aws.String("IfNoneMatch"), - IfUnmodifiedSince: aws.Time(time.Now()), - Range: aws.String("Range"), - RequestPayer: aws.String("RequestPayer"), - ResponseCacheControl: aws.String("ResponseCacheControl"), - ResponseContentDisposition: aws.String("ResponseContentDisposition"), - ResponseContentEncoding: aws.String("ResponseContentEncoding"), - ResponseContentLanguage: aws.String("ResponseContentLanguage"), - ResponseContentType: aws.String("ResponseContentType"), - ResponseExpires: aws.Time(time.Now()), - SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), - SSECustomerKey: aws.String("SSECustomerKey"), - SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), - VersionId: aws.String("ObjectVersionId"), - } - resp, err := svc.GetObject(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetObjectAcl() { - svc := s3.New(session.New()) - - params := &s3.GetObjectAclInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - RequestPayer: aws.String("RequestPayer"), - VersionId: aws.String("ObjectVersionId"), - } - resp, err := svc.GetObjectAcl(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_GetObjectTorrent() { - svc := s3.New(session.New()) - - params := &s3.GetObjectTorrentInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - RequestPayer: aws.String("RequestPayer"), - } - resp, err := svc.GetObjectTorrent(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_HeadBucket() { - svc := s3.New(session.New()) - - params := &s3.HeadBucketInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.HeadBucket(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_HeadObject() { - svc := s3.New(session.New()) - - params := &s3.HeadObjectInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - IfMatch: aws.String("IfMatch"), - IfModifiedSince: aws.Time(time.Now()), - IfNoneMatch: aws.String("IfNoneMatch"), - IfUnmodifiedSince: aws.Time(time.Now()), - Range: aws.String("Range"), - RequestPayer: aws.String("RequestPayer"), - SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), - SSECustomerKey: aws.String("SSECustomerKey"), - SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), - VersionId: aws.String("ObjectVersionId"), - } - resp, err := svc.HeadObject(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_ListBuckets() { - svc := s3.New(session.New()) - - var params *s3.ListBucketsInput - resp, err := svc.ListBuckets(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_ListMultipartUploads() { - svc := s3.New(session.New()) - - params := &s3.ListMultipartUploadsInput{ - Bucket: aws.String("BucketName"), // Required - Delimiter: aws.String("Delimiter"), - EncodingType: aws.String("EncodingType"), - KeyMarker: aws.String("KeyMarker"), - MaxUploads: aws.Int64(1), - Prefix: aws.String("Prefix"), - UploadIdMarker: aws.String("UploadIdMarker"), - } - resp, err := svc.ListMultipartUploads(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_ListObjectVersions() { - svc := s3.New(session.New()) - - params := &s3.ListObjectVersionsInput{ - Bucket: aws.String("BucketName"), // Required - Delimiter: aws.String("Delimiter"), - EncodingType: aws.String("EncodingType"), - KeyMarker: aws.String("KeyMarker"), - MaxKeys: aws.Int64(1), - Prefix: aws.String("Prefix"), - VersionIdMarker: aws.String("VersionIdMarker"), - } - resp, err := svc.ListObjectVersions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_ListObjects() { - svc := s3.New(session.New()) - - params := &s3.ListObjectsInput{ - Bucket: aws.String("BucketName"), // Required - Delimiter: aws.String("Delimiter"), - EncodingType: aws.String("EncodingType"), - Marker: aws.String("Marker"), - MaxKeys: aws.Int64(1), - Prefix: aws.String("Prefix"), - } - resp, err := svc.ListObjects(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_ListParts() { - svc := s3.New(session.New()) - - params := &s3.ListPartsInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - UploadId: aws.String("MultipartUploadId"), // Required - MaxParts: aws.Int64(1), - PartNumberMarker: aws.Int64(1), - RequestPayer: aws.String("RequestPayer"), - } - resp, err := svc.ListParts(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_PutBucketAcl() { - svc := s3.New(session.New()) - - params := &s3.PutBucketAclInput{ - Bucket: aws.String("BucketName"), // Required - ACL: aws.String("BucketCannedACL"), - AccessControlPolicy: &s3.AccessControlPolicy{ - Grants: []*s3.Grant{ - { // Required - Grantee: &s3.Grantee{ - Type: aws.String("Type"), // Required - DisplayName: aws.String("DisplayName"), - EmailAddress: aws.String("EmailAddress"), - ID: aws.String("ID"), - URI: aws.String("URI"), - }, - Permission: aws.String("Permission"), - }, - // More values... - }, - Owner: &s3.Owner{ - DisplayName: aws.String("DisplayName"), - ID: aws.String("ID"), - }, - }, - GrantFullControl: aws.String("GrantFullControl"), - GrantRead: aws.String("GrantRead"), - GrantReadACP: aws.String("GrantReadACP"), - GrantWrite: aws.String("GrantWrite"), - GrantWriteACP: aws.String("GrantWriteACP"), - } - resp, err := svc.PutBucketAcl(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_PutBucketCors() { - svc := s3.New(session.New()) - - params := &s3.PutBucketCorsInput{ - Bucket: aws.String("BucketName"), // Required - CORSConfiguration: &s3.CORSConfiguration{ // Required - CORSRules: []*s3.CORSRule{ // Required - { // Required - AllowedMethods: []*string{ // Required - aws.String("AllowedMethod"), // Required - // More values... - }, - AllowedOrigins: []*string{ // Required - aws.String("AllowedOrigin"), // Required - // More values... - }, - AllowedHeaders: []*string{ - aws.String("AllowedHeader"), // Required - // More values... - }, - ExposeHeaders: []*string{ - aws.String("ExposeHeader"), // Required - // More values... - }, - MaxAgeSeconds: aws.Int64(1), - }, - // More values... - }, - }, - } - resp, err := svc.PutBucketCors(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_PutBucketLifecycle() { - svc := s3.New(session.New()) - - params := &s3.PutBucketLifecycleInput{ - Bucket: aws.String("BucketName"), // Required - LifecycleConfiguration: &s3.LifecycleConfiguration{ - Rules: []*s3.Rule{ // Required - { // Required - Prefix: aws.String("Prefix"), // Required - Status: aws.String("ExpirationStatus"), // Required - Expiration: &s3.LifecycleExpiration{ - Date: aws.Time(time.Now()), - Days: aws.Int64(1), - }, - ID: aws.String("ID"), - NoncurrentVersionExpiration: &s3.NoncurrentVersionExpiration{ - NoncurrentDays: aws.Int64(1), - }, - NoncurrentVersionTransition: &s3.NoncurrentVersionTransition{ - NoncurrentDays: aws.Int64(1), - StorageClass: aws.String("TransitionStorageClass"), - }, - Transition: &s3.Transition{ - Date: aws.Time(time.Now()), - Days: aws.Int64(1), - StorageClass: aws.String("TransitionStorageClass"), - }, - }, - // More values... - }, - }, - } - resp, err := svc.PutBucketLifecycle(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_PutBucketLifecycleConfiguration() { - svc := s3.New(session.New()) - - params := &s3.PutBucketLifecycleConfigurationInput{ - Bucket: aws.String("BucketName"), // Required - LifecycleConfiguration: &s3.BucketLifecycleConfiguration{ - Rules: []*s3.LifecycleRule{ // Required - { // Required - Prefix: aws.String("Prefix"), // Required - Status: aws.String("ExpirationStatus"), // Required - Expiration: &s3.LifecycleExpiration{ - Date: aws.Time(time.Now()), - Days: aws.Int64(1), - }, - ID: aws.String("ID"), - NoncurrentVersionExpiration: &s3.NoncurrentVersionExpiration{ - NoncurrentDays: aws.Int64(1), - }, - NoncurrentVersionTransitions: []*s3.NoncurrentVersionTransition{ - { // Required - NoncurrentDays: aws.Int64(1), - StorageClass: aws.String("TransitionStorageClass"), - }, - // More values... - }, - Transitions: []*s3.Transition{ - { // Required - Date: aws.Time(time.Now()), - Days: aws.Int64(1), - StorageClass: aws.String("TransitionStorageClass"), - }, - // More values... - }, - }, - // More values... - }, - }, - } - resp, err := svc.PutBucketLifecycleConfiguration(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_PutBucketLogging() { - svc := s3.New(session.New()) - - params := &s3.PutBucketLoggingInput{ - Bucket: aws.String("BucketName"), // Required - BucketLoggingStatus: &s3.BucketLoggingStatus{ // Required - LoggingEnabled: &s3.LoggingEnabled{ - TargetBucket: aws.String("TargetBucket"), - TargetGrants: []*s3.TargetGrant{ - { // Required - Grantee: &s3.Grantee{ - Type: aws.String("Type"), // Required - DisplayName: aws.String("DisplayName"), - EmailAddress: aws.String("EmailAddress"), - ID: aws.String("ID"), - URI: aws.String("URI"), - }, - Permission: aws.String("BucketLogsPermission"), - }, - // More values... - }, - TargetPrefix: aws.String("TargetPrefix"), - }, - }, - } - resp, err := svc.PutBucketLogging(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_PutBucketNotification() { - svc := s3.New(session.New()) - - params := &s3.PutBucketNotificationInput{ - Bucket: aws.String("BucketName"), // Required - NotificationConfiguration: &s3.NotificationConfigurationDeprecated{ // Required - CloudFunctionConfiguration: &s3.CloudFunctionConfiguration{ - CloudFunction: aws.String("CloudFunction"), - Event: aws.String("Event"), - Events: []*string{ - aws.String("Event"), // Required - // More values... - }, - Id: aws.String("NotificationId"), - InvocationRole: aws.String("CloudFunctionInvocationRole"), - }, - QueueConfiguration: &s3.QueueConfigurationDeprecated{ - Event: aws.String("Event"), - Events: []*string{ - aws.String("Event"), // Required - // More values... - }, - Id: aws.String("NotificationId"), - Queue: aws.String("QueueArn"), - }, - TopicConfiguration: &s3.TopicConfigurationDeprecated{ - Event: aws.String("Event"), - Events: []*string{ - aws.String("Event"), // Required - // More values... - }, - Id: aws.String("NotificationId"), - Topic: aws.String("TopicArn"), - }, - }, - } - resp, err := svc.PutBucketNotification(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_PutBucketNotificationConfiguration() { - svc := s3.New(session.New()) - - params := &s3.PutBucketNotificationConfigurationInput{ - Bucket: aws.String("BucketName"), // Required - NotificationConfiguration: &s3.NotificationConfiguration{ // Required - LambdaFunctionConfigurations: []*s3.LambdaFunctionConfiguration{ - { // Required - Events: []*string{ // Required - aws.String("Event"), // Required - // More values... - }, - LambdaFunctionArn: aws.String("LambdaFunctionArn"), // Required - Filter: &s3.NotificationConfigurationFilter{ - Key: &s3.KeyFilter{ - FilterRules: []*s3.FilterRule{ - { // Required - Name: aws.String("FilterRuleName"), - Value: aws.String("FilterRuleValue"), - }, - // More values... - }, - }, - }, - Id: aws.String("NotificationId"), - }, - // More values... - }, - QueueConfigurations: []*s3.QueueConfiguration{ - { // Required - Events: []*string{ // Required - aws.String("Event"), // Required - // More values... - }, - QueueArn: aws.String("QueueArn"), // Required - Filter: &s3.NotificationConfigurationFilter{ - Key: &s3.KeyFilter{ - FilterRules: []*s3.FilterRule{ - { // Required - Name: aws.String("FilterRuleName"), - Value: aws.String("FilterRuleValue"), - }, - // More values... - }, - }, - }, - Id: aws.String("NotificationId"), - }, - // More values... - }, - TopicConfigurations: []*s3.TopicConfiguration{ - { // Required - Events: []*string{ // Required - aws.String("Event"), // Required - // More values... - }, - TopicArn: aws.String("TopicArn"), // Required - Filter: &s3.NotificationConfigurationFilter{ - Key: &s3.KeyFilter{ - FilterRules: []*s3.FilterRule{ - { // Required - Name: aws.String("FilterRuleName"), - Value: aws.String("FilterRuleValue"), - }, - // More values... - }, - }, - }, - Id: aws.String("NotificationId"), - }, - // More values... - }, - }, - } - resp, err := svc.PutBucketNotificationConfiguration(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_PutBucketPolicy() { - svc := s3.New(session.New()) - - params := &s3.PutBucketPolicyInput{ - Bucket: aws.String("BucketName"), // Required - Policy: aws.String("Policy"), // Required - } - resp, err := svc.PutBucketPolicy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_PutBucketReplication() { - svc := s3.New(session.New()) - - params := &s3.PutBucketReplicationInput{ - Bucket: aws.String("BucketName"), // Required - ReplicationConfiguration: &s3.ReplicationConfiguration{ // Required - Role: aws.String("Role"), // Required - Rules: []*s3.ReplicationRule{ // Required - { // Required - Destination: &s3.Destination{ // Required - Bucket: aws.String("BucketName"), // Required - StorageClass: aws.String("StorageClass"), - }, - Prefix: aws.String("Prefix"), // Required - Status: aws.String("ReplicationRuleStatus"), // Required - ID: aws.String("ID"), - }, - // More values... - }, - }, - } - resp, err := svc.PutBucketReplication(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_PutBucketRequestPayment() { - svc := s3.New(session.New()) - - params := &s3.PutBucketRequestPaymentInput{ - Bucket: aws.String("BucketName"), // Required - RequestPaymentConfiguration: &s3.RequestPaymentConfiguration{ // Required - Payer: aws.String("Payer"), // Required - }, - } - resp, err := svc.PutBucketRequestPayment(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_PutBucketTagging() { - svc := s3.New(session.New()) - - params := &s3.PutBucketTaggingInput{ - Bucket: aws.String("BucketName"), // Required - Tagging: &s3.Tagging{ // Required - TagSet: []*s3.Tag{ // Required - { // Required - Key: aws.String("ObjectKey"), // Required - Value: aws.String("Value"), // Required - }, - // More values... - }, - }, - } - resp, err := svc.PutBucketTagging(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_PutBucketVersioning() { - svc := s3.New(session.New()) - - params := &s3.PutBucketVersioningInput{ - Bucket: aws.String("BucketName"), // Required - VersioningConfiguration: &s3.VersioningConfiguration{ // Required - MFADelete: aws.String("MFADelete"), - Status: aws.String("BucketVersioningStatus"), - }, - MFA: aws.String("MFA"), - } - resp, err := svc.PutBucketVersioning(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_PutBucketWebsite() { - svc := s3.New(session.New()) - - params := &s3.PutBucketWebsiteInput{ - Bucket: aws.String("BucketName"), // Required - WebsiteConfiguration: &s3.WebsiteConfiguration{ // Required - ErrorDocument: &s3.ErrorDocument{ - Key: aws.String("ObjectKey"), // Required - }, - IndexDocument: &s3.IndexDocument{ - Suffix: aws.String("Suffix"), // Required - }, - RedirectAllRequestsTo: &s3.RedirectAllRequestsTo{ - HostName: aws.String("HostName"), // Required - Protocol: aws.String("Protocol"), - }, - RoutingRules: []*s3.RoutingRule{ - { // Required - Redirect: &s3.Redirect{ // Required - HostName: aws.String("HostName"), - HttpRedirectCode: aws.String("HttpRedirectCode"), - Protocol: aws.String("Protocol"), - ReplaceKeyPrefixWith: aws.String("ReplaceKeyPrefixWith"), - ReplaceKeyWith: aws.String("ReplaceKeyWith"), - }, - Condition: &s3.Condition{ - HttpErrorCodeReturnedEquals: aws.String("HttpErrorCodeReturnedEquals"), - KeyPrefixEquals: aws.String("KeyPrefixEquals"), - }, - }, - // More values... - }, - }, - } - resp, err := svc.PutBucketWebsite(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_PutObject() { - svc := s3.New(session.New()) - - params := &s3.PutObjectInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - ACL: aws.String("ObjectCannedACL"), - Body: bytes.NewReader([]byte("PAYLOAD")), - CacheControl: aws.String("CacheControl"), - ContentDisposition: aws.String("ContentDisposition"), - ContentEncoding: aws.String("ContentEncoding"), - ContentLanguage: aws.String("ContentLanguage"), - ContentLength: aws.Int64(1), - ContentType: aws.String("ContentType"), - Expires: aws.Time(time.Now()), - GrantFullControl: aws.String("GrantFullControl"), - GrantRead: aws.String("GrantRead"), - GrantReadACP: aws.String("GrantReadACP"), - GrantWriteACP: aws.String("GrantWriteACP"), - Metadata: map[string]*string{ - "Key": aws.String("MetadataValue"), // Required - // More values... - }, - RequestPayer: aws.String("RequestPayer"), - SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), - SSECustomerKey: aws.String("SSECustomerKey"), - SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), - SSEKMSKeyId: aws.String("SSEKMSKeyId"), - ServerSideEncryption: aws.String("ServerSideEncryption"), - StorageClass: aws.String("StorageClass"), - WebsiteRedirectLocation: aws.String("WebsiteRedirectLocation"), - } - resp, err := svc.PutObject(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_PutObjectAcl() { - svc := s3.New(session.New()) - - params := &s3.PutObjectAclInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - ACL: aws.String("ObjectCannedACL"), - AccessControlPolicy: &s3.AccessControlPolicy{ - Grants: []*s3.Grant{ - { // Required - Grantee: &s3.Grantee{ - Type: aws.String("Type"), // Required - DisplayName: aws.String("DisplayName"), - EmailAddress: aws.String("EmailAddress"), - ID: aws.String("ID"), - URI: aws.String("URI"), - }, - Permission: aws.String("Permission"), - }, - // More values... - }, - Owner: &s3.Owner{ - DisplayName: aws.String("DisplayName"), - ID: aws.String("ID"), - }, - }, - GrantFullControl: aws.String("GrantFullControl"), - GrantRead: aws.String("GrantRead"), - GrantReadACP: aws.String("GrantReadACP"), - GrantWrite: aws.String("GrantWrite"), - GrantWriteACP: aws.String("GrantWriteACP"), - RequestPayer: aws.String("RequestPayer"), - } - resp, err := svc.PutObjectAcl(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_RestoreObject() { - svc := s3.New(session.New()) - - params := &s3.RestoreObjectInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - RequestPayer: aws.String("RequestPayer"), - RestoreRequest: &s3.RestoreRequest{ - Days: aws.Int64(1), // Required - }, - VersionId: aws.String("ObjectVersionId"), - } - resp, err := svc.RestoreObject(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_UploadPart() { - svc := s3.New(session.New()) - - params := &s3.UploadPartInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - PartNumber: aws.Int64(1), // Required - UploadId: aws.String("MultipartUploadId"), // Required - Body: bytes.NewReader([]byte("PAYLOAD")), - ContentLength: aws.Int64(1), - RequestPayer: aws.String("RequestPayer"), - SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), - SSECustomerKey: aws.String("SSECustomerKey"), - SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), - } - resp, err := svc.UploadPart(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleS3_UploadPartCopy() { - svc := s3.New(session.New()) - - params := &s3.UploadPartCopyInput{ - Bucket: aws.String("BucketName"), // Required - CopySource: aws.String("CopySource"), // Required - Key: aws.String("ObjectKey"), // Required - PartNumber: aws.Int64(1), // Required - UploadId: aws.String("MultipartUploadId"), // Required - CopySourceIfMatch: aws.String("CopySourceIfMatch"), - CopySourceIfModifiedSince: aws.Time(time.Now()), - CopySourceIfNoneMatch: aws.String("CopySourceIfNoneMatch"), - CopySourceIfUnmodifiedSince: aws.Time(time.Now()), - CopySourceRange: aws.String("CopySourceRange"), - CopySourceSSECustomerAlgorithm: aws.String("CopySourceSSECustomerAlgorithm"), - CopySourceSSECustomerKey: aws.String("CopySourceSSECustomerKey"), - CopySourceSSECustomerKeyMD5: aws.String("CopySourceSSECustomerKeyMD5"), - RequestPayer: aws.String("RequestPayer"), - SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), - SSECustomerKey: aws.String("SSECustomerKey"), - SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), - } - resp, err := svc.UploadPartCopy(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket_test.go deleted file mode 100644 index 9c8e81c382..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket_test.go +++ /dev/null @@ -1,75 +0,0 @@ -package s3_test - -import ( - "net/url" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" -) - -type s3BucketTest struct { - bucket string - url string -} - -var ( - sslTests = []s3BucketTest{ - {"abc", "https://abc.s3.mock-region.amazonaws.com/"}, - {"a$b$c", "https://s3.mock-region.amazonaws.com/a%24b%24c"}, - {"a.b.c", "https://s3.mock-region.amazonaws.com/a.b.c"}, - {"a..bc", "https://s3.mock-region.amazonaws.com/a..bc"}, - } - - nosslTests = []s3BucketTest{ - {"a.b.c", "http://a.b.c.s3.mock-region.amazonaws.com/"}, - {"a..bc", "http://s3.mock-region.amazonaws.com/a..bc"}, - } - - forcepathTests = []s3BucketTest{ - {"abc", "https://s3.mock-region.amazonaws.com/abc"}, - {"a$b$c", "https://s3.mock-region.amazonaws.com/a%24b%24c"}, - {"a.b.c", "https://s3.mock-region.amazonaws.com/a.b.c"}, - {"a..bc", "https://s3.mock-region.amazonaws.com/a..bc"}, - } -) - -func runTests(t *testing.T, svc *s3.S3, tests []s3BucketTest) { - for _, test := range tests { - req, _ := svc.ListObjectsRequest(&s3.ListObjectsInput{Bucket: &test.bucket}) - req.Build() - assert.Equal(t, test.url, req.HTTPRequest.URL.String()) - } -} - -func TestHostStyleBucketBuild(t *testing.T) { - s := s3.New(unit.Session) - runTests(t, s, sslTests) -} - -func TestHostStyleBucketBuildNoSSL(t *testing.T) { - s := s3.New(unit.Session, &aws.Config{DisableSSL: aws.Bool(true)}) - runTests(t, s, nosslTests) -} - -func TestPathStyleBucketBuild(t *testing.T) { - s := s3.New(unit.Session, &aws.Config{S3ForcePathStyle: aws.Bool(true)}) - runTests(t, s, forcepathTests) -} - -func TestHostStyleBucketGetBucketLocation(t *testing.T) { - s := s3.New(unit.Session) - req, _ := s.GetBucketLocationRequest(&s3.GetBucketLocationInput{ - Bucket: aws.String("bucket"), - }) - - req.Build() - require.NoError(t, req.Error) - u, _ := url.Parse(req.HTTPRequest.URL.String()) - assert.NotContains(t, u.Host, "bucket") - assert.Contains(t, u.Path, "bucket") -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/download_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/download_test.go deleted file mode 100644 index af57e17fc4..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/download_test.go +++ /dev/null @@ -1,309 +0,0 @@ -package s3manager_test - -import ( - "bytes" - "fmt" - "io/ioutil" - "net/http" - "regexp" - "strconv" - "sync" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" - "github.com/aws/aws-sdk-go/service/s3/s3manager" -) - -func dlLoggingSvc(data []byte) (*s3.S3, *[]string, *[]string) { - var m sync.Mutex - names := []string{} - ranges := []string{} - - svc := s3.New(unit.Session) - svc.Handlers.Send.Clear() - svc.Handlers.Send.PushBack(func(r *request.Request) { - m.Lock() - defer m.Unlock() - - names = append(names, r.Operation.Name) - ranges = append(ranges, *r.Params.(*s3.GetObjectInput).Range) - - rerng := regexp.MustCompile(`bytes=(\d+)-(\d+)`) - rng := rerng.FindStringSubmatch(r.HTTPRequest.Header.Get("Range")) - start, _ := strconv.ParseInt(rng[1], 10, 64) - fin, _ := strconv.ParseInt(rng[2], 10, 64) - fin++ - - if fin > int64(len(data)) { - fin = int64(len(data)) - } - - bodyBytes := data[start:fin] - r.HTTPResponse = &http.Response{ - StatusCode: 200, - Body: ioutil.NopCloser(bytes.NewReader(bodyBytes)), - Header: http.Header{}, - } - r.HTTPResponse.Header.Set("Content-Range", fmt.Sprintf("bytes %d-%d/%d", - start, fin-1, len(data))) - r.HTTPResponse.Header.Set("Content-Length", fmt.Sprintf("%d", len(bodyBytes))) - }) - - return svc, &names, &ranges -} - -func dlLoggingSvcNoChunk(data []byte) (*s3.S3, *[]string) { - var m sync.Mutex - names := []string{} - - svc := s3.New(unit.Session) - svc.Handlers.Send.Clear() - svc.Handlers.Send.PushBack(func(r *request.Request) { - m.Lock() - defer m.Unlock() - - names = append(names, r.Operation.Name) - - r.HTTPResponse = &http.Response{ - StatusCode: 200, - Body: ioutil.NopCloser(bytes.NewReader(data[:])), - Header: http.Header{}, - } - r.HTTPResponse.Header.Set("Content-Length", fmt.Sprintf("%d", len(data))) - }) - - return svc, &names -} - -func dlLoggingSvcNoContentRangeLength(data []byte, states []int) (*s3.S3, *[]string) { - var m sync.Mutex - names := []string{} - var index int = 0 - - svc := s3.New(unit.Session) - svc.Handlers.Send.Clear() - svc.Handlers.Send.PushBack(func(r *request.Request) { - m.Lock() - defer m.Unlock() - - names = append(names, r.Operation.Name) - - r.HTTPResponse = &http.Response{ - StatusCode: states[index], - Body: ioutil.NopCloser(bytes.NewReader(data[:])), - Header: http.Header{}, - } - index++ - }) - - return svc, &names -} - -func dlLoggingSvcContentRangeTotalAny(data []byte, states []int) (*s3.S3, *[]string) { - var m sync.Mutex - names := []string{} - ranges := []string{} - var index int = 0 - - svc := s3.New(unit.Session) - svc.Handlers.Send.Clear() - svc.Handlers.Send.PushBack(func(r *request.Request) { - m.Lock() - defer m.Unlock() - - names = append(names, r.Operation.Name) - ranges = append(ranges, *r.Params.(*s3.GetObjectInput).Range) - - rerng := regexp.MustCompile(`bytes=(\d+)-(\d+)`) - rng := rerng.FindStringSubmatch(r.HTTPRequest.Header.Get("Range")) - start, _ := strconv.ParseInt(rng[1], 10, 64) - fin, _ := strconv.ParseInt(rng[2], 10, 64) - fin++ - - if fin >= int64(len(data)) { - fin = int64(len(data)) - } - - // Setting start and finish to 0 because this state of 1 is suppose to - // be an error state of 416 - if index == len(states)-1 { - start = 0 - fin = 0 - } - - bodyBytes := data[start:fin] - - r.HTTPResponse = &http.Response{ - StatusCode: states[index], - Body: ioutil.NopCloser(bytes.NewReader(bodyBytes)), - Header: http.Header{}, - } - r.HTTPResponse.Header.Set("Content-Range", fmt.Sprintf("bytes %d-%d/*", - start, fin-1)) - index++ - }) - - return svc, &names -} - -func TestDownloadOrder(t *testing.T) { - s, names, ranges := dlLoggingSvc(buf12MB) - - d := s3manager.NewDownloaderWithClient(s, func(d *s3manager.Downloader) { - d.Concurrency = 1 - }) - w := &aws.WriteAtBuffer{} - n, err := d.Download(w, &s3.GetObjectInput{ - Bucket: aws.String("bucket"), - Key: aws.String("key"), - }) - - assert.Nil(t, err) - assert.Equal(t, int64(len(buf12MB)), n) - assert.Equal(t, []string{"GetObject", "GetObject", "GetObject"}, *names) - assert.Equal(t, []string{"bytes=0-5242879", "bytes=5242880-10485759", "bytes=10485760-15728639"}, *ranges) - - count := 0 - for _, b := range w.Bytes() { - count += int(b) - } - assert.Equal(t, 0, count) -} - -func TestDownloadZero(t *testing.T) { - s, names, ranges := dlLoggingSvc([]byte{}) - - d := s3manager.NewDownloaderWithClient(s) - w := &aws.WriteAtBuffer{} - n, err := d.Download(w, &s3.GetObjectInput{ - Bucket: aws.String("bucket"), - Key: aws.String("key"), - }) - - assert.Nil(t, err) - assert.Equal(t, int64(0), n) - assert.Equal(t, []string{"GetObject"}, *names) - assert.Equal(t, []string{"bytes=0-5242879"}, *ranges) -} - -func TestDownloadSetPartSize(t *testing.T) { - s, names, ranges := dlLoggingSvc([]byte{1, 2, 3}) - - d := s3manager.NewDownloaderWithClient(s, func(d *s3manager.Downloader) { - d.Concurrency = 1 - d.PartSize = 1 - }) - w := &aws.WriteAtBuffer{} - n, err := d.Download(w, &s3.GetObjectInput{ - Bucket: aws.String("bucket"), - Key: aws.String("key"), - }) - - assert.Nil(t, err) - assert.Equal(t, int64(3), n) - assert.Equal(t, []string{"GetObject", "GetObject", "GetObject"}, *names) - assert.Equal(t, []string{"bytes=0-0", "bytes=1-1", "bytes=2-2"}, *ranges) - assert.Equal(t, []byte{1, 2, 3}, w.Bytes()) -} - -func TestDownloadError(t *testing.T) { - s, names, _ := dlLoggingSvc([]byte{1, 2, 3}) - - num := 0 - s.Handlers.Send.PushBack(func(r *request.Request) { - num++ - if num > 1 { - r.HTTPResponse.StatusCode = 400 - r.HTTPResponse.Body = ioutil.NopCloser(bytes.NewReader([]byte{})) - } - }) - - d := s3manager.NewDownloaderWithClient(s, func(d *s3manager.Downloader) { - d.Concurrency = 1 - d.PartSize = 1 - }) - w := &aws.WriteAtBuffer{} - n, err := d.Download(w, &s3.GetObjectInput{ - Bucket: aws.String("bucket"), - Key: aws.String("key"), - }) - - assert.NotNil(t, err) - assert.Equal(t, int64(1), n) - assert.Equal(t, []string{"GetObject", "GetObject"}, *names) - assert.Equal(t, []byte{1}, w.Bytes()) -} - -func TestDownloadNonChunk(t *testing.T) { - s, names := dlLoggingSvcNoChunk(buf2MB) - - d := s3manager.NewDownloaderWithClient(s, func(d *s3manager.Downloader) { - d.Concurrency = 1 - }) - w := &aws.WriteAtBuffer{} - n, err := d.Download(w, &s3.GetObjectInput{ - Bucket: aws.String("bucket"), - Key: aws.String("key"), - }) - - assert.Nil(t, err) - assert.Equal(t, int64(len(buf2MB)), n) - assert.Equal(t, []string{"GetObject"}, *names) - - count := 0 - for _, b := range w.Bytes() { - count += int(b) - } - assert.Equal(t, 0, count) -} - -func TestDownloadNoContentRangeLength(t *testing.T) { - s, names := dlLoggingSvcNoContentRangeLength(buf2MB, []int{200, 416}) - - d := s3manager.NewDownloaderWithClient(s, func(d *s3manager.Downloader) { - d.Concurrency = 1 - }) - w := &aws.WriteAtBuffer{} - n, err := d.Download(w, &s3.GetObjectInput{ - Bucket: aws.String("bucket"), - Key: aws.String("key"), - }) - - assert.Nil(t, err) - assert.Equal(t, int64(len(buf2MB)), n) - assert.Equal(t, []string{"GetObject", "GetObject"}, *names) - - count := 0 - for _, b := range w.Bytes() { - count += int(b) - } - assert.Equal(t, 0, count) -} - -func TestDownloadContentRangeTotalAny(t *testing.T) { - s, names := dlLoggingSvcContentRangeTotalAny(buf2MB, []int{200, 416}) - - d := s3manager.NewDownloaderWithClient(s, func(d *s3manager.Downloader) { - d.Concurrency = 1 - }) - w := &aws.WriteAtBuffer{} - n, err := d.Download(w, &s3.GetObjectInput{ - Bucket: aws.String("bucket"), - Key: aws.String("key"), - }) - - assert.Nil(t, err) - assert.Equal(t, int64(len(buf2MB)), n) - assert.Equal(t, []string{"GetObject", "GetObject"}, *names) - - count := 0 - for _, b := range w.Bytes() { - count += int(b) - } - assert.Equal(t, 0, count) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/shared_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/shared_test.go deleted file mode 100644 index b5b6131433..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/shared_test.go +++ /dev/null @@ -1,4 +0,0 @@ -package s3manager_test - -var buf12MB = make([]byte, 1024*1024*12) -var buf2MB = make([]byte, 1024*1024*2) diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload_test.go deleted file mode 100644 index 189ecb6575..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload_test.go +++ /dev/null @@ -1,482 +0,0 @@ -package s3manager_test - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/http/httptest" - "reflect" - "sort" - "strings" - "sync" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" - "github.com/aws/aws-sdk-go/service/s3/s3manager" - "github.com/stretchr/testify/assert" -) - -var emptyList = []string{} - -func val(i interface{}, s string) interface{} { - v, err := awsutil.ValuesAtPath(i, s) - if err != nil || len(v) == 0 { - return nil - } - if _, ok := v[0].(io.Reader); ok { - return v[0] - } - - if rv := reflect.ValueOf(v[0]); rv.Kind() == reflect.Ptr { - return rv.Elem().Interface() - } - - return v[0] -} - -func contains(src []string, s string) bool { - for _, v := range src { - if s == v { - return true - } - } - return false -} - -func loggingSvc(ignoreOps []string) (*s3.S3, *[]string, *[]interface{}) { - var m sync.Mutex - partNum := 0 - names := []string{} - params := []interface{}{} - svc := s3.New(unit.Session) - svc.Handlers.Unmarshal.Clear() - svc.Handlers.UnmarshalMeta.Clear() - svc.Handlers.UnmarshalError.Clear() - svc.Handlers.Send.Clear() - svc.Handlers.Send.PushBack(func(r *request.Request) { - m.Lock() - defer m.Unlock() - - if !contains(ignoreOps, r.Operation.Name) { - names = append(names, r.Operation.Name) - params = append(params, r.Params) - } - - r.HTTPResponse = &http.Response{ - StatusCode: 200, - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - } - - switch data := r.Data.(type) { - case *s3.CreateMultipartUploadOutput: - data.UploadId = aws.String("UPLOAD-ID") - case *s3.UploadPartOutput: - partNum++ - data.ETag = aws.String(fmt.Sprintf("ETAG%d", partNum)) - case *s3.CompleteMultipartUploadOutput: - data.Location = aws.String("https://location") - data.VersionId = aws.String("VERSION-ID") - case *s3.PutObjectOutput: - data.VersionId = aws.String("VERSION-ID") - } - }) - - return svc, &names, ¶ms -} - -func buflen(i interface{}) int { - r := i.(io.Reader) - b, _ := ioutil.ReadAll(r) - return len(b) -} - -func TestUploadOrderMulti(t *testing.T) { - s, ops, args := loggingSvc(emptyList) - u := s3manager.NewUploaderWithClient(s) - - resp, err := u.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: bytes.NewReader(buf12MB), - ServerSideEncryption: aws.String("AES256"), - ContentType: aws.String("content/type"), - }) - - assert.NoError(t, err) - assert.Equal(t, []string{"CreateMultipartUpload", "UploadPart", "UploadPart", "UploadPart", "CompleteMultipartUpload"}, *ops) - assert.Equal(t, "https://location", resp.Location) - assert.Equal(t, "UPLOAD-ID", resp.UploadID) - assert.Equal(t, aws.String("VERSION-ID"), resp.VersionID) - - // Validate input values - - // UploadPart - assert.Equal(t, "UPLOAD-ID", val((*args)[1], "UploadId")) - assert.Equal(t, "UPLOAD-ID", val((*args)[2], "UploadId")) - assert.Equal(t, "UPLOAD-ID", val((*args)[3], "UploadId")) - - // CompleteMultipartUpload - assert.Equal(t, "UPLOAD-ID", val((*args)[4], "UploadId")) - assert.Equal(t, int64(1), val((*args)[4], "MultipartUpload.Parts[0].PartNumber")) - assert.Equal(t, int64(2), val((*args)[4], "MultipartUpload.Parts[1].PartNumber")) - assert.Equal(t, int64(3), val((*args)[4], "MultipartUpload.Parts[2].PartNumber")) - assert.Regexp(t, `^ETAG\d+$`, val((*args)[4], "MultipartUpload.Parts[0].ETag")) - assert.Regexp(t, `^ETAG\d+$`, val((*args)[4], "MultipartUpload.Parts[1].ETag")) - assert.Regexp(t, `^ETAG\d+$`, val((*args)[4], "MultipartUpload.Parts[2].ETag")) - - // Custom headers - assert.Equal(t, "AES256", val((*args)[0], "ServerSideEncryption")) - assert.Equal(t, "content/type", val((*args)[0], "ContentType")) -} - -func TestUploadOrderMultiDifferentPartSize(t *testing.T) { - s, ops, args := loggingSvc(emptyList) - mgr := s3manager.NewUploaderWithClient(s, func(u *s3manager.Uploader) { - u.PartSize = 1024 * 1024 * 7 - u.Concurrency = 1 - }) - _, err := mgr.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: bytes.NewReader(buf12MB), - }) - - assert.NoError(t, err) - assert.Equal(t, []string{"CreateMultipartUpload", "UploadPart", "UploadPart", "CompleteMultipartUpload"}, *ops) - - // Part lengths - assert.Equal(t, 1024*1024*7, buflen(val((*args)[1], "Body"))) - assert.Equal(t, 1024*1024*5, buflen(val((*args)[2], "Body"))) -} - -func TestUploadIncreasePartSize(t *testing.T) { - s, ops, args := loggingSvc(emptyList) - mgr := s3manager.NewUploaderWithClient(s, func(u *s3manager.Uploader) { - u.Concurrency = 1 - u.MaxUploadParts = 2 - }) - _, err := mgr.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: bytes.NewReader(buf12MB), - }) - - assert.NoError(t, err) - assert.Equal(t, int64(s3manager.DefaultDownloadPartSize), mgr.PartSize) - assert.Equal(t, []string{"CreateMultipartUpload", "UploadPart", "UploadPart", "CompleteMultipartUpload"}, *ops) - - // Part lengths - assert.Equal(t, (1024*1024*6)+1, buflen(val((*args)[1], "Body"))) - assert.Equal(t, (1024*1024*6)-1, buflen(val((*args)[2], "Body"))) -} - -func TestUploadFailIfPartSizeTooSmall(t *testing.T) { - mgr := s3manager.NewUploader(unit.Session, func(u *s3manager.Uploader) { - u.PartSize = 5 - }) - resp, err := mgr.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: bytes.NewReader(buf12MB), - }) - - assert.Nil(t, resp) - assert.NotNil(t, err) - - aerr := err.(awserr.Error) - assert.Equal(t, "ConfigError", aerr.Code()) - assert.Contains(t, aerr.Message(), "part size must be at least") -} - -func TestUploadOrderSingle(t *testing.T) { - s, ops, args := loggingSvc(emptyList) - mgr := s3manager.NewUploaderWithClient(s) - resp, err := mgr.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: bytes.NewReader(buf2MB), - ServerSideEncryption: aws.String("AES256"), - ContentType: aws.String("content/type"), - }) - - assert.NoError(t, err) - assert.Equal(t, []string{"PutObject"}, *ops) - assert.NotEqual(t, "", resp.Location) - assert.Equal(t, aws.String("VERSION-ID"), resp.VersionID) - assert.Equal(t, "", resp.UploadID) - assert.Equal(t, "AES256", val((*args)[0], "ServerSideEncryption")) - assert.Equal(t, "content/type", val((*args)[0], "ContentType")) -} - -func TestUploadOrderSingleFailure(t *testing.T) { - s, ops, _ := loggingSvc(emptyList) - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse.StatusCode = 400 - }) - mgr := s3manager.NewUploaderWithClient(s) - resp, err := mgr.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: bytes.NewReader(buf2MB), - }) - - assert.Error(t, err) - assert.Equal(t, []string{"PutObject"}, *ops) - assert.Nil(t, resp) -} - -func TestUploadOrderZero(t *testing.T) { - s, ops, args := loggingSvc(emptyList) - mgr := s3manager.NewUploaderWithClient(s) - resp, err := mgr.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: bytes.NewReader(make([]byte, 0)), - }) - - assert.NoError(t, err) - assert.Equal(t, []string{"PutObject"}, *ops) - assert.NotEqual(t, "", resp.Location) - assert.Equal(t, "", resp.UploadID) - assert.Equal(t, 0, buflen(val((*args)[0], "Body"))) -} - -func TestUploadOrderMultiFailure(t *testing.T) { - s, ops, _ := loggingSvc(emptyList) - s.Handlers.Send.PushBack(func(r *request.Request) { - switch t := r.Data.(type) { - case *s3.UploadPartOutput: - if *t.ETag == "ETAG2" { - r.HTTPResponse.StatusCode = 400 - } - } - }) - - mgr := s3manager.NewUploaderWithClient(s, func(u *s3manager.Uploader) { - u.Concurrency = 1 - }) - _, err := mgr.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: bytes.NewReader(buf12MB), - }) - - assert.Error(t, err) - assert.Equal(t, []string{"CreateMultipartUpload", "UploadPart", "UploadPart", "AbortMultipartUpload"}, *ops) -} - -func TestUploadOrderMultiFailureOnComplete(t *testing.T) { - s, ops, _ := loggingSvc(emptyList) - s.Handlers.Send.PushBack(func(r *request.Request) { - switch r.Data.(type) { - case *s3.CompleteMultipartUploadOutput: - r.HTTPResponse.StatusCode = 400 - } - }) - - mgr := s3manager.NewUploaderWithClient(s, func(u *s3manager.Uploader) { - u.Concurrency = 1 - }) - _, err := mgr.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: bytes.NewReader(buf12MB), - }) - - assert.Error(t, err) - assert.Equal(t, []string{"CreateMultipartUpload", "UploadPart", "UploadPart", - "UploadPart", "CompleteMultipartUpload", "AbortMultipartUpload"}, *ops) -} - -func TestUploadOrderMultiFailureOnCreate(t *testing.T) { - s, ops, _ := loggingSvc(emptyList) - s.Handlers.Send.PushBack(func(r *request.Request) { - switch r.Data.(type) { - case *s3.CreateMultipartUploadOutput: - r.HTTPResponse.StatusCode = 400 - } - }) - - mgr := s3manager.NewUploaderWithClient(s) - _, err := mgr.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: bytes.NewReader(make([]byte, 1024*1024*12)), - }) - - assert.Error(t, err) - assert.Equal(t, []string{"CreateMultipartUpload"}, *ops) -} - -func TestUploadOrderMultiFailureLeaveParts(t *testing.T) { - s, ops, _ := loggingSvc(emptyList) - s.Handlers.Send.PushBack(func(r *request.Request) { - switch data := r.Data.(type) { - case *s3.UploadPartOutput: - if *data.ETag == "ETAG2" { - r.HTTPResponse.StatusCode = 400 - } - } - }) - - mgr := s3manager.NewUploaderWithClient(s, func(u *s3manager.Uploader) { - u.Concurrency = 1 - u.LeavePartsOnError = true - }) - _, err := mgr.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: bytes.NewReader(make([]byte, 1024*1024*12)), - }) - - assert.Error(t, err) - assert.Equal(t, []string{"CreateMultipartUpload", "UploadPart", "UploadPart"}, *ops) -} - -type failreader struct { - times int - failCount int -} - -func (f *failreader) Read(b []byte) (int, error) { - f.failCount++ - if f.failCount >= f.times { - return 0, fmt.Errorf("random failure") - } - return len(b), nil -} - -func TestUploadOrderReadFail1(t *testing.T) { - s, ops, _ := loggingSvc(emptyList) - mgr := s3manager.NewUploaderWithClient(s) - _, err := mgr.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: &failreader{times: 1}, - }) - - assert.Equal(t, "ReadRequestBody", err.(awserr.Error).Code()) - assert.EqualError(t, err.(awserr.Error).OrigErr(), "random failure") - assert.Equal(t, []string{}, *ops) -} - -func TestUploadOrderReadFail2(t *testing.T) { - s, ops, _ := loggingSvc([]string{"UploadPart"}) - mgr := s3manager.NewUploaderWithClient(s, func(u *s3manager.Uploader) { - u.Concurrency = 1 - }) - _, err := mgr.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: &failreader{times: 2}, - }) - - assert.Equal(t, "ReadRequestBody", err.(awserr.Error).Code()) - assert.EqualError(t, err.(awserr.Error).OrigErr(), "random failure") - assert.Equal(t, []string{"CreateMultipartUpload", "AbortMultipartUpload"}, *ops) -} - -type sizedReader struct { - size int - cur int -} - -func (s *sizedReader) Read(p []byte) (n int, err error) { - if s.cur >= s.size { - return 0, io.EOF - } - - n = len(p) - s.cur += len(p) - if s.cur > s.size { - n -= s.cur - s.size - } - - return -} - -func TestUploadOrderMultiBufferedReader(t *testing.T) { - s, ops, args := loggingSvc(emptyList) - mgr := s3manager.NewUploaderWithClient(s) - _, err := mgr.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: &sizedReader{size: 1024 * 1024 * 12}, - }) - - assert.NoError(t, err) - assert.Equal(t, []string{"CreateMultipartUpload", "UploadPart", "UploadPart", "UploadPart", "CompleteMultipartUpload"}, *ops) - - // Part lengths - parts := []int{ - buflen(val((*args)[1], "Body")), - buflen(val((*args)[2], "Body")), - buflen(val((*args)[3], "Body")), - } - sort.Ints(parts) - assert.Equal(t, []int{1024 * 1024 * 2, 1024 * 1024 * 5, 1024 * 1024 * 5}, parts) -} - -func TestUploadOrderMultiBufferedReaderExceedTotalParts(t *testing.T) { - s, ops, _ := loggingSvc([]string{"UploadPart"}) - mgr := s3manager.NewUploaderWithClient(s, func(u *s3manager.Uploader) { - u.Concurrency = 1 - u.MaxUploadParts = 2 - }) - resp, err := mgr.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: &sizedReader{size: 1024 * 1024 * 12}, - }) - - assert.Error(t, err) - assert.Nil(t, resp) - assert.Equal(t, []string{"CreateMultipartUpload", "AbortMultipartUpload"}, *ops) - - aerr := err.(awserr.Error) - assert.Equal(t, "TotalPartsExceeded", aerr.Code()) - assert.Contains(t, aerr.Message(), "configured MaxUploadParts (2)") -} - -func TestUploadOrderSingleBufferedReader(t *testing.T) { - s, ops, _ := loggingSvc(emptyList) - mgr := s3manager.NewUploaderWithClient(s) - resp, err := mgr.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: &sizedReader{size: 1024 * 1024 * 2}, - }) - - assert.NoError(t, err) - assert.Equal(t, []string{"PutObject"}, *ops) - assert.NotEqual(t, "", resp.Location) - assert.Equal(t, "", resp.UploadID) -} - -func TestUploadZeroLenObject(t *testing.T) { - requestMade := false - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - requestMade = true - w.WriteHeader(http.StatusOK) - })) - mgr := s3manager.NewUploaderWithClient(s3.New(unit.Session, &aws.Config{ - Endpoint: aws.String(server.URL), - })) - resp, err := mgr.Upload(&s3manager.UploadInput{ - Bucket: aws.String("Bucket"), - Key: aws.String("Key"), - Body: strings.NewReader(""), - }) - - assert.NoError(t, err) - assert.True(t, requestMade) - assert.NotEqual(t, "", resp.Location) - assert.Equal(t, "", resp.UploadID) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/sse_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/sse_test.go deleted file mode 100644 index 5f1ca64bff..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/sse_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package s3_test - -import ( - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" - "github.com/stretchr/testify/assert" -) - -func TestSSECustomerKeyOverHTTPError(t *testing.T) { - s := s3.New(unit.Session, &aws.Config{DisableSSL: aws.Bool(true)}) - req, _ := s.CopyObjectRequest(&s3.CopyObjectInput{ - Bucket: aws.String("bucket"), - CopySource: aws.String("bucket/source"), - Key: aws.String("dest"), - SSECustomerKey: aws.String("key"), - }) - err := req.Build() - - assert.Error(t, err) - assert.Equal(t, "ConfigError", err.(awserr.Error).Code()) - assert.Contains(t, err.(awserr.Error).Message(), "cannot send SSE keys over HTTP") -} - -func TestCopySourceSSECustomerKeyOverHTTPError(t *testing.T) { - s := s3.New(unit.Session, &aws.Config{DisableSSL: aws.Bool(true)}) - req, _ := s.CopyObjectRequest(&s3.CopyObjectInput{ - Bucket: aws.String("bucket"), - CopySource: aws.String("bucket/source"), - Key: aws.String("dest"), - CopySourceSSECustomerKey: aws.String("key"), - }) - err := req.Build() - - assert.Error(t, err) - assert.Equal(t, "ConfigError", err.(awserr.Error).Code()) - assert.Contains(t, err.(awserr.Error).Message(), "cannot send SSE keys over HTTP") -} - -func TestComputeSSEKeys(t *testing.T) { - s := s3.New(unit.Session) - req, _ := s.CopyObjectRequest(&s3.CopyObjectInput{ - Bucket: aws.String("bucket"), - CopySource: aws.String("bucket/source"), - Key: aws.String("dest"), - SSECustomerKey: aws.String("key"), - CopySourceSSECustomerKey: aws.String("key"), - }) - err := req.Build() - - assert.NoError(t, err) - assert.Equal(t, "a2V5", req.HTTPRequest.Header.Get("x-amz-server-side-encryption-customer-key")) - assert.Equal(t, "a2V5", req.HTTPRequest.Header.Get("x-amz-copy-source-server-side-encryption-customer-key")) - assert.Equal(t, "PG4LipwVIkqCKLmpjKFTHQ==", req.HTTPRequest.Header.Get("x-amz-server-side-encryption-customer-key-md5")) - assert.Equal(t, "PG4LipwVIkqCKLmpjKFTHQ==", req.HTTPRequest.Header.Get("x-amz-copy-source-server-side-encryption-customer-key-md5")) -} - -func TestComputeSSEKeysShortcircuit(t *testing.T) { - s := s3.New(unit.Session) - req, _ := s.CopyObjectRequest(&s3.CopyObjectInput{ - Bucket: aws.String("bucket"), - CopySource: aws.String("bucket/source"), - Key: aws.String("dest"), - SSECustomerKey: aws.String("key"), - CopySourceSSECustomerKey: aws.String("key"), - SSECustomerKeyMD5: aws.String("MD5"), - CopySourceSSECustomerKeyMD5: aws.String("MD5"), - }) - err := req.Build() - - assert.NoError(t, err) - assert.Equal(t, "a2V5", req.HTTPRequest.Header.Get("x-amz-server-side-encryption-customer-key")) - assert.Equal(t, "a2V5", req.HTTPRequest.Header.Get("x-amz-copy-source-server-side-encryption-customer-key")) - assert.Equal(t, "MD5", req.HTTPRequest.Header.Get("x-amz-server-side-encryption-customer-key-md5")) - assert.Equal(t, "MD5", req.HTTPRequest.Header.Get("x-amz-copy-source-server-side-encryption-customer-key-md5")) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error_test.go deleted file mode 100644 index f508cd153f..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error_test.go +++ /dev/null @@ -1,130 +0,0 @@ -package s3_test - -import ( - "fmt" - "net/http" - "net/http/httptest" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" -) - -const errMsg = `ErrorCodemessage bodyrequestIDhostID=` - -var lastModifiedTime = time.Date(2009, 11, 23, 0, 0, 0, 0, time.UTC) - -func TestCopyObjectNoError(t *testing.T) { - const successMsg = ` - -2009-11-23T0:00:00Z"1da64c7f13d1e8dbeaea40b905fd586c"` - - res, err := newCopyTestSvc(successMsg).CopyObject(&s3.CopyObjectInput{ - Bucket: aws.String("bucketname"), - CopySource: aws.String("bucketname/exists.txt"), - Key: aws.String("destination.txt"), - }) - - require.NoError(t, err) - - assert.Equal(t, fmt.Sprintf(`%q`, "1da64c7f13d1e8dbeaea40b905fd586c"), *res.CopyObjectResult.ETag) - assert.Equal(t, lastModifiedTime, *res.CopyObjectResult.LastModified) -} - -func TestCopyObjectError(t *testing.T) { - _, err := newCopyTestSvc(errMsg).CopyObject(&s3.CopyObjectInput{ - Bucket: aws.String("bucketname"), - CopySource: aws.String("bucketname/doesnotexist.txt"), - Key: aws.String("destination.txt"), - }) - - require.Error(t, err) - e := err.(awserr.Error) - - assert.Equal(t, "ErrorCode", e.Code()) - assert.Equal(t, "message body", e.Message()) -} - -func TestUploadPartCopySuccess(t *testing.T) { - const successMsg = ` - -2009-11-23T0:00:00Z"1da64c7f13d1e8dbeaea40b905fd586c"` - - res, err := newCopyTestSvc(successMsg).UploadPartCopy(&s3.UploadPartCopyInput{ - Bucket: aws.String("bucketname"), - CopySource: aws.String("bucketname/doesnotexist.txt"), - Key: aws.String("destination.txt"), - PartNumber: aws.Int64(0), - UploadId: aws.String("uploadID"), - }) - - require.NoError(t, err) - - assert.Equal(t, fmt.Sprintf(`%q`, "1da64c7f13d1e8dbeaea40b905fd586c"), *res.CopyPartResult.ETag) - assert.Equal(t, lastModifiedTime, *res.CopyPartResult.LastModified) -} - -func TestUploadPartCopyError(t *testing.T) { - _, err := newCopyTestSvc(errMsg).UploadPartCopy(&s3.UploadPartCopyInput{ - Bucket: aws.String("bucketname"), - CopySource: aws.String("bucketname/doesnotexist.txt"), - Key: aws.String("destination.txt"), - PartNumber: aws.Int64(0), - UploadId: aws.String("uploadID"), - }) - - require.Error(t, err) - e := err.(awserr.Error) - - assert.Equal(t, "ErrorCode", e.Code()) - assert.Equal(t, "message body", e.Message()) -} - -func TestCompleteMultipartUploadSuccess(t *testing.T) { - const successMsg = ` - -locationNamebucketNamekeyName"etagVal"` - res, err := newCopyTestSvc(successMsg).CompleteMultipartUpload(&s3.CompleteMultipartUploadInput{ - Bucket: aws.String("bucketname"), - Key: aws.String("key"), - UploadId: aws.String("uploadID"), - }) - - require.NoError(t, err) - - assert.Equal(t, `"etagVal"`, *res.ETag) - assert.Equal(t, "bucketName", *res.Bucket) - assert.Equal(t, "keyName", *res.Key) - assert.Equal(t, "locationName", *res.Location) -} - -func TestCompleteMultipartUploadError(t *testing.T) { - _, err := newCopyTestSvc(errMsg).CompleteMultipartUpload(&s3.CompleteMultipartUploadInput{ - Bucket: aws.String("bucketname"), - Key: aws.String("key"), - UploadId: aws.String("uploadID"), - }) - - require.Error(t, err) - e := err.(awserr.Error) - - assert.Equal(t, "ErrorCode", e.Code()) - assert.Equal(t, "message body", e.Message()) -} - -func newCopyTestSvc(errMsg string) *s3.S3 { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - http.Error(w, errMsg, http.StatusOK) - })) - return s3.New(unit.Session, aws.NewConfig(). - WithEndpoint(server.URL). - WithDisableSSL(true). - WithMaxRetries(0). - WithS3ForcePathStyle(true)) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error_test.go deleted file mode 100644 index 9e091398a6..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error_test.go +++ /dev/null @@ -1,165 +0,0 @@ -package s3_test - -import ( - "io/ioutil" - "net/http" - "strings" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" -) - -type testErrorCase struct { - RespFn func() *http.Response - ReqID string - Code, Msg string -} - -var testUnmarshalCases = []testErrorCase{ - { - RespFn: func() *http.Response { - return &http.Response{ - StatusCode: 301, - Header: http.Header{"X-Amz-Request-Id": []string{"abc123"}}, - Body: ioutil.NopCloser(nil), - ContentLength: -1, - } - }, - ReqID: "abc123", - Code: "BucketRegionError", Msg: "incorrect region, the bucket is not in 'mock-region' region", - }, - { - RespFn: func() *http.Response { - return &http.Response{ - StatusCode: 403, - Header: http.Header{"X-Amz-Request-Id": []string{"abc123"}}, - Body: ioutil.NopCloser(nil), - ContentLength: 0, - } - }, - ReqID: "abc123", - Code: "Forbidden", Msg: "Forbidden", - }, - { - RespFn: func() *http.Response { - return &http.Response{ - StatusCode: 400, - Header: http.Header{"X-Amz-Request-Id": []string{"abc123"}}, - Body: ioutil.NopCloser(nil), - ContentLength: 0, - } - }, - ReqID: "abc123", - Code: "BadRequest", Msg: "Bad Request", - }, - { - RespFn: func() *http.Response { - return &http.Response{ - StatusCode: 404, - Header: http.Header{"X-Amz-Request-Id": []string{"abc123"}}, - Body: ioutil.NopCloser(nil), - ContentLength: 0, - } - }, - ReqID: "abc123", - Code: "NotFound", Msg: "Not Found", - }, - { - RespFn: func() *http.Response { - body := `SomeExceptionException message` - return &http.Response{ - StatusCode: 500, - Header: http.Header{"X-Amz-Request-Id": []string{"abc123"}}, - Body: ioutil.NopCloser(strings.NewReader(body)), - ContentLength: int64(len(body)), - } - }, - ReqID: "abc123", - Code: "SomeException", Msg: "Exception message", - }, -} - -func TestUnmarshalError(t *testing.T) { - for _, c := range testUnmarshalCases { - s := s3.New(unit.Session) - s.Handlers.Send.Clear() - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = c.RespFn() - r.HTTPResponse.Status = http.StatusText(r.HTTPResponse.StatusCode) - }) - _, err := s.PutBucketAcl(&s3.PutBucketAclInput{ - Bucket: aws.String("bucket"), ACL: aws.String("public-read"), - }) - - assert.Error(t, err) - assert.Equal(t, c.Code, err.(awserr.Error).Code()) - assert.Equal(t, c.Msg, err.(awserr.Error).Message()) - assert.Equal(t, c.ReqID, err.(awserr.RequestFailure).RequestID()) - } -} - -const completeMultiResp = ` -163 - - -https://bucket.s3-us-west-2.amazonaws.com/keybucketkey"a7d414b9133d6483d9a1c4e04e856e3b-2" -0 -` - -func Test200NoErrorUnmarshalError(t *testing.T) { - s := s3.New(unit.Session) - s.Handlers.Send.Clear() - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &http.Response{ - StatusCode: 200, - Header: http.Header{"X-Amz-Request-Id": []string{"abc123"}}, - Body: ioutil.NopCloser(strings.NewReader(completeMultiResp)), - ContentLength: -1, - } - r.HTTPResponse.Status = http.StatusText(r.HTTPResponse.StatusCode) - }) - _, err := s.CompleteMultipartUpload(&s3.CompleteMultipartUploadInput{ - Bucket: aws.String("bucket"), Key: aws.String("key"), - UploadId: aws.String("id"), - MultipartUpload: &s3.CompletedMultipartUpload{Parts: []*s3.CompletedPart{ - {ETag: aws.String("etag"), PartNumber: aws.Int64(1)}, - }}, - }) - - assert.NoError(t, err) -} - -const completeMultiErrResp = `SomeExceptionException message` - -func Test200WithErrorUnmarshalError(t *testing.T) { - s := s3.New(unit.Session) - s.Handlers.Send.Clear() - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &http.Response{ - StatusCode: 200, - Header: http.Header{"X-Amz-Request-Id": []string{"abc123"}}, - Body: ioutil.NopCloser(strings.NewReader(completeMultiErrResp)), - ContentLength: -1, - } - r.HTTPResponse.Status = http.StatusText(r.HTTPResponse.StatusCode) - }) - _, err := s.CompleteMultipartUpload(&s3.CompleteMultipartUploadInput{ - Bucket: aws.String("bucket"), Key: aws.String("key"), - UploadId: aws.String("id"), - MultipartUpload: &s3.CompletedMultipartUpload{Parts: []*s3.CompletedPart{ - {ETag: aws.String("etag"), PartNumber: aws.Int64(1)}, - }}, - }) - - assert.Error(t, err) - - assert.Equal(t, "SomeException", err.(awserr.Error).Code()) - assert.Equal(t, "Exception message", err.(awserr.Error).Message()) - assert.Equal(t, "abc123", err.(awserr.RequestFailure).RequestID()) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sns/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/sns/examples_test.go deleted file mode 100644 index 4578ed6e77..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sns/examples_test.go +++ /dev/null @@ -1,542 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package sns_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/sns" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleSNS_AddPermission() { - svc := sns.New(session.New()) - - params := &sns.AddPermissionInput{ - AWSAccountId: []*string{ // Required - aws.String("delegate"), // Required - // More values... - }, - ActionName: []*string{ // Required - aws.String("action"), // Required - // More values... - }, - Label: aws.String("label"), // Required - TopicArn: aws.String("topicARN"), // Required - } - resp, err := svc.AddPermission(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_ConfirmSubscription() { - svc := sns.New(session.New()) - - params := &sns.ConfirmSubscriptionInput{ - Token: aws.String("token"), // Required - TopicArn: aws.String("topicARN"), // Required - AuthenticateOnUnsubscribe: aws.String("authenticateOnUnsubscribe"), - } - resp, err := svc.ConfirmSubscription(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_CreatePlatformApplication() { - svc := sns.New(session.New()) - - params := &sns.CreatePlatformApplicationInput{ - Attributes: map[string]*string{ // Required - "Key": aws.String("String"), // Required - // More values... - }, - Name: aws.String("String"), // Required - Platform: aws.String("String"), // Required - } - resp, err := svc.CreatePlatformApplication(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_CreatePlatformEndpoint() { - svc := sns.New(session.New()) - - params := &sns.CreatePlatformEndpointInput{ - PlatformApplicationArn: aws.String("String"), // Required - Token: aws.String("String"), // Required - Attributes: map[string]*string{ - "Key": aws.String("String"), // Required - // More values... - }, - CustomUserData: aws.String("String"), - } - resp, err := svc.CreatePlatformEndpoint(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_CreateTopic() { - svc := sns.New(session.New()) - - params := &sns.CreateTopicInput{ - Name: aws.String("topicName"), // Required - } - resp, err := svc.CreateTopic(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_DeleteEndpoint() { - svc := sns.New(session.New()) - - params := &sns.DeleteEndpointInput{ - EndpointArn: aws.String("String"), // Required - } - resp, err := svc.DeleteEndpoint(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_DeletePlatformApplication() { - svc := sns.New(session.New()) - - params := &sns.DeletePlatformApplicationInput{ - PlatformApplicationArn: aws.String("String"), // Required - } - resp, err := svc.DeletePlatformApplication(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_DeleteTopic() { - svc := sns.New(session.New()) - - params := &sns.DeleteTopicInput{ - TopicArn: aws.String("topicARN"), // Required - } - resp, err := svc.DeleteTopic(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_GetEndpointAttributes() { - svc := sns.New(session.New()) - - params := &sns.GetEndpointAttributesInput{ - EndpointArn: aws.String("String"), // Required - } - resp, err := svc.GetEndpointAttributes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_GetPlatformApplicationAttributes() { - svc := sns.New(session.New()) - - params := &sns.GetPlatformApplicationAttributesInput{ - PlatformApplicationArn: aws.String("String"), // Required - } - resp, err := svc.GetPlatformApplicationAttributes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_GetSubscriptionAttributes() { - svc := sns.New(session.New()) - - params := &sns.GetSubscriptionAttributesInput{ - SubscriptionArn: aws.String("subscriptionARN"), // Required - } - resp, err := svc.GetSubscriptionAttributes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_GetTopicAttributes() { - svc := sns.New(session.New()) - - params := &sns.GetTopicAttributesInput{ - TopicArn: aws.String("topicARN"), // Required - } - resp, err := svc.GetTopicAttributes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_ListEndpointsByPlatformApplication() { - svc := sns.New(session.New()) - - params := &sns.ListEndpointsByPlatformApplicationInput{ - PlatformApplicationArn: aws.String("String"), // Required - NextToken: aws.String("String"), - } - resp, err := svc.ListEndpointsByPlatformApplication(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_ListPlatformApplications() { - svc := sns.New(session.New()) - - params := &sns.ListPlatformApplicationsInput{ - NextToken: aws.String("String"), - } - resp, err := svc.ListPlatformApplications(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_ListSubscriptions() { - svc := sns.New(session.New()) - - params := &sns.ListSubscriptionsInput{ - NextToken: aws.String("nextToken"), - } - resp, err := svc.ListSubscriptions(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_ListSubscriptionsByTopic() { - svc := sns.New(session.New()) - - params := &sns.ListSubscriptionsByTopicInput{ - TopicArn: aws.String("topicARN"), // Required - NextToken: aws.String("nextToken"), - } - resp, err := svc.ListSubscriptionsByTopic(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_ListTopics() { - svc := sns.New(session.New()) - - params := &sns.ListTopicsInput{ - NextToken: aws.String("nextToken"), - } - resp, err := svc.ListTopics(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_Publish() { - svc := sns.New(session.New()) - - params := &sns.PublishInput{ - Message: aws.String("message"), // Required - MessageAttributes: map[string]*sns.MessageAttributeValue{ - "Key": { // Required - DataType: aws.String("String"), // Required - BinaryValue: []byte("PAYLOAD"), - StringValue: aws.String("String"), - }, - // More values... - }, - MessageStructure: aws.String("messageStructure"), - Subject: aws.String("subject"), - TargetArn: aws.String("String"), - TopicArn: aws.String("topicARN"), - } - resp, err := svc.Publish(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_RemovePermission() { - svc := sns.New(session.New()) - - params := &sns.RemovePermissionInput{ - Label: aws.String("label"), // Required - TopicArn: aws.String("topicARN"), // Required - } - resp, err := svc.RemovePermission(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_SetEndpointAttributes() { - svc := sns.New(session.New()) - - params := &sns.SetEndpointAttributesInput{ - Attributes: map[string]*string{ // Required - "Key": aws.String("String"), // Required - // More values... - }, - EndpointArn: aws.String("String"), // Required - } - resp, err := svc.SetEndpointAttributes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_SetPlatformApplicationAttributes() { - svc := sns.New(session.New()) - - params := &sns.SetPlatformApplicationAttributesInput{ - Attributes: map[string]*string{ // Required - "Key": aws.String("String"), // Required - // More values... - }, - PlatformApplicationArn: aws.String("String"), // Required - } - resp, err := svc.SetPlatformApplicationAttributes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_SetSubscriptionAttributes() { - svc := sns.New(session.New()) - - params := &sns.SetSubscriptionAttributesInput{ - AttributeName: aws.String("attributeName"), // Required - SubscriptionArn: aws.String("subscriptionARN"), // Required - AttributeValue: aws.String("attributeValue"), - } - resp, err := svc.SetSubscriptionAttributes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_SetTopicAttributes() { - svc := sns.New(session.New()) - - params := &sns.SetTopicAttributesInput{ - AttributeName: aws.String("attributeName"), // Required - TopicArn: aws.String("topicARN"), // Required - AttributeValue: aws.String("attributeValue"), - } - resp, err := svc.SetTopicAttributes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_Subscribe() { - svc := sns.New(session.New()) - - params := &sns.SubscribeInput{ - Protocol: aws.String("protocol"), // Required - TopicArn: aws.String("topicARN"), // Required - Endpoint: aws.String("endpoint"), - } - resp, err := svc.Subscribe(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSNS_Unsubscribe() { - svc := sns.New(session.New()) - - params := &sns.UnsubscribeInput{ - SubscriptionArn: aws.String("subscriptionARN"), // Required - } - resp, err := svc.Unsubscribe(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sqs/api_test.go b/vendor/github.com/aws/aws-sdk-go/service/sqs/api_test.go deleted file mode 100644 index 3f5517e605..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sqs/api_test.go +++ /dev/null @@ -1,30 +0,0 @@ -// +build integration - -package sqs_test - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/sqs" -) - -func TestFlattenedTraits(t *testing.T) { - s := sqs.New(session.New()) - _, err := s.DeleteMessageBatch(&sqs.DeleteMessageBatchInput{ - QueueURL: aws.String("QUEUE"), - Entries: []*sqs.DeleteMessageBatchRequestEntry{ - { - ID: aws.String("TEST"), - ReceiptHandle: aws.String("RECEIPT"), - }, - }, - }) - - assert.Error(t, err) - assert.Equal(t, "InvalidAddress", err.Code()) - assert.Equal(t, "The address QUEUE is not valid for this endpoint.", err.Message()) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sqs/checksums_test.go b/vendor/github.com/aws/aws-sdk-go/service/sqs/checksums_test.go deleted file mode 100644 index b6a2a0a2e5..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sqs/checksums_test.go +++ /dev/null @@ -1,207 +0,0 @@ -package sqs_test - -import ( - "bytes" - "io/ioutil" - "net/http" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/sqs" -) - -var svc = func() *sqs.SQS { - s := sqs.New(unit.Session, &aws.Config{ - DisableParamValidation: aws.Bool(true), - }) - s.Handlers.Send.Clear() - return s -}() - -func TestSendMessageChecksum(t *testing.T) { - req, _ := svc.SendMessageRequest(&sqs.SendMessageInput{ - MessageBody: aws.String("test"), - }) - req.Handlers.Send.PushBack(func(r *request.Request) { - body := ioutil.NopCloser(bytes.NewReader([]byte(""))) - r.HTTPResponse = &http.Response{StatusCode: 200, Body: body} - r.Data = &sqs.SendMessageOutput{ - MD5OfMessageBody: aws.String("098f6bcd4621d373cade4e832627b4f6"), - MessageId: aws.String("12345"), - } - }) - err := req.Send() - assert.NoError(t, err) -} - -func TestSendMessageChecksumInvalid(t *testing.T) { - req, _ := svc.SendMessageRequest(&sqs.SendMessageInput{ - MessageBody: aws.String("test"), - }) - req.Handlers.Send.PushBack(func(r *request.Request) { - body := ioutil.NopCloser(bytes.NewReader([]byte(""))) - r.HTTPResponse = &http.Response{StatusCode: 200, Body: body} - r.Data = &sqs.SendMessageOutput{ - MD5OfMessageBody: aws.String("000"), - MessageId: aws.String("12345"), - } - }) - err := req.Send() - assert.Error(t, err) - - assert.Equal(t, "InvalidChecksum", err.(awserr.Error).Code()) - assert.Contains(t, err.(awserr.Error).Message(), "expected MD5 checksum '000', got '098f6bcd4621d373cade4e832627b4f6'") -} - -func TestSendMessageChecksumInvalidNoValidation(t *testing.T) { - s := sqs.New(unit.Session, &aws.Config{ - DisableParamValidation: aws.Bool(true), - DisableComputeChecksums: aws.Bool(true), - }) - s.Handlers.Send.Clear() - - req, _ := s.SendMessageRequest(&sqs.SendMessageInput{ - MessageBody: aws.String("test"), - }) - req.Handlers.Send.PushBack(func(r *request.Request) { - body := ioutil.NopCloser(bytes.NewReader([]byte(""))) - r.HTTPResponse = &http.Response{StatusCode: 200, Body: body} - r.Data = &sqs.SendMessageOutput{ - MD5OfMessageBody: aws.String("000"), - MessageId: aws.String("12345"), - } - }) - err := req.Send() - assert.NoError(t, err) -} - -func TestSendMessageChecksumNoInput(t *testing.T) { - req, _ := svc.SendMessageRequest(&sqs.SendMessageInput{}) - req.Handlers.Send.PushBack(func(r *request.Request) { - body := ioutil.NopCloser(bytes.NewReader([]byte(""))) - r.HTTPResponse = &http.Response{StatusCode: 200, Body: body} - r.Data = &sqs.SendMessageOutput{} - }) - err := req.Send() - assert.Error(t, err) - - assert.Equal(t, "InvalidChecksum", err.(awserr.Error).Code()) - assert.Contains(t, err.(awserr.Error).Message(), "cannot compute checksum. missing body") -} - -func TestSendMessageChecksumNoOutput(t *testing.T) { - req, _ := svc.SendMessageRequest(&sqs.SendMessageInput{ - MessageBody: aws.String("test"), - }) - req.Handlers.Send.PushBack(func(r *request.Request) { - body := ioutil.NopCloser(bytes.NewReader([]byte(""))) - r.HTTPResponse = &http.Response{StatusCode: 200, Body: body} - r.Data = &sqs.SendMessageOutput{} - }) - err := req.Send() - assert.Error(t, err) - - assert.Equal(t, "InvalidChecksum", err.(awserr.Error).Code()) - assert.Contains(t, err.(awserr.Error).Message(), "cannot verify checksum. missing response MD5") -} - -func TestRecieveMessageChecksum(t *testing.T) { - req, _ := svc.ReceiveMessageRequest(&sqs.ReceiveMessageInput{}) - req.Handlers.Send.PushBack(func(r *request.Request) { - md5 := "098f6bcd4621d373cade4e832627b4f6" - body := ioutil.NopCloser(bytes.NewReader([]byte(""))) - r.HTTPResponse = &http.Response{StatusCode: 200, Body: body} - r.Data = &sqs.ReceiveMessageOutput{ - Messages: []*sqs.Message{ - {Body: aws.String("test"), MD5OfBody: &md5}, - {Body: aws.String("test"), MD5OfBody: &md5}, - {Body: aws.String("test"), MD5OfBody: &md5}, - {Body: aws.String("test"), MD5OfBody: &md5}, - }, - } - }) - err := req.Send() - assert.NoError(t, err) -} - -func TestRecieveMessageChecksumInvalid(t *testing.T) { - req, _ := svc.ReceiveMessageRequest(&sqs.ReceiveMessageInput{}) - req.Handlers.Send.PushBack(func(r *request.Request) { - md5 := "098f6bcd4621d373cade4e832627b4f6" - body := ioutil.NopCloser(bytes.NewReader([]byte(""))) - r.HTTPResponse = &http.Response{StatusCode: 200, Body: body} - r.Data = &sqs.ReceiveMessageOutput{ - Messages: []*sqs.Message{ - {Body: aws.String("test"), MD5OfBody: &md5}, - {Body: aws.String("test"), MD5OfBody: aws.String("000"), MessageId: aws.String("123")}, - {Body: aws.String("test"), MD5OfBody: aws.String("000"), MessageId: aws.String("456")}, - {Body: aws.String("test"), MD5OfBody: &md5}, - }, - } - }) - err := req.Send() - assert.Error(t, err) - - assert.Equal(t, "InvalidChecksum", err.(awserr.Error).Code()) - assert.Contains(t, err.(awserr.Error).Message(), "invalid messages: 123, 456") -} - -func TestSendMessageBatchChecksum(t *testing.T) { - req, _ := svc.SendMessageBatchRequest(&sqs.SendMessageBatchInput{ - Entries: []*sqs.SendMessageBatchRequestEntry{ - {Id: aws.String("1"), MessageBody: aws.String("test")}, - {Id: aws.String("2"), MessageBody: aws.String("test")}, - {Id: aws.String("3"), MessageBody: aws.String("test")}, - {Id: aws.String("4"), MessageBody: aws.String("test")}, - }, - }) - req.Handlers.Send.PushBack(func(r *request.Request) { - md5 := "098f6bcd4621d373cade4e832627b4f6" - body := ioutil.NopCloser(bytes.NewReader([]byte(""))) - r.HTTPResponse = &http.Response{StatusCode: 200, Body: body} - r.Data = &sqs.SendMessageBatchOutput{ - Successful: []*sqs.SendMessageBatchResultEntry{ - {MD5OfMessageBody: &md5, MessageId: aws.String("123"), Id: aws.String("1")}, - {MD5OfMessageBody: &md5, MessageId: aws.String("456"), Id: aws.String("2")}, - {MD5OfMessageBody: &md5, MessageId: aws.String("789"), Id: aws.String("3")}, - {MD5OfMessageBody: &md5, MessageId: aws.String("012"), Id: aws.String("4")}, - }, - } - }) - err := req.Send() - assert.NoError(t, err) -} - -func TestSendMessageBatchChecksumInvalid(t *testing.T) { - req, _ := svc.SendMessageBatchRequest(&sqs.SendMessageBatchInput{ - Entries: []*sqs.SendMessageBatchRequestEntry{ - {Id: aws.String("1"), MessageBody: aws.String("test")}, - {Id: aws.String("2"), MessageBody: aws.String("test")}, - {Id: aws.String("3"), MessageBody: aws.String("test")}, - {Id: aws.String("4"), MessageBody: aws.String("test")}, - }, - }) - req.Handlers.Send.PushBack(func(r *request.Request) { - md5 := "098f6bcd4621d373cade4e832627b4f6" - body := ioutil.NopCloser(bytes.NewReader([]byte(""))) - r.HTTPResponse = &http.Response{StatusCode: 200, Body: body} - r.Data = &sqs.SendMessageBatchOutput{ - Successful: []*sqs.SendMessageBatchResultEntry{ - {MD5OfMessageBody: &md5, MessageId: aws.String("123"), Id: aws.String("1")}, - {MD5OfMessageBody: aws.String("000"), MessageId: aws.String("456"), Id: aws.String("2")}, - {MD5OfMessageBody: aws.String("000"), MessageId: aws.String("789"), Id: aws.String("3")}, - {MD5OfMessageBody: &md5, MessageId: aws.String("012"), Id: aws.String("4")}, - }, - } - }) - err := req.Send() - assert.Error(t, err) - - assert.Equal(t, "InvalidChecksum", err.(awserr.Error).Code()) - assert.Contains(t, err.(awserr.Error).Message(), "invalid messages: 456, 789") -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sqs/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/sqs/examples_test.go deleted file mode 100644 index 2b86267738..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sqs/examples_test.go +++ /dev/null @@ -1,433 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package sqs_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/sqs" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleSQS_AddPermission() { - svc := sqs.New(session.New()) - - params := &sqs.AddPermissionInput{ - AWSAccountIds: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - Actions: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - Label: aws.String("String"), // Required - QueueUrl: aws.String("String"), // Required - } - resp, err := svc.AddPermission(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSQS_ChangeMessageVisibility() { - svc := sqs.New(session.New()) - - params := &sqs.ChangeMessageVisibilityInput{ - QueueUrl: aws.String("String"), // Required - ReceiptHandle: aws.String("String"), // Required - VisibilityTimeout: aws.Int64(1), // Required - } - resp, err := svc.ChangeMessageVisibility(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSQS_ChangeMessageVisibilityBatch() { - svc := sqs.New(session.New()) - - params := &sqs.ChangeMessageVisibilityBatchInput{ - Entries: []*sqs.ChangeMessageVisibilityBatchRequestEntry{ // Required - { // Required - Id: aws.String("String"), // Required - ReceiptHandle: aws.String("String"), // Required - VisibilityTimeout: aws.Int64(1), - }, - // More values... - }, - QueueUrl: aws.String("String"), // Required - } - resp, err := svc.ChangeMessageVisibilityBatch(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSQS_CreateQueue() { - svc := sqs.New(session.New()) - - params := &sqs.CreateQueueInput{ - QueueName: aws.String("String"), // Required - Attributes: map[string]*string{ - "Key": aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.CreateQueue(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSQS_DeleteMessage() { - svc := sqs.New(session.New()) - - params := &sqs.DeleteMessageInput{ - QueueUrl: aws.String("String"), // Required - ReceiptHandle: aws.String("String"), // Required - } - resp, err := svc.DeleteMessage(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSQS_DeleteMessageBatch() { - svc := sqs.New(session.New()) - - params := &sqs.DeleteMessageBatchInput{ - Entries: []*sqs.DeleteMessageBatchRequestEntry{ // Required - { // Required - Id: aws.String("String"), // Required - ReceiptHandle: aws.String("String"), // Required - }, - // More values... - }, - QueueUrl: aws.String("String"), // Required - } - resp, err := svc.DeleteMessageBatch(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSQS_DeleteQueue() { - svc := sqs.New(session.New()) - - params := &sqs.DeleteQueueInput{ - QueueUrl: aws.String("String"), // Required - } - resp, err := svc.DeleteQueue(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSQS_GetQueueAttributes() { - svc := sqs.New(session.New()) - - params := &sqs.GetQueueAttributesInput{ - QueueUrl: aws.String("String"), // Required - AttributeNames: []*string{ - aws.String("QueueAttributeName"), // Required - // More values... - }, - } - resp, err := svc.GetQueueAttributes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSQS_GetQueueUrl() { - svc := sqs.New(session.New()) - - params := &sqs.GetQueueUrlInput{ - QueueName: aws.String("String"), // Required - QueueOwnerAWSAccountId: aws.String("String"), - } - resp, err := svc.GetQueueUrl(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSQS_ListDeadLetterSourceQueues() { - svc := sqs.New(session.New()) - - params := &sqs.ListDeadLetterSourceQueuesInput{ - QueueUrl: aws.String("String"), // Required - } - resp, err := svc.ListDeadLetterSourceQueues(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSQS_ListQueues() { - svc := sqs.New(session.New()) - - params := &sqs.ListQueuesInput{ - QueueNamePrefix: aws.String("String"), - } - resp, err := svc.ListQueues(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSQS_PurgeQueue() { - svc := sqs.New(session.New()) - - params := &sqs.PurgeQueueInput{ - QueueUrl: aws.String("String"), // Required - } - resp, err := svc.PurgeQueue(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSQS_ReceiveMessage() { - svc := sqs.New(session.New()) - - params := &sqs.ReceiveMessageInput{ - QueueUrl: aws.String("String"), // Required - AttributeNames: []*string{ - aws.String("QueueAttributeName"), // Required - // More values... - }, - MaxNumberOfMessages: aws.Int64(1), - MessageAttributeNames: []*string{ - aws.String("MessageAttributeName"), // Required - // More values... - }, - VisibilityTimeout: aws.Int64(1), - WaitTimeSeconds: aws.Int64(1), - } - resp, err := svc.ReceiveMessage(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSQS_RemovePermission() { - svc := sqs.New(session.New()) - - params := &sqs.RemovePermissionInput{ - Label: aws.String("String"), // Required - QueueUrl: aws.String("String"), // Required - } - resp, err := svc.RemovePermission(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSQS_SendMessage() { - svc := sqs.New(session.New()) - - params := &sqs.SendMessageInput{ - MessageBody: aws.String("String"), // Required - QueueUrl: aws.String("String"), // Required - DelaySeconds: aws.Int64(1), - MessageAttributes: map[string]*sqs.MessageAttributeValue{ - "Key": { // Required - DataType: aws.String("String"), // Required - BinaryListValues: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - BinaryValue: []byte("PAYLOAD"), - StringListValues: []*string{ - aws.String("String"), // Required - // More values... - }, - StringValue: aws.String("String"), - }, - // More values... - }, - } - resp, err := svc.SendMessage(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSQS_SendMessageBatch() { - svc := sqs.New(session.New()) - - params := &sqs.SendMessageBatchInput{ - Entries: []*sqs.SendMessageBatchRequestEntry{ // Required - { // Required - Id: aws.String("String"), // Required - MessageBody: aws.String("String"), // Required - DelaySeconds: aws.Int64(1), - MessageAttributes: map[string]*sqs.MessageAttributeValue{ - "Key": { // Required - DataType: aws.String("String"), // Required - BinaryListValues: [][]byte{ - []byte("PAYLOAD"), // Required - // More values... - }, - BinaryValue: []byte("PAYLOAD"), - StringListValues: []*string{ - aws.String("String"), // Required - // More values... - }, - StringValue: aws.String("String"), - }, - // More values... - }, - }, - // More values... - }, - QueueUrl: aws.String("String"), // Required - } - resp, err := svc.SendMessageBatch(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} - -func ExampleSQS_SetQueueAttributes() { - svc := sqs.New(session.New()) - - params := &sqs.SetQueueAttributesInput{ - Attributes: map[string]*string{ // Required - "Key": aws.String("String"), // Required - // More values... - }, - QueueUrl: aws.String("String"), // Required - } - resp, err := svc.SetQueueAttributes(params) - - if err != nil { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - return - } - - // Pretty-print the response data. - fmt.Println(resp) -} diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/akrennmair/gopcap/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/akrennmair/gopcap/LICENSE new file mode 100644 index 0000000000..385fac9f26 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/akrennmair/gopcap/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009-2011 Andreas Krennmair. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Andreas Krennmair nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/bgentry/speakeasy/LICENSE_WINDOWS b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/bgentry/speakeasy/LICENSE_WINDOWS new file mode 100644 index 0000000000..ff177f6124 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/bgentry/speakeasy/LICENSE_WINDOWS @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [2013] [the CloudFoundry Authors] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/boltdb/bolt/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/boltdb/bolt/LICENSE new file mode 100644 index 0000000000..004e77fe5d --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/boltdb/bolt/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 Ben Johnson + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/cheggaaa/pb/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/cheggaaa/pb/LICENSE new file mode 100644 index 0000000000..13ef3fe53a --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/cheggaaa/pb/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2012, Sergey Cherepanov +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +* Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/codegangsta/cli/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/codegangsta/cli/LICENSE new file mode 100644 index 0000000000..5515ccfb71 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/codegangsta/cli/LICENSE @@ -0,0 +1,21 @@ +Copyright (C) 2013 Jeremy Saenz +All Rights Reserved. + +MIT LICENSE + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/coreos/gexpect/LICENCE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/coreos/gexpect/LICENCE new file mode 100644 index 0000000000..50adb0f19c --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/coreos/gexpect/LICENCE @@ -0,0 +1,7 @@ +Copyright (C) 2014 Thomas Rooney + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/cpuguy83/go-md2man/LICENSE.md b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/cpuguy83/go-md2man/LICENSE.md new file mode 100644 index 0000000000..1cade6cef6 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/cpuguy83/go-md2man/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Brian Goff + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/LICENSE new file mode 100644 index 0000000000..335e38e19b --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/LICENSE @@ -0,0 +1,36 @@ +Extensions for Protocol Buffers to create more go like structures. + +Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved. +http://github.com/gogo/protobuf/gogoproto + +Go support for Protocol Buffers - Google's data interchange format + +Copyright 2010 The Go Authors. All rights reserved. +https://github.com/golang/protobuf + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/golang/glog/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/golang/glog/LICENSE new file mode 100644 index 0000000000..37ec93a14f --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/golang/glog/LICENSE @@ -0,0 +1,191 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, "control" means (i) the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +"Object" form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +"submitted" means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of +this License; and +You must cause any modified files to carry prominent notices stating that You +changed the files; and +You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +If the Work includes a "NOTICE" text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets "[]" replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same "printed page" as the copyright notice for easier identification within +third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/golang/protobuf/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/golang/protobuf/LICENSE new file mode 100644 index 0000000000..1b1b1921ef --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/golang/protobuf/LICENSE @@ -0,0 +1,31 @@ +Go support for Protocol Buffers - Google's data interchange format + +Copyright 2010 The Go Authors. All rights reserved. +https://github.com/golang/protobuf + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/google/btree/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/google/btree/LICENSE new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/google/btree/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/vmware/govmomi/object/datastore_test.go b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/LICENSE similarity index 69% rename from vendor/github.com/vmware/govmomi/object/datastore_test.go rename to vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/LICENSE index 5b4f790fff..5f0d1fb6a7 100644 --- a/vendor/github.com/vmware/govmomi/object/datastore_test.go +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/LICENSE @@ -1,20 +1,13 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. +Copyright 2014 Alan Shreve Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -*/ - -package object - -// Datastore should implement the Reference interface. -var _ Reference = Datastore{} diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/jonboulle/clockwork/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/jonboulle/clockwork/LICENSE new file mode 100644 index 0000000000..5c304d1a4a --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/jonboulle/clockwork/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/kballard/go-shellquote/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/kballard/go-shellquote/LICENSE new file mode 100644 index 0000000000..a6d77312e1 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/kballard/go-shellquote/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2014 Kevin Ballard + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/kr/pty/License b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/kr/pty/License new file mode 100644 index 0000000000..6b7558b6b4 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/kr/pty/License @@ -0,0 +1,23 @@ +Copyright (c) 2011 Keith Rarick + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/olekukonko/ts/LICENCE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/olekukonko/ts/LICENCE new file mode 100644 index 0000000000..1fd8484253 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/olekukonko/ts/LICENCE @@ -0,0 +1,19 @@ +Copyright (C) 2014 by Oleku Konko + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/prometheus/procfs/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/prometheus/procfs/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/prometheus/procfs/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/prometheus/procfs/NOTICE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/prometheus/procfs/NOTICE new file mode 100644 index 0000000000..53c5e9aa11 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/prometheus/procfs/NOTICE @@ -0,0 +1,7 @@ +procfs provides functions to retrieve system, kernel and process +metrics from the pseudo-filesystem proc. + +Copyright 2014-2015 The Prometheus Authors + +This product includes software developed at +SoundCloud Ltd. (http://soundcloud.com/). diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/russross/blackfriday/LICENSE.txt b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/russross/blackfriday/LICENSE.txt new file mode 100644 index 0000000000..2885af3602 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/russross/blackfriday/LICENSE.txt @@ -0,0 +1,29 @@ +Blackfriday is distributed under the Simplified BSD License: + +> Copyright © 2011 Russ Ross +> All rights reserved. +> +> Redistribution and use in source and binary forms, with or without +> modification, are permitted provided that the following conditions +> are met: +> +> 1. Redistributions of source code must retain the above copyright +> notice, this list of conditions and the following disclaimer. +> +> 2. Redistributions in binary form must reproduce the above +> copyright notice, this list of conditions and the following +> disclaimer in the documentation and/or other materials provided with +> the distribution. +> +> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +> "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +> LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +> FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +> COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +> INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +> BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +> LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +> LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +> ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +> POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/shurcooL/sanitized_anchor_name/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/shurcooL/sanitized_anchor_name/LICENSE new file mode 100644 index 0000000000..5f4e3ed57a --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/shurcooL/sanitized_anchor_name/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Dmitri Shuralyov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/cobra/LICENSE.txt b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/cobra/LICENSE.txt new file mode 100644 index 0000000000..298f0e2665 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/cobra/LICENSE.txt @@ -0,0 +1,174 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/cobra/cobra/cmd/licenses.go b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/cobra/cobra/cmd/licenses.go new file mode 100644 index 0000000000..5ad9c96ef1 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/cobra/cobra/cmd/licenses.go @@ -0,0 +1,1133 @@ +// Copyright © 2015 Steve Francia . +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Parts inspired by https://github.com/ryanuber/go-license + +package cmd + +import "strings" + +//Licenses contains all possible licenses a user can chose from +var Licenses map[string]License + +//License represents a software license agreement, containing the Name of +// the license, its possible matches (on the command line as given to cobra) +// the header to be used with each file on the file's creating, and the text +// of the license +type License struct { + Name string // The type of license in use + PossibleMatches []string // Similar names to guess + Text string // License text data + Header string // License header for source files +} + +// given a license name (in), try to match the license indicated +func matchLicense(in string) string { + for key, lic := range Licenses { + for _, match := range lic.PossibleMatches { + if strings.EqualFold(in, match) { + return key + } + } + } + return "" +} + +func init() { + Licenses = make(map[string]License) + + Licenses["apache"] = License{ + Name: "Apache 2.0", + PossibleMatches: []string{"apache", "apache20", "apache 2.0", "apache2.0", "apache-2.0"}, + Header: ` +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License.`, + Text: ` + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +`, + } + + Licenses["mit"] = License{ + Name: "Mit", + PossibleMatches: []string{"mit"}, + Header: ` +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.`, + Text: `The MIT License (MIT) + +{{ .copyright }} + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +`, + } + + Licenses["bsd"] = License{ + Name: "NewBSD", + PossibleMatches: []string{"bsd", "newbsd", "3 clause bsd"}, + Header: ` +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE.`, + Text: `{{ .copyright }} +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +`, + } + + Licenses["freebsd"] = License{ + Name: "Simplified BSD License", + PossibleMatches: []string{"freebsd", "simpbsd", "simple bsd", "2 clause bsd"}, + Header: ` +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE.`, + Text: `{{ .copyright }} +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +`, + } + + Licenses["gpl3"] = License{ + Name: "GNU General Public License 3.0", + PossibleMatches: []string{"gpl3", "gpl", "gnu gpl3", "gnu gpl"}, + Header: `{{ .copyright }} + + This file is part of {{ .appName }}. + + {{ .appName }} is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + {{ .appName }} is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with {{ .appName }}. If not, see . + `, + Text: ` GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type 'show c' for details. + +The hypothetical commands 'show w' and 'show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. +`, + } + + // Licenses["apache20"] = License{ + // Name: "Apache 2.0", + // PossibleMatches: []string{"apache", "apache20", ""}, + // Header: ` + // `, + // Text: ` + // `, + // } +} diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/pflag/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/pflag/LICENSE new file mode 100644 index 0000000000..63ed1cfea1 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/pflag/LICENSE @@ -0,0 +1,28 @@ +Copyright (c) 2012 Alex Ogier. All rights reserved. +Copyright (c) 2012 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/LICENSE new file mode 100644 index 0000000000..95a0f0541c --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2012-2015 Ugorji Nwoke. +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/cbor_test.go b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/cbor_test.go deleted file mode 100644 index 205dffa7d1..0000000000 --- a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/cbor_test.go +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a MIT license found in the LICENSE file. - -package codec - -import ( - "bufio" - "bytes" - "encoding/hex" - "math" - "os" - "regexp" - "strings" - "testing" -) - -func TestCborIndefiniteLength(t *testing.T) { - oldMapType := testCborH.MapType - defer func() { - testCborH.MapType = oldMapType - }() - testCborH.MapType = testMapStrIntfTyp - // var ( - // M1 map[string][]byte - // M2 map[uint64]bool - // L1 []interface{} - // S1 []string - // B1 []byte - // ) - var v, vv interface{} - // define it (v), encode it using indefinite lengths, decode it (vv), compare v to vv - v = map[string]interface{}{ - "one-byte-key": []byte{1, 2, 3, 4, 5, 6}, - "two-string-key": "two-value", - "three-list-key": []interface{}{true, false, uint64(1), int64(-1)}, - } - var buf bytes.Buffer - // buf.Reset() - e := NewEncoder(&buf, testCborH) - buf.WriteByte(cborBdIndefiniteMap) - //---- - buf.WriteByte(cborBdIndefiniteString) - e.MustEncode("one-") - e.MustEncode("byte-") - e.MustEncode("key") - buf.WriteByte(cborBdBreak) - - buf.WriteByte(cborBdIndefiniteBytes) - e.MustEncode([]byte{1, 2, 3}) - e.MustEncode([]byte{4, 5, 6}) - buf.WriteByte(cborBdBreak) - - //---- - buf.WriteByte(cborBdIndefiniteString) - e.MustEncode("two-") - e.MustEncode("string-") - e.MustEncode("key") - buf.WriteByte(cborBdBreak) - - buf.WriteByte(cborBdIndefiniteString) - e.MustEncode([]byte("two-")) // encode as bytes, to check robustness of code - e.MustEncode([]byte("value")) - buf.WriteByte(cborBdBreak) - - //---- - buf.WriteByte(cborBdIndefiniteString) - e.MustEncode("three-") - e.MustEncode("list-") - e.MustEncode("key") - buf.WriteByte(cborBdBreak) - - buf.WriteByte(cborBdIndefiniteArray) - e.MustEncode(true) - e.MustEncode(false) - e.MustEncode(uint64(1)) - e.MustEncode(int64(-1)) - buf.WriteByte(cborBdBreak) - - buf.WriteByte(cborBdBreak) // close map - - NewDecoderBytes(buf.Bytes(), testCborH).MustDecode(&vv) - if err := deepEqual(v, vv); err != nil { - logT(t, "-------- Before and After marshal do not match: Error: %v", err) - logT(t, " ....... GOLDEN: (%T) %#v", v, v) - logT(t, " ....... DECODED: (%T) %#v", vv, vv) - failT(t) - } -} - -type testCborGolden struct { - Base64 string `codec:"cbor"` - Hex string `codec:"hex"` - Roundtrip bool `codec:"roundtrip"` - Decoded interface{} `codec:"decoded"` - Diagnostic string `codec:"diagnostic"` - Skip bool `codec:"skip"` -} - -// Some tests are skipped because they include numbers outside the range of int64/uint64 -func doTestCborGoldens(t *testing.T) { - oldMapType := testCborH.MapType - defer func() { - testCborH.MapType = oldMapType - }() - testCborH.MapType = testMapStrIntfTyp - // decode test-cbor-goldens.json into a list of []*testCborGolden - // for each one, - // - decode hex into []byte bs - // - decode bs into interface{} v - // - compare both using deepequal - // - for any miss, record it - var gs []*testCborGolden - f, err := os.Open("test-cbor-goldens.json") - if err != nil { - logT(t, "error opening test-cbor-goldens.json: %v", err) - failT(t) - } - defer f.Close() - jh := new(JsonHandle) - jh.MapType = testMapStrIntfTyp - // d := NewDecoder(f, jh) - d := NewDecoder(bufio.NewReader(f), jh) - // err = d.Decode(&gs) - d.MustDecode(&gs) - if err != nil { - logT(t, "error json decoding test-cbor-goldens.json: %v", err) - failT(t) - } - - tagregex := regexp.MustCompile(`[\d]+\(.+?\)`) - hexregex := regexp.MustCompile(`h'([0-9a-fA-F]*)'`) - for i, g := range gs { - // fmt.Printf("%v, skip: %v, isTag: %v, %s\n", i, g.Skip, tagregex.MatchString(g.Diagnostic), g.Diagnostic) - // skip tags or simple or those with prefix, as we can't verify them. - if g.Skip || strings.HasPrefix(g.Diagnostic, "simple(") || tagregex.MatchString(g.Diagnostic) { - // fmt.Printf("%v: skipped\n", i) - logT(t, "[%v] skipping because skip=true OR unsupported simple value or Tag Value", i) - continue - } - // println("++++++++++++", i, "g.Diagnostic", g.Diagnostic) - if hexregex.MatchString(g.Diagnostic) { - // println(i, "g.Diagnostic matched hex") - if s2 := g.Diagnostic[2 : len(g.Diagnostic)-1]; s2 == "" { - g.Decoded = zeroByteSlice - } else if bs2, err2 := hex.DecodeString(s2); err2 == nil { - g.Decoded = bs2 - } - // fmt.Printf("%v: hex: %v\n", i, g.Decoded) - } - bs, err := hex.DecodeString(g.Hex) - if err != nil { - logT(t, "[%v] error hex decoding %s [%v]: %v", i, g.Hex, err) - failT(t) - } - var v interface{} - NewDecoderBytes(bs, testCborH).MustDecode(&v) - if _, ok := v.(RawExt); ok { - continue - } - // check the diagnostics to compare - switch g.Diagnostic { - case "Infinity": - b := math.IsInf(v.(float64), 1) - testCborError(t, i, math.Inf(1), v, nil, &b) - case "-Infinity": - b := math.IsInf(v.(float64), -1) - testCborError(t, i, math.Inf(-1), v, nil, &b) - case "NaN": - // println(i, "checking NaN") - b := math.IsNaN(v.(float64)) - testCborError(t, i, math.NaN(), v, nil, &b) - case "undefined": - b := v == nil - testCborError(t, i, nil, v, nil, &b) - default: - v0 := g.Decoded - // testCborCoerceJsonNumber(reflect.ValueOf(&v0)) - testCborError(t, i, v0, v, deepEqual(v0, v), nil) - } - } -} - -func testCborError(t *testing.T, i int, v0, v1 interface{}, err error, equal *bool) { - if err == nil && equal == nil { - // fmt.Printf("%v testCborError passed (err and equal nil)\n", i) - return - } - if err != nil { - logT(t, "[%v] deepEqual error: %v", i, err) - logT(t, " ....... GOLDEN: (%T) %#v", v0, v0) - logT(t, " ....... DECODED: (%T) %#v", v1, v1) - failT(t) - } - if equal != nil && !*equal { - logT(t, "[%v] values not equal", i) - logT(t, " ....... GOLDEN: (%T) %#v", v0, v0) - logT(t, " ....... DECODED: (%T) %#v", v1, v1) - failT(t) - } - // fmt.Printf("%v testCborError passed (checks passed)\n", i) -} - -func TestCborGoldens(t *testing.T) { - doTestCborGoldens(t) -} diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/codec_test.go b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/codec_test.go deleted file mode 100644 index ab14e2d019..0000000000 --- a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/codec_test.go +++ /dev/null @@ -1,1185 +0,0 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a MIT license found in the LICENSE file. - -package codec - -// Test works by using a slice of interfaces. -// It can test for encoding/decoding into/from a nil interface{} -// or passing the object to encode/decode into. -// -// There are basically 2 main tests here. -// First test internally encodes and decodes things and verifies that -// the artifact was as expected. -// Second test will use python msgpack to create a bunch of golden files, -// read those files, and compare them to what it should be. It then -// writes those files back out and compares the byte streams. -// -// Taken together, the tests are pretty extensive. -// -// The following manual tests must be done: -// - TestCodecUnderlyingType -// - Set fastpathEnabled to false and run tests (to ensure that regular reflection works). -// We don't want to use a variable there so that code is ellided. - -import ( - "bytes" - "encoding/gob" - "flag" - "fmt" - "io/ioutil" - "math" - "math/rand" - "net" - "net/rpc" - "os" - "os/exec" - "path/filepath" - "reflect" - "runtime" - "strconv" - "sync/atomic" - "testing" - "time" -) - -func init() { - testInitFlags() - testPreInitFns = append(testPreInitFns, testInit) -} - -type testVerifyArg int - -const ( - testVerifyMapTypeSame testVerifyArg = iota - testVerifyMapTypeStrIntf - testVerifyMapTypeIntfIntf - // testVerifySliceIntf - testVerifyForPython -) - -const testSkipRPCTests = false - -var ( - testVerbose bool - testInitDebug bool - testUseIoEncDec bool - testStructToArray bool - testCanonical bool - testUseReset bool - testWriteNoSymbols bool - testSkipIntf bool - testInternStr bool - testUseMust bool - - skipVerifyVal interface{} = &(struct{}{}) - - testMapStrIntfTyp = reflect.TypeOf(map[string]interface{}(nil)) - - // For Go Time, do not use a descriptive timezone. - // It's unnecessary, and makes it harder to do a reflect.DeepEqual. - // The Offset already tells what the offset should be, if not on UTC and unknown zone name. - timeLoc = time.FixedZone("", -8*60*60) // UTC-08:00 //time.UTC-8 - timeToCompare1 = time.Date(2012, 2, 2, 2, 2, 2, 2000, timeLoc).UTC() - timeToCompare2 = time.Date(1900, 2, 2, 2, 2, 2, 2000, timeLoc).UTC() - timeToCompare3 = time.Unix(0, 270).UTC() // use value that must be encoded as uint64 for nanoseconds (for cbor/msgpack comparison) - //timeToCompare4 = time.Time{}.UTC() // does not work well with simple cbor time encoding (overflow) - timeToCompare4 = time.Unix(-2013855848, 4223).UTC() - - table []interface{} // main items we encode - tableVerify []interface{} // we verify encoded things against this after decode - tableTestNilVerify []interface{} // for nil interface, use this to verify (rules are different) - tablePythonVerify []interface{} // for verifying for python, since Python sometimes - // will encode a float32 as float64, or large int as uint - testRpcInt = new(TestRpcInt) -) - -func testInitFlags() { - // delete(testDecOpts.ExtFuncs, timeTyp) - flag.BoolVar(&testVerbose, "tv", false, "Test Verbose") - flag.BoolVar(&testInitDebug, "tg", false, "Test Init Debug") - flag.BoolVar(&testUseIoEncDec, "ti", false, "Use IO Reader/Writer for Marshal/Unmarshal") - flag.BoolVar(&testStructToArray, "ts", false, "Set StructToArray option") - flag.BoolVar(&testWriteNoSymbols, "tn", false, "Set NoSymbols option") - flag.BoolVar(&testCanonical, "tc", false, "Set Canonical option") - flag.BoolVar(&testInternStr, "te", false, "Set InternStr option") - flag.BoolVar(&testSkipIntf, "tf", false, "Skip Interfaces") - flag.BoolVar(&testUseReset, "tr", false, "Use Reset") - flag.BoolVar(&testUseMust, "tm", true, "Use Must(En|De)code") -} - -func testByteBuf(in []byte) *bytes.Buffer { - return bytes.NewBuffer(in) -} - -type TestABC struct { - A, B, C string -} - -type TestRpcInt struct { - i int -} - -func (r *TestRpcInt) Update(n int, res *int) error { r.i = n; *res = r.i; return nil } -func (r *TestRpcInt) Square(ignore int, res *int) error { *res = r.i * r.i; return nil } -func (r *TestRpcInt) Mult(n int, res *int) error { *res = r.i * n; return nil } -func (r *TestRpcInt) EchoStruct(arg TestABC, res *string) error { - *res = fmt.Sprintf("%#v", arg) - return nil -} -func (r *TestRpcInt) Echo123(args []string, res *string) error { - *res = fmt.Sprintf("%#v", args) - return nil -} - -type testUnixNanoTimeExt struct { - // keep timestamp here, so that do not incur interface-conversion costs - ts int64 -} - -// func (x *testUnixNanoTimeExt) WriteExt(interface{}) []byte { panic("unsupported") } -// func (x *testUnixNanoTimeExt) ReadExt(interface{}, []byte) { panic("unsupported") } -func (x *testUnixNanoTimeExt) ConvertExt(v interface{}) interface{} { - switch v2 := v.(type) { - case time.Time: - x.ts = v2.UTC().UnixNano() - case *time.Time: - x.ts = v2.UTC().UnixNano() - default: - panic(fmt.Sprintf("unsupported format for time conversion: expecting time.Time; got %T", v)) - } - return &x.ts -} -func (x *testUnixNanoTimeExt) UpdateExt(dest interface{}, v interface{}) { - // fmt.Printf("testUnixNanoTimeExt.UpdateExt: v: %v\n", v) - tt := dest.(*time.Time) - switch v2 := v.(type) { - case int64: - *tt = time.Unix(0, v2).UTC() - case *int64: - *tt = time.Unix(0, *v2).UTC() - case uint64: - *tt = time.Unix(0, int64(v2)).UTC() - case *uint64: - *tt = time.Unix(0, int64(*v2)).UTC() - //case float64: - //case string: - default: - panic(fmt.Sprintf("unsupported format for time conversion: expecting int64/uint64; got %T", v)) - } - // fmt.Printf("testUnixNanoTimeExt.UpdateExt: v: %v, tt: %#v\n", v, tt) -} - -func testVerifyVal(v interface{}, arg testVerifyArg) (v2 interface{}) { - //for python msgpack, - // - all positive integers are unsigned 64-bit ints - // - all floats are float64 - switch iv := v.(type) { - case int8: - if iv >= 0 { - v2 = uint64(iv) - } else { - v2 = int64(iv) - } - case int16: - if iv >= 0 { - v2 = uint64(iv) - } else { - v2 = int64(iv) - } - case int32: - if iv >= 0 { - v2 = uint64(iv) - } else { - v2 = int64(iv) - } - case int64: - if iv >= 0 { - v2 = uint64(iv) - } else { - v2 = int64(iv) - } - case uint8: - v2 = uint64(iv) - case uint16: - v2 = uint64(iv) - case uint32: - v2 = uint64(iv) - case uint64: - v2 = uint64(iv) - case float32: - v2 = float64(iv) - case float64: - v2 = float64(iv) - case []interface{}: - m2 := make([]interface{}, len(iv)) - for j, vj := range iv { - m2[j] = testVerifyVal(vj, arg) - } - v2 = m2 - case map[string]bool: - switch arg { - case testVerifyMapTypeSame: - m2 := make(map[string]bool) - for kj, kv := range iv { - m2[kj] = kv - } - v2 = m2 - case testVerifyMapTypeStrIntf, testVerifyForPython: - m2 := make(map[string]interface{}) - for kj, kv := range iv { - m2[kj] = kv - } - v2 = m2 - case testVerifyMapTypeIntfIntf: - m2 := make(map[interface{}]interface{}) - for kj, kv := range iv { - m2[kj] = kv - } - v2 = m2 - } - case map[string]interface{}: - switch arg { - case testVerifyMapTypeSame: - m2 := make(map[string]interface{}) - for kj, kv := range iv { - m2[kj] = testVerifyVal(kv, arg) - } - v2 = m2 - case testVerifyMapTypeStrIntf, testVerifyForPython: - m2 := make(map[string]interface{}) - for kj, kv := range iv { - m2[kj] = testVerifyVal(kv, arg) - } - v2 = m2 - case testVerifyMapTypeIntfIntf: - m2 := make(map[interface{}]interface{}) - for kj, kv := range iv { - m2[kj] = testVerifyVal(kv, arg) - } - v2 = m2 - } - case map[interface{}]interface{}: - m2 := make(map[interface{}]interface{}) - for kj, kv := range iv { - m2[testVerifyVal(kj, arg)] = testVerifyVal(kv, arg) - } - v2 = m2 - case time.Time: - switch arg { - case testVerifyForPython: - if iv2 := iv.UnixNano(); iv2 >= 0 { - v2 = uint64(iv2) - } else { - v2 = int64(iv2) - } - default: - v2 = v - } - default: - v2 = v - } - return -} - -func testInit() { - gob.Register(new(TestStruc)) - if testInitDebug { - ts0 := newTestStruc(2, false, !testSkipIntf, false) - fmt.Printf("====> depth: %v, ts: %#v\n", 2, ts0) - } - - for _, v := range testHandles { - bh := v.getBasicHandle() - bh.InternString = testInternStr - bh.Canonical = testCanonical - bh.StructToArray = testStructToArray - // mostly doing this for binc - if testWriteNoSymbols { - bh.AsSymbols = AsSymbolNone - } else { - bh.AsSymbols = AsSymbolAll - } - } - - testMsgpackH.RawToString = true - - // testMsgpackH.AddExt(byteSliceTyp, 0, testMsgpackH.BinaryEncodeExt, testMsgpackH.BinaryDecodeExt) - // testMsgpackH.AddExt(timeTyp, 1, testMsgpackH.TimeEncodeExt, testMsgpackH.TimeDecodeExt) - timeEncExt := func(rv reflect.Value) (bs []byte, err error) { - defer panicToErr(&err) - bs = timeExt{}.WriteExt(rv.Interface()) - return - } - timeDecExt := func(rv reflect.Value, bs []byte) (err error) { - defer panicToErr(&err) - timeExt{}.ReadExt(rv.Interface(), bs) - return - } - - // add extensions for msgpack, simple for time.Time, so we can encode/decode same way. - // use different flavors of XXXExt calls, including deprecated ones. - testSimpleH.AddExt(timeTyp, 1, timeEncExt, timeDecExt) - testMsgpackH.SetBytesExt(timeTyp, 1, timeExt{}) - testCborH.SetInterfaceExt(timeTyp, 1, &testUnixNanoTimeExt{}) - testJsonH.SetInterfaceExt(timeTyp, 1, &testUnixNanoTimeExt{}) - - primitives := []interface{}{ - int8(-8), - int16(-1616), - int32(-32323232), - int64(-6464646464646464), - uint8(192), - uint16(1616), - uint32(32323232), - uint64(6464646464646464), - byte(192), - float32(-3232.0), - float64(-6464646464.0), - float32(3232.0), - float64(6464646464.0), - false, - true, - nil, - "someday", - "", - "bytestring", - timeToCompare1, - timeToCompare2, - timeToCompare3, - timeToCompare4, - } - mapsAndStrucs := []interface{}{ - map[string]bool{ - "true": true, - "false": false, - }, - map[string]interface{}{ - "true": "True", - "false": false, - "uint16(1616)": uint16(1616), - }, - //add a complex combo map in here. (map has list which has map) - //note that after the first thing, everything else should be generic. - map[string]interface{}{ - "list": []interface{}{ - int16(1616), - int32(32323232), - true, - float32(-3232.0), - map[string]interface{}{ - "TRUE": true, - "FALSE": false, - }, - []interface{}{true, false}, - }, - "int32": int32(32323232), - "bool": true, - "LONG STRING": "123456789012345678901234567890123456789012345678901234567890", - "SHORT STRING": "1234567890", - }, - map[interface{}]interface{}{ - true: "true", - uint8(138): false, - "false": uint8(200), - }, - newTestStruc(0, false, !testSkipIntf, false), - } - - table = []interface{}{} - table = append(table, primitives...) //0-19 are primitives - table = append(table, primitives) //20 is a list of primitives - table = append(table, mapsAndStrucs...) //21-24 are maps. 25 is a *struct - - tableVerify = make([]interface{}, len(table)) - tableTestNilVerify = make([]interface{}, len(table)) - tablePythonVerify = make([]interface{}, len(table)) - - lp := len(primitives) - av := tableVerify - for i, v := range table { - if i == lp+3 { - av[i] = skipVerifyVal - continue - } - //av[i] = testVerifyVal(v, testVerifyMapTypeSame) - switch v.(type) { - case []interface{}: - av[i] = testVerifyVal(v, testVerifyMapTypeSame) - case map[string]interface{}: - av[i] = testVerifyVal(v, testVerifyMapTypeSame) - case map[interface{}]interface{}: - av[i] = testVerifyVal(v, testVerifyMapTypeSame) - default: - av[i] = v - } - } - - av = tableTestNilVerify - for i, v := range table { - if i > lp+3 { - av[i] = skipVerifyVal - continue - } - av[i] = testVerifyVal(v, testVerifyMapTypeStrIntf) - } - - av = tablePythonVerify - for i, v := range table { - if i > lp+3 { - av[i] = skipVerifyVal - continue - } - av[i] = testVerifyVal(v, testVerifyForPython) - } - - tablePythonVerify = tablePythonVerify[:24] -} - -func testUnmarshal(v interface{}, data []byte, h Handle) (err error) { - return testCodecDecode(data, v, h) -} - -func testMarshal(v interface{}, h Handle) (bs []byte, err error) { - return testCodecEncode(v, nil, testByteBuf, h) -} - -func testMarshalErr(v interface{}, h Handle, t *testing.T, name string) (bs []byte, err error) { - if bs, err = testMarshal(v, h); err != nil { - logT(t, "Error encoding %s: %v, Err: %v", name, v, err) - t.FailNow() - } - return -} - -func testUnmarshalErr(v interface{}, data []byte, h Handle, t *testing.T, name string) (err error) { - if err = testUnmarshal(v, data, h); err != nil { - logT(t, "Error Decoding into %s: %v, Err: %v", name, v, err) - t.FailNow() - } - return -} - -// doTestCodecTableOne allows us test for different variations based on arguments passed. -func doTestCodecTableOne(t *testing.T, testNil bool, h Handle, - vs []interface{}, vsVerify []interface{}) { - //if testNil, then just test for when a pointer to a nil interface{} is passed. It should work. - //Current setup allows us test (at least manually) the nil interface or typed interface. - logT(t, "================ TestNil: %v ================\n", testNil) - for i, v0 := range vs { - logT(t, "..............................................") - logT(t, " Testing: #%d:, %T, %#v\n", i, v0, v0) - b0, err := testMarshalErr(v0, h, t, "v0") - if err != nil { - continue - } - if h.isBinary() { - logT(t, " Encoded bytes: len: %v, %v\n", len(b0), b0) - } else { - logT(t, " Encoded string: len: %v, %v\n", len(string(b0)), string(b0)) - // println("########### encoded string: " + string(b0)) - } - var v1 interface{} - - if testNil { - err = testUnmarshal(&v1, b0, h) - } else { - if v0 != nil { - v0rt := reflect.TypeOf(v0) // ptr - rv1 := reflect.New(v0rt) - err = testUnmarshal(rv1.Interface(), b0, h) - v1 = rv1.Elem().Interface() - // v1 = reflect.Indirect(reflect.ValueOf(v1)).Interface() - } - } - - logT(t, " v1 returned: %T, %#v", v1, v1) - // if v1 != nil { - // logT(t, " v1 returned: %T, %#v", v1, v1) - // //we always indirect, because ptr to typed value may be passed (if not testNil) - // v1 = reflect.Indirect(reflect.ValueOf(v1)).Interface() - // } - if err != nil { - logT(t, "-------- Error: %v. Partial return: %v", err, v1) - failT(t) - continue - } - v0check := vsVerify[i] - if v0check == skipVerifyVal { - logT(t, " Nil Check skipped: Decoded: %T, %#v\n", v1, v1) - continue - } - - if err = deepEqual(v0check, v1); err == nil { - logT(t, "++++++++ Before and After marshal matched\n") - } else { - // logT(t, "-------- Before and After marshal do not match: Error: %v"+ - // " ====> GOLDEN: (%T) %#v, DECODED: (%T) %#v\n", err, v0check, v0check, v1, v1) - logT(t, "-------- Before and After marshal do not match: Error: %v", err) - logT(t, " ....... GOLDEN: (%T) %#v", v0check, v0check) - logT(t, " ....... DECODED: (%T) %#v", v1, v1) - failT(t) - } - } -} - -func testCodecTableOne(t *testing.T, h Handle) { - testOnce.Do(testInitAll) - // func TestMsgpackAllExperimental(t *testing.T) { - // dopts := testDecOpts(nil, nil, false, true, true), - - idxTime, numPrim, numMap := 19, 23, 4 - //println("#################") - switch v := h.(type) { - case *MsgpackHandle: - var oldWriteExt, oldRawToString bool - oldWriteExt, v.WriteExt = v.WriteExt, true - oldRawToString, v.RawToString = v.RawToString, true - doTestCodecTableOne(t, false, h, table, tableVerify) - v.WriteExt, v.RawToString = oldWriteExt, oldRawToString - case *JsonHandle: - //skip []interface{} containing time.Time, as it encodes as a number, but cannot decode back to time.Time. - //As there is no real support for extension tags in json, this must be skipped. - doTestCodecTableOne(t, false, h, table[:numPrim], tableVerify[:numPrim]) - doTestCodecTableOne(t, false, h, table[numPrim+1:], tableVerify[numPrim+1:]) - default: - doTestCodecTableOne(t, false, h, table, tableVerify) - } - // func TestMsgpackAll(t *testing.T) { - - // //skip []interface{} containing time.Time - // doTestCodecTableOne(t, false, h, table[:numPrim], tableVerify[:numPrim]) - // doTestCodecTableOne(t, false, h, table[numPrim+1:], tableVerify[numPrim+1:]) - // func TestMsgpackNilStringMap(t *testing.T) { - var oldMapType reflect.Type - v := h.getBasicHandle() - - oldMapType, v.MapType = v.MapType, testMapStrIntfTyp - - //skip time.Time, []interface{} containing time.Time, last map, and newStruc - doTestCodecTableOne(t, true, h, table[:idxTime], tableTestNilVerify[:idxTime]) - doTestCodecTableOne(t, true, h, table[numPrim+1:numPrim+numMap], tableTestNilVerify[numPrim+1:numPrim+numMap]) - - v.MapType = oldMapType - - // func TestMsgpackNilIntf(t *testing.T) { - - //do newTestStruc and last element of map - doTestCodecTableOne(t, true, h, table[numPrim+numMap:], tableTestNilVerify[numPrim+numMap:]) - //TODO? What is this one? - //doTestCodecTableOne(t, true, h, table[17:18], tableTestNilVerify[17:18]) -} - -func testCodecMiscOne(t *testing.T, h Handle) { - testOnce.Do(testInitAll) - b, err := testMarshalErr(32, h, t, "32") - // Cannot do this nil one, because faster type assertion decoding will panic - // var i *int32 - // if err = testUnmarshal(b, i, nil); err == nil { - // logT(t, "------- Expecting error because we cannot unmarshal to int32 nil ptr") - // t.FailNow() - // } - var i2 int32 = 0 - err = testUnmarshalErr(&i2, b, h, t, "int32-ptr") - if i2 != int32(32) { - logT(t, "------- didn't unmarshal to 32: Received: %d", i2) - t.FailNow() - } - - // func TestMsgpackDecodePtr(t *testing.T) { - ts := newTestStruc(0, false, !testSkipIntf, false) - b, err = testMarshalErr(ts, h, t, "pointer-to-struct") - if len(b) < 40 { - logT(t, "------- Size must be > 40. Size: %d", len(b)) - t.FailNow() - } - if h.isBinary() { - logT(t, "------- b: %v", b) - } else { - logT(t, "------- b: %s", b) - } - ts2 := new(TestStruc) - err = testUnmarshalErr(ts2, b, h, t, "pointer-to-struct") - if ts2.I64 != math.MaxInt64*2/3 { - logT(t, "------- Unmarshal wrong. Expect I64 = 64. Got: %v", ts2.I64) - t.FailNow() - } - - // func TestMsgpackIntfDecode(t *testing.T) { - m := map[string]int{"A": 2, "B": 3} - p := []interface{}{m} - bs, err := testMarshalErr(p, h, t, "p") - - m2 := map[string]int{} - p2 := []interface{}{m2} - err = testUnmarshalErr(&p2, bs, h, t, "&p2") - - if m2["A"] != 2 || m2["B"] != 3 { - logT(t, "m2 not as expected: expecting: %v, got: %v", m, m2) - t.FailNow() - } - // log("m: %v, m2: %v, p: %v, p2: %v", m, m2, p, p2) - checkEqualT(t, p, p2, "p=p2") - checkEqualT(t, m, m2, "m=m2") - if err = deepEqual(p, p2); err == nil { - logT(t, "p and p2 match") - } else { - logT(t, "Not Equal: %v. p: %v, p2: %v", err, p, p2) - t.FailNow() - } - if err = deepEqual(m, m2); err == nil { - logT(t, "m and m2 match") - } else { - logT(t, "Not Equal: %v. m: %v, m2: %v", err, m, m2) - t.FailNow() - } - - // func TestMsgpackDecodeStructSubset(t *testing.T) { - // test that we can decode a subset of the stream - mm := map[string]interface{}{"A": 5, "B": 99, "C": 333} - bs, err = testMarshalErr(mm, h, t, "mm") - type ttt struct { - A uint8 - C int32 - } - var t2 ttt - testUnmarshalErr(&t2, bs, h, t, "t2") - t3 := ttt{5, 333} - checkEqualT(t, t2, t3, "t2=t3") - - // println(">>>>>") - // test simple arrays, non-addressable arrays, slices - type tarr struct { - A int64 - B [3]int64 - C []byte - D [3]byte - } - var tarr0 = tarr{1, [3]int64{2, 3, 4}, []byte{4, 5, 6}, [3]byte{7, 8, 9}} - // test both pointer and non-pointer (value) - for _, tarr1 := range []interface{}{tarr0, &tarr0} { - bs, err = testMarshalErr(tarr1, h, t, "tarr1") - if err != nil { - logT(t, "Error marshalling: %v", err) - t.FailNow() - } - if _, ok := h.(*JsonHandle); ok { - logT(t, "Marshal as: %s", bs) - } - var tarr2 tarr - testUnmarshalErr(&tarr2, bs, h, t, "tarr2") - checkEqualT(t, tarr0, tarr2, "tarr0=tarr2") - // fmt.Printf(">>>> err: %v. tarr1: %v, tarr2: %v\n", err, tarr0, tarr2) - } - - // test byte array, even if empty (msgpack only) - if h == testMsgpackH { - type ystruct struct { - Anarray []byte - } - var ya = ystruct{} - testUnmarshalErr(&ya, []byte{0x91, 0x90}, h, t, "ya") - } -} - -func testCodecEmbeddedPointer(t *testing.T, h Handle) { - testOnce.Do(testInitAll) - type Z int - type A struct { - AnInt int - } - type B struct { - *Z - *A - MoreInt int - } - var z Z = 4 - x1 := &B{&z, &A{5}, 6} - bs, err := testMarshalErr(x1, h, t, "x1") - // fmt.Printf("buf: len(%v): %x\n", buf.Len(), buf.Bytes()) - var x2 = new(B) - err = testUnmarshalErr(x2, bs, h, t, "x2") - err = checkEqualT(t, x1, x2, "x1=x2") - _ = err -} - -func testCodecUnderlyingType(t *testing.T, h Handle) { - testOnce.Do(testInitAll) - // Manual Test. - // Run by hand, with accompanying print statements in fast-path.go - // to ensure that the fast functions are called. - type T1 map[string]string - v := T1{"1": "1s", "2": "2s"} - var bs []byte - var err error - NewEncoderBytes(&bs, h).MustEncode(v) - if err != nil { - logT(t, "Error during encode: %v", err) - failT(t) - } - var v2 T1 - NewDecoderBytes(bs, h).MustDecode(&v2) - if err != nil { - logT(t, "Error during decode: %v", err) - failT(t) - } -} - -func testCodecChan(t *testing.T, h Handle) { - // - send a slice []*int64 (sl1) into an chan (ch1) with cap > len(s1) - // - encode ch1 as a stream array - // - decode a chan (ch2), with cap > len(s1) from the stream array - // - receive from ch2 into slice sl2 - // - compare sl1 and sl2 - // - do this for codecs: json, cbor (covers all types) - sl1 := make([]*int64, 4) - for i := range sl1 { - var j int64 = int64(i) - sl1[i] = &j - } - ch1 := make(chan *int64, 4) - for _, j := range sl1 { - ch1 <- j - } - var bs []byte - NewEncoderBytes(&bs, h).MustEncode(ch1) - // if !h.isBinary() { - // fmt.Printf("before: len(ch1): %v, bs: %s\n", len(ch1), bs) - // } - // var ch2 chan *int64 // this will block if json, etc. - ch2 := make(chan *int64, 8) - NewDecoderBytes(bs, h).MustDecode(&ch2) - // logT(t, "Len(ch2): %v", len(ch2)) - // fmt.Printf("after: len(ch2): %v, ch2: %v\n", len(ch2), ch2) - close(ch2) - var sl2 []*int64 - for j := range ch2 { - sl2 = append(sl2, j) - } - if err := deepEqual(sl1, sl2); err != nil { - logT(t, "Not Match: %v; len: %v, %v", err, len(sl1), len(sl2)) - failT(t) - } -} - -func testCodecRpcOne(t *testing.T, rr Rpc, h Handle, doRequest bool, exitSleepMs time.Duration, -) (port int) { - testOnce.Do(testInitAll) - if testSkipRPCTests { - return - } - // rpc needs EOF, which is sent via a panic, and so must be recovered. - if !recoverPanicToErr { - logT(t, "EXPECTED. set recoverPanicToErr=true, since rpc needs EOF") - t.FailNow() - } - srv := rpc.NewServer() - srv.Register(testRpcInt) - ln, err := net.Listen("tcp", "127.0.0.1:0") - // log("listener: %v", ln.Addr()) - checkErrT(t, err) - port = (ln.Addr().(*net.TCPAddr)).Port - // var opts *DecoderOptions - // opts := testDecOpts - // opts.MapType = mapStrIntfTyp - // opts.RawToString = false - serverExitChan := make(chan bool, 1) - var serverExitFlag uint64 = 0 - serverFn := func() { - for { - conn1, err1 := ln.Accept() - // if err1 != nil { - // //fmt.Printf("accept err1: %v\n", err1) - // continue - // } - if atomic.LoadUint64(&serverExitFlag) == 1 { - serverExitChan <- true - conn1.Close() - return // exit serverFn goroutine - } - if err1 == nil { - var sc rpc.ServerCodec = rr.ServerCodec(conn1, h) - srv.ServeCodec(sc) - } - } - } - - clientFn := func(cc rpc.ClientCodec) { - cl := rpc.NewClientWithCodec(cc) - defer cl.Close() - // defer func() { println("##### client closing"); cl.Close() }() - var up, sq, mult int - var rstr string - // log("Calling client") - checkErrT(t, cl.Call("TestRpcInt.Update", 5, &up)) - // log("Called TestRpcInt.Update") - checkEqualT(t, testRpcInt.i, 5, "testRpcInt.i=5") - checkEqualT(t, up, 5, "up=5") - checkErrT(t, cl.Call("TestRpcInt.Square", 1, &sq)) - checkEqualT(t, sq, 25, "sq=25") - checkErrT(t, cl.Call("TestRpcInt.Mult", 20, &mult)) - checkEqualT(t, mult, 100, "mult=100") - checkErrT(t, cl.Call("TestRpcInt.EchoStruct", TestABC{"Aa", "Bb", "Cc"}, &rstr)) - checkEqualT(t, rstr, fmt.Sprintf("%#v", TestABC{"Aa", "Bb", "Cc"}), "rstr=") - checkErrT(t, cl.Call("TestRpcInt.Echo123", []string{"A1", "B2", "C3"}, &rstr)) - checkEqualT(t, rstr, fmt.Sprintf("%#v", []string{"A1", "B2", "C3"}), "rstr=") - } - - connFn := func() (bs net.Conn) { - // log("calling f1") - bs, err2 := net.Dial(ln.Addr().Network(), ln.Addr().String()) - //fmt.Printf("f1. bs: %v, err2: %v\n", bs, err2) - checkErrT(t, err2) - return - } - - exitFn := func() { - atomic.StoreUint64(&serverExitFlag, 1) - bs := connFn() - <-serverExitChan - bs.Close() - // serverExitChan <- true - } - - go serverFn() - runtime.Gosched() - //time.Sleep(100 * time.Millisecond) - if exitSleepMs == 0 { - defer ln.Close() - defer exitFn() - } - if doRequest { - bs := connFn() - cc := rr.ClientCodec(bs, h) - clientFn(cc) - } - if exitSleepMs != 0 { - go func() { - defer ln.Close() - time.Sleep(exitSleepMs) - exitFn() - }() - } - return -} - -func doTestMapEncodeForCanonical(t *testing.T, name string, h Handle) { - v1 := map[string]interface{}{ - "a": 1, - "b": "hello", - "c": map[string]interface{}{ - "c/a": 1, - "c/b": "world", - "c/c": []int{1, 2, 3, 4}, - "c/d": map[string]interface{}{ - "c/d/a": "fdisajfoidsajfopdjsaopfjdsapofda", - "c/d/b": "fdsafjdposakfodpsakfopdsakfpodsakfpodksaopfkdsopafkdopsa", - "c/d/c": "poir02 ir30qif4p03qir0pogjfpoaerfgjp ofke[padfk[ewapf kdp[afep[aw", - "c/d/d": "fdsopafkd[sa f-32qor-=4qeof -afo-erfo r-eafo 4e- o r4-qwo ag", - "c/d/e": "kfep[a sfkr0[paf[a foe-[wq ewpfao-q ro3-q ro-4qof4-qor 3-e orfkropzjbvoisdb", - "c/d/f": "", - }, - "c/e": map[int]string{ - 1: "1", - 22: "22", - 333: "333", - 4444: "4444", - 55555: "55555", - }, - "c/f": map[string]int{ - "1": 1, - "22": 22, - "333": 333, - "4444": 4444, - "55555": 55555, - }, - }, - } - var v2 map[string]interface{} - var b1, b2 []byte - - // encode v1 into b1, decode b1 into v2, encode v2 into b2, compare b1 and b2 - - bh := h.getBasicHandle() - if !bh.Canonical { - bh.Canonical = true - defer func() { bh.Canonical = false }() - } - - e1 := NewEncoderBytes(&b1, h) - e1.MustEncode(v1) - d1 := NewDecoderBytes(b1, h) - d1.MustDecode(&v2) - e2 := NewEncoderBytes(&b2, h) - e2.MustEncode(v2) - if !bytes.Equal(b1, b2) { - logT(t, "Unequal bytes: %v VS %v", b1, b2) - t.FailNow() - } -} - -// Comprehensive testing that generates data encoded from python handle (cbor, msgpack), -// and validates that our code can read and write it out accordingly. -// We keep this unexported here, and put actual test in ext_dep_test.go. -// This way, it can be excluded by excluding file completely. -func doTestPythonGenStreams(t *testing.T, name string, h Handle) { - logT(t, "TestPythonGenStreams-%v", name) - tmpdir, err := ioutil.TempDir("", "golang-"+name+"-test") - if err != nil { - logT(t, "-------- Unable to create temp directory\n") - t.FailNow() - } - defer os.RemoveAll(tmpdir) - logT(t, "tmpdir: %v", tmpdir) - cmd := exec.Command("python", "test.py", "testdata", tmpdir) - //cmd.Stdin = strings.NewReader("some input") - //cmd.Stdout = &out - var cmdout []byte - if cmdout, err = cmd.CombinedOutput(); err != nil { - logT(t, "-------- Error running test.py testdata. Err: %v", err) - logT(t, " %v", string(cmdout)) - t.FailNow() - } - - bh := h.getBasicHandle() - - oldMapType := bh.MapType - for i, v := range tablePythonVerify { - // if v == uint64(0) && h == testMsgpackH { - // v = int64(0) - // } - bh.MapType = oldMapType - //load up the golden file based on number - //decode it - //compare to in-mem object - //encode it again - //compare to output stream - logT(t, "..............................................") - logT(t, " Testing: #%d: %T, %#v\n", i, v, v) - var bss []byte - bss, err = ioutil.ReadFile(filepath.Join(tmpdir, strconv.Itoa(i)+"."+name+".golden")) - if err != nil { - logT(t, "-------- Error reading golden file: %d. Err: %v", i, err) - failT(t) - continue - } - bh.MapType = testMapStrIntfTyp - - var v1 interface{} - if err = testUnmarshal(&v1, bss, h); err != nil { - logT(t, "-------- Error decoding stream: %d: Err: %v", i, err) - failT(t) - continue - } - if v == skipVerifyVal { - continue - } - //no need to indirect, because we pass a nil ptr, so we already have the value - //if v1 != nil { v1 = reflect.Indirect(reflect.ValueOf(v1)).Interface() } - if err = deepEqual(v, v1); err == nil { - logT(t, "++++++++ Objects match: %T, %v", v, v) - } else { - logT(t, "-------- Objects do not match: %v. Source: %T. Decoded: %T", err, v, v1) - logT(t, "-------- GOLDEN: %#v", v) - // logT(t, "-------- DECODED: %#v <====> %#v", v1, reflect.Indirect(reflect.ValueOf(v1)).Interface()) - logT(t, "-------- DECODED: %#v <====> %#v", v1, reflect.Indirect(reflect.ValueOf(v1)).Interface()) - failT(t) - } - bsb, err := testMarshal(v1, h) - if err != nil { - logT(t, "Error encoding to stream: %d: Err: %v", i, err) - failT(t) - continue - } - if err = deepEqual(bsb, bss); err == nil { - logT(t, "++++++++ Bytes match") - } else { - logT(t, "???????? Bytes do not match. %v.", err) - xs := "--------" - if reflect.ValueOf(v).Kind() == reflect.Map { - xs = " " - logT(t, "%s It's a map. Ok that they don't match (dependent on ordering).", xs) - } else { - logT(t, "%s It's not a map. They should match.", xs) - failT(t) - } - logT(t, "%s FROM_FILE: %4d] %v", xs, len(bss), bss) - logT(t, "%s ENCODED: %4d] %v", xs, len(bsb), bsb) - } - } - bh.MapType = oldMapType -} - -// To test MsgpackSpecRpc, we test 3 scenarios: -// - Go Client to Go RPC Service (contained within TestMsgpackRpcSpec) -// - Go client to Python RPC Service (contained within doTestMsgpackRpcSpecGoClientToPythonSvc) -// - Python Client to Go RPC Service (contained within doTestMsgpackRpcSpecPythonClientToGoSvc) -// -// This allows us test the different calling conventions -// - Go Service requires only one argument -// - Python Service allows multiple arguments - -func doTestMsgpackRpcSpecGoClientToPythonSvc(t *testing.T) { - if testSkipRPCTests { - return - } - // openPorts are between 6700 and 6800 - r := rand.New(rand.NewSource(time.Now().UnixNano())) - openPort := strconv.FormatInt(6700+r.Int63n(99), 10) - // openPort := "6792" - cmd := exec.Command("python", "test.py", "rpc-server", openPort, "4") - checkErrT(t, cmd.Start()) - bs, err2 := net.Dial("tcp", ":"+openPort) - for i := 0; i < 10 && err2 != nil; i++ { - time.Sleep(50 * time.Millisecond) // time for python rpc server to start - bs, err2 = net.Dial("tcp", ":"+openPort) - } - checkErrT(t, err2) - cc := MsgpackSpecRpc.ClientCodec(bs, testMsgpackH) - cl := rpc.NewClientWithCodec(cc) - defer cl.Close() - var rstr string - checkErrT(t, cl.Call("EchoStruct", TestABC{"Aa", "Bb", "Cc"}, &rstr)) - //checkEqualT(t, rstr, "{'A': 'Aa', 'B': 'Bb', 'C': 'Cc'}") - var mArgs MsgpackSpecRpcMultiArgs = []interface{}{"A1", "B2", "C3"} - checkErrT(t, cl.Call("Echo123", mArgs, &rstr)) - checkEqualT(t, rstr, "1:A1 2:B2 3:C3", "rstr=") - cmd.Process.Kill() -} - -func doTestMsgpackRpcSpecPythonClientToGoSvc(t *testing.T) { - if testSkipRPCTests { - return - } - port := testCodecRpcOne(t, MsgpackSpecRpc, testMsgpackH, false, 1*time.Second) - //time.Sleep(1000 * time.Millisecond) - cmd := exec.Command("python", "test.py", "rpc-client-go-service", strconv.Itoa(port)) - var cmdout []byte - var err error - if cmdout, err = cmd.CombinedOutput(); err != nil { - logT(t, "-------- Error running test.py rpc-client-go-service. Err: %v", err) - logT(t, " %v", string(cmdout)) - t.FailNow() - } - checkEqualT(t, string(cmdout), - fmt.Sprintf("%#v\n%#v\n", []string{"A1", "B2", "C3"}, TestABC{"Aa", "Bb", "Cc"}), "cmdout=") -} - -func TestBincCodecsTable(t *testing.T) { - testCodecTableOne(t, testBincH) -} - -func TestBincCodecsMisc(t *testing.T) { - testCodecMiscOne(t, testBincH) -} - -func TestBincCodecsEmbeddedPointer(t *testing.T) { - testCodecEmbeddedPointer(t, testBincH) -} - -func TestSimpleCodecsTable(t *testing.T) { - testCodecTableOne(t, testSimpleH) -} - -func TestSimpleCodecsMisc(t *testing.T) { - testCodecMiscOne(t, testSimpleH) -} - -func TestSimpleCodecsEmbeddedPointer(t *testing.T) { - testCodecEmbeddedPointer(t, testSimpleH) -} - -func TestMsgpackCodecsTable(t *testing.T) { - testCodecTableOne(t, testMsgpackH) -} - -func TestMsgpackCodecsMisc(t *testing.T) { - testCodecMiscOne(t, testMsgpackH) -} - -func TestMsgpackCodecsEmbeddedPointer(t *testing.T) { - testCodecEmbeddedPointer(t, testMsgpackH) -} - -func TestCborCodecsTable(t *testing.T) { - testCodecTableOne(t, testCborH) -} - -func TestCborCodecsMisc(t *testing.T) { - testCodecMiscOne(t, testCborH) -} - -func TestCborCodecsEmbeddedPointer(t *testing.T) { - testCodecEmbeddedPointer(t, testCborH) -} - -func TestCborMapEncodeForCanonical(t *testing.T) { - doTestMapEncodeForCanonical(t, "cbor", testCborH) -} - -func TestJsonCodecsTable(t *testing.T) { - testCodecTableOne(t, testJsonH) -} - -func TestJsonCodecsMisc(t *testing.T) { - testCodecMiscOne(t, testJsonH) -} - -func TestJsonCodecsEmbeddedPointer(t *testing.T) { - testCodecEmbeddedPointer(t, testJsonH) -} - -func TestJsonCodecChan(t *testing.T) { - testCodecChan(t, testJsonH) -} - -func TestCborCodecChan(t *testing.T) { - testCodecChan(t, testCborH) -} - -// ----- RPC ----- - -func TestBincRpcGo(t *testing.T) { - testCodecRpcOne(t, GoRpc, testBincH, true, 0) -} - -func TestSimpleRpcGo(t *testing.T) { - testCodecRpcOne(t, GoRpc, testSimpleH, true, 0) -} - -func TestMsgpackRpcGo(t *testing.T) { - testCodecRpcOne(t, GoRpc, testMsgpackH, true, 0) -} - -func TestCborRpcGo(t *testing.T) { - testCodecRpcOne(t, GoRpc, testCborH, true, 0) -} - -func TestJsonRpcGo(t *testing.T) { - testCodecRpcOne(t, GoRpc, testJsonH, true, 0) -} - -func TestMsgpackRpcSpec(t *testing.T) { - testCodecRpcOne(t, MsgpackSpecRpc, testMsgpackH, true, 0) -} - -func TestBincUnderlyingType(t *testing.T) { - testCodecUnderlyingType(t, testBincH) -} - -// TODO: -// Add Tests for: -// - decoding empty list/map in stream into a nil slice/map -// - binary(M|Unm)arsher support for time.Time (e.g. cbor encoding) -// - text(M|Unm)arshaler support for time.Time (e.g. json encoding) -// - non fast-path scenarios e.g. map[string]uint16, []customStruct. -// Expand cbor to include indefinite length stuff for this non-fast-path types. -// This may not be necessary, since we have the manual tests (fastpathEnabled=false) to test/validate with. -// - CodecSelfer -// Ensure it is called when (en|de)coding interface{} or reflect.Value (2 different codepaths). -// - interfaces: textMarshaler, binaryMarshaler, codecSelfer -// - struct tags: -// on anonymous fields, _struct (all fields), etc -// - codecgen of struct containing channels. -// -// Cleanup tests: -// - The are brittle in their handling of validation and skipping diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/codecgen_test.go b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/codecgen_test.go deleted file mode 100644 index a73497e91f..0000000000 --- a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/codecgen_test.go +++ /dev/null @@ -1,24 +0,0 @@ -//+build x,codecgen - -package codec - -import ( - "fmt" - "testing" -) - -func _TestCodecgenJson1(t *testing.T) { - // This is just a simplistic test for codecgen. - // It is typically disabled. We only enable it for debugging purposes. - const callCodecgenDirect bool = true - v := newTestStruc(2, false, !testSkipIntf, false) - var bs []byte - e := NewEncoderBytes(&bs, testJsonH) - if callCodecgenDirect { - v.CodecEncodeSelf(e) - e.w.atEndOfEncode() - } else { - e.MustEncode(v) - } - fmt.Printf("%s\n", bs) -} diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_test.go b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_test.go deleted file mode 100644 index e1dea52f45..0000000000 --- a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_test.go +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a MIT license found in the LICENSE file. - -package codec - -// All non-std package dependencies related to testing live in this file, -// so porting to different environment is easy (just update functions). -// -// This file sets up the variables used, including testInitFns. -// Each file should add initialization that should be performed -// after flags are parsed. -// -// init is a multi-step process: -// - setup vars (handled by init functions in each file) -// - parse flags -// - setup derived vars (handled by pre-init registered functions - registered in init function) -// - post init (handled by post-init registered functions - registered in init function) -// This way, no one has to manage carefully control the initialization -// using file names, etc. -// -// Tests which require external dependencies need the -tag=x parameter. -// They should be run as: -// go test -tags=x -run=. -// Benchmarks should also take this parameter, to include the sereal, xdr, etc. -// To run against codecgen, etc, make sure you pass extra parameters. -// Example usage: -// go test "-tags=x codecgen unsafe" -bench=. -// -// To fully test everything: -// go test -tags=x -benchtime=100ms -tv -bg -bi -brw -bu -v -run=. -bench=. - -// Handling flags -// codec_test.go will define a set of global flags for testing, including: -// - Use Reset -// - Use IO reader/writer (vs direct bytes) -// - Set Canonical -// - Set InternStrings -// - Use Symbols -// -// This way, we can test them all by running same set of tests with a different -// set of flags. -// -// Following this, all the benchmarks will utilize flags set by codec_test.go -// and will not redefine these "global" flags. - -import ( - "bytes" - "errors" - "flag" - "fmt" - "reflect" - "sync" - "testing" -) - -type testHED struct { - H Handle - E *Encoder - D *Decoder -} - -var ( - testNoopH = NoopHandle(8) - testMsgpackH = &MsgpackHandle{} - testBincH = &BincHandle{} - testSimpleH = &SimpleHandle{} - testCborH = &CborHandle{} - testJsonH = &JsonHandle{} - - testHandles []Handle - testPreInitFns []func() - testPostInitFns []func() - - testOnce sync.Once - - testHEDs []testHED -) - -func init() { - testHEDs = make([]testHED, 0, 32) - testHandles = append(testHandles, - testNoopH, testMsgpackH, testBincH, testSimpleH, - testCborH, testJsonH) -} - -func testHEDGet(h Handle) *testHED { - for i := range testHEDs { - v := &testHEDs[i] - if v.H == h { - return v - } - } - testHEDs = append(testHEDs, testHED{h, NewEncoder(nil, h), NewDecoder(nil, h)}) - return &testHEDs[len(testHEDs)-1] -} - -func testInitAll() { - flag.Parse() - for _, f := range testPreInitFns { - f() - } - for _, f := range testPostInitFns { - f() - } -} - -func testCodecEncode(ts interface{}, bsIn []byte, - fn func([]byte) *bytes.Buffer, h Handle) (bs []byte, err error) { - // bs = make([]byte, 0, approxSize) - var e *Encoder - var buf *bytes.Buffer - if testUseReset { - e = testHEDGet(h).E - } else { - e = NewEncoder(nil, h) - } - if testUseIoEncDec { - buf = fn(bsIn) - e.Reset(buf) - } else { - bs = bsIn - e.ResetBytes(&bs) - } - if testUseMust { - e.MustEncode(ts) - } else { - err = e.Encode(ts) - } - if testUseIoEncDec { - bs = buf.Bytes() - } - return -} - -func testCodecDecode(bs []byte, ts interface{}, h Handle) (err error) { - var d *Decoder - var buf *bytes.Reader - if testUseReset { - d = testHEDGet(h).D - } else { - d = NewDecoder(nil, h) - } - if testUseIoEncDec { - buf = bytes.NewReader(bs) - d.Reset(buf) - } else { - d.ResetBytes(bs) - } - if testUseMust { - d.MustDecode(ts) - } else { - err = d.Decode(ts) - } - return -} - -// ----- functions below are used only by tests (not benchmarks) - -const ( - testLogToT = true - failNowOnFail = true -) - -func checkErrT(t *testing.T, err error) { - if err != nil { - logT(t, err.Error()) - failT(t) - } -} - -func checkEqualT(t *testing.T, v1 interface{}, v2 interface{}, desc string) (err error) { - if err = deepEqual(v1, v2); err != nil { - logT(t, "Not Equal: %s: %v. v1: %v, v2: %v", desc, err, v1, v2) - failT(t) - } - return -} - -func failT(t *testing.T) { - if failNowOnFail { - t.FailNow() - } else { - t.Fail() - } -} - -// --- these functions are used by both benchmarks and tests - -func deepEqual(v1, v2 interface{}) (err error) { - if !reflect.DeepEqual(v1, v2) { - err = errors.New("Not Match") - } - return -} - -func logT(x interface{}, format string, args ...interface{}) { - if t, ok := x.(*testing.T); ok && t != nil && testLogToT { - if testVerbose { - t.Logf(format, args...) - } - } else if b, ok := x.(*testing.B); ok && b != nil && testLogToT { - b.Logf(format, args...) - } else { - if len(format) == 0 || format[len(format)-1] != '\n' { - format = format + "\n" - } - fmt.Printf(format, args...) - } -} - -func approxDataSize(rv reflect.Value) (sum int) { - switch rk := rv.Kind(); rk { - case reflect.Invalid: - case reflect.Ptr, reflect.Interface: - sum += int(rv.Type().Size()) - sum += approxDataSize(rv.Elem()) - case reflect.Slice: - sum += int(rv.Type().Size()) - for j := 0; j < rv.Len(); j++ { - sum += approxDataSize(rv.Index(j)) - } - case reflect.String: - sum += int(rv.Type().Size()) - sum += rv.Len() - case reflect.Map: - sum += int(rv.Type().Size()) - for _, mk := range rv.MapKeys() { - sum += approxDataSize(mk) - sum += approxDataSize(rv.MapIndex(mk)) - } - case reflect.Struct: - //struct size already includes the full data size. - //sum += int(rv.Type().Size()) - for j := 0; j < rv.NumField(); j++ { - sum += approxDataSize(rv.Field(j)) - } - default: - //pure value types - sum += int(rv.Type().Size()) - } - return -} diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/py_test.go b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/py_test.go deleted file mode 100644 index bedd7b0dcf..0000000000 --- a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/py_test.go +++ /dev/null @@ -1,30 +0,0 @@ -//+build x - -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a MIT license found in the LICENSE file. - -package codec - -// These tests are used to verify msgpack and cbor implementations against their python libraries. -// If you have the library installed, you can enable the tests back by running: go test -tags=x . -// Look at test.py for how to setup your environment. - -import ( - "testing" -) - -func TestMsgpackPythonGenStreams(t *testing.T) { - doTestPythonGenStreams(t, "msgpack", testMsgpackH) -} - -func TestCborPythonGenStreams(t *testing.T) { - doTestPythonGenStreams(t, "cbor", testCborH) -} - -func TestMsgpackRpcSpecGoClientToPythonSvc(t *testing.T) { - doTestMsgpackRpcSpecGoClientToPythonSvc(t) -} - -func TestMsgpackRpcSpecPythonClientToGoSvc(t *testing.T) { - doTestMsgpackRpcSpecPythonClientToGoSvc(t) -} diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/values_test.go b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/values_test.go deleted file mode 100644 index 4ec28e131c..0000000000 --- a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/values_test.go +++ /dev/null @@ -1,203 +0,0 @@ -// // +build testing - -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a MIT license found in the LICENSE file. - -package codec - -// This file contains values used by tests and benchmarks. -// JSON/BSON do not like maps with keys that are not strings, -// so we only use maps with string keys here. - -import ( - "math" - "time" -) - -var testStrucTime = time.Date(2012, 2, 2, 2, 2, 2, 2000, time.UTC).UTC() - -type AnonInTestStruc struct { - AS string - AI64 int64 - AI16 int16 - AUi64 uint64 - ASslice []string - AI64slice []int64 - AF64slice []float64 - // AMI32U32 map[int32]uint32 - // AMU32F64 map[uint32]float64 // json/bson do not like it - AMSU16 map[string]uint16 -} - -type AnonInTestStrucIntf struct { - Islice []interface{} - Ms map[string]interface{} - Nintf interface{} //don't set this, so we can test for nil - T time.Time -} - -type TestStruc struct { - _struct struct{} `codec:",omitempty"` //set omitempty for every field - - S string - I64 int64 - I16 int16 - Ui64 uint64 - Ui8 uint8 - B bool - By uint8 // byte: msgp doesn't like byte - - Sslice []string - I64slice []int64 - I16slice []int16 - Ui64slice []uint64 - Ui8slice []uint8 - Bslice []bool - Byslice []byte - - Iptrslice []*int64 - - // TODO: test these separately, specifically for reflection and codecgen. - // Unfortunately, ffjson doesn't support these. Its compilation even fails. - // Ui64array [4]uint64 - // Ui64slicearray [][4]uint64 - - AnonInTestStruc - - //M map[interface{}]interface{} `json:"-",bson:"-"` - Msi64 map[string]int64 - - // make this a ptr, so that it could be set or not. - // for comparison (e.g. with msgp), give it a struct tag (so it is not inlined), - // make this one omitempty (so it is included if nil). - *AnonInTestStrucIntf `codec:",omitempty"` - - Nmap map[string]bool //don't set this, so we can test for nil - Nslice []byte //don't set this, so we can test for nil - Nint64 *int64 //don't set this, so we can test for nil - Mtsptr map[string]*TestStruc - Mts map[string]TestStruc - Its []*TestStruc - Nteststruc *TestStruc -} - -// small struct for testing that codecgen works for unexported types -type tLowerFirstLetter struct { - I int - u uint64 - S string - b []byte -} - -func newTestStruc(depth int, bench bool, useInterface, useStringKeyOnly bool) (ts *TestStruc) { - var i64a, i64b, i64c, i64d int64 = 64, 6464, 646464, 64646464 - - ts = &TestStruc{ - S: "some string", - I64: math.MaxInt64 * 2 / 3, // 64, - I16: 1616, - Ui64: uint64(int64(math.MaxInt64 * 2 / 3)), // 64, //don't use MaxUint64, as bson can't write it - Ui8: 160, - B: true, - By: 5, - - Sslice: []string{"one", "two", "three"}, - I64slice: []int64{1111, 2222, 3333}, - I16slice: []int16{44, 55, 66}, - Ui64slice: []uint64{12121212, 34343434, 56565656}, - Ui8slice: []uint8{210, 211, 212}, - Bslice: []bool{true, false, true, false}, - Byslice: []byte{13, 14, 15}, - - Msi64: map[string]int64{ - "one": 1, - "two": 2, - }, - AnonInTestStruc: AnonInTestStruc{ - // There's more leeway in altering this. - AS: "A-String", - AI64: -64646464, - AI16: 1616, - AUi64: 64646464, - // (U+1D11E)G-clef character may be represented in json as "\uD834\uDD1E". - // single reverse solidus character may be represented in json as "\u005C". - // include these in ASslice below. - ASslice: []string{"Aone", "Atwo", "Athree", - "Afour.reverse_solidus.\u005c", "Afive.Gclef.\U0001d11E"}, - AI64slice: []int64{1, -22, 333, -4444, 55555, -666666}, - AMSU16: map[string]uint16{"1": 1, "22": 2, "333": 3, "4444": 4}, - AF64slice: []float64{11.11e-11, 22.22E+22, 33.33E-33, 44.44e+44, 555.55E-6, 666.66E6}, - }, - } - if useInterface { - ts.AnonInTestStrucIntf = &AnonInTestStrucIntf{ - Islice: []interface{}{"true", true, "no", false, uint64(288), float64(0.4)}, - Ms: map[string]interface{}{ - "true": "true", - "int64(9)": false, - }, - T: testStrucTime, - } - } - - //For benchmarks, some things will not work. - if !bench { - //json and bson require string keys in maps - //ts.M = map[interface{}]interface{}{ - // true: "true", - // int8(9): false, - //} - //gob cannot encode nil in element in array (encodeArray: nil element) - ts.Iptrslice = []*int64{nil, &i64a, nil, &i64b, nil, &i64c, nil, &i64d, nil} - // ts.Iptrslice = nil - } - if !useStringKeyOnly { - // ts.AnonInTestStruc.AMU32F64 = map[uint32]float64{1: 1, 2: 2, 3: 3} // Json/Bson barf - } - if depth > 0 { - depth-- - if ts.Mtsptr == nil { - ts.Mtsptr = make(map[string]*TestStruc) - } - if ts.Mts == nil { - ts.Mts = make(map[string]TestStruc) - } - ts.Mtsptr["0"] = newTestStruc(depth, bench, useInterface, useStringKeyOnly) - ts.Mts["0"] = *(ts.Mtsptr["0"]) - ts.Its = append(ts.Its, ts.Mtsptr["0"]) - } - return -} - -// Some other types - -type Sstring string -type Bbool bool -type Sstructsmall struct { - A int -} - -type Sstructbig struct { - A int - B bool - c string - // Sval Sstruct - Ssmallptr *Sstructsmall - Ssmall *Sstructsmall - Sptr *Sstructbig -} - -type SstructbigMapBySlice struct { - _struct struct{} `codec:",toarray"` - A int - B bool - c string - // Sval Sstruct - Ssmallptr *Sstructsmall - Ssmall *Sstructsmall - Sptr *Sstructbig -} - -type Sinterface interface { - Noop() -} diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/xiang90/probing/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/xiang90/probing/LICENSE new file mode 100644 index 0000000000..cde8b8b05f --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/xiang90/probing/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Xiang Li + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/LICENSE new file mode 100644 index 0000000000..6a66aea5ea --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/PATENTS b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/PATENTS new file mode 100644 index 0000000000..733099041f --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context/context_test.go b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context/context_test.go deleted file mode 100644 index 05345fc5e5..0000000000 --- a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context/context_test.go +++ /dev/null @@ -1,575 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package context - -import ( - "fmt" - "math/rand" - "runtime" - "strings" - "sync" - "testing" - "time" -) - -// otherContext is a Context that's not one of the types defined in context.go. -// This lets us test code paths that differ based on the underlying type of the -// Context. -type otherContext struct { - Context -} - -func TestBackground(t *testing.T) { - c := Background() - if c == nil { - t.Fatalf("Background returned nil") - } - select { - case x := <-c.Done(): - t.Errorf("<-c.Done() == %v want nothing (it should block)", x) - default: - } - if got, want := fmt.Sprint(c), "context.Background"; got != want { - t.Errorf("Background().String() = %q want %q", got, want) - } -} - -func TestTODO(t *testing.T) { - c := TODO() - if c == nil { - t.Fatalf("TODO returned nil") - } - select { - case x := <-c.Done(): - t.Errorf("<-c.Done() == %v want nothing (it should block)", x) - default: - } - if got, want := fmt.Sprint(c), "context.TODO"; got != want { - t.Errorf("TODO().String() = %q want %q", got, want) - } -} - -func TestWithCancel(t *testing.T) { - c1, cancel := WithCancel(Background()) - - if got, want := fmt.Sprint(c1), "context.Background.WithCancel"; got != want { - t.Errorf("c1.String() = %q want %q", got, want) - } - - o := otherContext{c1} - c2, _ := WithCancel(o) - contexts := []Context{c1, o, c2} - - for i, c := range contexts { - if d := c.Done(); d == nil { - t.Errorf("c[%d].Done() == %v want non-nil", i, d) - } - if e := c.Err(); e != nil { - t.Errorf("c[%d].Err() == %v want nil", i, e) - } - - select { - case x := <-c.Done(): - t.Errorf("<-c.Done() == %v want nothing (it should block)", x) - default: - } - } - - cancel() - time.Sleep(100 * time.Millisecond) // let cancelation propagate - - for i, c := range contexts { - select { - case <-c.Done(): - default: - t.Errorf("<-c[%d].Done() blocked, but shouldn't have", i) - } - if e := c.Err(); e != Canceled { - t.Errorf("c[%d].Err() == %v want %v", i, e, Canceled) - } - } -} - -func TestParentFinishesChild(t *testing.T) { - // Context tree: - // parent -> cancelChild - // parent -> valueChild -> timerChild - parent, cancel := WithCancel(Background()) - cancelChild, stop := WithCancel(parent) - defer stop() - valueChild := WithValue(parent, "key", "value") - timerChild, stop := WithTimeout(valueChild, 10000*time.Hour) - defer stop() - - select { - case x := <-parent.Done(): - t.Errorf("<-parent.Done() == %v want nothing (it should block)", x) - case x := <-cancelChild.Done(): - t.Errorf("<-cancelChild.Done() == %v want nothing (it should block)", x) - case x := <-timerChild.Done(): - t.Errorf("<-timerChild.Done() == %v want nothing (it should block)", x) - case x := <-valueChild.Done(): - t.Errorf("<-valueChild.Done() == %v want nothing (it should block)", x) - default: - } - - // The parent's children should contain the two cancelable children. - pc := parent.(*cancelCtx) - cc := cancelChild.(*cancelCtx) - tc := timerChild.(*timerCtx) - pc.mu.Lock() - if len(pc.children) != 2 || !pc.children[cc] || !pc.children[tc] { - t.Errorf("bad linkage: pc.children = %v, want %v and %v", - pc.children, cc, tc) - } - pc.mu.Unlock() - - if p, ok := parentCancelCtx(cc.Context); !ok || p != pc { - t.Errorf("bad linkage: parentCancelCtx(cancelChild.Context) = %v, %v want %v, true", p, ok, pc) - } - if p, ok := parentCancelCtx(tc.Context); !ok || p != pc { - t.Errorf("bad linkage: parentCancelCtx(timerChild.Context) = %v, %v want %v, true", p, ok, pc) - } - - cancel() - - pc.mu.Lock() - if len(pc.children) != 0 { - t.Errorf("pc.cancel didn't clear pc.children = %v", pc.children) - } - pc.mu.Unlock() - - // parent and children should all be finished. - check := func(ctx Context, name string) { - select { - case <-ctx.Done(): - default: - t.Errorf("<-%s.Done() blocked, but shouldn't have", name) - } - if e := ctx.Err(); e != Canceled { - t.Errorf("%s.Err() == %v want %v", name, e, Canceled) - } - } - check(parent, "parent") - check(cancelChild, "cancelChild") - check(valueChild, "valueChild") - check(timerChild, "timerChild") - - // WithCancel should return a canceled context on a canceled parent. - precanceledChild := WithValue(parent, "key", "value") - select { - case <-precanceledChild.Done(): - default: - t.Errorf("<-precanceledChild.Done() blocked, but shouldn't have") - } - if e := precanceledChild.Err(); e != Canceled { - t.Errorf("precanceledChild.Err() == %v want %v", e, Canceled) - } -} - -func TestChildFinishesFirst(t *testing.T) { - cancelable, stop := WithCancel(Background()) - defer stop() - for _, parent := range []Context{Background(), cancelable} { - child, cancel := WithCancel(parent) - - select { - case x := <-parent.Done(): - t.Errorf("<-parent.Done() == %v want nothing (it should block)", x) - case x := <-child.Done(): - t.Errorf("<-child.Done() == %v want nothing (it should block)", x) - default: - } - - cc := child.(*cancelCtx) - pc, pcok := parent.(*cancelCtx) // pcok == false when parent == Background() - if p, ok := parentCancelCtx(cc.Context); ok != pcok || (ok && pc != p) { - t.Errorf("bad linkage: parentCancelCtx(cc.Context) = %v, %v want %v, %v", p, ok, pc, pcok) - } - - if pcok { - pc.mu.Lock() - if len(pc.children) != 1 || !pc.children[cc] { - t.Errorf("bad linkage: pc.children = %v, cc = %v", pc.children, cc) - } - pc.mu.Unlock() - } - - cancel() - - if pcok { - pc.mu.Lock() - if len(pc.children) != 0 { - t.Errorf("child's cancel didn't remove self from pc.children = %v", pc.children) - } - pc.mu.Unlock() - } - - // child should be finished. - select { - case <-child.Done(): - default: - t.Errorf("<-child.Done() blocked, but shouldn't have") - } - if e := child.Err(); e != Canceled { - t.Errorf("child.Err() == %v want %v", e, Canceled) - } - - // parent should not be finished. - select { - case x := <-parent.Done(): - t.Errorf("<-parent.Done() == %v want nothing (it should block)", x) - default: - } - if e := parent.Err(); e != nil { - t.Errorf("parent.Err() == %v want nil", e) - } - } -} - -func testDeadline(c Context, wait time.Duration, t *testing.T) { - select { - case <-time.After(wait): - t.Fatalf("context should have timed out") - case <-c.Done(): - } - if e := c.Err(); e != DeadlineExceeded { - t.Errorf("c.Err() == %v want %v", e, DeadlineExceeded) - } -} - -func TestDeadline(t *testing.T) { - c, _ := WithDeadline(Background(), time.Now().Add(100*time.Millisecond)) - if got, prefix := fmt.Sprint(c), "context.Background.WithDeadline("; !strings.HasPrefix(got, prefix) { - t.Errorf("c.String() = %q want prefix %q", got, prefix) - } - testDeadline(c, 200*time.Millisecond, t) - - c, _ = WithDeadline(Background(), time.Now().Add(100*time.Millisecond)) - o := otherContext{c} - testDeadline(o, 200*time.Millisecond, t) - - c, _ = WithDeadline(Background(), time.Now().Add(100*time.Millisecond)) - o = otherContext{c} - c, _ = WithDeadline(o, time.Now().Add(300*time.Millisecond)) - testDeadline(c, 200*time.Millisecond, t) -} - -func TestTimeout(t *testing.T) { - c, _ := WithTimeout(Background(), 100*time.Millisecond) - if got, prefix := fmt.Sprint(c), "context.Background.WithDeadline("; !strings.HasPrefix(got, prefix) { - t.Errorf("c.String() = %q want prefix %q", got, prefix) - } - testDeadline(c, 200*time.Millisecond, t) - - c, _ = WithTimeout(Background(), 100*time.Millisecond) - o := otherContext{c} - testDeadline(o, 200*time.Millisecond, t) - - c, _ = WithTimeout(Background(), 100*time.Millisecond) - o = otherContext{c} - c, _ = WithTimeout(o, 300*time.Millisecond) - testDeadline(c, 200*time.Millisecond, t) -} - -func TestCanceledTimeout(t *testing.T) { - c, _ := WithTimeout(Background(), 200*time.Millisecond) - o := otherContext{c} - c, cancel := WithTimeout(o, 400*time.Millisecond) - cancel() - time.Sleep(100 * time.Millisecond) // let cancelation propagate - select { - case <-c.Done(): - default: - t.Errorf("<-c.Done() blocked, but shouldn't have") - } - if e := c.Err(); e != Canceled { - t.Errorf("c.Err() == %v want %v", e, Canceled) - } -} - -type key1 int -type key2 int - -var k1 = key1(1) -var k2 = key2(1) // same int as k1, different type -var k3 = key2(3) // same type as k2, different int - -func TestValues(t *testing.T) { - check := func(c Context, nm, v1, v2, v3 string) { - if v, ok := c.Value(k1).(string); ok == (len(v1) == 0) || v != v1 { - t.Errorf(`%s.Value(k1).(string) = %q, %t want %q, %t`, nm, v, ok, v1, len(v1) != 0) - } - if v, ok := c.Value(k2).(string); ok == (len(v2) == 0) || v != v2 { - t.Errorf(`%s.Value(k2).(string) = %q, %t want %q, %t`, nm, v, ok, v2, len(v2) != 0) - } - if v, ok := c.Value(k3).(string); ok == (len(v3) == 0) || v != v3 { - t.Errorf(`%s.Value(k3).(string) = %q, %t want %q, %t`, nm, v, ok, v3, len(v3) != 0) - } - } - - c0 := Background() - check(c0, "c0", "", "", "") - - c1 := WithValue(Background(), k1, "c1k1") - check(c1, "c1", "c1k1", "", "") - - if got, want := fmt.Sprint(c1), `context.Background.WithValue(1, "c1k1")`; got != want { - t.Errorf("c.String() = %q want %q", got, want) - } - - c2 := WithValue(c1, k2, "c2k2") - check(c2, "c2", "c1k1", "c2k2", "") - - c3 := WithValue(c2, k3, "c3k3") - check(c3, "c2", "c1k1", "c2k2", "c3k3") - - c4 := WithValue(c3, k1, nil) - check(c4, "c4", "", "c2k2", "c3k3") - - o0 := otherContext{Background()} - check(o0, "o0", "", "", "") - - o1 := otherContext{WithValue(Background(), k1, "c1k1")} - check(o1, "o1", "c1k1", "", "") - - o2 := WithValue(o1, k2, "o2k2") - check(o2, "o2", "c1k1", "o2k2", "") - - o3 := otherContext{c4} - check(o3, "o3", "", "c2k2", "c3k3") - - o4 := WithValue(o3, k3, nil) - check(o4, "o4", "", "c2k2", "") -} - -func TestAllocs(t *testing.T) { - bg := Background() - for _, test := range []struct { - desc string - f func() - limit float64 - gccgoLimit float64 - }{ - { - desc: "Background()", - f: func() { Background() }, - limit: 0, - gccgoLimit: 0, - }, - { - desc: fmt.Sprintf("WithValue(bg, %v, nil)", k1), - f: func() { - c := WithValue(bg, k1, nil) - c.Value(k1) - }, - limit: 3, - gccgoLimit: 3, - }, - { - desc: "WithTimeout(bg, 15*time.Millisecond)", - f: func() { - c, _ := WithTimeout(bg, 15*time.Millisecond) - <-c.Done() - }, - limit: 8, - gccgoLimit: 15, - }, - { - desc: "WithCancel(bg)", - f: func() { - c, cancel := WithCancel(bg) - cancel() - <-c.Done() - }, - limit: 5, - gccgoLimit: 8, - }, - { - desc: "WithTimeout(bg, 100*time.Millisecond)", - f: func() { - c, cancel := WithTimeout(bg, 100*time.Millisecond) - cancel() - <-c.Done() - }, - limit: 8, - gccgoLimit: 25, - }, - } { - limit := test.limit - if runtime.Compiler == "gccgo" { - // gccgo does not yet do escape analysis. - // TOOD(iant): Remove this when gccgo does do escape analysis. - limit = test.gccgoLimit - } - if n := testing.AllocsPerRun(100, test.f); n > limit { - t.Errorf("%s allocs = %f want %d", test.desc, n, int(limit)) - } - } -} - -func TestSimultaneousCancels(t *testing.T) { - root, cancel := WithCancel(Background()) - m := map[Context]CancelFunc{root: cancel} - q := []Context{root} - // Create a tree of contexts. - for len(q) != 0 && len(m) < 100 { - parent := q[0] - q = q[1:] - for i := 0; i < 4; i++ { - ctx, cancel := WithCancel(parent) - m[ctx] = cancel - q = append(q, ctx) - } - } - // Start all the cancels in a random order. - var wg sync.WaitGroup - wg.Add(len(m)) - for _, cancel := range m { - go func(cancel CancelFunc) { - cancel() - wg.Done() - }(cancel) - } - // Wait on all the contexts in a random order. - for ctx := range m { - select { - case <-ctx.Done(): - case <-time.After(1 * time.Second): - buf := make([]byte, 10<<10) - n := runtime.Stack(buf, true) - t.Fatalf("timed out waiting for <-ctx.Done(); stacks:\n%s", buf[:n]) - } - } - // Wait for all the cancel functions to return. - done := make(chan struct{}) - go func() { - wg.Wait() - close(done) - }() - select { - case <-done: - case <-time.After(1 * time.Second): - buf := make([]byte, 10<<10) - n := runtime.Stack(buf, true) - t.Fatalf("timed out waiting for cancel functions; stacks:\n%s", buf[:n]) - } -} - -func TestInterlockedCancels(t *testing.T) { - parent, cancelParent := WithCancel(Background()) - child, cancelChild := WithCancel(parent) - go func() { - parent.Done() - cancelChild() - }() - cancelParent() - select { - case <-child.Done(): - case <-time.After(1 * time.Second): - buf := make([]byte, 10<<10) - n := runtime.Stack(buf, true) - t.Fatalf("timed out waiting for child.Done(); stacks:\n%s", buf[:n]) - } -} - -func TestLayersCancel(t *testing.T) { - testLayers(t, time.Now().UnixNano(), false) -} - -func TestLayersTimeout(t *testing.T) { - testLayers(t, time.Now().UnixNano(), true) -} - -func testLayers(t *testing.T, seed int64, testTimeout bool) { - rand.Seed(seed) - errorf := func(format string, a ...interface{}) { - t.Errorf(fmt.Sprintf("seed=%d: %s", seed, format), a...) - } - const ( - timeout = 200 * time.Millisecond - minLayers = 30 - ) - type value int - var ( - vals []*value - cancels []CancelFunc - numTimers int - ctx = Background() - ) - for i := 0; i < minLayers || numTimers == 0 || len(cancels) == 0 || len(vals) == 0; i++ { - switch rand.Intn(3) { - case 0: - v := new(value) - ctx = WithValue(ctx, v, v) - vals = append(vals, v) - case 1: - var cancel CancelFunc - ctx, cancel = WithCancel(ctx) - cancels = append(cancels, cancel) - case 2: - var cancel CancelFunc - ctx, cancel = WithTimeout(ctx, timeout) - cancels = append(cancels, cancel) - numTimers++ - } - } - checkValues := func(when string) { - for _, key := range vals { - if val := ctx.Value(key).(*value); key != val { - errorf("%s: ctx.Value(%p) = %p want %p", when, key, val, key) - } - } - } - select { - case <-ctx.Done(): - errorf("ctx should not be canceled yet") - default: - } - if s, prefix := fmt.Sprint(ctx), "context.Background."; !strings.HasPrefix(s, prefix) { - t.Errorf("ctx.String() = %q want prefix %q", s, prefix) - } - t.Log(ctx) - checkValues("before cancel") - if testTimeout { - select { - case <-ctx.Done(): - case <-time.After(timeout + 100*time.Millisecond): - errorf("ctx should have timed out") - } - checkValues("after timeout") - } else { - cancel := cancels[rand.Intn(len(cancels))] - cancel() - select { - case <-ctx.Done(): - default: - errorf("ctx should be canceled") - } - checkValues("after cancel") - } -} - -func TestCancelRemoves(t *testing.T) { - checkChildren := func(when string, ctx Context, want int) { - if got := len(ctx.(*cancelCtx).children); got != want { - t.Errorf("%s: context has %d children, want %d", when, got, want) - } - } - - ctx, _ := WithCancel(Background()) - checkChildren("after creation", ctx, 0) - _, cancel := WithCancel(ctx) - checkChildren("with WithCancel child ", ctx, 1) - cancel() - checkChildren("after cancelling WithCancel child", ctx, 0) - - ctx, _ = WithCancel(Background()) - checkChildren("after creation", ctx, 0) - _, cancel = WithTimeout(ctx, 60*time.Minute) - checkChildren("with WithTimeout child ", ctx, 1) - cancel() - checkChildren("after cancelling WithTimeout child", ctx, 0) -} diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context/ctxhttp/ctxhttp_test.go b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context/ctxhttp/ctxhttp_test.go deleted file mode 100644 index 8846f6b6e1..0000000000 --- a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context/ctxhttp/ctxhttp_test.go +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !plan9 - -package ctxhttp - -import ( - "io/ioutil" - "net" - "net/http" - "net/http/httptest" - "sync" - "testing" - "time" - - "github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context" -) - -const ( - requestDuration = 100 * time.Millisecond - requestBody = "ok" -) - -func TestNoTimeout(t *testing.T) { - ctx := context.Background() - resp, err := doRequest(ctx) - - if resp == nil || err != nil { - t.Fatalf("error received from client: %v %v", err, resp) - } -} - -func TestCancel(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - go func() { - time.Sleep(requestDuration / 2) - cancel() - }() - - resp, err := doRequest(ctx) - - if resp != nil || err == nil { - t.Fatalf("expected error, didn't get one. resp: %v", resp) - } - if err != ctx.Err() { - t.Fatalf("expected error from context but got: %v", err) - } -} - -func TestCancelAfterRequest(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - - resp, err := doRequest(ctx) - - // Cancel before reading the body. - // Request.Body should still be readable after the context is canceled. - cancel() - - b, err := ioutil.ReadAll(resp.Body) - if err != nil || string(b) != requestBody { - t.Fatalf("could not read body: %q %v", b, err) - } -} - -func TestCancelAfterHangingRequest(t *testing.T) { - handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - w.(http.Flusher).Flush() - <-w.(http.CloseNotifier).CloseNotify() - }) - - serv := httptest.NewServer(handler) - defer serv.Close() - - ctx, cancel := context.WithCancel(context.Background()) - resp, err := Get(ctx, nil, serv.URL) - if err != nil { - t.Fatalf("unexpected error in Get: %v", err) - } - - // Cancel befer reading the body. - // Reading Request.Body should fail, since the request was - // canceled before anything was written. - cancel() - - done := make(chan struct{}) - - go func() { - b, err := ioutil.ReadAll(resp.Body) - if len(b) != 0 || err == nil { - t.Errorf(`Read got (%q, %v); want ("", error)`, b, err) - } - close(done) - }() - - select { - case <-time.After(1 * time.Second): - t.Errorf("Test timed out") - case <-done: - } -} - -func doRequest(ctx context.Context) (*http.Response, error) { - var okHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - time.Sleep(requestDuration) - w.Write([]byte(requestBody)) - }) - - serv := httptest.NewServer(okHandler) - defer serv.Close() - - return Get(ctx, nil, serv.URL) -} - -// golang.org/issue/14065 -func TestClosesResponseBodyOnCancel(t *testing.T) { - defer func() { testHookContextDoneBeforeHeaders = nop }() - defer func() { testHookDoReturned = nop }() - defer func() { testHookDidBodyClose = nop }() - - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})) - defer ts.Close() - - ctx, cancel := context.WithCancel(context.Background()) - - // closed when Do enters select case <-ctx.Done() - enteredDonePath := make(chan struct{}) - - testHookContextDoneBeforeHeaders = func() { - close(enteredDonePath) - } - - testHookDoReturned = func() { - // We now have the result (the Flush'd headers) at least, - // so we can cancel the request. - cancel() - - // But block the client.Do goroutine from sending - // until Do enters into the <-ctx.Done() path, since - // otherwise if both channels are readable, select - // picks a random one. - <-enteredDonePath - } - - sawBodyClose := make(chan struct{}) - testHookDidBodyClose = func() { close(sawBodyClose) } - - tr := &http.Transport{} - defer tr.CloseIdleConnections() - c := &http.Client{Transport: tr} - req, _ := http.NewRequest("GET", ts.URL, nil) - _, doErr := Do(ctx, c, req) - - select { - case <-sawBodyClose: - case <-time.After(5 * time.Second): - t.Fatal("timeout waiting for body to close") - } - - if doErr != ctx.Err() { - t.Errorf("Do error = %v; want %v", doErr, ctx.Err()) - } -} - -type noteCloseConn struct { - net.Conn - onceClose sync.Once - closefn func() -} - -func (c *noteCloseConn) Close() error { - c.onceClose.Do(c.closefn) - return c.Conn.Close() -} diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context/withtimeout_test.go b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context/withtimeout_test.go deleted file mode 100644 index 04adc00f73..0000000000 --- a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context/withtimeout_test.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package context_test - -import ( - "fmt" - "time" - - "github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context" -) - -func ExampleWithTimeout() { - // Pass a context with a timeout to tell a blocking function that it - // should abandon its work after the timeout elapses. - ctx, _ := context.WithTimeout(context.Background(), 100*time.Millisecond) - select { - case <-time.After(200 * time.Millisecond): - fmt.Println("overslept") - case <-ctx.Done(): - fmt.Println(ctx.Err()) // prints "context deadline exceeded" - } - // Output: - // context deadline exceeded -} diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/google.golang.org/grpc/LICENSE b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/google.golang.org/grpc/LICENSE new file mode 100644 index 0000000000..f4988b4507 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/google.golang.org/grpc/LICENSE @@ -0,0 +1,28 @@ +Copyright 2014, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/coreos/etcd/Godeps/_workspace/src/google.golang.org/grpc/PATENTS b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/google.golang.org/grpc/PATENTS new file mode 100644 index 0000000000..619f9dbfe6 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Godeps/_workspace/src/google.golang.org/grpc/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the GRPC project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of GRPC, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of GRPC. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of GRPC or any code incorporated within this +implementation of GRPC constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of GRPC +shall terminate as of the date such litigation is filed. diff --git a/vendor/github.com/coreos/etcd/LICENSE b/vendor/github.com/coreos/etcd/LICENSE new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/vendor/github.com/coreos/etcd/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/coreos/etcd/NOTICE b/vendor/github.com/coreos/etcd/NOTICE new file mode 100644 index 0000000000..b39ddfa5cb --- /dev/null +++ b/vendor/github.com/coreos/etcd/NOTICE @@ -0,0 +1,5 @@ +CoreOS Project +Copyright 2014 CoreOS, Inc + +This product includes software developed at CoreOS, Inc. +(http://www.coreos.com/). diff --git a/vendor/github.com/coreos/etcd/client/client_test.go b/vendor/github.com/coreos/etcd/client/client_test.go deleted file mode 100644 index 74437d690e..0000000000 --- a/vendor/github.com/coreos/etcd/client/client_test.go +++ /dev/null @@ -1,896 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package client - -import ( - "errors" - "io" - "io/ioutil" - "math/rand" - "net/http" - "net/url" - "reflect" - "sort" - "strings" - "testing" - "time" - - "github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context" - "github.com/coreos/etcd/pkg/testutil" -) - -type actionAssertingHTTPClient struct { - t *testing.T - num int - act httpAction - - resp http.Response - body []byte - err error -} - -func (a *actionAssertingHTTPClient) Do(_ context.Context, act httpAction) (*http.Response, []byte, error) { - if !reflect.DeepEqual(a.act, act) { - a.t.Errorf("#%d: unexpected httpAction: want=%#v got=%#v", a.num, a.act, act) - } - - return &a.resp, a.body, a.err -} - -type staticHTTPClient struct { - resp http.Response - body []byte - err error -} - -func (s *staticHTTPClient) Do(context.Context, httpAction) (*http.Response, []byte, error) { - return &s.resp, s.body, s.err -} - -type staticHTTPAction struct { - request http.Request -} - -func (s *staticHTTPAction) HTTPRequest(url.URL) *http.Request { - return &s.request -} - -type staticHTTPResponse struct { - resp http.Response - body []byte - err error -} - -type multiStaticHTTPClient struct { - responses []staticHTTPResponse - cur int -} - -func (s *multiStaticHTTPClient) Do(context.Context, httpAction) (*http.Response, []byte, error) { - r := s.responses[s.cur] - s.cur++ - return &r.resp, r.body, r.err -} - -func newStaticHTTPClientFactory(responses []staticHTTPResponse) httpClientFactory { - var cur int - return func(url.URL) httpClient { - r := responses[cur] - cur++ - return &staticHTTPClient{resp: r.resp, body: r.body, err: r.err} - } -} - -type fakeTransport struct { - respchan chan *http.Response - errchan chan error - startCancel chan struct{} - finishCancel chan struct{} -} - -func newFakeTransport() *fakeTransport { - return &fakeTransport{ - respchan: make(chan *http.Response, 1), - errchan: make(chan error, 1), - startCancel: make(chan struct{}, 1), - finishCancel: make(chan struct{}, 1), - } -} - -func (t *fakeTransport) CancelRequest(*http.Request) { - t.startCancel <- struct{}{} -} - -type fakeAction struct{} - -func (a *fakeAction) HTTPRequest(url.URL) *http.Request { - return &http.Request{} -} - -func TestSimpleHTTPClientDoSuccess(t *testing.T) { - tr := newFakeTransport() - c := &simpleHTTPClient{transport: tr} - - tr.respchan <- &http.Response{ - StatusCode: http.StatusTeapot, - Body: ioutil.NopCloser(strings.NewReader("foo")), - } - - resp, body, err := c.Do(context.Background(), &fakeAction{}) - if err != nil { - t.Fatalf("incorrect error value: want=nil got=%v", err) - } - - wantCode := http.StatusTeapot - if wantCode != resp.StatusCode { - t.Fatalf("invalid response code: want=%d got=%d", wantCode, resp.StatusCode) - } - - wantBody := []byte("foo") - if !reflect.DeepEqual(wantBody, body) { - t.Fatalf("invalid response body: want=%q got=%q", wantBody, body) - } -} - -func TestSimpleHTTPClientDoError(t *testing.T) { - tr := newFakeTransport() - c := &simpleHTTPClient{transport: tr} - - tr.errchan <- errors.New("fixture") - - _, _, err := c.Do(context.Background(), &fakeAction{}) - if err == nil { - t.Fatalf("expected non-nil error, got nil") - } -} - -func TestSimpleHTTPClientDoCancelContext(t *testing.T) { - tr := newFakeTransport() - c := &simpleHTTPClient{transport: tr} - - tr.startCancel <- struct{}{} - tr.finishCancel <- struct{}{} - - _, _, err := c.Do(context.Background(), &fakeAction{}) - if err == nil { - t.Fatalf("expected non-nil error, got nil") - } -} - -type checkableReadCloser struct { - io.ReadCloser - closed bool -} - -func (c *checkableReadCloser) Close() error { - if !c.closed { - c.closed = true - return c.ReadCloser.Close() - } - return nil -} - -func TestSimpleHTTPClientDoCancelContextResponseBodyClosed(t *testing.T) { - tr := newFakeTransport() - c := &simpleHTTPClient{transport: tr} - - // create an already-cancelled context - ctx, cancel := context.WithCancel(context.Background()) - cancel() - - body := &checkableReadCloser{ReadCloser: ioutil.NopCloser(strings.NewReader("foo"))} - go func() { - // wait that simpleHTTPClient knows the context is already timed out, - // and calls CancelRequest - testutil.WaitSchedule() - - // response is returned before cancel effects - tr.respchan <- &http.Response{Body: body} - }() - - _, _, err := c.Do(ctx, &fakeAction{}) - if err == nil { - t.Fatalf("expected non-nil error, got nil") - } - - if !body.closed { - t.Fatalf("expected closed body") - } -} - -type blockingBody struct { - c chan struct{} -} - -func (bb *blockingBody) Read(p []byte) (n int, err error) { - <-bb.c - return 0, errors.New("closed") -} - -func (bb *blockingBody) Close() error { - close(bb.c) - return nil -} - -func TestSimpleHTTPClientDoCancelContextResponseBodyClosedWithBlockingBody(t *testing.T) { - tr := newFakeTransport() - c := &simpleHTTPClient{transport: tr} - - ctx, cancel := context.WithCancel(context.Background()) - body := &checkableReadCloser{ReadCloser: &blockingBody{c: make(chan struct{})}} - go func() { - tr.respchan <- &http.Response{Body: body} - time.Sleep(2 * time.Millisecond) - // cancel after the body is received - cancel() - }() - - _, _, err := c.Do(ctx, &fakeAction{}) - if err != context.Canceled { - t.Fatalf("expected %+v, got %+v", context.Canceled, err) - } - - if !body.closed { - t.Fatalf("expected closed body") - } -} - -func TestSimpleHTTPClientDoCancelContextWaitForRoundTrip(t *testing.T) { - tr := newFakeTransport() - c := &simpleHTTPClient{transport: tr} - - donechan := make(chan struct{}) - ctx, cancel := context.WithCancel(context.Background()) - go func() { - c.Do(ctx, &fakeAction{}) - close(donechan) - }() - - // This should call CancelRequest and begin the cancellation process - cancel() - - select { - case <-donechan: - t.Fatalf("simpleHTTPClient.Do should not have exited yet") - default: - } - - tr.finishCancel <- struct{}{} - - select { - case <-donechan: - //expected behavior - return - case <-time.After(time.Second): - t.Fatalf("simpleHTTPClient.Do did not exit within 1s") - } -} - -func TestSimpleHTTPClientDoHeaderTimeout(t *testing.T) { - tr := newFakeTransport() - tr.finishCancel <- struct{}{} - c := &simpleHTTPClient{transport: tr, headerTimeout: time.Millisecond} - - errc := make(chan error) - go func() { - _, _, err := c.Do(context.Background(), &fakeAction{}) - errc <- err - }() - - select { - case err := <-errc: - if err == nil { - t.Fatalf("expected non-nil error, got nil") - } - case <-time.After(time.Second): - t.Fatalf("unexpected timeout when waitting for the test to finish") - } -} - -func TestHTTPClusterClientDo(t *testing.T) { - fakeErr := errors.New("fake!") - fakeURL := url.URL{} - tests := []struct { - client *httpClusterClient - wantCode int - wantErr error - wantPinned int - }{ - // first good response short-circuits Do - { - client: &httpClusterClient{ - endpoints: []url.URL{fakeURL, fakeURL}, - clientFactory: newStaticHTTPClientFactory( - []staticHTTPResponse{ - {resp: http.Response{StatusCode: http.StatusTeapot}}, - {err: fakeErr}, - }, - ), - rand: rand.New(rand.NewSource(0)), - }, - wantCode: http.StatusTeapot, - }, - - // fall through to good endpoint if err is arbitrary - { - client: &httpClusterClient{ - endpoints: []url.URL{fakeURL, fakeURL}, - clientFactory: newStaticHTTPClientFactory( - []staticHTTPResponse{ - {err: fakeErr}, - {resp: http.Response{StatusCode: http.StatusTeapot}}, - }, - ), - rand: rand.New(rand.NewSource(0)), - }, - wantCode: http.StatusTeapot, - wantPinned: 1, - }, - - // context.Canceled short-circuits Do - { - client: &httpClusterClient{ - endpoints: []url.URL{fakeURL, fakeURL}, - clientFactory: newStaticHTTPClientFactory( - []staticHTTPResponse{ - {err: context.Canceled}, - {resp: http.Response{StatusCode: http.StatusTeapot}}, - }, - ), - rand: rand.New(rand.NewSource(0)), - }, - wantErr: context.Canceled, - }, - - // return err if there are no endpoints - { - client: &httpClusterClient{ - endpoints: []url.URL{}, - clientFactory: newHTTPClientFactory(nil, nil, 0), - rand: rand.New(rand.NewSource(0)), - }, - wantErr: ErrNoEndpoints, - }, - - // return err if all endpoints return arbitrary errors - { - client: &httpClusterClient{ - endpoints: []url.URL{fakeURL, fakeURL}, - clientFactory: newStaticHTTPClientFactory( - []staticHTTPResponse{ - {err: fakeErr}, - {err: fakeErr}, - }, - ), - rand: rand.New(rand.NewSource(0)), - }, - wantErr: &ClusterError{Errors: []error{fakeErr, fakeErr}}, - }, - - // 500-level errors cause Do to fallthrough to next endpoint - { - client: &httpClusterClient{ - endpoints: []url.URL{fakeURL, fakeURL}, - clientFactory: newStaticHTTPClientFactory( - []staticHTTPResponse{ - {resp: http.Response{StatusCode: http.StatusBadGateway}}, - {resp: http.Response{StatusCode: http.StatusTeapot}}, - }, - ), - rand: rand.New(rand.NewSource(0)), - }, - wantCode: http.StatusTeapot, - wantPinned: 1, - }, - } - - for i, tt := range tests { - resp, _, err := tt.client.Do(context.Background(), nil) - if !reflect.DeepEqual(tt.wantErr, err) { - t.Errorf("#%d: got err=%v, want=%v", i, err, tt.wantErr) - continue - } - - if resp == nil { - if tt.wantCode != 0 { - t.Errorf("#%d: resp is nil, want=%d", i, tt.wantCode) - } - continue - } - - if resp.StatusCode != tt.wantCode { - t.Errorf("#%d: resp code=%d, want=%d", i, resp.StatusCode, tt.wantCode) - continue - } - - if tt.client.pinned != tt.wantPinned { - t.Errorf("#%d: pinned=%d, want=%d", i, tt.client.pinned, tt.wantPinned) - } - } -} - -func TestHTTPClusterClientDoDeadlineExceedContext(t *testing.T) { - fakeURL := url.URL{} - tr := newFakeTransport() - tr.finishCancel <- struct{}{} - c := &httpClusterClient{ - clientFactory: newHTTPClientFactory(tr, DefaultCheckRedirect, 0), - endpoints: []url.URL{fakeURL}, - } - - errc := make(chan error) - go func() { - ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond) - defer cancel() - _, _, err := c.Do(ctx, &fakeAction{}) - errc <- err - }() - - select { - case err := <-errc: - if err != context.DeadlineExceeded { - t.Errorf("err = %+v, want %+v", err, context.DeadlineExceeded) - } - case <-time.After(time.Second): - t.Fatalf("unexpected timeout when waitting for request to deadline exceed") - } -} - -func TestRedirectedHTTPAction(t *testing.T) { - act := &redirectedHTTPAction{ - action: &staticHTTPAction{ - request: http.Request{ - Method: "DELETE", - URL: &url.URL{ - Scheme: "https", - Host: "foo.example.com", - Path: "/ping", - }, - }, - }, - location: url.URL{ - Scheme: "https", - Host: "bar.example.com", - Path: "/pong", - }, - } - - want := &http.Request{ - Method: "DELETE", - URL: &url.URL{ - Scheme: "https", - Host: "bar.example.com", - Path: "/pong", - }, - } - got := act.HTTPRequest(url.URL{Scheme: "http", Host: "baz.example.com", Path: "/pang"}) - - if !reflect.DeepEqual(want, got) { - t.Fatalf("HTTPRequest is %#v, want %#v", want, got) - } -} - -func TestRedirectFollowingHTTPClient(t *testing.T) { - tests := []struct { - checkRedirect CheckRedirectFunc - client httpClient - wantCode int - wantErr error - }{ - // errors bubbled up - { - checkRedirect: func(int) error { return ErrTooManyRedirects }, - client: &multiStaticHTTPClient{ - responses: []staticHTTPResponse{ - { - err: errors.New("fail!"), - }, - }, - }, - wantErr: errors.New("fail!"), - }, - - // no need to follow redirect if none given - { - checkRedirect: func(int) error { return ErrTooManyRedirects }, - client: &multiStaticHTTPClient{ - responses: []staticHTTPResponse{ - { - resp: http.Response{ - StatusCode: http.StatusTeapot, - }, - }, - }, - }, - wantCode: http.StatusTeapot, - }, - - // redirects if less than max - { - checkRedirect: func(via int) error { - if via >= 2 { - return ErrTooManyRedirects - } - return nil - }, - client: &multiStaticHTTPClient{ - responses: []staticHTTPResponse{ - { - resp: http.Response{ - StatusCode: http.StatusTemporaryRedirect, - Header: http.Header{"Location": []string{"http://example.com"}}, - }, - }, - { - resp: http.Response{ - StatusCode: http.StatusTeapot, - }, - }, - }, - }, - wantCode: http.StatusTeapot, - }, - - // succeed after reaching max redirects - { - checkRedirect: func(via int) error { - if via >= 3 { - return ErrTooManyRedirects - } - return nil - }, - client: &multiStaticHTTPClient{ - responses: []staticHTTPResponse{ - { - resp: http.Response{ - StatusCode: http.StatusTemporaryRedirect, - Header: http.Header{"Location": []string{"http://example.com"}}, - }, - }, - { - resp: http.Response{ - StatusCode: http.StatusTemporaryRedirect, - Header: http.Header{"Location": []string{"http://example.com"}}, - }, - }, - { - resp: http.Response{ - StatusCode: http.StatusTeapot, - }, - }, - }, - }, - wantCode: http.StatusTeapot, - }, - - // fail if too many redirects - { - checkRedirect: func(via int) error { - if via >= 2 { - return ErrTooManyRedirects - } - return nil - }, - client: &multiStaticHTTPClient{ - responses: []staticHTTPResponse{ - { - resp: http.Response{ - StatusCode: http.StatusTemporaryRedirect, - Header: http.Header{"Location": []string{"http://example.com"}}, - }, - }, - { - resp: http.Response{ - StatusCode: http.StatusTemporaryRedirect, - Header: http.Header{"Location": []string{"http://example.com"}}, - }, - }, - { - resp: http.Response{ - StatusCode: http.StatusTeapot, - }, - }, - }, - }, - wantErr: ErrTooManyRedirects, - }, - - // fail if Location header not set - { - checkRedirect: func(int) error { return ErrTooManyRedirects }, - client: &multiStaticHTTPClient{ - responses: []staticHTTPResponse{ - { - resp: http.Response{ - StatusCode: http.StatusTemporaryRedirect, - }, - }, - }, - }, - wantErr: errors.New("Location header not set"), - }, - - // fail if Location header is invalid - { - checkRedirect: func(int) error { return ErrTooManyRedirects }, - client: &multiStaticHTTPClient{ - responses: []staticHTTPResponse{ - { - resp: http.Response{ - StatusCode: http.StatusTemporaryRedirect, - Header: http.Header{"Location": []string{":"}}, - }, - }, - }, - }, - wantErr: errors.New("Location header not valid URL: :"), - }, - - // fail if redirects checked way too many times - { - checkRedirect: func(int) error { return nil }, - client: &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusTemporaryRedirect, - Header: http.Header{"Location": []string{"http://example.com"}}, - }, - }, - wantErr: errTooManyRedirectChecks, - }, - } - - for i, tt := range tests { - client := &redirectFollowingHTTPClient{client: tt.client, checkRedirect: tt.checkRedirect} - resp, _, err := client.Do(context.Background(), nil) - if !reflect.DeepEqual(tt.wantErr, err) { - t.Errorf("#%d: got err=%v, want=%v", i, err, tt.wantErr) - continue - } - - if resp == nil { - if tt.wantCode != 0 { - t.Errorf("#%d: resp is nil, want=%d", i, tt.wantCode) - } - continue - } - - if resp.StatusCode != tt.wantCode { - t.Errorf("#%d: resp code=%d, want=%d", i, resp.StatusCode, tt.wantCode) - continue - } - } -} - -func TestDefaultCheckRedirect(t *testing.T) { - tests := []struct { - num int - err error - }{ - {0, nil}, - {5, nil}, - {10, nil}, - {11, ErrTooManyRedirects}, - {29, ErrTooManyRedirects}, - } - - for i, tt := range tests { - err := DefaultCheckRedirect(tt.num) - if !reflect.DeepEqual(tt.err, err) { - t.Errorf("#%d: want=%#v got=%#v", i, tt.err, err) - } - } -} - -func TestHTTPClusterClientSync(t *testing.T) { - cf := newStaticHTTPClientFactory([]staticHTTPResponse{ - { - resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}}, - body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`), - }, - }) - - hc := &httpClusterClient{ - clientFactory: cf, - rand: rand.New(rand.NewSource(0)), - } - err := hc.SetEndpoints([]string{"http://127.0.0.1:2379"}) - if err != nil { - t.Fatalf("unexpected error during setup: %#v", err) - } - - want := []string{"http://127.0.0.1:2379"} - got := hc.Endpoints() - if !reflect.DeepEqual(want, got) { - t.Fatalf("incorrect endpoints: want=%#v got=%#v", want, got) - } - - err = hc.Sync(context.Background()) - if err != nil { - t.Fatalf("unexpected error during Sync: %#v", err) - } - - want = []string{"http://127.0.0.1:2379", "http://127.0.0.1:4001", "http://127.0.0.1:4002", "http://127.0.0.1:4003"} - got = hc.Endpoints() - sort.Sort(sort.StringSlice(got)) - if !reflect.DeepEqual(want, got) { - t.Fatalf("incorrect endpoints post-Sync: want=%#v got=%#v", want, got) - } - - err = hc.SetEndpoints([]string{"http://127.0.0.1:4009"}) - if err != nil { - t.Fatalf("unexpected error during reset: %#v", err) - } - - want = []string{"http://127.0.0.1:4009"} - got = hc.Endpoints() - if !reflect.DeepEqual(want, got) { - t.Fatalf("incorrect endpoints post-reset: want=%#v got=%#v", want, got) - } -} - -func TestHTTPClusterClientSyncFail(t *testing.T) { - cf := newStaticHTTPClientFactory([]staticHTTPResponse{ - {err: errors.New("fail!")}, - }) - - hc := &httpClusterClient{ - clientFactory: cf, - rand: rand.New(rand.NewSource(0)), - } - err := hc.SetEndpoints([]string{"http://127.0.0.1:2379"}) - if err != nil { - t.Fatalf("unexpected error during setup: %#v", err) - } - - want := []string{"http://127.0.0.1:2379"} - got := hc.Endpoints() - if !reflect.DeepEqual(want, got) { - t.Fatalf("incorrect endpoints: want=%#v got=%#v", want, got) - } - - err = hc.Sync(context.Background()) - if err == nil { - t.Fatalf("got nil error during Sync") - } - - got = hc.Endpoints() - if !reflect.DeepEqual(want, got) { - t.Fatalf("incorrect endpoints after failed Sync: want=%#v got=%#v", want, got) - } -} - -func TestHTTPClusterClientAutoSyncCancelContext(t *testing.T) { - cf := newStaticHTTPClientFactory([]staticHTTPResponse{ - { - resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}}, - body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`), - }, - }) - - hc := &httpClusterClient{ - clientFactory: cf, - rand: rand.New(rand.NewSource(0)), - } - err := hc.SetEndpoints([]string{"http://127.0.0.1:2379"}) - if err != nil { - t.Fatalf("unexpected error during setup: %#v", err) - } - ctx, cancel := context.WithCancel(context.Background()) - cancel() - - err = hc.AutoSync(ctx, time.Hour) - if err != context.Canceled { - t.Fatalf("incorrect error value: want=%v got=%v", context.Canceled, err) - } -} - -func TestHTTPClusterClientAutoSyncFail(t *testing.T) { - cf := newStaticHTTPClientFactory([]staticHTTPResponse{ - {err: errors.New("fail!")}, - }) - - hc := &httpClusterClient{ - clientFactory: cf, - rand: rand.New(rand.NewSource(0)), - } - err := hc.SetEndpoints([]string{"http://127.0.0.1:2379"}) - if err != nil { - t.Fatalf("unexpected error during setup: %#v", err) - } - - err = hc.AutoSync(context.Background(), time.Hour) - if err.Error() != ErrClusterUnavailable.Error() { - t.Fatalf("incorrect error value: want=%v got=%v", ErrClusterUnavailable, err) - } -} - -// TestHTTPClusterClientSyncPinEndpoint tests that Sync() pins the endpoint when -// it gets the exactly same member list as before. -func TestHTTPClusterClientSyncPinEndpoint(t *testing.T) { - cf := newStaticHTTPClientFactory([]staticHTTPResponse{ - { - resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}}, - body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`), - }, - { - resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}}, - body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`), - }, - { - resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}}, - body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`), - }, - }) - - hc := &httpClusterClient{ - clientFactory: cf, - rand: rand.New(rand.NewSource(0)), - } - err := hc.SetEndpoints([]string{"http://127.0.0.1:4003", "http://127.0.0.1:2379", "http://127.0.0.1:4001", "http://127.0.0.1:4002"}) - if err != nil { - t.Fatalf("unexpected error during setup: %#v", err) - } - pinnedEndpoint := hc.endpoints[hc.pinned] - - for i := 0; i < 3; i++ { - err = hc.Sync(context.Background()) - if err != nil { - t.Fatalf("#%d: unexpected error during Sync: %#v", i, err) - } - - if g := hc.endpoints[hc.pinned]; g != pinnedEndpoint { - t.Errorf("#%d: pinned endpoint = %s, want %s", i, g, pinnedEndpoint) - } - } -} - -func TestHTTPClusterClientResetFail(t *testing.T) { - tests := [][]string{ - // need at least one endpoint - {}, - - // urls must be valid - {":"}, - } - - for i, tt := range tests { - hc := &httpClusterClient{rand: rand.New(rand.NewSource(0))} - err := hc.SetEndpoints(tt) - if err == nil { - t.Errorf("#%d: expected non-nil error", i) - } - } -} - -func TestHTTPClusterClientResetPinRandom(t *testing.T) { - round := 2000 - pinNum := 0 - for i := 0; i < round; i++ { - hc := &httpClusterClient{rand: rand.New(rand.NewSource(int64(i)))} - err := hc.SetEndpoints([]string{"http://127.0.0.1:4001", "http://127.0.0.1:4002", "http://127.0.0.1:4003"}) - if err != nil { - t.Fatalf("#%d: reset error (%v)", i, err) - } - if hc.endpoints[hc.pinned].String() == "http://127.0.0.1:4001" { - pinNum++ - } - } - - min := 1.0/3.0 - 0.05 - max := 1.0/3.0 + 0.05 - if ratio := float64(pinNum) / float64(round); ratio > max || ratio < min { - t.Errorf("pinned ratio = %v, want [%v, %v]", ratio, min, max) - } -} diff --git a/vendor/github.com/coreos/etcd/client/fake_transport_go14_test.go b/vendor/github.com/coreos/etcd/client/fake_transport_go14_test.go deleted file mode 100644 index 4a99a7d374..0000000000 --- a/vendor/github.com/coreos/etcd/client/fake_transport_go14_test.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build !go1.5 - -package client - -import ( - "errors" - "net/http" -) - -func (t *fakeTransport) RoundTrip(req *http.Request) (*http.Response, error) { - select { - case resp := <-t.respchan: - return resp, nil - case err := <-t.errchan: - return nil, err - case <-t.startCancel: - select { - // this simulates that the request is finished before cancel effects - case resp := <-t.respchan: - return resp, nil - // wait on finishCancel to simulate taking some amount of - // time while calling CancelRequest - case <-t.finishCancel: - return nil, errors.New("cancelled") - } - } -} diff --git a/vendor/github.com/coreos/etcd/client/fake_transport_test.go b/vendor/github.com/coreos/etcd/client/fake_transport_test.go deleted file mode 100644 index 06761e2668..0000000000 --- a/vendor/github.com/coreos/etcd/client/fake_transport_test.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build go1.5 - -package client - -import ( - "errors" - "net/http" -) - -func (t *fakeTransport) RoundTrip(req *http.Request) (*http.Response, error) { - select { - case resp := <-t.respchan: - return resp, nil - case err := <-t.errchan: - return nil, err - case <-t.startCancel: - case <-req.Cancel: - } - select { - // this simulates that the request is finished before cancel effects - case resp := <-t.respchan: - return resp, nil - // wait on finishCancel to simulate taking some amount of - // time while calling CancelRequest - case <-t.finishCancel: - return nil, errors.New("cancelled") - } -} diff --git a/vendor/github.com/coreos/etcd/client/keys_bench_test.go b/vendor/github.com/coreos/etcd/client/keys_bench_test.go deleted file mode 100644 index 5b65415920..0000000000 --- a/vendor/github.com/coreos/etcd/client/keys_bench_test.go +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package client - -import ( - "encoding/json" - "net/http" - "reflect" - "strings" - "testing" -) - -func createTestNode(size int) *Node { - return &Node{ - Key: strings.Repeat("a", 30), - Value: strings.Repeat("a", size), - CreatedIndex: 123456, - ModifiedIndex: 123456, - TTL: 123456789, - } -} - -func createTestNodeWithChildren(children, size int) *Node { - node := createTestNode(size) - for i := 0; i < children; i++ { - node.Nodes = append(node.Nodes, createTestNode(size)) - } - return node -} - -func createTestResponse(children, size int) *Response { - return &Response{ - Action: "aaaaa", - Node: createTestNodeWithChildren(children, size), - PrevNode: nil, - } -} - -func benchmarkResponseUnmarshalling(b *testing.B, children, size int) { - header := http.Header{} - header.Add("X-Etcd-Index", "123456") - response := createTestResponse(children, size) - body, err := json.Marshal(response) - if err != nil { - b.Fatal(err) - } - - b.ResetTimer() - newResponse := new(Response) - for i := 0; i < b.N; i++ { - if newResponse, err = unmarshalSuccessfulKeysResponse(header, body); err != nil { - b.Errorf("error unmarshaling response (%v)", err) - } - - } - if !reflect.DeepEqual(response.Node, newResponse.Node) { - b.Errorf("Unexpected difference in a parsed response: \n%+v\n%+v", response, newResponse) - } -} - -func BenchmarkSmallResponseUnmarshal(b *testing.B) { - benchmarkResponseUnmarshalling(b, 30, 20) -} - -func BenchmarkManySmallResponseUnmarshal(b *testing.B) { - benchmarkResponseUnmarshalling(b, 3000, 20) -} - -func BenchmarkMediumResponseUnmarshal(b *testing.B) { - benchmarkResponseUnmarshalling(b, 300, 200) -} - -func BenchmarkLargeResponseUnmarshal(b *testing.B) { - benchmarkResponseUnmarshalling(b, 3000, 2000) -} diff --git a/vendor/github.com/coreos/etcd/client/keys_test.go b/vendor/github.com/coreos/etcd/client/keys_test.go deleted file mode 100644 index cafe6bea4c..0000000000 --- a/vendor/github.com/coreos/etcd/client/keys_test.go +++ /dev/null @@ -1,1407 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package client - -import ( - "errors" - "fmt" - "io/ioutil" - "net/http" - "net/url" - "reflect" - "testing" - "time" - - "github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context" -) - -func TestV2KeysURLHelper(t *testing.T) { - tests := []struct { - endpoint url.URL - prefix string - key string - want url.URL - }{ - // key is empty, no problem - { - endpoint: url.URL{Scheme: "http", Host: "example.com", Path: "/v2/keys"}, - prefix: "", - key: "", - want: url.URL{Scheme: "http", Host: "example.com", Path: "/v2/keys"}, - }, - - // key is joined to path - { - endpoint: url.URL{Scheme: "http", Host: "example.com", Path: "/v2/keys"}, - prefix: "", - key: "/foo/bar", - want: url.URL{Scheme: "http", Host: "example.com", Path: "/v2/keys/foo/bar"}, - }, - - // key is joined to path when path is empty - { - endpoint: url.URL{Scheme: "http", Host: "example.com", Path: ""}, - prefix: "", - key: "/foo/bar", - want: url.URL{Scheme: "http", Host: "example.com", Path: "/foo/bar"}, - }, - - // Host field carries through with port - { - endpoint: url.URL{Scheme: "http", Host: "example.com:8080", Path: "/v2/keys"}, - prefix: "", - key: "", - want: url.URL{Scheme: "http", Host: "example.com:8080", Path: "/v2/keys"}, - }, - - // Scheme carries through - { - endpoint: url.URL{Scheme: "https", Host: "example.com", Path: "/v2/keys"}, - prefix: "", - key: "", - want: url.URL{Scheme: "https", Host: "example.com", Path: "/v2/keys"}, - }, - // Prefix is applied - { - endpoint: url.URL{Scheme: "https", Host: "example.com", Path: "/foo"}, - prefix: "/bar", - key: "/baz", - want: url.URL{Scheme: "https", Host: "example.com", Path: "/foo/bar/baz"}, - }, - // Prefix is joined to path - { - endpoint: url.URL{Scheme: "https", Host: "example.com", Path: "/foo"}, - prefix: "/bar", - key: "", - want: url.URL{Scheme: "https", Host: "example.com", Path: "/foo/bar"}, - }, - // Keep trailing slash - { - endpoint: url.URL{Scheme: "https", Host: "example.com", Path: "/foo"}, - prefix: "/bar", - key: "/baz/", - want: url.URL{Scheme: "https", Host: "example.com", Path: "/foo/bar/baz/"}, - }, - } - - for i, tt := range tests { - got := v2KeysURL(tt.endpoint, tt.prefix, tt.key) - if tt.want != *got { - t.Errorf("#%d: want=%#v, got=%#v", i, tt.want, *got) - } - } -} - -func TestGetAction(t *testing.T) { - ep := url.URL{Scheme: "http", Host: "example.com", Path: "/v2/keys"} - baseWantURL := &url.URL{ - Scheme: "http", - Host: "example.com", - Path: "/v2/keys/foo/bar", - } - wantHeader := http.Header{} - - tests := []struct { - recursive bool - sorted bool - quorum bool - wantQuery string - }{ - { - recursive: false, - sorted: false, - quorum: false, - wantQuery: "quorum=false&recursive=false&sorted=false", - }, - { - recursive: true, - sorted: false, - quorum: false, - wantQuery: "quorum=false&recursive=true&sorted=false", - }, - { - recursive: false, - sorted: true, - quorum: false, - wantQuery: "quorum=false&recursive=false&sorted=true", - }, - { - recursive: true, - sorted: true, - quorum: false, - wantQuery: "quorum=false&recursive=true&sorted=true", - }, - { - recursive: false, - sorted: false, - quorum: true, - wantQuery: "quorum=true&recursive=false&sorted=false", - }, - } - - for i, tt := range tests { - f := getAction{ - Key: "/foo/bar", - Recursive: tt.recursive, - Sorted: tt.sorted, - Quorum: tt.quorum, - } - got := *f.HTTPRequest(ep) - - wantURL := baseWantURL - wantURL.RawQuery = tt.wantQuery - - err := assertRequest(got, "GET", wantURL, wantHeader, nil) - if err != nil { - t.Errorf("#%d: %v", i, err) - } - } -} - -func TestWaitAction(t *testing.T) { - ep := url.URL{Scheme: "http", Host: "example.com", Path: "/v2/keys"} - baseWantURL := &url.URL{ - Scheme: "http", - Host: "example.com", - Path: "/v2/keys/foo/bar", - } - wantHeader := http.Header{} - - tests := []struct { - waitIndex uint64 - recursive bool - wantQuery string - }{ - { - recursive: false, - waitIndex: uint64(0), - wantQuery: "recursive=false&wait=true&waitIndex=0", - }, - { - recursive: false, - waitIndex: uint64(12), - wantQuery: "recursive=false&wait=true&waitIndex=12", - }, - { - recursive: true, - waitIndex: uint64(12), - wantQuery: "recursive=true&wait=true&waitIndex=12", - }, - } - - for i, tt := range tests { - f := waitAction{ - Key: "/foo/bar", - WaitIndex: tt.waitIndex, - Recursive: tt.recursive, - } - got := *f.HTTPRequest(ep) - - wantURL := baseWantURL - wantURL.RawQuery = tt.wantQuery - - err := assertRequest(got, "GET", wantURL, wantHeader, nil) - if err != nil { - t.Errorf("#%d: unexpected error: %#v", i, err) - } - } -} - -func TestSetAction(t *testing.T) { - wantHeader := http.Header(map[string][]string{ - "Content-Type": {"application/x-www-form-urlencoded"}, - }) - - tests := []struct { - act setAction - wantURL string - wantBody string - }{ - // default prefix - { - act: setAction{ - Prefix: defaultV2KeysPrefix, - Key: "foo", - }, - wantURL: "http://example.com/v2/keys/foo", - wantBody: "value=", - }, - - // non-default prefix - { - act: setAction{ - Prefix: "/pfx", - Key: "foo", - }, - wantURL: "http://example.com/pfx/foo", - wantBody: "value=", - }, - - // no prefix - { - act: setAction{ - Key: "foo", - }, - wantURL: "http://example.com/foo", - wantBody: "value=", - }, - - // Key with path separators - { - act: setAction{ - Prefix: defaultV2KeysPrefix, - Key: "foo/bar/baz", - }, - wantURL: "http://example.com/v2/keys/foo/bar/baz", - wantBody: "value=", - }, - - // Key with leading slash, Prefix with trailing slash - { - act: setAction{ - Prefix: "/foo/", - Key: "/bar", - }, - wantURL: "http://example.com/foo/bar", - wantBody: "value=", - }, - - // Key with trailing slash - { - act: setAction{ - Key: "/foo/", - }, - wantURL: "http://example.com/foo/", - wantBody: "value=", - }, - - // Value is set - { - act: setAction{ - Key: "foo", - Value: "baz", - }, - wantURL: "http://example.com/foo", - wantBody: "value=baz", - }, - - // PrevExist set, but still ignored - { - act: setAction{ - Key: "foo", - PrevExist: PrevIgnore, - }, - wantURL: "http://example.com/foo", - wantBody: "value=", - }, - - // PrevExist set to true - { - act: setAction{ - Key: "foo", - PrevExist: PrevExist, - }, - wantURL: "http://example.com/foo?prevExist=true", - wantBody: "value=", - }, - - // PrevExist set to false - { - act: setAction{ - Key: "foo", - PrevExist: PrevNoExist, - }, - wantURL: "http://example.com/foo?prevExist=false", - wantBody: "value=", - }, - - // PrevValue is urlencoded - { - act: setAction{ - Key: "foo", - PrevValue: "bar baz", - }, - wantURL: "http://example.com/foo?prevValue=bar+baz", - wantBody: "value=", - }, - - // PrevIndex is set - { - act: setAction{ - Key: "foo", - PrevIndex: uint64(12), - }, - wantURL: "http://example.com/foo?prevIndex=12", - wantBody: "value=", - }, - - // TTL is set - { - act: setAction{ - Key: "foo", - TTL: 3 * time.Minute, - }, - wantURL: "http://example.com/foo", - wantBody: "ttl=180&value=", - }, - // Dir is set - { - act: setAction{ - Key: "foo", - Dir: true, - }, - wantURL: "http://example.com/foo?dir=true", - wantBody: "", - }, - // Dir is set with a value - { - act: setAction{ - Key: "foo", - Value: "bar", - Dir: true, - }, - wantURL: "http://example.com/foo?dir=true", - wantBody: "", - }, - // Dir is set with PrevExist set to true - { - act: setAction{ - Key: "foo", - PrevExist: PrevExist, - Dir: true, - }, - wantURL: "http://example.com/foo?dir=true&prevExist=true", - wantBody: "", - }, - // Dir is set with PrevValue - { - act: setAction{ - Key: "foo", - PrevValue: "bar", - Dir: true, - }, - wantURL: "http://example.com/foo?dir=true", - wantBody: "", - }, - } - - for i, tt := range tests { - u, err := url.Parse(tt.wantURL) - if err != nil { - t.Errorf("#%d: unable to use wantURL fixture: %v", i, err) - } - - got := tt.act.HTTPRequest(url.URL{Scheme: "http", Host: "example.com"}) - if err := assertRequest(*got, "PUT", u, wantHeader, []byte(tt.wantBody)); err != nil { - t.Errorf("#%d: %v", i, err) - } - } -} - -func TestCreateInOrderAction(t *testing.T) { - wantHeader := http.Header(map[string][]string{ - "Content-Type": {"application/x-www-form-urlencoded"}, - }) - - tests := []struct { - act createInOrderAction - wantURL string - wantBody string - }{ - // default prefix - { - act: createInOrderAction{ - Prefix: defaultV2KeysPrefix, - Dir: "foo", - }, - wantURL: "http://example.com/v2/keys/foo", - wantBody: "value=", - }, - - // non-default prefix - { - act: createInOrderAction{ - Prefix: "/pfx", - Dir: "foo", - }, - wantURL: "http://example.com/pfx/foo", - wantBody: "value=", - }, - - // no prefix - { - act: createInOrderAction{ - Dir: "foo", - }, - wantURL: "http://example.com/foo", - wantBody: "value=", - }, - - // Key with path separators - { - act: createInOrderAction{ - Prefix: defaultV2KeysPrefix, - Dir: "foo/bar/baz", - }, - wantURL: "http://example.com/v2/keys/foo/bar/baz", - wantBody: "value=", - }, - - // Key with leading slash, Prefix with trailing slash - { - act: createInOrderAction{ - Prefix: "/foo/", - Dir: "/bar", - }, - wantURL: "http://example.com/foo/bar", - wantBody: "value=", - }, - - // Key with trailing slash - { - act: createInOrderAction{ - Dir: "/foo/", - }, - wantURL: "http://example.com/foo/", - wantBody: "value=", - }, - - // Value is set - { - act: createInOrderAction{ - Dir: "foo", - Value: "baz", - }, - wantURL: "http://example.com/foo", - wantBody: "value=baz", - }, - // TTL is set - { - act: createInOrderAction{ - Dir: "foo", - TTL: 3 * time.Minute, - }, - wantURL: "http://example.com/foo", - wantBody: "ttl=180&value=", - }, - } - - for i, tt := range tests { - u, err := url.Parse(tt.wantURL) - if err != nil { - t.Errorf("#%d: unable to use wantURL fixture: %v", i, err) - } - - got := tt.act.HTTPRequest(url.URL{Scheme: "http", Host: "example.com"}) - if err := assertRequest(*got, "POST", u, wantHeader, []byte(tt.wantBody)); err != nil { - t.Errorf("#%d: %v", i, err) - } - } -} - -func TestDeleteAction(t *testing.T) { - wantHeader := http.Header(map[string][]string{ - "Content-Type": {"application/x-www-form-urlencoded"}, - }) - - tests := []struct { - act deleteAction - wantURL string - }{ - // default prefix - { - act: deleteAction{ - Prefix: defaultV2KeysPrefix, - Key: "foo", - }, - wantURL: "http://example.com/v2/keys/foo", - }, - - // non-default prefix - { - act: deleteAction{ - Prefix: "/pfx", - Key: "foo", - }, - wantURL: "http://example.com/pfx/foo", - }, - - // no prefix - { - act: deleteAction{ - Key: "foo", - }, - wantURL: "http://example.com/foo", - }, - - // Key with path separators - { - act: deleteAction{ - Prefix: defaultV2KeysPrefix, - Key: "foo/bar/baz", - }, - wantURL: "http://example.com/v2/keys/foo/bar/baz", - }, - - // Key with leading slash, Prefix with trailing slash - { - act: deleteAction{ - Prefix: "/foo/", - Key: "/bar", - }, - wantURL: "http://example.com/foo/bar", - }, - - // Key with trailing slash - { - act: deleteAction{ - Key: "/foo/", - }, - wantURL: "http://example.com/foo/", - }, - - // Recursive set to true - { - act: deleteAction{ - Key: "foo", - Recursive: true, - }, - wantURL: "http://example.com/foo?recursive=true", - }, - - // PrevValue is urlencoded - { - act: deleteAction{ - Key: "foo", - PrevValue: "bar baz", - }, - wantURL: "http://example.com/foo?prevValue=bar+baz", - }, - - // PrevIndex is set - { - act: deleteAction{ - Key: "foo", - PrevIndex: uint64(12), - }, - wantURL: "http://example.com/foo?prevIndex=12", - }, - } - - for i, tt := range tests { - u, err := url.Parse(tt.wantURL) - if err != nil { - t.Errorf("#%d: unable to use wantURL fixture: %v", i, err) - } - - got := tt.act.HTTPRequest(url.URL{Scheme: "http", Host: "example.com"}) - if err := assertRequest(*got, "DELETE", u, wantHeader, nil); err != nil { - t.Errorf("#%d: %v", i, err) - } - } -} - -func assertRequest(got http.Request, wantMethod string, wantURL *url.URL, wantHeader http.Header, wantBody []byte) error { - if wantMethod != got.Method { - return fmt.Errorf("want.Method=%#v got.Method=%#v", wantMethod, got.Method) - } - - if !reflect.DeepEqual(wantURL, got.URL) { - return fmt.Errorf("want.URL=%#v got.URL=%#v", wantURL, got.URL) - } - - if !reflect.DeepEqual(wantHeader, got.Header) { - return fmt.Errorf("want.Header=%#v got.Header=%#v", wantHeader, got.Header) - } - - if got.Body == nil { - if wantBody != nil { - return fmt.Errorf("want.Body=%v got.Body=%v", wantBody, got.Body) - } - } else { - if wantBody == nil { - return fmt.Errorf("want.Body=%v got.Body=%s", wantBody, got.Body) - } else { - gotBytes, err := ioutil.ReadAll(got.Body) - if err != nil { - return err - } - - if !reflect.DeepEqual(wantBody, gotBytes) { - return fmt.Errorf("want.Body=%s got.Body=%s", wantBody, gotBytes) - } - } - } - - return nil -} - -func TestUnmarshalSuccessfulResponse(t *testing.T) { - var expiration time.Time - expiration.UnmarshalText([]byte("2015-04-07T04:40:23.044979686Z")) - - tests := []struct { - hdr string - body string - wantRes *Response - wantErr bool - }{ - // Neither PrevNode or Node - { - hdr: "1", - body: `{"action":"delete"}`, - wantRes: &Response{Action: "delete", Index: 1}, - wantErr: false, - }, - - // PrevNode - { - hdr: "15", - body: `{"action":"delete", "prevNode": {"key": "/foo", "value": "bar", "modifiedIndex": 12, "createdIndex": 10}}`, - wantRes: &Response{ - Action: "delete", - Index: 15, - Node: nil, - PrevNode: &Node{ - Key: "/foo", - Value: "bar", - ModifiedIndex: 12, - CreatedIndex: 10, - }, - }, - wantErr: false, - }, - - // Node - { - hdr: "15", - body: `{"action":"get", "node": {"key": "/foo", "value": "bar", "modifiedIndex": 12, "createdIndex": 10, "ttl": 10, "expiration": "2015-04-07T04:40:23.044979686Z"}}`, - wantRes: &Response{ - Action: "get", - Index: 15, - Node: &Node{ - Key: "/foo", - Value: "bar", - ModifiedIndex: 12, - CreatedIndex: 10, - TTL: 10, - Expiration: &expiration, - }, - PrevNode: nil, - }, - wantErr: false, - }, - - // Node Dir - { - hdr: "15", - body: `{"action":"get", "node": {"key": "/foo", "dir": true, "modifiedIndex": 12, "createdIndex": 10}}`, - wantRes: &Response{ - Action: "get", - Index: 15, - Node: &Node{ - Key: "/foo", - Dir: true, - ModifiedIndex: 12, - CreatedIndex: 10, - }, - PrevNode: nil, - }, - wantErr: false, - }, - - // PrevNode and Node - { - hdr: "15", - body: `{"action":"update", "prevNode": {"key": "/foo", "value": "baz", "modifiedIndex": 10, "createdIndex": 10}, "node": {"key": "/foo", "value": "bar", "modifiedIndex": 12, "createdIndex": 10}}`, - wantRes: &Response{ - Action: "update", - Index: 15, - PrevNode: &Node{ - Key: "/foo", - Value: "baz", - ModifiedIndex: 10, - CreatedIndex: 10, - }, - Node: &Node{ - Key: "/foo", - Value: "bar", - ModifiedIndex: 12, - CreatedIndex: 10, - }, - }, - wantErr: false, - }, - - // Garbage in body - { - hdr: "", - body: `garbage`, - wantRes: nil, - wantErr: true, - }, - - // non-integer index - { - hdr: "poo", - body: `{}`, - wantRes: nil, - wantErr: true, - }, - } - - for i, tt := range tests { - h := make(http.Header) - h.Add("X-Etcd-Index", tt.hdr) - res, err := unmarshalSuccessfulKeysResponse(h, []byte(tt.body)) - if tt.wantErr != (err != nil) { - t.Errorf("#%d: wantErr=%t, err=%v", i, tt.wantErr, err) - } - - if (res == nil) != (tt.wantRes == nil) { - t.Errorf("#%d: received res=%#v, but expected res=%#v", i, res, tt.wantRes) - continue - } else if tt.wantRes == nil { - // expected and successfully got nil response - continue - } - - if res.Action != tt.wantRes.Action { - t.Errorf("#%d: Action=%s, expected %s", i, res.Action, tt.wantRes.Action) - } - if res.Index != tt.wantRes.Index { - t.Errorf("#%d: Index=%d, expected %d", i, res.Index, tt.wantRes.Index) - } - if !reflect.DeepEqual(res.Node, tt.wantRes.Node) { - t.Errorf("#%d: Node=%v, expected %v", i, res.Node, tt.wantRes.Node) - } - } -} - -func TestUnmarshalFailedKeysResponse(t *testing.T) { - body := []byte(`{"errorCode":100,"message":"Key not found","cause":"/foo","index":18}`) - - wantErr := Error{ - Code: 100, - Message: "Key not found", - Cause: "/foo", - Index: uint64(18), - } - - gotErr := unmarshalFailedKeysResponse(body) - if !reflect.DeepEqual(wantErr, gotErr) { - t.Errorf("unexpected error: want=%#v got=%#v", wantErr, gotErr) - } -} - -func TestUnmarshalFailedKeysResponseBadJSON(t *testing.T) { - err := unmarshalFailedKeysResponse([]byte(`{"er`)) - if err == nil { - t.Errorf("got nil error") - } else if _, ok := err.(Error); ok { - t.Errorf("error is of incorrect type *Error: %#v", err) - } -} - -func TestHTTPWatcherNextWaitAction(t *testing.T) { - initAction := waitAction{ - Prefix: "/pants", - Key: "/foo/bar", - Recursive: true, - WaitIndex: 19, - } - - client := &actionAssertingHTTPClient{ - t: t, - act: &initAction, - resp: http.Response{ - StatusCode: http.StatusOK, - Header: http.Header{"X-Etcd-Index": []string{"42"}}, - }, - body: []byte(`{"action":"update","node":{"key":"/pants/foo/bar/baz","value":"snarf","modifiedIndex":21,"createdIndex":19},"prevNode":{"key":"/pants/foo/bar/baz","value":"snazz","modifiedIndex":20,"createdIndex":19}}`), - } - - wantResponse := &Response{ - Action: "update", - Node: &Node{Key: "/pants/foo/bar/baz", Value: "snarf", CreatedIndex: uint64(19), ModifiedIndex: uint64(21)}, - PrevNode: &Node{Key: "/pants/foo/bar/baz", Value: "snazz", CreatedIndex: uint64(19), ModifiedIndex: uint64(20)}, - Index: uint64(42), - } - - wantNextWait := waitAction{ - Prefix: "/pants", - Key: "/foo/bar", - Recursive: true, - WaitIndex: 22, - } - - watcher := &httpWatcher{ - client: client, - nextWait: initAction, - } - - resp, err := watcher.Next(context.Background()) - if err != nil { - t.Errorf("non-nil error: %#v", err) - } - - if !reflect.DeepEqual(wantResponse, resp) { - t.Errorf("received incorrect Response: want=%#v got=%#v", wantResponse, resp) - } - - if !reflect.DeepEqual(wantNextWait, watcher.nextWait) { - t.Errorf("nextWait incorrect: want=%#v got=%#v", wantNextWait, watcher.nextWait) - } -} - -func TestHTTPWatcherNextFail(t *testing.T) { - tests := []httpClient{ - // generic HTTP client failure - &staticHTTPClient{ - err: errors.New("fail!"), - }, - - // unusable status code - &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusTeapot, - }, - }, - - // etcd Error response - &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusNotFound, - }, - body: []byte(`{"errorCode":100,"message":"Key not found","cause":"/foo","index":18}`), - }, - } - - for i, tt := range tests { - act := waitAction{ - Prefix: "/pants", - Key: "/foo/bar", - Recursive: true, - WaitIndex: 19, - } - - watcher := &httpWatcher{ - client: tt, - nextWait: act, - } - - resp, err := watcher.Next(context.Background()) - if err == nil { - t.Errorf("#%d: expected non-nil error", i) - } - if resp != nil { - t.Errorf("#%d: expected nil Response, got %#v", i, resp) - } - if !reflect.DeepEqual(act, watcher.nextWait) { - t.Errorf("#%d: nextWait changed: want=%#v got=%#v", i, act, watcher.nextWait) - } - } -} - -func TestHTTPKeysAPIWatcherAction(t *testing.T) { - tests := []struct { - key string - opts *WatcherOptions - want waitAction - }{ - { - key: "/foo", - opts: nil, - want: waitAction{ - Key: "/foo", - Recursive: false, - WaitIndex: 0, - }, - }, - - { - key: "/foo", - opts: &WatcherOptions{ - Recursive: false, - AfterIndex: 0, - }, - want: waitAction{ - Key: "/foo", - Recursive: false, - WaitIndex: 0, - }, - }, - - { - key: "/foo", - opts: &WatcherOptions{ - Recursive: true, - AfterIndex: 0, - }, - want: waitAction{ - Key: "/foo", - Recursive: true, - WaitIndex: 0, - }, - }, - - { - key: "/foo", - opts: &WatcherOptions{ - Recursive: false, - AfterIndex: 19, - }, - want: waitAction{ - Key: "/foo", - Recursive: false, - WaitIndex: 20, - }, - }, - } - - for i, tt := range tests { - kAPI := &httpKeysAPI{ - client: &staticHTTPClient{err: errors.New("fail!")}, - } - - want := &httpWatcher{ - client: &staticHTTPClient{err: errors.New("fail!")}, - nextWait: tt.want, - } - - got := kAPI.Watcher(tt.key, tt.opts) - if !reflect.DeepEqual(want, got) { - t.Errorf("#%d: incorrect watcher: want=%#v got=%#v", i, want, got) - } - } -} - -func TestHTTPKeysAPISetAction(t *testing.T) { - tests := []struct { - key string - value string - opts *SetOptions - wantAction httpAction - }{ - // nil SetOptions - { - key: "/foo", - value: "bar", - opts: nil, - wantAction: &setAction{ - Key: "/foo", - Value: "bar", - PrevValue: "", - PrevIndex: 0, - PrevExist: PrevIgnore, - TTL: 0, - }, - }, - // empty SetOptions - { - key: "/foo", - value: "bar", - opts: &SetOptions{}, - wantAction: &setAction{ - Key: "/foo", - Value: "bar", - PrevValue: "", - PrevIndex: 0, - PrevExist: PrevIgnore, - TTL: 0, - }, - }, - // populated SetOptions - { - key: "/foo", - value: "bar", - opts: &SetOptions{ - PrevValue: "baz", - PrevIndex: 13, - PrevExist: PrevExist, - TTL: time.Minute, - Dir: true, - }, - wantAction: &setAction{ - Key: "/foo", - Value: "bar", - PrevValue: "baz", - PrevIndex: 13, - PrevExist: PrevExist, - TTL: time.Minute, - Dir: true, - }, - }, - } - - for i, tt := range tests { - client := &actionAssertingHTTPClient{t: t, num: i, act: tt.wantAction} - kAPI := httpKeysAPI{client: client} - kAPI.Set(context.Background(), tt.key, tt.value, tt.opts) - } -} - -func TestHTTPKeysAPISetError(t *testing.T) { - tests := []httpClient{ - // generic HTTP client failure - &staticHTTPClient{ - err: errors.New("fail!"), - }, - - // unusable status code - &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusTeapot, - }, - }, - - // etcd Error response - &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusInternalServerError, - }, - body: []byte(`{"errorCode":300,"message":"Raft internal error","cause":"/foo","index":18}`), - }, - } - - for i, tt := range tests { - kAPI := httpKeysAPI{client: tt} - resp, err := kAPI.Set(context.Background(), "/foo", "bar", nil) - if err == nil { - t.Errorf("#%d: received nil error", i) - } - if resp != nil { - t.Errorf("#%d: received non-nil Response: %#v", i, resp) - } - } -} - -func TestHTTPKeysAPISetResponse(t *testing.T) { - client := &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusOK, - Header: http.Header{"X-Etcd-Index": []string{"21"}}, - }, - body: []byte(`{"action":"set","node":{"key":"/pants/foo/bar/baz","value":"snarf","modifiedIndex":21,"createdIndex":21},"prevNode":{"key":"/pants/foo/bar/baz","value":"snazz","modifiedIndex":20,"createdIndex":19}}`), - } - - wantResponse := &Response{ - Action: "set", - Node: &Node{Key: "/pants/foo/bar/baz", Value: "snarf", CreatedIndex: uint64(21), ModifiedIndex: uint64(21)}, - PrevNode: &Node{Key: "/pants/foo/bar/baz", Value: "snazz", CreatedIndex: uint64(19), ModifiedIndex: uint64(20)}, - Index: uint64(21), - } - - kAPI := &httpKeysAPI{client: client, prefix: "/pants"} - resp, err := kAPI.Set(context.Background(), "/foo/bar/baz", "snarf", nil) - if err != nil { - t.Errorf("non-nil error: %#v", err) - } - if !reflect.DeepEqual(wantResponse, resp) { - t.Errorf("incorrect Response: want=%#v got=%#v", wantResponse, resp) - } -} - -func TestHTTPKeysAPIGetAction(t *testing.T) { - tests := []struct { - key string - opts *GetOptions - wantAction httpAction - }{ - // nil GetOptions - { - key: "/foo", - opts: nil, - wantAction: &getAction{ - Key: "/foo", - Sorted: false, - Recursive: false, - }, - }, - // empty GetOptions - { - key: "/foo", - opts: &GetOptions{}, - wantAction: &getAction{ - Key: "/foo", - Sorted: false, - Recursive: false, - }, - }, - // populated GetOptions - { - key: "/foo", - opts: &GetOptions{ - Sort: true, - Recursive: true, - Quorum: true, - }, - wantAction: &getAction{ - Key: "/foo", - Sorted: true, - Recursive: true, - Quorum: true, - }, - }, - } - - for i, tt := range tests { - client := &actionAssertingHTTPClient{t: t, num: i, act: tt.wantAction} - kAPI := httpKeysAPI{client: client} - kAPI.Get(context.Background(), tt.key, tt.opts) - } -} - -func TestHTTPKeysAPIGetError(t *testing.T) { - tests := []httpClient{ - // generic HTTP client failure - &staticHTTPClient{ - err: errors.New("fail!"), - }, - - // unusable status code - &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusTeapot, - }, - }, - - // etcd Error response - &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusInternalServerError, - }, - body: []byte(`{"errorCode":300,"message":"Raft internal error","cause":"/foo","index":18}`), - }, - } - - for i, tt := range tests { - kAPI := httpKeysAPI{client: tt} - resp, err := kAPI.Get(context.Background(), "/foo", nil) - if err == nil { - t.Errorf("#%d: received nil error", i) - } - if resp != nil { - t.Errorf("#%d: received non-nil Response: %#v", i, resp) - } - } -} - -func TestHTTPKeysAPIGetResponse(t *testing.T) { - client := &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusOK, - Header: http.Header{"X-Etcd-Index": []string{"42"}}, - }, - body: []byte(`{"action":"get","node":{"key":"/pants/foo/bar","modifiedIndex":25,"createdIndex":19,"nodes":[{"key":"/pants/foo/bar/baz","value":"snarf","createdIndex":21,"modifiedIndex":25}]}}`), - } - - wantResponse := &Response{ - Action: "get", - Node: &Node{ - Key: "/pants/foo/bar", - Nodes: []*Node{ - {Key: "/pants/foo/bar/baz", Value: "snarf", CreatedIndex: 21, ModifiedIndex: 25}, - }, - CreatedIndex: uint64(19), - ModifiedIndex: uint64(25), - }, - Index: uint64(42), - } - - kAPI := &httpKeysAPI{client: client, prefix: "/pants"} - resp, err := kAPI.Get(context.Background(), "/foo/bar", &GetOptions{Recursive: true}) - if err != nil { - t.Errorf("non-nil error: %#v", err) - } - if !reflect.DeepEqual(wantResponse, resp) { - t.Errorf("incorrect Response: want=%#v got=%#v", wantResponse, resp) - } -} - -func TestHTTPKeysAPIDeleteAction(t *testing.T) { - tests := []struct { - key string - value string - opts *DeleteOptions - wantAction httpAction - }{ - // nil DeleteOptions - { - key: "/foo", - opts: nil, - wantAction: &deleteAction{ - Key: "/foo", - PrevValue: "", - PrevIndex: 0, - Recursive: false, - }, - }, - // empty DeleteOptions - { - key: "/foo", - opts: &DeleteOptions{}, - wantAction: &deleteAction{ - Key: "/foo", - PrevValue: "", - PrevIndex: 0, - Recursive: false, - }, - }, - // populated DeleteOptions - { - key: "/foo", - opts: &DeleteOptions{ - PrevValue: "baz", - PrevIndex: 13, - Recursive: true, - }, - wantAction: &deleteAction{ - Key: "/foo", - PrevValue: "baz", - PrevIndex: 13, - Recursive: true, - }, - }, - } - - for i, tt := range tests { - client := &actionAssertingHTTPClient{t: t, num: i, act: tt.wantAction} - kAPI := httpKeysAPI{client: client} - kAPI.Delete(context.Background(), tt.key, tt.opts) - } -} - -func TestHTTPKeysAPIDeleteError(t *testing.T) { - tests := []httpClient{ - // generic HTTP client failure - &staticHTTPClient{ - err: errors.New("fail!"), - }, - - // unusable status code - &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusTeapot, - }, - }, - - // etcd Error response - &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusInternalServerError, - }, - body: []byte(`{"errorCode":300,"message":"Raft internal error","cause":"/foo","index":18}`), - }, - } - - for i, tt := range tests { - kAPI := httpKeysAPI{client: tt} - resp, err := kAPI.Delete(context.Background(), "/foo", nil) - if err == nil { - t.Errorf("#%d: received nil error", i) - } - if resp != nil { - t.Errorf("#%d: received non-nil Response: %#v", i, resp) - } - } -} - -func TestHTTPKeysAPIDeleteResponse(t *testing.T) { - client := &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusOK, - Header: http.Header{"X-Etcd-Index": []string{"22"}}, - }, - body: []byte(`{"action":"delete","node":{"key":"/pants/foo/bar/baz","value":"snarf","modifiedIndex":22,"createdIndex":19},"prevNode":{"key":"/pants/foo/bar/baz","value":"snazz","modifiedIndex":20,"createdIndex":19}}`), - } - - wantResponse := &Response{ - Action: "delete", - Node: &Node{Key: "/pants/foo/bar/baz", Value: "snarf", CreatedIndex: uint64(19), ModifiedIndex: uint64(22)}, - PrevNode: &Node{Key: "/pants/foo/bar/baz", Value: "snazz", CreatedIndex: uint64(19), ModifiedIndex: uint64(20)}, - Index: uint64(22), - } - - kAPI := &httpKeysAPI{client: client, prefix: "/pants"} - resp, err := kAPI.Delete(context.Background(), "/foo/bar/baz", nil) - if err != nil { - t.Errorf("non-nil error: %#v", err) - } - if !reflect.DeepEqual(wantResponse, resp) { - t.Errorf("incorrect Response: want=%#v got=%#v", wantResponse, resp) - } -} - -func TestHTTPKeysAPICreateAction(t *testing.T) { - act := &setAction{ - Key: "/foo", - Value: "bar", - PrevExist: PrevNoExist, - PrevIndex: 0, - PrevValue: "", - TTL: 0, - } - - kAPI := httpKeysAPI{client: &actionAssertingHTTPClient{t: t, act: act}} - kAPI.Create(context.Background(), "/foo", "bar") -} - -func TestHTTPKeysAPICreateInOrderAction(t *testing.T) { - act := &createInOrderAction{ - Dir: "/foo", - Value: "bar", - TTL: 0, - } - kAPI := httpKeysAPI{client: &actionAssertingHTTPClient{t: t, act: act}} - kAPI.CreateInOrder(context.Background(), "/foo", "bar", nil) -} - -func TestHTTPKeysAPIUpdateAction(t *testing.T) { - act := &setAction{ - Key: "/foo", - Value: "bar", - PrevExist: PrevExist, - PrevIndex: 0, - PrevValue: "", - TTL: 0, - } - - kAPI := httpKeysAPI{client: &actionAssertingHTTPClient{t: t, act: act}} - kAPI.Update(context.Background(), "/foo", "bar") -} - -func TestNodeTTLDuration(t *testing.T) { - tests := []struct { - node *Node - want time.Duration - }{ - { - node: &Node{TTL: 0}, - want: 0, - }, - { - node: &Node{TTL: 97}, - want: 97 * time.Second, - }, - } - - for i, tt := range tests { - got := tt.node.TTLDuration() - if tt.want != got { - t.Errorf("#%d: incorrect duration: want=%v got=%v", i, tt.want, got) - } - } -} diff --git a/vendor/github.com/coreos/etcd/client/members_test.go b/vendor/github.com/coreos/etcd/client/members_test.go deleted file mode 100644 index 494e2dc562..0000000000 --- a/vendor/github.com/coreos/etcd/client/members_test.go +++ /dev/null @@ -1,599 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package client - -import ( - "encoding/json" - "errors" - "net/http" - "net/url" - "reflect" - "testing" - - "github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context" - - "github.com/coreos/etcd/pkg/types" -) - -func TestMembersAPIActionList(t *testing.T) { - ep := url.URL{Scheme: "http", Host: "example.com"} - act := &membersAPIActionList{} - - wantURL := &url.URL{ - Scheme: "http", - Host: "example.com", - Path: "/v2/members", - } - - got := *act.HTTPRequest(ep) - err := assertRequest(got, "GET", wantURL, http.Header{}, nil) - if err != nil { - t.Error(err.Error()) - } -} - -func TestMembersAPIActionAdd(t *testing.T) { - ep := url.URL{Scheme: "http", Host: "example.com"} - act := &membersAPIActionAdd{ - peerURLs: types.URLs([]url.URL{ - {Scheme: "https", Host: "127.0.0.1:8081"}, - {Scheme: "http", Host: "127.0.0.1:8080"}, - }), - } - - wantURL := &url.URL{ - Scheme: "http", - Host: "example.com", - Path: "/v2/members", - } - wantHeader := http.Header{ - "Content-Type": []string{"application/json"}, - } - wantBody := []byte(`{"peerURLs":["https://127.0.0.1:8081","http://127.0.0.1:8080"]}`) - - got := *act.HTTPRequest(ep) - err := assertRequest(got, "POST", wantURL, wantHeader, wantBody) - if err != nil { - t.Error(err.Error()) - } -} - -func TestMembersAPIActionUpdate(t *testing.T) { - ep := url.URL{Scheme: "http", Host: "example.com"} - act := &membersAPIActionUpdate{ - memberID: "0xabcd", - peerURLs: types.URLs([]url.URL{ - {Scheme: "https", Host: "127.0.0.1:8081"}, - {Scheme: "http", Host: "127.0.0.1:8080"}, - }), - } - - wantURL := &url.URL{ - Scheme: "http", - Host: "example.com", - Path: "/v2/members/0xabcd", - } - wantHeader := http.Header{ - "Content-Type": []string{"application/json"}, - } - wantBody := []byte(`{"peerURLs":["https://127.0.0.1:8081","http://127.0.0.1:8080"]}`) - - got := *act.HTTPRequest(ep) - err := assertRequest(got, "PUT", wantURL, wantHeader, wantBody) - if err != nil { - t.Error(err.Error()) - } -} - -func TestMembersAPIActionRemove(t *testing.T) { - ep := url.URL{Scheme: "http", Host: "example.com"} - act := &membersAPIActionRemove{memberID: "XXX"} - - wantURL := &url.URL{ - Scheme: "http", - Host: "example.com", - Path: "/v2/members/XXX", - } - - got := *act.HTTPRequest(ep) - err := assertRequest(got, "DELETE", wantURL, http.Header{}, nil) - if err != nil { - t.Error(err.Error()) - } -} - -func TestMembersAPIActionLeader(t *testing.T) { - ep := url.URL{Scheme: "http", Host: "example.com"} - act := &membersAPIActionLeader{} - - wantURL := &url.URL{ - Scheme: "http", - Host: "example.com", - Path: "/v2/members/leader", - } - - got := *act.HTTPRequest(ep) - err := assertRequest(got, "GET", wantURL, http.Header{}, nil) - if err != nil { - t.Error(err.Error()) - } -} - -func TestAssertStatusCode(t *testing.T) { - if err := assertStatusCode(404, 400); err == nil { - t.Errorf("assertStatusCode failed to detect conflict in 400 vs 404") - } - - if err := assertStatusCode(404, 400, 404); err != nil { - t.Errorf("assertStatusCode found conflict in (404,400) vs 400: %v", err) - } -} - -func TestV2MembersURL(t *testing.T) { - got := v2MembersURL(url.URL{ - Scheme: "http", - Host: "foo.example.com:4002", - Path: "/pants", - }) - want := &url.URL{ - Scheme: "http", - Host: "foo.example.com:4002", - Path: "/pants/v2/members", - } - - if !reflect.DeepEqual(want, got) { - t.Fatalf("v2MembersURL got %#v, want %#v", got, want) - } -} - -func TestMemberUnmarshal(t *testing.T) { - tests := []struct { - body []byte - wantMember Member - wantError bool - }{ - // no URLs, just check ID & Name - { - body: []byte(`{"id": "c", "name": "dungarees"}`), - wantMember: Member{ID: "c", Name: "dungarees", PeerURLs: nil, ClientURLs: nil}, - }, - - // both client and peer URLs - { - body: []byte(`{"peerURLs": ["http://127.0.0.1:2379"], "clientURLs": ["http://127.0.0.1:2379"]}`), - wantMember: Member{ - PeerURLs: []string{ - "http://127.0.0.1:2379", - }, - ClientURLs: []string{ - "http://127.0.0.1:2379", - }, - }, - }, - - // multiple peer URLs - { - body: []byte(`{"peerURLs": ["http://127.0.0.1:2379", "https://example.com"]}`), - wantMember: Member{ - PeerURLs: []string{ - "http://127.0.0.1:2379", - "https://example.com", - }, - ClientURLs: nil, - }, - }, - - // multiple client URLs - { - body: []byte(`{"clientURLs": ["http://127.0.0.1:2379", "https://example.com"]}`), - wantMember: Member{ - PeerURLs: nil, - ClientURLs: []string{ - "http://127.0.0.1:2379", - "https://example.com", - }, - }, - }, - - // invalid JSON - { - body: []byte(`{"peerU`), - wantError: true, - }, - } - - for i, tt := range tests { - got := Member{} - err := json.Unmarshal(tt.body, &got) - if tt.wantError != (err != nil) { - t.Errorf("#%d: want error %t, got %v", i, tt.wantError, err) - continue - } - - if !reflect.DeepEqual(tt.wantMember, got) { - t.Errorf("#%d: incorrect output: want=%#v, got=%#v", i, tt.wantMember, got) - } - } -} - -func TestMemberCollectionUnmarshalFail(t *testing.T) { - mc := &memberCollection{} - if err := mc.UnmarshalJSON([]byte(`{`)); err == nil { - t.Errorf("got nil error") - } -} - -func TestMemberCollectionUnmarshal(t *testing.T) { - tests := []struct { - body []byte - want memberCollection - }{ - { - body: []byte(`{}`), - want: memberCollection([]Member{}), - }, - { - body: []byte(`{"members":[]}`), - want: memberCollection([]Member{}), - }, - { - body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`), - want: memberCollection( - []Member{ - { - ID: "2745e2525fce8fe", - Name: "node3", - PeerURLs: []string{ - "http://127.0.0.1:7003", - }, - ClientURLs: []string{ - "http://127.0.0.1:4003", - }, - }, - { - ID: "42134f434382925", - Name: "node1", - PeerURLs: []string{ - "http://127.0.0.1:2380", - "http://127.0.0.1:7001", - }, - ClientURLs: []string{ - "http://127.0.0.1:2379", - "http://127.0.0.1:4001", - }, - }, - { - ID: "94088180e21eb87b", - Name: "node2", - PeerURLs: []string{ - "http://127.0.0.1:7002", - }, - ClientURLs: []string{ - "http://127.0.0.1:4002", - }, - }, - }, - ), - }, - } - - for i, tt := range tests { - var got memberCollection - err := json.Unmarshal(tt.body, &got) - if err != nil { - t.Errorf("#%d: unexpected error: %v", i, err) - continue - } - - if !reflect.DeepEqual(tt.want, got) { - t.Errorf("#%d: incorrect output: want=%#v, got=%#v", i, tt.want, got) - } - } -} - -func TestMemberCreateRequestMarshal(t *testing.T) { - req := memberCreateOrUpdateRequest{ - PeerURLs: types.URLs([]url.URL{ - {Scheme: "http", Host: "127.0.0.1:8081"}, - {Scheme: "https", Host: "127.0.0.1:8080"}, - }), - } - want := []byte(`{"peerURLs":["http://127.0.0.1:8081","https://127.0.0.1:8080"]}`) - - got, err := json.Marshal(&req) - if err != nil { - t.Fatalf("Marshal returned unexpected err=%v", err) - } - - if !reflect.DeepEqual(want, got) { - t.Fatalf("Failed to marshal memberCreateRequest: want=%s, got=%s", want, got) - } -} - -func TestHTTPMembersAPIAddSuccess(t *testing.T) { - wantAction := &membersAPIActionAdd{ - peerURLs: types.URLs([]url.URL{ - {Scheme: "http", Host: "127.0.0.1:7002"}, - }), - } - - mAPI := &httpMembersAPI{ - client: &actionAssertingHTTPClient{ - t: t, - act: wantAction, - resp: http.Response{ - StatusCode: http.StatusCreated, - }, - body: []byte(`{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"]}`), - }, - } - - wantResponseMember := &Member{ - ID: "94088180e21eb87b", - PeerURLs: []string{"http://127.0.0.1:7002"}, - } - - m, err := mAPI.Add(context.Background(), "http://127.0.0.1:7002") - if err != nil { - t.Errorf("got non-nil err: %#v", err) - } - if !reflect.DeepEqual(wantResponseMember, m) { - t.Errorf("incorrect Member: want=%#v got=%#v", wantResponseMember, m) - } -} - -func TestHTTPMembersAPIAddError(t *testing.T) { - okPeer := "http://example.com:2379" - tests := []struct { - peerURL string - client httpClient - - // if wantErr == nil, assert that the returned error is non-nil - // if wantErr != nil, assert that the returned error matches - wantErr error - }{ - // malformed peer URL - { - peerURL: ":", - }, - - // generic httpClient failure - { - peerURL: okPeer, - client: &staticHTTPClient{err: errors.New("fail!")}, - }, - - // unrecognized HTTP status code - { - peerURL: okPeer, - client: &staticHTTPClient{ - resp: http.Response{StatusCode: http.StatusTeapot}, - }, - }, - - // unmarshal body into membersError on StatusConflict - { - peerURL: okPeer, - client: &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusConflict, - }, - body: []byte(`{"message":"fail!"}`), - }, - wantErr: membersError{Message: "fail!"}, - }, - - // fail to unmarshal body on StatusConflict - { - peerURL: okPeer, - client: &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusConflict, - }, - body: []byte(`{"`), - }, - }, - - // fail to unmarshal body on StatusCreated - { - peerURL: okPeer, - client: &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusCreated, - }, - body: []byte(`{"id":"XX`), - }, - }, - } - - for i, tt := range tests { - mAPI := &httpMembersAPI{client: tt.client} - m, err := mAPI.Add(context.Background(), tt.peerURL) - if err == nil { - t.Errorf("#%d: got nil err", i) - } - if tt.wantErr != nil && !reflect.DeepEqual(tt.wantErr, err) { - t.Errorf("#%d: incorrect error: want=%#v got=%#v", i, tt.wantErr, err) - } - if m != nil { - t.Errorf("#%d: got non-nil Member", i) - } - } -} - -func TestHTTPMembersAPIRemoveSuccess(t *testing.T) { - wantAction := &membersAPIActionRemove{ - memberID: "94088180e21eb87b", - } - - mAPI := &httpMembersAPI{ - client: &actionAssertingHTTPClient{ - t: t, - act: wantAction, - resp: http.Response{ - StatusCode: http.StatusNoContent, - }, - }, - } - - if err := mAPI.Remove(context.Background(), "94088180e21eb87b"); err != nil { - t.Errorf("got non-nil err: %#v", err) - } -} - -func TestHTTPMembersAPIRemoveFail(t *testing.T) { - tests := []httpClient{ - // generic error - &staticHTTPClient{ - err: errors.New("fail!"), - }, - - // unexpected HTTP status code - &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusInternalServerError, - }, - }, - } - - for i, tt := range tests { - mAPI := &httpMembersAPI{client: tt} - if err := mAPI.Remove(context.Background(), "94088180e21eb87b"); err == nil { - t.Errorf("#%d: got nil err", i) - } - } -} - -func TestHTTPMembersAPIListSuccess(t *testing.T) { - wantAction := &membersAPIActionList{} - mAPI := &httpMembersAPI{ - client: &actionAssertingHTTPClient{ - t: t, - act: wantAction, - resp: http.Response{ - StatusCode: http.StatusOK, - }, - body: []byte(`{"members":[{"id":"94088180e21eb87b","name":"node2","peerURLs":["http://127.0.0.1:7002"],"clientURLs":["http://127.0.0.1:4002"]}]}`), - }, - } - - wantResponseMembers := []Member{ - { - ID: "94088180e21eb87b", - Name: "node2", - PeerURLs: []string{"http://127.0.0.1:7002"}, - ClientURLs: []string{"http://127.0.0.1:4002"}, - }, - } - - m, err := mAPI.List(context.Background()) - if err != nil { - t.Errorf("got non-nil err: %#v", err) - } - if !reflect.DeepEqual(wantResponseMembers, m) { - t.Errorf("incorrect Members: want=%#v got=%#v", wantResponseMembers, m) - } -} - -func TestHTTPMembersAPIListError(t *testing.T) { - tests := []httpClient{ - // generic httpClient failure - &staticHTTPClient{err: errors.New("fail!")}, - - // unrecognized HTTP status code - &staticHTTPClient{ - resp: http.Response{StatusCode: http.StatusTeapot}, - }, - - // fail to unmarshal body on StatusOK - &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusOK, - }, - body: []byte(`[{"id":"XX`), - }, - } - - for i, tt := range tests { - mAPI := &httpMembersAPI{client: tt} - ms, err := mAPI.List(context.Background()) - if err == nil { - t.Errorf("#%d: got nil err", i) - } - if ms != nil { - t.Errorf("#%d: got non-nil Member slice", i) - } - } -} - -func TestHTTPMembersAPILeaderSuccess(t *testing.T) { - wantAction := &membersAPIActionLeader{} - mAPI := &httpMembersAPI{ - client: &actionAssertingHTTPClient{ - t: t, - act: wantAction, - resp: http.Response{ - StatusCode: http.StatusOK, - }, - body: []byte(`{"id":"94088180e21eb87b","name":"node2","peerURLs":["http://127.0.0.1:7002"],"clientURLs":["http://127.0.0.1:4002"]}`), - }, - } - - wantResponseMember := &Member{ - ID: "94088180e21eb87b", - Name: "node2", - PeerURLs: []string{"http://127.0.0.1:7002"}, - ClientURLs: []string{"http://127.0.0.1:4002"}, - } - - m, err := mAPI.Leader(context.Background()) - if err != nil { - t.Errorf("err = %v, want %v", err, nil) - } - if !reflect.DeepEqual(wantResponseMember, m) { - t.Errorf("incorrect member: member = %v, want %v", wantResponseMember, m) - } -} - -func TestHTTPMembersAPILeaderError(t *testing.T) { - tests := []httpClient{ - // generic httpClient failure - &staticHTTPClient{err: errors.New("fail!")}, - - // unrecognized HTTP status code - &staticHTTPClient{ - resp: http.Response{StatusCode: http.StatusTeapot}, - }, - - // fail to unmarshal body on StatusOK - &staticHTTPClient{ - resp: http.Response{ - StatusCode: http.StatusOK, - }, - body: []byte(`[{"id":"XX`), - }, - } - - for i, tt := range tests { - mAPI := &httpMembersAPI{client: tt} - m, err := mAPI.Leader(context.Background()) - if err == nil { - t.Errorf("#%d: err = nil, want not nil", i) - } - if m != nil { - t.Errorf("member slice = %v, want nil", m) - } - } -} diff --git a/vendor/github.com/coreos/etcd/client/srv_test.go b/vendor/github.com/coreos/etcd/client/srv_test.go deleted file mode 100644 index 52d4a08e3a..0000000000 --- a/vendor/github.com/coreos/etcd/client/srv_test.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package client - -import ( - "errors" - "net" - "reflect" - "testing" -) - -func TestSRVDiscover(t *testing.T) { - defer func() { lookupSRV = net.LookupSRV }() - - tests := []struct { - withSSL []*net.SRV - withoutSSL []*net.SRV - expected []string - }{ - { - []*net.SRV{}, - []*net.SRV{}, - []string{}, - }, - { - []*net.SRV{ - {Target: "10.0.0.1", Port: 2480}, - {Target: "10.0.0.2", Port: 2480}, - {Target: "10.0.0.3", Port: 2480}, - }, - []*net.SRV{}, - []string{"https://10.0.0.1:2480", "https://10.0.0.2:2480", "https://10.0.0.3:2480"}, - }, - { - []*net.SRV{ - {Target: "10.0.0.1", Port: 2480}, - {Target: "10.0.0.2", Port: 2480}, - {Target: "10.0.0.3", Port: 2480}, - }, - []*net.SRV{ - {Target: "10.0.0.1", Port: 7001}, - }, - []string{"https://10.0.0.1:2480", "https://10.0.0.2:2480", "https://10.0.0.3:2480", "http://10.0.0.1:7001"}, - }, - { - []*net.SRV{ - {Target: "10.0.0.1", Port: 2480}, - {Target: "10.0.0.2", Port: 2480}, - {Target: "10.0.0.3", Port: 2480}, - }, - []*net.SRV{ - {Target: "10.0.0.1", Port: 7001}, - }, - []string{"https://10.0.0.1:2480", "https://10.0.0.2:2480", "https://10.0.0.3:2480", "http://10.0.0.1:7001"}, - }, - { - []*net.SRV{ - {Target: "a.example.com", Port: 2480}, - {Target: "b.example.com", Port: 2480}, - {Target: "c.example.com", Port: 2480}, - }, - []*net.SRV{}, - []string{"https://a.example.com:2480", "https://b.example.com:2480", "https://c.example.com:2480"}, - }, - } - - for i, tt := range tests { - lookupSRV = func(service string, proto string, domain string) (string, []*net.SRV, error) { - if service == "etcd-client-ssl" { - return "", tt.withSSL, nil - } - if service == "etcd-client" { - return "", tt.withoutSSL, nil - } - return "", nil, errors.New("Unknown service in mock") - } - - d := NewSRVDiscover() - - endpoints, err := d.Discover("example.com") - if err != nil { - t.Fatalf("%d: err: %#v", i, err) - } - - if !reflect.DeepEqual(endpoints, tt.expected) { - t.Errorf("#%d: endpoints = %v, want %v", i, endpoints, tt.expected) - } - - } -} diff --git a/vendor/github.com/coreos/etcd/pkg/pathutil/path_test.go b/vendor/github.com/coreos/etcd/pkg/pathutil/path_test.go deleted file mode 100644 index 6d3d803cfc..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/pathutil/path_test.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package pathutil - -import "testing" - -func TestCanonicalURLPath(t *testing.T) { - tests := []struct { - p string - wp string - }{ - {"/a", "/a"}, - {"", "/"}, - {"a", "/a"}, - {"//a", "/a"}, - {"/a/.", "/a"}, - {"/a/..", "/"}, - {"/a/", "/a/"}, - {"/a//", "/a/"}, - } - for i, tt := range tests { - if g := CanonicalURLPath(tt.p); g != tt.wp { - t.Errorf("#%d: canonical path = %s, want %s", i, g, tt.wp) - } - } -} diff --git a/vendor/github.com/coreos/etcd/pkg/types/id_test.go b/vendor/github.com/coreos/etcd/pkg/types/id_test.go deleted file mode 100644 index 97d168f58e..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/types/id_test.go +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package types - -import ( - "reflect" - "sort" - "testing" -) - -func TestIDString(t *testing.T) { - tests := []struct { - input ID - want string - }{ - { - input: 12, - want: "c", - }, - { - input: 4918257920282737594, - want: "444129853c343bba", - }, - } - - for i, tt := range tests { - got := tt.input.String() - if tt.want != got { - t.Errorf("#%d: ID.String failure: want=%v, got=%v", i, tt.want, got) - } - } -} - -func TestIDFromString(t *testing.T) { - tests := []struct { - input string - want ID - }{ - { - input: "17", - want: 23, - }, - { - input: "612840dae127353", - want: 437557308098245459, - }, - } - - for i, tt := range tests { - got, err := IDFromString(tt.input) - if err != nil { - t.Errorf("#%d: IDFromString failure: err=%v", i, err) - continue - } - if tt.want != got { - t.Errorf("#%d: IDFromString failure: want=%v, got=%v", i, tt.want, got) - } - } -} - -func TestIDFromStringFail(t *testing.T) { - tests := []string{ - "", - "XXX", - "612840dae127353612840dae127353", - } - - for i, tt := range tests { - _, err := IDFromString(tt) - if err == nil { - t.Fatalf("#%d: IDFromString expected error, but err=nil", i) - } - } -} - -func TestIDSlice(t *testing.T) { - g := []ID{10, 500, 5, 1, 100, 25} - w := []ID{1, 5, 10, 25, 100, 500} - sort.Sort(IDSlice(g)) - if !reflect.DeepEqual(g, w) { - t.Errorf("slice after sort = %#v, want %#v", g, w) - } -} diff --git a/vendor/github.com/coreos/etcd/pkg/types/set_test.go b/vendor/github.com/coreos/etcd/pkg/types/set_test.go deleted file mode 100644 index ff1ecc68d3..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/types/set_test.go +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package types - -import ( - "reflect" - "sort" - "testing" -) - -func TestUnsafeSet(t *testing.T) { - driveSetTests(t, NewUnsafeSet()) -} - -func TestThreadsafeSet(t *testing.T) { - driveSetTests(t, NewThreadsafeSet()) -} - -// Check that two slices contents are equal; order is irrelevant -func equal(a, b []string) bool { - as := sort.StringSlice(a) - bs := sort.StringSlice(b) - as.Sort() - bs.Sort() - return reflect.DeepEqual(as, bs) -} - -func driveSetTests(t *testing.T, s Set) { - // Verify operations on an empty set - eValues := []string{} - values := s.Values() - if !reflect.DeepEqual(values, eValues) { - t.Fatalf("Expect values=%v got %v", eValues, values) - } - if l := s.Length(); l != 0 { - t.Fatalf("Expected length=0, got %d", l) - } - for _, v := range []string{"foo", "bar", "baz"} { - if s.Contains(v) { - t.Fatalf("Expect s.Contains(%q) to be fale, got true", v) - } - } - - // Add three items, ensure they show up - s.Add("foo") - s.Add("bar") - s.Add("baz") - - eValues = []string{"foo", "bar", "baz"} - values = s.Values() - if !equal(values, eValues) { - t.Fatalf("Expect values=%v got %v", eValues, values) - } - - for _, v := range eValues { - if !s.Contains(v) { - t.Fatalf("Expect s.Contains(%q) to be true, got false", v) - } - } - - if l := s.Length(); l != 3 { - t.Fatalf("Expected length=3, got %d", l) - } - - // Add the same item a second time, ensuring it is not duplicated - s.Add("foo") - - values = s.Values() - if !equal(values, eValues) { - t.Fatalf("Expect values=%v got %v", eValues, values) - } - if l := s.Length(); l != 3 { - t.Fatalf("Expected length=3, got %d", l) - } - - // Remove all items, ensure they are gone - s.Remove("foo") - s.Remove("bar") - s.Remove("baz") - - eValues = []string{} - values = s.Values() - if !equal(values, eValues) { - t.Fatalf("Expect values=%v got %v", eValues, values) - } - - if l := s.Length(); l != 0 { - t.Fatalf("Expected length=0, got %d", l) - } - - // Create new copies of the set, and ensure they are unlinked to the - // original Set by making modifications - s.Add("foo") - s.Add("bar") - cp1 := s.Copy() - cp2 := s.Copy() - s.Remove("foo") - cp3 := s.Copy() - cp1.Add("baz") - - for i, tt := range []struct { - want []string - got []string - }{ - {[]string{"bar"}, s.Values()}, - {[]string{"foo", "bar", "baz"}, cp1.Values()}, - {[]string{"foo", "bar"}, cp2.Values()}, - {[]string{"bar"}, cp3.Values()}, - } { - if !equal(tt.want, tt.got) { - t.Fatalf("case %d: expect values=%v got %v", i, tt.want, tt.got) - } - } - - for i, tt := range []struct { - want bool - got bool - }{ - {true, s.Equals(cp3)}, - {true, cp3.Equals(s)}, - {false, s.Equals(cp2)}, - {false, s.Equals(cp1)}, - {false, cp1.Equals(s)}, - {false, cp2.Equals(s)}, - {false, cp2.Equals(cp1)}, - } { - if tt.got != tt.want { - t.Fatalf("case %d: want %t, got %t", i, tt.want, tt.got) - - } - } - - // Subtract values from a Set, ensuring a new Set is created and - // the original Sets are unmodified - sub1 := cp1.Sub(s) - sub2 := cp2.Sub(cp1) - - for i, tt := range []struct { - want []string - got []string - }{ - {[]string{"foo", "bar", "baz"}, cp1.Values()}, - {[]string{"foo", "bar"}, cp2.Values()}, - {[]string{"bar"}, s.Values()}, - {[]string{"foo", "baz"}, sub1.Values()}, - {[]string{}, sub2.Values()}, - } { - if !equal(tt.want, tt.got) { - t.Fatalf("case %d: expect values=%v got %v", i, tt.want, tt.got) - } - } -} - -func TestUnsafeSetContainsAll(t *testing.T) { - vals := []string{"foo", "bar", "baz"} - s := NewUnsafeSet(vals...) - - tests := []struct { - strs []string - wcontain bool - }{ - {[]string{}, true}, - {vals[:1], true}, - {vals[:2], true}, - {vals, true}, - {[]string{"cuz"}, false}, - {[]string{vals[0], "cuz"}, false}, - } - for i, tt := range tests { - if g := s.ContainsAll(tt.strs); g != tt.wcontain { - t.Errorf("#%d: ok = %v, want %v", i, g, tt.wcontain) - } - } -} diff --git a/vendor/github.com/coreos/etcd/pkg/types/slice_test.go b/vendor/github.com/coreos/etcd/pkg/types/slice_test.go deleted file mode 100644 index 95e37e04d2..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/types/slice_test.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package types - -import ( - "reflect" - "sort" - "testing" -) - -func TestUint64Slice(t *testing.T) { - g := Uint64Slice{10, 500, 5, 1, 100, 25} - w := Uint64Slice{1, 5, 10, 25, 100, 500} - sort.Sort(g) - if !reflect.DeepEqual(g, w) { - t.Errorf("slice after sort = %#v, want %#v", g, w) - } -} diff --git a/vendor/github.com/coreos/etcd/pkg/types/urls_test.go b/vendor/github.com/coreos/etcd/pkg/types/urls_test.go deleted file mode 100644 index ffa2cf007b..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/types/urls_test.go +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package types - -import ( - "reflect" - "testing" - - "github.com/coreos/etcd/pkg/testutil" -) - -func TestNewURLs(t *testing.T) { - tests := []struct { - strs []string - wurls URLs - }{ - { - []string{"http://127.0.0.1:2379"}, - testutil.MustNewURLs(t, []string{"http://127.0.0.1:2379"}), - }, - // it can trim space - { - []string{" http://127.0.0.1:2379 "}, - testutil.MustNewURLs(t, []string{"http://127.0.0.1:2379"}), - }, - // it does sort - { - []string{ - "http://127.0.0.2:2379", - "http://127.0.0.1:2379", - }, - testutil.MustNewURLs(t, []string{ - "http://127.0.0.1:2379", - "http://127.0.0.2:2379", - }), - }, - } - for i, tt := range tests { - urls, _ := NewURLs(tt.strs) - if !reflect.DeepEqual(urls, tt.wurls) { - t.Errorf("#%d: urls = %+v, want %+v", i, urls, tt.wurls) - } - } -} - -func TestURLsString(t *testing.T) { - tests := []struct { - us URLs - wstr string - }{ - { - URLs{}, - "", - }, - { - testutil.MustNewURLs(t, []string{"http://127.0.0.1:2379"}), - "http://127.0.0.1:2379", - }, - { - testutil.MustNewURLs(t, []string{ - "http://127.0.0.1:2379", - "http://127.0.0.2:2379", - }), - "http://127.0.0.1:2379,http://127.0.0.2:2379", - }, - { - testutil.MustNewURLs(t, []string{ - "http://127.0.0.2:2379", - "http://127.0.0.1:2379", - }), - "http://127.0.0.2:2379,http://127.0.0.1:2379", - }, - } - for i, tt := range tests { - g := tt.us.String() - if g != tt.wstr { - t.Errorf("#%d: string = %s, want %s", i, g, tt.wstr) - } - } -} - -func TestURLsSort(t *testing.T) { - g := testutil.MustNewURLs(t, []string{ - "http://127.0.0.4:2379", - "http://127.0.0.2:2379", - "http://127.0.0.1:2379", - "http://127.0.0.3:2379", - }) - w := testutil.MustNewURLs(t, []string{ - "http://127.0.0.1:2379", - "http://127.0.0.2:2379", - "http://127.0.0.3:2379", - "http://127.0.0.4:2379", - }) - gurls := URLs(g) - gurls.Sort() - if !reflect.DeepEqual(g, w) { - t.Errorf("URLs after sort = %#v, want %#v", g, w) - } -} - -func TestURLsStringSlice(t *testing.T) { - tests := []struct { - us URLs - wstr []string - }{ - { - URLs{}, - []string{}, - }, - { - testutil.MustNewURLs(t, []string{"http://127.0.0.1:2379"}), - []string{"http://127.0.0.1:2379"}, - }, - { - testutil.MustNewURLs(t, []string{ - "http://127.0.0.1:2379", - "http://127.0.0.2:2379", - }), - []string{"http://127.0.0.1:2379", "http://127.0.0.2:2379"}, - }, - { - testutil.MustNewURLs(t, []string{ - "http://127.0.0.2:2379", - "http://127.0.0.1:2379", - }), - []string{"http://127.0.0.2:2379", "http://127.0.0.1:2379"}, - }, - } - for i, tt := range tests { - g := tt.us.StringSlice() - if !reflect.DeepEqual(g, tt.wstr) { - t.Errorf("#%d: string slice = %+v, want %+v", i, g, tt.wstr) - } - } -} - -func TestNewURLsFail(t *testing.T) { - tests := [][]string{ - // no urls given - {}, - // missing protocol scheme - {"://127.0.0.1:2379"}, - // unsupported scheme - {"mailto://127.0.0.1:2379"}, - // not conform to host:port - {"http://127.0.0.1"}, - // contain a path - {"http://127.0.0.1:2379/path"}, - } - for i, tt := range tests { - _, err := NewURLs(tt) - if err == nil { - t.Errorf("#%d: err = nil, but error", i) - } - } -} diff --git a/vendor/github.com/coreos/etcd/pkg/types/urlsmap_go15_test.go b/vendor/github.com/coreos/etcd/pkg/types/urlsmap_go15_test.go deleted file mode 100644 index 1955bb9cb1..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/types/urlsmap_go15_test.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build go1.5 - -package types - -import ( - "reflect" - "testing" - - "github.com/coreos/etcd/pkg/testutil" -) - -// This is only tested in Go1.5+ because Go1.4 doesn't support literal IPv6 address with zone in -// URI (https://github.com/golang/go/issues/6530). -func TestNewURLsMapIPV6(t *testing.T) { - c, err := NewURLsMap("mem1=http://[2001:db8::1]:2380,mem1=http://[fe80::6e40:8ff:feb1:58e4%25en0]:2380,mem2=http://[fe80::92e2:baff:fe7c:3224%25ext0]:2380") - if err != nil { - t.Fatalf("unexpected parse error: %v", err) - } - wc := URLsMap(map[string]URLs{ - "mem1": testutil.MustNewURLs(t, []string{"http://[2001:db8::1]:2380", "http://[fe80::6e40:8ff:feb1:58e4%25en0]:2380"}), - "mem2": testutil.MustNewURLs(t, []string{"http://[fe80::92e2:baff:fe7c:3224%25ext0]:2380"}), - }) - if !reflect.DeepEqual(c, wc) { - t.Errorf("cluster = %#v, want %#v", c, wc) - } -} diff --git a/vendor/github.com/coreos/etcd/pkg/types/urlsmap_test.go b/vendor/github.com/coreos/etcd/pkg/types/urlsmap_test.go deleted file mode 100644 index a01b5efa97..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/types/urlsmap_test.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package types - -import ( - "reflect" - "testing" - - "github.com/coreos/etcd/pkg/testutil" -) - -func TestParseInitialCluster(t *testing.T) { - c, err := NewURLsMap("mem1=http://10.0.0.1:2379,mem1=http://128.193.4.20:2379,mem2=http://10.0.0.2:2379,default=http://127.0.0.1:2379") - if err != nil { - t.Fatalf("unexpected parse error: %v", err) - } - wc := URLsMap(map[string]URLs{ - "mem1": testutil.MustNewURLs(t, []string{"http://10.0.0.1:2379", "http://128.193.4.20:2379"}), - "mem2": testutil.MustNewURLs(t, []string{"http://10.0.0.2:2379"}), - "default": testutil.MustNewURLs(t, []string{"http://127.0.0.1:2379"}), - }) - if !reflect.DeepEqual(c, wc) { - t.Errorf("cluster = %+v, want %+v", c, wc) - } -} - -func TestParseInitialClusterBad(t *testing.T) { - tests := []string{ - // invalid URL - "%^", - // no URL defined for member - "mem1=,mem2=http://128.193.4.20:2379,mem3=http://10.0.0.2:2379", - "mem1,mem2=http://128.193.4.20:2379,mem3=http://10.0.0.2:2379", - // bad URL for member - "default=http://localhost/", - } - for i, tt := range tests { - if _, err := NewURLsMap(tt); err == nil { - t.Errorf("#%d: unexpected successful parse, want err", i) - } - } -} - -func TestNameURLPairsString(t *testing.T) { - cls := URLsMap(map[string]URLs{ - "abc": testutil.MustNewURLs(t, []string{"http://1.1.1.1:1111", "http://0.0.0.0:0000"}), - "def": testutil.MustNewURLs(t, []string{"http://2.2.2.2:2222"}), - "ghi": testutil.MustNewURLs(t, []string{"http://3.3.3.3:1234", "http://127.0.0.1:2380"}), - // no PeerURLs = not included - "four": testutil.MustNewURLs(t, []string{}), - "five": testutil.MustNewURLs(t, nil), - }) - w := "abc=http://0.0.0.0:0000,abc=http://1.1.1.1:1111,def=http://2.2.2.2:2222,ghi=http://127.0.0.1:2380,ghi=http://3.3.3.3:1234" - if g := cls.String(); g != w { - t.Fatalf("NameURLPairs.String():\ngot %#v\nwant %#v", g, w) - } -} - -func TestParse(t *testing.T) { - tests := []struct { - s string - wm map[string][]string - }{ - { - "", - map[string][]string{}, - }, - { - "a=b", - map[string][]string{"a": {"b"}}, - }, - { - "a=b,a=c", - map[string][]string{"a": {"b", "c"}}, - }, - { - "a=b,a1=c", - map[string][]string{"a": {"b"}, "a1": {"c"}}, - }, - } - for i, tt := range tests { - m := parse(tt.s) - if !reflect.DeepEqual(m, tt.wm) { - t.Errorf("#%d: m = %+v, want %+v", i, m, tt.wm) - } - } -} diff --git a/vendor/github.com/cyberdelia/heroku-go/LICENSE b/vendor/github.com/cyberdelia/heroku-go/LICENSE new file mode 100644 index 0000000000..053e74e612 --- /dev/null +++ b/vendor/github.com/cyberdelia/heroku-go/LICENSE @@ -0,0 +1,19 @@ +Copyright (©) 2014-2016 Timothée Peignier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/digitalocean/godo/account_test.go b/vendor/github.com/digitalocean/godo/account_test.go deleted file mode 100644 index 53e86ac1bf..0000000000 --- a/vendor/github.com/digitalocean/godo/account_test.go +++ /dev/null @@ -1,59 +0,0 @@ -package godo - -import ( - "fmt" - "net/http" - "reflect" - "testing" -) - -func TestAccountGet(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/account", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - - response := ` - { "account": { - "droplet_limit": 25, - "floating_ip_limit": 25, - "email": "sammy@digitalocean.com", - "uuid": "b6fr89dbf6d9156cace5f3c78dc9851d957381ef", - "email_verified": true - } - }` - - fmt.Fprint(w, response) - }) - - acct, _, err := client.Account.Get() - if err != nil { - t.Errorf("Account.Get returned error: %v", err) - } - - expected := &Account{DropletLimit: 25, FloatingIPLimit: 25, Email: "sammy@digitalocean.com", - UUID: "b6fr89dbf6d9156cace5f3c78dc9851d957381ef", EmailVerified: true} - if !reflect.DeepEqual(acct, expected) { - t.Errorf("Account.Get returned %+v, expected %+v", acct, expected) - } -} - -func TestAccountString(t *testing.T) { - acct := &Account{ - DropletLimit: 25, - FloatingIPLimit: 25, - Email: "sammy@digitalocean.com", - UUID: "b6fr89dbf6d9156cace5f3c78dc9851d957381ef", - EmailVerified: true, - Status: "active", - StatusMessage: "message", - } - - stringified := acct.String() - expected := `godo.Account{DropletLimit:25, FloatingIPLimit:25, Email:"sammy@digitalocean.com", UUID:"b6fr89dbf6d9156cace5f3c78dc9851d957381ef", EmailVerified:true, Status:"active", StatusMessage:"message"}` - if expected != stringified { - t.Errorf("Account.String returned %+v, expected %+v", stringified, expected) - } - -} diff --git a/vendor/github.com/digitalocean/godo/action_test.go b/vendor/github.com/digitalocean/godo/action_test.go deleted file mode 100644 index 9c63da03e6..0000000000 --- a/vendor/github.com/digitalocean/godo/action_test.go +++ /dev/null @@ -1,136 +0,0 @@ -package godo - -import ( - "fmt" - "net/http" - "reflect" - "testing" - "time" -) - -func TestAction_List(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/actions", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, `{"actions": [{"id":1},{"id":2}]}`) - testMethod(t, r, "GET") - }) - - actions, _, err := client.Actions.List(nil) - if err != nil { - t.Fatalf("unexpected error: %s", err) - } - - expected := []Action{{ID: 1}, {ID: 2}} - if len(actions) != len(expected) || actions[0].ID != expected[0].ID || actions[1].ID != expected[1].ID { - t.Fatalf("unexpected response") - } -} - -func TestAction_ListActionMultiplePages(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/actions", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, `{"actions": [{"id":1},{"id":2}], "links":{"pages":{"next":"http://example.com/v2/droplets/?page=2"}}}`) - testMethod(t, r, "GET") - }) - - _, resp, err := client.Actions.List(nil) - if err != nil { - t.Fatal(nil) - } - - checkCurrentPage(t, resp, 1) -} - -func TestAction_RetrievePageByNumber(t *testing.T) { - setup() - defer teardown() - - jBlob := ` - { - "actions": [{"id":1},{"id":2}], - "links":{ - "pages":{ - "next":"http://example.com/v2/actions/?page=3", - "prev":"http://example.com/v2/actions/?page=1", - "last":"http://example.com/v2/actions/?page=3", - "first":"http://example.com/v2/actions/?page=1" - } - } - }` - - mux.HandleFunc("/v2/actions", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, jBlob) - }) - - opt := &ListOptions{Page: 2} - _, resp, err := client.Actions.List(opt) - if err != nil { - t.Fatal(err) - } - - checkCurrentPage(t, resp, 2) -} - -func TestAction_Get(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/actions/12345", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, `{"action": {"id":12345,"region":{"name":"name","slug":"slug","available":true,"sizes":["512mb"],"features":["virtio"]},"region_slug":"slug"}}`) - testMethod(t, r, "GET") - }) - - action, _, err := client.Actions.Get(12345) - if err != nil { - t.Fatalf("unexpected error: %s", err) - } - - if action.ID != 12345 { - t.Fatalf("unexpected response") - } - - region := &Region{ - Name: "name", - Slug: "slug", - Available: true, - Sizes: []string{"512mb"}, - Features: []string{"virtio"}, - } - if !reflect.DeepEqual(action.Region, region) { - t.Fatalf("unexpected response, invalid region") - } - - if action.RegionSlug != "slug" { - t.Fatalf("unexpected response, invalid region slug") - } -} - -func TestAction_String(t *testing.T) { - pt, err := time.Parse(time.RFC3339, "2014-05-08T20:36:47Z") - if err != nil { - t.Fatalf("unexpected error: %s", err) - } - - startedAt := &Timestamp{ - Time: pt, - } - action := &Action{ - ID: 1, - Status: "in-progress", - Type: "transfer", - StartedAt: startedAt, - } - - stringified := action.String() - expected := `godo.Action{ID:1, Status:"in-progress", Type:"transfer", ` + - `StartedAt:godo.Timestamp{2014-05-08 20:36:47 +0000 UTC}, ` + - `ResourceID:0, ResourceType:"", RegionSlug:""}` - if expected != stringified { - t.Errorf("Action.Stringify returned %+v, expected %+v", stringified, expected) - } -} diff --git a/vendor/github.com/digitalocean/godo/domains_test.go b/vendor/github.com/digitalocean/godo/domains_test.go deleted file mode 100644 index 6dbd724786..0000000000 --- a/vendor/github.com/digitalocean/godo/domains_test.go +++ /dev/null @@ -1,340 +0,0 @@ -package godo - -import ( - "encoding/json" - "fmt" - "net/http" - "reflect" - "testing" -) - -func TestDomains_ListDomains(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/domains", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"domains": [{"name":"foo.com"},{"name":"bar.com"}]}`) - }) - - domains, _, err := client.Domains.List(nil) - if err != nil { - t.Errorf("Domains.List returned error: %v", err) - } - - expected := []Domain{{Name: "foo.com"}, {Name: "bar.com"}} - if !reflect.DeepEqual(domains, expected) { - t.Errorf("Domains.List returned %+v, expected %+v", domains, expected) - } -} - -func TestDomains_ListDomainsMultiplePages(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/domains", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"domains": [{"id":1},{"id":2}], "links":{"pages":{"next":"http://example.com/v2/domains/?page=2"}}}`) - }) - - _, resp, err := client.Domains.List(nil) - if err != nil { - t.Fatal(err) - } - - checkCurrentPage(t, resp, 1) -} - -func TestDomains_RetrievePageByNumber(t *testing.T) { - setup() - defer teardown() - - jBlob := ` - { - "domains": [{"id":1},{"id":2}], - "links":{ - "pages":{ - "next":"http://example.com/v2/domains/?page=3", - "prev":"http://example.com/v2/domains/?page=1", - "last":"http://example.com/v2/domains/?page=3", - "first":"http://example.com/v2/domains/?page=1" - } - } - }` - - mux.HandleFunc("/v2/domains", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, jBlob) - }) - - opt := &ListOptions{Page: 2} - _, resp, err := client.Domains.List(opt) - if err != nil { - t.Fatal(err) - } - - checkCurrentPage(t, resp, 2) -} - -func TestDomains_GetDomain(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/domains/example.com", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"domain":{"name":"example.com"}}`) - }) - - domains, _, err := client.Domains.Get("example.com") - if err != nil { - t.Errorf("domain.Get returned error: %v", err) - } - - expected := &Domain{Name: "example.com"} - if !reflect.DeepEqual(domains, expected) { - t.Errorf("domains.Get returned %+v, expected %+v", domains, expected) - } -} - -func TestDomains_Create(t *testing.T) { - setup() - defer teardown() - - createRequest := &DomainCreateRequest{ - Name: "example.com", - IPAddress: "127.0.0.1", - } - - mux.HandleFunc("/v2/domains", func(w http.ResponseWriter, r *http.Request) { - v := new(DomainCreateRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatal(err) - } - - testMethod(t, r, "POST") - if !reflect.DeepEqual(v, createRequest) { - t.Errorf("Request body = %+v, expected %+v", v, createRequest) - } - - fmt.Fprint(w, `{"domain":{"name":"example.com"}}`) - }) - - domain, _, err := client.Domains.Create(createRequest) - if err != nil { - t.Errorf("Domains.Create returned error: %v", err) - } - - expected := &Domain{Name: "example.com"} - if !reflect.DeepEqual(domain, expected) { - t.Errorf("Domains.Create returned %+v, expected %+v", domain, expected) - } -} - -func TestDomains_Destroy(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/domains/example.com", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - }) - - _, err := client.Domains.Delete("example.com") - if err != nil { - t.Errorf("Domains.Delete returned error: %v", err) - } -} - -func TestDomains_AllRecordsForDomainName(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/domains/example.com/records", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"domain_records":[{"id":1},{"id":2}]}`) - }) - - records, _, err := client.Domains.Records("example.com", nil) - if err != nil { - t.Errorf("Domains.List returned error: %v", err) - } - - expected := []DomainRecord{{ID: 1}, {ID: 2}} - if !reflect.DeepEqual(records, expected) { - t.Errorf("Domains.List returned %+v, expected %+v", records, expected) - } -} - -func TestDomains_AllRecordsForDomainName_PerPage(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/domains/example.com/records", func(w http.ResponseWriter, r *http.Request) { - perPage := r.URL.Query().Get("per_page") - if perPage != "2" { - t.Fatalf("expected '2', got '%s'", perPage) - } - - fmt.Fprint(w, `{"domain_records":[{"id":1},{"id":2}]}`) - }) - - dro := &ListOptions{PerPage: 2} - records, _, err := client.Domains.Records("example.com", dro) - if err != nil { - t.Errorf("Domains.List returned error: %v", err) - } - - expected := []DomainRecord{{ID: 1}, {ID: 2}} - if !reflect.DeepEqual(records, expected) { - t.Errorf("Domains.List returned %+v, expected %+v", records, expected) - } -} - -func TestDomains_GetRecordforDomainName(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/domains/example.com/records/1", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"domain_record":{"id":1}}`) - }) - - record, _, err := client.Domains.Record("example.com", 1) - if err != nil { - t.Errorf("Domains.GetRecord returned error: %v", err) - } - - expected := &DomainRecord{ID: 1} - if !reflect.DeepEqual(record, expected) { - t.Errorf("Domains.GetRecord returned %+v, expected %+v", record, expected) - } -} - -func TestDomains_DeleteRecordForDomainName(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/domains/example.com/records/1", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - }) - - _, err := client.Domains.DeleteRecord("example.com", 1) - if err != nil { - t.Errorf("Domains.RecordDelete returned error: %v", err) - } -} - -func TestDomains_CreateRecordForDomainName(t *testing.T) { - setup() - defer teardown() - - createRequest := &DomainRecordEditRequest{ - Type: "CNAME", - Name: "example", - Data: "@", - Priority: 10, - Port: 10, - Weight: 10, - } - - mux.HandleFunc("/v2/domains/example.com/records", - func(w http.ResponseWriter, r *http.Request) { - v := new(DomainRecordEditRequest) - err := json.NewDecoder(r.Body).Decode(v) - - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - if !reflect.DeepEqual(v, createRequest) { - t.Errorf("Request body = %+v, expected %+v", v, createRequest) - } - - fmt.Fprintf(w, `{"domain_record": {"id":1}}`) - }) - - record, _, err := client.Domains.CreateRecord("example.com", createRequest) - if err != nil { - t.Errorf("Domains.CreateRecord returned error: %v", err) - } - - expected := &DomainRecord{ID: 1} - if !reflect.DeepEqual(record, expected) { - t.Errorf("Domains.CreateRecord returned %+v, expected %+v", record, expected) - } -} - -func TestDomains_EditRecordForDomainName(t *testing.T) { - setup() - defer teardown() - - editRequest := &DomainRecordEditRequest{ - Type: "CNAME", - Name: "example", - Data: "@", - Priority: 10, - Port: 10, - Weight: 10, - } - - mux.HandleFunc("/v2/domains/example.com/records/1", func(w http.ResponseWriter, r *http.Request) { - v := new(DomainRecordEditRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "PUT") - if !reflect.DeepEqual(v, editRequest) { - t.Errorf("Request body = %+v, expected %+v", v, editRequest) - } - - fmt.Fprintf(w, `{"id":1}`) - }) - - record, _, err := client.Domains.EditRecord("example.com", 1, editRequest) - if err != nil { - t.Errorf("Domains.EditRecord returned error: %v", err) - } - - expected := &DomainRecord{ID: 1} - if !reflect.DeepEqual(record, expected) { - t.Errorf("Domains.EditRecord returned %+v, expected %+v", record, expected) - } -} - -func TestDomainRecord_String(t *testing.T) { - record := &DomainRecord{ - ID: 1, - Type: "CNAME", - Name: "example", - Data: "@", - Priority: 10, - Port: 10, - Weight: 10, - } - - stringified := record.String() - expected := `godo.DomainRecord{ID:1, Type:"CNAME", Name:"example", Data:"@", Priority:10, Port:10, Weight:10}` - if expected != stringified { - t.Errorf("DomainRecord.String returned %+v, expected %+v", stringified, expected) - } -} - -func TestDomainRecordEditRequest_String(t *testing.T) { - record := &DomainRecordEditRequest{ - Type: "CNAME", - Name: "example", - Data: "@", - Priority: 10, - Port: 10, - Weight: 10, - } - - stringified := record.String() - expected := `godo.DomainRecordEditRequest{Type:"CNAME", Name:"example", Data:"@", Priority:10, Port:10, Weight:10}` - if expected != stringified { - t.Errorf("DomainRecordEditRequest.String returned %+v, expected %+v", stringified, expected) - } -} diff --git a/vendor/github.com/digitalocean/godo/droplet_actions_test.go b/vendor/github.com/digitalocean/godo/droplet_actions_test.go deleted file mode 100644 index fa063dba52..0000000000 --- a/vendor/github.com/digitalocean/godo/droplet_actions_test.go +++ /dev/null @@ -1,666 +0,0 @@ -package godo - -import ( - "encoding/json" - "fmt" - "net/http" - "reflect" - "testing" -) - -func TestDropletActions_Shutdown(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "shutdown", - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.DropletActions.Shutdown(1) - if err != nil { - t.Errorf("DropletActions.Shutdown returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.Shutdown returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_PowerOff(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "power_off", - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.DropletActions.PowerOff(1) - if err != nil { - t.Errorf("DropletActions.PowerOff returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.Poweroff returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_PowerOn(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "power_on", - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.DropletActions.PowerOn(1) - if err != nil { - t.Errorf("DropletActions.PowerOn returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.PowerOn returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_Reboot(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "reboot", - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - - }) - - action, _, err := client.DropletActions.Reboot(1) - if err != nil { - t.Errorf("DropletActions.Reboot returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.Reboot returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_Restore(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "restore", - "image": float64(1), - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - - }) - - action, _, err := client.DropletActions.Restore(1, 1) - if err != nil { - t.Errorf("DropletActions.Restore returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.Restore returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_Resize(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "resize", - "size": "1024mb", - "disk": true, - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - - }) - - action, _, err := client.DropletActions.Resize(1, "1024mb", true) - if err != nil { - t.Errorf("DropletActions.Resize returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.Resize returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_Rename(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "rename", - "name": "Droplet-Name", - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.DropletActions.Rename(1, "Droplet-Name") - if err != nil { - t.Errorf("DropletActions.Rename returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.Rename returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_PowerCycle(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "power_cycle", - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - - }) - - action, _, err := client.DropletActions.PowerCycle(1) - if err != nil { - t.Errorf("DropletActions.PowerCycle returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.PowerCycle returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_Snapshot(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "snapshot", - "name": "Image-Name", - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.DropletActions.Snapshot(1, "Image-Name") - if err != nil { - t.Errorf("DropletActions.Snapshot returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.Snapshot returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_EnableBackups(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "enable_backups", - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.DropletActions.EnableBackups(1) - if err != nil { - t.Errorf("DropletActions.EnableBackups returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.EnableBackups returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_DisableBackups(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "disable_backups", - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.DropletActions.DisableBackups(1) - if err != nil { - t.Errorf("DropletActions.DisableBackups returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.DisableBackups returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_PasswordReset(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "password_reset", - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.DropletActions.PasswordReset(1) - if err != nil { - t.Errorf("DropletActions.PasswordReset returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.PasswordReset returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_RebuildByImageID(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "rebuild", - "image": float64(2), - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = \n%#v, expected \n%#v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.DropletActions.RebuildByImageID(1, 2) - if err != nil { - t.Errorf("DropletActions.RebuildByImageID returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.RebuildByImageID returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_RebuildByImageSlug(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "rebuild", - "image": "Image-Name", - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.DropletActions.RebuildByImageSlug(1, "Image-Name") - if err != nil { - t.Errorf("DropletActions.RebuildByImageSlug returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.RebuildByImageSlug returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_ChangeKernel(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "change_kernel", - "kernel": float64(2), - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.DropletActions.ChangeKernel(1, 2) - if err != nil { - t.Errorf("DropletActions.ChangeKernel returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.ChangeKernel returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_EnableIPv6(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "enable_ipv6", - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.DropletActions.EnableIPv6(1) - if err != nil { - t.Errorf("DropletActions.EnableIPv6 returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.EnableIPv6 returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_EnablePrivateNetworking(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "enable_private_networking", - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.DropletActions.EnablePrivateNetworking(1) - if err != nil { - t.Errorf("DropletActions.EnablePrivateNetworking returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.EnablePrivateNetworking returned %+v, expected %+v", action, expected) - } -} - -func TestDropletAction_Upgrade(t *testing.T) { - setup() - defer teardown() - - request := &ActionRequest{ - "type": "upgrade", - } - - mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - - if !reflect.DeepEqual(v, request) { - t.Errorf("Request body = %+v, expected %+v", v, request) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.DropletActions.Upgrade(1) - if err != nil { - t.Errorf("DropletActions.Upgrade returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.Upgrade returned %+v, expected %+v", action, expected) - } -} - -func TestDropletActions_Get(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/droplets/123/actions/456", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.DropletActions.Get(123, 456) - if err != nil { - t.Errorf("DropletActions.Get returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("DropletActions.Get returned %+v, expected %+v", action, expected) - } -} diff --git a/vendor/github.com/digitalocean/godo/droplets_test.go b/vendor/github.com/digitalocean/godo/droplets_test.go deleted file mode 100644 index b7504992fe..0000000000 --- a/vendor/github.com/digitalocean/godo/droplets_test.go +++ /dev/null @@ -1,428 +0,0 @@ -package godo - -import ( - "encoding/json" - "fmt" - "net/http" - "reflect" - "testing" -) - -func TestDroplets_ListDroplets(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/droplets", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"droplets": [{"id":1},{"id":2}]}`) - }) - - droplets, _, err := client.Droplets.List(nil) - if err != nil { - t.Errorf("Droplets.List returned error: %v", err) - } - - expected := []Droplet{{ID: 1}, {ID: 2}} - if !reflect.DeepEqual(droplets, expected) { - t.Errorf("Droplets.List returned %+v, expected %+v", droplets, expected) - } -} - -func TestDroplets_ListDropletsMultiplePages(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/droplets", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - - dr := dropletsRoot{ - Droplets: []Droplet{ - {ID: 1}, - {ID: 2}, - }, - Links: &Links{ - Pages: &Pages{Next: "http://example.com/v2/droplets/?page=2"}, - }, - } - - b, err := json.Marshal(dr) - if err != nil { - t.Fatal(err) - } - - fmt.Fprint(w, string(b)) - }) - - _, resp, err := client.Droplets.List(nil) - if err != nil { - t.Fatal(err) - } - - checkCurrentPage(t, resp, 1) -} - -func TestDroplets_RetrievePageByNumber(t *testing.T) { - setup() - defer teardown() - - jBlob := ` - { - "droplets": [{"id":1},{"id":2}], - "links":{ - "pages":{ - "next":"http://example.com/v2/droplets/?page=3", - "prev":"http://example.com/v2/droplets/?page=1", - "last":"http://example.com/v2/droplets/?page=3", - "first":"http://example.com/v2/droplets/?page=1" - } - } - }` - - mux.HandleFunc("/v2/droplets", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, jBlob) - }) - - opt := &ListOptions{Page: 2} - _, resp, err := client.Droplets.List(opt) - if err != nil { - t.Fatal(err) - } - - checkCurrentPage(t, resp, 2) -} - -func TestDroplets_GetDroplet(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/droplets/12345", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"droplet":{"id":12345}}`) - }) - - droplets, _, err := client.Droplets.Get(12345) - if err != nil { - t.Errorf("Droplet.Get returned error: %v", err) - } - - expected := &Droplet{ID: 12345} - if !reflect.DeepEqual(droplets, expected) { - t.Errorf("Droplets.Get returned %+v, expected %+v", droplets, expected) - } -} - -func TestDroplets_Create(t *testing.T) { - setup() - defer teardown() - - createRequest := &DropletCreateRequest{ - Name: "name", - Region: "region", - Size: "size", - Image: DropletCreateImage{ - ID: 1, - }, - } - - mux.HandleFunc("/v2/droplets", func(w http.ResponseWriter, r *http.Request) { - expected := map[string]interface{}{ - "name": "name", - "region": "region", - "size": "size", - "image": float64(1), - "ssh_keys": nil, - "backups": false, - "ipv6": false, - "private_networking": false, - } - - var v map[string]interface{} - err := json.NewDecoder(r.Body).Decode(&v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - if !reflect.DeepEqual(v, expected) { - t.Errorf("Request body = %#v, expected %#v", v, expected) - } - - fmt.Fprintf(w, `{"droplet":{"id":1}, "links":{"actions": [{"id": 1, "href": "http://example.com", "rel": "create"}]}}`) - }) - - droplet, resp, err := client.Droplets.Create(createRequest) - if err != nil { - t.Errorf("Droplets.Create returned error: %v", err) - } - - if id := droplet.ID; id != 1 { - t.Errorf("expected id '%d', received '%d'", 1, id) - } - - if a := resp.Links.Actions[0]; a.ID != 1 { - t.Errorf("expected action id '%d', received '%d'", 1, a.ID) - } -} - -func TestDroplets_CreateMultiple(t *testing.T) { - setup() - defer teardown() - - createRequest := &DropletMultiCreateRequest{ - Names: []string{"name1", "name2"}, - Region: "region", - Size: "size", - Image: DropletCreateImage{ - ID: 1, - }, - } - - mux.HandleFunc("/v2/droplets", func(w http.ResponseWriter, r *http.Request) { - expected := map[string]interface{}{ - "names": []interface {}{"name1", "name2"}, - "region": "region", - "size": "size", - "image": float64(1), - "ssh_keys": nil, - "backups": false, - "ipv6": false, - "private_networking": false, - } - - var v map[string]interface{} - err := json.NewDecoder(r.Body).Decode(&v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - if !reflect.DeepEqual(v, expected) { - t.Errorf("Request body = %#v, expected %#v", v, expected) - } - - fmt.Fprintf(w, `{"droplets":[{"id":1},{"id":2}], "links":{"actions": [{"id": 1, "href": "http://example.com", "rel": "multiple_create"}]}}`) - }) - - droplets, resp, err := client.Droplets.CreateMultiple(createRequest) - if err != nil { - t.Errorf("Droplets.CreateMultiple returned error: %v", err) - } - - if id := droplets[0].ID; id != 1 { - t.Errorf("expected id '%d', received '%d'", 1, id) - } - - if id := droplets[1].ID; id != 2 { - t.Errorf("expected id '%d', received '%d'", 1, id) - } - - if a := resp.Links.Actions[0]; a.ID != 1 { - t.Errorf("expected action id '%d', received '%d'", 1, a.ID) - } -} - -func TestDroplets_Destroy(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/droplets/12345", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - }) - - _, err := client.Droplets.Delete(12345) - if err != nil { - t.Errorf("Droplet.Delete returned error: %v", err) - } -} - -func TestDroplets_Kernels(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/droplets/12345/kernels", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"kernels": [{"id":1},{"id":2}]}`) - }) - - opt := &ListOptions{Page: 2} - kernels, _, err := client.Droplets.Kernels(12345, opt) - if err != nil { - t.Errorf("Droplets.Kernels returned error: %v", err) - } - - expected := []Kernel{{ID: 1}, {ID: 2}} - if !reflect.DeepEqual(kernels, expected) { - t.Errorf("Droplets.Kernels returned %+v, expected %+v", kernels, expected) - } -} - -func TestDroplets_Snapshots(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/droplets/12345/snapshots", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"snapshots": [{"id":1},{"id":2}]}`) - }) - - opt := &ListOptions{Page: 2} - snapshots, _, err := client.Droplets.Snapshots(12345, opt) - if err != nil { - t.Errorf("Droplets.Snapshots returned error: %v", err) - } - - expected := []Image{{ID: 1}, {ID: 2}} - if !reflect.DeepEqual(snapshots, expected) { - t.Errorf("Droplets.Snapshots returned %+v, expected %+v", snapshots, expected) - } -} - -func TestDroplets_Backups(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/droplets/12345/backups", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"backups": [{"id":1},{"id":2}]}`) - }) - - opt := &ListOptions{Page: 2} - backups, _, err := client.Droplets.Backups(12345, opt) - if err != nil { - t.Errorf("Droplets.Backups returned error: %v", err) - } - - expected := []Image{{ID: 1}, {ID: 2}} - if !reflect.DeepEqual(backups, expected) { - t.Errorf("Droplets.Backups returned %+v, expected %+v", backups, expected) - } -} - -func TestDroplets_Actions(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/droplets/12345/actions", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"actions": [{"id":1},{"id":2}]}`) - }) - - opt := &ListOptions{Page: 2} - actions, _, err := client.Droplets.Actions(12345, opt) - if err != nil { - t.Errorf("Droplets.Actions returned error: %v", err) - } - - expected := []Action{{ID: 1}, {ID: 2}} - if !reflect.DeepEqual(actions, expected) { - t.Errorf("Droplets.Actions returned %+v, expected %+v", actions, expected) - } -} - -func TestDroplets_Neighbors(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/droplets/12345/neighbors", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"droplets": [{"id":1},{"id":2}]}`) - }) - - neighbors, _, err := client.Droplets.Neighbors(12345) - if err != nil { - t.Errorf("Droplets.Neighbors returned error: %v", err) - } - - expected := []Droplet{{ID: 1}, {ID: 2}} - if !reflect.DeepEqual(neighbors, expected) { - t.Errorf("Droplets.Neighbors returned %+v, expected %+v", neighbors, expected) - } -} - -func TestNetworkV4_String(t *testing.T) { - network := &NetworkV4{ - IPAddress: "192.168.1.2", - Netmask: "255.255.255.0", - Gateway: "192.168.1.1", - } - - stringified := network.String() - expected := `godo.NetworkV4{IPAddress:"192.168.1.2", Netmask:"255.255.255.0", Gateway:"192.168.1.1", Type:""}` - if expected != stringified { - t.Errorf("NetworkV4.String returned %+v, expected %+v", stringified, expected) - } - -} - -func TestNetworkV6_String(t *testing.T) { - network := &NetworkV6{ - IPAddress: "2604:A880:0800:0010:0000:0000:02DD:4001", - Netmask: 64, - Gateway: "2604:A880:0800:0010:0000:0000:0000:0001", - } - stringified := network.String() - expected := `godo.NetworkV6{IPAddress:"2604:A880:0800:0010:0000:0000:02DD:4001", Netmask:64, Gateway:"2604:A880:0800:0010:0000:0000:0000:0001", Type:""}` - if expected != stringified { - t.Errorf("NetworkV6.String returned %+v, expected %+v", stringified, expected) - } -} - -func TestDroplet_String(t *testing.T) { - - region := &Region{ - Slug: "region", - Name: "Region", - Sizes: []string{"1", "2"}, - Available: true, - } - - image := &Image{ - ID: 1, - Name: "Image", - Type: "snapshot", - Distribution: "Ubuntu", - Slug: "image", - Public: true, - Regions: []string{"one", "two"}, - MinDiskSize: 20, - Created: "2013-11-27T09:24:55Z", - } - - size := &Size{ - Slug: "size", - PriceMonthly: 123, - PriceHourly: 456, - Regions: []string{"1", "2"}, - } - network := &NetworkV4{ - IPAddress: "192.168.1.2", - Netmask: "255.255.255.0", - Gateway: "192.168.1.1", - } - networks := &Networks{ - V4: []NetworkV4{*network}, - } - - droplet := &Droplet{ - ID: 1, - Name: "droplet", - Memory: 123, - Vcpus: 456, - Disk: 789, - Region: region, - Image: image, - Size: size, - BackupIDs: []int{1}, - SnapshotIDs: []int{1}, - ActionIDs: []int{1}, - Locked: false, - Status: "active", - Networks: networks, - SizeSlug: "1gb", - } - - stringified := droplet.String() - expected := `godo.Droplet{ID:1, Name:"droplet", Memory:123, Vcpus:456, Disk:789, Region:godo.Region{Slug:"region", Name:"Region", Sizes:["1" "2"], Available:true}, Image:godo.Image{ID:1, Name:"Image", Type:"snapshot", Distribution:"Ubuntu", Slug:"image", Public:true, Regions:["one" "two"], MinDiskSize:20, Created:"2013-11-27T09:24:55Z"}, Size:godo.Size{Slug:"size", Memory:0, Vcpus:0, Disk:0, PriceMonthly:123, PriceHourly:456, Regions:["1" "2"], Available:false, Transfer:0}, SizeSlug:"1gb", BackupIDs:[1], SnapshotIDs:[1], Locked:false, Status:"active", Networks:godo.Networks{V4:[godo.NetworkV4{IPAddress:"192.168.1.2", Netmask:"255.255.255.0", Gateway:"192.168.1.1", Type:""}]}, ActionIDs:[1], Created:""}` - if expected != stringified { - t.Errorf("Droplet.String returned %+v, expected %+v", stringified, expected) - } -} diff --git a/vendor/github.com/digitalocean/godo/errors_test.go b/vendor/github.com/digitalocean/godo/errors_test.go deleted file mode 100644 index 71bf1edc3d..0000000000 --- a/vendor/github.com/digitalocean/godo/errors_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package godo - -import "testing" - -func TestArgError(t *testing.T) { - expected := "foo is invalid because bar" - err := NewArgError("foo", "bar") - if got := err.Error(); got != expected { - t.Errorf("ArgError().Error() = %q; expected %q", got, expected) - } -} diff --git a/vendor/github.com/digitalocean/godo/floating_ips_actions_test.go b/vendor/github.com/digitalocean/godo/floating_ips_actions_test.go deleted file mode 100644 index 3e1077dde1..0000000000 --- a/vendor/github.com/digitalocean/godo/floating_ips_actions_test.go +++ /dev/null @@ -1,167 +0,0 @@ -package godo - -import ( - "encoding/json" - "fmt" - "net/http" - "reflect" - "testing" -) - -func TestFloatingIPsActions_Assign(t *testing.T) { - setup() - defer teardown() - dropletID := 12345 - assignRequest := &ActionRequest{ - "droplet_id": float64(dropletID), // encoding/json decodes numbers as floats - "type": "assign", - } - - mux.HandleFunc("/v2/floating_ips/192.168.0.1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - if !reflect.DeepEqual(v, assignRequest) { - t.Errorf("Request body = %#v, expected %#v", v, assignRequest) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - - }) - - assign, _, err := client.FloatingIPActions.Assign("192.168.0.1", 12345) - if err != nil { - t.Errorf("FloatingIPsActions.Assign returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(assign, expected) { - t.Errorf("FloatingIPsActions.Assign returned %+v, expected %+v", assign, expected) - } -} - -func TestFloatingIPsActions_Unassign(t *testing.T) { - setup() - defer teardown() - - unassignRequest := &ActionRequest{ - "type": "unassign", - } - - mux.HandleFunc("/v2/floating_ips/192.168.0.1/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - if !reflect.DeepEqual(v, unassignRequest) { - t.Errorf("Request body = %+v, expected %+v", v, unassignRequest) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.FloatingIPActions.Unassign("192.168.0.1") - if err != nil { - t.Errorf("FloatingIPsActions.Get returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("FloatingIPsActions.Get returned %+v, expected %+v", action, expected) - } -} - -func TestFloatingIPsActions_Get(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/floating_ips/192.168.0.1/actions/456", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.FloatingIPActions.Get("192.168.0.1", 456) - if err != nil { - t.Errorf("FloatingIPsActions.Get returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("FloatingIPsActions.Get returned %+v, expected %+v", action, expected) - } -} - -func TestFloatingIPsActions_List(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/floating_ips/192.168.0.1/actions", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprintf(w, `{"actions":[{"status":"in-progress"}]}`) - }) - - actions, _, err := client.FloatingIPActions.List("192.168.0.1", nil) - if err != nil { - t.Errorf("FloatingIPsActions.List returned error: %v", err) - } - - expected := []Action{Action{Status: "in-progress"}} - if !reflect.DeepEqual(actions, expected) { - t.Errorf("FloatingIPsActions.List returned %+v, expected %+v", actions, expected) - } -} - -func TestFloatingIPsActions_ListMultiplePages(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/floating_ips/192.168.0.1/actions", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"actions":[{"status":"in-progress"}], "links":{"pages":{"next":"http://example.com/v2/floating_ips/192.168.0.1/actions?page=2"}}}`) - }) - - _, resp, err := client.FloatingIPActions.List("192.168.0.1", nil) - if err != nil { - t.Errorf("FloatingIPsActions.List returned error: %v", err) - } - - checkCurrentPage(t, resp, 1) -} - -func TestFloatingIPsActions_ListPageByNumber(t *testing.T) { - setup() - defer teardown() - - jBlob := ` - { - "actions":[{"status":"in-progress"}], - "links":{ - "pages":{ - "next":"http://example.com/v2/regions/?page=3", - "prev":"http://example.com/v2/regions/?page=1", - "last":"http://example.com/v2/regions/?page=3", - "first":"http://example.com/v2/regions/?page=1" - } - } - }` - - mux.HandleFunc("/v2/floating_ips/192.168.0.1/actions", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, jBlob) - }) - - opt := &ListOptions{Page: 2} - _, resp, err := client.FloatingIPActions.List("192.168.0.1", opt) - if err != nil { - t.Errorf("FloatingIPsActions.List returned error: %v", err) - } - - checkCurrentPage(t, resp, 2) -} diff --git a/vendor/github.com/digitalocean/godo/floating_ips_test.go b/vendor/github.com/digitalocean/godo/floating_ips_test.go deleted file mode 100644 index 9bd2eae11f..0000000000 --- a/vendor/github.com/digitalocean/godo/floating_ips_test.go +++ /dev/null @@ -1,149 +0,0 @@ -package godo - -import ( - "encoding/json" - "fmt" - "net/http" - "reflect" - "testing" -) - -func TestFloatingIPs_ListFloatingIPs(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/floating_ips", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"floating_ips": [{"region":{"slug":"nyc3"},"droplet":{"id":1},"ip":"192.168.0.1"},{"region":{"slug":"nyc3"},"droplet":{"id":2},"ip":"192.168.0.2"}]}`) - }) - - floatingIPs, _, err := client.FloatingIPs.List(nil) - if err != nil { - t.Errorf("FloatingIPs.List returned error: %v", err) - } - - expected := []FloatingIP{ - {Region: &Region{Slug: "nyc3"}, Droplet: &Droplet{ID: 1}, IP: "192.168.0.1"}, - {Region: &Region{Slug: "nyc3"}, Droplet: &Droplet{ID: 2}, IP: "192.168.0.2"}, - } - if !reflect.DeepEqual(floatingIPs, expected) { - t.Errorf("FloatingIPs.List returned %+v, expected %+v", floatingIPs, expected) - } -} - -func TestFloatingIPs_ListFloatingIPsMultiplePages(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/floating_ips", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"floating_ips": [{"region":{"slug":"nyc3"},"droplet":{"id":1},"ip":"192.168.0.1"},{"region":{"slug":"nyc3"},"droplet":{"id":2},"ip":"192.168.0.2"}], "links":{"pages":{"next":"http://example.com/v2/floating_ips/?page=2"}}}`) - }) - - _, resp, err := client.FloatingIPs.List(nil) - if err != nil { - t.Fatal(err) - } - - checkCurrentPage(t, resp, 1) -} - -func TestFloatingIPs_RetrievePageByNumber(t *testing.T) { - setup() - defer teardown() - - jBlob := ` - { - "floating_ips": [{"region":{"slug":"nyc3"},"droplet":{"id":1},"ip":"192.168.0.1"},{"region":{"slug":"nyc3"},"droplet":{"id":2},"ip":"192.168.0.2"}], - "links":{ - "pages":{ - "next":"http://example.com/v2/floating_ips/?page=3", - "prev":"http://example.com/v2/floating_ips/?page=1", - "last":"http://example.com/v2/floating_ips/?page=3", - "first":"http://example.com/v2/floating_ips/?page=1" - } - } - }` - - mux.HandleFunc("/v2/floating_ips", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, jBlob) - }) - - opt := &ListOptions{Page: 2} - _, resp, err := client.FloatingIPs.List(opt) - if err != nil { - t.Fatal(err) - } - - checkCurrentPage(t, resp, 2) -} - -func TestFloatingIPs_Get(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/floating_ips/192.168.0.1", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"floating_ip":{"region":{"slug":"nyc3"},"droplet":{"id":1},"ip":"192.168.0.1"}}`) - }) - - floatingIP, _, err := client.FloatingIPs.Get("192.168.0.1") - if err != nil { - t.Errorf("domain.Get returned error: %v", err) - } - - expected := &FloatingIP{Region: &Region{Slug: "nyc3"}, Droplet: &Droplet{ID: 1}, IP: "192.168.0.1"} - if !reflect.DeepEqual(floatingIP, expected) { - t.Errorf("FloatingIPs.Get returned %+v, expected %+v", floatingIP, expected) - } -} - -func TestFloatingIPs_Create(t *testing.T) { - setup() - defer teardown() - - createRequest := &FloatingIPCreateRequest{ - Region: "nyc3", - DropletID: 1, - } - - mux.HandleFunc("/v2/floating_ips", func(w http.ResponseWriter, r *http.Request) { - v := new(FloatingIPCreateRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatal(err) - } - - testMethod(t, r, "POST") - if !reflect.DeepEqual(v, createRequest) { - t.Errorf("Request body = %+v, expected %+v", v, createRequest) - } - - fmt.Fprint(w, `{"floating_ip":{"region":{"slug":"nyc3"},"droplet":{"id":1},"ip":"192.168.0.1"}}`) - }) - - floatingIP, _, err := client.FloatingIPs.Create(createRequest) - if err != nil { - t.Errorf("FloatingIPs.Create returned error: %v", err) - } - - expected := &FloatingIP{Region: &Region{Slug: "nyc3"}, Droplet: &Droplet{ID: 1}, IP: "192.168.0.1"} - if !reflect.DeepEqual(floatingIP, expected) { - t.Errorf("FloatingIPs.Create returned %+v, expected %+v", floatingIP, expected) - } -} - -func TestFloatingIPs_Destroy(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/floating_ips/192.168.0.1", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - }) - - _, err := client.FloatingIPs.Delete("192.168.0.1") - if err != nil { - t.Errorf("FloatingIPs.Delete returned error: %v", err) - } -} diff --git a/vendor/github.com/digitalocean/godo/godo_test.go b/vendor/github.com/digitalocean/godo/godo_test.go deleted file mode 100644 index 5da13f9e06..0000000000 --- a/vendor/github.com/digitalocean/godo/godo_test.go +++ /dev/null @@ -1,455 +0,0 @@ -package godo - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "net/http/httptest" - "net/http/httputil" - "net/url" - "reflect" - "strings" - "testing" - "time" -) - -var ( - mux *http.ServeMux - - client *Client - - server *httptest.Server -) - -func setup() { - mux = http.NewServeMux() - server = httptest.NewServer(mux) - - client = NewClient(nil) - url, _ := url.Parse(server.URL) - client.BaseURL = url -} - -func teardown() { - server.Close() -} - -func testMethod(t *testing.T, r *http.Request, expected string) { - if expected != r.Method { - t.Errorf("Request method = %v, expected %v", r.Method, expected) - } -} - -type values map[string]string - -func testFormValues(t *testing.T, r *http.Request, values values) { - expected := url.Values{} - for k, v := range values { - expected.Add(k, v) - } - - err := r.ParseForm() - if err != nil { - t.Fatalf("parseForm(): %v", err) - } - - if !reflect.DeepEqual(expected, r.Form) { - t.Errorf("Request parameters = %v, expected %v", r.Form, expected) - } -} - -func testURLParseError(t *testing.T, err error) { - if err == nil { - t.Errorf("Expected error to be returned") - } - if err, ok := err.(*url.Error); !ok || err.Op != "parse" { - t.Errorf("Expected URL parse error, got %+v", err) - } -} - -func TestNewClient(t *testing.T) { - c := NewClient(nil) - if c.BaseURL.String() != defaultBaseURL { - t.Errorf("NewClient BaseURL = %v, expected %v", c.BaseURL.String(), defaultBaseURL) - } - - if c.UserAgent != userAgent { - t.Errorf("NewClick UserAgent = %v, expected %v", c.UserAgent, userAgent) - } -} - -func TestNewRequest(t *testing.T) { - c := NewClient(nil) - - inURL, outURL := "/foo", defaultBaseURL+"foo" - inBody, outBody := &DropletCreateRequest{Name: "l"}, - `{"name":"l","region":"","size":"","image":0,`+ - `"ssh_keys":null,"backups":false,"ipv6":false,`+ - `"private_networking":false}`+"\n" - req, _ := c.NewRequest("GET", inURL, inBody) - - // test relative URL was expanded - if req.URL.String() != outURL { - t.Errorf("NewRequest(%v) URL = %v, expected %v", inURL, req.URL, outURL) - } - - // test body was JSON encoded - body, _ := ioutil.ReadAll(req.Body) - if string(body) != outBody { - t.Errorf("NewRequest(%v)Body = %v, expected %v", inBody, string(body), outBody) - } - - // test default user-agent is attached to the request - userAgent := req.Header.Get("User-Agent") - if c.UserAgent != userAgent { - t.Errorf("NewRequest() User-Agent = %v, expected %v", userAgent, c.UserAgent) - } -} - -func TestNewRequest_withUserData(t *testing.T) { - c := NewClient(nil) - - inURL, outURL := "/foo", defaultBaseURL+"foo" - inBody, outBody := &DropletCreateRequest{Name: "l", UserData: "u"}, - `{"name":"l","region":"","size":"","image":0,`+ - `"ssh_keys":null,"backups":false,"ipv6":false,`+ - `"private_networking":false,"user_data":"u"}`+"\n" - req, _ := c.NewRequest("GET", inURL, inBody) - - // test relative URL was expanded - if req.URL.String() != outURL { - t.Errorf("NewRequest(%v) URL = %v, expected %v", inURL, req.URL, outURL) - } - - // test body was JSON encoded - body, _ := ioutil.ReadAll(req.Body) - if string(body) != outBody { - t.Errorf("NewRequest(%v)Body = %v, expected %v", inBody, string(body), outBody) - } - - // test default user-agent is attached to the request - userAgent := req.Header.Get("User-Agent") - if c.UserAgent != userAgent { - t.Errorf("NewRequest() User-Agent = %v, expected %v", userAgent, c.UserAgent) - } -} - -func TestNewRequest_invalidJSON(t *testing.T) { - c := NewClient(nil) - - type T struct { - A map[int]interface{} - } - _, err := c.NewRequest("GET", "/", &T{}) - - if err == nil { - t.Error("Expected error to be returned.") - } - if err, ok := err.(*json.UnsupportedTypeError); !ok { - t.Errorf("Expected a JSON error; got %#v.", err) - } -} - -func TestNewRequest_badURL(t *testing.T) { - c := NewClient(nil) - _, err := c.NewRequest("GET", ":", nil) - testURLParseError(t, err) -} - -func TestDo(t *testing.T) { - setup() - defer teardown() - - type foo struct { - A string - } - - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - if m := "GET"; m != r.Method { - t.Errorf("Request method = %v, expected %v", r.Method, m) - } - fmt.Fprint(w, `{"A":"a"}`) - }) - - req, _ := client.NewRequest("GET", "/", nil) - body := new(foo) - _, err := client.Do(req, body) - if err != nil { - t.Fatalf("Do(): %v", err) - } - - expected := &foo{"a"} - if !reflect.DeepEqual(body, expected) { - t.Errorf("Response body = %v, expected %v", body, expected) - } -} - -func TestDo_httpError(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - http.Error(w, "Bad Request", 400) - }) - - req, _ := client.NewRequest("GET", "/", nil) - _, err := client.Do(req, nil) - - if err == nil { - t.Error("Expected HTTP 400 error.") - } -} - -// Test handling of an error caused by the internal http client's Do() -// function. -func TestDo_redirectLoop(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - http.Redirect(w, r, "/", http.StatusFound) - }) - - req, _ := client.NewRequest("GET", "/", nil) - _, err := client.Do(req, nil) - - if err == nil { - t.Error("Expected error to be returned.") - } - if err, ok := err.(*url.Error); !ok { - t.Errorf("Expected a URL error; got %#v.", err) - } -} - -func TestCheckResponse(t *testing.T) { - res := &http.Response{ - Request: &http.Request{}, - StatusCode: http.StatusBadRequest, - Body: ioutil.NopCloser(strings.NewReader(`{"message":"m", - "errors": [{"resource": "r", "field": "f", "code": "c"}]}`)), - } - err := CheckResponse(res).(*ErrorResponse) - - if err == nil { - t.Fatalf("Expected error response.") - } - - expected := &ErrorResponse{ - Response: res, - Message: "m", - } - if !reflect.DeepEqual(err, expected) { - t.Errorf("Error = %#v, expected %#v", err, expected) - } -} - -// ensure that we properly handle API errors that do not contain a response -// body -func TestCheckResponse_noBody(t *testing.T) { - res := &http.Response{ - Request: &http.Request{}, - StatusCode: http.StatusBadRequest, - Body: ioutil.NopCloser(strings.NewReader("")), - } - err := CheckResponse(res).(*ErrorResponse) - - if err == nil { - t.Errorf("Expected error response.") - } - - expected := &ErrorResponse{ - Response: res, - } - if !reflect.DeepEqual(err, expected) { - t.Errorf("Error = %#v, expected %#v", err, expected) - } -} - -func TestErrorResponse_Error(t *testing.T) { - res := &http.Response{Request: &http.Request{}} - err := ErrorResponse{Message: "m", Response: res} - if err.Error() == "" { - t.Errorf("Expected non-empty ErrorResponse.Error()") - } -} - -func TestDo_rateLimit(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - w.Header().Add(headerRateLimit, "60") - w.Header().Add(headerRateRemaining, "59") - w.Header().Add(headerRateReset, "1372700873") - }) - - var expected int - - if expected = 0; client.Rate.Limit != expected { - t.Errorf("Client rate limit = %v, expected %v", client.Rate.Limit, expected) - } - if expected = 0; client.Rate.Remaining != expected { - t.Errorf("Client rate remaining = %v, got %v", client.Rate.Remaining, expected) - } - if !client.Rate.Reset.IsZero() { - t.Errorf("Client rate reset not initialized to zero value") - } - - req, _ := client.NewRequest("GET", "/", nil) - _, err := client.Do(req, nil) - if err != nil { - t.Fatalf("Do(): %v", err) - } - - if expected = 60; client.Rate.Limit != expected { - t.Errorf("Client rate limit = %v, expected %v", client.Rate.Limit, expected) - } - if expected = 59; client.Rate.Remaining != expected { - t.Errorf("Client rate remaining = %v, expected %v", client.Rate.Remaining, expected) - } - reset := time.Date(2013, 7, 1, 17, 47, 53, 0, time.UTC) - if client.Rate.Reset.UTC() != reset { - t.Errorf("Client rate reset = %v, expected %v", client.Rate.Reset, reset) - } -} - -func TestDo_rateLimit_errorResponse(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - w.Header().Add(headerRateLimit, "60") - w.Header().Add(headerRateRemaining, "59") - w.Header().Add(headerRateReset, "1372700873") - http.Error(w, `{"message":"bad request"}`, 400) - }) - - var expected int - - req, _ := client.NewRequest("GET", "/", nil) - _, _ = client.Do(req, nil) - - if expected = 60; client.Rate.Limit != expected { - t.Errorf("Client rate limit = %v, expected %v", client.Rate.Limit, expected) - } - if expected = 59; client.Rate.Remaining != expected { - t.Errorf("Client rate remaining = %v, expected %v", client.Rate.Remaining, expected) - } - reset := time.Date(2013, 7, 1, 17, 47, 53, 0, time.UTC) - if client.Rate.Reset.UTC() != reset { - t.Errorf("Client rate reset = %v, expected %v", client.Rate.Reset, reset) - } -} - -func checkCurrentPage(t *testing.T, resp *Response, expectedPage int) { - links := resp.Links - p, err := links.CurrentPage() - if err != nil { - t.Fatal(err) - } - - if p != expectedPage { - t.Fatalf("expected current page to be '%d', was '%d'", expectedPage, p) - } -} - -func TestDo_completion_callback(t *testing.T) { - setup() - defer teardown() - - type foo struct { - A string - } - - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - if m := "GET"; m != r.Method { - t.Errorf("Request method = %v, expected %v", r.Method, m) - } - fmt.Fprint(w, `{"A":"a"}`) - }) - - req, _ := client.NewRequest("GET", "/", nil) - body := new(foo) - var completedReq *http.Request - var completedResp string - client.OnRequestCompleted(func(req *http.Request, resp *http.Response) { - completedReq = req - b, err := httputil.DumpResponse(resp, true) - if err != nil { - t.Errorf("Failed to dump response: %s", err) - } - completedResp = string(b) - }) - _, err := client.Do(req, body) - if err != nil { - t.Fatalf("Do(): %v", err) - } - if !reflect.DeepEqual(req, completedReq) { - t.Errorf("Completed request = %v, expected %v", completedReq, req) - } - expected := `{"A":"a"}` - if !strings.Contains(completedResp, expected) { - t.Errorf("expected response to contain %v, Response = %v", expected, completedResp) - } -} - -func TestAddOptions(t *testing.T) { - cases := []struct { - name string - path string - expected string - opts *ListOptions - isErr bool - }{ - { - name: "add options", - path: "/action", - expected: "/action?page=1", - opts: &ListOptions{Page: 1}, - isErr: false, - }, - { - name: "add options with existing parameters", - path: "/action?scope=all", - expected: "/action?page=1&scope=all", - opts: &ListOptions{Page: 1}, - isErr: false, - }, - } - - for _, c := range cases { - got, err := addOptions(c.path, c.opts) - if c.isErr && err == nil { - t.Errorf("%q expected error but none was encountered", c.name) - continue - } - - if !c.isErr && err != nil { - t.Errorf("%q unexpected error: %v", c.name, err) - continue - } - - gotURL, err := url.Parse(got) - if err != nil { - t.Errorf("%q unable to parse returned URL", c.name) - continue - } - - expectedURL, err := url.Parse(c.expected) - if err != nil { - t.Errorf("%q unable to parse expected URL", c.name) - continue - } - - if g, e := gotURL.Path, expectedURL.Path; g != e { - t.Errorf("%q path = %q; expected %q", c.name, g, e) - continue - } - - if g, e := gotURL.Query(), expectedURL.Query(); !reflect.DeepEqual(g, e) { - t.Errorf("%q query = %#v; expected %#v", c.name, g, e) - continue - } - } -} diff --git a/vendor/github.com/digitalocean/godo/image_actions_test.go b/vendor/github.com/digitalocean/godo/image_actions_test.go deleted file mode 100644 index 5d3cf67c04..0000000000 --- a/vendor/github.com/digitalocean/godo/image_actions_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package godo - -import ( - "encoding/json" - "fmt" - "net/http" - "reflect" - "testing" -) - -func TestImageActions_Transfer(t *testing.T) { - setup() - defer teardown() - - transferRequest := &ActionRequest{} - - mux.HandleFunc("/v2/images/12345/actions", func(w http.ResponseWriter, r *http.Request) { - v := new(ActionRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - if !reflect.DeepEqual(v, transferRequest) { - t.Errorf("Request body = %+v, expected %+v", v, transferRequest) - } - - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - - }) - - transfer, _, err := client.ImageActions.Transfer(12345, transferRequest) - if err != nil { - t.Errorf("ImageActions.Transfer returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(transfer, expected) { - t.Errorf("ImageActions.Transfer returned %+v, expected %+v", transfer, expected) - } -} - -func TestImageActions_Get(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/images/123/actions/456", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`) - }) - - action, _, err := client.ImageActions.Get(123, 456) - if err != nil { - t.Errorf("ImageActions.Get returned error: %v", err) - } - - expected := &Action{Status: "in-progress"} - if !reflect.DeepEqual(action, expected) { - t.Errorf("ImageActions.Get returned %+v, expected %+v", action, expected) - } -} diff --git a/vendor/github.com/digitalocean/godo/images_test.go b/vendor/github.com/digitalocean/godo/images_test.go deleted file mode 100644 index 3fd4d1a80e..0000000000 --- a/vendor/github.com/digitalocean/godo/images_test.go +++ /dev/null @@ -1,262 +0,0 @@ -package godo - -import ( - "encoding/json" - "fmt" - "net/http" - "reflect" - "testing" -) - -func TestImages_List(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/images", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"images":[{"id":1},{"id":2}]}`) - }) - - images, _, err := client.Images.List(nil) - if err != nil { - t.Errorf("Images.List returned error: %v", err) - } - - expected := []Image{{ID: 1}, {ID: 2}} - if !reflect.DeepEqual(images, expected) { - t.Errorf("Images.List returned %+v, expected %+v", images, expected) - } -} - -func TestImages_ListDistribution(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/images", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - expected := "distribution" - actual := r.URL.Query().Get("type") - if actual != expected { - t.Errorf("'type' query = %v, expected %v", actual, expected) - } - fmt.Fprint(w, `{"images":[{"id":1},{"id":2}]}`) - }) - - images, _, err := client.Images.ListDistribution(nil) - if err != nil { - t.Errorf("Images.ListDistribution returned error: %v", err) - } - - expected := []Image{{ID: 1}, {ID: 2}} - if !reflect.DeepEqual(images, expected) { - t.Errorf("Images.ListDistribution returned %+v, expected %+v", images, expected) - } -} - -func TestImages_ListApplication(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/images", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - expected := "application" - actual := r.URL.Query().Get("type") - if actual != expected { - t.Errorf("'type' query = %v, expected %v", actual, expected) - } - fmt.Fprint(w, `{"images":[{"id":1},{"id":2}]}`) - }) - - images, _, err := client.Images.ListApplication(nil) - if err != nil { - t.Errorf("Images.ListApplication returned error: %v", err) - } - - expected := []Image{{ID: 1}, {ID: 2}} - if !reflect.DeepEqual(images, expected) { - t.Errorf("Images.ListApplication returned %+v, expected %+v", images, expected) - } -} - -func TestImages_ListUser(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/images", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - expected := "true" - actual := r.URL.Query().Get("private") - if actual != expected { - t.Errorf("'private' query = %v, expected %v", actual, expected) - } - - fmt.Fprint(w, `{"images":[{"id":1},{"id":2}]}`) - }) - - images, _, err := client.Images.ListUser(nil) - if err != nil { - t.Errorf("Images.ListUser returned error: %v", err) - } - - expected := []Image{{ID: 1}, {ID: 2}} - if !reflect.DeepEqual(images, expected) { - t.Errorf("Images.ListUser returned %+v, expected %+v", images, expected) - } -} - -func TestImages_ListImagesMultiplePages(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/images", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"images": [{"id":1},{"id":2}], "links":{"pages":{"next":"http://example.com/v2/images/?page=2"}}}`) - }) - - _, resp, err := client.Images.List(&ListOptions{Page: 2}) - if err != nil { - t.Fatal(err) - } - checkCurrentPage(t, resp, 1) -} - -func TestImages_RetrievePageByNumber(t *testing.T) { - setup() - defer teardown() - - jBlob := ` - { - "images": [{"id":1},{"id":2}], - "links":{ - "pages":{ - "next":"http://example.com/v2/images/?page=3", - "prev":"http://example.com/v2/images/?page=1", - "last":"http://example.com/v2/images/?page=3", - "first":"http://example.com/v2/images/?page=1" - } - } - }` - - mux.HandleFunc("/v2/images", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, jBlob) - }) - - opt := &ListOptions{Page: 2} - _, resp, err := client.Images.List(opt) - if err != nil { - t.Fatal(err) - } - - checkCurrentPage(t, resp, 2) -} - -func TestImages_GetImageByID(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/images/12345", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"image":{"id":12345}}`) - }) - - images, _, err := client.Images.GetByID(12345) - if err != nil { - t.Errorf("Image.GetByID returned error: %v", err) - } - - expected := &Image{ID: 12345} - if !reflect.DeepEqual(images, expected) { - t.Errorf("Images.GetByID returned %+v, expected %+v", images, expected) - } -} - -func TestImages_GetImageBySlug(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/images/ubuntu", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"image":{"id":12345}}`) - }) - - images, _, err := client.Images.GetBySlug("ubuntu") - if err != nil { - t.Errorf("Image.GetBySlug returned error: %v", err) - } - - expected := &Image{ID: 12345} - if !reflect.DeepEqual(images, expected) { - t.Errorf("Images.Get returned %+v, expected %+v", images, expected) - } -} - -func TestImages_Update(t *testing.T) { - setup() - defer teardown() - - updateRequest := &ImageUpdateRequest{ - Name: "name", - } - - mux.HandleFunc("/v2/images/12345", func(w http.ResponseWriter, r *http.Request) { - expected := map[string]interface{}{ - "name": "name", - } - - var v map[string]interface{} - err := json.NewDecoder(r.Body).Decode(&v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - if !reflect.DeepEqual(v, expected) { - t.Errorf("Request body = %#v, expected %#v", v, expected) - } - - fmt.Fprintf(w, `{"image":{"id":1}}`) - }) - - image, _, err := client.Images.Update(12345, updateRequest) - if err != nil { - t.Errorf("Images.Update returned error: %v", err) - } else { - if id := image.ID; id != 1 { - t.Errorf("expected id '%d', received '%d'", 1, id) - } - } -} - -func TestImages_Destroy(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/images/12345", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - }) - - _, err := client.Images.Delete(12345) - if err != nil { - t.Errorf("Image.Delete returned error: %v", err) - } -} - -func TestImage_String(t *testing.T) { - image := &Image{ - ID: 1, - Name: "Image", - Type: "snapshot", - Distribution: "Ubuntu", - Slug: "image", - Public: true, - Regions: []string{"one", "two"}, - MinDiskSize: 20, - Created: "2013-11-27T09:24:55Z", - } - - stringified := image.String() - expected := `godo.Image{ID:1, Name:"Image", Type:"snapshot", Distribution:"Ubuntu", Slug:"image", Public:true, Regions:["one" "two"], MinDiskSize:20, Created:"2013-11-27T09:24:55Z"}` - if expected != stringified { - t.Errorf("Image.String returned %+v, expected %+v", stringified, expected) - } -} diff --git a/vendor/github.com/digitalocean/godo/keys_test.go b/vendor/github.com/digitalocean/godo/keys_test.go deleted file mode 100644 index b209f61f5a..0000000000 --- a/vendor/github.com/digitalocean/godo/keys_test.go +++ /dev/null @@ -1,265 +0,0 @@ -package godo - -import ( - "encoding/json" - "fmt" - "net/http" - "reflect" - "testing" -) - -func TestKeys_List(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/account/keys", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"ssh_keys":[{"id":1},{"id":2}]}`) - }) - - keys, _, err := client.Keys.List(nil) - if err != nil { - t.Errorf("Keys.List returned error: %v", err) - } - - expected := []Key{{ID: 1}, {ID: 2}} - if !reflect.DeepEqual(keys, expected) { - t.Errorf("Keys.List returned %+v, expected %+v", keys, expected) - } -} - -func TestKeys_ListKeysMultiplePages(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/account/keys", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"droplets": [{"id":1},{"id":2}], "links":{"pages":{"next":"http://example.com/v2/account/keys/?page=2"}}}`) - }) - - _, resp, err := client.Keys.List(nil) - if err != nil { - t.Fatal(err) - } - checkCurrentPage(t, resp, 1) -} - -func TestKeys_RetrievePageByNumber(t *testing.T) { - setup() - defer teardown() - - jBlob := ` - { - "keys": [{"id":1},{"id":2}], - "links":{ - "pages":{ - "next":"http://example.com/v2/account/keys/?page=3", - "prev":"http://example.com/v2/account/keys/?page=1", - "last":"http://example.com/v2/account/keys/?page=3", - "first":"http://example.com/v2/account/keys/?page=1" - } - } - }` - - mux.HandleFunc("/v2/account/keys", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, jBlob) - }) - - opt := &ListOptions{Page: 2} - _, resp, err := client.Keys.List(opt) - if err != nil { - t.Fatal(err) - } - checkCurrentPage(t, resp, 2) -} - -func TestKeys_GetByID(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/account/keys/12345", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"ssh_key": {"id":12345}}`) - }) - - keys, _, err := client.Keys.GetByID(12345) - if err != nil { - t.Errorf("Keys.GetByID returned error: %v", err) - } - - expected := &Key{ID: 12345} - if !reflect.DeepEqual(keys, expected) { - t.Errorf("Keys.GetByID returned %+v, expected %+v", keys, expected) - } -} - -func TestKeys_GetByFingerprint(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/account/keys/aa:bb:cc", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"ssh_key": {"fingerprint":"aa:bb:cc"}}`) - }) - - keys, _, err := client.Keys.GetByFingerprint("aa:bb:cc") - if err != nil { - t.Errorf("Keys.GetByFingerprint returned error: %v", err) - } - - expected := &Key{Fingerprint: "aa:bb:cc"} - if !reflect.DeepEqual(keys, expected) { - t.Errorf("Keys.GetByFingerprint returned %+v, expected %+v", keys, expected) - } -} - -func TestKeys_Create(t *testing.T) { - setup() - defer teardown() - - createRequest := &KeyCreateRequest{ - Name: "name", - PublicKey: "ssh-rsa longtextandstuff", - } - - mux.HandleFunc("/v2/account/keys", func(w http.ResponseWriter, r *http.Request) { - v := new(KeyCreateRequest) - err := json.NewDecoder(r.Body).Decode(v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - testMethod(t, r, "POST") - if !reflect.DeepEqual(v, createRequest) { - t.Errorf("Request body = %+v, expected %+v", v, createRequest) - } - - fmt.Fprintf(w, `{"ssh_key":{"id":1}}`) - }) - - key, _, err := client.Keys.Create(createRequest) - if err != nil { - t.Errorf("Keys.Create returned error: %v", err) - } - - expected := &Key{ID: 1} - if !reflect.DeepEqual(key, expected) { - t.Errorf("Keys.Create returned %+v, expected %+v", key, expected) - } -} - -func TestKeys_UpdateByID(t *testing.T) { - setup() - defer teardown() - - updateRequest := &KeyUpdateRequest{ - Name: "name", - } - - mux.HandleFunc("/v2/account/keys/12345", func(w http.ResponseWriter, r *http.Request) { - expected := map[string]interface{}{ - "name": "name", - } - - var v map[string]interface{} - err := json.NewDecoder(r.Body).Decode(&v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - if !reflect.DeepEqual(v, expected) { - t.Errorf("Request body = %#v, expected %#v", v, expected) - } - - fmt.Fprintf(w, `{"ssh_key":{"id":1}}`) - }) - - key, _, err := client.Keys.UpdateByID(12345, updateRequest) - if err != nil { - t.Errorf("Keys.Update returned error: %v", err) - } else { - if id := key.ID; id != 1 { - t.Errorf("expected id '%d', received '%d'", 1, id) - } - } -} - -func TestKeys_UpdateByFingerprint(t *testing.T) { - setup() - defer teardown() - - updateRequest := &KeyUpdateRequest{ - Name: "name", - } - - mux.HandleFunc("/v2/account/keys/3b:16:bf:e4:8b:00:8b:b8:59:8c:a9:d3:f0:19:45:fa", func(w http.ResponseWriter, r *http.Request) { - expected := map[string]interface{}{ - "name": "name", - } - - var v map[string]interface{} - err := json.NewDecoder(r.Body).Decode(&v) - if err != nil { - t.Fatalf("decode json: %v", err) - } - - if !reflect.DeepEqual(v, expected) { - t.Errorf("Request body = %#v, expected %#v", v, expected) - } - - fmt.Fprintf(w, `{"ssh_key":{"id":1}}`) - }) - - key, _, err := client.Keys.UpdateByFingerprint("3b:16:bf:e4:8b:00:8b:b8:59:8c:a9:d3:f0:19:45:fa", updateRequest) - if err != nil { - t.Errorf("Keys.Update returned error: %v", err) - } else { - if id := key.ID; id != 1 { - t.Errorf("expected id '%d', received '%d'", 1, id) - } - } -} - -func TestKeys_DestroyByID(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/account/keys/12345", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - }) - - _, err := client.Keys.DeleteByID(12345) - if err != nil { - t.Errorf("Keys.Delete returned error: %v", err) - } -} - -func TestKeys_DestroyByFingerprint(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/account/keys/aa:bb:cc", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - }) - - _, err := client.Keys.DeleteByFingerprint("aa:bb:cc") - if err != nil { - t.Errorf("Keys.Delete returned error: %v", err) - } -} - -func TestKey_String(t *testing.T) { - key := &Key{ - ID: 123, - Name: "Key", - Fingerprint: "fingerprint", - PublicKey: "public key", - } - - stringified := key.String() - expected := `godo.Key{ID:123, Name:"Key", Fingerprint:"fingerprint", PublicKey:"public key"}` - if expected != stringified { - t.Errorf("Key.String returned %+v, expected %+v", stringified, expected) - } -} diff --git a/vendor/github.com/digitalocean/godo/links_test.go b/vendor/github.com/digitalocean/godo/links_test.go deleted file mode 100644 index 02c9f34d25..0000000000 --- a/vendor/github.com/digitalocean/godo/links_test.go +++ /dev/null @@ -1,176 +0,0 @@ -package godo - -import ( - "encoding/json" - "testing" -) - -var ( - firstPageLinksJSONBlob = []byte(`{ - "links": { - "pages": { - "last": "https://api.digitalocean.com/v2/droplets/?page=3", - "next": "https://api.digitalocean.com/v2/droplets/?page=2" - } - } - }`) - otherPageLinksJSONBlob = []byte(`{ - "links": { - "pages": { - "first": "https://api.digitalocean.com/v2/droplets/?page=1", - "prev": "https://api.digitalocean.com/v2/droplets/?page=1", - "last": "https://api.digitalocean.com/v2/droplets/?page=3", - "next": "https://api.digitalocean.com/v2/droplets/?page=3" - } - } - }`) - lastPageLinksJSONBlob = []byte(`{ - "links": { - "pages": { - "first": "https://api.digitalocean.com/v2/droplets/?page=1", - "prev": "https://api.digitalocean.com/v2/droplets/?page=2" - } - } - }`) - - missingLinksJSONBlob = []byte(`{ }`) -) - -type godoList struct { - Links Links `json:"links"` -} - -func loadLinksJSON(t *testing.T, j []byte) Links { - var list godoList - err := json.Unmarshal(j, &list) - if err != nil { - t.Fatal(err) - } - - return list.Links -} - -func TestLinks_ParseFirst(t *testing.T) { - links := loadLinksJSON(t, firstPageLinksJSONBlob) - _, err := links.CurrentPage() - if err != nil { - t.Fatal(err) - } - - r := &Response{Links: &links} - checkCurrentPage(t, r, 1) - - if links.IsLastPage() { - t.Fatalf("shouldn't be last page") - } -} - -func TestLinks_ParseMiddle(t *testing.T) { - links := loadLinksJSON(t, otherPageLinksJSONBlob) - _, err := links.CurrentPage() - if err != nil { - t.Fatal(err) - } - - r := &Response{Links: &links} - checkCurrentPage(t, r, 2) - - if links.IsLastPage() { - t.Fatalf("shouldn't be last page") - } -} - -func TestLinks_ParseLast(t *testing.T) { - links := loadLinksJSON(t, lastPageLinksJSONBlob) - _, err := links.CurrentPage() - if err != nil { - t.Fatal(err) - } - - r := &Response{Links: &links} - checkCurrentPage(t, r, 3) - if !links.IsLastPage() { - t.Fatalf("expected last page") - } -} - -func TestLinks_ParseMissing(t *testing.T) { - links := loadLinksJSON(t, missingLinksJSONBlob) - _, err := links.CurrentPage() - if err != nil { - t.Fatal(err) - } - - r := &Response{Links: &links} - checkCurrentPage(t, r, 1) -} - -func TestLinks_ParseURL(t *testing.T) { - type linkTest struct { - name, url string - expected int - } - - linkTests := []linkTest{ - { - name: "prev", - url: "https://api.digitalocean.com/v2/droplets/?page=1", - expected: 1, - }, - { - name: "last", - url: "https://api.digitalocean.com/v2/droplets/?page=5", - expected: 5, - }, - { - name: "nexta", - url: "https://api.digitalocean.com/v2/droplets/?page=2", - expected: 2, - }, - } - - for _, lT := range linkTests { - p, err := pageForURL(lT.url) - if err != nil { - t.Fatal(err) - } - - if p != lT.expected { - t.Errorf("expected page for '%s' to be '%d', was '%d'", - lT.url, lT.expected, p) - } - } - -} - -func TestLinks_ParseEmptyString(t *testing.T) { - type linkTest struct { - name, url string - expected int - } - - linkTests := []linkTest{ - { - name: "none", - url: "http://example.com", - expected: 0, - }, - { - name: "bad", - url: "no url", - expected: 0, - }, - { - name: "empty", - url: "", - expected: 0, - }, - } - - for _, lT := range linkTests { - _, err := pageForURL(lT.url) - if err == nil { - t.Fatalf("expected error for test '%s', but received none", lT.name) - } - } -} diff --git a/vendor/github.com/digitalocean/godo/regions_test.go b/vendor/github.com/digitalocean/godo/regions_test.go deleted file mode 100644 index 3c725763f8..0000000000 --- a/vendor/github.com/digitalocean/godo/regions_test.go +++ /dev/null @@ -1,91 +0,0 @@ -package godo - -import ( - "fmt" - "net/http" - "reflect" - "testing" -) - -func TestRegions_List(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/regions", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"regions":[{"slug":"1"},{"slug":"2"}]}`) - }) - - regions, _, err := client.Regions.List(nil) - if err != nil { - t.Errorf("Regions.List returned error: %v", err) - } - - expected := []Region{{Slug: "1"}, {Slug: "2"}} - if !reflect.DeepEqual(regions, expected) { - t.Errorf("Regions.List returned %+v, expected %+v", regions, expected) - } -} - -func TestRegions_ListRegionsMultiplePages(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/regions", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"regions": [{"id":1},{"id":2}], "links":{"pages":{"next":"http://example.com/v2/regions/?page=2"}}}`) - }) - - _, resp, err := client.Regions.List(nil) - if err != nil { - t.Fatal(err) - } - - checkCurrentPage(t, resp, 1) -} - -func TestRegions_RetrievePageByNumber(t *testing.T) { - setup() - defer teardown() - - jBlob := ` - { - "regions": [{"id":1},{"id":2}], - "links":{ - "pages":{ - "next":"http://example.com/v2/regions/?page=3", - "prev":"http://example.com/v2/regions/?page=1", - "last":"http://example.com/v2/regions/?page=3", - "first":"http://example.com/v2/regions/?page=1" - } - } - }` - - mux.HandleFunc("/v2/regions", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, jBlob) - }) - - opt := &ListOptions{Page: 2} - _, resp, err := client.Regions.List(opt) - if err != nil { - t.Fatal(err) - } - - checkCurrentPage(t, resp, 2) -} - -func TestRegion_String(t *testing.T) { - region := &Region{ - Slug: "region", - Name: "Region", - Sizes: []string{"1", "2"}, - Available: true, - } - - stringified := region.String() - expected := `godo.Region{Slug:"region", Name:"Region", Sizes:["1" "2"], Available:true}` - if expected != stringified { - t.Errorf("Region.String returned %+v, expected %+v", stringified, expected) - } -} diff --git a/vendor/github.com/digitalocean/godo/sizes_test.go b/vendor/github.com/digitalocean/godo/sizes_test.go deleted file mode 100644 index 390ddf4dba..0000000000 --- a/vendor/github.com/digitalocean/godo/sizes_test.go +++ /dev/null @@ -1,96 +0,0 @@ -package godo - -import ( - "fmt" - "net/http" - "reflect" - "testing" -) - -func TestSizes_List(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/sizes", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"sizes":[{"slug":"1"},{"slug":"2"}]}`) - }) - - sizes, _, err := client.Sizes.List(nil) - if err != nil { - t.Errorf("Sizes.List returned error: %v", err) - } - - expected := []Size{{Slug: "1"}, {Slug: "2"}} - if !reflect.DeepEqual(sizes, expected) { - t.Errorf("Sizes.List returned %+v, expected %+v", sizes, expected) - } -} - -func TestSizes_ListSizesMultiplePages(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/v2/sizes", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"sizes": [{"id":1},{"id":2}], "links":{"pages":{"next":"http://example.com/v2/sizes/?page=2"}}}`) - }) - - _, resp, err := client.Sizes.List(nil) - if err != nil { - t.Fatal(err) - } - - checkCurrentPage(t, resp, 1) -} - -func TestSizes_RetrievePageByNumber(t *testing.T) { - setup() - defer teardown() - - jBlob := ` - { - "sizes": [{"id":1},{"id":2}], - "links":{ - "pages":{ - "next":"http://example.com/v2/sizes/?page=3", - "prev":"http://example.com/v2/sizes/?page=1", - "last":"http://example.com/v2/sizes/?page=3", - "first":"http://example.com/v2/sizes/?page=1" - } - } - }` - - mux.HandleFunc("/v2/sizes", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, jBlob) - }) - - opt := &ListOptions{Page: 2} - _, resp, err := client.Sizes.List(opt) - if err != nil { - t.Fatal(err) - } - - checkCurrentPage(t, resp, 2) -} - -func TestSize_String(t *testing.T) { - size := &Size{ - Slug: "slize", - Memory: 123, - Vcpus: 456, - Disk: 789, - PriceMonthly: 123, - PriceHourly: 456, - Regions: []string{"1", "2"}, - Available: true, - Transfer: 789, - } - - stringified := size.String() - expected := `godo.Size{Slug:"slize", Memory:123, Vcpus:456, Disk:789, PriceMonthly:123, PriceHourly:456, Regions:["1" "2"], Available:true, Transfer:789}` - if expected != stringified { - t.Errorf("Size.String returned %+v, expected %+v", stringified, expected) - } -} diff --git a/vendor/github.com/digitalocean/godo/timestamp_test.go b/vendor/github.com/digitalocean/godo/timestamp_test.go deleted file mode 100644 index 087e8aac14..0000000000 --- a/vendor/github.com/digitalocean/godo/timestamp_test.go +++ /dev/null @@ -1,176 +0,0 @@ -package godo - -import ( - "encoding/json" - "fmt" - "testing" - "time" -) - -const ( - emptyTimeStr = `"0001-01-01T00:00:00Z"` - referenceTimeStr = `"2006-01-02T15:04:05Z"` - referenceUnixTimeStr = `1136214245` -) - -var ( - referenceTime = time.Date(2006, 01, 02, 15, 04, 05, 0, time.UTC) - unixOrigin = time.Unix(0, 0).In(time.UTC) -) - -func TestTimestamp_Marshal(t *testing.T) { - testCases := []struct { - desc string - data Timestamp - want string - wantErr bool - equal bool - }{ - {"Reference", Timestamp{referenceTime}, referenceTimeStr, false, true}, - {"Empty", Timestamp{}, emptyTimeStr, false, true}, - {"Mismatch", Timestamp{}, referenceTimeStr, false, false}, - } - for _, tc := range testCases { - out, err := json.Marshal(tc.data) - if gotErr := (err != nil); gotErr != tc.wantErr { - t.Errorf("%s: gotErr=%v, wantErr=%v, err=%v", tc.desc, gotErr, tc.wantErr, err) - } - got := string(out) - equal := got == tc.want - if (got == tc.want) != tc.equal { - t.Errorf("%s: got=%s, want=%s, equal=%v, want=%v", tc.desc, got, tc.want, equal, tc.equal) - } - } -} - -func TestTimestamp_Unmarshal(t *testing.T) { - testCases := []struct { - desc string - data string - want Timestamp - wantErr bool - equal bool - }{ - {"Reference", referenceTimeStr, Timestamp{referenceTime}, false, true}, - {"ReferenceUnix", `1136214245`, Timestamp{referenceTime}, false, true}, - {"Empty", emptyTimeStr, Timestamp{}, false, true}, - {"UnixStart", `0`, Timestamp{unixOrigin}, false, true}, - {"Mismatch", referenceTimeStr, Timestamp{}, false, false}, - {"MismatchUnix", `0`, Timestamp{}, false, false}, - {"Invalid", `"asdf"`, Timestamp{referenceTime}, true, false}, - } - for _, tc := range testCases { - var got Timestamp - err := json.Unmarshal([]byte(tc.data), &got) - if gotErr := err != nil; gotErr != tc.wantErr { - t.Errorf("%s: gotErr=%v, wantErr=%v, err=%v", tc.desc, gotErr, tc.wantErr, err) - continue - } - equal := got.Equal(tc.want) - if equal != tc.equal { - t.Errorf("%s: got=%#v, want=%#v, equal=%v, want=%v", tc.desc, got, tc.want, equal, tc.equal) - } - } -} - -func TestTimstamp_MarshalReflexivity(t *testing.T) { - testCases := []struct { - desc string - data Timestamp - }{ - {"Reference", Timestamp{referenceTime}}, - {"Empty", Timestamp{}}, - } - for _, tc := range testCases { - data, err := json.Marshal(tc.data) - if err != nil { - t.Errorf("%s: Marshal err=%v", tc.desc, err) - } - var got Timestamp - err = json.Unmarshal(data, &got) - if !got.Equal(tc.data) { - t.Errorf("%s: %+v != %+v", tc.desc, got, data) - } - } -} - -type WrappedTimestamp struct { - A int - Time Timestamp -} - -func TestWrappedTimstamp_Marshal(t *testing.T) { - testCases := []struct { - desc string - data WrappedTimestamp - want string - wantErr bool - equal bool - }{ - {"Reference", WrappedTimestamp{0, Timestamp{referenceTime}}, fmt.Sprintf(`{"A":0,"Time":%s}`, referenceTimeStr), false, true}, - {"Empty", WrappedTimestamp{}, fmt.Sprintf(`{"A":0,"Time":%s}`, emptyTimeStr), false, true}, - {"Mismatch", WrappedTimestamp{}, fmt.Sprintf(`{"A":0,"Time":%s}`, referenceTimeStr), false, false}, - } - for _, tc := range testCases { - out, err := json.Marshal(tc.data) - if gotErr := err != nil; gotErr != tc.wantErr { - t.Errorf("%s: gotErr=%v, wantErr=%v, err=%v", tc.desc, gotErr, tc.wantErr, err) - } - got := string(out) - equal := got == tc.want - if equal != tc.equal { - t.Errorf("%s: got=%s, want=%s, equal=%v, want=%v", tc.desc, got, tc.want, equal, tc.equal) - } - } -} - -func TestWrappedTimestamp_Unmarshal(t *testing.T) { - testCases := []struct { - desc string - data string - want WrappedTimestamp - wantErr bool - equal bool - }{ - {"Reference", referenceTimeStr, WrappedTimestamp{0, Timestamp{referenceTime}}, false, true}, - {"ReferenceUnix", referenceUnixTimeStr, WrappedTimestamp{0, Timestamp{referenceTime}}, false, true}, - {"Empty", emptyTimeStr, WrappedTimestamp{0, Timestamp{}}, false, true}, - {"UnixStart", `0`, WrappedTimestamp{0, Timestamp{unixOrigin}}, false, true}, - {"Mismatch", referenceTimeStr, WrappedTimestamp{0, Timestamp{}}, false, false}, - {"MismatchUnix", `0`, WrappedTimestamp{0, Timestamp{}}, false, false}, - {"Invalid", `"asdf"`, WrappedTimestamp{0, Timestamp{referenceTime}}, true, false}, - } - for _, tc := range testCases { - var got Timestamp - err := json.Unmarshal([]byte(tc.data), &got) - if gotErr := err != nil; gotErr != tc.wantErr { - t.Errorf("%s: gotErr=%v, wantErr=%v, err=%v", tc.desc, gotErr, tc.wantErr, err) - continue - } - equal := got.Time.Equal(tc.want.Time.Time) - if equal != tc.equal { - t.Errorf("%s: got=%#v, want=%#v, equal=%v, want=%v", tc.desc, got, tc.want, equal, tc.equal) - } - } -} - -func TestWrappedTimestamp_MarshalReflexivity(t *testing.T) { - testCases := []struct { - desc string - data WrappedTimestamp - }{ - {"Reference", WrappedTimestamp{0, Timestamp{referenceTime}}}, - {"Empty", WrappedTimestamp{0, Timestamp{}}}, - } - for _, tc := range testCases { - bytes, err := json.Marshal(tc.data) - if err != nil { - t.Errorf("%s: Marshal err=%v", tc.desc, err) - } - var got WrappedTimestamp - err = json.Unmarshal(bytes, &got) - if !got.Time.Equal(tc.data.Time) { - t.Errorf("%s: %+v != %+v", tc.desc, got, tc.data) - } - } -} diff --git a/vendor/github.com/digitalocean/godo/util/droplet_test.go b/vendor/github.com/digitalocean/godo/util/droplet_test.go deleted file mode 100644 index e0a82ad96c..0000000000 --- a/vendor/github.com/digitalocean/godo/util/droplet_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package util - -import ( - "golang.org/x/oauth2" - - "github.com/digitalocean/godo" -) - -func ExampleWaitForActive() { - // build client - pat := "mytoken" - token := &oauth2.Token{AccessToken: pat} - t := oauth2.StaticTokenSource(token) - - oauthClient := oauth2.NewClient(oauth2.NoContext, t) - client := godo.NewClient(oauthClient) - - // create your droplet and retrieve the create action uri - uri := "https://api.digitalocean.com/v2/actions/xxxxxxxx" - - // block until until the action is complete - err := WaitForActive(client, uri) - if err != nil { - panic(err) - } -} diff --git a/vendor/github.com/dylanmei/iso8601/duration_test.go b/vendor/github.com/dylanmei/iso8601/duration_test.go deleted file mode 100644 index 5a2b2527fe..0000000000 --- a/vendor/github.com/dylanmei/iso8601/duration_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package iso8601 - -import ( - "testing" - "time" -) - -func Test_parse_duration(t *testing.T) { - var dur time.Duration - var err error - - // test with bad format - _, err = ParseDuration("asdf") - if err != ErrBadFormat { - t.Fatalf("Expected an ErrBadFormat") - } - - // test with month - _, err = ParseDuration("P1M") - if err != ErrNoMonth { - t.Fatalf("Expected an ErrNoMonth") - } - - // test with good full string - exp, _ := time.ParseDuration("51h4m5s") - dur, err = ParseDuration("P2DT3H4M5S") - if err != nil { - t.Fatalf("Did not expect err: %v", err) - } - if dur.Hours() != exp.Hours() { - t.Errorf("Expected %v hours, not %v", exp.Hours(), dur.Hours()) - } - if dur.Minutes() != exp.Minutes() { - t.Errorf("Expected %v minutes, not %v", exp.Hours(), dur.Minutes()) - } - if dur.Seconds() != exp.Seconds() { - t.Errorf("Expected 5 seconds, not %v", exp.Nanoseconds(), dur.Seconds()) - } - if dur.Nanoseconds() != exp.Nanoseconds() { - t.Error("Expected %v nanoseconds, not %v", exp.Nanoseconds(), dur.Nanoseconds()) - } - - // test with good week string - dur, err = ParseDuration("P1W") - if err != nil { - t.Fatalf("Did not expect err: %v", err) - } - if dur.Hours() != 24*7 { - t.Errorf("Expected 168 hours, not %d", dur.Hours()) - } -} - -func Test_format_duration(t *testing.T) { - // Test complex duration with hours, minutes, seconds - d := time.Duration(3701) * time.Second - s := FormatDuration(d) - if s != "PT1H1M41S" { - t.Fatalf("bad ISO 8601 duration string: %s", s) - } - - // Test only minutes duration - d = time.Duration(20) * time.Minute - s = FormatDuration(d) - if s != "PT20M" { - t.Fatalf("bad ISO 8601 duration string for 20M: %s", s) - } - - // Test only seconds - d = time.Duration(1) * time.Second - s = FormatDuration(d) - if s != "PT1S" { - t.Fatalf("bad ISO 8601 duration string for 1S: %s", s) - } - - // Test negative duration (unsupported) - d = time.Duration(-1) * time.Second - s = FormatDuration(d) - if s != "PT0S" { - t.Fatalf("bad ISO 8601 duration string for negative: %s", s) - } -} diff --git a/vendor/github.com/dylanmei/winrmtest/wsman_test.go b/vendor/github.com/dylanmei/winrmtest/wsman_test.go deleted file mode 100644 index e9e4999e80..0000000000 --- a/vendor/github.com/dylanmei/winrmtest/wsman_test.go +++ /dev/null @@ -1,220 +0,0 @@ -package winrmtest - -import ( - "fmt" - "io" - "net/http" - "net/http/httptest" - "strings" - "testing" - - "github.com/masterzen/winrm/soap" - "github.com/masterzen/xmlpath" - "github.com/satori/go.uuid" -) - -func Test_creating_a_shell(t *testing.T) { - w := &wsman{} - - res := httptest.NewRecorder() - req, _ := http.NewRequest("POST", "", strings.NewReader(` - - - http://schemas.xmlsoap.org/ws/2004/09/transfer/Create - - - - stdin - stdout stderr - - - `)) - - w.ServeHTTP(res, req) - if res.Code != http.StatusOK { - t.Errorf("Expected 200 OK but was %d.\n", res.Code) - } - - if contentType := res.HeaderMap.Get("Content-Type"); contentType != "application/soap+xml" { - t.Errorf("Expected ContentType application/soap+xml was %s.\n", contentType) - } - - env, err := xmlpath.Parse(res.Body) - if err != nil { - t.Error("Couldn't compile the SOAP response.") - } - - xpath, _ := xmlpath.CompileWithNamespace( - "//rsp:ShellId", soap.GetAllNamespaces()) - - if _, found := xpath.String(env); !found { - t.Error("Expected a Shell identifier.") - } -} - -func Test_executing_a_command(t *testing.T) { - w := &wsman{} - id := w.HandleCommand(MatchText("echo tacos"), func(out, err io.Writer) int { - return 0 - }) - - res := httptest.NewRecorder() - req, _ := http.NewRequest("POST", "", strings.NewReader(` - - - http://schemas.xmlsoap.org/ws/2004/09/shell/Command - - - "echo tacos" - - `)) - - w.ServeHTTP(res, req) - if res.Code != http.StatusOK { - t.Errorf("Expected 200 OK but was %d.\n", res.Code) - } - - env, err := xmlpath.Parse(res.Body) - if err != nil { - t.Error("Couldn't compile the SOAP response.") - } - - xpath, _ := xmlpath.CompileWithNamespace( - "//rsp:CommandId", soap.GetAllNamespaces()) - - result, _ := xpath.String(env) - if result != id { - t.Errorf("Expected CommandId=%s but was \"%s\"", id, result) - } -} - -func Test_executing_a_regex_command(t *testing.T) { - w := &wsman{} - id := w.HandleCommand(MatchPattern(`echo .* >> C:\file.cmd`), func(out, err io.Writer) int { - return 0 - }) - - res := httptest.NewRecorder() - req, _ := http.NewRequest("POST", "", strings.NewReader(fmt.Sprintf(` - - - http://schemas.xmlsoap.org/ws/2004/09/shell/Command - - - "echo %d >> C:\file.cmd" - - `, uuid.NewV4().String()))) - - w.ServeHTTP(res, req) - if res.Code != http.StatusOK { - t.Errorf("Expected 200 OK but was %d.\n", res.Code) - } - - env, err := xmlpath.Parse(res.Body) - if err != nil { - t.Error("Couldn't compile the SOAP response.") - } - - xpath, _ := xmlpath.CompileWithNamespace( - "//rsp:CommandId", soap.GetAllNamespaces()) - - result, _ := xpath.String(env) - if result != id { - t.Errorf("Expected CommandId=%s but was \"%s\"", id, result) - } -} - -func Test_receiving_command_results(t *testing.T) { - w := &wsman{} - id := w.HandleCommand(MatchText("echo tacos"), func(out, err io.Writer) int { - out.Write([]byte("tacos")) - return 0 - }) - - res := httptest.NewRecorder() - req, _ := http.NewRequest("POST", "", strings.NewReader(fmt.Sprintf(` - - - http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Receive - - - stdout stderr - - `, id))) - - w.ServeHTTP(res, req) - if res.Code != http.StatusOK { - t.Errorf("Expected 200 OK but was %d.\n", res.Code) - } - - env, err := xmlpath.Parse(res.Body) - if err != nil { - t.Error("Couldn't compile the SOAP response.") - } - - xpath, _ := xmlpath.CompileWithNamespace("//rsp:ReceiveResponse", soap.GetAllNamespaces()) - iter := xpath.Iter(env) - if !iter.Next() { - t.Error("Expected a ReceiveResponse element.") - } - - xresp := iter.Node() - xpath, _ = xmlpath.CompileWithNamespace( - fmt.Sprintf("rsp:Stream[@CommandId='%s']", id), soap.GetAllNamespaces()) - iter = xpath.Iter(xresp) - - if !iter.Next() || !nodeHasAttribute(iter.Node(), "Name", "stdout") || iter.Node().String() != "dGFjb3M=" { - t.Error("Expected an stdout Stream with the text \"dGFjb3M=\".") - } - - if !iter.Next() || !nodeHasAttribute(iter.Node(), "Name", "stdout") || !nodeHasAttribute(iter.Node(), "End", "true") { - t.Error("Expected an stdout Stream with an \"End\" attribute.") - } - - if !iter.Next() || !nodeHasAttribute(iter.Node(), "Name", "stderr") || !nodeHasAttribute(iter.Node(), "End", "true") { - t.Error("Expected an stderr Stream with an \"End\" attribute.") - } - - xpath, _ = xmlpath.CompileWithNamespace( - "//rsp:CommandState[@State='http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandState/Done']", - soap.GetAllNamespaces()) - - if _, found := xpath.String(env); !found { - t.Error("Expected CommandState=\"Done\"") - } - - xpath, _ = xmlpath.CompileWithNamespace("//rsp:CommandState/rsp:ExitCode", soap.GetAllNamespaces()) - if code, _ := xpath.String(env); code != "0" { - t.Errorf("Expected ExitCode=0 but found \"%s\"\n", code) - } -} - -func Test_deleting_a_shell(t *testing.T) { - w := &wsman{} - - res := httptest.NewRecorder() - req, _ := http.NewRequest("POST", "", strings.NewReader(` - - - http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete - - `)) - - w.ServeHTTP(res, req) - if res.Code != http.StatusOK { - t.Errorf("Expected 200 OK but was %d.\n", res.Code) - } - - if res.Body.Len() != 0 { - t.Errorf("Expected body to be empty but was \"%v\".", res.Body) - } -} - -func nodeHasAttribute(n *xmlpath.Node, name, value string) bool { - xpath := xmlpath.MustCompile("attribute::" + name) - if result, found := xpath.String(n); found { - return result == value - } - - return false -} diff --git a/vendor/github.com/fsouza/go-dockerclient/auth_test.go b/vendor/github.com/fsouza/go-dockerclient/auth_test.go deleted file mode 100644 index e53b176011..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/auth_test.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2015 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package docker - -import ( - "encoding/base64" - "fmt" - "net/http" - "strings" - "testing" -) - -func TestAuthLegacyConfig(t *testing.T) { - auth := base64.StdEncoding.EncodeToString([]byte("user:pa:ss")) - read := strings.NewReader(fmt.Sprintf(`{"docker.io":{"auth":"%s","email":"user@example.com"}}`, auth)) - ac, err := NewAuthConfigurations(read) - if err != nil { - t.Error(err) - } - c, ok := ac.Configs["docker.io"] - if !ok { - t.Error("NewAuthConfigurations: Expected Configs to contain docker.io") - } - if got, want := c.Email, "user@example.com"; got != want { - t.Errorf(`AuthConfigurations.Configs["docker.io"].Email: wrong result. Want %q. Got %q`, want, got) - } - if got, want := c.Username, "user"; got != want { - t.Errorf(`AuthConfigurations.Configs["docker.io"].Username: wrong result. Want %q. Got %q`, want, got) - } - if got, want := c.Password, "pa:ss"; got != want { - t.Errorf(`AuthConfigurations.Configs["docker.io"].Password: wrong result. Want %q. Got %q`, want, got) - } - if got, want := c.ServerAddress, "docker.io"; got != want { - t.Errorf(`AuthConfigurations.Configs["docker.io"].ServerAddress: wrong result. Want %q. Got %q`, want, got) - } -} - -func TestAuthBadConfig(t *testing.T) { - auth := base64.StdEncoding.EncodeToString([]byte("userpass")) - read := strings.NewReader(fmt.Sprintf(`{"docker.io":{"auth":"%s","email":"user@example.com"}}`, auth)) - ac, err := NewAuthConfigurations(read) - if err != ErrCannotParseDockercfg { - t.Errorf("Incorrect error returned %v\n", err) - } - if ac != nil { - t.Errorf("Invalid auth configuration returned, should be nil %v\n", ac) - } -} - -func TestAuthConfig(t *testing.T) { - auth := base64.StdEncoding.EncodeToString([]byte("user:pass")) - read := strings.NewReader(fmt.Sprintf(`{"auths":{"docker.io":{"auth":"%s","email":"user@example.com"}}}`, auth)) - ac, err := NewAuthConfigurations(read) - if err != nil { - t.Error(err) - } - c, ok := ac.Configs["docker.io"] - if !ok { - t.Error("NewAuthConfigurations: Expected Configs to contain docker.io") - } - if got, want := c.Email, "user@example.com"; got != want { - t.Errorf(`AuthConfigurations.Configs["docker.io"].Email: wrong result. Want %q. Got %q`, want, got) - } - if got, want := c.Username, "user"; got != want { - t.Errorf(`AuthConfigurations.Configs["docker.io"].Username: wrong result. Want %q. Got %q`, want, got) - } - if got, want := c.Password, "pass"; got != want { - t.Errorf(`AuthConfigurations.Configs["docker.io"].Password: wrong result. Want %q. Got %q`, want, got) - } - if got, want := c.ServerAddress, "docker.io"; got != want { - t.Errorf(`AuthConfigurations.Configs["docker.io"].ServerAddress: wrong result. Want %q. Got %q`, want, got) - } -} - -func TestAuthCheck(t *testing.T) { - fakeRT := &FakeRoundTripper{status: http.StatusOK} - client := newTestClient(fakeRT) - if err := client.AuthCheck(nil); err == nil { - t.Fatalf("expected error on nil auth config") - } - // test good auth - if err := client.AuthCheck(&AuthConfiguration{}); err != nil { - t.Fatal(err) - } - *fakeRT = FakeRoundTripper{status: http.StatusUnauthorized} - if err := client.AuthCheck(&AuthConfiguration{}); err == nil { - t.Fatal("expected failure from unauthorized auth") - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/build_test.go b/vendor/github.com/fsouza/go-dockerclient/build_test.go deleted file mode 100644 index c9640f2057..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/build_test.go +++ /dev/null @@ -1,154 +0,0 @@ -package docker - -import ( - "bytes" - "io" - "io/ioutil" - "net/http" - "os" - "reflect" - "testing" - - "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive" -) - -func TestBuildImageMultipleContextsError(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - var buf bytes.Buffer - opts := BuildImageOptions{ - Name: "testImage", - NoCache: true, - SuppressOutput: true, - RmTmpContainer: true, - ForceRmTmpContainer: true, - InputStream: &buf, - OutputStream: &buf, - ContextDir: "testing/data", - } - err := client.BuildImage(opts) - if err != ErrMultipleContexts { - t.Errorf("BuildImage: providing both InputStream and ContextDir should produce an error") - } -} - -func TestBuildImageContextDirDockerignoreParsing(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - - if err := os.Symlink("doesnotexist", "testing/data/symlink"); err != nil { - t.Errorf("error creating symlink on demand: %s", err) - } - defer func() { - if err := os.Remove("testing/data/symlink"); err != nil { - t.Errorf("error removing symlink on demand: %s", err) - } - }() - - var buf bytes.Buffer - opts := BuildImageOptions{ - Name: "testImage", - NoCache: true, - SuppressOutput: true, - RmTmpContainer: true, - ForceRmTmpContainer: true, - OutputStream: &buf, - ContextDir: "testing/data", - } - err := client.BuildImage(opts) - if err != nil { - t.Fatal(err) - } - reqBody := fakeRT.requests[0].Body - tmpdir, err := unpackBodyTarball(reqBody) - if err != nil { - t.Fatal(err) - } - - defer func() { - if err := os.RemoveAll(tmpdir); err != nil { - t.Fatal(err) - } - }() - - files, err := ioutil.ReadDir(tmpdir) - if err != nil { - t.Fatal(err) - } - - foundFiles := []string{} - for _, file := range files { - foundFiles = append(foundFiles, file.Name()) - } - - expectedFiles := []string{ - ".dockerignore", - "Dockerfile", - "barfile", - "ca.pem", - "cert.pem", - "key.pem", - "server.pem", - "serverkey.pem", - "symlink", - } - - if !reflect.DeepEqual(expectedFiles, foundFiles) { - t.Errorf( - "BuildImage: incorrect files sent in tarball to docker server\nexpected %+v, found %+v", - expectedFiles, foundFiles, - ) - } -} - -func TestBuildImageSendXRegistryConfig(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - var buf bytes.Buffer - opts := BuildImageOptions{ - Name: "testImage", - NoCache: true, - SuppressOutput: true, - RmTmpContainer: true, - ForceRmTmpContainer: true, - OutputStream: &buf, - ContextDir: "testing/data", - AuthConfigs: AuthConfigurations{ - Configs: map[string]AuthConfiguration{ - "quay.io": { - Username: "foo", - Password: "bar", - Email: "baz", - ServerAddress: "quay.io", - }, - }, - }, - } - - encodedConfig := "eyJjb25maWdzIjp7InF1YXkuaW8iOnsidXNlcm5hbWUiOiJmb28iLCJwYXNzd29yZCI6ImJhciIsImVtYWlsIjoiYmF6Iiwic2VydmVyYWRkcmVzcyI6InF1YXkuaW8ifX19Cg==" - - if err := client.BuildImage(opts); err != nil { - t.Fatal(err) - } - - xRegistryConfig := fakeRT.requests[0].Header["X-Registry-Config"][0] - if xRegistryConfig != encodedConfig { - t.Errorf( - "BuildImage: X-Registry-Config not set currectly: expected %q, got %q", - encodedConfig, - xRegistryConfig, - ) - } -} - -func unpackBodyTarball(req io.ReadCloser) (tmpdir string, err error) { - tmpdir, err = ioutil.TempDir("", "go-dockerclient-test") - if err != nil { - return - } - err = archive.Untar(req, tmpdir, &archive.TarOptions{ - Compression: archive.Uncompressed, - NoLchown: true, - }) - return -} diff --git a/vendor/github.com/fsouza/go-dockerclient/change_test.go b/vendor/github.com/fsouza/go-dockerclient/change_test.go deleted file mode 100644 index 9418b183cf..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/change_test.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package docker - -import "testing" - -func TestChangeString(t *testing.T) { - var tests = []struct { - change Change - expected string - }{ - {Change{"/etc/passwd", ChangeModify}, "C /etc/passwd"}, - {Change{"/etc/passwd", ChangeAdd}, "A /etc/passwd"}, - {Change{"/etc/passwd", ChangeDelete}, "D /etc/passwd"}, - {Change{"/etc/passwd", 33}, " /etc/passwd"}, - } - for _, tt := range tests { - if got := tt.change.String(); got != tt.expected { - t.Errorf("Change.String(): want %q. Got %q.", tt.expected, got) - } - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/client_test.go b/vendor/github.com/fsouza/go-dockerclient/client_test.go deleted file mode 100644 index d6ae570ba5..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/client_test.go +++ /dev/null @@ -1,502 +0,0 @@ -// Copyright 2015 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package docker - -import ( - "bytes" - "fmt" - "io/ioutil" - "net" - "net/http" - "net/url" - "os" - "path/filepath" - "reflect" - "strconv" - "strings" - "testing" - "time" - - "github.com/fsouza/go-dockerclient/external/github.com/hashicorp/go-cleanhttp" -) - -func TestNewAPIClient(t *testing.T) { - endpoint := "http://localhost:4243" - client, err := NewClient(endpoint) - if err != nil { - t.Fatal(err) - } - if client.endpoint != endpoint { - t.Errorf("Expected endpoint %s. Got %s.", endpoint, client.endpoint) - } - // test unix socket endpoints - endpoint = "unix:///var/run/docker.sock" - client, err = NewClient(endpoint) - if err != nil { - t.Fatal(err) - } - if client.endpoint != endpoint { - t.Errorf("Expected endpoint %s. Got %s.", endpoint, client.endpoint) - } - if !client.SkipServerVersionCheck { - t.Error("Expected SkipServerVersionCheck to be true, got false") - } - if client.requestedAPIVersion != nil { - t.Errorf("Expected requestedAPIVersion to be nil, got %#v.", client.requestedAPIVersion) - } -} - -func newTLSClient(endpoint string) (*Client, error) { - return NewTLSClient(endpoint, - "testing/data/cert.pem", - "testing/data/key.pem", - "testing/data/ca.pem") -} - -func TestNewTSLAPIClient(t *testing.T) { - endpoint := "https://localhost:4243" - client, err := newTLSClient(endpoint) - if err != nil { - t.Fatal(err) - } - if client.endpoint != endpoint { - t.Errorf("Expected endpoint %s. Got %s.", endpoint, client.endpoint) - } - if !client.SkipServerVersionCheck { - t.Error("Expected SkipServerVersionCheck to be true, got false") - } - if client.requestedAPIVersion != nil { - t.Errorf("Expected requestedAPIVersion to be nil, got %#v.", client.requestedAPIVersion) - } -} - -func TestNewVersionedClient(t *testing.T) { - endpoint := "http://localhost:4243" - client, err := NewVersionedClient(endpoint, "1.12") - if err != nil { - t.Fatal(err) - } - if client.endpoint != endpoint { - t.Errorf("Expected endpoint %s. Got %s.", endpoint, client.endpoint) - } - if reqVersion := client.requestedAPIVersion.String(); reqVersion != "1.12" { - t.Errorf("Wrong requestAPIVersion. Want %q. Got %q.", "1.12", reqVersion) - } - if client.SkipServerVersionCheck { - t.Error("Expected SkipServerVersionCheck to be false, got true") - } -} - -func TestNewVersionedClientFromEnv(t *testing.T) { - endpoint := "tcp://localhost:2376" - endpointURL := "http://localhost:2376" - os.Setenv("DOCKER_HOST", endpoint) - os.Setenv("DOCKER_TLS_VERIFY", "") - client, err := NewVersionedClientFromEnv("1.12") - if err != nil { - t.Fatal(err) - } - if client.endpoint != endpoint { - t.Errorf("Expected endpoint %s. Got %s.", endpoint, client.endpoint) - } - if client.endpointURL.String() != endpointURL { - t.Errorf("Expected endpointURL %s. Got %s.", endpoint, client.endpoint) - } - if reqVersion := client.requestedAPIVersion.String(); reqVersion != "1.12" { - t.Errorf("Wrong requestAPIVersion. Want %q. Got %q.", "1.12", reqVersion) - } - if client.SkipServerVersionCheck { - t.Error("Expected SkipServerVersionCheck to be false, got true") - } -} - -func TestNewVersionedClientFromEnvTLS(t *testing.T) { - endpoint := "tcp://localhost:2376" - endpointURL := "https://localhost:2376" - base, _ := os.Getwd() - os.Setenv("DOCKER_CERT_PATH", filepath.Join(base, "/testing/data/")) - os.Setenv("DOCKER_HOST", endpoint) - os.Setenv("DOCKER_TLS_VERIFY", "1") - client, err := NewVersionedClientFromEnv("1.12") - if err != nil { - t.Fatal(err) - } - if client.endpoint != endpoint { - t.Errorf("Expected endpoint %s. Got %s.", endpoint, client.endpoint) - } - if client.endpointURL.String() != endpointURL { - t.Errorf("Expected endpointURL %s. Got %s.", endpoint, client.endpoint) - } - if reqVersion := client.requestedAPIVersion.String(); reqVersion != "1.12" { - t.Errorf("Wrong requestAPIVersion. Want %q. Got %q.", "1.12", reqVersion) - } - if client.SkipServerVersionCheck { - t.Error("Expected SkipServerVersionCheck to be false, got true") - } -} - -func TestNewTLSVersionedClient(t *testing.T) { - certPath := "testing/data/cert.pem" - keyPath := "testing/data/key.pem" - caPath := "testing/data/ca.pem" - endpoint := "https://localhost:4243" - client, err := NewVersionedTLSClient(endpoint, certPath, keyPath, caPath, "1.14") - if err != nil { - t.Fatal(err) - } - if client.endpoint != endpoint { - t.Errorf("Expected endpoint %s. Got %s.", endpoint, client.endpoint) - } - if reqVersion := client.requestedAPIVersion.String(); reqVersion != "1.14" { - t.Errorf("Wrong requestAPIVersion. Want %q. Got %q.", "1.14", reqVersion) - } - if client.SkipServerVersionCheck { - t.Error("Expected SkipServerVersionCheck to be false, got true") - } -} - -func TestNewTLSVersionedClientInvalidCA(t *testing.T) { - certPath := "testing/data/cert.pem" - keyPath := "testing/data/key.pem" - caPath := "testing/data/key.pem" - endpoint := "https://localhost:4243" - _, err := NewVersionedTLSClient(endpoint, certPath, keyPath, caPath, "1.14") - if err == nil { - t.Errorf("Expected invalid ca at %s", caPath) - } -} - -func TestNewClientInvalidEndpoint(t *testing.T) { - cases := []string{ - "htp://localhost:3243", "http://localhost:a", - "", "http://localhost:8080:8383", "http://localhost:65536", - "https://localhost:-20", - } - for _, c := range cases { - client, err := NewClient(c) - if client != nil { - t.Errorf("Want client for invalid endpoint, got %#v.", client) - } - if !reflect.DeepEqual(err, ErrInvalidEndpoint) { - t.Errorf("NewClient(%q): Got invalid error for invalid endpoint. Want %#v. Got %#v.", c, ErrInvalidEndpoint, err) - } - } -} - -func TestNewClientNoSchemeEndpoint(t *testing.T) { - cases := []string{"localhost", "localhost:8080"} - for _, c := range cases { - client, err := NewClient(c) - if client == nil { - t.Errorf("Want client for scheme-less endpoint, got ") - } - if err != nil { - t.Errorf("Got unexpected error scheme-less endpoint: %q", err) - } - } -} - -func TestNewTLSClient(t *testing.T) { - var tests = []struct { - endpoint string - expected string - }{ - {"tcp://localhost:2376", "https"}, - {"tcp://localhost:2375", "https"}, - {"tcp://localhost:4000", "https"}, - {"http://localhost:4000", "https"}, - } - for _, tt := range tests { - client, err := newTLSClient(tt.endpoint) - if err != nil { - t.Error(err) - } - got := client.endpointURL.Scheme - if got != tt.expected { - t.Errorf("endpointURL.Scheme: Got %s. Want %s.", got, tt.expected) - } - } -} - -func TestEndpoint(t *testing.T) { - client, err := NewVersionedClient("http://localhost:4243", "1.12") - if err != nil { - t.Fatal(err) - } - if endpoint := client.Endpoint(); endpoint != client.endpoint { - t.Errorf("Client.Endpoint(): want %q. Got %q", client.endpoint, endpoint) - } -} - -func TestGetURL(t *testing.T) { - var tests = []struct { - endpoint string - path string - expected string - }{ - {"http://localhost:4243/", "/", "http://localhost:4243/"}, - {"http://localhost:4243", "/", "http://localhost:4243/"}, - {"http://localhost:4243", "/containers/ps", "http://localhost:4243/containers/ps"}, - {"tcp://localhost:4243", "/containers/ps", "http://localhost:4243/containers/ps"}, - {"http://localhost:4243/////", "/", "http://localhost:4243/"}, - {"unix:///var/run/docker.socket", "/containers", "/containers"}, - } - for _, tt := range tests { - client, _ := NewClient(tt.endpoint) - client.endpoint = tt.endpoint - client.SkipServerVersionCheck = true - got := client.getURL(tt.path) - if got != tt.expected { - t.Errorf("getURL(%q): Got %s. Want %s.", tt.path, got, tt.expected) - } - } -} - -func TestGetFakeUnixURL(t *testing.T) { - var tests = []struct { - endpoint string - path string - expected string - }{ - {"unix://var/run/docker.sock", "/", "http://unix.sock/"}, - {"unix://var/run/docker.socket", "/", "http://unix.sock/"}, - {"unix://var/run/docker.sock", "/containers/ps", "http://unix.sock/containers/ps"}, - } - for _, tt := range tests { - client, _ := NewClient(tt.endpoint) - client.endpoint = tt.endpoint - client.SkipServerVersionCheck = true - got := client.getFakeUnixURL(tt.path) - if got != tt.expected { - t.Errorf("getURL(%q): Got %s. Want %s.", tt.path, got, tt.expected) - } - } -} - -func TestError(t *testing.T) { - fakeBody := ioutil.NopCloser(bytes.NewBufferString("bad parameter")) - resp := &http.Response{ - StatusCode: 400, - Body: fakeBody, - } - err := newError(resp) - expected := Error{Status: 400, Message: "bad parameter"} - if !reflect.DeepEqual(expected, *err) { - t.Errorf("Wrong error type. Want %#v. Got %#v.", expected, *err) - } - message := "API error (400): bad parameter" - if err.Error() != message { - t.Errorf("Wrong error message. Want %q. Got %q.", message, err.Error()) - } -} - -func TestQueryString(t *testing.T) { - v := float32(2.4) - f32QueryString := fmt.Sprintf("w=%s&x=10&y=10.35", strconv.FormatFloat(float64(v), 'f', -1, 64)) - jsonPerson := url.QueryEscape(`{"Name":"gopher","age":4}`) - var tests = []struct { - input interface{} - want string - }{ - {&ListContainersOptions{All: true}, "all=1"}, - {ListContainersOptions{All: true}, "all=1"}, - {ListContainersOptions{Before: "something"}, "before=something"}, - {ListContainersOptions{Before: "something", Since: "other"}, "before=something&since=other"}, - {ListContainersOptions{Filters: map[string][]string{"status": {"paused", "running"}}}, "filters=%7B%22status%22%3A%5B%22paused%22%2C%22running%22%5D%7D"}, - {dumb{X: 10, Y: 10.35000}, "x=10&y=10.35"}, - {dumb{W: v, X: 10, Y: 10.35000}, f32QueryString}, - {dumb{X: 10, Y: 10.35000, Z: 10}, "x=10&y=10.35&zee=10"}, - {dumb{v: 4, X: 10, Y: 10.35000}, "x=10&y=10.35"}, - {dumb{T: 10, Y: 10.35000}, "y=10.35"}, - {dumb{Person: &person{Name: "gopher", Age: 4}}, "p=" + jsonPerson}, - {nil, ""}, - {10, ""}, - {"not_a_struct", ""}, - } - for _, tt := range tests { - got := queryString(tt.input) - if got != tt.want { - t.Errorf("queryString(%v). Want %q. Got %q.", tt.input, tt.want, got) - } - } -} - -func TestAPIVersions(t *testing.T) { - var tests = []struct { - a string - b string - expectedALessThanB bool - expectedALessThanOrEqualToB bool - expectedAGreaterThanB bool - expectedAGreaterThanOrEqualToB bool - }{ - {"1.11", "1.11", false, true, false, true}, - {"1.10", "1.11", true, true, false, false}, - {"1.11", "1.10", false, false, true, true}, - - {"1.11-ubuntu0", "1.11", false, true, false, true}, - {"1.10", "1.11-el7", true, true, false, false}, - - {"1.9", "1.11", true, true, false, false}, - {"1.11", "1.9", false, false, true, true}, - - {"1.1.1", "1.1", false, false, true, true}, - {"1.1", "1.1.1", true, true, false, false}, - - {"2.1", "1.1.1", false, false, true, true}, - {"2.1", "1.3.1", false, false, true, true}, - {"1.1.1", "2.1", true, true, false, false}, - {"1.3.1", "2.1", true, true, false, false}, - } - - for _, tt := range tests { - a, _ := NewAPIVersion(tt.a) - b, _ := NewAPIVersion(tt.b) - - if tt.expectedALessThanB && !a.LessThan(b) { - t.Errorf("Expected %#v < %#v", a, b) - } - if tt.expectedALessThanOrEqualToB && !a.LessThanOrEqualTo(b) { - t.Errorf("Expected %#v <= %#v", a, b) - } - if tt.expectedAGreaterThanB && !a.GreaterThan(b) { - t.Errorf("Expected %#v > %#v", a, b) - } - if tt.expectedAGreaterThanOrEqualToB && !a.GreaterThanOrEqualTo(b) { - t.Errorf("Expected %#v >= %#v", a, b) - } - } -} - -func TestPing(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - err := client.Ping() - if err != nil { - t.Fatal(err) - } -} - -func TestPingFailing(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusInternalServerError} - client := newTestClient(fakeRT) - err := client.Ping() - if err == nil { - t.Fatal("Expected non nil error, got nil") - } - expectedErrMsg := "API error (500): " - if err.Error() != expectedErrMsg { - t.Fatalf("Expected error to be %q, got: %q", expectedErrMsg, err.Error()) - } -} - -func TestPingFailingWrongStatus(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusAccepted} - client := newTestClient(fakeRT) - err := client.Ping() - if err == nil { - t.Fatal("Expected non nil error, got nil") - } - expectedErrMsg := "API error (202): " - if err.Error() != expectedErrMsg { - t.Fatalf("Expected error to be %q, got: %q", expectedErrMsg, err.Error()) - } -} - -func TestPingErrorWithUnixSocket(t *testing.T) { - go func() { - li, err := net.Listen("unix", "/tmp/echo.sock") - if err != nil { - t.Fatal(err) - } - defer li.Close() - if err != nil { - t.Fatalf("Expected to get listener, but failed: %#v", err) - } - - fd, err := li.Accept() - if err != nil { - t.Fatalf("Expected to accept connection, but failed: %#v", err) - } - - buf := make([]byte, 512) - nr, err := fd.Read(buf) - - // Create invalid response message to trigger error. - data := buf[0:nr] - for i := 0; i < 10; i++ { - data[i] = 63 - } - - _, err = fd.Write(data) - if err != nil { - t.Fatalf("Expected to write to socket, but failed: %#v", err) - } - - return - }() - - // Wait for unix socket to listen - time.Sleep(10 * time.Millisecond) - - endpoint := "unix:///tmp/echo.sock" - u, _ := parseEndpoint(endpoint, false) - client := Client{ - HTTPClient: cleanhttp.DefaultClient(), - Dialer: &net.Dialer{}, - endpoint: endpoint, - endpointURL: u, - SkipServerVersionCheck: true, - } - - err := client.Ping() - if err == nil { - t.Fatal("Expected non nil error, got nil") - } -} - -type FakeRoundTripper struct { - message string - status int - header map[string]string - requests []*http.Request -} - -func (rt *FakeRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) { - body := strings.NewReader(rt.message) - rt.requests = append(rt.requests, r) - res := &http.Response{ - StatusCode: rt.status, - Body: ioutil.NopCloser(body), - Header: make(http.Header), - } - for k, v := range rt.header { - res.Header.Set(k, v) - } - return res, nil -} - -func (rt *FakeRoundTripper) Reset() { - rt.requests = nil -} - -type person struct { - Name string - Age int `json:"age"` -} - -type dumb struct { - T int `qs:"-"` - v int - W float32 - X int - Y float64 - Z int `qs:"zee"` - Person *person `qs:"p"` -} - -type fakeEndpointURL struct { - Scheme string -} diff --git a/vendor/github.com/fsouza/go-dockerclient/container_test.go b/vendor/github.com/fsouza/go-dockerclient/container_test.go deleted file mode 100644 index 1b05b27bb5..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/container_test.go +++ /dev/null @@ -1,2263 +0,0 @@ -// Copyright 2015 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package docker - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "io/ioutil" - "net" - "net/http" - "net/http/httptest" - "net/url" - "os" - "reflect" - "regexp" - "runtime" - "strconv" - "strings" - "testing" - "time" - - "github.com/fsouza/go-dockerclient/external/github.com/hashicorp/go-cleanhttp" -) - -func TestStateString(t *testing.T) { - started := time.Now().Add(-3 * time.Hour) - var tests = []struct { - input State - expected string - }{ - {State{Running: true, Paused: true}, "^paused$"}, - {State{Running: true, StartedAt: started}, "^Up 3h.*$"}, - {State{Running: false, ExitCode: 7}, "^Exit 7$"}, - } - for _, tt := range tests { - re := regexp.MustCompile(tt.expected) - if got := tt.input.String(); !re.MatchString(got) { - t.Errorf("State.String(): wrong result. Want %q. Got %q.", tt.expected, got) - } - } -} - -func TestListContainers(t *testing.T) { - jsonContainers := `[ - { - "Id": "8dfafdbc3a40", - "Image": "base:latest", - "Command": "echo 1", - "Created": 1367854155, - "Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}], - "Status": "Exit 0" - }, - { - "Id": "9cd87474be90", - "Image": "base:latest", - "Command": "echo 222222", - "Created": 1367854155, - "Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}], - "Status": "Exit 0" - }, - { - "Id": "3176a2479c92", - "Image": "base:latest", - "Command": "echo 3333333333333333", - "Created": 1367854154, - "Ports":[{"PrivatePort": 2221, "PublicPort": 3331, "Type": "tcp"}], - "Status": "Exit 0" - }, - { - "Id": "4cb07b47f9fb", - "Image": "base:latest", - "Command": "echo 444444444444444444444444444444444", - "Ports":[{"PrivatePort": 2223, "PublicPort": 3332, "Type": "tcp"}], - "Created": 1367854152, - "Status": "Exit 0" - } -]` - var expected []APIContainers - err := json.Unmarshal([]byte(jsonContainers), &expected) - if err != nil { - t.Fatal(err) - } - client := newTestClient(&FakeRoundTripper{message: jsonContainers, status: http.StatusOK}) - containers, err := client.ListContainers(ListContainersOptions{}) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(containers, expected) { - t.Errorf("ListContainers: Expected %#v. Got %#v.", expected, containers) - } -} - -func TestListContainersParams(t *testing.T) { - var tests = []struct { - input ListContainersOptions - params map[string][]string - }{ - {ListContainersOptions{}, map[string][]string{}}, - {ListContainersOptions{All: true}, map[string][]string{"all": {"1"}}}, - {ListContainersOptions{All: true, Limit: 10}, map[string][]string{"all": {"1"}, "limit": {"10"}}}, - { - ListContainersOptions{All: true, Limit: 10, Since: "adf9983", Before: "abdeef"}, - map[string][]string{"all": {"1"}, "limit": {"10"}, "since": {"adf9983"}, "before": {"abdeef"}}, - }, - { - ListContainersOptions{Filters: map[string][]string{"status": {"paused", "running"}}}, - map[string][]string{"filters": {"{\"status\":[\"paused\",\"running\"]}"}}, - }, - { - ListContainersOptions{All: true, Filters: map[string][]string{"exited": {"0"}, "status": {"exited"}}}, - map[string][]string{"all": {"1"}, "filters": {"{\"exited\":[\"0\"],\"status\":[\"exited\"]}"}}, - }, - } - fakeRT := &FakeRoundTripper{message: "[]", status: http.StatusOK} - client := newTestClient(fakeRT) - u, _ := url.Parse(client.getURL("/containers/json")) - for _, tt := range tests { - if _, err := client.ListContainers(tt.input); err != nil { - t.Error(err) - } - got := map[string][]string(fakeRT.requests[0].URL.Query()) - if !reflect.DeepEqual(got, tt.params) { - t.Errorf("Expected %#v, got %#v.", tt.params, got) - } - if path := fakeRT.requests[0].URL.Path; path != u.Path { - t.Errorf("Wrong path on request. Want %q. Got %q.", u.Path, path) - } - if meth := fakeRT.requests[0].Method; meth != "GET" { - t.Errorf("Wrong HTTP method. Want GET. Got %s.", meth) - } - fakeRT.Reset() - } -} - -func TestListContainersFailure(t *testing.T) { - var tests = []struct { - status int - message string - }{ - {400, "bad parameter"}, - {500, "internal server error"}, - } - for _, tt := range tests { - client := newTestClient(&FakeRoundTripper{message: tt.message, status: tt.status}) - expected := Error{Status: tt.status, Message: tt.message} - containers, err := client.ListContainers(ListContainersOptions{}) - if !reflect.DeepEqual(expected, *err.(*Error)) { - t.Errorf("Wrong error in ListContainers. Want %#v. Got %#v.", expected, err) - } - if len(containers) > 0 { - t.Errorf("ListContainers failure. Expected empty list. Got %#v.", containers) - } - } -} - -func TestInspectContainer(t *testing.T) { - jsonContainer := `{ - "Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2", - "AppArmorProfile": "Profile", - "Created": "2013-05-07T14:51:42.087658+02:00", - "Path": "date", - "Args": [], - "Config": { - "Hostname": "4fa6e0f0c678", - "User": "", - "Memory": 17179869184, - "MemorySwap": 34359738368, - "AttachStdin": false, - "AttachStdout": true, - "AttachStderr": true, - "PortSpecs": null, - "Tty": false, - "OpenStdin": false, - "StdinOnce": false, - "Env": null, - "Cmd": [ - "date" - ], - "Image": "base", - "Volumes": {}, - "VolumesFrom": "", - "SecurityOpt": [ - "label:user:USER" - ], - "Ulimits": [ - { "Name": "nofile", "Soft": 1024, "Hard": 2048 } - ] - }, - "State": { - "Running": false, - "Pid": 0, - "ExitCode": 0, - "StartedAt": "2013-05-07T14:51:42.087658+02:00", - "Ghost": false - }, - "Node": { - "ID": "4I4E:QR4I:Z733:QEZK:5X44:Q4T7:W2DD:JRDY:KB2O:PODO:Z5SR:XRB6", - "IP": "192.168.99.105", - "Addra": "192.168.99.105:2376", - "Name": "node-01", - "Cpus": 4, - "Memory": 1048436736, - "Labels": { - "executiondriver": "native-0.2", - "kernelversion": "3.18.5-tinycore64", - "operatingsystem": "Boot2Docker 1.5.0 (TCL 5.4); master : a66bce5 - Tue Feb 10 23:31:27 UTC 2015", - "provider": "virtualbox", - "storagedriver": "aufs" - } - }, - "Image": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", - "NetworkSettings": { - "IpAddress": "", - "IpPrefixLen": 0, - "Gateway": "", - "Bridge": "", - "PortMapping": null - }, - "SysInitPath": "/home/kitty/go/src/github.com/dotcloud/docker/bin/docker", - "ResolvConfPath": "/etc/resolv.conf", - "Volumes": {}, - "HostConfig": { - "Binds": null, - "ContainerIDFile": "", - "LxcConf": [], - "Privileged": false, - "PortBindings": { - "80/tcp": [ - { - "HostIp": "0.0.0.0", - "HostPort": "49153" - } - ] - }, - "Links": null, - "PublishAllPorts": false, - "CgroupParent": "/mesos", - "Memory": 17179869184, - "MemorySwap": 34359738368, - "GroupAdd": ["fake", "12345"], - "OomScoreAdj": 642 - } -}` - var expected Container - err := json.Unmarshal([]byte(jsonContainer), &expected) - if err != nil { - t.Fatal(err) - } - fakeRT := &FakeRoundTripper{message: jsonContainer, status: http.StatusOK} - client := newTestClient(fakeRT) - id := "4fa6e0f0c678" - container, err := client.InspectContainer(id) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(*container, expected) { - t.Errorf("InspectContainer(%q): Expected %#v. Got %#v.", id, expected, container) - } - expectedURL, _ := url.Parse(client.getURL("/containers/4fa6e0f0c678/json")) - if gotPath := fakeRT.requests[0].URL.Path; gotPath != expectedURL.Path { - t.Errorf("InspectContainer(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } -} - -func TestInspectContainerNetwork(t *testing.T) { - jsonContainer := `{ - "Id": "81e1bbe20b5508349e1c804eb08b7b6ca8366751dbea9f578b3ea0773fa66c1c", - "Created": "2015-11-12T14:54:04.791485659Z", - "Path": "consul-template", - "Args": [ - "-config=/tmp/haproxy.json", - "-consul=192.168.99.120:8500" - ], - "State": { - "Status": "running", - "Running": true, - "Paused": false, - "Restarting": false, - "OOMKilled": false, - "Dead": false, - "Pid": 3196, - "ExitCode": 0, - "Error": "", - "StartedAt": "2015-11-12T14:54:05.026747471Z", - "FinishedAt": "0001-01-01T00:00:00Z" - }, - "Image": "4921c5917fc117df3dec32f4c1976635dc6c56ccd3336fe1db3477f950e78bf7", - "ResolvConfPath": "/mnt/sda1/var/lib/docker/containers/81e1bbe20b5508349e1c804eb08b7b6ca8366751dbea9f578b3ea0773fa66c1c/resolv.conf", - "HostnamePath": "/mnt/sda1/var/lib/docker/containers/81e1bbe20b5508349e1c804eb08b7b6ca8366751dbea9f578b3ea0773fa66c1c/hostname", - "HostsPath": "/mnt/sda1/var/lib/docker/containers/81e1bbe20b5508349e1c804eb08b7b6ca8366751dbea9f578b3ea0773fa66c1c/hosts", - "LogPath": "/mnt/sda1/var/lib/docker/containers/81e1bbe20b5508349e1c804eb08b7b6ca8366751dbea9f578b3ea0773fa66c1c/81e1bbe20b5508349e1c804eb08b7b6ca8366751dbea9f578b3ea0773fa66c1c-json.log", - "Node": { - "ID": "AUIB:LFOT:3LSF:SCFS:OYDQ:NLXD:JZNE:4INI:3DRC:ZFBB:GWCY:DWJK", - "IP": "192.168.99.121", - "Addr": "192.168.99.121:2376", - "Name": "swl-demo1", - "Cpus": 1, - "Memory": 2099945472, - "Labels": { - "executiondriver": "native-0.2", - "kernelversion": "4.1.12-boot2docker", - "operatingsystem": "Boot2Docker 1.9.0 (TCL 6.4); master : 16e4a2a - Tue Nov 3 19:49:22 UTC 2015", - "provider": "virtualbox", - "storagedriver": "aufs" - } - }, - "Name": "/docker-proxy.swl-demo1", - "RestartCount": 0, - "Driver": "aufs", - "ExecDriver": "native-0.2", - "MountLabel": "", - "ProcessLabel": "", - "AppArmorProfile": "", - "ExecIDs": null, - "HostConfig": { - "Binds": null, - "ContainerIDFile": "", - "LxcConf": [], - "Memory": 0, - "MemoryReservation": 0, - "MemorySwap": 0, - "KernelMemory": 0, - "CpuShares": 0, - "CpuPeriod": 0, - "CpusetCpus": "", - "CpusetMems": "", - "CpuQuota": 0, - "BlkioWeight": 0, - "OomKillDisable": false, - "MemorySwappiness": -1, - "Privileged": false, - "PortBindings": { - "443/tcp": [ - { - "HostIp": "", - "HostPort": "443" - } - ] - }, - "Links": null, - "PublishAllPorts": false, - "Dns": null, - "DnsOptions": null, - "DnsSearch": null, - "ExtraHosts": null, - "VolumesFrom": null, - "Devices": [], - "NetworkMode": "swl-net", - "IpcMode": "", - "PidMode": "", - "UTSMode": "", - "CapAdd": null, - "CapDrop": null, - "GroupAdd": null, - "RestartPolicy": { - "Name": "no", - "MaximumRetryCount": 0 - }, - "SecurityOpt": null, - "ReadonlyRootfs": false, - "Ulimits": null, - "LogConfig": { - "Type": "json-file", - "Config": {} - }, - "CgroupParent": "", - "ConsoleSize": [ - 0, - 0 - ], - "VolumeDriver": "" - }, - "GraphDriver": { - "Name": "aufs", - "Data": null - }, - "Mounts": [], - "Config": { - "Hostname": "81e1bbe20b55", - "Domainname": "", - "User": "", - "AttachStdin": false, - "AttachStdout": false, - "AttachStderr": false, - "ExposedPorts": { - "443/tcp": {} - }, - "Tty": false, - "OpenStdin": false, - "StdinOnce": false, - "Env": [ - "DOMAIN=local.auto", - "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", - "CONSUL_TEMPLATE_VERSION=0.11.1" - ], - "Cmd": [ - "-consul=192.168.99.120:8500" - ], - "Image": "docker-proxy:latest", - "Volumes": null, - "WorkingDir": "", - "Entrypoint": [ - "consul-template", - "-config=/tmp/haproxy.json" - ], - "OnBuild": null, - "Labels": {}, - "StopSignal": "SIGTERM" - }, - "NetworkSettings": { - "Bridge": "", - "SandboxID": "c6b903dc5c1a96113a22dbc44709e30194079bd2d262eea1eb4f38d85821f6e1", - "HairpinMode": false, - "LinkLocalIPv6Address": "", - "LinkLocalIPv6PrefixLen": 0, - "Ports": { - "443/tcp": [ - { - "HostIp": "192.168.99.121", - "HostPort": "443" - } - ] - }, - "SandboxKey": "/var/run/docker/netns/c6b903dc5c1a", - "SecondaryIPAddresses": null, - "SecondaryIPv6Addresses": null, - "EndpointID": "", - "Gateway": "", - "GlobalIPv6Address": "", - "GlobalIPv6PrefixLen": 0, - "IPAddress": "", - "IPPrefixLen": 0, - "IPv6Gateway": "", - "MacAddress": "", - "Networks": { - "swl-net": { - "EndpointID": "683e3092275782a53c3b0968cc7e3a10f23264022ded9cb20490902f96fc5981", - "Gateway": "", - "IPAddress": "10.0.0.3", - "IPPrefixLen": 24, - "IPv6Gateway": "", - "GlobalIPv6Address": "", - "GlobalIPv6PrefixLen": 0, - "MacAddress": "02:42:0a:00:00:03" - } - } - } -}` - - fakeRT := &FakeRoundTripper{message: jsonContainer, status: http.StatusOK} - client := newTestClient(fakeRT) - id := "81e1bbe20b55" - exp := "10.0.0.3" - - container, err := client.InspectContainer(id) - if err != nil { - t.Fatal(err) - } - - s := reflect.Indirect(reflect.ValueOf(container.NetworkSettings)) - networks := s.FieldByName("Networks") - if networks.IsValid() { - var ip string - for _, net := range networks.MapKeys() { - if net.Interface().(string) == container.HostConfig.NetworkMode { - ip = networks.MapIndex(net).FieldByName("IPAddress").Interface().(string) - t.Logf("%s %v", net, ip) - } - } - if ip != exp { - t.Errorf("InspectContainerNetworks(%q): Expected %#v. Got %#v.", id, exp, ip) - } - } else { - t.Errorf("InspectContainerNetworks(%q): No method Networks for NetworkSettings", id) - } - -} - -func TestInspectContainerNegativeSwap(t *testing.T) { - jsonContainer := `{ - "Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2", - "Created": "2013-05-07T14:51:42.087658+02:00", - "Path": "date", - "Args": [], - "Config": { - "Hostname": "4fa6e0f0c678", - "User": "", - "Memory": 17179869184, - "MemorySwap": -1, - "AttachStdin": false, - "AttachStdout": true, - "AttachStderr": true, - "PortSpecs": null, - "Tty": false, - "OpenStdin": false, - "StdinOnce": false, - "Env": null, - "Cmd": [ - "date" - ], - "Image": "base", - "Volumes": {}, - "VolumesFrom": "" - }, - "State": { - "Running": false, - "Pid": 0, - "ExitCode": 0, - "StartedAt": "2013-05-07T14:51:42.087658+02:00", - "Ghost": false - }, - "Image": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", - "NetworkSettings": { - "IpAddress": "", - "IpPrefixLen": 0, - "Gateway": "", - "Bridge": "", - "PortMapping": null - }, - "SysInitPath": "/home/kitty/go/src/github.com/dotcloud/docker/bin/docker", - "ResolvConfPath": "/etc/resolv.conf", - "Volumes": {}, - "HostConfig": { - "Binds": null, - "ContainerIDFile": "", - "LxcConf": [], - "Privileged": false, - "PortBindings": { - "80/tcp": [ - { - "HostIp": "0.0.0.0", - "HostPort": "49153" - } - ] - }, - "Links": null, - "PublishAllPorts": false - } -}` - var expected Container - err := json.Unmarshal([]byte(jsonContainer), &expected) - if err != nil { - t.Fatal(err) - } - fakeRT := &FakeRoundTripper{message: jsonContainer, status: http.StatusOK} - client := newTestClient(fakeRT) - id := "4fa6e0f0c678" - container, err := client.InspectContainer(id) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(*container, expected) { - t.Errorf("InspectContainer(%q): Expected %#v. Got %#v.", id, expected, container) - } - expectedURL, _ := url.Parse(client.getURL("/containers/4fa6e0f0c678/json")) - if gotPath := fakeRT.requests[0].URL.Path; gotPath != expectedURL.Path { - t.Errorf("InspectContainer(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } -} - -func TestInspectContainerFailure(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "server error", status: 500}) - expected := Error{Status: 500, Message: "server error"} - container, err := client.InspectContainer("abe033") - if container != nil { - t.Errorf("InspectContainer: Expected container, got %#v", container) - } - if !reflect.DeepEqual(expected, *err.(*Error)) { - t.Errorf("InspectContainer: Wrong error information. Want %#v. Got %#v.", expected, err) - } -} - -func TestInspectContainerNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such container", status: 404}) - container, err := client.InspectContainer("abe033") - if container != nil { - t.Errorf("InspectContainer: Expected container, got %#v", container) - } - expected := &NoSuchContainer{ID: "abe033"} - if !reflect.DeepEqual(err, expected) { - t.Errorf("InspectContainer: Wrong error information. Want %#v. Got %#v.", expected, err) - } -} - -func TestContainerChanges(t *testing.T) { - jsonChanges := `[ - { - "Path":"/dev", - "Kind":0 - }, - { - "Path":"/dev/kmsg", - "Kind":1 - }, - { - "Path":"/test", - "Kind":1 - } -]` - var expected []Change - err := json.Unmarshal([]byte(jsonChanges), &expected) - if err != nil { - t.Fatal(err) - } - fakeRT := &FakeRoundTripper{message: jsonChanges, status: http.StatusOK} - client := newTestClient(fakeRT) - id := "4fa6e0f0c678" - changes, err := client.ContainerChanges(id) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(changes, expected) { - t.Errorf("ContainerChanges(%q): Expected %#v. Got %#v.", id, expected, changes) - } - expectedURL, _ := url.Parse(client.getURL("/containers/4fa6e0f0c678/changes")) - if gotPath := fakeRT.requests[0].URL.Path; gotPath != expectedURL.Path { - t.Errorf("ContainerChanges(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } -} - -func TestContainerChangesFailure(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "server error", status: 500}) - expected := Error{Status: 500, Message: "server error"} - changes, err := client.ContainerChanges("abe033") - if changes != nil { - t.Errorf("ContainerChanges: Expected changes, got %#v", changes) - } - if !reflect.DeepEqual(expected, *err.(*Error)) { - t.Errorf("ContainerChanges: Wrong error information. Want %#v. Got %#v.", expected, err) - } -} - -func TestContainerChangesNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such container", status: 404}) - changes, err := client.ContainerChanges("abe033") - if changes != nil { - t.Errorf("ContainerChanges: Expected changes, got %#v", changes) - } - expected := &NoSuchContainer{ID: "abe033"} - if !reflect.DeepEqual(err, expected) { - t.Errorf("ContainerChanges: Wrong error information. Want %#v. Got %#v.", expected, err) - } -} - -func TestCreateContainer(t *testing.T) { - jsonContainer := `{ - "Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2", - "Warnings": [] -}` - var expected Container - err := json.Unmarshal([]byte(jsonContainer), &expected) - if err != nil { - t.Fatal(err) - } - fakeRT := &FakeRoundTripper{message: jsonContainer, status: http.StatusOK} - client := newTestClient(fakeRT) - config := Config{AttachStdout: true, AttachStdin: true} - opts := CreateContainerOptions{Name: "TestCreateContainer", Config: &config} - container, err := client.CreateContainer(opts) - if err != nil { - t.Fatal(err) - } - id := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - if container.ID != id { - t.Errorf("CreateContainer: wrong ID. Want %q. Got %q.", id, container.ID) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("CreateContainer: wrong HTTP method. Want %q. Got %q.", "POST", req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/containers/create")) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("CreateContainer: Wrong path in request. Want %q. Got %q.", expectedURL.Path, gotPath) - } - var gotBody Config - err = json.NewDecoder(req.Body).Decode(&gotBody) - if err != nil { - t.Fatal(err) - } -} - -func TestCreateContainerImageNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "No such image", status: http.StatusNotFound}) - config := Config{AttachStdout: true, AttachStdin: true} - container, err := client.CreateContainer(CreateContainerOptions{Config: &config}) - if container != nil { - t.Errorf("CreateContainer: expected container, got %#v.", container) - } - if !reflect.DeepEqual(err, ErrNoSuchImage) { - t.Errorf("CreateContainer: Wrong error type. Want %#v. Got %#v.", ErrNoSuchImage, err) - } -} - -func TestCreateContainerDuplicateName(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "No such image", status: http.StatusConflict}) - config := Config{AttachStdout: true, AttachStdin: true} - container, err := client.CreateContainer(CreateContainerOptions{Config: &config}) - if container != nil { - t.Errorf("CreateContainer: expected container, got %#v.", container) - } - if err != ErrContainerAlreadyExists { - t.Errorf("CreateContainer: Wrong error type. Want %#v. Got %#v.", ErrContainerAlreadyExists, err) - } -} - -func TestCreateContainerWithHostConfig(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "{}", status: http.StatusOK} - client := newTestClient(fakeRT) - config := Config{} - hostConfig := HostConfig{PublishAllPorts: true} - opts := CreateContainerOptions{Name: "TestCreateContainerWithHostConfig", Config: &config, HostConfig: &hostConfig} - _, err := client.CreateContainer(opts) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - var gotBody map[string]interface{} - err = json.NewDecoder(req.Body).Decode(&gotBody) - if err != nil { - t.Fatal(err) - } - if _, ok := gotBody["HostConfig"]; !ok { - t.Errorf("CreateContainer: wrong body. HostConfig was not serialized") - } -} - -func TestStartContainer(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - id := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - err := client.StartContainer(id, &HostConfig{}) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("StartContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/start")) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("StartContainer(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } - expectedContentType := "application/json" - if contentType := req.Header.Get("Content-Type"); contentType != expectedContentType { - t.Errorf("StartContainer(%q): Wrong content-type in request. Want %q. Got %q.", id, expectedContentType, contentType) - } -} - -func TestStartContainerNilHostConfig(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - id := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - err := client.StartContainer(id, nil) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("StartContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/start")) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("StartContainer(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } - expectedContentType := "application/json" - if contentType := req.Header.Get("Content-Type"); contentType != expectedContentType { - t.Errorf("StartContainer(%q): Wrong content-type in request. Want %q. Got %q.", id, expectedContentType, contentType) - } - var buf [4]byte - req.Body.Read(buf[:]) - if string(buf[:]) != "null" { - t.Errorf("Startcontainer(%q): Wrong body. Want null. Got %s", id, buf[:]) - } -} - -func TestStartContainerNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) - err := client.StartContainer("a2344", &HostConfig{}) - expected := &NoSuchContainer{ID: "a2344", Err: err.(*NoSuchContainer).Err} - if !reflect.DeepEqual(err, expected) { - t.Errorf("StartContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) - } -} - -func TestStartContainerAlreadyRunning(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "container already running", status: http.StatusNotModified}) - err := client.StartContainer("a2334", &HostConfig{}) - expected := &ContainerAlreadyRunning{ID: "a2334"} - if !reflect.DeepEqual(err, expected) { - t.Errorf("StartContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) - } -} - -func TestStopContainer(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusNoContent} - client := newTestClient(fakeRT) - id := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - err := client.StopContainer(id, 10) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("StopContainer(%q, 10): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/stop")) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("StopContainer(%q, 10): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } -} - -func TestStopContainerNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) - err := client.StopContainer("a2334", 10) - expected := &NoSuchContainer{ID: "a2334"} - if !reflect.DeepEqual(err, expected) { - t.Errorf("StopContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) - } -} - -func TestStopContainerNotRunning(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "container not running", status: http.StatusNotModified}) - err := client.StopContainer("a2334", 10) - expected := &ContainerNotRunning{ID: "a2334"} - if !reflect.DeepEqual(err, expected) { - t.Errorf("StopContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) - } -} - -func TestRestartContainer(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusNoContent} - client := newTestClient(fakeRT) - id := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - err := client.RestartContainer(id, 10) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("RestartContainer(%q, 10): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/restart")) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("RestartContainer(%q, 10): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } -} - -func TestRestartContainerNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) - err := client.RestartContainer("a2334", 10) - expected := &NoSuchContainer{ID: "a2334"} - if !reflect.DeepEqual(err, expected) { - t.Errorf("RestartContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) - } -} - -func TestPauseContainer(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusNoContent} - client := newTestClient(fakeRT) - id := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - err := client.PauseContainer(id) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("PauseContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/pause")) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("PauseContainer(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } -} - -func TestPauseContainerNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) - err := client.PauseContainer("a2334") - expected := &NoSuchContainer{ID: "a2334"} - if !reflect.DeepEqual(err, expected) { - t.Errorf("PauseContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) - } -} - -func TestUnpauseContainer(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusNoContent} - client := newTestClient(fakeRT) - id := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - err := client.UnpauseContainer(id) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("PauseContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/unpause")) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("PauseContainer(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } -} - -func TestUnpauseContainerNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) - err := client.UnpauseContainer("a2334") - expected := &NoSuchContainer{ID: "a2334"} - if !reflect.DeepEqual(err, expected) { - t.Errorf("PauseContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) - } -} - -func TestKillContainer(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusNoContent} - client := newTestClient(fakeRT) - id := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - err := client.KillContainer(KillContainerOptions{ID: id}) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("KillContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/kill")) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("KillContainer(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } -} - -func TestKillContainerSignal(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusNoContent} - client := newTestClient(fakeRT) - id := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - err := client.KillContainer(KillContainerOptions{ID: id, Signal: SIGTERM}) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("KillContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) - } - if signal := req.URL.Query().Get("signal"); signal != "15" { - t.Errorf("KillContainer(%q): Wrong query string in request. Want %q. Got %q.", id, "15", signal) - } -} - -func TestKillContainerNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) - err := client.KillContainer(KillContainerOptions{ID: "a2334"}) - expected := &NoSuchContainer{ID: "a2334"} - if !reflect.DeepEqual(err, expected) { - t.Errorf("KillContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) - } -} - -func TestRemoveContainer(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - id := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - opts := RemoveContainerOptions{ID: id} - err := client.RemoveContainer(opts) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != "DELETE" { - t.Errorf("RemoveContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "DELETE", req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/containers/" + id)) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("RemoveContainer(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } -} - -func TestRemoveContainerRemoveVolumes(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - id := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - opts := RemoveContainerOptions{ID: id, RemoveVolumes: true} - err := client.RemoveContainer(opts) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - params := map[string][]string(req.URL.Query()) - expected := map[string][]string{"v": {"1"}} - if !reflect.DeepEqual(params, expected) { - t.Errorf("RemoveContainer(%q): wrong parameters. Want %#v. Got %#v.", id, expected, params) - } -} - -func TestRemoveContainerNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) - err := client.RemoveContainer(RemoveContainerOptions{ID: "a2334"}) - expected := &NoSuchContainer{ID: "a2334"} - if !reflect.DeepEqual(err, expected) { - t.Errorf("RemoveContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) - } -} - -func TestResizeContainerTTY(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - id := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - err := client.ResizeContainerTTY(id, 40, 80) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("ResizeContainerTTY(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/resize")) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("ResizeContainerTTY(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } - got := map[string][]string(req.URL.Query()) - expectedParams := map[string][]string{ - "w": {"80"}, - "h": {"40"}, - } - if !reflect.DeepEqual(got, expectedParams) { - t.Errorf("Expected %#v, got %#v.", expectedParams, got) - } -} - -func TestWaitContainer(t *testing.T) { - fakeRT := &FakeRoundTripper{message: `{"StatusCode": 56}`, status: http.StatusOK} - client := newTestClient(fakeRT) - id := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - status, err := client.WaitContainer(id) - if err != nil { - t.Fatal(err) - } - if status != 56 { - t.Errorf("WaitContainer(%q): wrong return. Want 56. Got %d.", id, status) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("WaitContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/wait")) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("WaitContainer(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } -} - -func TestWaitContainerNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) - _, err := client.WaitContainer("a2334") - expected := &NoSuchContainer{ID: "a2334"} - if !reflect.DeepEqual(err, expected) { - t.Errorf("WaitContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) - } -} - -func TestCommitContainer(t *testing.T) { - response := `{"Id":"596069db4bf5"}` - client := newTestClient(&FakeRoundTripper{message: response, status: http.StatusOK}) - id := "596069db4bf5" - image, err := client.CommitContainer(CommitContainerOptions{}) - if err != nil { - t.Fatal(err) - } - if image.ID != id { - t.Errorf("CommitContainer: Wrong image id. Want %q. Got %q.", id, image.ID) - } -} - -func TestCommitContainerParams(t *testing.T) { - cfg := Config{Memory: 67108864} - json, _ := json.Marshal(&cfg) - var tests = []struct { - input CommitContainerOptions - params map[string][]string - body []byte - }{ - {CommitContainerOptions{}, map[string][]string{}, nil}, - {CommitContainerOptions{Container: "44c004db4b17"}, map[string][]string{"container": {"44c004db4b17"}}, nil}, - { - CommitContainerOptions{Container: "44c004db4b17", Repository: "tsuru/python", Message: "something"}, - map[string][]string{"container": {"44c004db4b17"}, "repo": {"tsuru/python"}, "comment": {"something"}}, - nil, - }, - { - CommitContainerOptions{Container: "44c004db4b17", Run: &cfg}, - map[string][]string{"container": {"44c004db4b17"}}, - json, - }, - } - fakeRT := &FakeRoundTripper{message: "{}", status: http.StatusOK} - client := newTestClient(fakeRT) - u, _ := url.Parse(client.getURL("/commit")) - for _, tt := range tests { - if _, err := client.CommitContainer(tt.input); err != nil { - t.Error(err) - } - got := map[string][]string(fakeRT.requests[0].URL.Query()) - if !reflect.DeepEqual(got, tt.params) { - t.Errorf("Expected %#v, got %#v.", tt.params, got) - } - if path := fakeRT.requests[0].URL.Path; path != u.Path { - t.Errorf("Wrong path on request. Want %q. Got %q.", u.Path, path) - } - if meth := fakeRT.requests[0].Method; meth != "POST" { - t.Errorf("Wrong HTTP method. Want POST. Got %s.", meth) - } - if tt.body != nil { - if requestBody, err := ioutil.ReadAll(fakeRT.requests[0].Body); err == nil { - if bytes.Compare(requestBody, tt.body) != 0 { - t.Errorf("Expected body %#v, got %#v", tt.body, requestBody) - } - } else { - t.Errorf("Error reading request body: %#v", err) - } - } - fakeRT.Reset() - } -} - -func TestCommitContainerFailure(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusInternalServerError}) - _, err := client.CommitContainer(CommitContainerOptions{}) - if err == nil { - t.Error("Expected non-nil error, got .") - } -} - -func TestCommitContainerNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) - _, err := client.CommitContainer(CommitContainerOptions{}) - expected := &NoSuchContainer{ID: ""} - if !reflect.DeepEqual(err, expected) { - t.Errorf("CommitContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) - } -} - -func TestAttachToContainerLogs(t *testing.T) { - var req http.Request - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte{1, 0, 0, 0, 0, 0, 0, 19}) - w.Write([]byte("something happened!")) - req = *r - })) - defer server.Close() - client, _ := NewClient(server.URL) - client.SkipServerVersionCheck = true - var buf bytes.Buffer - opts := AttachToContainerOptions{ - Container: "a123456", - OutputStream: &buf, - Stdout: true, - Stderr: true, - Logs: true, - } - err := client.AttachToContainer(opts) - if err != nil { - t.Fatal(err) - } - expected := "something happened!" - if buf.String() != expected { - t.Errorf("AttachToContainer for logs: wrong output. Want %q. Got %q.", expected, buf.String()) - } - if req.Method != "POST" { - t.Errorf("AttachToContainer: wrong HTTP method. Want POST. Got %s.", req.Method) - } - u, _ := url.Parse(client.getURL("/containers/a123456/attach")) - if req.URL.Path != u.Path { - t.Errorf("AttachToContainer for logs: wrong HTTP path. Want %q. Got %q.", u.Path, req.URL.Path) - } - expectedQs := map[string][]string{ - "logs": {"1"}, - "stdout": {"1"}, - "stderr": {"1"}, - } - got := map[string][]string(req.URL.Query()) - if !reflect.DeepEqual(got, expectedQs) { - t.Errorf("AttachToContainer: wrong query string. Want %#v. Got %#v.", expectedQs, got) - } -} - -func TestAttachToContainer(t *testing.T) { - var reader = strings.NewReader("send value") - var req http.Request - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte{1, 0, 0, 0, 0, 0, 0, 5}) - w.Write([]byte("hello")) - req = *r - })) - defer server.Close() - client, _ := NewClient(server.URL) - client.SkipServerVersionCheck = true - var stdout, stderr bytes.Buffer - opts := AttachToContainerOptions{ - Container: "a123456", - OutputStream: &stdout, - ErrorStream: &stderr, - InputStream: reader, - Stdin: true, - Stdout: true, - Stderr: true, - Stream: true, - RawTerminal: true, - } - err := client.AttachToContainer(opts) - if err != nil { - t.Fatal(err) - } - expected := map[string][]string{ - "stdin": {"1"}, - "stdout": {"1"}, - "stderr": {"1"}, - "stream": {"1"}, - } - got := map[string][]string(req.URL.Query()) - if !reflect.DeepEqual(got, expected) { - t.Errorf("AttachToContainer: wrong query string. Want %#v. Got %#v.", expected, got) - } -} - -func TestAttachToContainerSentinel(t *testing.T) { - var reader = strings.NewReader("send value") - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte{1, 0, 0, 0, 0, 0, 0, 5}) - w.Write([]byte("hello")) - })) - defer server.Close() - client, _ := NewClient(server.URL) - client.SkipServerVersionCheck = true - var stdout, stderr bytes.Buffer - success := make(chan struct{}) - opts := AttachToContainerOptions{ - Container: "a123456", - OutputStream: &stdout, - ErrorStream: &stderr, - InputStream: reader, - Stdin: true, - Stdout: true, - Stderr: true, - Stream: true, - RawTerminal: true, - Success: success, - } - go func() { - if err := client.AttachToContainer(opts); err != nil { - t.Error(err) - } - }() - success <- <-success -} - -func TestAttachToContainerNilStdout(t *testing.T) { - var reader = strings.NewReader("send value") - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte{1, 0, 0, 0, 0, 0, 0, 5}) - w.Write([]byte("hello")) - })) - defer server.Close() - client, _ := NewClient(server.URL) - client.SkipServerVersionCheck = true - var stderr bytes.Buffer - opts := AttachToContainerOptions{ - Container: "a123456", - OutputStream: nil, - ErrorStream: &stderr, - InputStream: reader, - Stdin: true, - Stdout: true, - Stderr: true, - Stream: true, - RawTerminal: true, - } - err := client.AttachToContainer(opts) - if err != nil { - t.Fatal(err) - } -} - -func TestAttachToContainerNilStderr(t *testing.T) { - var reader = strings.NewReader("send value") - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte{1, 0, 0, 0, 0, 0, 0, 5}) - w.Write([]byte("hello")) - })) - defer server.Close() - client, _ := NewClient(server.URL) - client.SkipServerVersionCheck = true - var stdout bytes.Buffer - opts := AttachToContainerOptions{ - Container: "a123456", - OutputStream: &stdout, - InputStream: reader, - Stdin: true, - Stdout: true, - Stderr: true, - Stream: true, - RawTerminal: true, - } - err := client.AttachToContainer(opts) - if err != nil { - t.Fatal(err) - } -} - -func TestAttachToContainerStdinOnly(t *testing.T) { - var reader = strings.NewReader("send value") - serverFinished := make(chan struct{}) - clientFinished := make(chan struct{}) - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - hj, ok := w.(http.Hijacker) - if !ok { - t.Fatal("cannot hijack server connection") - } - conn, _, err := hj.Hijack() - if err != nil { - t.Fatal(err) - } - // wait for client to indicate it's finished - <-clientFinished - // inform test that the server has finished - close(serverFinished) - conn.Close() - })) - defer server.Close() - client, _ := NewClient(server.URL) - client.SkipServerVersionCheck = true - success := make(chan struct{}) - opts := AttachToContainerOptions{ - Container: "a123456", - InputStream: reader, - Stdin: true, - Stdout: false, - Stderr: false, - Stream: true, - RawTerminal: false, - Success: success, - } - go func() { - if err := client.AttachToContainer(opts); err != nil { - t.Error(err) - } - // client's attach session is over - close(clientFinished) - }() - success <- <-success - // wait for server to finish handling attach - <-serverFinished -} - -func TestAttachToContainerRawTerminalFalse(t *testing.T) { - input := strings.NewReader("send value") - var req http.Request - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - req = *r - w.WriteHeader(http.StatusOK) - hj, ok := w.(http.Hijacker) - if !ok { - t.Fatal("cannot hijack server connection") - } - conn, _, err := hj.Hijack() - if err != nil { - t.Fatal(err) - } - conn.Write([]byte{1, 0, 0, 0, 0, 0, 0, 5}) - conn.Write([]byte("hello")) - conn.Write([]byte{2, 0, 0, 0, 0, 0, 0, 6}) - conn.Write([]byte("hello!")) - conn.Close() - })) - defer server.Close() - client, _ := NewClient(server.URL) - client.SkipServerVersionCheck = true - var stdout, stderr bytes.Buffer - opts := AttachToContainerOptions{ - Container: "a123456", - OutputStream: &stdout, - ErrorStream: &stderr, - InputStream: input, - Stdin: true, - Stdout: true, - Stderr: true, - Stream: true, - RawTerminal: false, - } - client.AttachToContainer(opts) - expected := map[string][]string{ - "stdin": {"1"}, - "stdout": {"1"}, - "stderr": {"1"}, - "stream": {"1"}, - } - got := map[string][]string(req.URL.Query()) - if !reflect.DeepEqual(got, expected) { - t.Errorf("AttachToContainer: wrong query string. Want %#v. Got %#v.", expected, got) - } - if stdout.String() != "hello" { - t.Errorf("AttachToContainer: wrong content written to stdout. Want %q. Got %q.", "hello", stdout.String()) - } - if stderr.String() != "hello!" { - t.Errorf("AttachToContainer: wrong content written to stderr. Want %q. Got %q.", "hello!", stderr.String()) - } -} - -func TestAttachToContainerWithoutContainer(t *testing.T) { - var client Client - err := client.AttachToContainer(AttachToContainerOptions{}) - expected := &NoSuchContainer{ID: ""} - if !reflect.DeepEqual(err, expected) { - t.Errorf("AttachToContainer: wrong error. Want %#v. Got %#v.", expected, err) - } -} - -func TestLogs(t *testing.T) { - var req http.Request - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - prefix := []byte{1, 0, 0, 0, 0, 0, 0, 19} - w.Write(prefix) - w.Write([]byte("something happened!")) - req = *r - })) - defer server.Close() - client, _ := NewClient(server.URL) - client.SkipServerVersionCheck = true - var buf bytes.Buffer - opts := LogsOptions{ - Container: "a123456", - OutputStream: &buf, - Follow: true, - Stdout: true, - Stderr: true, - Timestamps: true, - } - err := client.Logs(opts) - if err != nil { - t.Fatal(err) - } - expected := "something happened!" - if buf.String() != expected { - t.Errorf("Logs: wrong output. Want %q. Got %q.", expected, buf.String()) - } - if req.Method != "GET" { - t.Errorf("Logs: wrong HTTP method. Want GET. Got %s.", req.Method) - } - u, _ := url.Parse(client.getURL("/containers/a123456/logs")) - if req.URL.Path != u.Path { - t.Errorf("AttachToContainer for logs: wrong HTTP path. Want %q. Got %q.", u.Path, req.URL.Path) - } - expectedQs := map[string][]string{ - "follow": {"1"}, - "stdout": {"1"}, - "stderr": {"1"}, - "timestamps": {"1"}, - "tail": {"all"}, - } - got := map[string][]string(req.URL.Query()) - if !reflect.DeepEqual(got, expectedQs) { - t.Errorf("Logs: wrong query string. Want %#v. Got %#v.", expectedQs, got) - } -} - -func TestLogsNilStdoutDoesntFail(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - prefix := []byte{1, 0, 0, 0, 0, 0, 0, 19} - w.Write(prefix) - w.Write([]byte("something happened!")) - })) - defer server.Close() - client, _ := NewClient(server.URL) - client.SkipServerVersionCheck = true - opts := LogsOptions{ - Container: "a123456", - Follow: true, - Stdout: true, - Stderr: true, - Timestamps: true, - } - err := client.Logs(opts) - if err != nil { - t.Fatal(err) - } -} - -func TestLogsNilStderrDoesntFail(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - prefix := []byte{2, 0, 0, 0, 0, 0, 0, 19} - w.Write(prefix) - w.Write([]byte("something happened!")) - })) - defer server.Close() - client, _ := NewClient(server.URL) - client.SkipServerVersionCheck = true - opts := LogsOptions{ - Container: "a123456", - Follow: true, - Stdout: true, - Stderr: true, - Timestamps: true, - } - err := client.Logs(opts) - if err != nil { - t.Fatal(err) - } -} - -func TestLogsSpecifyingTail(t *testing.T) { - var req http.Request - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - prefix := []byte{1, 0, 0, 0, 0, 0, 0, 19} - w.Write(prefix) - w.Write([]byte("something happened!")) - req = *r - })) - defer server.Close() - client, _ := NewClient(server.URL) - client.SkipServerVersionCheck = true - var buf bytes.Buffer - opts := LogsOptions{ - Container: "a123456", - OutputStream: &buf, - Follow: true, - Stdout: true, - Stderr: true, - Timestamps: true, - Tail: "100", - } - err := client.Logs(opts) - if err != nil { - t.Fatal(err) - } - expected := "something happened!" - if buf.String() != expected { - t.Errorf("Logs: wrong output. Want %q. Got %q.", expected, buf.String()) - } - if req.Method != "GET" { - t.Errorf("Logs: wrong HTTP method. Want GET. Got %s.", req.Method) - } - u, _ := url.Parse(client.getURL("/containers/a123456/logs")) - if req.URL.Path != u.Path { - t.Errorf("AttachToContainer for logs: wrong HTTP path. Want %q. Got %q.", u.Path, req.URL.Path) - } - expectedQs := map[string][]string{ - "follow": {"1"}, - "stdout": {"1"}, - "stderr": {"1"}, - "timestamps": {"1"}, - "tail": {"100"}, - } - got := map[string][]string(req.URL.Query()) - if !reflect.DeepEqual(got, expectedQs) { - t.Errorf("Logs: wrong query string. Want %#v. Got %#v.", expectedQs, got) - } -} - -func TestLogsRawTerminal(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("something happened!")) - })) - defer server.Close() - client, _ := NewClient(server.URL) - client.SkipServerVersionCheck = true - var buf bytes.Buffer - opts := LogsOptions{ - Container: "a123456", - OutputStream: &buf, - Follow: true, - RawTerminal: true, - Stdout: true, - Stderr: true, - Timestamps: true, - Tail: "100", - } - err := client.Logs(opts) - if err != nil { - t.Fatal(err) - } - expected := "something happened!" - if buf.String() != expected { - t.Errorf("Logs: wrong output. Want %q. Got %q.", expected, buf.String()) - } -} - -func TestLogsNoContainer(t *testing.T) { - var client Client - err := client.Logs(LogsOptions{}) - expected := &NoSuchContainer{ID: ""} - if !reflect.DeepEqual(err, expected) { - t.Errorf("AttachToContainer: wrong error. Want %#v. Got %#v.", expected, err) - } -} - -func TestNoSuchContainerError(t *testing.T) { - var err = &NoSuchContainer{ID: "i345"} - expected := "No such container: i345" - if got := err.Error(); got != expected { - t.Errorf("NoSuchContainer: wrong message. Want %q. Got %q.", expected, got) - } -} - -func TestNoSuchContainerErrorMessage(t *testing.T) { - var err = &NoSuchContainer{ID: "i345", Err: errors.New("some advanced error info")} - expected := "some advanced error info" - if got := err.Error(); got != expected { - t.Errorf("NoSuchContainer: wrong message. Want %q. Got %q.", expected, got) - } -} - -func TestExportContainer(t *testing.T) { - content := "exported container tar content" - out := stdoutMock{bytes.NewBufferString(content)} - client := newTestClient(&FakeRoundTripper{status: http.StatusOK}) - opts := ExportContainerOptions{ID: "4fa6e0f0c678", OutputStream: out} - err := client.ExportContainer(opts) - if err != nil { - t.Errorf("ExportContainer: caugh error %#v while exporting container, expected nil", err.Error()) - } - if out.String() != content { - t.Errorf("ExportContainer: wrong stdout. Want %#v. Got %#v.", content, out.String()) - } -} - -func TestExportContainerViaUnixSocket(t *testing.T) { - if runtime.GOOS != "darwin" { - t.Skip(fmt.Sprintf("skipping test on %s", runtime.GOOS)) - } - content := "exported container tar content" - var buf []byte - out := bytes.NewBuffer(buf) - tempSocket := tempfile("export_socket") - defer os.Remove(tempSocket) - endpoint := "unix://" + tempSocket - u, _ := parseEndpoint(endpoint, false) - client := Client{ - HTTPClient: cleanhttp.DefaultClient(), - Dialer: &net.Dialer{}, - endpoint: endpoint, - endpointURL: u, - SkipServerVersionCheck: true, - } - listening := make(chan string) - done := make(chan int) - go runStreamConnServer(t, "unix", tempSocket, listening, done) - <-listening // wait for server to start - opts := ExportContainerOptions{ID: "4fa6e0f0c678", OutputStream: out} - err := client.ExportContainer(opts) - <-done // make sure server stopped - if err != nil { - t.Errorf("ExportContainer: caugh error %#v while exporting container, expected nil", err.Error()) - } - if out.String() != content { - t.Errorf("ExportContainer: wrong stdout. Want %#v. Got %#v.", content, out.String()) - } -} - -func runStreamConnServer(t *testing.T, network, laddr string, listening chan<- string, done chan<- int) { - defer close(done) - l, err := net.Listen(network, laddr) - if err != nil { - t.Errorf("Listen(%q, %q) failed: %v", network, laddr, err) - listening <- "" - return - } - defer l.Close() - listening <- l.Addr().String() - c, err := l.Accept() - if err != nil { - t.Logf("Accept failed: %v", err) - return - } - c.Write([]byte("HTTP/1.1 200 OK\n\nexported container tar content")) - c.Close() -} - -func tempfile(filename string) string { - return os.TempDir() + "/" + filename + "." + strconv.Itoa(os.Getpid()) -} - -func TestExportContainerNoId(t *testing.T) { - client := Client{} - out := stdoutMock{bytes.NewBufferString("")} - err := client.ExportContainer(ExportContainerOptions{OutputStream: out}) - e, ok := err.(*NoSuchContainer) - if !ok { - t.Errorf("ExportContainer: wrong error. Want NoSuchContainer. Got %#v.", e) - } - if e.ID != "" { - t.Errorf("ExportContainer: wrong ID. Want %q. Got %q", "", e.ID) - } -} - -func TestUploadToContainer(t *testing.T) { - content := "File content" - in := stdinMock{bytes.NewBufferString(content)} - fakeRT := &FakeRoundTripper{status: http.StatusOK} - client := newTestClient(fakeRT) - opts := UploadToContainerOptions{ - Path: "abc", - InputStream: in, - } - err := client.UploadToContainer("a123456", opts) - if err != nil { - t.Errorf("UploadToContainer: caught error %#v while uploading archive to container, expected nil", err) - } - - req := fakeRT.requests[0] - - if req.Method != "PUT" { - t.Errorf("UploadToContainer{Path:abc}: Wrong HTTP method. Want PUT. Got %s", req.Method) - } - - if pathParam := req.URL.Query().Get("path"); pathParam != "abc" { - t.Errorf("ListImages({Path:abc}): Wrong parameter. Want path=abc. Got path=%s", pathParam) - } - -} - -func TestDownloadFromContainer(t *testing.T) { - filecontent := "File content" - client := newTestClient(&FakeRoundTripper{message: filecontent, status: http.StatusOK}) - - var out bytes.Buffer - opts := DownloadFromContainerOptions{ - OutputStream: &out, - } - err := client.DownloadFromContainer("a123456", opts) - if err != nil { - t.Errorf("DownloadFromContainer: caught error %#v while downloading from container, expected nil", err.Error()) - } - if out.String() != filecontent { - t.Errorf("DownloadFromContainer: wrong stdout. Want %#v. Got %#v.", filecontent, out.String()) - } -} - -func TestCopyFromContainer(t *testing.T) { - content := "File content" - out := stdoutMock{bytes.NewBufferString(content)} - client := newTestClient(&FakeRoundTripper{status: http.StatusOK}) - opts := CopyFromContainerOptions{ - Container: "a123456", - OutputStream: &out, - } - err := client.CopyFromContainer(opts) - if err != nil { - t.Errorf("CopyFromContainer: caught error %#v while copying from container, expected nil", err.Error()) - } - if out.String() != content { - t.Errorf("CopyFromContainer: wrong stdout. Want %#v. Got %#v.", content, out.String()) - } -} - -func TestCopyFromContainerEmptyContainer(t *testing.T) { - client := newTestClient(&FakeRoundTripper{status: http.StatusOK}) - err := client.CopyFromContainer(CopyFromContainerOptions{}) - _, ok := err.(*NoSuchContainer) - if !ok { - t.Errorf("CopyFromContainer: invalid error returned. Want NoSuchContainer, got %#v.", err) - } -} - -func TestPassingNameOptToCreateContainerReturnsItInContainer(t *testing.T) { - jsonContainer := `{ - "Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2", - "Warnings": [] -}` - fakeRT := &FakeRoundTripper{message: jsonContainer, status: http.StatusOK} - client := newTestClient(fakeRT) - config := Config{AttachStdout: true, AttachStdin: true} - opts := CreateContainerOptions{Name: "TestCreateContainer", Config: &config} - container, err := client.CreateContainer(opts) - if err != nil { - t.Fatal(err) - } - if container.Name != "TestCreateContainer" { - t.Errorf("Container name expected to be TestCreateContainer, was %s", container.Name) - } -} - -func TestAlwaysRestart(t *testing.T) { - policy := AlwaysRestart() - if policy.Name != "always" { - t.Errorf("AlwaysRestart(): wrong policy name. Want %q. Got %q", "always", policy.Name) - } - if policy.MaximumRetryCount != 0 { - t.Errorf("AlwaysRestart(): wrong MaximumRetryCount. Want 0. Got %d", policy.MaximumRetryCount) - } -} - -func TestRestartOnFailure(t *testing.T) { - const retry = 5 - policy := RestartOnFailure(retry) - if policy.Name != "on-failure" { - t.Errorf("RestartOnFailure(%d): wrong policy name. Want %q. Got %q", retry, "on-failure", policy.Name) - } - if policy.MaximumRetryCount != retry { - t.Errorf("RestartOnFailure(%d): wrong MaximumRetryCount. Want %d. Got %d", retry, retry, policy.MaximumRetryCount) - } -} - -func TestNeverRestart(t *testing.T) { - policy := NeverRestart() - if policy.Name != "no" { - t.Errorf("NeverRestart(): wrong policy name. Want %q. Got %q", "always", policy.Name) - } - if policy.MaximumRetryCount != 0 { - t.Errorf("NeverRestart(): wrong MaximumRetryCount. Want 0. Got %d", policy.MaximumRetryCount) - } -} - -func TestTopContainer(t *testing.T) { - jsonTop := `{ - "Processes": [ - [ - "ubuntu", - "3087", - "815", - "0", - "01:44", - "?", - "00:00:00", - "cmd1" - ], - [ - "root", - "3158", - "3087", - "0", - "01:44", - "?", - "00:00:01", - "cmd2" - ] - ], - "Titles": [ - "UID", - "PID", - "PPID", - "C", - "STIME", - "TTY", - "TIME", - "CMD" - ] -}` - var expected TopResult - err := json.Unmarshal([]byte(jsonTop), &expected) - if err != nil { - t.Fatal(err) - } - id := "4fa6e0f0" - fakeRT := &FakeRoundTripper{message: jsonTop, status: http.StatusOK} - client := newTestClient(fakeRT) - processes, err := client.TopContainer(id, "") - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(processes, expected) { - t.Errorf("TopContainer: Expected %#v. Got %#v.", expected, processes) - } - if len(processes.Processes) != 2 || len(processes.Processes[0]) != 8 || - processes.Processes[0][7] != "cmd1" { - t.Errorf("TopContainer: Process list to include cmd1. Got %#v.", processes) - } - expectedURI := "/containers/" + id + "/top" - if !strings.HasSuffix(fakeRT.requests[0].URL.String(), expectedURI) { - t.Errorf("TopContainer: Expected URI to have %q. Got %q.", expectedURI, fakeRT.requests[0].URL.String()) - } -} - -func TestTopContainerNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) - _, err := client.TopContainer("abef348", "") - expected := &NoSuchContainer{ID: "abef348"} - if !reflect.DeepEqual(err, expected) { - t.Errorf("StopContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) - } -} - -func TestTopContainerWithPsArgs(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "no such container", status: http.StatusNotFound} - client := newTestClient(fakeRT) - expectedErr := &NoSuchContainer{ID: "abef348"} - if _, err := client.TopContainer("abef348", "aux"); !reflect.DeepEqual(expectedErr, err) { - t.Errorf("TopContainer: Expected %v. Got %v.", expectedErr, err) - } - expectedURI := "/containers/abef348/top?ps_args=aux" - if !strings.HasSuffix(fakeRT.requests[0].URL.String(), expectedURI) { - t.Errorf("TopContainer: Expected URI to have %q. Got %q.", expectedURI, fakeRT.requests[0].URL.String()) - } -} - -func TestStatsTimeout(t *testing.T) { - l, err := net.Listen("unix", "/tmp/docker_test.sock") - if err != nil { - t.Fatal(err) - } - received := false - defer l.Close() - go func() { - l.Accept() - received = true - time.Sleep(time.Second) - }() - client, _ := NewClient("unix:///tmp/docker_test.sock") - client.SkipServerVersionCheck = true - errC := make(chan error, 1) - statsC := make(chan *Stats) - done := make(chan bool) - go func() { - errC <- client.Stats(StatsOptions{"c", statsC, true, done, time.Millisecond * 100}) - close(errC) - }() - err = <-errC - e, ok := err.(net.Error) - if !ok || !e.Timeout() { - t.Error("Failed to receive timeout exception") - } - if !received { - t.Fatal("Failed to receive message") - } -} - -func TestStats(t *testing.T) { - jsonStats1 := `{ - "read" : "2015-01-08T22:57:31.547920715Z", - "network" : { - "rx_dropped" : 0, - "rx_bytes" : 648, - "rx_errors" : 0, - "tx_packets" : 8, - "tx_dropped" : 0, - "rx_packets" : 8, - "tx_errors" : 0, - "tx_bytes" : 648 - }, - "networks" : { - "eth0":{ - "rx_dropped" : 0, - "rx_bytes" : 648, - "rx_errors" : 0, - "tx_packets" : 8, - "tx_dropped" : 0, - "rx_packets" : 8, - "tx_errors" : 0, - "tx_bytes" : 648 - } - }, - "memory_stats" : { - "stats" : { - "total_pgmajfault" : 0, - "cache" : 0, - "mapped_file" : 0, - "total_inactive_file" : 0, - "pgpgout" : 414, - "rss" : 6537216, - "total_mapped_file" : 0, - "writeback" : 0, - "unevictable" : 0, - "pgpgin" : 477, - "total_unevictable" : 0, - "pgmajfault" : 0, - "total_rss" : 6537216, - "total_rss_huge" : 6291456, - "total_writeback" : 0, - "total_inactive_anon" : 0, - "rss_huge" : 6291456, - "hierarchical_memory_limit": 189204833, - "total_pgfault" : 964, - "total_active_file" : 0, - "active_anon" : 6537216, - "total_active_anon" : 6537216, - "total_pgpgout" : 414, - "total_cache" : 0, - "inactive_anon" : 0, - "active_file" : 0, - "pgfault" : 964, - "inactive_file" : 0, - "total_pgpgin" : 477, - "swap" : 47312896, - "hierarchical_memsw_limit" : 1610612736 - }, - "max_usage" : 6651904, - "usage" : 6537216, - "failcnt" : 0, - "limit" : 67108864 - }, - "blkio_stats": { - "io_service_bytes_recursive": [ - { - "major": 8, - "minor": 0, - "op": "Read", - "value": 428795731968 - }, - { - "major": 8, - "minor": 0, - "op": "Write", - "value": 388177920 - } - ], - "io_serviced_recursive": [ - { - "major": 8, - "minor": 0, - "op": "Read", - "value": 25994442 - }, - { - "major": 8, - "minor": 0, - "op": "Write", - "value": 1734 - } - ], - "io_queue_recursive": [], - "io_service_time_recursive": [], - "io_wait_time_recursive": [], - "io_merged_recursive": [], - "io_time_recursive": [], - "sectors_recursive": [] - }, - "cpu_stats" : { - "cpu_usage" : { - "percpu_usage" : [ - 16970827, - 1839451, - 7107380, - 10571290 - ], - "usage_in_usermode" : 10000000, - "total_usage" : 36488948, - "usage_in_kernelmode" : 20000000 - }, - "system_cpu_usage" : 20091722000000000 - }, - "precpu_stats" : { - "cpu_usage" : { - "percpu_usage" : [ - 16970827, - 1839451, - 7107380, - 10571290 - ], - "usage_in_usermode" : 10000000, - "total_usage" : 36488948, - "usage_in_kernelmode" : 20000000 - }, - "system_cpu_usage" : 20091722000000000 - } - }` - // 1 second later, cache is 100 - jsonStats2 := `{ - "read" : "2015-01-08T22:57:32.547920715Z", - "networks" : { - "eth0":{ - "rx_dropped" : 0, - "rx_bytes" : 648, - "rx_errors" : 0, - "tx_packets" : 8, - "tx_dropped" : 0, - "rx_packets" : 8, - "tx_errors" : 0, - "tx_bytes" : 648 - } - }, - "memory_stats" : { - "stats" : { - "total_pgmajfault" : 0, - "cache" : 100, - "mapped_file" : 0, - "total_inactive_file" : 0, - "pgpgout" : 414, - "rss" : 6537216, - "total_mapped_file" : 0, - "writeback" : 0, - "unevictable" : 0, - "pgpgin" : 477, - "total_unevictable" : 0, - "pgmajfault" : 0, - "total_rss" : 6537216, - "total_rss_huge" : 6291456, - "total_writeback" : 0, - "total_inactive_anon" : 0, - "rss_huge" : 6291456, - "total_pgfault" : 964, - "total_active_file" : 0, - "active_anon" : 6537216, - "total_active_anon" : 6537216, - "total_pgpgout" : 414, - "total_cache" : 0, - "inactive_anon" : 0, - "active_file" : 0, - "pgfault" : 964, - "inactive_file" : 0, - "total_pgpgin" : 477, - "swap" : 47312896, - "hierarchical_memsw_limit" : 1610612736 - }, - "max_usage" : 6651904, - "usage" : 6537216, - "failcnt" : 0, - "limit" : 67108864 - }, - "blkio_stats": { - "io_service_bytes_recursive": [ - { - "major": 8, - "minor": 0, - "op": "Read", - "value": 428795731968 - }, - { - "major": 8, - "minor": 0, - "op": "Write", - "value": 388177920 - } - ], - "io_serviced_recursive": [ - { - "major": 8, - "minor": 0, - "op": "Read", - "value": 25994442 - }, - { - "major": 8, - "minor": 0, - "op": "Write", - "value": 1734 - } - ], - "io_queue_recursive": [], - "io_service_time_recursive": [], - "io_wait_time_recursive": [], - "io_merged_recursive": [], - "io_time_recursive": [], - "sectors_recursive": [] - }, - "cpu_stats" : { - "cpu_usage" : { - "percpu_usage" : [ - 16970827, - 1839451, - 7107380, - 10571290 - ], - "usage_in_usermode" : 10000000, - "total_usage" : 36488948, - "usage_in_kernelmode" : 20000000 - }, - "system_cpu_usage" : 20091722000000000 - }, - "precpu_stats" : { - "cpu_usage" : { - "percpu_usage" : [ - 16970827, - 1839451, - 7107380, - 10571290 - ], - "usage_in_usermode" : 10000000, - "total_usage" : 36488948, - "usage_in_kernelmode" : 20000000 - }, - "system_cpu_usage" : 20091722000000000 - } - }` - var expected1 Stats - var expected2 Stats - err := json.Unmarshal([]byte(jsonStats1), &expected1) - if err != nil { - t.Fatal(err) - } - err = json.Unmarshal([]byte(jsonStats2), &expected2) - if err != nil { - t.Fatal(err) - } - id := "4fa6e0f0" - - var req http.Request - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") - w.Write([]byte(jsonStats1)) - w.Write([]byte(jsonStats2)) - req = *r - })) - defer server.Close() - client, _ := NewClient(server.URL) - client.SkipServerVersionCheck = true - errC := make(chan error, 1) - statsC := make(chan *Stats) - done := make(chan bool) - go func() { - errC <- client.Stats(StatsOptions{id, statsC, true, done, 0}) - close(errC) - }() - var resultStats []*Stats - for { - stats, ok := <-statsC - if !ok { - break - } - resultStats = append(resultStats, stats) - } - err = <-errC - if err != nil { - t.Fatal(err) - } - if len(resultStats) != 2 { - t.Fatalf("Stats: Expected 2 results. Got %d.", len(resultStats)) - } - if !reflect.DeepEqual(resultStats[0], &expected1) { - t.Errorf("Stats: Expected:\n%+v\nGot:\n%+v", expected1, resultStats[0]) - } - if !reflect.DeepEqual(resultStats[1], &expected2) { - t.Errorf("Stats: Expected:\n%+v\nGot:\n%+v", expected2, resultStats[1]) - } - if req.Method != "GET" { - t.Errorf("Stats: wrong HTTP method. Want GET. Got %s.", req.Method) - } - u, _ := url.Parse(client.getURL("/containers/" + id + "/stats")) - if req.URL.Path != u.Path { - t.Errorf("Stats: wrong HTTP path. Want %q. Got %q.", u.Path, req.URL.Path) - } -} - -func TestStatsContainerNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) - statsC := make(chan *Stats) - done := make(chan bool) - err := client.Stats(StatsOptions{"abef348", statsC, true, done, 0}) - expected := &NoSuchContainer{ID: "abef348"} - if !reflect.DeepEqual(err, expected) { - t.Errorf("Stats: Wrong error returned. Want %#v. Got %#v.", expected, err) - } -} - -func TestRenameContainer(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - opts := RenameContainerOptions{ID: "something_old", Name: "something_new"} - err := client.RenameContainer(opts) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("RenameContainer: wrong HTTP method. Want %q. Got %q.", "POST", req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/containers/something_old/rename?name=something_new")) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("RenameContainer: Wrong path in request. Want %q. Got %q.", expectedURL.Path, gotPath) - } - expectedValues := expectedURL.Query()["name"] - actualValues := req.URL.Query()["name"] - if len(actualValues) != 1 || expectedValues[0] != actualValues[0] { - t.Errorf("RenameContainer: Wrong params in request. Want %q. Got %q.", expectedValues, actualValues) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/env_test.go b/vendor/github.com/fsouza/go-dockerclient/env_test.go deleted file mode 100644 index df5169d06b..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/env_test.go +++ /dev/null @@ -1,351 +0,0 @@ -// Copyright 2014 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the DOCKER-LICENSE file. - -package docker - -import ( - "bytes" - "errors" - "reflect" - "sort" - "testing" -) - -func TestGet(t *testing.T) { - var tests = []struct { - input []string - query string - expected string - }{ - {[]string{"PATH=/usr/bin:/bin", "PYTHONPATH=/usr/local"}, "PATH", "/usr/bin:/bin"}, - {[]string{"PATH=/usr/bin:/bin", "PYTHONPATH=/usr/local"}, "PYTHONPATH", "/usr/local"}, - {[]string{"PATH=/usr/bin:/bin", "PYTHONPATH=/usr/local"}, "PYTHONPATHI", ""}, - {[]string{"WAT="}, "WAT", ""}, - } - for _, tt := range tests { - env := Env(tt.input) - got := env.Get(tt.query) - if got != tt.expected { - t.Errorf("Env.Get(%q): wrong result. Want %q. Got %q", tt.query, tt.expected, got) - } - } -} - -func TestExists(t *testing.T) { - var tests = []struct { - input []string - query string - expected bool - }{ - {[]string{"WAT=", "PYTHONPATH=/usr/local"}, "WAT", true}, - {[]string{"PATH=/usr/bin:/bin", "PYTHONPATH=/usr/local"}, "PYTHONPATH", true}, - {[]string{"PATH=/usr/bin:/bin", "PYTHONPATH=/usr/local"}, "PYTHONPATHI", false}, - } - for _, tt := range tests { - env := Env(tt.input) - got := env.Exists(tt.query) - if got != tt.expected { - t.Errorf("Env.Exists(%q): wrong result. Want %v. Got %v", tt.query, tt.expected, got) - } - } -} - -func TestGetBool(t *testing.T) { - var tests = []struct { - input string - expected bool - }{ - {"EMTPY_VAR", false}, {"ZERO_VAR", false}, {"NO_VAR", false}, - {"FALSE_VAR", false}, {"NONE_VAR", false}, {"TRUE_VAR", true}, - {"WAT", true}, {"PATH", true}, {"ONE_VAR", true}, {"NO_VAR_TAB", false}, - } - env := Env([]string{ - "EMPTY_VAR=", "ZERO_VAR=0", "NO_VAR=no", "FALSE_VAR=false", - "NONE_VAR=none", "TRUE_VAR=true", "WAT=wat", "PATH=/usr/bin:/bin", - "ONE_VAR=1", "NO_VAR_TAB=0 \t\t\t", - }) - for _, tt := range tests { - got := env.GetBool(tt.input) - if got != tt.expected { - t.Errorf("Env.GetBool(%q): wrong result. Want %v. Got %v.", tt.input, tt.expected, got) - } - } -} - -func TestSetBool(t *testing.T) { - var tests = []struct { - input bool - expected string - }{ - {true, "1"}, {false, "0"}, - } - for _, tt := range tests { - var env Env - env.SetBool("SOME", tt.input) - if got := env.Get("SOME"); got != tt.expected { - t.Errorf("Env.SetBool(%v): wrong result. Want %q. Got %q", tt.input, tt.expected, got) - } - } -} - -func TestGetInt(t *testing.T) { - var tests = []struct { - input string - expected int - }{ - {"NEGATIVE_INTEGER", -10}, {"NON_INTEGER", -1}, {"ONE", 1}, {"TWO", 2}, - } - env := Env([]string{"NEGATIVE_INTEGER=-10", "NON_INTEGER=wat", "ONE=1", "TWO=2"}) - for _, tt := range tests { - got := env.GetInt(tt.input) - if got != tt.expected { - t.Errorf("Env.GetInt(%q): wrong result. Want %d. Got %d", tt.input, tt.expected, got) - } - } -} - -func TestSetInt(t *testing.T) { - var tests = []struct { - input int - expected string - }{ - {10, "10"}, {13, "13"}, {7, "7"}, {33, "33"}, - {0, "0"}, {-34, "-34"}, - } - for _, tt := range tests { - var env Env - env.SetInt("SOME", tt.input) - if got := env.Get("SOME"); got != tt.expected { - t.Errorf("Env.SetBool(%d): wrong result. Want %q. Got %q", tt.input, tt.expected, got) - } - } -} - -func TestGetInt64(t *testing.T) { - var tests = []struct { - input string - expected int64 - }{ - {"NEGATIVE_INTEGER", -10}, {"NON_INTEGER", -1}, {"ONE", 1}, {"TWO", 2}, - } - env := Env([]string{"NEGATIVE_INTEGER=-10", "NON_INTEGER=wat", "ONE=1", "TWO=2"}) - for _, tt := range tests { - got := env.GetInt64(tt.input) - if got != tt.expected { - t.Errorf("Env.GetInt64(%q): wrong result. Want %d. Got %d", tt.input, tt.expected, got) - } - } -} - -func TestSetInt64(t *testing.T) { - var tests = []struct { - input int64 - expected string - }{ - {10, "10"}, {13, "13"}, {7, "7"}, {33, "33"}, - {0, "0"}, {-34, "-34"}, - } - for _, tt := range tests { - var env Env - env.SetInt64("SOME", tt.input) - if got := env.Get("SOME"); got != tt.expected { - t.Errorf("Env.SetBool(%d): wrong result. Want %q. Got %q", tt.input, tt.expected, got) - } - } -} - -func TestGetJSON(t *testing.T) { - var p struct { - Name string `json:"name"` - Age int `json:"age"` - } - var env Env - env.Set("person", `{"name":"Gopher","age":5}`) - err := env.GetJSON("person", &p) - if err != nil { - t.Error(err) - } - if p.Name != "Gopher" { - t.Errorf("Env.GetJSON(%q): wrong name. Want %q. Got %q", "person", "Gopher", p.Name) - } - if p.Age != 5 { - t.Errorf("Env.GetJSON(%q): wrong age. Want %d. Got %d", "person", 5, p.Age) - } -} - -func TestGetJSONAbsent(t *testing.T) { - var l []string - var env Env - err := env.GetJSON("person", &l) - if err != nil { - t.Error(err) - } - if l != nil { - t.Errorf("Env.GetJSON(): get unexpected list %v", l) - } -} - -func TestGetJSONFailure(t *testing.T) { - var p []string - var env Env - env.Set("list-person", `{"name":"Gopher","age":5}`) - err := env.GetJSON("list-person", &p) - if err == nil { - t.Errorf("Env.GetJSON(%q): got unexpected error.", "list-person") - } -} - -func TestSetJSON(t *testing.T) { - var p1 = struct { - Name string `json:"name"` - Age int `json:"age"` - }{Name: "Gopher", Age: 5} - var env Env - err := env.SetJSON("person", p1) - if err != nil { - t.Error(err) - } - var p2 struct { - Name string `json:"name"` - Age int `json:"age"` - } - err = env.GetJSON("person", &p2) - if err != nil { - t.Error(err) - } - if !reflect.DeepEqual(p1, p2) { - t.Errorf("Env.SetJSON(%q): wrong result. Want %v. Got %v", "person", p1, p2) - } -} - -func TestSetJSONFailure(t *testing.T) { - var env Env - err := env.SetJSON("person", unmarshable{}) - if err == nil { - t.Error("Env.SetJSON(): got unexpected error") - } - if env.Exists("person") { - t.Errorf("Env.SetJSON(): should not define the key %q, but did", "person") - } -} - -func TestGetList(t *testing.T) { - var tests = []struct { - input string - expected []string - }{ - {"WAT=wat", []string{"wat"}}, - {`WAT=["wat","wet","wit","wot","wut"]`, []string{"wat", "wet", "wit", "wot", "wut"}}, - {"WAT=", nil}, - } - for _, tt := range tests { - env := Env([]string{tt.input}) - got := env.GetList("WAT") - if !reflect.DeepEqual(got, tt.expected) { - t.Errorf("Env.GetList(%q): wrong result. Want %v. Got %v", "WAT", tt.expected, got) - } - } -} - -func TestSetList(t *testing.T) { - list := []string{"a", "b", "c"} - var env Env - if err := env.SetList("SOME", list); err != nil { - t.Error(err) - } - if got := env.GetList("SOME"); !reflect.DeepEqual(got, list) { - t.Errorf("Env.SetList(%v): wrong result. Got %v", list, got) - } -} - -func TestSet(t *testing.T) { - var env Env - env.Set("PATH", "/home/bin:/bin") - env.Set("SOMETHING", "/usr/bin") - env.Set("PATH", "/bin") - if expected, got := "/usr/bin", env.Get("SOMETHING"); got != expected { - t.Errorf("Env.Set(%q): wrong result. Want %q. Got %q", expected, expected, got) - } - if expected, got := "/bin", env.Get("PATH"); got != expected { - t.Errorf("Env.Set(%q): wrong result. Want %q. Got %q", expected, expected, got) - } -} - -func TestDecode(t *testing.T) { - var tests = []struct { - input string - expectedOut []string - expectedErr string - }{ - { - `{"PATH":"/usr/bin:/bin","containers":54,"wat":["123","345"]}`, - []string{"PATH=/usr/bin:/bin", "containers=54", `wat=["123","345"]`}, - "", - }, - {"}}", nil, "invalid character '}' looking for beginning of value"}, - {`{}`, nil, ""}, - } - for _, tt := range tests { - var env Env - err := env.Decode(bytes.NewBufferString(tt.input)) - if tt.expectedErr == "" { - if err != nil { - t.Error(err) - } - } else if tt.expectedErr != err.Error() { - t.Errorf("Env.Decode(): invalid error. Want %q. Got %q.", tt.expectedErr, err) - } - got := []string(env) - sort.Strings(got) - sort.Strings(tt.expectedOut) - if !reflect.DeepEqual(got, tt.expectedOut) { - t.Errorf("Env.Decode(): wrong result. Want %v. Got %v.", tt.expectedOut, got) - } - } -} - -func TestSetAuto(t *testing.T) { - buf := bytes.NewBufferString("oi") - var tests = []struct { - input interface{} - expected string - }{ - {10, "10"}, - {10.3, "10"}, - {"oi", "oi"}, - {buf, "{}"}, - {unmarshable{}, "{}"}, - } - for _, tt := range tests { - var env Env - env.SetAuto("SOME", tt.input) - if got := env.Get("SOME"); got != tt.expected { - t.Errorf("Env.SetAuto(%v): wrong result. Want %q. Got %q", tt.input, tt.expected, got) - } - } -} - -func TestMap(t *testing.T) { - var tests = []struct { - input []string - expected map[string]string - }{ - {[]string{"PATH=/usr/bin:/bin", "PYTHONPATH=/usr/local"}, map[string]string{"PATH": "/usr/bin:/bin", "PYTHONPATH": "/usr/local"}}, - {nil, nil}, - } - for _, tt := range tests { - env := Env(tt.input) - got := env.Map() - if !reflect.DeepEqual(got, tt.expected) { - t.Errorf("Env.Map(): wrong result. Want %v. Got %v", tt.expected, got) - } - } -} - -type unmarshable struct { -} - -func (unmarshable) MarshalJSON() ([]byte, error) { - return nil, errors.New("cannot marshal") -} diff --git a/vendor/github.com/fsouza/go-dockerclient/event_test.go b/vendor/github.com/fsouza/go-dockerclient/event_test.go deleted file mode 100644 index a308538ccd..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/event_test.go +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright 2014 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package docker - -import ( - "bufio" - "crypto/tls" - "crypto/x509" - "fmt" - "io/ioutil" - "net/http" - "net/http/httptest" - "strings" - "testing" - "time" -) - -func TestEventListeners(t *testing.T) { - testEventListeners("TestEventListeners", t, httptest.NewServer, NewClient) -} - -func TestTLSEventListeners(t *testing.T) { - testEventListeners("TestTLSEventListeners", t, func(handler http.Handler) *httptest.Server { - server := httptest.NewUnstartedServer(handler) - - cert, err := tls.LoadX509KeyPair("testing/data/server.pem", "testing/data/serverkey.pem") - if err != nil { - t.Fatalf("Error loading server key pair: %s", err) - } - - caCert, err := ioutil.ReadFile("testing/data/ca.pem") - if err != nil { - t.Fatalf("Error loading ca certificate: %s", err) - } - caPool := x509.NewCertPool() - if !caPool.AppendCertsFromPEM(caCert) { - t.Fatalf("Could not add ca certificate") - } - - server.TLS = &tls.Config{ - Certificates: []tls.Certificate{cert}, - RootCAs: caPool, - } - server.StartTLS() - return server - }, func(url string) (*Client, error) { - return NewTLSClient(url, "testing/data/cert.pem", "testing/data/key.pem", "testing/data/ca.pem") - }) -} - -func testEventListeners(testName string, t *testing.T, buildServer func(http.Handler) *httptest.Server, buildClient func(string) (*Client, error)) { - response := `{"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924} -{"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924} -{"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966} -{"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970} -` - - server := buildServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - rsc := bufio.NewScanner(strings.NewReader(response)) - for rsc.Scan() { - w.Write([]byte(rsc.Text())) - w.(http.Flusher).Flush() - time.Sleep(10 * time.Millisecond) - } - })) - defer server.Close() - - client, err := buildClient(server.URL) - if err != nil { - t.Errorf("Failed to create client: %s", err) - } - client.SkipServerVersionCheck = true - - listener := make(chan *APIEvents, 10) - defer func() { - time.Sleep(10 * time.Millisecond) - if err := client.RemoveEventListener(listener); err != nil { - t.Error(err) - } - }() - - err = client.AddEventListener(listener) - if err != nil { - t.Errorf("Failed to add event listener: %s", err) - } - - timeout := time.After(1 * time.Second) - var count int - - for { - select { - case msg := <-listener: - t.Logf("Received: %v", *msg) - count++ - err = checkEvent(count, msg) - if err != nil { - t.Fatalf("Check event failed: %s", err) - } - if count == 4 { - return - } - case <-timeout: - t.Fatalf("%s timed out waiting on events", testName) - } - } -} - -func checkEvent(index int, event *APIEvents) error { - if event.ID != "dfdf82bd3881" { - return fmt.Errorf("event ID did not match. Expected dfdf82bd3881 got %s", event.ID) - } - if event.From != "base:latest" { - return fmt.Errorf("event from did not match. Expected base:latest got %s", event.From) - } - var status string - switch index { - case 1: - status = "create" - case 2: - status = "start" - case 3: - status = "stop" - case 4: - status = "destroy" - } - if event.Status != status { - return fmt.Errorf("event status did not match. Expected %s got %s", status, event.Status) - } - return nil -} diff --git a/vendor/github.com/fsouza/go-dockerclient/example_test.go b/vendor/github.com/fsouza/go-dockerclient/example_test.go deleted file mode 100644 index 8c2c719e6e..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/example_test.go +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2014 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package docker_test - -import ( - "archive/tar" - "bytes" - "fmt" - "io" - "log" - "time" - - "github.com/fsouza/go-dockerclient" -) - -func ExampleClient_AttachToContainer() { - client, err := docker.NewClient("http://localhost:4243") - if err != nil { - log.Fatal(err) - } - client.SkipServerVersionCheck = true - // Reading logs from container a84849 and sending them to buf. - var buf bytes.Buffer - err = client.AttachToContainer(docker.AttachToContainerOptions{ - Container: "a84849", - OutputStream: &buf, - Logs: true, - Stdout: true, - Stderr: true, - }) - if err != nil { - log.Fatal(err) - } - log.Println(buf.String()) - buf.Reset() - err = client.AttachToContainer(docker.AttachToContainerOptions{ - Container: "a84849", - OutputStream: &buf, - Stdout: true, - Stream: true, - }) - if err != nil { - log.Fatal(err) - } - log.Println(buf.String()) -} - -func ExampleClient_CopyFromContainer() { - client, err := docker.NewClient("http://localhost:4243") - if err != nil { - log.Fatal(err) - } - cid := "a84849" - var buf bytes.Buffer - filename := "/tmp/output.txt" - err = client.CopyFromContainer(docker.CopyFromContainerOptions{ - Container: cid, - Resource: filename, - OutputStream: &buf, - }) - if err != nil { - log.Fatalf("Error while copying from %s: %s\n", cid, err) - } - content := new(bytes.Buffer) - r := bytes.NewReader(buf.Bytes()) - tr := tar.NewReader(r) - tr.Next() - if err != nil && err != io.EOF { - log.Fatal(err) - } - if _, err := io.Copy(content, tr); err != nil { - log.Fatal(err) - } - log.Println(buf.String()) -} - -func ExampleClient_BuildImage() { - client, err := docker.NewClient("http://localhost:4243") - if err != nil { - log.Fatal(err) - } - - t := time.Now() - inputbuf, outputbuf := bytes.NewBuffer(nil), bytes.NewBuffer(nil) - tr := tar.NewWriter(inputbuf) - tr.WriteHeader(&tar.Header{Name: "Dockerfile", Size: 10, ModTime: t, AccessTime: t, ChangeTime: t}) - tr.Write([]byte("FROM base\n")) - tr.Close() - opts := docker.BuildImageOptions{ - Name: "test", - InputStream: inputbuf, - OutputStream: outputbuf, - } - if err := client.BuildImage(opts); err != nil { - log.Fatal(err) - } -} - -func ExampleClient_ListenEvents() { - client, err := docker.NewClient("http://localhost:4243") - if err != nil { - log.Fatal(err) - } - - listener := make(chan *docker.APIEvents) - err = client.AddEventListener(listener) - if err != nil { - log.Fatal(err) - } - - defer func() { - - err = client.RemoveEventListener(listener) - if err != nil { - log.Fatal(err) - } - - }() - - timeout := time.After(1 * time.Second) - - for { - select { - case msg := <-listener: - log.Println(msg) - case <-timeout: - break - } - } - -} - -func ExampleEnv_Map() { - e := docker.Env([]string{"A=1", "B=2", "C=3"}) - envs := e.Map() - for k, v := range envs { - fmt.Printf("%s=%q\n", k, v) - } -} - -func ExampleEnv_SetJSON() { - type Person struct { - Name string - Age int - } - p := Person{Name: "Gopher", Age: 4} - var e docker.Env - err := e.SetJSON("person", p) - if err != nil { - log.Fatal(err) - } -} - -func ExampleEnv_GetJSON() { - type Person struct { - Name string - Age int - } - p := Person{Name: "Gopher", Age: 4} - var e docker.Env - e.Set("person", `{"name":"Gopher","age":4}`) - err := e.GetJSON("person", &p) - if err != nil { - log.Fatal(err) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/exec_test.go b/vendor/github.com/fsouza/go-dockerclient/exec_test.go deleted file mode 100644 index 2dc8d2100c..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/exec_test.go +++ /dev/null @@ -1,262 +0,0 @@ -// Copyright 2015 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package docker - -import ( - "bytes" - "encoding/json" - "net/http" - "net/http/httptest" - "net/url" - "reflect" - "strings" - "testing" -) - -func TestExecCreate(t *testing.T) { - jsonContainer := `{"Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2"}` - var expected struct{ ID string } - err := json.Unmarshal([]byte(jsonContainer), &expected) - if err != nil { - t.Fatal(err) - } - fakeRT := &FakeRoundTripper{message: jsonContainer, status: http.StatusOK} - client := newTestClient(fakeRT) - config := CreateExecOptions{ - Container: "test", - AttachStdin: true, - AttachStdout: true, - AttachStderr: false, - Tty: false, - Cmd: []string{"touch", "/tmp/file"}, - User: "a-user", - } - execObj, err := client.CreateExec(config) - if err != nil { - t.Fatal(err) - } - expectedID := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - if execObj.ID != expectedID { - t.Errorf("ExecCreate: wrong ID. Want %q. Got %q.", expectedID, execObj.ID) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("ExecCreate: wrong HTTP method. Want %q. Got %q.", "POST", req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/containers/test/exec")) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("ExecCreate: Wrong path in request. Want %q. Got %q.", expectedURL.Path, gotPath) - } - var gotBody struct{ ID string } - err = json.NewDecoder(req.Body).Decode(&gotBody) - if err != nil { - t.Fatal(err) - } -} - -func TestExecStartDetached(t *testing.T) { - execID := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - fakeRT := &FakeRoundTripper{status: http.StatusOK} - client := newTestClient(fakeRT) - config := StartExecOptions{ - Detach: true, - } - err := client.StartExec(execID, config) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("ExecStart: wrong HTTP method. Want %q. Got %q.", "POST", req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/exec/" + execID + "/start")) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("ExecCreate: Wrong path in request. Want %q. Got %q.", expectedURL.Path, gotPath) - } - t.Log(req.Body) - var gotBody struct{ Detach bool } - err = json.NewDecoder(req.Body).Decode(&gotBody) - if err != nil { - t.Fatal(err) - } - if !gotBody.Detach { - t.Fatal("Expected Detach in StartExecOptions to be true") - } -} - -func TestExecStartAndAttach(t *testing.T) { - var reader = strings.NewReader("send value") - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte{1, 0, 0, 0, 0, 0, 0, 5}) - w.Write([]byte("hello")) - })) - defer server.Close() - client, _ := NewClient(server.URL) - client.SkipServerVersionCheck = true - var stdout, stderr bytes.Buffer - success := make(chan struct{}) - execID := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - opts := StartExecOptions{ - OutputStream: &stdout, - ErrorStream: &stderr, - InputStream: reader, - RawTerminal: true, - Success: success, - } - go func() { - if err := client.StartExec(execID, opts); err != nil { - t.Error(err) - } - }() - <-success -} - -func TestExecResize(t *testing.T) { - execID := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - fakeRT := &FakeRoundTripper{status: http.StatusOK} - client := newTestClient(fakeRT) - err := client.ResizeExecTTY(execID, 10, 20) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("ExecStart: wrong HTTP method. Want %q. Got %q.", "POST", req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/exec/" + execID + "/resize?h=10&w=20")) - if gotPath := req.URL.RequestURI(); gotPath != expectedURL.RequestURI() { - t.Errorf("ExecCreate: Wrong path in request. Want %q. Got %q.", expectedURL.Path, gotPath) - } -} - -func TestExecInspect(t *testing.T) { - jsonExec := `{ - "ID": "32adfeeec34250f9530ce1dafd40c6233832315e065ea6b362d745e2f63cde0e", - "Running": true, - "ExitCode": 0, - "ProcessConfig": { - "privileged": false, - "user": "", - "tty": true, - "entrypoint": "bash", - "arguments": [] - }, - "OpenStdin": true, - "OpenStderr": true, - "OpenStdout": true, - "Container": { - "State": { - "Running": true, - "Paused": false, - "Restarting": false, - "OOMKilled": false, - "Pid": 29392, - "ExitCode": 0, - "Error": "", - "StartedAt": "2015-01-21T17:08:59.634662178Z", - "FinishedAt": "0001-01-01T00:00:00Z" - }, - "ID": "922cd0568714763dc725b24b7c9801016b2a3de68e2a1dc989bf5abf07740521", - "Created": "2015-01-21T17:08:59.46407212Z", - "Path": "/bin/bash", - "Args": [ - "-lc", - "tsuru_unit_agent http://192.168.50.4:8080 689b30e0ab3adce374346de2e72512138e0e8b75 gtest /var/lib/tsuru/start && tail -f /dev/null" - ], - "Config": { - "Hostname": "922cd0568714", - "Domainname": "", - "User": "ubuntu", - "Memory": 0, - "MemorySwap": 0, - "CpuShares": 100, - "Cpuset": "", - "AttachStdin": false, - "AttachStdout": false, - "AttachStderr": false, - "PortSpecs": null, - "ExposedPorts": { - "8888/tcp": {} - }, - "Tty": false, - "OpenStdin": false, - "StdinOnce": false, - "Env": [ - "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - ], - "Cmd": [ - "/bin/bash", - "-lc", - "tsuru_unit_agent http://192.168.50.4:8080 689b30e0ab3adce374346de2e72512138e0e8b75 gtest /var/lib/tsuru/start && tail -f /dev/null" - ], - "Image": "tsuru/app-gtest", - "Volumes": null, - "WorkingDir": "", - "Entrypoint": null, - "NetworkDisabled": false, - "MacAddress": "", - "OnBuild": null - }, - "Image": "a88060b8b54fde0f7168c86742d0ce83b80f3f10925d85c98fdad9ed00bef544", - "NetworkSettings": { - "IPAddress": "172.17.0.8", - "IPPrefixLen": 16, - "MacAddress": "02:42:ac:11:00:08", - "LinkLocalIPv6Address": "fe80::42:acff:fe11:8", - "LinkLocalIPv6PrefixLen": 64, - "GlobalIPv6Address": "", - "GlobalIPv6PrefixLen": 0, - "Gateway": "172.17.42.1", - "IPv6Gateway": "", - "Bridge": "docker0", - "PortMapping": null, - "Ports": { - "8888/tcp": [ - { - "HostIp": "0.0.0.0", - "HostPort": "49156" - } - ] - } - }, - "ResolvConfPath": "/var/lib/docker/containers/922cd0568714763dc725b24b7c9801016b2a3de68e2a1dc989bf5abf07740521/resolv.conf", - "HostnamePath": "/var/lib/docker/containers/922cd0568714763dc725b24b7c9801016b2a3de68e2a1dc989bf5abf07740521/hostname", - "HostsPath": "/var/lib/docker/containers/922cd0568714763dc725b24b7c9801016b2a3de68e2a1dc989bf5abf07740521/hosts", - "Name": "/c7e43b72288ee9d0270a", - "Driver": "aufs", - "ExecDriver": "native-0.2", - "MountLabel": "", - "ProcessLabel": "", - "AppArmorProfile": "", - "RestartCount": 0, - "UpdateDns": false, - "Volumes": {}, - "VolumesRW": {} - } - }` - var expected ExecInspect - err := json.Unmarshal([]byte(jsonExec), &expected) - if err != nil { - t.Fatal(err) - } - fakeRT := &FakeRoundTripper{message: jsonExec, status: http.StatusOK} - client := newTestClient(fakeRT) - expectedID := "32adfeeec34250f9530ce1dafd40c6233832315e065ea6b362d745e2f63cde0e" - execObj, err := client.InspectExec(expectedID) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(*execObj, expected) { - t.Errorf("ExecInspect: Expected %#v. Got %#v.", expected, *execObj) - } - req := fakeRT.requests[0] - if req.Method != "GET" { - t.Errorf("ExecInspect: wrong HTTP method. Want %q. Got %q.", "GET", req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/exec/" + expectedID + "/json")) - if gotPath := fakeRT.requests[0].URL.Path; gotPath != expectedURL.Path { - t.Errorf("ExecInspect: Wrong path in request. Want %q. Got %q.", expectedURL.Path, gotPath) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/entry_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/entry_test.go deleted file mode 100644 index 2b1cc4e1d8..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/entry_test.go +++ /dev/null @@ -1,77 +0,0 @@ -package logrus - -import ( - "bytes" - "fmt" - "testing" - - "github.com/fsouza/go-dockerclient/external/github.com/stretchr/testify/assert" -) - -func TestEntryWithError(t *testing.T) { - - assert := assert.New(t) - - defer func() { - ErrorKey = "error" - }() - - err := fmt.Errorf("kaboom at layer %d", 4711) - - assert.Equal(err, WithError(err).Data["error"]) - - logger := New() - logger.Out = &bytes.Buffer{} - entry := NewEntry(logger) - - assert.Equal(err, entry.WithError(err).Data["error"]) - - ErrorKey = "err" - - assert.Equal(err, entry.WithError(err).Data["err"]) - -} - -func TestEntryPanicln(t *testing.T) { - errBoom := fmt.Errorf("boom time") - - defer func() { - p := recover() - assert.NotNil(t, p) - - switch pVal := p.(type) { - case *Entry: - assert.Equal(t, "kaboom", pVal.Message) - assert.Equal(t, errBoom, pVal.Data["err"]) - default: - t.Fatalf("want type *Entry, got %T: %#v", pVal, pVal) - } - }() - - logger := New() - logger.Out = &bytes.Buffer{} - entry := NewEntry(logger) - entry.WithField("err", errBoom).Panicln("kaboom") -} - -func TestEntryPanicf(t *testing.T) { - errBoom := fmt.Errorf("boom again") - - defer func() { - p := recover() - assert.NotNil(t, p) - - switch pVal := p.(type) { - case *Entry: - assert.Equal(t, "kaboom true", pVal.Message) - assert.Equal(t, errBoom, pVal.Data["err"]) - default: - t.Fatalf("want type *Entry, got %T: %#v", pVal, pVal) - } - }() - - logger := New() - logger.Out = &bytes.Buffer{} - entry := NewEntry(logger) - entry.WithField("err", errBoom).Panicf("kaboom %v", true) -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/formatter_bench_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/formatter_bench_test.go deleted file mode 100644 index c6d290c77f..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/formatter_bench_test.go +++ /dev/null @@ -1,98 +0,0 @@ -package logrus - -import ( - "fmt" - "testing" - "time" -) - -// smallFields is a small size data set for benchmarking -var smallFields = Fields{ - "foo": "bar", - "baz": "qux", - "one": "two", - "three": "four", -} - -// largeFields is a large size data set for benchmarking -var largeFields = Fields{ - "foo": "bar", - "baz": "qux", - "one": "two", - "three": "four", - "five": "six", - "seven": "eight", - "nine": "ten", - "eleven": "twelve", - "thirteen": "fourteen", - "fifteen": "sixteen", - "seventeen": "eighteen", - "nineteen": "twenty", - "a": "b", - "c": "d", - "e": "f", - "g": "h", - "i": "j", - "k": "l", - "m": "n", - "o": "p", - "q": "r", - "s": "t", - "u": "v", - "w": "x", - "y": "z", - "this": "will", - "make": "thirty", - "entries": "yeah", -} - -var errorFields = Fields{ - "foo": fmt.Errorf("bar"), - "baz": fmt.Errorf("qux"), -} - -func BenchmarkErrorTextFormatter(b *testing.B) { - doBenchmark(b, &TextFormatter{DisableColors: true}, errorFields) -} - -func BenchmarkSmallTextFormatter(b *testing.B) { - doBenchmark(b, &TextFormatter{DisableColors: true}, smallFields) -} - -func BenchmarkLargeTextFormatter(b *testing.B) { - doBenchmark(b, &TextFormatter{DisableColors: true}, largeFields) -} - -func BenchmarkSmallColoredTextFormatter(b *testing.B) { - doBenchmark(b, &TextFormatter{ForceColors: true}, smallFields) -} - -func BenchmarkLargeColoredTextFormatter(b *testing.B) { - doBenchmark(b, &TextFormatter{ForceColors: true}, largeFields) -} - -func BenchmarkSmallJSONFormatter(b *testing.B) { - doBenchmark(b, &JSONFormatter{}, smallFields) -} - -func BenchmarkLargeJSONFormatter(b *testing.B) { - doBenchmark(b, &JSONFormatter{}, largeFields) -} - -func doBenchmark(b *testing.B, formatter Formatter, fields Fields) { - entry := &Entry{ - Time: time.Time{}, - Level: InfoLevel, - Message: "message", - Data: fields, - } - var d []byte - var err error - for i := 0; i < b.N; i++ { - d, err = formatter.Format(entry) - if err != nil { - b.Fatal(err) - } - b.SetBytes(int64(len(d))) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/hook_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/hook_test.go deleted file mode 100644 index 938b974956..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/hook_test.go +++ /dev/null @@ -1,122 +0,0 @@ -package logrus - -import ( - "testing" - - "github.com/fsouza/go-dockerclient/external/github.com/stretchr/testify/assert" -) - -type TestHook struct { - Fired bool -} - -func (hook *TestHook) Fire(entry *Entry) error { - hook.Fired = true - return nil -} - -func (hook *TestHook) Levels() []Level { - return []Level{ - DebugLevel, - InfoLevel, - WarnLevel, - ErrorLevel, - FatalLevel, - PanicLevel, - } -} - -func TestHookFires(t *testing.T) { - hook := new(TestHook) - - LogAndAssertJSON(t, func(log *Logger) { - log.Hooks.Add(hook) - assert.Equal(t, hook.Fired, false) - - log.Print("test") - }, func(fields Fields) { - assert.Equal(t, hook.Fired, true) - }) -} - -type ModifyHook struct { -} - -func (hook *ModifyHook) Fire(entry *Entry) error { - entry.Data["wow"] = "whale" - return nil -} - -func (hook *ModifyHook) Levels() []Level { - return []Level{ - DebugLevel, - InfoLevel, - WarnLevel, - ErrorLevel, - FatalLevel, - PanicLevel, - } -} - -func TestHookCanModifyEntry(t *testing.T) { - hook := new(ModifyHook) - - LogAndAssertJSON(t, func(log *Logger) { - log.Hooks.Add(hook) - log.WithField("wow", "elephant").Print("test") - }, func(fields Fields) { - assert.Equal(t, fields["wow"], "whale") - }) -} - -func TestCanFireMultipleHooks(t *testing.T) { - hook1 := new(ModifyHook) - hook2 := new(TestHook) - - LogAndAssertJSON(t, func(log *Logger) { - log.Hooks.Add(hook1) - log.Hooks.Add(hook2) - - log.WithField("wow", "elephant").Print("test") - }, func(fields Fields) { - assert.Equal(t, fields["wow"], "whale") - assert.Equal(t, hook2.Fired, true) - }) -} - -type ErrorHook struct { - Fired bool -} - -func (hook *ErrorHook) Fire(entry *Entry) error { - hook.Fired = true - return nil -} - -func (hook *ErrorHook) Levels() []Level { - return []Level{ - ErrorLevel, - } -} - -func TestErrorHookShouldntFireOnInfo(t *testing.T) { - hook := new(ErrorHook) - - LogAndAssertJSON(t, func(log *Logger) { - log.Hooks.Add(hook) - log.Info("test") - }, func(fields Fields) { - assert.Equal(t, hook.Fired, false) - }) -} - -func TestErrorHookShouldFireOnError(t *testing.T) { - hook := new(ErrorHook) - - LogAndAssertJSON(t, func(log *Logger) { - log.Hooks.Add(hook) - log.Error("test") - }, func(fields Fields) { - assert.Equal(t, hook.Fired, true) - }) -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/json_formatter_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/json_formatter_test.go deleted file mode 100644 index 1d70873254..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/json_formatter_test.go +++ /dev/null @@ -1,120 +0,0 @@ -package logrus - -import ( - "encoding/json" - "errors" - - "testing" -) - -func TestErrorNotLost(t *testing.T) { - formatter := &JSONFormatter{} - - b, err := formatter.Format(WithField("error", errors.New("wild walrus"))) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - - entry := make(map[string]interface{}) - err = json.Unmarshal(b, &entry) - if err != nil { - t.Fatal("Unable to unmarshal formatted entry: ", err) - } - - if entry["error"] != "wild walrus" { - t.Fatal("Error field not set") - } -} - -func TestErrorNotLostOnFieldNotNamedError(t *testing.T) { - formatter := &JSONFormatter{} - - b, err := formatter.Format(WithField("omg", errors.New("wild walrus"))) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - - entry := make(map[string]interface{}) - err = json.Unmarshal(b, &entry) - if err != nil { - t.Fatal("Unable to unmarshal formatted entry: ", err) - } - - if entry["omg"] != "wild walrus" { - t.Fatal("Error field not set") - } -} - -func TestFieldClashWithTime(t *testing.T) { - formatter := &JSONFormatter{} - - b, err := formatter.Format(WithField("time", "right now!")) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - - entry := make(map[string]interface{}) - err = json.Unmarshal(b, &entry) - if err != nil { - t.Fatal("Unable to unmarshal formatted entry: ", err) - } - - if entry["fields.time"] != "right now!" { - t.Fatal("fields.time not set to original time field") - } - - if entry["time"] != "0001-01-01T00:00:00Z" { - t.Fatal("time field not set to current time, was: ", entry["time"]) - } -} - -func TestFieldClashWithMsg(t *testing.T) { - formatter := &JSONFormatter{} - - b, err := formatter.Format(WithField("msg", "something")) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - - entry := make(map[string]interface{}) - err = json.Unmarshal(b, &entry) - if err != nil { - t.Fatal("Unable to unmarshal formatted entry: ", err) - } - - if entry["fields.msg"] != "something" { - t.Fatal("fields.msg not set to original msg field") - } -} - -func TestFieldClashWithLevel(t *testing.T) { - formatter := &JSONFormatter{} - - b, err := formatter.Format(WithField("level", "something")) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - - entry := make(map[string]interface{}) - err = json.Unmarshal(b, &entry) - if err != nil { - t.Fatal("Unable to unmarshal formatted entry: ", err) - } - - if entry["fields.level"] != "something" { - t.Fatal("fields.level not set to original level field") - } -} - -func TestJSONEntryEndsWithNewline(t *testing.T) { - formatter := &JSONFormatter{} - - b, err := formatter.Format(WithField("level", "something")) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - - if b[len(b)-1] != '\n' { - t.Fatal("Expected JSON log entry to end with a newline") - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/logrus_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/logrus_test.go deleted file mode 100644 index e8719b090d..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/logrus_test.go +++ /dev/null @@ -1,301 +0,0 @@ -package logrus - -import ( - "bytes" - "encoding/json" - "strconv" - "strings" - "sync" - "testing" - - "github.com/fsouza/go-dockerclient/external/github.com/stretchr/testify/assert" -) - -func LogAndAssertJSON(t *testing.T, log func(*Logger), assertions func(fields Fields)) { - var buffer bytes.Buffer - var fields Fields - - logger := New() - logger.Out = &buffer - logger.Formatter = new(JSONFormatter) - - log(logger) - - err := json.Unmarshal(buffer.Bytes(), &fields) - assert.Nil(t, err) - - assertions(fields) -} - -func LogAndAssertText(t *testing.T, log func(*Logger), assertions func(fields map[string]string)) { - var buffer bytes.Buffer - - logger := New() - logger.Out = &buffer - logger.Formatter = &TextFormatter{ - DisableColors: true, - } - - log(logger) - - fields := make(map[string]string) - for _, kv := range strings.Split(buffer.String(), " ") { - if !strings.Contains(kv, "=") { - continue - } - kvArr := strings.Split(kv, "=") - key := strings.TrimSpace(kvArr[0]) - val := kvArr[1] - if kvArr[1][0] == '"' { - var err error - val, err = strconv.Unquote(val) - assert.NoError(t, err) - } - fields[key] = val - } - assertions(fields) -} - -func TestPrint(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Print("test") - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "test") - assert.Equal(t, fields["level"], "info") - }) -} - -func TestInfo(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Info("test") - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "test") - assert.Equal(t, fields["level"], "info") - }) -} - -func TestWarn(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Warn("test") - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "test") - assert.Equal(t, fields["level"], "warning") - }) -} - -func TestInfolnShouldAddSpacesBetweenStrings(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Infoln("test", "test") - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "test test") - }) -} - -func TestInfolnShouldAddSpacesBetweenStringAndNonstring(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Infoln("test", 10) - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "test 10") - }) -} - -func TestInfolnShouldAddSpacesBetweenTwoNonStrings(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Infoln(10, 10) - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "10 10") - }) -} - -func TestInfoShouldAddSpacesBetweenTwoNonStrings(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Infoln(10, 10) - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "10 10") - }) -} - -func TestInfoShouldNotAddSpacesBetweenStringAndNonstring(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Info("test", 10) - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "test10") - }) -} - -func TestInfoShouldNotAddSpacesBetweenStrings(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Info("test", "test") - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "testtest") - }) -} - -func TestWithFieldsShouldAllowAssignments(t *testing.T) { - var buffer bytes.Buffer - var fields Fields - - logger := New() - logger.Out = &buffer - logger.Formatter = new(JSONFormatter) - - localLog := logger.WithFields(Fields{ - "key1": "value1", - }) - - localLog.WithField("key2", "value2").Info("test") - err := json.Unmarshal(buffer.Bytes(), &fields) - assert.Nil(t, err) - - assert.Equal(t, "value2", fields["key2"]) - assert.Equal(t, "value1", fields["key1"]) - - buffer = bytes.Buffer{} - fields = Fields{} - localLog.Info("test") - err = json.Unmarshal(buffer.Bytes(), &fields) - assert.Nil(t, err) - - _, ok := fields["key2"] - assert.Equal(t, false, ok) - assert.Equal(t, "value1", fields["key1"]) -} - -func TestUserSuppliedFieldDoesNotOverwriteDefaults(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.WithField("msg", "hello").Info("test") - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "test") - }) -} - -func TestUserSuppliedMsgFieldHasPrefix(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.WithField("msg", "hello").Info("test") - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "test") - assert.Equal(t, fields["fields.msg"], "hello") - }) -} - -func TestUserSuppliedTimeFieldHasPrefix(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.WithField("time", "hello").Info("test") - }, func(fields Fields) { - assert.Equal(t, fields["fields.time"], "hello") - }) -} - -func TestUserSuppliedLevelFieldHasPrefix(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.WithField("level", 1).Info("test") - }, func(fields Fields) { - assert.Equal(t, fields["level"], "info") - assert.Equal(t, fields["fields.level"], 1.0) // JSON has floats only - }) -} - -func TestDefaultFieldsAreNotPrefixed(t *testing.T) { - LogAndAssertText(t, func(log *Logger) { - ll := log.WithField("herp", "derp") - ll.Info("hello") - ll.Info("bye") - }, func(fields map[string]string) { - for _, fieldName := range []string{"fields.level", "fields.time", "fields.msg"} { - if _, ok := fields[fieldName]; ok { - t.Fatalf("should not have prefixed %q: %v", fieldName, fields) - } - } - }) -} - -func TestDoubleLoggingDoesntPrefixPreviousFields(t *testing.T) { - - var buffer bytes.Buffer - var fields Fields - - logger := New() - logger.Out = &buffer - logger.Formatter = new(JSONFormatter) - - llog := logger.WithField("context", "eating raw fish") - - llog.Info("looks delicious") - - err := json.Unmarshal(buffer.Bytes(), &fields) - assert.NoError(t, err, "should have decoded first message") - assert.Equal(t, len(fields), 4, "should only have msg/time/level/context fields") - assert.Equal(t, fields["msg"], "looks delicious") - assert.Equal(t, fields["context"], "eating raw fish") - - buffer.Reset() - - llog.Warn("omg it is!") - - err = json.Unmarshal(buffer.Bytes(), &fields) - assert.NoError(t, err, "should have decoded second message") - assert.Equal(t, len(fields), 4, "should only have msg/time/level/context fields") - assert.Equal(t, fields["msg"], "omg it is!") - assert.Equal(t, fields["context"], "eating raw fish") - assert.Nil(t, fields["fields.msg"], "should not have prefixed previous `msg` entry") - -} - -func TestConvertLevelToString(t *testing.T) { - assert.Equal(t, "debug", DebugLevel.String()) - assert.Equal(t, "info", InfoLevel.String()) - assert.Equal(t, "warning", WarnLevel.String()) - assert.Equal(t, "error", ErrorLevel.String()) - assert.Equal(t, "fatal", FatalLevel.String()) - assert.Equal(t, "panic", PanicLevel.String()) -} - -func TestParseLevel(t *testing.T) { - l, err := ParseLevel("panic") - assert.Nil(t, err) - assert.Equal(t, PanicLevel, l) - - l, err = ParseLevel("fatal") - assert.Nil(t, err) - assert.Equal(t, FatalLevel, l) - - l, err = ParseLevel("error") - assert.Nil(t, err) - assert.Equal(t, ErrorLevel, l) - - l, err = ParseLevel("warn") - assert.Nil(t, err) - assert.Equal(t, WarnLevel, l) - - l, err = ParseLevel("warning") - assert.Nil(t, err) - assert.Equal(t, WarnLevel, l) - - l, err = ParseLevel("info") - assert.Nil(t, err) - assert.Equal(t, InfoLevel, l) - - l, err = ParseLevel("debug") - assert.Nil(t, err) - assert.Equal(t, DebugLevel, l) - - l, err = ParseLevel("invalid") - assert.Equal(t, "not a valid logrus Level: \"invalid\"", err.Error()) -} - -func TestGetSetLevelRace(t *testing.T) { - wg := sync.WaitGroup{} - for i := 0; i < 100; i++ { - wg.Add(1) - go func(i int) { - defer wg.Done() - if i%2 == 0 { - SetLevel(InfoLevel) - } else { - GetLevel() - } - }(i) - - } - wg.Wait() -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/text_formatter_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/text_formatter_test.go deleted file mode 100644 index e25a44f67b..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/text_formatter_test.go +++ /dev/null @@ -1,61 +0,0 @@ -package logrus - -import ( - "bytes" - "errors" - "testing" - "time" -) - -func TestQuoting(t *testing.T) { - tf := &TextFormatter{DisableColors: true} - - checkQuoting := func(q bool, value interface{}) { - b, _ := tf.Format(WithField("test", value)) - idx := bytes.Index(b, ([]byte)("test=")) - cont := bytes.Contains(b[idx+5:], []byte{'"'}) - if cont != q { - if q { - t.Errorf("quoting expected for: %#v", value) - } else { - t.Errorf("quoting not expected for: %#v", value) - } - } - } - - checkQuoting(false, "abcd") - checkQuoting(false, "v1.0") - checkQuoting(false, "1234567890") - checkQuoting(true, "/foobar") - checkQuoting(true, "x y") - checkQuoting(true, "x,y") - checkQuoting(false, errors.New("invalid")) - checkQuoting(true, errors.New("invalid argument")) -} - -func TestTimestampFormat(t *testing.T) { - checkTimeStr := func(format string) { - customFormatter := &TextFormatter{DisableColors: true, TimestampFormat: format} - customStr, _ := customFormatter.Format(WithField("test", "test")) - timeStart := bytes.Index(customStr, ([]byte)("time=")) - timeEnd := bytes.Index(customStr, ([]byte)("level=")) - timeStr := customStr[timeStart+5 : timeEnd-1] - if timeStr[0] == '"' && timeStr[len(timeStr)-1] == '"' { - timeStr = timeStr[1 : len(timeStr)-1] - } - if format == "" { - format = time.RFC3339 - } - _, e := time.Parse(format, (string)(timeStr)) - if e != nil { - t.Errorf("time string \"%s\" did not match provided time format \"%s\": %s", timeStr, format, e) - } - } - - checkTimeStr("2006-01-02T15:04:05.000000000Z07:00") - checkTimeStr("Mon Jan _2 15:04:05 2006") - checkTimeStr("") -} - -// TODO add tests for sorting etc., this requires a parser for the text -// formatter output. diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/envfile_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/envfile_test.go deleted file mode 100644 index a2e2200fa1..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/envfile_test.go +++ /dev/null @@ -1,142 +0,0 @@ -package opts - -import ( - "bufio" - "fmt" - "io/ioutil" - "os" - "reflect" - "strings" - "testing" -) - -func tmpFileWithContent(content string, t *testing.T) string { - tmpFile, err := ioutil.TempFile("", "envfile-test") - if err != nil { - t.Fatal(err) - } - defer tmpFile.Close() - - tmpFile.WriteString(content) - return tmpFile.Name() -} - -// Test ParseEnvFile for a file with a few well formatted lines -func TestParseEnvFileGoodFile(t *testing.T) { - content := `foo=bar - baz=quux -# comment - -_foobar=foobaz -with.dots=working -and_underscore=working too -` - // Adding a newline + a line with pure whitespace. - // This is being done like this instead of the block above - // because it's common for editors to trim trailing whitespace - // from lines, which becomes annoying since that's the - // exact thing we need to test. - content += "\n \t " - tmpFile := tmpFileWithContent(content, t) - defer os.Remove(tmpFile) - - lines, err := ParseEnvFile(tmpFile) - if err != nil { - t.Fatal(err) - } - - expectedLines := []string{ - "foo=bar", - "baz=quux", - "_foobar=foobaz", - "with.dots=working", - "and_underscore=working too", - } - - if !reflect.DeepEqual(lines, expectedLines) { - t.Fatal("lines not equal to expected_lines") - } -} - -// Test ParseEnvFile for an empty file -func TestParseEnvFileEmptyFile(t *testing.T) { - tmpFile := tmpFileWithContent("", t) - defer os.Remove(tmpFile) - - lines, err := ParseEnvFile(tmpFile) - if err != nil { - t.Fatal(err) - } - - if len(lines) != 0 { - t.Fatal("lines not empty; expected empty") - } -} - -// Test ParseEnvFile for a non existent file -func TestParseEnvFileNonExistentFile(t *testing.T) { - _, err := ParseEnvFile("foo_bar_baz") - if err == nil { - t.Fatal("ParseEnvFile succeeded; expected failure") - } - if _, ok := err.(*os.PathError); !ok { - t.Fatalf("Expected a PathError, got [%v]", err) - } -} - -// Test ParseEnvFile for a badly formatted file -func TestParseEnvFileBadlyFormattedFile(t *testing.T) { - content := `foo=bar - f =quux -` - - tmpFile := tmpFileWithContent(content, t) - defer os.Remove(tmpFile) - - _, err := ParseEnvFile(tmpFile) - if err == nil { - t.Fatalf("Expected a ErrBadEnvVariable, got nothing") - } - if _, ok := err.(ErrBadEnvVariable); !ok { - t.Fatalf("Expected a ErrBadEnvVariable, got [%v]", err) - } - expectedMessage := "poorly formatted environment: variable 'f ' has white spaces" - if err.Error() != expectedMessage { - t.Fatalf("Expected [%v], got [%v]", expectedMessage, err.Error()) - } -} - -// Test ParseEnvFile for a file with a line exceeding bufio.MaxScanTokenSize -func TestParseEnvFileLineTooLongFile(t *testing.T) { - content := strings.Repeat("a", bufio.MaxScanTokenSize+42) - content = fmt.Sprint("foo=", content) - - tmpFile := tmpFileWithContent(content, t) - defer os.Remove(tmpFile) - - _, err := ParseEnvFile(tmpFile) - if err == nil { - t.Fatal("ParseEnvFile succeeded; expected failure") - } -} - -// ParseEnvFile with a random file, pass through -func TestParseEnvFileRandomFile(t *testing.T) { - content := `first line -another invalid line` - tmpFile := tmpFileWithContent(content, t) - defer os.Remove(tmpFile) - - _, err := ParseEnvFile(tmpFile) - - if err == nil { - t.Fatalf("Expected a ErrBadEnvVariable, got nothing") - } - if _, ok := err.(ErrBadEnvVariable); !ok { - t.Fatalf("Expected a ErrBadEnvvariable, got [%v]", err) - } - expectedMessage := "poorly formatted environment: variable 'first line' has white spaces" - if err.Error() != expectedMessage { - t.Fatalf("Expected [%v], got [%v]", expectedMessage, err.Error()) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/hosts_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/hosts_test.go deleted file mode 100644 index e497e28656..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/hosts_test.go +++ /dev/null @@ -1,164 +0,0 @@ -package opts - -import ( - "runtime" - "testing" -) - -func TestParseHost(t *testing.T) { - invalid := map[string]string{ - "anything": "Invalid bind address format: anything", - "something with spaces": "Invalid bind address format: something with spaces", - "://": "Invalid bind address format: ://", - "unknown://": "Invalid bind address format: unknown://", - "tcp://:port": "Invalid bind address format: :port", - "tcp://invalid": "Invalid bind address format: invalid", - "tcp://invalid:port": "Invalid bind address format: invalid:port", - } - const defaultHTTPHost = "tcp://127.0.0.1:2375" - var defaultHOST = "unix:///var/run/docker.sock" - - if runtime.GOOS == "windows" { - defaultHOST = defaultHTTPHost - } - valid := map[string]string{ - "": defaultHOST, - "fd://": "fd://", - "fd://something": "fd://something", - "tcp://host:": "tcp://host:2375", - "tcp://": "tcp://localhost:2375", - "tcp://:2375": "tcp://localhost:2375", // default ip address - "tcp://:2376": "tcp://localhost:2376", // default ip address - "tcp://0.0.0.0:8080": "tcp://0.0.0.0:8080", - "tcp://192.168.0.0:12000": "tcp://192.168.0.0:12000", - "tcp://192.168:8080": "tcp://192.168:8080", - "tcp://0.0.0.0:1234567890": "tcp://0.0.0.0:1234567890", // yeah it's valid :P - "tcp://docker.com:2375": "tcp://docker.com:2375", - "unix://": "unix:///var/run/docker.sock", // default unix:// value - "unix://path/to/socket": "unix://path/to/socket", - } - - for value, errorMessage := range invalid { - if _, err := ParseHost(defaultHTTPHost, value); err == nil || err.Error() != errorMessage { - t.Fatalf("Expected an error for %v with [%v], got [%v]", value, errorMessage, err) - } - } - for value, expected := range valid { - if actual, err := ParseHost(defaultHTTPHost, value); err != nil || actual != expected { - t.Fatalf("Expected for %v [%v], got [%v, %v]", value, expected, actual, err) - } - } -} - -func TestParseDockerDaemonHost(t *testing.T) { - var ( - defaultHTTPHost = "tcp://localhost:2375" - defaultHTTPSHost = "tcp://localhost:2376" - defaultUnix = "/var/run/docker.sock" - defaultHOST = "unix:///var/run/docker.sock" - ) - if runtime.GOOS == "windows" { - defaultHOST = defaultHTTPHost - } - invalids := map[string]string{ - "0.0.0.0": "Invalid bind address format: 0.0.0.0", - "tcp:a.b.c.d": "Invalid bind address format: tcp:a.b.c.d", - "tcp:a.b.c.d/path": "Invalid bind address format: tcp:a.b.c.d/path", - "udp://127.0.0.1": "Invalid bind address format: udp://127.0.0.1", - "udp://127.0.0.1:2375": "Invalid bind address format: udp://127.0.0.1:2375", - "tcp://unix:///run/docker.sock": "Invalid bind address format: unix", - "tcp": "Invalid bind address format: tcp", - "unix": "Invalid bind address format: unix", - "fd": "Invalid bind address format: fd", - } - valids := map[string]string{ - "0.0.0.1:": "tcp://0.0.0.1:2375", - "0.0.0.1:5555": "tcp://0.0.0.1:5555", - "0.0.0.1:5555/path": "tcp://0.0.0.1:5555/path", - "[::1]:": "tcp://[::1]:2375", - "[::1]:5555/path": "tcp://[::1]:5555/path", - "[0:0:0:0:0:0:0:1]:": "tcp://[0:0:0:0:0:0:0:1]:2375", - "[0:0:0:0:0:0:0:1]:5555/path": "tcp://[0:0:0:0:0:0:0:1]:5555/path", - ":6666": "tcp://localhost:6666", - ":6666/path": "tcp://localhost:6666/path", - "": defaultHOST, - " ": defaultHOST, - " ": defaultHOST, - "tcp://": defaultHTTPHost, - "tcp://:7777": "tcp://localhost:7777", - "tcp://:7777/path": "tcp://localhost:7777/path", - " tcp://:7777/path ": "tcp://localhost:7777/path", - "unix:///run/docker.sock": "unix:///run/docker.sock", - "unix://": "unix:///var/run/docker.sock", - "fd://": "fd://", - "fd://something": "fd://something", - "localhost:": "tcp://localhost:2375", - "localhost:5555": "tcp://localhost:5555", - "localhost:5555/path": "tcp://localhost:5555/path", - } - for invalidAddr, expectedError := range invalids { - if addr, err := parseDockerDaemonHost(defaultHTTPHost, defaultHTTPSHost, defaultUnix, "", invalidAddr); err == nil || err.Error() != expectedError { - t.Errorf("tcp %v address expected error %v return, got %s and addr %v", invalidAddr, expectedError, err, addr) - } - } - for validAddr, expectedAddr := range valids { - if addr, err := parseDockerDaemonHost(defaultHTTPHost, defaultHTTPSHost, defaultUnix, "", validAddr); err != nil || addr != expectedAddr { - t.Errorf("%v -> expected %v, got (%v) addr (%v)", validAddr, expectedAddr, err, addr) - } - } -} - -func TestParseTCP(t *testing.T) { - var ( - defaultHTTPHost = "tcp://127.0.0.1:2376" - ) - invalids := map[string]string{ - "0.0.0.0": "Invalid bind address format: 0.0.0.0", - "tcp:a.b.c.d": "Invalid bind address format: tcp:a.b.c.d", - "tcp:a.b.c.d/path": "Invalid bind address format: tcp:a.b.c.d/path", - "udp://127.0.0.1": "Invalid proto, expected tcp: udp://127.0.0.1", - "udp://127.0.0.1:2375": "Invalid proto, expected tcp: udp://127.0.0.1:2375", - } - valids := map[string]string{ - "": defaultHTTPHost, - "tcp://": defaultHTTPHost, - "0.0.0.1:": "tcp://0.0.0.1:2376", - "0.0.0.1:5555": "tcp://0.0.0.1:5555", - "0.0.0.1:5555/path": "tcp://0.0.0.1:5555/path", - ":6666": "tcp://127.0.0.1:6666", - ":6666/path": "tcp://127.0.0.1:6666/path", - "tcp://:7777": "tcp://127.0.0.1:7777", - "tcp://:7777/path": "tcp://127.0.0.1:7777/path", - "[::1]:": "tcp://[::1]:2376", - "[::1]:5555": "tcp://[::1]:5555", - "[::1]:5555/path": "tcp://[::1]:5555/path", - "[0:0:0:0:0:0:0:1]:": "tcp://[0:0:0:0:0:0:0:1]:2376", - "[0:0:0:0:0:0:0:1]:5555": "tcp://[0:0:0:0:0:0:0:1]:5555", - "[0:0:0:0:0:0:0:1]:5555/path": "tcp://[0:0:0:0:0:0:0:1]:5555/path", - "localhost:": "tcp://localhost:2376", - "localhost:5555": "tcp://localhost:5555", - "localhost:5555/path": "tcp://localhost:5555/path", - } - for invalidAddr, expectedError := range invalids { - if addr, err := parseTCPAddr(invalidAddr, defaultHTTPHost); err == nil || err.Error() != expectedError { - t.Errorf("tcp %v address expected error %v return, got %s and addr %v", invalidAddr, expectedError, err, addr) - } - } - for validAddr, expectedAddr := range valids { - if addr, err := parseTCPAddr(validAddr, defaultHTTPHost); err != nil || addr != expectedAddr { - t.Errorf("%v -> expected %v, got %v and addr %v", validAddr, expectedAddr, err, addr) - } - } -} - -func TestParseInvalidUnixAddrInvalid(t *testing.T) { - if _, err := parseUnixAddr("tcp://127.0.0.1", "unix:///var/run/docker.sock"); err == nil || err.Error() != "Invalid proto, expected unix: tcp://127.0.0.1" { - t.Fatalf("Expected an error, got %v", err) - } - if _, err := parseUnixAddr("unix://tcp://127.0.0.1", "/var/run/docker.sock"); err == nil || err.Error() != "Invalid proto, expected unix: tcp://127.0.0.1" { - t.Fatalf("Expected an error, got %v", err) - } - if v, err := parseUnixAddr("", "/var/run/docker.sock"); err != nil || v != "unix:///var/run/docker.sock" { - t.Fatalf("Expected an %v, got %v", v, "unix:///var/run/docker.sock") - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/ip_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/ip_test.go deleted file mode 100644 index 1027d84a05..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/ip_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package opts - -import ( - "net" - "testing" -) - -func TestIpOptString(t *testing.T) { - addresses := []string{"", "0.0.0.0"} - var ip net.IP - - for _, address := range addresses { - stringAddress := NewIPOpt(&ip, address).String() - if stringAddress != address { - t.Fatalf("IpOpt string should be `%s`, not `%s`", address, stringAddress) - } - } -} - -func TestNewIpOptInvalidDefaultVal(t *testing.T) { - ip := net.IPv4(127, 0, 0, 1) - defaultVal := "Not an ip" - - ipOpt := NewIPOpt(&ip, defaultVal) - - expected := "127.0.0.1" - if ipOpt.String() != expected { - t.Fatalf("Expected [%v], got [%v]", expected, ipOpt.String()) - } -} - -func TestNewIpOptValidDefaultVal(t *testing.T) { - ip := net.IPv4(127, 0, 0, 1) - defaultVal := "192.168.1.1" - - ipOpt := NewIPOpt(&ip, defaultVal) - - expected := "192.168.1.1" - if ipOpt.String() != expected { - t.Fatalf("Expected [%v], got [%v]", expected, ipOpt.String()) - } -} - -func TestIpOptSetInvalidVal(t *testing.T) { - ip := net.IPv4(127, 0, 0, 1) - ipOpt := &IPOpt{IP: &ip} - - invalidIP := "invalid ip" - expectedError := "invalid ip is not an ip address" - err := ipOpt.Set(invalidIP) - if err == nil || err.Error() != expectedError { - t.Fatalf("Expected an Error with [%v], got [%v]", expectedError, err.Error()) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/opts_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/opts_test.go deleted file mode 100644 index e2af1c11d0..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/opts_test.go +++ /dev/null @@ -1,301 +0,0 @@ -package opts - -import ( - "fmt" - "os" - "strings" - "testing" -) - -func TestValidateIPAddress(t *testing.T) { - if ret, err := ValidateIPAddress(`1.2.3.4`); err != nil || ret == "" { - t.Fatalf("ValidateIPAddress(`1.2.3.4`) got %s %s", ret, err) - } - - if ret, err := ValidateIPAddress(`127.0.0.1`); err != nil || ret == "" { - t.Fatalf("ValidateIPAddress(`127.0.0.1`) got %s %s", ret, err) - } - - if ret, err := ValidateIPAddress(`::1`); err != nil || ret == "" { - t.Fatalf("ValidateIPAddress(`::1`) got %s %s", ret, err) - } - - if ret, err := ValidateIPAddress(`127`); err == nil || ret != "" { - t.Fatalf("ValidateIPAddress(`127`) got %s %s", ret, err) - } - - if ret, err := ValidateIPAddress(`random invalid string`); err == nil || ret != "" { - t.Fatalf("ValidateIPAddress(`random invalid string`) got %s %s", ret, err) - } - -} - -func TestMapOpts(t *testing.T) { - tmpMap := make(map[string]string) - o := NewMapOpts(tmpMap, logOptsValidator) - o.Set("max-size=1") - if o.String() != "map[max-size:1]" { - t.Errorf("%s != [map[max-size:1]", o.String()) - } - - o.Set("max-file=2") - if len(tmpMap) != 2 { - t.Errorf("map length %d != 2", len(tmpMap)) - } - - if tmpMap["max-file"] != "2" { - t.Errorf("max-file = %s != 2", tmpMap["max-file"]) - } - - if tmpMap["max-size"] != "1" { - t.Errorf("max-size = %s != 1", tmpMap["max-size"]) - } - if o.Set("dummy-val=3") == nil { - t.Errorf("validator is not being called") - } -} - -func TestValidateMACAddress(t *testing.T) { - if _, err := ValidateMACAddress(`92:d0:c6:0a:29:33`); err != nil { - t.Fatalf("ValidateMACAddress(`92:d0:c6:0a:29:33`) got %s", err) - } - - if _, err := ValidateMACAddress(`92:d0:c6:0a:33`); err == nil { - t.Fatalf("ValidateMACAddress(`92:d0:c6:0a:33`) succeeded; expected failure on invalid MAC") - } - - if _, err := ValidateMACAddress(`random invalid string`); err == nil { - t.Fatalf("ValidateMACAddress(`random invalid string`) succeeded; expected failure on invalid MAC") - } -} - -func TestListOptsWithoutValidator(t *testing.T) { - o := NewListOpts(nil) - o.Set("foo") - if o.String() != "[foo]" { - t.Errorf("%s != [foo]", o.String()) - } - o.Set("bar") - if o.Len() != 2 { - t.Errorf("%d != 2", o.Len()) - } - o.Set("bar") - if o.Len() != 3 { - t.Errorf("%d != 3", o.Len()) - } - if !o.Get("bar") { - t.Error("o.Get(\"bar\") == false") - } - if o.Get("baz") { - t.Error("o.Get(\"baz\") == true") - } - o.Delete("foo") - if o.String() != "[bar bar]" { - t.Errorf("%s != [bar bar]", o.String()) - } - listOpts := o.GetAll() - if len(listOpts) != 2 || listOpts[0] != "bar" || listOpts[1] != "bar" { - t.Errorf("Expected [[bar bar]], got [%v]", listOpts) - } - mapListOpts := o.GetMap() - if len(mapListOpts) != 1 { - t.Errorf("Expected [map[bar:{}]], got [%v]", mapListOpts) - } - -} - -func TestListOptsWithValidator(t *testing.T) { - // Re-using logOptsvalidator (used by MapOpts) - o := NewListOpts(logOptsValidator) - o.Set("foo") - if o.String() != "[]" { - t.Errorf("%s != []", o.String()) - } - o.Set("foo=bar") - if o.String() != "[]" { - t.Errorf("%s != []", o.String()) - } - o.Set("max-file=2") - if o.Len() != 1 { - t.Errorf("%d != 1", o.Len()) - } - if !o.Get("max-file=2") { - t.Error("o.Get(\"max-file=2\") == false") - } - if o.Get("baz") { - t.Error("o.Get(\"baz\") == true") - } - o.Delete("max-file=2") - if o.String() != "[]" { - t.Errorf("%s != []", o.String()) - } -} - -func TestValidateDNSSearch(t *testing.T) { - valid := []string{ - `.`, - `a`, - `a.`, - `1.foo`, - `17.foo`, - `foo.bar`, - `foo.bar.baz`, - `foo.bar.`, - `foo.bar.baz`, - `foo1.bar2`, - `foo1.bar2.baz`, - `1foo.2bar.`, - `1foo.2bar.baz`, - `foo-1.bar-2`, - `foo-1.bar-2.baz`, - `foo-1.bar-2.`, - `foo-1.bar-2.baz`, - `1-foo.2-bar`, - `1-foo.2-bar.baz`, - `1-foo.2-bar.`, - `1-foo.2-bar.baz`, - } - - invalid := []string{ - ``, - ` `, - ` `, - `17`, - `17.`, - `.17`, - `17-.`, - `17-.foo`, - `.foo`, - `foo-.bar`, - `-foo.bar`, - `foo.bar-`, - `foo.bar-.baz`, - `foo.-bar`, - `foo.-bar.baz`, - `foo.bar.baz.this.should.fail.on.long.name.beause.it.is.longer.thanisshouldbethis.should.fail.on.long.name.beause.it.is.longer.thanisshouldbethis.should.fail.on.long.name.beause.it.is.longer.thanisshouldbethis.should.fail.on.long.name.beause.it.is.longer.thanisshouldbe`, - } - - for _, domain := range valid { - if ret, err := ValidateDNSSearch(domain); err != nil || ret == "" { - t.Fatalf("ValidateDNSSearch(`"+domain+"`) got %s %s", ret, err) - } - } - - for _, domain := range invalid { - if ret, err := ValidateDNSSearch(domain); err == nil || ret != "" { - t.Fatalf("ValidateDNSSearch(`"+domain+"`) got %s %s", ret, err) - } - } -} - -func TestValidateExtraHosts(t *testing.T) { - valid := []string{ - `myhost:192.168.0.1`, - `thathost:10.0.2.1`, - `anipv6host:2003:ab34:e::1`, - `ipv6local:::1`, - } - - invalid := map[string]string{ - `myhost:192.notanipaddress.1`: `invalid IP`, - `thathost-nosemicolon10.0.0.1`: `bad format`, - `anipv6host:::::1`: `invalid IP`, - `ipv6local:::0::`: `invalid IP`, - } - - for _, extrahost := range valid { - if _, err := ValidateExtraHost(extrahost); err != nil { - t.Fatalf("ValidateExtraHost(`"+extrahost+"`) should succeed: error %v", err) - } - } - - for extraHost, expectedError := range invalid { - if _, err := ValidateExtraHost(extraHost); err == nil { - t.Fatalf("ValidateExtraHost(`%q`) should have failed validation", extraHost) - } else { - if !strings.Contains(err.Error(), expectedError) { - t.Fatalf("ValidateExtraHost(`%q`) error should contain %q", extraHost, expectedError) - } - } - } -} - -func TestValidateAttach(t *testing.T) { - valid := []string{ - "stdin", - "stdout", - "stderr", - "STDIN", - "STDOUT", - "STDERR", - } - if _, err := ValidateAttach("invalid"); err == nil { - t.Fatalf("Expected error with [valid streams are STDIN, STDOUT and STDERR], got nothing") - } - - for _, attach := range valid { - value, err := ValidateAttach(attach) - if err != nil { - t.Fatal(err) - } - if value != strings.ToLower(attach) { - t.Fatalf("Expected [%v], got [%v]", attach, value) - } - } -} - -func TestValidateEnv(t *testing.T) { - valids := map[string]string{ - "a": "a", - "something": "something", - "_=a": "_=a", - "env1=value1": "env1=value1", - "_env1=value1": "_env1=value1", - "env2=value2=value3": "env2=value2=value3", - "env3=abc!qwe": "env3=abc!qwe", - "env_4=value 4": "env_4=value 4", - "PATH": fmt.Sprintf("PATH=%v", os.Getenv("PATH")), - "PATH=something": "PATH=something", - "asd!qwe": "asd!qwe", - "1asd": "1asd", - "123": "123", - "some space": "some space", - " some space before": " some space before", - "some space after ": "some space after ", - } - for value, expected := range valids { - actual, err := ValidateEnv(value) - if err != nil { - t.Fatal(err) - } - if actual != expected { - t.Fatalf("Expected [%v], got [%v]", expected, actual) - } - } -} - -func TestValidateLabel(t *testing.T) { - if _, err := ValidateLabel("label"); err == nil || err.Error() != "bad attribute format: label" { - t.Fatalf("Expected an error [bad attribute format: label], go %v", err) - } - if actual, err := ValidateLabel("key1=value1"); err != nil || actual != "key1=value1" { - t.Fatalf("Expected [key1=value1], got [%v,%v]", actual, err) - } - // Validate it's working with more than one = - if actual, err := ValidateLabel("key1=value1=value2"); err != nil { - t.Fatalf("Expected [key1=value1=value2], got [%v,%v]", actual, err) - } - // Validate it's working with one more - if actual, err := ValidateLabel("key1=value1=value2=value3"); err != nil { - t.Fatalf("Expected [key1=value1=value2=value2], got [%v,%v]", actual, err) - } -} - -func logOptsValidator(val string) (string, error) { - allowedKeys := map[string]string{"max-size": "1", "max-file": "2"} - vals := strings.Split(val, "=") - if allowedKeys[vals[0]] != "" { - return val, nil - } - return "", fmt.Errorf("invalid key %s", vals[0]) -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/archive_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/archive_test.go deleted file mode 100644 index 94deff3f49..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/archive_test.go +++ /dev/null @@ -1,1248 +0,0 @@ -package archive - -import ( - "archive/tar" - "bytes" - "fmt" - "io" - "io/ioutil" - "os" - "os/exec" - "path" - "path/filepath" - "strings" - "syscall" - "testing" - "time" - - "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system" -) - -func TestIsArchiveNilHeader(t *testing.T) { - out := IsArchive(nil) - if out { - t.Fatalf("isArchive should return false as nil is not a valid archive header") - } -} - -func TestIsArchiveInvalidHeader(t *testing.T) { - header := []byte{0x00, 0x01, 0x02} - out := IsArchive(header) - if out { - t.Fatalf("isArchive should return false as %s is not a valid archive header", header) - } -} - -func TestIsArchiveBzip2(t *testing.T) { - header := []byte{0x42, 0x5A, 0x68} - out := IsArchive(header) - if !out { - t.Fatalf("isArchive should return true as %s is a bz2 header", header) - } -} - -func TestIsArchive7zip(t *testing.T) { - header := []byte{0x50, 0x4b, 0x03, 0x04} - out := IsArchive(header) - if out { - t.Fatalf("isArchive should return false as %s is a 7z header and it is not supported", header) - } -} - -func TestIsArchivePathDir(t *testing.T) { - cmd := exec.Command("/bin/sh", "-c", "mkdir -p /tmp/archivedir") - output, err := cmd.CombinedOutput() - if err != nil { - t.Fatalf("Fail to create an archive file for test : %s.", output) - } - if IsArchivePath("/tmp/archivedir") { - t.Fatalf("Incorrectly recognised directory as an archive") - } -} - -func TestIsArchivePathInvalidFile(t *testing.T) { - cmd := exec.Command("/bin/sh", "-c", "dd if=/dev/zero bs=1K count=1 of=/tmp/archive && gzip --stdout /tmp/archive > /tmp/archive.gz") - output, err := cmd.CombinedOutput() - if err != nil { - t.Fatalf("Fail to create an archive file for test : %s.", output) - } - if IsArchivePath("/tmp/archive") { - t.Fatalf("Incorrectly recognised invalid tar path as archive") - } - if IsArchivePath("/tmp/archive.gz") { - t.Fatalf("Incorrectly recognised invalid compressed tar path as archive") - } -} - -func TestIsArchivePathTar(t *testing.T) { - cmd := exec.Command("/bin/sh", "-c", "touch /tmp/archivedata && tar -cf /tmp/archive /tmp/archivedata && gzip --stdout /tmp/archive > /tmp/archive.gz") - output, err := cmd.CombinedOutput() - if err != nil { - t.Fatalf("Fail to create an archive file for test : %s.", output) - } - if !IsArchivePath("/tmp/archive") { - t.Fatalf("Did not recognise valid tar path as archive") - } - if !IsArchivePath("/tmp/archive.gz") { - t.Fatalf("Did not recognise valid compressed tar path as archive") - } -} - -func TestDecompressStreamGzip(t *testing.T) { - cmd := exec.Command("/bin/sh", "-c", "touch /tmp/archive && gzip -f /tmp/archive") - output, err := cmd.CombinedOutput() - if err != nil { - t.Fatalf("Fail to create an archive file for test : %s.", output) - } - archive, err := os.Open("/tmp/archive.gz") - _, err = DecompressStream(archive) - if err != nil { - t.Fatalf("Failed to decompress a gzip file.") - } -} - -func TestDecompressStreamBzip2(t *testing.T) { - cmd := exec.Command("/bin/sh", "-c", "touch /tmp/archive && bzip2 -f /tmp/archive") - output, err := cmd.CombinedOutput() - if err != nil { - t.Fatalf("Fail to create an archive file for test : %s.", output) - } - archive, err := os.Open("/tmp/archive.bz2") - _, err = DecompressStream(archive) - if err != nil { - t.Fatalf("Failed to decompress a bzip2 file.") - } -} - -func TestDecompressStreamXz(t *testing.T) { - cmd := exec.Command("/bin/sh", "-c", "touch /tmp/archive && xz -f /tmp/archive") - output, err := cmd.CombinedOutput() - if err != nil { - t.Fatalf("Fail to create an archive file for test : %s.", output) - } - archive, err := os.Open("/tmp/archive.xz") - _, err = DecompressStream(archive) - if err != nil { - t.Fatalf("Failed to decompress a xz file.") - } -} - -func TestCompressStreamXzUnsuported(t *testing.T) { - dest, err := os.Create("/tmp/dest") - if err != nil { - t.Fatalf("Fail to create the destination file") - } - _, err = CompressStream(dest, Xz) - if err == nil { - t.Fatalf("Should fail as xz is unsupported for compression format.") - } -} - -func TestCompressStreamBzip2Unsupported(t *testing.T) { - dest, err := os.Create("/tmp/dest") - if err != nil { - t.Fatalf("Fail to create the destination file") - } - _, err = CompressStream(dest, Xz) - if err == nil { - t.Fatalf("Should fail as xz is unsupported for compression format.") - } -} - -func TestCompressStreamInvalid(t *testing.T) { - dest, err := os.Create("/tmp/dest") - if err != nil { - t.Fatalf("Fail to create the destination file") - } - _, err = CompressStream(dest, -1) - if err == nil { - t.Fatalf("Should fail as xz is unsupported for compression format.") - } -} - -func TestExtensionInvalid(t *testing.T) { - compression := Compression(-1) - output := compression.Extension() - if output != "" { - t.Fatalf("The extension of an invalid compression should be an empty string.") - } -} - -func TestExtensionUncompressed(t *testing.T) { - compression := Uncompressed - output := compression.Extension() - if output != "tar" { - t.Fatalf("The extension of a uncompressed archive should be 'tar'.") - } -} -func TestExtensionBzip2(t *testing.T) { - compression := Bzip2 - output := compression.Extension() - if output != "tar.bz2" { - t.Fatalf("The extension of a bzip2 archive should be 'tar.bz2'") - } -} -func TestExtensionGzip(t *testing.T) { - compression := Gzip - output := compression.Extension() - if output != "tar.gz" { - t.Fatalf("The extension of a bzip2 archive should be 'tar.gz'") - } -} -func TestExtensionXz(t *testing.T) { - compression := Xz - output := compression.Extension() - if output != "tar.xz" { - t.Fatalf("The extension of a bzip2 archive should be 'tar.xz'") - } -} - -func TestCmdStreamLargeStderr(t *testing.T) { - cmd := exec.Command("/bin/sh", "-c", "dd if=/dev/zero bs=1k count=1000 of=/dev/stderr; echo hello") - out, _, err := cmdStream(cmd, nil) - if err != nil { - t.Fatalf("Failed to start command: %s", err) - } - errCh := make(chan error) - go func() { - _, err := io.Copy(ioutil.Discard, out) - errCh <- err - }() - select { - case err := <-errCh: - if err != nil { - t.Fatalf("Command should not have failed (err=%.100s...)", err) - } - case <-time.After(5 * time.Second): - t.Fatalf("Command did not complete in 5 seconds; probable deadlock") - } -} - -func TestCmdStreamBad(t *testing.T) { - badCmd := exec.Command("/bin/sh", "-c", "echo hello; echo >&2 error couldn\\'t reverse the phase pulser; exit 1") - out, _, err := cmdStream(badCmd, nil) - if err != nil { - t.Fatalf("Failed to start command: %s", err) - } - if output, err := ioutil.ReadAll(out); err == nil { - t.Fatalf("Command should have failed") - } else if err.Error() != "exit status 1: error couldn't reverse the phase pulser\n" { - t.Fatalf("Wrong error value (%s)", err) - } else if s := string(output); s != "hello\n" { - t.Fatalf("Command output should be '%s', not '%s'", "hello\\n", output) - } -} - -func TestCmdStreamGood(t *testing.T) { - cmd := exec.Command("/bin/sh", "-c", "echo hello; exit 0") - out, _, err := cmdStream(cmd, nil) - if err != nil { - t.Fatal(err) - } - if output, err := ioutil.ReadAll(out); err != nil { - t.Fatalf("Command should not have failed (err=%s)", err) - } else if s := string(output); s != "hello\n" { - t.Fatalf("Command output should be '%s', not '%s'", "hello\\n", output) - } -} - -func TestUntarPathWithInvalidDest(t *testing.T) { - tempFolder, err := ioutil.TempDir("", "docker-archive-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tempFolder) - invalidDestFolder := path.Join(tempFolder, "invalidDest") - // Create a src file - srcFile := path.Join(tempFolder, "src") - tarFile := path.Join(tempFolder, "src.tar") - os.Create(srcFile) - os.Create(invalidDestFolder) // being a file (not dir) should cause an error - cmd := exec.Command("/bin/sh", "-c", "tar cf "+tarFile+" "+srcFile) - _, err = cmd.CombinedOutput() - if err != nil { - t.Fatal(err) - } - - err = UntarPath(tarFile, invalidDestFolder) - if err == nil { - t.Fatalf("UntarPath with invalid destination path should throw an error.") - } -} - -func TestUntarPathWithInvalidSrc(t *testing.T) { - dest, err := ioutil.TempDir("", "docker-archive-test") - if err != nil { - t.Fatalf("Fail to create the destination file") - } - defer os.RemoveAll(dest) - err = UntarPath("/invalid/path", dest) - if err == nil { - t.Fatalf("UntarPath with invalid src path should throw an error.") - } -} - -func TestUntarPath(t *testing.T) { - tmpFolder, err := ioutil.TempDir("", "docker-archive-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tmpFolder) - srcFile := path.Join(tmpFolder, "src") - tarFile := path.Join(tmpFolder, "src.tar") - os.Create(path.Join(tmpFolder, "src")) - cmd := exec.Command("/bin/sh", "-c", "tar cf "+tarFile+" "+srcFile) - _, err = cmd.CombinedOutput() - if err != nil { - t.Fatal(err) - } - destFolder := path.Join(tmpFolder, "dest") - err = os.MkdirAll(destFolder, 0740) - if err != nil { - t.Fatalf("Fail to create the destination file") - } - err = UntarPath(tarFile, destFolder) - if err != nil { - t.Fatalf("UntarPath shouldn't throw an error, %s.", err) - } - expectedFile := path.Join(destFolder, srcFile) - _, err = os.Stat(expectedFile) - if err != nil { - t.Fatalf("Destination folder should contain the source file but did not.") - } -} - -// Do the same test as above but with the destination as file, it should fail -func TestUntarPathWithDestinationFile(t *testing.T) { - tmpFolder, err := ioutil.TempDir("", "docker-archive-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tmpFolder) - srcFile := path.Join(tmpFolder, "src") - tarFile := path.Join(tmpFolder, "src.tar") - os.Create(path.Join(tmpFolder, "src")) - cmd := exec.Command("/bin/sh", "-c", "tar cf "+tarFile+" "+srcFile) - _, err = cmd.CombinedOutput() - if err != nil { - t.Fatal(err) - } - destFile := path.Join(tmpFolder, "dest") - _, err = os.Create(destFile) - if err != nil { - t.Fatalf("Fail to create the destination file") - } - err = UntarPath(tarFile, destFile) - if err == nil { - t.Fatalf("UntarPath should throw an error if the destination if a file") - } -} - -// Do the same test as above but with the destination folder already exists -// and the destination file is a directory -// It's working, see https://github.com/docker/docker/issues/10040 -func TestUntarPathWithDestinationSrcFileAsFolder(t *testing.T) { - tmpFolder, err := ioutil.TempDir("", "docker-archive-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tmpFolder) - srcFile := path.Join(tmpFolder, "src") - tarFile := path.Join(tmpFolder, "src.tar") - os.Create(srcFile) - cmd := exec.Command("/bin/sh", "-c", "tar cf "+tarFile+" "+srcFile) - _, err = cmd.CombinedOutput() - if err != nil { - t.Fatal(err) - } - destFolder := path.Join(tmpFolder, "dest") - err = os.MkdirAll(destFolder, 0740) - if err != nil { - t.Fatalf("Fail to create the destination folder") - } - // Let's create a folder that will has the same path as the extracted file (from tar) - destSrcFileAsFolder := path.Join(destFolder, srcFile) - err = os.MkdirAll(destSrcFileAsFolder, 0740) - if err != nil { - t.Fatal(err) - } - err = UntarPath(tarFile, destFolder) - if err != nil { - t.Fatalf("UntarPath should throw not throw an error if the extracted file already exists and is a folder") - } -} - -func TestCopyWithTarInvalidSrc(t *testing.T) { - tempFolder, err := ioutil.TempDir("", "docker-archive-test") - if err != nil { - t.Fatal(nil) - } - destFolder := path.Join(tempFolder, "dest") - invalidSrc := path.Join(tempFolder, "doesnotexists") - err = os.MkdirAll(destFolder, 0740) - if err != nil { - t.Fatal(err) - } - err = CopyWithTar(invalidSrc, destFolder) - if err == nil { - t.Fatalf("archiver.CopyWithTar with invalid src path should throw an error.") - } -} - -func TestCopyWithTarInexistentDestWillCreateIt(t *testing.T) { - tempFolder, err := ioutil.TempDir("", "docker-archive-test") - if err != nil { - t.Fatal(nil) - } - srcFolder := path.Join(tempFolder, "src") - inexistentDestFolder := path.Join(tempFolder, "doesnotexists") - err = os.MkdirAll(srcFolder, 0740) - if err != nil { - t.Fatal(err) - } - err = CopyWithTar(srcFolder, inexistentDestFolder) - if err != nil { - t.Fatalf("CopyWithTar with an inexistent folder shouldn't fail.") - } - _, err = os.Stat(inexistentDestFolder) - if err != nil { - t.Fatalf("CopyWithTar with an inexistent folder should create it.") - } -} - -// Test CopyWithTar with a file as src -func TestCopyWithTarSrcFile(t *testing.T) { - folder, err := ioutil.TempDir("", "docker-archive-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(folder) - dest := path.Join(folder, "dest") - srcFolder := path.Join(folder, "src") - src := path.Join(folder, path.Join("src", "src")) - err = os.MkdirAll(srcFolder, 0740) - if err != nil { - t.Fatal(err) - } - err = os.MkdirAll(dest, 0740) - if err != nil { - t.Fatal(err) - } - ioutil.WriteFile(src, []byte("content"), 0777) - err = CopyWithTar(src, dest) - if err != nil { - t.Fatalf("archiver.CopyWithTar shouldn't throw an error, %s.", err) - } - _, err = os.Stat(dest) - // FIXME Check the content - if err != nil { - t.Fatalf("Destination file should be the same as the source.") - } -} - -// Test CopyWithTar with a folder as src -func TestCopyWithTarSrcFolder(t *testing.T) { - folder, err := ioutil.TempDir("", "docker-archive-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(folder) - dest := path.Join(folder, "dest") - src := path.Join(folder, path.Join("src", "folder")) - err = os.MkdirAll(src, 0740) - if err != nil { - t.Fatal(err) - } - err = os.MkdirAll(dest, 0740) - if err != nil { - t.Fatal(err) - } - ioutil.WriteFile(path.Join(src, "file"), []byte("content"), 0777) - err = CopyWithTar(src, dest) - if err != nil { - t.Fatalf("archiver.CopyWithTar shouldn't throw an error, %s.", err) - } - _, err = os.Stat(dest) - // FIXME Check the content (the file inside) - if err != nil { - t.Fatalf("Destination folder should contain the source file but did not.") - } -} - -func TestCopyFileWithTarInvalidSrc(t *testing.T) { - tempFolder, err := ioutil.TempDir("", "docker-archive-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tempFolder) - destFolder := path.Join(tempFolder, "dest") - err = os.MkdirAll(destFolder, 0740) - if err != nil { - t.Fatal(err) - } - invalidFile := path.Join(tempFolder, "doesnotexists") - err = CopyFileWithTar(invalidFile, destFolder) - if err == nil { - t.Fatalf("archiver.CopyWithTar with invalid src path should throw an error.") - } -} - -func TestCopyFileWithTarInexistentDestWillCreateIt(t *testing.T) { - tempFolder, err := ioutil.TempDir("", "docker-archive-test") - if err != nil { - t.Fatal(nil) - } - defer os.RemoveAll(tempFolder) - srcFile := path.Join(tempFolder, "src") - inexistentDestFolder := path.Join(tempFolder, "doesnotexists") - _, err = os.Create(srcFile) - if err != nil { - t.Fatal(err) - } - err = CopyFileWithTar(srcFile, inexistentDestFolder) - if err != nil { - t.Fatalf("CopyWithTar with an inexistent folder shouldn't fail.") - } - _, err = os.Stat(inexistentDestFolder) - if err != nil { - t.Fatalf("CopyWithTar with an inexistent folder should create it.") - } - // FIXME Test the src file and content -} - -func TestCopyFileWithTarSrcFolder(t *testing.T) { - folder, err := ioutil.TempDir("", "docker-archive-copyfilewithtar-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(folder) - dest := path.Join(folder, "dest") - src := path.Join(folder, "srcfolder") - err = os.MkdirAll(src, 0740) - if err != nil { - t.Fatal(err) - } - err = os.MkdirAll(dest, 0740) - if err != nil { - t.Fatal(err) - } - err = CopyFileWithTar(src, dest) - if err == nil { - t.Fatalf("CopyFileWithTar should throw an error with a folder.") - } -} - -func TestCopyFileWithTarSrcFile(t *testing.T) { - folder, err := ioutil.TempDir("", "docker-archive-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(folder) - dest := path.Join(folder, "dest") - srcFolder := path.Join(folder, "src") - src := path.Join(folder, path.Join("src", "src")) - err = os.MkdirAll(srcFolder, 0740) - if err != nil { - t.Fatal(err) - } - err = os.MkdirAll(dest, 0740) - if err != nil { - t.Fatal(err) - } - ioutil.WriteFile(src, []byte("content"), 0777) - err = CopyWithTar(src, dest+"/") - if err != nil { - t.Fatalf("archiver.CopyFileWithTar shouldn't throw an error, %s.", err) - } - _, err = os.Stat(dest) - if err != nil { - t.Fatalf("Destination folder should contain the source file but did not.") - } -} - -func TestTarFiles(t *testing.T) { - // try without hardlinks - if err := checkNoChanges(1000, false); err != nil { - t.Fatal(err) - } - // try with hardlinks - if err := checkNoChanges(1000, true); err != nil { - t.Fatal(err) - } -} - -func checkNoChanges(fileNum int, hardlinks bool) error { - srcDir, err := ioutil.TempDir("", "docker-test-srcDir") - if err != nil { - return err - } - defer os.RemoveAll(srcDir) - - destDir, err := ioutil.TempDir("", "docker-test-destDir") - if err != nil { - return err - } - defer os.RemoveAll(destDir) - - _, err = prepareUntarSourceDirectory(fileNum, srcDir, hardlinks) - if err != nil { - return err - } - - err = TarUntar(srcDir, destDir) - if err != nil { - return err - } - - changes, err := ChangesDirs(destDir, srcDir) - if err != nil { - return err - } - if len(changes) > 0 { - return fmt.Errorf("with %d files and %v hardlinks: expected 0 changes, got %d", fileNum, hardlinks, len(changes)) - } - return nil -} - -func tarUntar(t *testing.T, origin string, options *TarOptions) ([]Change, error) { - archive, err := TarWithOptions(origin, options) - if err != nil { - t.Fatal(err) - } - defer archive.Close() - - buf := make([]byte, 10) - if _, err := archive.Read(buf); err != nil { - return nil, err - } - wrap := io.MultiReader(bytes.NewReader(buf), archive) - - detectedCompression := DetectCompression(buf) - compression := options.Compression - if detectedCompression.Extension() != compression.Extension() { - return nil, fmt.Errorf("Wrong compression detected. Actual compression: %s, found %s", compression.Extension(), detectedCompression.Extension()) - } - - tmp, err := ioutil.TempDir("", "docker-test-untar") - if err != nil { - return nil, err - } - defer os.RemoveAll(tmp) - if err := Untar(wrap, tmp, nil); err != nil { - return nil, err - } - if _, err := os.Stat(tmp); err != nil { - return nil, err - } - - return ChangesDirs(origin, tmp) -} - -func TestTarUntar(t *testing.T) { - origin, err := ioutil.TempDir("", "docker-test-untar-origin") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(origin) - if err := ioutil.WriteFile(path.Join(origin, "1"), []byte("hello world"), 0700); err != nil { - t.Fatal(err) - } - if err := ioutil.WriteFile(path.Join(origin, "2"), []byte("welcome!"), 0700); err != nil { - t.Fatal(err) - } - if err := ioutil.WriteFile(path.Join(origin, "3"), []byte("will be ignored"), 0700); err != nil { - t.Fatal(err) - } - - for _, c := range []Compression{ - Uncompressed, - Gzip, - } { - changes, err := tarUntar(t, origin, &TarOptions{ - Compression: c, - ExcludePatterns: []string{"3"}, - }) - - if err != nil { - t.Fatalf("Error tar/untar for compression %s: %s", c.Extension(), err) - } - - if len(changes) != 1 || changes[0].Path != "/3" { - t.Fatalf("Unexpected differences after tarUntar: %v", changes) - } - } -} - -func TestTarUntarWithXattr(t *testing.T) { - origin, err := ioutil.TempDir("", "docker-test-untar-origin") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(origin) - if err := ioutil.WriteFile(path.Join(origin, "1"), []byte("hello world"), 0700); err != nil { - t.Fatal(err) - } - if err := ioutil.WriteFile(path.Join(origin, "2"), []byte("welcome!"), 0700); err != nil { - t.Fatal(err) - } - if err := ioutil.WriteFile(path.Join(origin, "3"), []byte("will be ignored"), 0700); err != nil { - t.Fatal(err) - } - if err := system.Lsetxattr(path.Join(origin, "2"), "security.capability", []byte{0x00}, 0); err != nil { - t.Fatal(err) - } - - for _, c := range []Compression{ - Uncompressed, - Gzip, - } { - changes, err := tarUntar(t, origin, &TarOptions{ - Compression: c, - ExcludePatterns: []string{"3"}, - }) - - if err != nil { - t.Fatalf("Error tar/untar for compression %s: %s", c.Extension(), err) - } - - if len(changes) != 1 || changes[0].Path != "/3" { - t.Fatalf("Unexpected differences after tarUntar: %v", changes) - } - capability, _ := system.Lgetxattr(path.Join(origin, "2"), "security.capability") - if capability == nil && capability[0] != 0x00 { - t.Fatalf("Untar should have kept the 'security.capability' xattr.") - } - } -} - -func TestTarWithOptions(t *testing.T) { - origin, err := ioutil.TempDir("", "docker-test-untar-origin") - if err != nil { - t.Fatal(err) - } - if _, err := ioutil.TempDir(origin, "folder"); err != nil { - t.Fatal(err) - } - defer os.RemoveAll(origin) - if err := ioutil.WriteFile(path.Join(origin, "1"), []byte("hello world"), 0700); err != nil { - t.Fatal(err) - } - if err := ioutil.WriteFile(path.Join(origin, "2"), []byte("welcome!"), 0700); err != nil { - t.Fatal(err) - } - - cases := []struct { - opts *TarOptions - numChanges int - }{ - {&TarOptions{IncludeFiles: []string{"1"}}, 2}, - {&TarOptions{ExcludePatterns: []string{"2"}}, 1}, - {&TarOptions{ExcludePatterns: []string{"1", "folder*"}}, 2}, - {&TarOptions{IncludeFiles: []string{"1", "1"}}, 2}, - {&TarOptions{IncludeFiles: []string{"1"}, RebaseNames: map[string]string{"1": "test"}}, 4}, - } - for _, testCase := range cases { - changes, err := tarUntar(t, origin, testCase.opts) - if err != nil { - t.Fatalf("Error tar/untar when testing inclusion/exclusion: %s", err) - } - if len(changes) != testCase.numChanges { - t.Errorf("Expected %d changes, got %d for %+v:", - testCase.numChanges, len(changes), testCase.opts) - } - } -} - -// Some tar archives such as http://haproxy.1wt.eu/download/1.5/src/devel/haproxy-1.5-dev21.tar.gz -// use PAX Global Extended Headers. -// Failing prevents the archives from being uncompressed during ADD -func TestTypeXGlobalHeaderDoesNotFail(t *testing.T) { - hdr := tar.Header{Typeflag: tar.TypeXGlobalHeader} - tmpDir, err := ioutil.TempDir("", "docker-test-archive-pax-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tmpDir) - err = createTarFile(filepath.Join(tmpDir, "pax_global_header"), tmpDir, &hdr, nil, true, nil) - if err != nil { - t.Fatal(err) - } -} - -// Some tar have both GNU specific (huge uid) and Ustar specific (long name) things. -// Not supposed to happen (should use PAX instead of Ustar for long name) but it does and it should still work. -func TestUntarUstarGnuConflict(t *testing.T) { - f, err := os.Open("testdata/broken.tar") - if err != nil { - t.Fatal(err) - } - found := false - tr := tar.NewReader(f) - // Iterate through the files in the archive. - for { - hdr, err := tr.Next() - if err == io.EOF { - // end of tar archive - break - } - if err != nil { - t.Fatal(err) - } - if hdr.Name == "root/.cpanm/work/1395823785.24209/Plack-1.0030/blib/man3/Plack::Middleware::LighttpdScriptNameFix.3pm" { - found = true - break - } - } - if !found { - t.Fatalf("%s not found in the archive", "root/.cpanm/work/1395823785.24209/Plack-1.0030/blib/man3/Plack::Middleware::LighttpdScriptNameFix.3pm") - } -} - -func TestTarWithBlockCharFifo(t *testing.T) { - origin, err := ioutil.TempDir("", "docker-test-tar-hardlink") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(origin) - if err := ioutil.WriteFile(path.Join(origin, "1"), []byte("hello world"), 0700); err != nil { - t.Fatal(err) - } - if err := system.Mknod(path.Join(origin, "2"), syscall.S_IFBLK, int(system.Mkdev(int64(12), int64(5)))); err != nil { - t.Fatal(err) - } - if err := system.Mknod(path.Join(origin, "3"), syscall.S_IFCHR, int(system.Mkdev(int64(12), int64(5)))); err != nil { - t.Fatal(err) - } - if err := system.Mknod(path.Join(origin, "4"), syscall.S_IFIFO, int(system.Mkdev(int64(12), int64(5)))); err != nil { - t.Fatal(err) - } - - dest, err := ioutil.TempDir("", "docker-test-tar-hardlink-dest") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(dest) - - // we'll do this in two steps to separate failure - fh, err := Tar(origin, Uncompressed) - if err != nil { - t.Fatal(err) - } - - // ensure we can read the whole thing with no error, before writing back out - buf, err := ioutil.ReadAll(fh) - if err != nil { - t.Fatal(err) - } - - bRdr := bytes.NewReader(buf) - err = Untar(bRdr, dest, &TarOptions{Compression: Uncompressed}) - if err != nil { - t.Fatal(err) - } - - changes, err := ChangesDirs(origin, dest) - if err != nil { - t.Fatal(err) - } - if len(changes) > 0 { - t.Fatalf("Tar with special device (block, char, fifo) should keep them (recreate them when untar) : %v", changes) - } -} - -func TestTarWithHardLink(t *testing.T) { - origin, err := ioutil.TempDir("", "docker-test-tar-hardlink") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(origin) - if err := ioutil.WriteFile(path.Join(origin, "1"), []byte("hello world"), 0700); err != nil { - t.Fatal(err) - } - if err := os.Link(path.Join(origin, "1"), path.Join(origin, "2")); err != nil { - t.Fatal(err) - } - - var i1, i2 uint64 - if i1, err = getNlink(path.Join(origin, "1")); err != nil { - t.Fatal(err) - } - // sanity check that we can hardlink - if i1 != 2 { - t.Skipf("skipping since hardlinks don't work here; expected 2 links, got %d", i1) - } - - dest, err := ioutil.TempDir("", "docker-test-tar-hardlink-dest") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(dest) - - // we'll do this in two steps to separate failure - fh, err := Tar(origin, Uncompressed) - if err != nil { - t.Fatal(err) - } - - // ensure we can read the whole thing with no error, before writing back out - buf, err := ioutil.ReadAll(fh) - if err != nil { - t.Fatal(err) - } - - bRdr := bytes.NewReader(buf) - err = Untar(bRdr, dest, &TarOptions{Compression: Uncompressed}) - if err != nil { - t.Fatal(err) - } - - if i1, err = getInode(path.Join(dest, "1")); err != nil { - t.Fatal(err) - } - if i2, err = getInode(path.Join(dest, "2")); err != nil { - t.Fatal(err) - } - - if i1 != i2 { - t.Errorf("expected matching inodes, but got %d and %d", i1, i2) - } -} - -func getNlink(path string) (uint64, error) { - stat, err := os.Stat(path) - if err != nil { - return 0, err - } - statT, ok := stat.Sys().(*syscall.Stat_t) - if !ok { - return 0, fmt.Errorf("expected type *syscall.Stat_t, got %t", stat.Sys()) - } - // We need this conversion on ARM64 - return uint64(statT.Nlink), nil -} - -func getInode(path string) (uint64, error) { - stat, err := os.Stat(path) - if err != nil { - return 0, err - } - statT, ok := stat.Sys().(*syscall.Stat_t) - if !ok { - return 0, fmt.Errorf("expected type *syscall.Stat_t, got %t", stat.Sys()) - } - return statT.Ino, nil -} - -func prepareUntarSourceDirectory(numberOfFiles int, targetPath string, makeLinks bool) (int, error) { - fileData := []byte("fooo") - for n := 0; n < numberOfFiles; n++ { - fileName := fmt.Sprintf("file-%d", n) - if err := ioutil.WriteFile(path.Join(targetPath, fileName), fileData, 0700); err != nil { - return 0, err - } - if makeLinks { - if err := os.Link(path.Join(targetPath, fileName), path.Join(targetPath, fileName+"-link")); err != nil { - return 0, err - } - } - } - totalSize := numberOfFiles * len(fileData) - return totalSize, nil -} - -func BenchmarkTarUntar(b *testing.B) { - origin, err := ioutil.TempDir("", "docker-test-untar-origin") - if err != nil { - b.Fatal(err) - } - tempDir, err := ioutil.TempDir("", "docker-test-untar-destination") - if err != nil { - b.Fatal(err) - } - target := path.Join(tempDir, "dest") - n, err := prepareUntarSourceDirectory(100, origin, false) - if err != nil { - b.Fatal(err) - } - defer os.RemoveAll(origin) - defer os.RemoveAll(tempDir) - - b.ResetTimer() - b.SetBytes(int64(n)) - for n := 0; n < b.N; n++ { - err := TarUntar(origin, target) - if err != nil { - b.Fatal(err) - } - os.RemoveAll(target) - } -} - -func BenchmarkTarUntarWithLinks(b *testing.B) { - origin, err := ioutil.TempDir("", "docker-test-untar-origin") - if err != nil { - b.Fatal(err) - } - tempDir, err := ioutil.TempDir("", "docker-test-untar-destination") - if err != nil { - b.Fatal(err) - } - target := path.Join(tempDir, "dest") - n, err := prepareUntarSourceDirectory(100, origin, true) - if err != nil { - b.Fatal(err) - } - defer os.RemoveAll(origin) - defer os.RemoveAll(tempDir) - - b.ResetTimer() - b.SetBytes(int64(n)) - for n := 0; n < b.N; n++ { - err := TarUntar(origin, target) - if err != nil { - b.Fatal(err) - } - os.RemoveAll(target) - } -} - -func TestUntarInvalidFilenames(t *testing.T) { - for i, headers := range [][]*tar.Header{ - { - { - Name: "../victim/dotdot", - Typeflag: tar.TypeReg, - Mode: 0644, - }, - }, - { - { - // Note the leading slash - Name: "/../victim/slash-dotdot", - Typeflag: tar.TypeReg, - Mode: 0644, - }, - }, - } { - if err := testBreakout("untar", "docker-TestUntarInvalidFilenames", headers); err != nil { - t.Fatalf("i=%d. %v", i, err) - } - } -} - -func TestUntarHardlinkToSymlink(t *testing.T) { - for i, headers := range [][]*tar.Header{ - { - { - Name: "symlink1", - Typeflag: tar.TypeSymlink, - Linkname: "regfile", - Mode: 0644, - }, - { - Name: "symlink2", - Typeflag: tar.TypeLink, - Linkname: "symlink1", - Mode: 0644, - }, - { - Name: "regfile", - Typeflag: tar.TypeReg, - Mode: 0644, - }, - }, - } { - if err := testBreakout("untar", "docker-TestUntarHardlinkToSymlink", headers); err != nil { - t.Fatalf("i=%d. %v", i, err) - } - } -} - -func TestUntarInvalidHardlink(t *testing.T) { - for i, headers := range [][]*tar.Header{ - { // try reading victim/hello (../) - { - Name: "dotdot", - Typeflag: tar.TypeLink, - Linkname: "../victim/hello", - Mode: 0644, - }, - }, - { // try reading victim/hello (/../) - { - Name: "slash-dotdot", - Typeflag: tar.TypeLink, - // Note the leading slash - Linkname: "/../victim/hello", - Mode: 0644, - }, - }, - { // try writing victim/file - { - Name: "loophole-victim", - Typeflag: tar.TypeLink, - Linkname: "../victim", - Mode: 0755, - }, - { - Name: "loophole-victim/file", - Typeflag: tar.TypeReg, - Mode: 0644, - }, - }, - { // try reading victim/hello (hardlink, symlink) - { - Name: "loophole-victim", - Typeflag: tar.TypeLink, - Linkname: "../victim", - Mode: 0755, - }, - { - Name: "symlink", - Typeflag: tar.TypeSymlink, - Linkname: "loophole-victim/hello", - Mode: 0644, - }, - }, - { // Try reading victim/hello (hardlink, hardlink) - { - Name: "loophole-victim", - Typeflag: tar.TypeLink, - Linkname: "../victim", - Mode: 0755, - }, - { - Name: "hardlink", - Typeflag: tar.TypeLink, - Linkname: "loophole-victim/hello", - Mode: 0644, - }, - }, - { // Try removing victim directory (hardlink) - { - Name: "loophole-victim", - Typeflag: tar.TypeLink, - Linkname: "../victim", - Mode: 0755, - }, - { - Name: "loophole-victim", - Typeflag: tar.TypeReg, - Mode: 0644, - }, - }, - } { - if err := testBreakout("untar", "docker-TestUntarInvalidHardlink", headers); err != nil { - t.Fatalf("i=%d. %v", i, err) - } - } -} - -func TestUntarInvalidSymlink(t *testing.T) { - for i, headers := range [][]*tar.Header{ - { // try reading victim/hello (../) - { - Name: "dotdot", - Typeflag: tar.TypeSymlink, - Linkname: "../victim/hello", - Mode: 0644, - }, - }, - { // try reading victim/hello (/../) - { - Name: "slash-dotdot", - Typeflag: tar.TypeSymlink, - // Note the leading slash - Linkname: "/../victim/hello", - Mode: 0644, - }, - }, - { // try writing victim/file - { - Name: "loophole-victim", - Typeflag: tar.TypeSymlink, - Linkname: "../victim", - Mode: 0755, - }, - { - Name: "loophole-victim/file", - Typeflag: tar.TypeReg, - Mode: 0644, - }, - }, - { // try reading victim/hello (symlink, symlink) - { - Name: "loophole-victim", - Typeflag: tar.TypeSymlink, - Linkname: "../victim", - Mode: 0755, - }, - { - Name: "symlink", - Typeflag: tar.TypeSymlink, - Linkname: "loophole-victim/hello", - Mode: 0644, - }, - }, - { // try reading victim/hello (symlink, hardlink) - { - Name: "loophole-victim", - Typeflag: tar.TypeSymlink, - Linkname: "../victim", - Mode: 0755, - }, - { - Name: "hardlink", - Typeflag: tar.TypeLink, - Linkname: "loophole-victim/hello", - Mode: 0644, - }, - }, - { // try removing victim directory (symlink) - { - Name: "loophole-victim", - Typeflag: tar.TypeSymlink, - Linkname: "../victim", - Mode: 0755, - }, - { - Name: "loophole-victim", - Typeflag: tar.TypeReg, - Mode: 0644, - }, - }, - { // try writing to victim/newdir/newfile with a symlink in the path - { - // this header needs to be before the next one, or else there is an error - Name: "dir/loophole", - Typeflag: tar.TypeSymlink, - Linkname: "../../victim", - Mode: 0755, - }, - { - Name: "dir/loophole/newdir/newfile", - Typeflag: tar.TypeReg, - Mode: 0644, - }, - }, - } { - if err := testBreakout("untar", "docker-TestUntarInvalidSymlink", headers); err != nil { - t.Fatalf("i=%d. %v", i, err) - } - } -} - -func TestTempArchiveCloseMultipleTimes(t *testing.T) { - reader := ioutil.NopCloser(strings.NewReader("hello")) - tempArchive, err := NewTempArchive(reader, "") - buf := make([]byte, 10) - n, err := tempArchive.Read(buf) - if n != 5 { - t.Fatalf("Expected to read 5 bytes. Read %d instead", n) - } - for i := 0; i < 3; i++ { - if err = tempArchive.Close(); err != nil { - t.Fatalf("i=%d. Unexpected error closing temp archive: %v", i, err) - } - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/archive_unix_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/archive_unix_test.go deleted file mode 100644 index 18f45c480f..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/archive_unix_test.go +++ /dev/null @@ -1,60 +0,0 @@ -// +build !windows - -package archive - -import ( - "os" - "testing" -) - -func TestCanonicalTarNameForPath(t *testing.T) { - cases := []struct{ in, expected string }{ - {"foo", "foo"}, - {"foo/bar", "foo/bar"}, - {"foo/dir/", "foo/dir/"}, - } - for _, v := range cases { - if out, err := CanonicalTarNameForPath(v.in); err != nil { - t.Fatalf("cannot get canonical name for path: %s: %v", v.in, err) - } else if out != v.expected { - t.Fatalf("wrong canonical tar name. expected:%s got:%s", v.expected, out) - } - } -} - -func TestCanonicalTarName(t *testing.T) { - cases := []struct { - in string - isDir bool - expected string - }{ - {"foo", false, "foo"}, - {"foo", true, "foo/"}, - {"foo/bar", false, "foo/bar"}, - {"foo/bar", true, "foo/bar/"}, - } - for _, v := range cases { - if out, err := canonicalTarName(v.in, v.isDir); err != nil { - t.Fatalf("cannot get canonical name for path: %s: %v", v.in, err) - } else if out != v.expected { - t.Fatalf("wrong canonical tar name. expected:%s got:%s", v.expected, out) - } - } -} - -func TestChmodTarEntry(t *testing.T) { - cases := []struct { - in, expected os.FileMode - }{ - {0000, 0000}, - {0777, 0777}, - {0644, 0644}, - {0755, 0755}, - {0444, 0444}, - } - for _, v := range cases { - if out := chmodTarEntry(v.in); out != v.expected { - t.Fatalf("wrong chmod. expected:%v got:%v", v.expected, out) - } - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/archive_windows_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/archive_windows_test.go deleted file mode 100644 index b7abc40223..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/archive_windows_test.go +++ /dev/null @@ -1,87 +0,0 @@ -// +build windows - -package archive - -import ( - "io/ioutil" - "os" - "path/filepath" - "testing" -) - -func TestCopyFileWithInvalidDest(t *testing.T) { - folder, err := ioutil.TempDir("", "docker-archive-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(folder) - dest := "c:dest" - srcFolder := filepath.Join(folder, "src") - src := filepath.Join(folder, "src", "src") - err = os.MkdirAll(srcFolder, 0740) - if err != nil { - t.Fatal(err) - } - ioutil.WriteFile(src, []byte("content"), 0777) - err = CopyWithTar(src, dest) - if err == nil { - t.Fatalf("archiver.CopyWithTar should throw an error on invalid dest.") - } -} - -func TestCanonicalTarNameForPath(t *testing.T) { - cases := []struct { - in, expected string - shouldFail bool - }{ - {"foo", "foo", false}, - {"foo/bar", "___", true}, // unix-styled windows path must fail - {`foo\bar`, "foo/bar", false}, - } - for _, v := range cases { - if out, err := CanonicalTarNameForPath(v.in); err != nil && !v.shouldFail { - t.Fatalf("cannot get canonical name for path: %s: %v", v.in, err) - } else if v.shouldFail && err == nil { - t.Fatalf("canonical path call should have failed with error. in=%s out=%s", v.in, out) - } else if !v.shouldFail && out != v.expected { - t.Fatalf("wrong canonical tar name. expected:%s got:%s", v.expected, out) - } - } -} - -func TestCanonicalTarName(t *testing.T) { - cases := []struct { - in string - isDir bool - expected string - }{ - {"foo", false, "foo"}, - {"foo", true, "foo/"}, - {`foo\bar`, false, "foo/bar"}, - {`foo\bar`, true, "foo/bar/"}, - } - for _, v := range cases { - if out, err := canonicalTarName(v.in, v.isDir); err != nil { - t.Fatalf("cannot get canonical name for path: %s: %v", v.in, err) - } else if out != v.expected { - t.Fatalf("wrong canonical tar name. expected:%s got:%s", v.expected, out) - } - } -} - -func TestChmodTarEntry(t *testing.T) { - cases := []struct { - in, expected os.FileMode - }{ - {0000, 0111}, - {0777, 0755}, - {0644, 0755}, - {0755, 0755}, - {0444, 0555}, - } - for _, v := range cases { - if out := chmodTarEntry(v.in); out != v.expected { - t.Fatalf("wrong chmod. expected:%v got:%v", v.expected, out) - } - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/changes_posix_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/changes_posix_test.go deleted file mode 100644 index 5a3282b5a8..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/changes_posix_test.go +++ /dev/null @@ -1,127 +0,0 @@ -package archive - -import ( - "archive/tar" - "fmt" - "io" - "io/ioutil" - "os" - "path" - "sort" - "testing" -) - -func TestHardLinkOrder(t *testing.T) { - names := []string{"file1.txt", "file2.txt", "file3.txt"} - msg := []byte("Hey y'all") - - // Create dir - src, err := ioutil.TempDir("", "docker-hardlink-test-src-") - if err != nil { - t.Fatal(err) - } - //defer os.RemoveAll(src) - for _, name := range names { - func() { - fh, err := os.Create(path.Join(src, name)) - if err != nil { - t.Fatal(err) - } - defer fh.Close() - if _, err = fh.Write(msg); err != nil { - t.Fatal(err) - } - }() - } - // Create dest, with changes that includes hardlinks - dest, err := ioutil.TempDir("", "docker-hardlink-test-dest-") - if err != nil { - t.Fatal(err) - } - os.RemoveAll(dest) // we just want the name, at first - if err := copyDir(src, dest); err != nil { - t.Fatal(err) - } - defer os.RemoveAll(dest) - for _, name := range names { - for i := 0; i < 5; i++ { - if err := os.Link(path.Join(dest, name), path.Join(dest, fmt.Sprintf("%s.link%d", name, i))); err != nil { - t.Fatal(err) - } - } - } - - // get changes - changes, err := ChangesDirs(dest, src) - if err != nil { - t.Fatal(err) - } - - // sort - sort.Sort(changesByPath(changes)) - - // ExportChanges - ar, err := ExportChanges(dest, changes, nil, nil) - if err != nil { - t.Fatal(err) - } - hdrs, err := walkHeaders(ar) - if err != nil { - t.Fatal(err) - } - - // reverse sort - sort.Sort(sort.Reverse(changesByPath(changes))) - // ExportChanges - arRev, err := ExportChanges(dest, changes, nil, nil) - if err != nil { - t.Fatal(err) - } - hdrsRev, err := walkHeaders(arRev) - if err != nil { - t.Fatal(err) - } - - // line up the two sets - sort.Sort(tarHeaders(hdrs)) - sort.Sort(tarHeaders(hdrsRev)) - - // compare Size and LinkName - for i := range hdrs { - if hdrs[i].Name != hdrsRev[i].Name { - t.Errorf("headers - expected name %q; but got %q", hdrs[i].Name, hdrsRev[i].Name) - } - if hdrs[i].Size != hdrsRev[i].Size { - t.Errorf("headers - %q expected size %d; but got %d", hdrs[i].Name, hdrs[i].Size, hdrsRev[i].Size) - } - if hdrs[i].Typeflag != hdrsRev[i].Typeflag { - t.Errorf("headers - %q expected type %d; but got %d", hdrs[i].Name, hdrs[i].Typeflag, hdrsRev[i].Typeflag) - } - if hdrs[i].Linkname != hdrsRev[i].Linkname { - t.Errorf("headers - %q expected linkname %q; but got %q", hdrs[i].Name, hdrs[i].Linkname, hdrsRev[i].Linkname) - } - } - -} - -type tarHeaders []tar.Header - -func (th tarHeaders) Len() int { return len(th) } -func (th tarHeaders) Swap(i, j int) { th[j], th[i] = th[i], th[j] } -func (th tarHeaders) Less(i, j int) bool { return th[i].Name < th[j].Name } - -func walkHeaders(r io.Reader) ([]tar.Header, error) { - t := tar.NewReader(r) - headers := []tar.Header{} - for { - hdr, err := t.Next() - if err != nil { - if err == io.EOF { - break - } - return headers, err - } - headers = append(headers, *hdr) - } - return headers, nil -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/changes_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/changes_test.go deleted file mode 100644 index f4316ce21e..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/changes_test.go +++ /dev/null @@ -1,527 +0,0 @@ -package archive - -import ( - "io/ioutil" - "os" - "os/exec" - "path" - "sort" - "testing" - "time" -) - -func max(x, y int) int { - if x >= y { - return x - } - return y -} - -func copyDir(src, dst string) error { - cmd := exec.Command("cp", "-a", src, dst) - if err := cmd.Run(); err != nil { - return err - } - return nil -} - -type FileType uint32 - -const ( - Regular FileType = iota - Dir - Symlink -) - -type FileData struct { - filetype FileType - path string - contents string - permissions os.FileMode -} - -func createSampleDir(t *testing.T, root string) { - files := []FileData{ - {Regular, "file1", "file1\n", 0600}, - {Regular, "file2", "file2\n", 0666}, - {Regular, "file3", "file3\n", 0404}, - {Regular, "file4", "file4\n", 0600}, - {Regular, "file5", "file5\n", 0600}, - {Regular, "file6", "file6\n", 0600}, - {Regular, "file7", "file7\n", 0600}, - {Dir, "dir1", "", 0740}, - {Regular, "dir1/file1-1", "file1-1\n", 01444}, - {Regular, "dir1/file1-2", "file1-2\n", 0666}, - {Dir, "dir2", "", 0700}, - {Regular, "dir2/file2-1", "file2-1\n", 0666}, - {Regular, "dir2/file2-2", "file2-2\n", 0666}, - {Dir, "dir3", "", 0700}, - {Regular, "dir3/file3-1", "file3-1\n", 0666}, - {Regular, "dir3/file3-2", "file3-2\n", 0666}, - {Dir, "dir4", "", 0700}, - {Regular, "dir4/file3-1", "file4-1\n", 0666}, - {Regular, "dir4/file3-2", "file4-2\n", 0666}, - {Symlink, "symlink1", "target1", 0666}, - {Symlink, "symlink2", "target2", 0666}, - {Symlink, "symlink3", root + "/file1", 0666}, - {Symlink, "symlink4", root + "/symlink3", 0666}, - {Symlink, "dirSymlink", root + "/dir1", 0740}, - } - - now := time.Now() - for _, info := range files { - p := path.Join(root, info.path) - if info.filetype == Dir { - if err := os.MkdirAll(p, info.permissions); err != nil { - t.Fatal(err) - } - } else if info.filetype == Regular { - if err := ioutil.WriteFile(p, []byte(info.contents), info.permissions); err != nil { - t.Fatal(err) - } - } else if info.filetype == Symlink { - if err := os.Symlink(info.contents, p); err != nil { - t.Fatal(err) - } - } - - if info.filetype != Symlink { - // Set a consistent ctime, atime for all files and dirs - if err := os.Chtimes(p, now, now); err != nil { - t.Fatal(err) - } - } - } -} - -func TestChangeString(t *testing.T) { - modifiyChange := Change{"change", ChangeModify} - toString := modifiyChange.String() - if toString != "C change" { - t.Fatalf("String() of a change with ChangeModifiy Kind should have been %s but was %s", "C change", toString) - } - addChange := Change{"change", ChangeAdd} - toString = addChange.String() - if toString != "A change" { - t.Fatalf("String() of a change with ChangeAdd Kind should have been %s but was %s", "A change", toString) - } - deleteChange := Change{"change", ChangeDelete} - toString = deleteChange.String() - if toString != "D change" { - t.Fatalf("String() of a change with ChangeDelete Kind should have been %s but was %s", "D change", toString) - } -} - -func TestChangesWithNoChanges(t *testing.T) { - rwLayer, err := ioutil.TempDir("", "docker-changes-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(rwLayer) - layer, err := ioutil.TempDir("", "docker-changes-test-layer") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(layer) - createSampleDir(t, layer) - changes, err := Changes([]string{layer}, rwLayer) - if err != nil { - t.Fatal(err) - } - if len(changes) != 0 { - t.Fatalf("Changes with no difference should have detect no changes, but detected %d", len(changes)) - } -} - -func TestChangesWithChanges(t *testing.T) { - // Mock the readonly layer - layer, err := ioutil.TempDir("", "docker-changes-test-layer") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(layer) - createSampleDir(t, layer) - os.MkdirAll(path.Join(layer, "dir1/subfolder"), 0740) - - // Mock the RW layer - rwLayer, err := ioutil.TempDir("", "docker-changes-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(rwLayer) - - // Create a folder in RW layer - dir1 := path.Join(rwLayer, "dir1") - os.MkdirAll(dir1, 0740) - deletedFile := path.Join(dir1, ".wh.file1-2") - ioutil.WriteFile(deletedFile, []byte{}, 0600) - modifiedFile := path.Join(dir1, "file1-1") - ioutil.WriteFile(modifiedFile, []byte{0x00}, 01444) - // Let's add a subfolder for a newFile - subfolder := path.Join(dir1, "subfolder") - os.MkdirAll(subfolder, 0740) - newFile := path.Join(subfolder, "newFile") - ioutil.WriteFile(newFile, []byte{}, 0740) - - changes, err := Changes([]string{layer}, rwLayer) - if err != nil { - t.Fatal(err) - } - - expectedChanges := []Change{ - {"/dir1", ChangeModify}, - {"/dir1/file1-1", ChangeModify}, - {"/dir1/file1-2", ChangeDelete}, - {"/dir1/subfolder", ChangeModify}, - {"/dir1/subfolder/newFile", ChangeAdd}, - } - checkChanges(expectedChanges, changes, t) -} - -// See https://github.com/docker/docker/pull/13590 -func TestChangesWithChangesGH13590(t *testing.T) { - baseLayer, err := ioutil.TempDir("", "docker-changes-test.") - defer os.RemoveAll(baseLayer) - - dir3 := path.Join(baseLayer, "dir1/dir2/dir3") - os.MkdirAll(dir3, 07400) - - file := path.Join(dir3, "file.txt") - ioutil.WriteFile(file, []byte("hello"), 0666) - - layer, err := ioutil.TempDir("", "docker-changes-test2.") - defer os.RemoveAll(layer) - - // Test creating a new file - if err := copyDir(baseLayer+"/dir1", layer+"/"); err != nil { - t.Fatalf("Cmd failed: %q", err) - } - - os.Remove(path.Join(layer, "dir1/dir2/dir3/file.txt")) - file = path.Join(layer, "dir1/dir2/dir3/file1.txt") - ioutil.WriteFile(file, []byte("bye"), 0666) - - changes, err := Changes([]string{baseLayer}, layer) - if err != nil { - t.Fatal(err) - } - - expectedChanges := []Change{ - {"/dir1/dir2/dir3", ChangeModify}, - {"/dir1/dir2/dir3/file1.txt", ChangeAdd}, - } - checkChanges(expectedChanges, changes, t) - - // Now test changing a file - layer, err = ioutil.TempDir("", "docker-changes-test3.") - defer os.RemoveAll(layer) - - if err := copyDir(baseLayer+"/dir1", layer+"/"); err != nil { - t.Fatalf("Cmd failed: %q", err) - } - - file = path.Join(layer, "dir1/dir2/dir3/file.txt") - ioutil.WriteFile(file, []byte("bye"), 0666) - - changes, err = Changes([]string{baseLayer}, layer) - if err != nil { - t.Fatal(err) - } - - expectedChanges = []Change{ - {"/dir1/dir2/dir3/file.txt", ChangeModify}, - } - checkChanges(expectedChanges, changes, t) -} - -// Create an directory, copy it, make sure we report no changes between the two -func TestChangesDirsEmpty(t *testing.T) { - src, err := ioutil.TempDir("", "docker-changes-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(src) - createSampleDir(t, src) - dst := src + "-copy" - if err := copyDir(src, dst); err != nil { - t.Fatal(err) - } - defer os.RemoveAll(dst) - changes, err := ChangesDirs(dst, src) - if err != nil { - t.Fatal(err) - } - - if len(changes) != 0 { - t.Fatalf("Reported changes for identical dirs: %v", changes) - } - os.RemoveAll(src) - os.RemoveAll(dst) -} - -func mutateSampleDir(t *testing.T, root string) { - // Remove a regular file - if err := os.RemoveAll(path.Join(root, "file1")); err != nil { - t.Fatal(err) - } - - // Remove a directory - if err := os.RemoveAll(path.Join(root, "dir1")); err != nil { - t.Fatal(err) - } - - // Remove a symlink - if err := os.RemoveAll(path.Join(root, "symlink1")); err != nil { - t.Fatal(err) - } - - // Rewrite a file - if err := ioutil.WriteFile(path.Join(root, "file2"), []byte("fileNN\n"), 0777); err != nil { - t.Fatal(err) - } - - // Replace a file - if err := os.RemoveAll(path.Join(root, "file3")); err != nil { - t.Fatal(err) - } - if err := ioutil.WriteFile(path.Join(root, "file3"), []byte("fileMM\n"), 0404); err != nil { - t.Fatal(err) - } - - // Touch file - if err := os.Chtimes(path.Join(root, "file4"), time.Now().Add(time.Second), time.Now().Add(time.Second)); err != nil { - t.Fatal(err) - } - - // Replace file with dir - if err := os.RemoveAll(path.Join(root, "file5")); err != nil { - t.Fatal(err) - } - if err := os.MkdirAll(path.Join(root, "file5"), 0666); err != nil { - t.Fatal(err) - } - - // Create new file - if err := ioutil.WriteFile(path.Join(root, "filenew"), []byte("filenew\n"), 0777); err != nil { - t.Fatal(err) - } - - // Create new dir - if err := os.MkdirAll(path.Join(root, "dirnew"), 0766); err != nil { - t.Fatal(err) - } - - // Create a new symlink - if err := os.Symlink("targetnew", path.Join(root, "symlinknew")); err != nil { - t.Fatal(err) - } - - // Change a symlink - if err := os.RemoveAll(path.Join(root, "symlink2")); err != nil { - t.Fatal(err) - } - if err := os.Symlink("target2change", path.Join(root, "symlink2")); err != nil { - t.Fatal(err) - } - - // Replace dir with file - if err := os.RemoveAll(path.Join(root, "dir2")); err != nil { - t.Fatal(err) - } - if err := ioutil.WriteFile(path.Join(root, "dir2"), []byte("dir2\n"), 0777); err != nil { - t.Fatal(err) - } - - // Touch dir - if err := os.Chtimes(path.Join(root, "dir3"), time.Now().Add(time.Second), time.Now().Add(time.Second)); err != nil { - t.Fatal(err) - } -} - -func TestChangesDirsMutated(t *testing.T) { - src, err := ioutil.TempDir("", "docker-changes-test") - if err != nil { - t.Fatal(err) - } - createSampleDir(t, src) - dst := src + "-copy" - if err := copyDir(src, dst); err != nil { - t.Fatal(err) - } - defer os.RemoveAll(src) - defer os.RemoveAll(dst) - - mutateSampleDir(t, dst) - - changes, err := ChangesDirs(dst, src) - if err != nil { - t.Fatal(err) - } - - sort.Sort(changesByPath(changes)) - - expectedChanges := []Change{ - {"/dir1", ChangeDelete}, - {"/dir2", ChangeModify}, - {"/dirnew", ChangeAdd}, - {"/file1", ChangeDelete}, - {"/file2", ChangeModify}, - {"/file3", ChangeModify}, - {"/file4", ChangeModify}, - {"/file5", ChangeModify}, - {"/filenew", ChangeAdd}, - {"/symlink1", ChangeDelete}, - {"/symlink2", ChangeModify}, - {"/symlinknew", ChangeAdd}, - } - - for i := 0; i < max(len(changes), len(expectedChanges)); i++ { - if i >= len(expectedChanges) { - t.Fatalf("unexpected change %s\n", changes[i].String()) - } - if i >= len(changes) { - t.Fatalf("no change for expected change %s\n", expectedChanges[i].String()) - } - if changes[i].Path == expectedChanges[i].Path { - if changes[i] != expectedChanges[i] { - t.Fatalf("Wrong change for %s, expected %s, got %s\n", changes[i].Path, changes[i].String(), expectedChanges[i].String()) - } - } else if changes[i].Path < expectedChanges[i].Path { - t.Fatalf("unexpected change %s\n", changes[i].String()) - } else { - t.Fatalf("no change for expected change %s != %s\n", expectedChanges[i].String(), changes[i].String()) - } - } -} - -func TestApplyLayer(t *testing.T) { - src, err := ioutil.TempDir("", "docker-changes-test") - if err != nil { - t.Fatal(err) - } - createSampleDir(t, src) - defer os.RemoveAll(src) - dst := src + "-copy" - if err := copyDir(src, dst); err != nil { - t.Fatal(err) - } - mutateSampleDir(t, dst) - defer os.RemoveAll(dst) - - changes, err := ChangesDirs(dst, src) - if err != nil { - t.Fatal(err) - } - - layer, err := ExportChanges(dst, changes, nil, nil) - if err != nil { - t.Fatal(err) - } - - layerCopy, err := NewTempArchive(layer, "") - if err != nil { - t.Fatal(err) - } - - if _, err := ApplyLayer(src, layerCopy); err != nil { - t.Fatal(err) - } - - changes2, err := ChangesDirs(src, dst) - if err != nil { - t.Fatal(err) - } - - if len(changes2) != 0 { - t.Fatalf("Unexpected differences after reapplying mutation: %v", changes2) - } -} - -func TestChangesSizeWithHardlinks(t *testing.T) { - srcDir, err := ioutil.TempDir("", "docker-test-srcDir") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(srcDir) - - destDir, err := ioutil.TempDir("", "docker-test-destDir") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(destDir) - - creationSize, err := prepareUntarSourceDirectory(100, destDir, true) - if err != nil { - t.Fatal(err) - } - - changes, err := ChangesDirs(destDir, srcDir) - if err != nil { - t.Fatal(err) - } - - got := ChangesSize(destDir, changes) - if got != int64(creationSize) { - t.Errorf("Expected %d bytes of changes, got %d", creationSize, got) - } -} - -func TestChangesSizeWithNoChanges(t *testing.T) { - size := ChangesSize("/tmp", nil) - if size != 0 { - t.Fatalf("ChangesSizes with no changes should be 0, was %d", size) - } -} - -func TestChangesSizeWithOnlyDeleteChanges(t *testing.T) { - changes := []Change{ - {Path: "deletedPath", Kind: ChangeDelete}, - } - size := ChangesSize("/tmp", changes) - if size != 0 { - t.Fatalf("ChangesSizes with only delete changes should be 0, was %d", size) - } -} - -func TestChangesSize(t *testing.T) { - parentPath, err := ioutil.TempDir("", "docker-changes-test") - defer os.RemoveAll(parentPath) - addition := path.Join(parentPath, "addition") - if err := ioutil.WriteFile(addition, []byte{0x01, 0x01, 0x01}, 0744); err != nil { - t.Fatal(err) - } - modification := path.Join(parentPath, "modification") - if err = ioutil.WriteFile(modification, []byte{0x01, 0x01, 0x01}, 0744); err != nil { - t.Fatal(err) - } - changes := []Change{ - {Path: "addition", Kind: ChangeAdd}, - {Path: "modification", Kind: ChangeModify}, - } - size := ChangesSize(parentPath, changes) - if size != 6 { - t.Fatalf("Expected 6 bytes of changes, got %d", size) - } -} - -func checkChanges(expectedChanges, changes []Change, t *testing.T) { - sort.Sort(changesByPath(expectedChanges)) - sort.Sort(changesByPath(changes)) - for i := 0; i < max(len(changes), len(expectedChanges)); i++ { - if i >= len(expectedChanges) { - t.Fatalf("unexpected change %s\n", changes[i].String()) - } - if i >= len(changes) { - t.Fatalf("no change for expected change %s\n", expectedChanges[i].String()) - } - if changes[i].Path == expectedChanges[i].Path { - if changes[i] != expectedChanges[i] { - t.Fatalf("Wrong change for %s, expected %s, got %s\n", changes[i].Path, changes[i].String(), expectedChanges[i].String()) - } - } else if changes[i].Path < expectedChanges[i].Path { - t.Fatalf("unexpected change %s\n", changes[i].String()) - } else { - t.Fatalf("no change for expected change %s != %s\n", expectedChanges[i].String(), changes[i].String()) - } - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/copy_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/copy_test.go deleted file mode 100644 index f1dc23824d..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/copy_test.go +++ /dev/null @@ -1,974 +0,0 @@ -package archive - -import ( - "bytes" - "crypto/sha256" - "encoding/hex" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "testing" -) - -func removeAllPaths(paths ...string) { - for _, path := range paths { - os.RemoveAll(path) - } -} - -func getTestTempDirs(t *testing.T) (tmpDirA, tmpDirB string) { - var err error - - if tmpDirA, err = ioutil.TempDir("", "archive-copy-test"); err != nil { - t.Fatal(err) - } - - if tmpDirB, err = ioutil.TempDir("", "archive-copy-test"); err != nil { - t.Fatal(err) - } - - return -} - -func isNotDir(err error) bool { - return strings.Contains(err.Error(), "not a directory") -} - -func joinTrailingSep(pathElements ...string) string { - joined := filepath.Join(pathElements...) - - return fmt.Sprintf("%s%c", joined, filepath.Separator) -} - -func fileContentsEqual(t *testing.T, filenameA, filenameB string) (err error) { - t.Logf("checking for equal file contents: %q and %q\n", filenameA, filenameB) - - fileA, err := os.Open(filenameA) - if err != nil { - return - } - defer fileA.Close() - - fileB, err := os.Open(filenameB) - if err != nil { - return - } - defer fileB.Close() - - hasher := sha256.New() - - if _, err = io.Copy(hasher, fileA); err != nil { - return - } - - hashA := hasher.Sum(nil) - hasher.Reset() - - if _, err = io.Copy(hasher, fileB); err != nil { - return - } - - hashB := hasher.Sum(nil) - - if !bytes.Equal(hashA, hashB) { - err = fmt.Errorf("file content hashes not equal - expected %s, got %s", hex.EncodeToString(hashA), hex.EncodeToString(hashB)) - } - - return -} - -func dirContentsEqual(t *testing.T, newDir, oldDir string) (err error) { - t.Logf("checking for equal directory contents: %q and %q\n", newDir, oldDir) - - var changes []Change - - if changes, err = ChangesDirs(newDir, oldDir); err != nil { - return - } - - if len(changes) != 0 { - err = fmt.Errorf("expected no changes between directories, but got: %v", changes) - } - - return -} - -func logDirContents(t *testing.T, dirPath string) { - logWalkedPaths := filepath.WalkFunc(func(path string, info os.FileInfo, err error) error { - if err != nil { - t.Errorf("stat error for path %q: %s", path, err) - return nil - } - - if info.IsDir() { - path = joinTrailingSep(path) - } - - t.Logf("\t%s", path) - - return nil - }) - - t.Logf("logging directory contents: %q", dirPath) - - if err := filepath.Walk(dirPath, logWalkedPaths); err != nil { - t.Fatal(err) - } -} - -func testCopyHelper(t *testing.T, srcPath, dstPath string) (err error) { - t.Logf("copying from %q to %q (not follow symbol link)", srcPath, dstPath) - - return CopyResource(srcPath, dstPath, false) -} - -func testCopyHelperFSym(t *testing.T, srcPath, dstPath string) (err error) { - t.Logf("copying from %q to %q (follow symbol link)", srcPath, dstPath) - - return CopyResource(srcPath, dstPath, true) -} - -// Basic assumptions about SRC and DST: -// 1. SRC must exist. -// 2. If SRC ends with a trailing separator, it must be a directory. -// 3. DST parent directory must exist. -// 4. If DST exists as a file, it must not end with a trailing separator. - -// First get these easy error cases out of the way. - -// Test for error when SRC does not exist. -func TestCopyErrSrcNotExists(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - if _, err := CopyInfoSourcePath(filepath.Join(tmpDirA, "file1"), false); !os.IsNotExist(err) { - t.Fatalf("expected IsNotExist error, but got %T: %s", err, err) - } -} - -// Test for error when SRC ends in a trailing -// path separator but it exists as a file. -func TestCopyErrSrcNotDir(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A with some sample files and directories. - createSampleDir(t, tmpDirA) - - if _, err := CopyInfoSourcePath(joinTrailingSep(tmpDirA, "file1"), false); !isNotDir(err) { - t.Fatalf("expected IsNotDir error, but got %T: %s", err, err) - } -} - -// Test for error when SRC is a valid file or directory, -// but the DST parent directory does not exist. -func TestCopyErrDstParentNotExists(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A with some sample files and directories. - createSampleDir(t, tmpDirA) - - srcInfo := CopyInfo{Path: filepath.Join(tmpDirA, "file1"), Exists: true, IsDir: false} - - // Try with a file source. - content, err := TarResource(srcInfo) - if err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - defer content.Close() - - // Copy to a file whose parent does not exist. - if err = CopyTo(content, srcInfo, filepath.Join(tmpDirB, "fakeParentDir", "file1")); err == nil { - t.Fatal("expected IsNotExist error, but got nil instead") - } - - if !os.IsNotExist(err) { - t.Fatalf("expected IsNotExist error, but got %T: %s", err, err) - } - - // Try with a directory source. - srcInfo = CopyInfo{Path: filepath.Join(tmpDirA, "dir1"), Exists: true, IsDir: true} - - content, err = TarResource(srcInfo) - if err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - defer content.Close() - - // Copy to a directory whose parent does not exist. - if err = CopyTo(content, srcInfo, joinTrailingSep(tmpDirB, "fakeParentDir", "fakeDstDir")); err == nil { - t.Fatal("expected IsNotExist error, but got nil instead") - } - - if !os.IsNotExist(err) { - t.Fatalf("expected IsNotExist error, but got %T: %s", err, err) - } -} - -// Test for error when DST ends in a trailing -// path separator but exists as a file. -func TestCopyErrDstNotDir(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A and B with some sample files and directories. - createSampleDir(t, tmpDirA) - createSampleDir(t, tmpDirB) - - // Try with a file source. - srcInfo := CopyInfo{Path: filepath.Join(tmpDirA, "file1"), Exists: true, IsDir: false} - - content, err := TarResource(srcInfo) - if err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - defer content.Close() - - if err = CopyTo(content, srcInfo, joinTrailingSep(tmpDirB, "file1")); err == nil { - t.Fatal("expected IsNotDir error, but got nil instead") - } - - if !isNotDir(err) { - t.Fatalf("expected IsNotDir error, but got %T: %s", err, err) - } - - // Try with a directory source. - srcInfo = CopyInfo{Path: filepath.Join(tmpDirA, "dir1"), Exists: true, IsDir: true} - - content, err = TarResource(srcInfo) - if err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - defer content.Close() - - if err = CopyTo(content, srcInfo, joinTrailingSep(tmpDirB, "file1")); err == nil { - t.Fatal("expected IsNotDir error, but got nil instead") - } - - if !isNotDir(err) { - t.Fatalf("expected IsNotDir error, but got %T: %s", err, err) - } -} - -// Possibilities are reduced to the remaining 10 cases: -// -// case | srcIsDir | onlyDirContents | dstExists | dstIsDir | dstTrSep | action -// =================================================================================================== -// A | no | - | no | - | no | create file -// B | no | - | no | - | yes | error -// C | no | - | yes | no | - | overwrite file -// D | no | - | yes | yes | - | create file in dst dir -// E | yes | no | no | - | - | create dir, copy contents -// F | yes | no | yes | no | - | error -// G | yes | no | yes | yes | - | copy dir and contents -// H | yes | yes | no | - | - | create dir, copy contents -// I | yes | yes | yes | no | - | error -// J | yes | yes | yes | yes | - | copy dir contents -// - -// A. SRC specifies a file and DST (no trailing path separator) doesn't -// exist. This should create a file with the name DST and copy the -// contents of the source file into it. -func TestCopyCaseA(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A with some sample files and directories. - createSampleDir(t, tmpDirA) - - srcPath := filepath.Join(tmpDirA, "file1") - dstPath := filepath.Join(tmpDirB, "itWorks.txt") - - var err error - - if err = testCopyHelper(t, srcPath, dstPath); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = fileContentsEqual(t, srcPath, dstPath); err != nil { - t.Fatal(err) - } - os.Remove(dstPath) - - symlinkPath := filepath.Join(tmpDirA, "symlink3") - symlinkPath1 := filepath.Join(tmpDirA, "symlink4") - linkTarget := filepath.Join(tmpDirA, "file1") - - if err = testCopyHelperFSym(t, symlinkPath, dstPath); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = fileContentsEqual(t, linkTarget, dstPath); err != nil { - t.Fatal(err) - } - os.Remove(dstPath) - if err = testCopyHelperFSym(t, symlinkPath1, dstPath); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = fileContentsEqual(t, linkTarget, dstPath); err != nil { - t.Fatal(err) - } -} - -// B. SRC specifies a file and DST (with trailing path separator) doesn't -// exist. This should cause an error because the copy operation cannot -// create a directory when copying a single file. -func TestCopyCaseB(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A with some sample files and directories. - createSampleDir(t, tmpDirA) - - srcPath := filepath.Join(tmpDirA, "file1") - dstDir := joinTrailingSep(tmpDirB, "testDir") - - var err error - - if err = testCopyHelper(t, srcPath, dstDir); err == nil { - t.Fatal("expected ErrDirNotExists error, but got nil instead") - } - - if err != ErrDirNotExists { - t.Fatalf("expected ErrDirNotExists error, but got %T: %s", err, err) - } - - symlinkPath := filepath.Join(tmpDirA, "symlink3") - - if err = testCopyHelperFSym(t, symlinkPath, dstDir); err == nil { - t.Fatal("expected ErrDirNotExists error, but got nil instead") - } - if err != ErrDirNotExists { - t.Fatalf("expected ErrDirNotExists error, but got %T: %s", err, err) - } - -} - -// C. SRC specifies a file and DST exists as a file. This should overwrite -// the file at DST with the contents of the source file. -func TestCopyCaseC(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A and B with some sample files and directories. - createSampleDir(t, tmpDirA) - createSampleDir(t, tmpDirB) - - srcPath := filepath.Join(tmpDirA, "file1") - dstPath := filepath.Join(tmpDirB, "file2") - - var err error - - // Ensure they start out different. - if err = fileContentsEqual(t, srcPath, dstPath); err == nil { - t.Fatal("expected different file contents") - } - - if err = testCopyHelper(t, srcPath, dstPath); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = fileContentsEqual(t, srcPath, dstPath); err != nil { - t.Fatal(err) - } -} - -// C. Symbol link following version: -// SRC specifies a file and DST exists as a file. This should overwrite -// the file at DST with the contents of the source file. -func TestCopyCaseCFSym(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A and B with some sample files and directories. - createSampleDir(t, tmpDirA) - createSampleDir(t, tmpDirB) - - symlinkPathBad := filepath.Join(tmpDirA, "symlink1") - symlinkPath := filepath.Join(tmpDirA, "symlink3") - linkTarget := filepath.Join(tmpDirA, "file1") - dstPath := filepath.Join(tmpDirB, "file2") - - var err error - - // first to test broken link - if err = testCopyHelperFSym(t, symlinkPathBad, dstPath); err == nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - // test symbol link -> symbol link -> target - // Ensure they start out different. - if err = fileContentsEqual(t, linkTarget, dstPath); err == nil { - t.Fatal("expected different file contents") - } - - if err = testCopyHelperFSym(t, symlinkPath, dstPath); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = fileContentsEqual(t, linkTarget, dstPath); err != nil { - t.Fatal(err) - } -} - -// D. SRC specifies a file and DST exists as a directory. This should place -// a copy of the source file inside it using the basename from SRC. Ensure -// this works whether DST has a trailing path separator or not. -func TestCopyCaseD(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A and B with some sample files and directories. - createSampleDir(t, tmpDirA) - createSampleDir(t, tmpDirB) - - srcPath := filepath.Join(tmpDirA, "file1") - dstDir := filepath.Join(tmpDirB, "dir1") - dstPath := filepath.Join(dstDir, "file1") - - var err error - - // Ensure that dstPath doesn't exist. - if _, err = os.Stat(dstPath); !os.IsNotExist(err) { - t.Fatalf("did not expect dstPath %q to exist", dstPath) - } - - if err = testCopyHelper(t, srcPath, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = fileContentsEqual(t, srcPath, dstPath); err != nil { - t.Fatal(err) - } - - // Now try again but using a trailing path separator for dstDir. - - if err = os.RemoveAll(dstDir); err != nil { - t.Fatalf("unable to remove dstDir: %s", err) - } - - if err = os.MkdirAll(dstDir, os.FileMode(0755)); err != nil { - t.Fatalf("unable to make dstDir: %s", err) - } - - dstDir = joinTrailingSep(tmpDirB, "dir1") - - if err = testCopyHelper(t, srcPath, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = fileContentsEqual(t, srcPath, dstPath); err != nil { - t.Fatal(err) - } -} - -// D. Symbol link following version: -// SRC specifies a file and DST exists as a directory. This should place -// a copy of the source file inside it using the basename from SRC. Ensure -// this works whether DST has a trailing path separator or not. -func TestCopyCaseDFSym(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A and B with some sample files and directories. - createSampleDir(t, tmpDirA) - createSampleDir(t, tmpDirB) - - srcPath := filepath.Join(tmpDirA, "symlink4") - linkTarget := filepath.Join(tmpDirA, "file1") - dstDir := filepath.Join(tmpDirB, "dir1") - dstPath := filepath.Join(dstDir, "symlink4") - - var err error - - // Ensure that dstPath doesn't exist. - if _, err = os.Stat(dstPath); !os.IsNotExist(err) { - t.Fatalf("did not expect dstPath %q to exist", dstPath) - } - - if err = testCopyHelperFSym(t, srcPath, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = fileContentsEqual(t, linkTarget, dstPath); err != nil { - t.Fatal(err) - } - - // Now try again but using a trailing path separator for dstDir. - - if err = os.RemoveAll(dstDir); err != nil { - t.Fatalf("unable to remove dstDir: %s", err) - } - - if err = os.MkdirAll(dstDir, os.FileMode(0755)); err != nil { - t.Fatalf("unable to make dstDir: %s", err) - } - - dstDir = joinTrailingSep(tmpDirB, "dir1") - - if err = testCopyHelperFSym(t, srcPath, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = fileContentsEqual(t, linkTarget, dstPath); err != nil { - t.Fatal(err) - } -} - -// E. SRC specifies a directory and DST does not exist. This should create a -// directory at DST and copy the contents of the SRC directory into the DST -// directory. Ensure this works whether DST has a trailing path separator or -// not. -func TestCopyCaseE(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A with some sample files and directories. - createSampleDir(t, tmpDirA) - - srcDir := filepath.Join(tmpDirA, "dir1") - dstDir := filepath.Join(tmpDirB, "testDir") - - var err error - - if err = testCopyHelper(t, srcDir, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = dirContentsEqual(t, dstDir, srcDir); err != nil { - t.Log("dir contents not equal") - logDirContents(t, tmpDirA) - logDirContents(t, tmpDirB) - t.Fatal(err) - } - - // Now try again but using a trailing path separator for dstDir. - - if err = os.RemoveAll(dstDir); err != nil { - t.Fatalf("unable to remove dstDir: %s", err) - } - - dstDir = joinTrailingSep(tmpDirB, "testDir") - - if err = testCopyHelper(t, srcDir, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = dirContentsEqual(t, dstDir, srcDir); err != nil { - t.Fatal(err) - } -} - -// E. Symbol link following version: -// SRC specifies a directory and DST does not exist. This should create a -// directory at DST and copy the contents of the SRC directory into the DST -// directory. Ensure this works whether DST has a trailing path separator or -// not. -func TestCopyCaseEFSym(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A with some sample files and directories. - createSampleDir(t, tmpDirA) - - srcDir := filepath.Join(tmpDirA, "dirSymlink") - linkTarget := filepath.Join(tmpDirA, "dir1") - dstDir := filepath.Join(tmpDirB, "testDir") - - var err error - - if err = testCopyHelperFSym(t, srcDir, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = dirContentsEqual(t, dstDir, linkTarget); err != nil { - t.Log("dir contents not equal") - logDirContents(t, tmpDirA) - logDirContents(t, tmpDirB) - t.Fatal(err) - } - - // Now try again but using a trailing path separator for dstDir. - - if err = os.RemoveAll(dstDir); err != nil { - t.Fatalf("unable to remove dstDir: %s", err) - } - - dstDir = joinTrailingSep(tmpDirB, "testDir") - - if err = testCopyHelperFSym(t, srcDir, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = dirContentsEqual(t, dstDir, linkTarget); err != nil { - t.Fatal(err) - } -} - -// F. SRC specifies a directory and DST exists as a file. This should cause an -// error as it is not possible to overwrite a file with a directory. -func TestCopyCaseF(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A and B with some sample files and directories. - createSampleDir(t, tmpDirA) - createSampleDir(t, tmpDirB) - - srcDir := filepath.Join(tmpDirA, "dir1") - symSrcDir := filepath.Join(tmpDirA, "dirSymlink") - dstFile := filepath.Join(tmpDirB, "file1") - - var err error - - if err = testCopyHelper(t, srcDir, dstFile); err == nil { - t.Fatal("expected ErrCannotCopyDir error, but got nil instead") - } - - if err != ErrCannotCopyDir { - t.Fatalf("expected ErrCannotCopyDir error, but got %T: %s", err, err) - } - - // now test with symbol link - if err = testCopyHelperFSym(t, symSrcDir, dstFile); err == nil { - t.Fatal("expected ErrCannotCopyDir error, but got nil instead") - } - - if err != ErrCannotCopyDir { - t.Fatalf("expected ErrCannotCopyDir error, but got %T: %s", err, err) - } -} - -// G. SRC specifies a directory and DST exists as a directory. This should copy -// the SRC directory and all its contents to the DST directory. Ensure this -// works whether DST has a trailing path separator or not. -func TestCopyCaseG(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A and B with some sample files and directories. - createSampleDir(t, tmpDirA) - createSampleDir(t, tmpDirB) - - srcDir := filepath.Join(tmpDirA, "dir1") - dstDir := filepath.Join(tmpDirB, "dir2") - resultDir := filepath.Join(dstDir, "dir1") - - var err error - - if err = testCopyHelper(t, srcDir, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = dirContentsEqual(t, resultDir, srcDir); err != nil { - t.Fatal(err) - } - - // Now try again but using a trailing path separator for dstDir. - - if err = os.RemoveAll(dstDir); err != nil { - t.Fatalf("unable to remove dstDir: %s", err) - } - - if err = os.MkdirAll(dstDir, os.FileMode(0755)); err != nil { - t.Fatalf("unable to make dstDir: %s", err) - } - - dstDir = joinTrailingSep(tmpDirB, "dir2") - - if err = testCopyHelper(t, srcDir, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = dirContentsEqual(t, resultDir, srcDir); err != nil { - t.Fatal(err) - } -} - -// G. Symbol link version: -// SRC specifies a directory and DST exists as a directory. This should copy -// the SRC directory and all its contents to the DST directory. Ensure this -// works whether DST has a trailing path separator or not. -func TestCopyCaseGFSym(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A and B with some sample files and directories. - createSampleDir(t, tmpDirA) - createSampleDir(t, tmpDirB) - - srcDir := filepath.Join(tmpDirA, "dirSymlink") - linkTarget := filepath.Join(tmpDirA, "dir1") - dstDir := filepath.Join(tmpDirB, "dir2") - resultDir := filepath.Join(dstDir, "dirSymlink") - - var err error - - if err = testCopyHelperFSym(t, srcDir, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = dirContentsEqual(t, resultDir, linkTarget); err != nil { - t.Fatal(err) - } - - // Now try again but using a trailing path separator for dstDir. - - if err = os.RemoveAll(dstDir); err != nil { - t.Fatalf("unable to remove dstDir: %s", err) - } - - if err = os.MkdirAll(dstDir, os.FileMode(0755)); err != nil { - t.Fatalf("unable to make dstDir: %s", err) - } - - dstDir = joinTrailingSep(tmpDirB, "dir2") - - if err = testCopyHelperFSym(t, srcDir, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = dirContentsEqual(t, resultDir, linkTarget); err != nil { - t.Fatal(err) - } -} - -// H. SRC specifies a directory's contents only and DST does not exist. This -// should create a directory at DST and copy the contents of the SRC -// directory (but not the directory itself) into the DST directory. Ensure -// this works whether DST has a trailing path separator or not. -func TestCopyCaseH(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A with some sample files and directories. - createSampleDir(t, tmpDirA) - - srcDir := joinTrailingSep(tmpDirA, "dir1") + "." - dstDir := filepath.Join(tmpDirB, "testDir") - - var err error - - if err = testCopyHelper(t, srcDir, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = dirContentsEqual(t, dstDir, srcDir); err != nil { - t.Log("dir contents not equal") - logDirContents(t, tmpDirA) - logDirContents(t, tmpDirB) - t.Fatal(err) - } - - // Now try again but using a trailing path separator for dstDir. - - if err = os.RemoveAll(dstDir); err != nil { - t.Fatalf("unable to remove dstDir: %s", err) - } - - dstDir = joinTrailingSep(tmpDirB, "testDir") - - if err = testCopyHelper(t, srcDir, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = dirContentsEqual(t, dstDir, srcDir); err != nil { - t.Log("dir contents not equal") - logDirContents(t, tmpDirA) - logDirContents(t, tmpDirB) - t.Fatal(err) - } -} - -// H. Symbol link following version: -// SRC specifies a directory's contents only and DST does not exist. This -// should create a directory at DST and copy the contents of the SRC -// directory (but not the directory itself) into the DST directory. Ensure -// this works whether DST has a trailing path separator or not. -func TestCopyCaseHFSym(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A with some sample files and directories. - createSampleDir(t, tmpDirA) - - srcDir := joinTrailingSep(tmpDirA, "dirSymlink") + "." - linkTarget := filepath.Join(tmpDirA, "dir1") - dstDir := filepath.Join(tmpDirB, "testDir") - - var err error - - if err = testCopyHelperFSym(t, srcDir, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = dirContentsEqual(t, dstDir, linkTarget); err != nil { - t.Log("dir contents not equal") - logDirContents(t, tmpDirA) - logDirContents(t, tmpDirB) - t.Fatal(err) - } - - // Now try again but using a trailing path separator for dstDir. - - if err = os.RemoveAll(dstDir); err != nil { - t.Fatalf("unable to remove dstDir: %s", err) - } - - dstDir = joinTrailingSep(tmpDirB, "testDir") - - if err = testCopyHelperFSym(t, srcDir, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = dirContentsEqual(t, dstDir, linkTarget); err != nil { - t.Log("dir contents not equal") - logDirContents(t, tmpDirA) - logDirContents(t, tmpDirB) - t.Fatal(err) - } -} - -// I. SRC specifies a directory's contents only and DST exists as a file. This -// should cause an error as it is not possible to overwrite a file with a -// directory. -func TestCopyCaseI(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A and B with some sample files and directories. - createSampleDir(t, tmpDirA) - createSampleDir(t, tmpDirB) - - srcDir := joinTrailingSep(tmpDirA, "dir1") + "." - symSrcDir := filepath.Join(tmpDirB, "dirSymlink") - dstFile := filepath.Join(tmpDirB, "file1") - - var err error - - if err = testCopyHelper(t, srcDir, dstFile); err == nil { - t.Fatal("expected ErrCannotCopyDir error, but got nil instead") - } - - if err != ErrCannotCopyDir { - t.Fatalf("expected ErrCannotCopyDir error, but got %T: %s", err, err) - } - - // now try with symbol link of dir - if err = testCopyHelperFSym(t, symSrcDir, dstFile); err == nil { - t.Fatal("expected ErrCannotCopyDir error, but got nil instead") - } - - if err != ErrCannotCopyDir { - t.Fatalf("expected ErrCannotCopyDir error, but got %T: %s", err, err) - } -} - -// J. SRC specifies a directory's contents only and DST exists as a directory. -// This should copy the contents of the SRC directory (but not the directory -// itself) into the DST directory. Ensure this works whether DST has a -// trailing path separator or not. -func TestCopyCaseJ(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A and B with some sample files and directories. - createSampleDir(t, tmpDirA) - createSampleDir(t, tmpDirB) - - srcDir := joinTrailingSep(tmpDirA, "dir1") + "." - dstDir := filepath.Join(tmpDirB, "dir5") - - var err error - - // first to create an empty dir - if err = os.MkdirAll(dstDir, os.FileMode(0755)); err != nil { - t.Fatalf("unable to make dstDir: %s", err) - } - - if err = testCopyHelper(t, srcDir, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = dirContentsEqual(t, dstDir, srcDir); err != nil { - t.Fatal(err) - } - - // Now try again but using a trailing path separator for dstDir. - - if err = os.RemoveAll(dstDir); err != nil { - t.Fatalf("unable to remove dstDir: %s", err) - } - - if err = os.MkdirAll(dstDir, os.FileMode(0755)); err != nil { - t.Fatalf("unable to make dstDir: %s", err) - } - - dstDir = joinTrailingSep(tmpDirB, "dir5") - - if err = testCopyHelper(t, srcDir, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = dirContentsEqual(t, dstDir, srcDir); err != nil { - t.Fatal(err) - } -} - -// J. Symbol link following version: -// SRC specifies a directory's contents only and DST exists as a directory. -// This should copy the contents of the SRC directory (but not the directory -// itself) into the DST directory. Ensure this works whether DST has a -// trailing path separator or not. -func TestCopyCaseJFSym(t *testing.T) { - tmpDirA, tmpDirB := getTestTempDirs(t) - defer removeAllPaths(tmpDirA, tmpDirB) - - // Load A and B with some sample files and directories. - createSampleDir(t, tmpDirA) - createSampleDir(t, tmpDirB) - - srcDir := joinTrailingSep(tmpDirA, "dirSymlink") + "." - linkTarget := filepath.Join(tmpDirA, "dir1") - dstDir := filepath.Join(tmpDirB, "dir5") - - var err error - - // first to create an empty dir - if err = os.MkdirAll(dstDir, os.FileMode(0755)); err != nil { - t.Fatalf("unable to make dstDir: %s", err) - } - - if err = testCopyHelperFSym(t, srcDir, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = dirContentsEqual(t, dstDir, linkTarget); err != nil { - t.Fatal(err) - } - - // Now try again but using a trailing path separator for dstDir. - - if err = os.RemoveAll(dstDir); err != nil { - t.Fatalf("unable to remove dstDir: %s", err) - } - - if err = os.MkdirAll(dstDir, os.FileMode(0755)); err != nil { - t.Fatalf("unable to make dstDir: %s", err) - } - - dstDir = joinTrailingSep(tmpDirB, "dir5") - - if err = testCopyHelperFSym(t, srcDir, dstDir); err != nil { - t.Fatalf("unexpected error %T: %s", err, err) - } - - if err = dirContentsEqual(t, dstDir, linkTarget); err != nil { - t.Fatal(err) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/diff_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/diff_test.go deleted file mode 100644 index 4388d69c77..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/diff_test.go +++ /dev/null @@ -1,370 +0,0 @@ -package archive - -import ( - "archive/tar" - "io" - "io/ioutil" - "os" - "path/filepath" - "reflect" - "testing" - - "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils" -) - -func TestApplyLayerInvalidFilenames(t *testing.T) { - for i, headers := range [][]*tar.Header{ - { - { - Name: "../victim/dotdot", - Typeflag: tar.TypeReg, - Mode: 0644, - }, - }, - { - { - // Note the leading slash - Name: "/../victim/slash-dotdot", - Typeflag: tar.TypeReg, - Mode: 0644, - }, - }, - } { - if err := testBreakout("applylayer", "docker-TestApplyLayerInvalidFilenames", headers); err != nil { - t.Fatalf("i=%d. %v", i, err) - } - } -} - -func TestApplyLayerInvalidHardlink(t *testing.T) { - for i, headers := range [][]*tar.Header{ - { // try reading victim/hello (../) - { - Name: "dotdot", - Typeflag: tar.TypeLink, - Linkname: "../victim/hello", - Mode: 0644, - }, - }, - { // try reading victim/hello (/../) - { - Name: "slash-dotdot", - Typeflag: tar.TypeLink, - // Note the leading slash - Linkname: "/../victim/hello", - Mode: 0644, - }, - }, - { // try writing victim/file - { - Name: "loophole-victim", - Typeflag: tar.TypeLink, - Linkname: "../victim", - Mode: 0755, - }, - { - Name: "loophole-victim/file", - Typeflag: tar.TypeReg, - Mode: 0644, - }, - }, - { // try reading victim/hello (hardlink, symlink) - { - Name: "loophole-victim", - Typeflag: tar.TypeLink, - Linkname: "../victim", - Mode: 0755, - }, - { - Name: "symlink", - Typeflag: tar.TypeSymlink, - Linkname: "loophole-victim/hello", - Mode: 0644, - }, - }, - { // Try reading victim/hello (hardlink, hardlink) - { - Name: "loophole-victim", - Typeflag: tar.TypeLink, - Linkname: "../victim", - Mode: 0755, - }, - { - Name: "hardlink", - Typeflag: tar.TypeLink, - Linkname: "loophole-victim/hello", - Mode: 0644, - }, - }, - { // Try removing victim directory (hardlink) - { - Name: "loophole-victim", - Typeflag: tar.TypeLink, - Linkname: "../victim", - Mode: 0755, - }, - { - Name: "loophole-victim", - Typeflag: tar.TypeReg, - Mode: 0644, - }, - }, - } { - if err := testBreakout("applylayer", "docker-TestApplyLayerInvalidHardlink", headers); err != nil { - t.Fatalf("i=%d. %v", i, err) - } - } -} - -func TestApplyLayerInvalidSymlink(t *testing.T) { - for i, headers := range [][]*tar.Header{ - { // try reading victim/hello (../) - { - Name: "dotdot", - Typeflag: tar.TypeSymlink, - Linkname: "../victim/hello", - Mode: 0644, - }, - }, - { // try reading victim/hello (/../) - { - Name: "slash-dotdot", - Typeflag: tar.TypeSymlink, - // Note the leading slash - Linkname: "/../victim/hello", - Mode: 0644, - }, - }, - { // try writing victim/file - { - Name: "loophole-victim", - Typeflag: tar.TypeSymlink, - Linkname: "../victim", - Mode: 0755, - }, - { - Name: "loophole-victim/file", - Typeflag: tar.TypeReg, - Mode: 0644, - }, - }, - { // try reading victim/hello (symlink, symlink) - { - Name: "loophole-victim", - Typeflag: tar.TypeSymlink, - Linkname: "../victim", - Mode: 0755, - }, - { - Name: "symlink", - Typeflag: tar.TypeSymlink, - Linkname: "loophole-victim/hello", - Mode: 0644, - }, - }, - { // try reading victim/hello (symlink, hardlink) - { - Name: "loophole-victim", - Typeflag: tar.TypeSymlink, - Linkname: "../victim", - Mode: 0755, - }, - { - Name: "hardlink", - Typeflag: tar.TypeLink, - Linkname: "loophole-victim/hello", - Mode: 0644, - }, - }, - { // try removing victim directory (symlink) - { - Name: "loophole-victim", - Typeflag: tar.TypeSymlink, - Linkname: "../victim", - Mode: 0755, - }, - { - Name: "loophole-victim", - Typeflag: tar.TypeReg, - Mode: 0644, - }, - }, - } { - if err := testBreakout("applylayer", "docker-TestApplyLayerInvalidSymlink", headers); err != nil { - t.Fatalf("i=%d. %v", i, err) - } - } -} - -func TestApplyLayerWhiteouts(t *testing.T) { - wd, err := ioutil.TempDir("", "graphdriver-test-whiteouts") - if err != nil { - return - } - defer os.RemoveAll(wd) - - base := []string{ - ".baz", - "bar/", - "bar/bax", - "bar/bay/", - "baz", - "foo/", - "foo/.abc", - "foo/.bcd/", - "foo/.bcd/a", - "foo/cde/", - "foo/cde/def", - "foo/cde/efg", - "foo/fgh", - "foobar", - } - - type tcase struct { - change, expected []string - } - - tcases := []tcase{ - { - base, - base, - }, - { - []string{ - ".bay", - ".wh.baz", - "foo/", - "foo/.bce", - "foo/.wh..wh..opq", - "foo/cde/", - "foo/cde/efg", - }, - []string{ - ".bay", - ".baz", - "bar/", - "bar/bax", - "bar/bay/", - "foo/", - "foo/.bce", - "foo/cde/", - "foo/cde/efg", - "foobar", - }, - }, - { - []string{ - ".bay", - ".wh..baz", - ".wh.foobar", - "foo/", - "foo/.abc", - "foo/.wh.cde", - "bar/", - }, - []string{ - ".bay", - "bar/", - "bar/bax", - "bar/bay/", - "foo/", - "foo/.abc", - "foo/.bce", - }, - }, - { - []string{ - ".abc", - ".wh..wh..opq", - "foobar", - }, - []string{ - ".abc", - "foobar", - }, - }, - } - - for i, tc := range tcases { - l, err := makeTestLayer(tc.change) - if err != nil { - t.Fatal(err) - } - - _, err = UnpackLayer(wd, l, nil) - if err != nil { - t.Fatal(err) - } - err = l.Close() - if err != nil { - t.Fatal(err) - } - - paths, err := readDirContents(wd) - if err != nil { - t.Fatal(err) - } - - if !reflect.DeepEqual(tc.expected, paths) { - t.Fatalf("invalid files for layer %d: expected %q, got %q", i, tc.expected, paths) - } - } - -} - -func makeTestLayer(paths []string) (rc io.ReadCloser, err error) { - tmpDir, err := ioutil.TempDir("", "graphdriver-test-mklayer") - if err != nil { - return - } - defer func() { - if err != nil { - os.RemoveAll(tmpDir) - } - }() - for _, p := range paths { - if p[len(p)-1] == filepath.Separator { - if err = os.MkdirAll(filepath.Join(tmpDir, p), 0700); err != nil { - return - } - } else { - if err = ioutil.WriteFile(filepath.Join(tmpDir, p), nil, 0600); err != nil { - return - } - } - } - archive, err := Tar(tmpDir, Uncompressed) - if err != nil { - return - } - return ioutils.NewReadCloserWrapper(archive, func() error { - err := archive.Close() - os.RemoveAll(tmpDir) - return err - }), nil -} - -func readDirContents(root string) ([]string, error) { - var files []string - err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - if path == root { - return nil - } - rel, err := filepath.Rel(root, path) - if err != nil { - return err - } - if info.IsDir() { - rel = rel + "/" - } - files = append(files, rel) - return nil - }) - if err != nil { - return nil, err - } - return files, nil -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/utils_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/utils_test.go deleted file mode 100644 index 98719032f3..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/utils_test.go +++ /dev/null @@ -1,166 +0,0 @@ -package archive - -import ( - "archive/tar" - "bytes" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "time" -) - -var testUntarFns = map[string]func(string, io.Reader) error{ - "untar": func(dest string, r io.Reader) error { - return Untar(r, dest, nil) - }, - "applylayer": func(dest string, r io.Reader) error { - _, err := ApplyLayer(dest, Reader(r)) - return err - }, -} - -// testBreakout is a helper function that, within the provided `tmpdir` directory, -// creates a `victim` folder with a generated `hello` file in it. -// `untar` extracts to a directory named `dest`, the tar file created from `headers`. -// -// Here are the tested scenarios: -// - removed `victim` folder (write) -// - removed files from `victim` folder (write) -// - new files in `victim` folder (write) -// - modified files in `victim` folder (write) -// - file in `dest` with same content as `victim/hello` (read) -// -// When using testBreakout make sure you cover one of the scenarios listed above. -func testBreakout(untarFn string, tmpdir string, headers []*tar.Header) error { - tmpdir, err := ioutil.TempDir("", tmpdir) - if err != nil { - return err - } - defer os.RemoveAll(tmpdir) - - dest := filepath.Join(tmpdir, "dest") - if err := os.Mkdir(dest, 0755); err != nil { - return err - } - - victim := filepath.Join(tmpdir, "victim") - if err := os.Mkdir(victim, 0755); err != nil { - return err - } - hello := filepath.Join(victim, "hello") - helloData, err := time.Now().MarshalText() - if err != nil { - return err - } - if err := ioutil.WriteFile(hello, helloData, 0644); err != nil { - return err - } - helloStat, err := os.Stat(hello) - if err != nil { - return err - } - - reader, writer := io.Pipe() - go func() { - t := tar.NewWriter(writer) - for _, hdr := range headers { - t.WriteHeader(hdr) - } - t.Close() - }() - - untar := testUntarFns[untarFn] - if untar == nil { - return fmt.Errorf("could not find untar function %q in testUntarFns", untarFn) - } - if err := untar(dest, reader); err != nil { - if _, ok := err.(breakoutError); !ok { - // If untar returns an error unrelated to an archive breakout, - // then consider this an unexpected error and abort. - return err - } - // Here, untar detected the breakout. - // Let's move on verifying that indeed there was no breakout. - fmt.Printf("breakoutError: %v\n", err) - } - - // Check victim folder - f, err := os.Open(victim) - if err != nil { - // codepath taken if victim folder was removed - return fmt.Errorf("archive breakout: error reading %q: %v", victim, err) - } - defer f.Close() - - // Check contents of victim folder - // - // We are only interested in getting 2 files from the victim folder, because if all is well - // we expect only one result, the `hello` file. If there is a second result, it cannot - // hold the same name `hello` and we assume that a new file got created in the victim folder. - // That is enough to detect an archive breakout. - names, err := f.Readdirnames(2) - if err != nil { - // codepath taken if victim is not a folder - return fmt.Errorf("archive breakout: error reading directory content of %q: %v", victim, err) - } - for _, name := range names { - if name != "hello" { - // codepath taken if new file was created in victim folder - return fmt.Errorf("archive breakout: new file %q", name) - } - } - - // Check victim/hello - f, err = os.Open(hello) - if err != nil { - // codepath taken if read permissions were removed - return fmt.Errorf("archive breakout: could not lstat %q: %v", hello, err) - } - defer f.Close() - b, err := ioutil.ReadAll(f) - if err != nil { - return err - } - fi, err := f.Stat() - if err != nil { - return err - } - if helloStat.IsDir() != fi.IsDir() || - // TODO: cannot check for fi.ModTime() change - helloStat.Mode() != fi.Mode() || - helloStat.Size() != fi.Size() || - !bytes.Equal(helloData, b) { - // codepath taken if hello has been modified - return fmt.Errorf("archive breakout: file %q has been modified. Contents: expected=%q, got=%q. FileInfo: expected=%#v, got=%#v", hello, helloData, b, helloStat, fi) - } - - // Check that nothing in dest/ has the same content as victim/hello. - // Since victim/hello was generated with time.Now(), it is safe to assume - // that any file whose content matches exactly victim/hello, managed somehow - // to access victim/hello. - return filepath.Walk(dest, func(path string, info os.FileInfo, err error) error { - if info.IsDir() { - if err != nil { - // skip directory if error - return filepath.SkipDir - } - // enter directory - return nil - } - if err != nil { - // skip file if error - return nil - } - b, err := ioutil.ReadFile(path) - if err != nil { - // Houston, we have a problem. Aborting (space)walk. - return err - } - if bytes.Equal(helloData, b) { - return fmt.Errorf("archive breakout: file %q has been accessed via %q", hello, path) - } - return nil - }) -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/wrap_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/wrap_test.go deleted file mode 100644 index 46ab36697a..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/wrap_test.go +++ /dev/null @@ -1,98 +0,0 @@ -package archive - -import ( - "archive/tar" - "bytes" - "io" - "testing" -) - -func TestGenerateEmptyFile(t *testing.T) { - archive, err := Generate("emptyFile") - if err != nil { - t.Fatal(err) - } - if archive == nil { - t.Fatal("The generated archive should not be nil.") - } - - expectedFiles := [][]string{ - {"emptyFile", ""}, - } - - tr := tar.NewReader(archive) - actualFiles := make([][]string, 0, 10) - i := 0 - for { - hdr, err := tr.Next() - if err == io.EOF { - break - } - if err != nil { - t.Fatal(err) - } - buf := new(bytes.Buffer) - buf.ReadFrom(tr) - content := buf.String() - actualFiles = append(actualFiles, []string{hdr.Name, content}) - i++ - } - if len(actualFiles) != len(expectedFiles) { - t.Fatalf("Number of expected file %d, got %d.", len(expectedFiles), len(actualFiles)) - } - for i := 0; i < len(expectedFiles); i++ { - actual := actualFiles[i] - expected := expectedFiles[i] - if actual[0] != expected[0] { - t.Fatalf("Expected name '%s', Actual name '%s'", expected[0], actual[0]) - } - if actual[1] != expected[1] { - t.Fatalf("Expected content '%s', Actual content '%s'", expected[1], actual[1]) - } - } -} - -func TestGenerateWithContent(t *testing.T) { - archive, err := Generate("file", "content") - if err != nil { - t.Fatal(err) - } - if archive == nil { - t.Fatal("The generated archive should not be nil.") - } - - expectedFiles := [][]string{ - {"file", "content"}, - } - - tr := tar.NewReader(archive) - actualFiles := make([][]string, 0, 10) - i := 0 - for { - hdr, err := tr.Next() - if err == io.EOF { - break - } - if err != nil { - t.Fatal(err) - } - buf := new(bytes.Buffer) - buf.ReadFrom(tr) - content := buf.String() - actualFiles = append(actualFiles, []string{hdr.Name, content}) - i++ - } - if len(actualFiles) != len(expectedFiles) { - t.Fatalf("Number of expected file %d, got %d.", len(expectedFiles), len(actualFiles)) - } - for i := 0; i < len(expectedFiles); i++ { - actual := actualFiles[i] - expected := expectedFiles[i] - if actual[0] != expected[0] { - t.Fatalf("Expected name '%s', Actual name '%s'", expected[0], actual[0]) - } - if actual[1] != expected[1] { - t.Fatalf("Expected content '%s', Actual content '%s'", expected[1], actual[1]) - } - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/fileutils/fileutils_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/fileutils/fileutils_test.go deleted file mode 100644 index 2d584c6676..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/fileutils/fileutils_test.go +++ /dev/null @@ -1,573 +0,0 @@ -package fileutils - -import ( - "io/ioutil" - "os" - "path" - "path/filepath" - "runtime" - "strings" - "testing" -) - -// CopyFile with invalid src -func TestCopyFileWithInvalidSrc(t *testing.T) { - tempFolder, err := ioutil.TempDir("", "docker-fileutils-test") - defer os.RemoveAll(tempFolder) - if err != nil { - t.Fatal(err) - } - bytes, err := CopyFile("/invalid/file/path", path.Join(tempFolder, "dest")) - if err == nil { - t.Fatal("Should have fail to copy an invalid src file") - } - if bytes != 0 { - t.Fatal("Should have written 0 bytes") - } - -} - -// CopyFile with invalid dest -func TestCopyFileWithInvalidDest(t *testing.T) { - tempFolder, err := ioutil.TempDir("", "docker-fileutils-test") - defer os.RemoveAll(tempFolder) - if err != nil { - t.Fatal(err) - } - src := path.Join(tempFolder, "file") - err = ioutil.WriteFile(src, []byte("content"), 0740) - if err != nil { - t.Fatal(err) - } - bytes, err := CopyFile(src, path.Join(tempFolder, "/invalid/dest/path")) - if err == nil { - t.Fatal("Should have fail to copy an invalid src file") - } - if bytes != 0 { - t.Fatal("Should have written 0 bytes") - } - -} - -// CopyFile with same src and dest -func TestCopyFileWithSameSrcAndDest(t *testing.T) { - tempFolder, err := ioutil.TempDir("", "docker-fileutils-test") - defer os.RemoveAll(tempFolder) - if err != nil { - t.Fatal(err) - } - file := path.Join(tempFolder, "file") - err = ioutil.WriteFile(file, []byte("content"), 0740) - if err != nil { - t.Fatal(err) - } - bytes, err := CopyFile(file, file) - if err != nil { - t.Fatal(err) - } - if bytes != 0 { - t.Fatal("Should have written 0 bytes as it is the same file.") - } -} - -// CopyFile with same src and dest but path is different and not clean -func TestCopyFileWithSameSrcAndDestWithPathNameDifferent(t *testing.T) { - tempFolder, err := ioutil.TempDir("", "docker-fileutils-test") - defer os.RemoveAll(tempFolder) - if err != nil { - t.Fatal(err) - } - testFolder := path.Join(tempFolder, "test") - err = os.MkdirAll(testFolder, 0740) - if err != nil { - t.Fatal(err) - } - file := path.Join(testFolder, "file") - sameFile := testFolder + "/../test/file" - err = ioutil.WriteFile(file, []byte("content"), 0740) - if err != nil { - t.Fatal(err) - } - bytes, err := CopyFile(file, sameFile) - if err != nil { - t.Fatal(err) - } - if bytes != 0 { - t.Fatal("Should have written 0 bytes as it is the same file.") - } -} - -func TestCopyFile(t *testing.T) { - tempFolder, err := ioutil.TempDir("", "docker-fileutils-test") - defer os.RemoveAll(tempFolder) - if err != nil { - t.Fatal(err) - } - src := path.Join(tempFolder, "src") - dest := path.Join(tempFolder, "dest") - ioutil.WriteFile(src, []byte("content"), 0777) - ioutil.WriteFile(dest, []byte("destContent"), 0777) - bytes, err := CopyFile(src, dest) - if err != nil { - t.Fatal(err) - } - if bytes != 7 { - t.Fatalf("Should have written %d bytes but wrote %d", 7, bytes) - } - actual, err := ioutil.ReadFile(dest) - if err != nil { - t.Fatal(err) - } - if string(actual) != "content" { - t.Fatalf("Dest content was '%s', expected '%s'", string(actual), "content") - } -} - -// Reading a symlink to a directory must return the directory -func TestReadSymlinkedDirectoryExistingDirectory(t *testing.T) { - var err error - if err = os.Mkdir("/tmp/testReadSymlinkToExistingDirectory", 0777); err != nil { - t.Errorf("failed to create directory: %s", err) - } - - if err = os.Symlink("/tmp/testReadSymlinkToExistingDirectory", "/tmp/dirLinkTest"); err != nil { - t.Errorf("failed to create symlink: %s", err) - } - - var path string - if path, err = ReadSymlinkedDirectory("/tmp/dirLinkTest"); err != nil { - t.Fatalf("failed to read symlink to directory: %s", err) - } - - if path != "/tmp/testReadSymlinkToExistingDirectory" { - t.Fatalf("symlink returned unexpected directory: %s", path) - } - - if err = os.Remove("/tmp/testReadSymlinkToExistingDirectory"); err != nil { - t.Errorf("failed to remove temporary directory: %s", err) - } - - if err = os.Remove("/tmp/dirLinkTest"); err != nil { - t.Errorf("failed to remove symlink: %s", err) - } -} - -// Reading a non-existing symlink must fail -func TestReadSymlinkedDirectoryNonExistingSymlink(t *testing.T) { - var path string - var err error - if path, err = ReadSymlinkedDirectory("/tmp/test/foo/Non/ExistingPath"); err == nil { - t.Fatalf("error expected for non-existing symlink") - } - - if path != "" { - t.Fatalf("expected empty path, but '%s' was returned", path) - } -} - -// Reading a symlink to a file must fail -func TestReadSymlinkedDirectoryToFile(t *testing.T) { - var err error - var file *os.File - - if file, err = os.Create("/tmp/testReadSymlinkToFile"); err != nil { - t.Fatalf("failed to create file: %s", err) - } - - file.Close() - - if err = os.Symlink("/tmp/testReadSymlinkToFile", "/tmp/fileLinkTest"); err != nil { - t.Errorf("failed to create symlink: %s", err) - } - - var path string - if path, err = ReadSymlinkedDirectory("/tmp/fileLinkTest"); err == nil { - t.Fatalf("ReadSymlinkedDirectory on a symlink to a file should've failed") - } - - if path != "" { - t.Fatalf("path should've been empty: %s", path) - } - - if err = os.Remove("/tmp/testReadSymlinkToFile"); err != nil { - t.Errorf("failed to remove file: %s", err) - } - - if err = os.Remove("/tmp/fileLinkTest"); err != nil { - t.Errorf("failed to remove symlink: %s", err) - } -} - -func TestWildcardMatches(t *testing.T) { - match, _ := Matches("fileutils.go", []string{"*"}) - if match != true { - t.Errorf("failed to get a wildcard match, got %v", match) - } -} - -// A simple pattern match should return true. -func TestPatternMatches(t *testing.T) { - match, _ := Matches("fileutils.go", []string{"*.go"}) - if match != true { - t.Errorf("failed to get a match, got %v", match) - } -} - -// An exclusion followed by an inclusion should return true. -func TestExclusionPatternMatchesPatternBefore(t *testing.T) { - match, _ := Matches("fileutils.go", []string{"!fileutils.go", "*.go"}) - if match != true { - t.Errorf("failed to get true match on exclusion pattern, got %v", match) - } -} - -// A folder pattern followed by an exception should return false. -func TestPatternMatchesFolderExclusions(t *testing.T) { - match, _ := Matches("docs/README.md", []string{"docs", "!docs/README.md"}) - if match != false { - t.Errorf("failed to get a false match on exclusion pattern, got %v", match) - } -} - -// A folder pattern followed by an exception should return false. -func TestPatternMatchesFolderWithSlashExclusions(t *testing.T) { - match, _ := Matches("docs/README.md", []string{"docs/", "!docs/README.md"}) - if match != false { - t.Errorf("failed to get a false match on exclusion pattern, got %v", match) - } -} - -// A folder pattern followed by an exception should return false. -func TestPatternMatchesFolderWildcardExclusions(t *testing.T) { - match, _ := Matches("docs/README.md", []string{"docs/*", "!docs/README.md"}) - if match != false { - t.Errorf("failed to get a false match on exclusion pattern, got %v", match) - } -} - -// A pattern followed by an exclusion should return false. -func TestExclusionPatternMatchesPatternAfter(t *testing.T) { - match, _ := Matches("fileutils.go", []string{"*.go", "!fileutils.go"}) - if match != false { - t.Errorf("failed to get false match on exclusion pattern, got %v", match) - } -} - -// A filename evaluating to . should return false. -func TestExclusionPatternMatchesWholeDirectory(t *testing.T) { - match, _ := Matches(".", []string{"*.go"}) - if match != false { - t.Errorf("failed to get false match on ., got %v", match) - } -} - -// A single ! pattern should return an error. -func TestSingleExclamationError(t *testing.T) { - _, err := Matches("fileutils.go", []string{"!"}) - if err == nil { - t.Errorf("failed to get an error for a single exclamation point, got %v", err) - } -} - -// A string preceded with a ! should return true from Exclusion. -func TestExclusion(t *testing.T) { - exclusion := exclusion("!") - if !exclusion { - t.Errorf("failed to get true for a single !, got %v", exclusion) - } -} - -// Matches with no patterns -func TestMatchesWithNoPatterns(t *testing.T) { - matches, err := Matches("/any/path/there", []string{}) - if err != nil { - t.Fatal(err) - } - if matches { - t.Fatalf("Should not have match anything") - } -} - -// Matches with malformed patterns -func TestMatchesWithMalformedPatterns(t *testing.T) { - matches, err := Matches("/any/path/there", []string{"["}) - if err == nil { - t.Fatal("Should have failed because of a malformed syntax in the pattern") - } - if matches { - t.Fatalf("Should not have match anything") - } -} - -// Test lots of variants of patterns & strings -func TestMatches(t *testing.T) { - tests := []struct { - pattern string - text string - pass bool - }{ - {"**", "file", true}, - {"**", "file/", true}, - {"**/", "file", true}, // weird one - {"**/", "file/", true}, - {"**", "/", true}, - {"**/", "/", true}, - {"**", "dir/file", true}, - {"**/", "dir/file", false}, - {"**", "dir/file/", true}, - {"**/", "dir/file/", true}, - {"**/**", "dir/file", true}, - {"**/**", "dir/file/", true}, - {"dir/**", "dir/file", true}, - {"dir/**", "dir/file/", true}, - {"dir/**", "dir/dir2/file", true}, - {"dir/**", "dir/dir2/file/", true}, - {"**/dir2/*", "dir/dir2/file", true}, - {"**/dir2/*", "dir/dir2/file/", false}, - {"**/dir2/**", "dir/dir2/dir3/file", true}, - {"**/dir2/**", "dir/dir2/dir3/file/", true}, - {"**file", "file", true}, - {"**file", "dir/file", true}, - {"**/file", "dir/file", true}, - {"**file", "dir/dir/file", true}, - {"**/file", "dir/dir/file", true}, - {"**/file*", "dir/dir/file", true}, - {"**/file*", "dir/dir/file.txt", true}, - {"**/file*txt", "dir/dir/file.txt", true}, - {"**/file*.txt", "dir/dir/file.txt", true}, - {"**/file*.txt*", "dir/dir/file.txt", true}, - {"**/**/*.txt", "dir/dir/file.txt", true}, - {"**/**/*.txt2", "dir/dir/file.txt", false}, - {"**/*.txt", "file.txt", true}, - {"**/**/*.txt", "file.txt", true}, - {"a**/*.txt", "a/file.txt", true}, - {"a**/*.txt", "a/dir/file.txt", true}, - {"a**/*.txt", "a/dir/dir/file.txt", true}, - {"a/*.txt", "a/dir/file.txt", false}, - {"a/*.txt", "a/file.txt", true}, - {"a/*.txt**", "a/file.txt", true}, - {"a[b-d]e", "ae", false}, - {"a[b-d]e", "ace", true}, - {"a[b-d]e", "aae", false}, - {"a[^b-d]e", "aze", true}, - {".*", ".foo", true}, - {".*", "foo", false}, - {"abc.def", "abcdef", false}, - {"abc.def", "abc.def", true}, - {"abc.def", "abcZdef", false}, - {"abc?def", "abcZdef", true}, - {"abc?def", "abcdef", false}, - {"a\\*b", "a*b", true}, - {"a\\", "a", false}, - {"a\\", "a\\", false}, - {"a\\\\", "a\\", true}, - {"**/foo/bar", "foo/bar", true}, - {"**/foo/bar", "dir/foo/bar", true}, - {"**/foo/bar", "dir/dir2/foo/bar", true}, - {"abc/**", "abc", false}, - {"abc/**", "abc/def", true}, - {"abc/**", "abc/def/ghi", true}, - } - - for _, test := range tests { - res, _ := regexpMatch(test.pattern, test.text) - if res != test.pass { - t.Fatalf("Failed: %v - res:%v", test, res) - } - } -} - -// An empty string should return true from Empty. -func TestEmpty(t *testing.T) { - empty := empty("") - if !empty { - t.Errorf("failed to get true for an empty string, got %v", empty) - } -} - -func TestCleanPatterns(t *testing.T) { - cleaned, _, _, _ := CleanPatterns([]string{"docs", "config"}) - if len(cleaned) != 2 { - t.Errorf("expected 2 element slice, got %v", len(cleaned)) - } -} - -func TestCleanPatternsStripEmptyPatterns(t *testing.T) { - cleaned, _, _, _ := CleanPatterns([]string{"docs", "config", ""}) - if len(cleaned) != 2 { - t.Errorf("expected 2 element slice, got %v", len(cleaned)) - } -} - -func TestCleanPatternsExceptionFlag(t *testing.T) { - _, _, exceptions, _ := CleanPatterns([]string{"docs", "!docs/README.md"}) - if !exceptions { - t.Errorf("expected exceptions to be true, got %v", exceptions) - } -} - -func TestCleanPatternsLeadingSpaceTrimmed(t *testing.T) { - _, _, exceptions, _ := CleanPatterns([]string{"docs", " !docs/README.md"}) - if !exceptions { - t.Errorf("expected exceptions to be true, got %v", exceptions) - } -} - -func TestCleanPatternsTrailingSpaceTrimmed(t *testing.T) { - _, _, exceptions, _ := CleanPatterns([]string{"docs", "!docs/README.md "}) - if !exceptions { - t.Errorf("expected exceptions to be true, got %v", exceptions) - } -} - -func TestCleanPatternsErrorSingleException(t *testing.T) { - _, _, _, err := CleanPatterns([]string{"!"}) - if err == nil { - t.Errorf("expected error on single exclamation point, got %v", err) - } -} - -func TestCleanPatternsFolderSplit(t *testing.T) { - _, dirs, _, _ := CleanPatterns([]string{"docs/config/CONFIG.md"}) - if dirs[0][0] != "docs" { - t.Errorf("expected first element in dirs slice to be docs, got %v", dirs[0][1]) - } - if dirs[0][1] != "config" { - t.Errorf("expected first element in dirs slice to be config, got %v", dirs[0][1]) - } -} - -func TestCreateIfNotExistsDir(t *testing.T) { - tempFolder, err := ioutil.TempDir("", "docker-fileutils-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tempFolder) - - folderToCreate := filepath.Join(tempFolder, "tocreate") - - if err := CreateIfNotExists(folderToCreate, true); err != nil { - t.Fatal(err) - } - fileinfo, err := os.Stat(folderToCreate) - if err != nil { - t.Fatalf("Should have create a folder, got %v", err) - } - - if !fileinfo.IsDir() { - t.Fatalf("Should have been a dir, seems it's not") - } -} - -func TestCreateIfNotExistsFile(t *testing.T) { - tempFolder, err := ioutil.TempDir("", "docker-fileutils-test") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tempFolder) - - fileToCreate := filepath.Join(tempFolder, "file/to/create") - - if err := CreateIfNotExists(fileToCreate, false); err != nil { - t.Fatal(err) - } - fileinfo, err := os.Stat(fileToCreate) - if err != nil { - t.Fatalf("Should have create a file, got %v", err) - } - - if fileinfo.IsDir() { - t.Fatalf("Should have been a file, seems it's not") - } -} - -// These matchTests are stolen from go's filepath Match tests. -type matchTest struct { - pattern, s string - match bool - err error -} - -var matchTests = []matchTest{ - {"abc", "abc", true, nil}, - {"*", "abc", true, nil}, - {"*c", "abc", true, nil}, - {"a*", "a", true, nil}, - {"a*", "abc", true, nil}, - {"a*", "ab/c", false, nil}, - {"a*/b", "abc/b", true, nil}, - {"a*/b", "a/c/b", false, nil}, - {"a*b*c*d*e*/f", "axbxcxdxe/f", true, nil}, - {"a*b*c*d*e*/f", "axbxcxdxexxx/f", true, nil}, - {"a*b*c*d*e*/f", "axbxcxdxe/xxx/f", false, nil}, - {"a*b*c*d*e*/f", "axbxcxdxexxx/fff", false, nil}, - {"a*b?c*x", "abxbbxdbxebxczzx", true, nil}, - {"a*b?c*x", "abxbbxdbxebxczzy", false, nil}, - {"ab[c]", "abc", true, nil}, - {"ab[b-d]", "abc", true, nil}, - {"ab[e-g]", "abc", false, nil}, - {"ab[^c]", "abc", false, nil}, - {"ab[^b-d]", "abc", false, nil}, - {"ab[^e-g]", "abc", true, nil}, - {"a\\*b", "a*b", true, nil}, - {"a\\*b", "ab", false, nil}, - {"a?b", "a☺b", true, nil}, - {"a[^a]b", "a☺b", true, nil}, - {"a???b", "a☺b", false, nil}, - {"a[^a][^a][^a]b", "a☺b", false, nil}, - {"[a-ζ]*", "α", true, nil}, - {"*[a-ζ]", "A", false, nil}, - {"a?b", "a/b", false, nil}, - {"a*b", "a/b", false, nil}, - {"[\\]a]", "]", true, nil}, - {"[\\-]", "-", true, nil}, - {"[x\\-]", "x", true, nil}, - {"[x\\-]", "-", true, nil}, - {"[x\\-]", "z", false, nil}, - {"[\\-x]", "x", true, nil}, - {"[\\-x]", "-", true, nil}, - {"[\\-x]", "a", false, nil}, - {"[]a]", "]", false, filepath.ErrBadPattern}, - {"[-]", "-", false, filepath.ErrBadPattern}, - {"[x-]", "x", false, filepath.ErrBadPattern}, - {"[x-]", "-", false, filepath.ErrBadPattern}, - {"[x-]", "z", false, filepath.ErrBadPattern}, - {"[-x]", "x", false, filepath.ErrBadPattern}, - {"[-x]", "-", false, filepath.ErrBadPattern}, - {"[-x]", "a", false, filepath.ErrBadPattern}, - {"\\", "a", false, filepath.ErrBadPattern}, - {"[a-b-c]", "a", false, filepath.ErrBadPattern}, - {"[", "a", false, filepath.ErrBadPattern}, - {"[^", "a", false, filepath.ErrBadPattern}, - {"[^bc", "a", false, filepath.ErrBadPattern}, - {"a[", "a", false, filepath.ErrBadPattern}, // was nil but IMO its wrong - {"a[", "ab", false, filepath.ErrBadPattern}, - {"*x", "xxx", true, nil}, -} - -func errp(e error) string { - if e == nil { - return "" - } - return e.Error() -} - -// TestMatch test's our version of filepath.Match, called regexpMatch. -func TestMatch(t *testing.T) { - for _, tt := range matchTests { - pattern := tt.pattern - s := tt.s - if runtime.GOOS == "windows" { - if strings.Index(pattern, "\\") >= 0 { - // no escape allowed on windows. - continue - } - pattern = filepath.Clean(pattern) - s = filepath.Clean(s) - } - ok, err := regexpMatch(pattern, s) - if ok != tt.match || err != tt.err { - t.Fatalf("Match(%#q, %#q) = %v, %q want %v, %q", pattern, s, ok, errp(err), tt.match, errp(tt.err)) - } - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/homedir/homedir_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/homedir/homedir_test.go deleted file mode 100644 index 7a95cb2bd7..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/homedir/homedir_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package homedir - -import ( - "path/filepath" - "testing" -) - -func TestGet(t *testing.T) { - home := Get() - if home == "" { - t.Fatal("returned home directory is empty") - } - - if !filepath.IsAbs(home) { - t.Fatalf("returned path is not absolute: %s", home) - } -} - -func TestGetShortcutString(t *testing.T) { - shortcut := GetShortcutString() - if shortcut == "" { - t.Fatal("returned shortcut string is empty") - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/idtools/idtools_unix_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/idtools/idtools_unix_test.go deleted file mode 100644 index 55b338c96e..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/idtools/idtools_unix_test.go +++ /dev/null @@ -1,243 +0,0 @@ -// +build !windows - -package idtools - -import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - "syscall" - "testing" -) - -type node struct { - uid int - gid int -} - -func TestMkdirAllAs(t *testing.T) { - dirName, err := ioutil.TempDir("", "mkdirall") - if err != nil { - t.Fatalf("Couldn't create temp dir: %v", err) - } - defer os.RemoveAll(dirName) - - testTree := map[string]node{ - "usr": {0, 0}, - "usr/bin": {0, 0}, - "lib": {33, 33}, - "lib/x86_64": {45, 45}, - "lib/x86_64/share": {1, 1}, - } - - if err := buildTree(dirName, testTree); err != nil { - t.Fatal(err) - } - - // test adding a directory to a pre-existing dir; only the new dir is owned by the uid/gid - if err := MkdirAllAs(filepath.Join(dirName, "usr", "share"), 0755, 99, 99); err != nil { - t.Fatal(err) - } - testTree["usr/share"] = node{99, 99} - verifyTree, err := readTree(dirName, "") - if err != nil { - t.Fatal(err) - } - if err := compareTrees(testTree, verifyTree); err != nil { - t.Fatal(err) - } - - // test 2-deep new directories--both should be owned by the uid/gid pair - if err := MkdirAllAs(filepath.Join(dirName, "lib", "some", "other"), 0755, 101, 101); err != nil { - t.Fatal(err) - } - testTree["lib/some"] = node{101, 101} - testTree["lib/some/other"] = node{101, 101} - verifyTree, err = readTree(dirName, "") - if err != nil { - t.Fatal(err) - } - if err := compareTrees(testTree, verifyTree); err != nil { - t.Fatal(err) - } - - // test a directory that already exists; should be chowned, but nothing else - if err := MkdirAllAs(filepath.Join(dirName, "usr"), 0755, 102, 102); err != nil { - t.Fatal(err) - } - testTree["usr"] = node{102, 102} - verifyTree, err = readTree(dirName, "") - if err != nil { - t.Fatal(err) - } - if err := compareTrees(testTree, verifyTree); err != nil { - t.Fatal(err) - } -} - -func TestMkdirAllNewAs(t *testing.T) { - - dirName, err := ioutil.TempDir("", "mkdirnew") - if err != nil { - t.Fatalf("Couldn't create temp dir: %v", err) - } - defer os.RemoveAll(dirName) - - testTree := map[string]node{ - "usr": {0, 0}, - "usr/bin": {0, 0}, - "lib": {33, 33}, - "lib/x86_64": {45, 45}, - "lib/x86_64/share": {1, 1}, - } - - if err := buildTree(dirName, testTree); err != nil { - t.Fatal(err) - } - - // test adding a directory to a pre-existing dir; only the new dir is owned by the uid/gid - if err := MkdirAllNewAs(filepath.Join(dirName, "usr", "share"), 0755, 99, 99); err != nil { - t.Fatal(err) - } - testTree["usr/share"] = node{99, 99} - verifyTree, err := readTree(dirName, "") - if err != nil { - t.Fatal(err) - } - if err := compareTrees(testTree, verifyTree); err != nil { - t.Fatal(err) - } - - // test 2-deep new directories--both should be owned by the uid/gid pair - if err := MkdirAllNewAs(filepath.Join(dirName, "lib", "some", "other"), 0755, 101, 101); err != nil { - t.Fatal(err) - } - testTree["lib/some"] = node{101, 101} - testTree["lib/some/other"] = node{101, 101} - verifyTree, err = readTree(dirName, "") - if err != nil { - t.Fatal(err) - } - if err := compareTrees(testTree, verifyTree); err != nil { - t.Fatal(err) - } - - // test a directory that already exists; should NOT be chowned - if err := MkdirAllNewAs(filepath.Join(dirName, "usr"), 0755, 102, 102); err != nil { - t.Fatal(err) - } - verifyTree, err = readTree(dirName, "") - if err != nil { - t.Fatal(err) - } - if err := compareTrees(testTree, verifyTree); err != nil { - t.Fatal(err) - } -} - -func TestMkdirAs(t *testing.T) { - - dirName, err := ioutil.TempDir("", "mkdir") - if err != nil { - t.Fatalf("Couldn't create temp dir: %v", err) - } - defer os.RemoveAll(dirName) - - testTree := map[string]node{ - "usr": {0, 0}, - } - if err := buildTree(dirName, testTree); err != nil { - t.Fatal(err) - } - - // test a directory that already exists; should just chown to the requested uid/gid - if err := MkdirAs(filepath.Join(dirName, "usr"), 0755, 99, 99); err != nil { - t.Fatal(err) - } - testTree["usr"] = node{99, 99} - verifyTree, err := readTree(dirName, "") - if err != nil { - t.Fatal(err) - } - if err := compareTrees(testTree, verifyTree); err != nil { - t.Fatal(err) - } - - // create a subdir under a dir which doesn't exist--should fail - if err := MkdirAs(filepath.Join(dirName, "usr", "bin", "subdir"), 0755, 102, 102); err == nil { - t.Fatalf("Trying to create a directory with Mkdir where the parent doesn't exist should have failed") - } - - // create a subdir under an existing dir; should only change the ownership of the new subdir - if err := MkdirAs(filepath.Join(dirName, "usr", "bin"), 0755, 102, 102); err != nil { - t.Fatal(err) - } - testTree["usr/bin"] = node{102, 102} - verifyTree, err = readTree(dirName, "") - if err != nil { - t.Fatal(err) - } - if err := compareTrees(testTree, verifyTree); err != nil { - t.Fatal(err) - } -} - -func buildTree(base string, tree map[string]node) error { - for path, node := range tree { - fullPath := filepath.Join(base, path) - if err := os.MkdirAll(fullPath, 0755); err != nil { - return fmt.Errorf("Couldn't create path: %s; error: %v", fullPath, err) - } - if err := os.Chown(fullPath, node.uid, node.gid); err != nil { - return fmt.Errorf("Couldn't chown path: %s; error: %v", fullPath, err) - } - } - return nil -} - -func readTree(base, root string) (map[string]node, error) { - tree := make(map[string]node) - - dirInfos, err := ioutil.ReadDir(base) - if err != nil { - return nil, fmt.Errorf("Couldn't read directory entries for %q: %v", base, err) - } - - for _, info := range dirInfos { - s := &syscall.Stat_t{} - if err := syscall.Stat(filepath.Join(base, info.Name()), s); err != nil { - return nil, fmt.Errorf("Can't stat file %q: %v", filepath.Join(base, info.Name()), err) - } - tree[filepath.Join(root, info.Name())] = node{int(s.Uid), int(s.Gid)} - if info.IsDir() { - // read the subdirectory - subtree, err := readTree(filepath.Join(base, info.Name()), filepath.Join(root, info.Name())) - if err != nil { - return nil, err - } - for path, nodeinfo := range subtree { - tree[path] = nodeinfo - } - } - } - return tree, nil -} - -func compareTrees(left, right map[string]node) error { - if len(left) != len(right) { - return fmt.Errorf("Trees aren't the same size") - } - for path, nodeLeft := range left { - if nodeRight, ok := right[path]; ok { - if nodeRight.uid != nodeLeft.uid || nodeRight.gid != nodeLeft.gid { - // mismatch - return fmt.Errorf("mismatched ownership for %q: expected: %d:%d, got: %d:%d", path, - nodeLeft.uid, nodeLeft.gid, nodeRight.uid, nodeRight.gid) - } - continue - } - return fmt.Errorf("right tree didn't contain path %q", path) - } - return nil -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/bytespipe_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/bytespipe_test.go deleted file mode 100644 index b051139adf..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/bytespipe_test.go +++ /dev/null @@ -1,158 +0,0 @@ -package ioutils - -import ( - "crypto/sha1" - "encoding/hex" - "math/rand" - "testing" - "time" -) - -func TestBytesPipeRead(t *testing.T) { - buf := NewBytesPipe(nil) - buf.Write([]byte("12")) - buf.Write([]byte("34")) - buf.Write([]byte("56")) - buf.Write([]byte("78")) - buf.Write([]byte("90")) - rd := make([]byte, 4) - n, err := buf.Read(rd) - if err != nil { - t.Fatal(err) - } - if n != 4 { - t.Fatalf("Wrong number of bytes read: %d, should be %d", n, 4) - } - if string(rd) != "1234" { - t.Fatalf("Read %s, but must be %s", rd, "1234") - } - n, err = buf.Read(rd) - if err != nil { - t.Fatal(err) - } - if n != 4 { - t.Fatalf("Wrong number of bytes read: %d, should be %d", n, 4) - } - if string(rd) != "5678" { - t.Fatalf("Read %s, but must be %s", rd, "5679") - } - n, err = buf.Read(rd) - if err != nil { - t.Fatal(err) - } - if n != 2 { - t.Fatalf("Wrong number of bytes read: %d, should be %d", n, 2) - } - if string(rd[:n]) != "90" { - t.Fatalf("Read %s, but must be %s", rd, "90") - } -} - -func TestBytesPipeWrite(t *testing.T) { - buf := NewBytesPipe(nil) - buf.Write([]byte("12")) - buf.Write([]byte("34")) - buf.Write([]byte("56")) - buf.Write([]byte("78")) - buf.Write([]byte("90")) - if string(buf.buf[0]) != "1234567890" { - t.Fatalf("Buffer %s, must be %s", buf.buf, "1234567890") - } -} - -// Write and read in different speeds/chunk sizes and check valid data is read. -func TestBytesPipeWriteRandomChunks(t *testing.T) { - cases := []struct{ iterations, writesPerLoop, readsPerLoop int }{ - {100, 10, 1}, - {1000, 10, 5}, - {1000, 100, 0}, - {1000, 5, 6}, - {10000, 50, 25}, - } - - testMessage := []byte("this is a random string for testing") - // random slice sizes to read and write - writeChunks := []int{25, 35, 15, 20} - readChunks := []int{5, 45, 20, 25} - - for _, c := range cases { - // first pass: write directly to hash - hash := sha1.New() - for i := 0; i < c.iterations*c.writesPerLoop; i++ { - if _, err := hash.Write(testMessage[:writeChunks[i%len(writeChunks)]]); err != nil { - t.Fatal(err) - } - } - expected := hex.EncodeToString(hash.Sum(nil)) - - // write/read through buffer - buf := NewBytesPipe(nil) - hash.Reset() - - done := make(chan struct{}) - - go func() { - // random delay before read starts - <-time.After(time.Duration(rand.Intn(10)) * time.Millisecond) - for i := 0; ; i++ { - p := make([]byte, readChunks[(c.iterations*c.readsPerLoop+i)%len(readChunks)]) - n, _ := buf.Read(p) - if n == 0 { - break - } - hash.Write(p[:n]) - } - - close(done) - }() - - for i := 0; i < c.iterations; i++ { - for w := 0; w < c.writesPerLoop; w++ { - buf.Write(testMessage[:writeChunks[(i*c.writesPerLoop+w)%len(writeChunks)]]) - } - } - buf.Close() - <-done - - actual := hex.EncodeToString(hash.Sum(nil)) - - if expected != actual { - t.Fatalf("BytesPipe returned invalid data. Expected checksum %v, got %v", expected, actual) - } - - } -} - -func BenchmarkBytesPipeWrite(b *testing.B) { - for i := 0; i < b.N; i++ { - readBuf := make([]byte, 1024) - buf := NewBytesPipe(nil) - go func() { - var err error - for err == nil { - _, err = buf.Read(readBuf) - } - }() - for j := 0; j < 1000; j++ { - buf.Write([]byte("pretty short line, because why not?")) - } - buf.Close() - } -} - -func BenchmarkBytesPipeRead(b *testing.B) { - rd := make([]byte, 512) - for i := 0; i < b.N; i++ { - b.StopTimer() - buf := NewBytesPipe(nil) - for j := 0; j < 500; j++ { - buf.Write(make([]byte, 1024)) - } - b.StartTimer() - for j := 0; j < 1000; j++ { - if n, _ := buf.Read(rd); n != 512 { - b.Fatalf("Wrong number of bytes: %d", n) - } - } - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/fmt_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/fmt_test.go deleted file mode 100644 index 8968863296..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/fmt_test.go +++ /dev/null @@ -1,17 +0,0 @@ -package ioutils - -import "testing" - -func TestFprintfIfNotEmpty(t *testing.T) { - wc := NewWriteCounter(&NopWriter{}) - n, _ := FprintfIfNotEmpty(wc, "foo%s", "") - - if wc.Count != 0 || n != 0 { - t.Errorf("Wrong count: %v vs. %v vs. 0", wc.Count, n) - } - - n, _ = FprintfIfNotEmpty(wc, "foo%s", "bar") - if wc.Count != 6 || n != 6 { - t.Errorf("Wrong count: %v vs. %v vs. 6", wc.Count, n) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/multireader_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/multireader_test.go deleted file mode 100644 index de495b56da..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/multireader_test.go +++ /dev/null @@ -1,149 +0,0 @@ -package ioutils - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "os" - "strings" - "testing" -) - -func TestMultiReadSeekerReadAll(t *testing.T) { - str := "hello world" - s1 := strings.NewReader(str + " 1") - s2 := strings.NewReader(str + " 2") - s3 := strings.NewReader(str + " 3") - mr := MultiReadSeeker(s1, s2, s3) - - expectedSize := int64(s1.Len() + s2.Len() + s3.Len()) - - b, err := ioutil.ReadAll(mr) - if err != nil { - t.Fatal(err) - } - - expected := "hello world 1hello world 2hello world 3" - if string(b) != expected { - t.Fatalf("ReadAll failed, got: %q, expected %q", string(b), expected) - } - - size, err := mr.Seek(0, os.SEEK_END) - if err != nil { - t.Fatal(err) - } - if size != expectedSize { - t.Fatalf("reader size does not match, got %d, expected %d", size, expectedSize) - } - - // Reset the position and read again - pos, err := mr.Seek(0, os.SEEK_SET) - if err != nil { - t.Fatal(err) - } - if pos != 0 { - t.Fatalf("expected position to be set to 0, got %d", pos) - } - - b, err = ioutil.ReadAll(mr) - if err != nil { - t.Fatal(err) - } - - if string(b) != expected { - t.Fatalf("ReadAll failed, got: %q, expected %q", string(b), expected) - } -} - -func TestMultiReadSeekerReadEach(t *testing.T) { - str := "hello world" - s1 := strings.NewReader(str + " 1") - s2 := strings.NewReader(str + " 2") - s3 := strings.NewReader(str + " 3") - mr := MultiReadSeeker(s1, s2, s3) - - var totalBytes int64 - for i, s := range []*strings.Reader{s1, s2, s3} { - sLen := int64(s.Len()) - buf := make([]byte, s.Len()) - expected := []byte(fmt.Sprintf("%s %d", str, i+1)) - - if _, err := mr.Read(buf); err != nil && err != io.EOF { - t.Fatal(err) - } - - if !bytes.Equal(buf, expected) { - t.Fatalf("expected %q to be %q", string(buf), string(expected)) - } - - pos, err := mr.Seek(0, os.SEEK_CUR) - if err != nil { - t.Fatalf("iteration: %d, error: %v", i+1, err) - } - - // check that the total bytes read is the current position of the seeker - totalBytes += sLen - if pos != totalBytes { - t.Fatalf("expected current position to be: %d, got: %d, iteration: %d", totalBytes, pos, i+1) - } - - // This tests not only that SEEK_SET and SEEK_CUR give the same values, but that the next iteration is in the expected position as well - newPos, err := mr.Seek(pos, os.SEEK_SET) - if err != nil { - t.Fatal(err) - } - if newPos != pos { - t.Fatalf("expected to get same position when calling SEEK_SET with value from SEEK_CUR, cur: %d, set: %d", pos, newPos) - } - } -} - -func TestMultiReadSeekerReadSpanningChunks(t *testing.T) { - str := "hello world" - s1 := strings.NewReader(str + " 1") - s2 := strings.NewReader(str + " 2") - s3 := strings.NewReader(str + " 3") - mr := MultiReadSeeker(s1, s2, s3) - - buf := make([]byte, s1.Len()+3) - _, err := mr.Read(buf) - if err != nil { - t.Fatal(err) - } - - // expected is the contents of s1 + 3 bytes from s2, ie, the `hel` at the end of this string - expected := "hello world 1hel" - if string(buf) != expected { - t.Fatalf("expected %s to be %s", string(buf), expected) - } -} - -func TestMultiReadSeekerNegativeSeek(t *testing.T) { - str := "hello world" - s1 := strings.NewReader(str + " 1") - s2 := strings.NewReader(str + " 2") - s3 := strings.NewReader(str + " 3") - mr := MultiReadSeeker(s1, s2, s3) - - s1Len := s1.Len() - s2Len := s2.Len() - s3Len := s3.Len() - - s, err := mr.Seek(int64(-1*s3.Len()), os.SEEK_END) - if err != nil { - t.Fatal(err) - } - if s != int64(s1Len+s2Len) { - t.Fatalf("expected %d to be %d", s, s1.Len()+s2.Len()) - } - - buf := make([]byte, s3Len) - if _, err := mr.Read(buf); err != nil && err != io.EOF { - t.Fatal(err) - } - expected := fmt.Sprintf("%s %d", str, 3) - if string(buf) != fmt.Sprintf("%s %d", str, 3) { - t.Fatalf("expected %q to be %q", string(buf), expected) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/readers_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/readers_test.go deleted file mode 100644 index 8f9e03c310..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/readers_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package ioutils - -import ( - "fmt" - "io/ioutil" - "strings" - "testing" - "time" - - "github.com/fsouza/go-dockerclient/external/golang.org/x/net/context" -) - -// Implement io.Reader -type errorReader struct{} - -func (r *errorReader) Read(p []byte) (int, error) { - return 0, fmt.Errorf("Error reader always fail.") -} - -func TestReadCloserWrapperClose(t *testing.T) { - reader := strings.NewReader("A string reader") - wrapper := NewReadCloserWrapper(reader, func() error { - return fmt.Errorf("This will be called when closing") - }) - err := wrapper.Close() - if err == nil || !strings.Contains(err.Error(), "This will be called when closing") { - t.Fatalf("readCloserWrapper should have call the anonymous func and thus, fail.") - } -} - -func TestReaderErrWrapperReadOnError(t *testing.T) { - called := false - reader := &errorReader{} - wrapper := NewReaderErrWrapper(reader, func() { - called = true - }) - _, err := wrapper.Read([]byte{}) - if err == nil || !strings.Contains(err.Error(), "Error reader always fail.") { - t.Fatalf("readErrWrapper should returned an error") - } - if !called { - t.Fatalf("readErrWrapper should have call the anonymous function on failure") - } -} - -func TestReaderErrWrapperRead(t *testing.T) { - reader := strings.NewReader("a string reader.") - wrapper := NewReaderErrWrapper(reader, func() { - t.Fatalf("readErrWrapper should not have called the anonymous function") - }) - // Read 20 byte (should be ok with the string above) - num, err := wrapper.Read(make([]byte, 20)) - if err != nil { - t.Fatal(err) - } - if num != 16 { - t.Fatalf("readerErrWrapper should have read 16 byte, but read %d", num) - } -} - -func TestHashData(t *testing.T) { - reader := strings.NewReader("hash-me") - actual, err := HashData(reader) - if err != nil { - t.Fatal(err) - } - expected := "sha256:4d11186aed035cc624d553e10db358492c84a7cd6b9670d92123c144930450aa" - if actual != expected { - t.Fatalf("Expecting %s, got %s", expected, actual) - } -} - -type perpetualReader struct{} - -func (p *perpetualReader) Read(buf []byte) (n int, err error) { - for i := 0; i != len(buf); i++ { - buf[i] = 'a' - } - return len(buf), nil -} - -func TestCancelReadCloser(t *testing.T) { - ctx, _ := context.WithTimeout(context.Background(), 100*time.Millisecond) - cancelReadCloser := NewCancelReadCloser(ctx, ioutil.NopCloser(&perpetualReader{})) - for { - var buf [128]byte - _, err := cancelReadCloser.Read(buf[:]) - if err == context.DeadlineExceeded { - break - } else if err != nil { - t.Fatalf("got unexpected error: %v", err) - } - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/writers_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/writers_test.go deleted file mode 100644 index 564b1cd4f5..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/writers_test.go +++ /dev/null @@ -1,65 +0,0 @@ -package ioutils - -import ( - "bytes" - "strings" - "testing" -) - -func TestWriteCloserWrapperClose(t *testing.T) { - called := false - writer := bytes.NewBuffer([]byte{}) - wrapper := NewWriteCloserWrapper(writer, func() error { - called = true - return nil - }) - if err := wrapper.Close(); err != nil { - t.Fatal(err) - } - if !called { - t.Fatalf("writeCloserWrapper should have call the anonymous function.") - } -} - -func TestNopWriteCloser(t *testing.T) { - writer := bytes.NewBuffer([]byte{}) - wrapper := NopWriteCloser(writer) - if err := wrapper.Close(); err != nil { - t.Fatal("NopWriteCloser always return nil on Close.") - } - -} - -func TestNopWriter(t *testing.T) { - nw := &NopWriter{} - l, err := nw.Write([]byte{'c'}) - if err != nil { - t.Fatal(err) - } - if l != 1 { - t.Fatalf("Expected 1 got %d", l) - } -} - -func TestWriteCounter(t *testing.T) { - dummy1 := "This is a dummy string." - dummy2 := "This is another dummy string." - totalLength := int64(len(dummy1) + len(dummy2)) - - reader1 := strings.NewReader(dummy1) - reader2 := strings.NewReader(dummy2) - - var buffer bytes.Buffer - wc := NewWriteCounter(&buffer) - - reader1.WriteTo(wc) - reader2.WriteTo(wc) - - if wc.Count != totalLength { - t.Errorf("Wrong count: %d vs. %d", wc.Count, totalLength) - } - - if buffer.String() != dummy1+dummy2 { - t.Error("Wrong message written") - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/longpath/longpath_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/longpath/longpath_test.go deleted file mode 100644 index 01865eff09..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/longpath/longpath_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package longpath - -import ( - "strings" - "testing" -) - -func TestStandardLongPath(t *testing.T) { - c := `C:\simple\path` - longC := AddPrefix(c) - if !strings.EqualFold(longC, `\\?\C:\simple\path`) { - t.Errorf("Wrong long path returned. Original = %s ; Long = %s", c, longC) - } -} - -func TestUNCLongPath(t *testing.T) { - c := `\\server\share\path` - longC := AddPrefix(c) - if !strings.EqualFold(longC, `\\?\UNC\server\share\path`) { - t.Errorf("Wrong UNC long path returned. Original = %s ; Long = %s", c, longC) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/pools/pools_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/pools/pools_test.go deleted file mode 100644 index 78689800b4..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/pools/pools_test.go +++ /dev/null @@ -1,162 +0,0 @@ -package pools - -import ( - "bufio" - "bytes" - "io" - "strings" - "testing" -) - -func TestBufioReaderPoolGetWithNoReaderShouldCreateOne(t *testing.T) { - reader := BufioReader32KPool.Get(nil) - if reader == nil { - t.Fatalf("BufioReaderPool should have create a bufio.Reader but did not.") - } -} - -func TestBufioReaderPoolPutAndGet(t *testing.T) { - sr := bufio.NewReader(strings.NewReader("foobar")) - reader := BufioReader32KPool.Get(sr) - if reader == nil { - t.Fatalf("BufioReaderPool should not return a nil reader.") - } - // verify the first 3 byte - buf1 := make([]byte, 3) - _, err := reader.Read(buf1) - if err != nil { - t.Fatal(err) - } - if actual := string(buf1); actual != "foo" { - t.Fatalf("The first letter should have been 'foo' but was %v", actual) - } - BufioReader32KPool.Put(reader) - // Try to read the next 3 bytes - _, err = sr.Read(make([]byte, 3)) - if err == nil || err != io.EOF { - t.Fatalf("The buffer should have been empty, issue an EOF error.") - } -} - -type simpleReaderCloser struct { - io.Reader - closed bool -} - -func (r *simpleReaderCloser) Close() error { - r.closed = true - return nil -} - -func TestNewReadCloserWrapperWithAReadCloser(t *testing.T) { - br := bufio.NewReader(strings.NewReader("")) - sr := &simpleReaderCloser{ - Reader: strings.NewReader("foobar"), - closed: false, - } - reader := BufioReader32KPool.NewReadCloserWrapper(br, sr) - if reader == nil { - t.Fatalf("NewReadCloserWrapper should not return a nil reader.") - } - // Verify the content of reader - buf := make([]byte, 3) - _, err := reader.Read(buf) - if err != nil { - t.Fatal(err) - } - if actual := string(buf); actual != "foo" { - t.Fatalf("The first 3 letter should have been 'foo' but were %v", actual) - } - reader.Close() - // Read 3 more bytes "bar" - _, err = reader.Read(buf) - if err != nil { - t.Fatal(err) - } - if actual := string(buf); actual != "bar" { - t.Fatalf("The first 3 letter should have been 'bar' but were %v", actual) - } - if !sr.closed { - t.Fatalf("The ReaderCloser should have been closed, it is not.") - } -} - -func TestBufioWriterPoolGetWithNoReaderShouldCreateOne(t *testing.T) { - writer := BufioWriter32KPool.Get(nil) - if writer == nil { - t.Fatalf("BufioWriterPool should have create a bufio.Writer but did not.") - } -} - -func TestBufioWriterPoolPutAndGet(t *testing.T) { - buf := new(bytes.Buffer) - bw := bufio.NewWriter(buf) - writer := BufioWriter32KPool.Get(bw) - if writer == nil { - t.Fatalf("BufioReaderPool should not return a nil writer.") - } - written, err := writer.Write([]byte("foobar")) - if err != nil { - t.Fatal(err) - } - if written != 6 { - t.Fatalf("Should have written 6 bytes, but wrote %v bytes", written) - } - // Make sure we Flush all the way ? - writer.Flush() - bw.Flush() - if len(buf.Bytes()) != 6 { - t.Fatalf("The buffer should contain 6 bytes ('foobar') but contains %v ('%v')", buf.Bytes(), string(buf.Bytes())) - } - // Reset the buffer - buf.Reset() - BufioWriter32KPool.Put(writer) - // Try to write something - written, err = writer.Write([]byte("barfoo")) - if err != nil { - t.Fatal(err) - } - // If we now try to flush it, it should panic (the writer is nil) - // recover it - defer func() { - if r := recover(); r == nil { - t.Fatal("Trying to flush the writter should have 'paniced', did not.") - } - }() - writer.Flush() -} - -type simpleWriterCloser struct { - io.Writer - closed bool -} - -func (r *simpleWriterCloser) Close() error { - r.closed = true - return nil -} - -func TestNewWriteCloserWrapperWithAWriteCloser(t *testing.T) { - buf := new(bytes.Buffer) - bw := bufio.NewWriter(buf) - sw := &simpleWriterCloser{ - Writer: new(bytes.Buffer), - closed: false, - } - bw.Flush() - writer := BufioWriter32KPool.NewWriteCloserWrapper(bw, sw) - if writer == nil { - t.Fatalf("BufioReaderPool should not return a nil writer.") - } - written, err := writer.Write([]byte("foobar")) - if err != nil { - t.Fatal(err) - } - if written != 6 { - t.Fatalf("Should have written 6 bytes, but wrote %v bytes", written) - } - writer.Close() - if !sw.closed { - t.Fatalf("The ReaderCloser should have been closed, it is not.") - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/stdcopy/stdcopy_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/stdcopy/stdcopy_test.go deleted file mode 100644 index 88d88d41e6..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/stdcopy/stdcopy_test.go +++ /dev/null @@ -1,261 +0,0 @@ -package stdcopy - -import ( - "bytes" - "errors" - "io" - "io/ioutil" - "strings" - "testing" -) - -func TestNewStdWriter(t *testing.T) { - writer := NewStdWriter(ioutil.Discard, Stdout) - if writer == nil { - t.Fatalf("NewStdWriter with an invalid StdType should not return nil.") - } -} - -func TestWriteWithUnitializedStdWriter(t *testing.T) { - writer := StdWriter{ - Writer: nil, - prefix: Stdout, - sizeBuf: make([]byte, 4), - } - n, err := writer.Write([]byte("Something here")) - if n != 0 || err == nil { - t.Fatalf("Should fail when given an uncomplete or uninitialized StdWriter") - } -} - -func TestWriteWithNilBytes(t *testing.T) { - writer := NewStdWriter(ioutil.Discard, Stdout) - n, err := writer.Write(nil) - if err != nil { - t.Fatalf("Shouldn't have fail when given no data") - } - if n > 0 { - t.Fatalf("Write should have written 0 byte, but has written %d", n) - } -} - -func TestWrite(t *testing.T) { - writer := NewStdWriter(ioutil.Discard, Stdout) - data := []byte("Test StdWrite.Write") - n, err := writer.Write(data) - if err != nil { - t.Fatalf("Error while writing with StdWrite") - } - if n != len(data) { - t.Fatalf("Write should have written %d byte but wrote %d.", len(data), n) - } -} - -type errWriter struct { - n int - err error -} - -func (f *errWriter) Write(buf []byte) (int, error) { - return f.n, f.err -} - -func TestWriteWithWriterError(t *testing.T) { - expectedError := errors.New("expected") - expectedReturnedBytes := 10 - writer := NewStdWriter(&errWriter{ - n: stdWriterPrefixLen + expectedReturnedBytes, - err: expectedError}, Stdout) - data := []byte("This won't get written, sigh") - n, err := writer.Write(data) - if err != expectedError { - t.Fatalf("Didn't get expected error.") - } - if n != expectedReturnedBytes { - t.Fatalf("Didn't get expected writen bytes %d, got %d.", - expectedReturnedBytes, n) - } -} - -func TestWriteDoesNotReturnNegativeWrittenBytes(t *testing.T) { - writer := NewStdWriter(&errWriter{n: -1}, Stdout) - data := []byte("This won't get written, sigh") - actual, _ := writer.Write(data) - if actual != 0 { - t.Fatalf("Expected returned written bytes equal to 0, got %d", actual) - } -} - -func getSrcBuffer(stdOutBytes, stdErrBytes []byte) (buffer *bytes.Buffer, err error) { - buffer = new(bytes.Buffer) - dstOut := NewStdWriter(buffer, Stdout) - _, err = dstOut.Write(stdOutBytes) - if err != nil { - return - } - dstErr := NewStdWriter(buffer, Stderr) - _, err = dstErr.Write(stdErrBytes) - return -} - -func TestStdCopyWriteAndRead(t *testing.T) { - stdOutBytes := []byte(strings.Repeat("o", startingBufLen)) - stdErrBytes := []byte(strings.Repeat("e", startingBufLen)) - buffer, err := getSrcBuffer(stdOutBytes, stdErrBytes) - if err != nil { - t.Fatal(err) - } - written, err := StdCopy(ioutil.Discard, ioutil.Discard, buffer) - if err != nil { - t.Fatal(err) - } - expectedTotalWritten := len(stdOutBytes) + len(stdErrBytes) - if written != int64(expectedTotalWritten) { - t.Fatalf("Expected to have total of %d bytes written, got %d", expectedTotalWritten, written) - } -} - -type customReader struct { - n int - err error - totalCalls int - correctCalls int - src *bytes.Buffer -} - -func (f *customReader) Read(buf []byte) (int, error) { - f.totalCalls++ - if f.totalCalls <= f.correctCalls { - return f.src.Read(buf) - } - return f.n, f.err -} - -func TestStdCopyReturnsErrorReadingHeader(t *testing.T) { - expectedError := errors.New("error") - reader := &customReader{ - err: expectedError} - written, err := StdCopy(ioutil.Discard, ioutil.Discard, reader) - if written != 0 { - t.Fatalf("Expected 0 bytes read, got %d", written) - } - if err != expectedError { - t.Fatalf("Didn't get expected error") - } -} - -func TestStdCopyReturnsErrorReadingFrame(t *testing.T) { - expectedError := errors.New("error") - stdOutBytes := []byte(strings.Repeat("o", startingBufLen)) - stdErrBytes := []byte(strings.Repeat("e", startingBufLen)) - buffer, err := getSrcBuffer(stdOutBytes, stdErrBytes) - if err != nil { - t.Fatal(err) - } - reader := &customReader{ - correctCalls: 1, - n: stdWriterPrefixLen + 1, - err: expectedError, - src: buffer} - written, err := StdCopy(ioutil.Discard, ioutil.Discard, reader) - if written != 0 { - t.Fatalf("Expected 0 bytes read, got %d", written) - } - if err != expectedError { - t.Fatalf("Didn't get expected error") - } -} - -func TestStdCopyDetectsCorruptedFrame(t *testing.T) { - stdOutBytes := []byte(strings.Repeat("o", startingBufLen)) - stdErrBytes := []byte(strings.Repeat("e", startingBufLen)) - buffer, err := getSrcBuffer(stdOutBytes, stdErrBytes) - if err != nil { - t.Fatal(err) - } - reader := &customReader{ - correctCalls: 1, - n: stdWriterPrefixLen + 1, - err: io.EOF, - src: buffer} - written, err := StdCopy(ioutil.Discard, ioutil.Discard, reader) - if written != startingBufLen { - t.Fatalf("Expected 0 bytes read, got %d", written) - } - if err != nil { - t.Fatal("Didn't get nil error") - } -} - -func TestStdCopyWithInvalidInputHeader(t *testing.T) { - dstOut := NewStdWriter(ioutil.Discard, Stdout) - dstErr := NewStdWriter(ioutil.Discard, Stderr) - src := strings.NewReader("Invalid input") - _, err := StdCopy(dstOut, dstErr, src) - if err == nil { - t.Fatal("StdCopy with invalid input header should fail.") - } -} - -func TestStdCopyWithCorruptedPrefix(t *testing.T) { - data := []byte{0x01, 0x02, 0x03} - src := bytes.NewReader(data) - written, err := StdCopy(nil, nil, src) - if err != nil { - t.Fatalf("StdCopy should not return an error with corrupted prefix.") - } - if written != 0 { - t.Fatalf("StdCopy should have written 0, but has written %d", written) - } -} - -func TestStdCopyReturnsWriteErrors(t *testing.T) { - stdOutBytes := []byte(strings.Repeat("o", startingBufLen)) - stdErrBytes := []byte(strings.Repeat("e", startingBufLen)) - buffer, err := getSrcBuffer(stdOutBytes, stdErrBytes) - if err != nil { - t.Fatal(err) - } - expectedError := errors.New("expected") - - dstOut := &errWriter{err: expectedError} - - written, err := StdCopy(dstOut, ioutil.Discard, buffer) - if written != 0 { - t.Fatalf("StdCopy should have written 0, but has written %d", written) - } - if err != expectedError { - t.Fatalf("Didn't get expected error, got %v", err) - } -} - -func TestStdCopyDetectsNotFullyWrittenFrames(t *testing.T) { - stdOutBytes := []byte(strings.Repeat("o", startingBufLen)) - stdErrBytes := []byte(strings.Repeat("e", startingBufLen)) - buffer, err := getSrcBuffer(stdOutBytes, stdErrBytes) - if err != nil { - t.Fatal(err) - } - dstOut := &errWriter{n: startingBufLen - 10} - - written, err := StdCopy(dstOut, ioutil.Discard, buffer) - if written != 0 { - t.Fatalf("StdCopy should have return 0 written bytes, but returned %d", written) - } - if err != io.ErrShortWrite { - t.Fatalf("Didn't get expected io.ErrShortWrite error") - } -} - -func BenchmarkWrite(b *testing.B) { - w := NewStdWriter(ioutil.Discard, Stdout) - data := []byte("Test line for testing stdwriter performance\n") - data = bytes.Repeat(data, 100) - b.SetBytes(int64(len(data))) - b.ResetTimer() - for i := 0; i < b.N; i++ { - if _, err := w.Write(data); err != nil { - b.Fatal(err) - } - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/chtimes_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/chtimes_test.go deleted file mode 100644 index 5c87df32a2..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/chtimes_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package system - -import ( - "io/ioutil" - "os" - "path/filepath" - "testing" - "time" -) - -// prepareTempFile creates a temporary file in a temporary directory. -func prepareTempFile(t *testing.T) (string, string) { - dir, err := ioutil.TempDir("", "docker-system-test") - if err != nil { - t.Fatal(err) - } - - file := filepath.Join(dir, "exist") - if err := ioutil.WriteFile(file, []byte("hello"), 0644); err != nil { - t.Fatal(err) - } - return file, dir -} - -// TestChtimes tests Chtimes on a tempfile. Test only mTime, because aTime is OS dependent -func TestChtimes(t *testing.T) { - file, dir := prepareTempFile(t) - defer os.RemoveAll(dir) - - beforeUnixEpochTime := time.Unix(0, 0).Add(-100 * time.Second) - unixEpochTime := time.Unix(0, 0) - afterUnixEpochTime := time.Unix(100, 0) - unixMaxTime := maxTime - - // Test both aTime and mTime set to Unix Epoch - Chtimes(file, unixEpochTime, unixEpochTime) - - f, err := os.Stat(file) - if err != nil { - t.Fatal(err) - } - - if f.ModTime() != unixEpochTime { - t.Fatalf("Expected: %s, got: %s", unixEpochTime, f.ModTime()) - } - - // Test aTime before Unix Epoch and mTime set to Unix Epoch - Chtimes(file, beforeUnixEpochTime, unixEpochTime) - - f, err = os.Stat(file) - if err != nil { - t.Fatal(err) - } - - if f.ModTime() != unixEpochTime { - t.Fatalf("Expected: %s, got: %s", unixEpochTime, f.ModTime()) - } - - // Test aTime set to Unix Epoch and mTime before Unix Epoch - Chtimes(file, unixEpochTime, beforeUnixEpochTime) - - f, err = os.Stat(file) - if err != nil { - t.Fatal(err) - } - - if f.ModTime() != unixEpochTime { - t.Fatalf("Expected: %s, got: %s", unixEpochTime, f.ModTime()) - } - - // Test both aTime and mTime set to after Unix Epoch (valid time) - Chtimes(file, afterUnixEpochTime, afterUnixEpochTime) - - f, err = os.Stat(file) - if err != nil { - t.Fatal(err) - } - - if f.ModTime() != afterUnixEpochTime { - t.Fatalf("Expected: %s, got: %s", afterUnixEpochTime, f.ModTime()) - } - - // Test both aTime and mTime set to Unix max time - Chtimes(file, unixMaxTime, unixMaxTime) - - f, err = os.Stat(file) - if err != nil { - t.Fatal(err) - } - - if f.ModTime().Truncate(time.Second) != unixMaxTime.Truncate(time.Second) { - t.Fatalf("Expected: %s, got: %s", unixMaxTime.Truncate(time.Second), f.ModTime().Truncate(time.Second)) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/chtimes_unix_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/chtimes_unix_test.go deleted file mode 100644 index fcd5940238..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/chtimes_unix_test.go +++ /dev/null @@ -1,91 +0,0 @@ -// +build linux freebsd - -package system - -import ( - "os" - "syscall" - "testing" - "time" -) - -// TestChtimes tests Chtimes access time on a tempfile on Linux -func TestChtimesLinux(t *testing.T) { - file, dir := prepareTempFile(t) - defer os.RemoveAll(dir) - - beforeUnixEpochTime := time.Unix(0, 0).Add(-100 * time.Second) - unixEpochTime := time.Unix(0, 0) - afterUnixEpochTime := time.Unix(100, 0) - unixMaxTime := maxTime - - // Test both aTime and mTime set to Unix Epoch - Chtimes(file, unixEpochTime, unixEpochTime) - - f, err := os.Stat(file) - if err != nil { - t.Fatal(err) - } - - stat := f.Sys().(*syscall.Stat_t) - aTime := time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) - if aTime != unixEpochTime { - t.Fatalf("Expected: %s, got: %s", unixEpochTime, aTime) - } - - // Test aTime before Unix Epoch and mTime set to Unix Epoch - Chtimes(file, beforeUnixEpochTime, unixEpochTime) - - f, err = os.Stat(file) - if err != nil { - t.Fatal(err) - } - - stat = f.Sys().(*syscall.Stat_t) - aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) - if aTime != unixEpochTime { - t.Fatalf("Expected: %s, got: %s", unixEpochTime, aTime) - } - - // Test aTime set to Unix Epoch and mTime before Unix Epoch - Chtimes(file, unixEpochTime, beforeUnixEpochTime) - - f, err = os.Stat(file) - if err != nil { - t.Fatal(err) - } - - stat = f.Sys().(*syscall.Stat_t) - aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) - if aTime != unixEpochTime { - t.Fatalf("Expected: %s, got: %s", unixEpochTime, aTime) - } - - // Test both aTime and mTime set to after Unix Epoch (valid time) - Chtimes(file, afterUnixEpochTime, afterUnixEpochTime) - - f, err = os.Stat(file) - if err != nil { - t.Fatal(err) - } - - stat = f.Sys().(*syscall.Stat_t) - aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) - if aTime != afterUnixEpochTime { - t.Fatalf("Expected: %s, got: %s", afterUnixEpochTime, aTime) - } - - // Test both aTime and mTime set to Unix max time - Chtimes(file, unixMaxTime, unixMaxTime) - - f, err = os.Stat(file) - if err != nil { - t.Fatal(err) - } - - stat = f.Sys().(*syscall.Stat_t) - aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) - if aTime.Truncate(time.Second) != unixMaxTime.Truncate(time.Second) { - t.Fatalf("Expected: %s, got: %s", unixMaxTime.Truncate(time.Second), aTime.Truncate(time.Second)) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/chtimes_windows_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/chtimes_windows_test.go deleted file mode 100644 index be57558e1b..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/chtimes_windows_test.go +++ /dev/null @@ -1,86 +0,0 @@ -// +build windows - -package system - -import ( - "os" - "syscall" - "testing" - "time" -) - -// TestChtimes tests Chtimes access time on a tempfile on Windows -func TestChtimesWindows(t *testing.T) { - file, dir := prepareTempFile(t) - defer os.RemoveAll(dir) - - beforeUnixEpochTime := time.Unix(0, 0).Add(-100 * time.Second) - unixEpochTime := time.Unix(0, 0) - afterUnixEpochTime := time.Unix(100, 0) - unixMaxTime := maxTime - - // Test both aTime and mTime set to Unix Epoch - Chtimes(file, unixEpochTime, unixEpochTime) - - f, err := os.Stat(file) - if err != nil { - t.Fatal(err) - } - - aTime := time.Unix(0, f.Sys().(*syscall.Win32FileAttributeData).LastAccessTime.Nanoseconds()) - if aTime != unixEpochTime { - t.Fatalf("Expected: %s, got: %s", unixEpochTime, aTime) - } - - // Test aTime before Unix Epoch and mTime set to Unix Epoch - Chtimes(file, beforeUnixEpochTime, unixEpochTime) - - f, err = os.Stat(file) - if err != nil { - t.Fatal(err) - } - - aTime = time.Unix(0, f.Sys().(*syscall.Win32FileAttributeData).LastAccessTime.Nanoseconds()) - if aTime != unixEpochTime { - t.Fatalf("Expected: %s, got: %s", unixEpochTime, aTime) - } - - // Test aTime set to Unix Epoch and mTime before Unix Epoch - Chtimes(file, unixEpochTime, beforeUnixEpochTime) - - f, err = os.Stat(file) - if err != nil { - t.Fatal(err) - } - - aTime = time.Unix(0, f.Sys().(*syscall.Win32FileAttributeData).LastAccessTime.Nanoseconds()) - if aTime != unixEpochTime { - t.Fatalf("Expected: %s, got: %s", unixEpochTime, aTime) - } - - // Test both aTime and mTime set to after Unix Epoch (valid time) - Chtimes(file, afterUnixEpochTime, afterUnixEpochTime) - - f, err = os.Stat(file) - if err != nil { - t.Fatal(err) - } - - aTime = time.Unix(0, f.Sys().(*syscall.Win32FileAttributeData).LastAccessTime.Nanoseconds()) - if aTime != afterUnixEpochTime { - t.Fatalf("Expected: %s, got: %s", afterUnixEpochTime, aTime) - } - - // Test both aTime and mTime set to Unix max time - Chtimes(file, unixMaxTime, unixMaxTime) - - f, err = os.Stat(file) - if err != nil { - t.Fatal(err) - } - - aTime = time.Unix(0, f.Sys().(*syscall.Win32FileAttributeData).LastAccessTime.Nanoseconds()) - if aTime.Truncate(time.Second) != unixMaxTime.Truncate(time.Second) { - t.Fatalf("Expected: %s, got: %s", unixMaxTime.Truncate(time.Second), aTime.Truncate(time.Second)) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/lstat_unix_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/lstat_unix_test.go deleted file mode 100644 index 062cf53bfe..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/lstat_unix_test.go +++ /dev/null @@ -1,30 +0,0 @@ -// +build linux freebsd - -package system - -import ( - "os" - "testing" -) - -// TestLstat tests Lstat for existing and non existing files -func TestLstat(t *testing.T) { - file, invalid, _, dir := prepareFiles(t) - defer os.RemoveAll(dir) - - statFile, err := Lstat(file) - if err != nil { - t.Fatal(err) - } - if statFile == nil { - t.Fatal("returned empty stat for existing file") - } - - statInvalid, err := Lstat(invalid) - if err == nil { - t.Fatal("did not return error for non-existing file") - } - if statInvalid != nil { - t.Fatal("returned non-nil stat for non-existing file") - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/meminfo_unix_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/meminfo_unix_test.go deleted file mode 100644 index dda048379a..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/meminfo_unix_test.go +++ /dev/null @@ -1,40 +0,0 @@ -// +build linux freebsd - -package system - -import ( - "strings" - "testing" - - "github.com/fsouza/go-dockerclient/external/github.com/docker/go-units" -) - -// TestMemInfo tests parseMemInfo with a static meminfo string -func TestMemInfo(t *testing.T) { - const input = ` - MemTotal: 1 kB - MemFree: 2 kB - SwapTotal: 3 kB - SwapFree: 4 kB - Malformed1: - Malformed2: 1 - Malformed3: 2 MB - Malformed4: X kB - ` - meminfo, err := parseMemInfo(strings.NewReader(input)) - if err != nil { - t.Fatal(err) - } - if meminfo.MemTotal != 1*units.KiB { - t.Fatalf("Unexpected MemTotal: %d", meminfo.MemTotal) - } - if meminfo.MemFree != 2*units.KiB { - t.Fatalf("Unexpected MemFree: %d", meminfo.MemFree) - } - if meminfo.SwapTotal != 3*units.KiB { - t.Fatalf("Unexpected SwapTotal: %d", meminfo.SwapTotal) - } - if meminfo.SwapFree != 4*units.KiB { - t.Fatalf("Unexpected SwapFree: %d", meminfo.SwapFree) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_unix_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_unix_test.go deleted file mode 100644 index dee8d30a19..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_unix_test.go +++ /dev/null @@ -1,39 +0,0 @@ -// +build linux freebsd - -package system - -import ( - "os" - "syscall" - "testing" -) - -// TestFromStatT tests fromStatT for a tempfile -func TestFromStatT(t *testing.T) { - file, _, _, dir := prepareFiles(t) - defer os.RemoveAll(dir) - - stat := &syscall.Stat_t{} - err := syscall.Lstat(file, stat) - - s, err := fromStatT(stat) - if err != nil { - t.Fatal(err) - } - - if stat.Mode != s.Mode() { - t.Fatal("got invalid mode") - } - if stat.Uid != s.UID() { - t.Fatal("got invalid uid") - } - if stat.Gid != s.GID() { - t.Fatal("got invalid gid") - } - if stat.Rdev != s.Rdev() { - t.Fatal("got invalid rdev") - } - if stat.Mtim != s.Mtim() { - t.Fatal("got invalid mtim") - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/utimes_unix_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/utimes_unix_test.go deleted file mode 100644 index 1ee0d099f9..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/utimes_unix_test.go +++ /dev/null @@ -1,68 +0,0 @@ -// +build linux freebsd - -package system - -import ( - "io/ioutil" - "os" - "path/filepath" - "syscall" - "testing" -) - -// prepareFiles creates files for testing in the temp directory -func prepareFiles(t *testing.T) (string, string, string, string) { - dir, err := ioutil.TempDir("", "docker-system-test") - if err != nil { - t.Fatal(err) - } - - file := filepath.Join(dir, "exist") - if err := ioutil.WriteFile(file, []byte("hello"), 0644); err != nil { - t.Fatal(err) - } - - invalid := filepath.Join(dir, "doesnt-exist") - - symlink := filepath.Join(dir, "symlink") - if err := os.Symlink(file, symlink); err != nil { - t.Fatal(err) - } - - return file, invalid, symlink, dir -} - -func TestLUtimesNano(t *testing.T) { - file, invalid, symlink, dir := prepareFiles(t) - defer os.RemoveAll(dir) - - before, err := os.Stat(file) - if err != nil { - t.Fatal(err) - } - - ts := []syscall.Timespec{{0, 0}, {0, 0}} - if err := LUtimesNano(symlink, ts); err != nil { - t.Fatal(err) - } - - symlinkInfo, err := os.Lstat(symlink) - if err != nil { - t.Fatal(err) - } - if before.ModTime().Unix() == symlinkInfo.ModTime().Unix() { - t.Fatal("The modification time of the symlink should be different") - } - - fileInfo, err := os.Stat(file) - if err != nil { - t.Fatal(err) - } - if before.ModTime().Unix() != fileInfo.ModTime().Unix() { - t.Fatal("The modification time of the file should be same") - } - - if err := LUtimesNano(invalid, ts); err == nil { - t.Fatal("Doesn't return an error on a non-existing file") - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/go-units/duration_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/go-units/duration_test.go deleted file mode 100644 index 63baa515bf..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/go-units/duration_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package units - -import ( - "fmt" - "testing" - "time" -) - -func ExampleHumanDuration() { - fmt.Println(HumanDuration(450 * time.Millisecond)) - fmt.Println(HumanDuration(47 * time.Second)) - fmt.Println(HumanDuration(1 * time.Minute)) - fmt.Println(HumanDuration(3 * time.Minute)) - fmt.Println(HumanDuration(35 * time.Minute)) - fmt.Println(HumanDuration(35*time.Minute + 40*time.Second)) - fmt.Println(HumanDuration(1 * time.Hour)) - fmt.Println(HumanDuration(1*time.Hour + 45*time.Minute)) - fmt.Println(HumanDuration(3 * time.Hour)) - fmt.Println(HumanDuration(3*time.Hour + 59*time.Minute)) - fmt.Println(HumanDuration(3*time.Hour + 60*time.Minute)) - fmt.Println(HumanDuration(24 * time.Hour)) - fmt.Println(HumanDuration(24*time.Hour + 12*time.Hour)) - fmt.Println(HumanDuration(2 * 24 * time.Hour)) - fmt.Println(HumanDuration(7 * 24 * time.Hour)) - fmt.Println(HumanDuration(13*24*time.Hour + 5*time.Hour)) - fmt.Println(HumanDuration(2 * 7 * 24 * time.Hour)) - fmt.Println(HumanDuration(2*7*24*time.Hour + 4*24*time.Hour)) - fmt.Println(HumanDuration(3 * 7 * 24 * time.Hour)) - fmt.Println(HumanDuration(4 * 7 * 24 * time.Hour)) - fmt.Println(HumanDuration(4*7*24*time.Hour + 3*24*time.Hour)) - fmt.Println(HumanDuration(1 * 30 * 24 * time.Hour)) - fmt.Println(HumanDuration(1*30*24*time.Hour + 2*7*24*time.Hour)) - fmt.Println(HumanDuration(2 * 30 * 24 * time.Hour)) - fmt.Println(HumanDuration(3*30*24*time.Hour + 1*7*24*time.Hour)) - fmt.Println(HumanDuration(5*30*24*time.Hour + 2*7*24*time.Hour)) - fmt.Println(HumanDuration(13 * 30 * 24 * time.Hour)) - fmt.Println(HumanDuration(23 * 30 * 24 * time.Hour)) - fmt.Println(HumanDuration(24 * 30 * 24 * time.Hour)) - fmt.Println(HumanDuration(24*30*24*time.Hour + 2*7*24*time.Hour)) - fmt.Println(HumanDuration(3*365*24*time.Hour + 2*30*24*time.Hour)) -} - -func TestHumanDuration(t *testing.T) { - // Useful duration abstractions - day := 24 * time.Hour - week := 7 * day - month := 30 * day - year := 365 * day - - assertEquals(t, "Less than a second", HumanDuration(450*time.Millisecond)) - assertEquals(t, "47 seconds", HumanDuration(47*time.Second)) - assertEquals(t, "About a minute", HumanDuration(1*time.Minute)) - assertEquals(t, "3 minutes", HumanDuration(3*time.Minute)) - assertEquals(t, "35 minutes", HumanDuration(35*time.Minute)) - assertEquals(t, "35 minutes", HumanDuration(35*time.Minute+40*time.Second)) - assertEquals(t, "About an hour", HumanDuration(1*time.Hour)) - assertEquals(t, "About an hour", HumanDuration(1*time.Hour+45*time.Minute)) - assertEquals(t, "3 hours", HumanDuration(3*time.Hour)) - assertEquals(t, "3 hours", HumanDuration(3*time.Hour+59*time.Minute)) - assertEquals(t, "4 hours", HumanDuration(3*time.Hour+60*time.Minute)) - assertEquals(t, "24 hours", HumanDuration(24*time.Hour)) - assertEquals(t, "36 hours", HumanDuration(1*day+12*time.Hour)) - assertEquals(t, "2 days", HumanDuration(2*day)) - assertEquals(t, "7 days", HumanDuration(7*day)) - assertEquals(t, "13 days", HumanDuration(13*day+5*time.Hour)) - assertEquals(t, "2 weeks", HumanDuration(2*week)) - assertEquals(t, "2 weeks", HumanDuration(2*week+4*day)) - assertEquals(t, "3 weeks", HumanDuration(3*week)) - assertEquals(t, "4 weeks", HumanDuration(4*week)) - assertEquals(t, "4 weeks", HumanDuration(4*week+3*day)) - assertEquals(t, "4 weeks", HumanDuration(1*month)) - assertEquals(t, "6 weeks", HumanDuration(1*month+2*week)) - assertEquals(t, "8 weeks", HumanDuration(2*month)) - assertEquals(t, "3 months", HumanDuration(3*month+1*week)) - assertEquals(t, "5 months", HumanDuration(5*month+2*week)) - assertEquals(t, "13 months", HumanDuration(13*month)) - assertEquals(t, "23 months", HumanDuration(23*month)) - assertEquals(t, "24 months", HumanDuration(24*month)) - assertEquals(t, "2 years", HumanDuration(24*month+2*week)) - assertEquals(t, "3 years", HumanDuration(3*year+2*month)) -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/go-units/size_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/go-units/size_test.go deleted file mode 100644 index a968f5c0df..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/go-units/size_test.go +++ /dev/null @@ -1,160 +0,0 @@ -package units - -import ( - "fmt" - "reflect" - "runtime" - "strings" - "testing" -) - -func ExampleBytesSize() { - fmt.Println(BytesSize(1024)) - fmt.Println(BytesSize(1024 * 1024)) - fmt.Println(BytesSize(1048576)) - fmt.Println(BytesSize(2 * MiB)) - fmt.Println(BytesSize(3.42 * GiB)) - fmt.Println(BytesSize(5.372 * TiB)) - fmt.Println(BytesSize(2.22 * PiB)) -} - -func ExampleHumanSize() { - fmt.Println(HumanSize(1000)) - fmt.Println(HumanSize(1024)) - fmt.Println(HumanSize(1000000)) - fmt.Println(HumanSize(1048576)) - fmt.Println(HumanSize(2 * MB)) - fmt.Println(HumanSize(float64(3.42 * GB))) - fmt.Println(HumanSize(float64(5.372 * TB))) - fmt.Println(HumanSize(float64(2.22 * PB))) -} - -func ExampleFromHumanSize() { - fmt.Println(FromHumanSize("32")) - fmt.Println(FromHumanSize("32b")) - fmt.Println(FromHumanSize("32B")) - fmt.Println(FromHumanSize("32k")) - fmt.Println(FromHumanSize("32K")) - fmt.Println(FromHumanSize("32kb")) - fmt.Println(FromHumanSize("32Kb")) - fmt.Println(FromHumanSize("32Mb")) - fmt.Println(FromHumanSize("32Gb")) - fmt.Println(FromHumanSize("32Tb")) - fmt.Println(FromHumanSize("32Pb")) -} - -func ExampleRAMInBytes() { - fmt.Println(RAMInBytes("32")) - fmt.Println(RAMInBytes("32b")) - fmt.Println(RAMInBytes("32B")) - fmt.Println(RAMInBytes("32k")) - fmt.Println(RAMInBytes("32K")) - fmt.Println(RAMInBytes("32kb")) - fmt.Println(RAMInBytes("32Kb")) - fmt.Println(RAMInBytes("32Mb")) - fmt.Println(RAMInBytes("32Gb")) - fmt.Println(RAMInBytes("32Tb")) - fmt.Println(RAMInBytes("32Pb")) - fmt.Println(RAMInBytes("32PB")) - fmt.Println(RAMInBytes("32P")) -} - -func TestBytesSize(t *testing.T) { - assertEquals(t, "1 KiB", BytesSize(1024)) - assertEquals(t, "1 MiB", BytesSize(1024*1024)) - assertEquals(t, "1 MiB", BytesSize(1048576)) - assertEquals(t, "2 MiB", BytesSize(2*MiB)) - assertEquals(t, "3.42 GiB", BytesSize(3.42*GiB)) - assertEquals(t, "5.372 TiB", BytesSize(5.372*TiB)) - assertEquals(t, "2.22 PiB", BytesSize(2.22*PiB)) -} - -func TestHumanSize(t *testing.T) { - assertEquals(t, "1 kB", HumanSize(1000)) - assertEquals(t, "1.024 kB", HumanSize(1024)) - assertEquals(t, "1 MB", HumanSize(1000000)) - assertEquals(t, "1.049 MB", HumanSize(1048576)) - assertEquals(t, "2 MB", HumanSize(2*MB)) - assertEquals(t, "3.42 GB", HumanSize(float64(3.42*GB))) - assertEquals(t, "5.372 TB", HumanSize(float64(5.372*TB))) - assertEquals(t, "2.22 PB", HumanSize(float64(2.22*PB))) -} - -func TestFromHumanSize(t *testing.T) { - assertSuccessEquals(t, 32, FromHumanSize, "32") - assertSuccessEquals(t, 32, FromHumanSize, "32b") - assertSuccessEquals(t, 32, FromHumanSize, "32B") - assertSuccessEquals(t, 32*KB, FromHumanSize, "32k") - assertSuccessEquals(t, 32*KB, FromHumanSize, "32K") - assertSuccessEquals(t, 32*KB, FromHumanSize, "32kb") - assertSuccessEquals(t, 32*KB, FromHumanSize, "32Kb") - assertSuccessEquals(t, 32*MB, FromHumanSize, "32Mb") - assertSuccessEquals(t, 32*GB, FromHumanSize, "32Gb") - assertSuccessEquals(t, 32*TB, FromHumanSize, "32Tb") - assertSuccessEquals(t, 32*PB, FromHumanSize, "32Pb") - - assertError(t, FromHumanSize, "") - assertError(t, FromHumanSize, "hello") - assertError(t, FromHumanSize, "-32") - assertError(t, FromHumanSize, "32.3") - assertError(t, FromHumanSize, " 32 ") - assertError(t, FromHumanSize, "32.3Kb") - assertError(t, FromHumanSize, "32 mb") - assertError(t, FromHumanSize, "32m b") - assertError(t, FromHumanSize, "32bm") -} - -func TestRAMInBytes(t *testing.T) { - assertSuccessEquals(t, 32, RAMInBytes, "32") - assertSuccessEquals(t, 32, RAMInBytes, "32b") - assertSuccessEquals(t, 32, RAMInBytes, "32B") - assertSuccessEquals(t, 32*KiB, RAMInBytes, "32k") - assertSuccessEquals(t, 32*KiB, RAMInBytes, "32K") - assertSuccessEquals(t, 32*KiB, RAMInBytes, "32kb") - assertSuccessEquals(t, 32*KiB, RAMInBytes, "32Kb") - assertSuccessEquals(t, 32*MiB, RAMInBytes, "32Mb") - assertSuccessEquals(t, 32*GiB, RAMInBytes, "32Gb") - assertSuccessEquals(t, 32*TiB, RAMInBytes, "32Tb") - assertSuccessEquals(t, 32*PiB, RAMInBytes, "32Pb") - assertSuccessEquals(t, 32*PiB, RAMInBytes, "32PB") - assertSuccessEquals(t, 32*PiB, RAMInBytes, "32P") - - assertError(t, RAMInBytes, "") - assertError(t, RAMInBytes, "hello") - assertError(t, RAMInBytes, "-32") - assertError(t, RAMInBytes, "32.3") - assertError(t, RAMInBytes, " 32 ") - assertError(t, RAMInBytes, "32.3Kb") - assertError(t, RAMInBytes, "32 mb") - assertError(t, RAMInBytes, "32m b") - assertError(t, RAMInBytes, "32bm") -} - -func assertEquals(t *testing.T, expected, actual interface{}) { - if expected != actual { - t.Errorf("Expected '%v' but got '%v'", expected, actual) - } -} - -// func that maps to the parse function signatures as testing abstraction -type parseFn func(string) (int64, error) - -// Define 'String()' for pretty-print -func (fn parseFn) String() string { - fnName := runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name() - return fnName[strings.LastIndex(fnName, ".")+1:] -} - -func assertSuccessEquals(t *testing.T, expected int64, fn parseFn, arg string) { - res, err := fn(arg) - if err != nil || res != expected { - t.Errorf("%s(\"%s\") -> expected '%d' but got '%d' with error '%v'", fn, arg, expected, res, err) - } -} - -func assertError(t *testing.T, fn parseFn, arg string) { - res, err := fn(arg) - if err == nil && res != -1 { - t.Errorf("%s(\"%s\") -> expected error but got '%d'", fn, arg, res) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/go-units/ulimit_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/go-units/ulimit_test.go deleted file mode 100644 index 3e7f10fc2b..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/go-units/ulimit_test.go +++ /dev/null @@ -1,74 +0,0 @@ -package units - -import ( - "fmt" - "strconv" - "testing" -) - -func ExampleParseUlimit() { - fmt.Println(ParseUlimit("nofile=512:1024")) - fmt.Println(ParseUlimit("nofile=1024")) - fmt.Println(ParseUlimit("cpu=2:4")) - fmt.Println(ParseUlimit("cpu=6")) -} - -func TestParseUlimitValid(t *testing.T) { - u1 := &Ulimit{"nofile", 1024, 512} - if u2, _ := ParseUlimit("nofile=512:1024"); *u1 != *u2 { - t.Fatalf("expected %q, but got %q", u1, u2) - } -} - -func TestParseUlimitInvalidLimitType(t *testing.T) { - if _, err := ParseUlimit("notarealtype=1024:1024"); err == nil { - t.Fatalf("expected error on invalid ulimit type") - } -} - -func TestParseUlimitBadFormat(t *testing.T) { - if _, err := ParseUlimit("nofile:1024:1024"); err == nil { - t.Fatal("expected error on bad syntax") - } - - if _, err := ParseUlimit("nofile"); err == nil { - t.Fatal("expected error on bad syntax") - } - - if _, err := ParseUlimit("nofile="); err == nil { - t.Fatal("expected error on bad syntax") - } - if _, err := ParseUlimit("nofile=:"); err == nil { - t.Fatal("expected error on bad syntax") - } - if _, err := ParseUlimit("nofile=:1024"); err == nil { - t.Fatal("expected error on bad syntax") - } -} - -func TestParseUlimitHardLessThanSoft(t *testing.T) { - if _, err := ParseUlimit("nofile=1024:1"); err == nil { - t.Fatal("expected error on hard limit less than soft limit") - } -} - -func TestParseUlimitInvalidValueType(t *testing.T) { - if _, err := ParseUlimit("nofile=asdf"); err == nil { - t.Fatal("expected error on bad value type, but got no error") - } else if _, ok := err.(*strconv.NumError); !ok { - t.Fatalf("expected error on bad value type, but got `%s`", err) - } - - if _, err := ParseUlimit("nofile=1024:asdf"); err == nil { - t.Fatal("expected error on bad value type, but got no error") - } else if _, ok := err.(*strconv.NumError); !ok { - t.Fatalf("expected error on bad value type, but got `%s`", err) - } -} - -func TestUlimitStringOutput(t *testing.T) { - u := &Ulimit{"nofile", 1024, 512} - if s := u.String(); s != "nofile=512:1024" { - t.Fatal("expected String to return nofile=512:1024, but got", s) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/context/context_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/context/context_test.go deleted file mode 100644 index 9814c501e8..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/context/context_test.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2012 The Gorilla Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package context - -import ( - "net/http" - "testing" -) - -type keyType int - -const ( - key1 keyType = iota - key2 -) - -func TestContext(t *testing.T) { - assertEqual := func(val interface{}, exp interface{}) { - if val != exp { - t.Errorf("Expected %v, got %v.", exp, val) - } - } - - r, _ := http.NewRequest("GET", "http://localhost:8080/", nil) - emptyR, _ := http.NewRequest("GET", "http://localhost:8080/", nil) - - // Get() - assertEqual(Get(r, key1), nil) - - // Set() - Set(r, key1, "1") - assertEqual(Get(r, key1), "1") - assertEqual(len(data[r]), 1) - - Set(r, key2, "2") - assertEqual(Get(r, key2), "2") - assertEqual(len(data[r]), 2) - - //GetOk - value, ok := GetOk(r, key1) - assertEqual(value, "1") - assertEqual(ok, true) - - value, ok = GetOk(r, "not exists") - assertEqual(value, nil) - assertEqual(ok, false) - - Set(r, "nil value", nil) - value, ok = GetOk(r, "nil value") - assertEqual(value, nil) - assertEqual(ok, true) - - // GetAll() - values := GetAll(r) - assertEqual(len(values), 3) - - // GetAll() for empty request - values = GetAll(emptyR) - if values != nil { - t.Error("GetAll didn't return nil value for invalid request") - } - - // GetAllOk() - values, ok = GetAllOk(r) - assertEqual(len(values), 3) - assertEqual(ok, true) - - // GetAllOk() for empty request - values, ok = GetAllOk(emptyR) - assertEqual(value, nil) - assertEqual(ok, false) - - // Delete() - Delete(r, key1) - assertEqual(Get(r, key1), nil) - assertEqual(len(data[r]), 2) - - Delete(r, key2) - assertEqual(Get(r, key2), nil) - assertEqual(len(data[r]), 1) - - // Clear() - Clear(r) - assertEqual(len(data), 0) -} - -func parallelReader(r *http.Request, key string, iterations int, wait, done chan struct{}) { - <-wait - for i := 0; i < iterations; i++ { - Get(r, key) - } - done <- struct{}{} - -} - -func parallelWriter(r *http.Request, key, value string, iterations int, wait, done chan struct{}) { - <-wait - for i := 0; i < iterations; i++ { - Set(r, key, value) - } - done <- struct{}{} - -} - -func benchmarkMutex(b *testing.B, numReaders, numWriters, iterations int) { - - b.StopTimer() - r, _ := http.NewRequest("GET", "http://localhost:8080/", nil) - done := make(chan struct{}) - b.StartTimer() - - for i := 0; i < b.N; i++ { - wait := make(chan struct{}) - - for i := 0; i < numReaders; i++ { - go parallelReader(r, "test", iterations, wait, done) - } - - for i := 0; i < numWriters; i++ { - go parallelWriter(r, "test", "123", iterations, wait, done) - } - - close(wait) - - for i := 0; i < numReaders+numWriters; i++ { - <-done - } - - } - -} - -func BenchmarkMutexSameReadWrite1(b *testing.B) { - benchmarkMutex(b, 1, 1, 32) -} -func BenchmarkMutexSameReadWrite2(b *testing.B) { - benchmarkMutex(b, 2, 2, 32) -} -func BenchmarkMutexSameReadWrite4(b *testing.B) { - benchmarkMutex(b, 4, 4, 32) -} -func BenchmarkMutex1(b *testing.B) { - benchmarkMutex(b, 2, 8, 32) -} -func BenchmarkMutex2(b *testing.B) { - benchmarkMutex(b, 16, 4, 64) -} -func BenchmarkMutex3(b *testing.B) { - benchmarkMutex(b, 1, 2, 128) -} -func BenchmarkMutex4(b *testing.B) { - benchmarkMutex(b, 128, 32, 256) -} -func BenchmarkMutex5(b *testing.B) { - benchmarkMutex(b, 1024, 2048, 64) -} -func BenchmarkMutex6(b *testing.B) { - benchmarkMutex(b, 2048, 1024, 512) -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/bench_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/bench_test.go deleted file mode 100644 index c5f97b2b2a..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/bench_test.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Gorilla Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package mux - -import ( - "net/http" - "testing" -) - -func BenchmarkMux(b *testing.B) { - router := new(Router) - handler := func(w http.ResponseWriter, r *http.Request) {} - router.HandleFunc("/v1/{v1}", handler) - - request, _ := http.NewRequest("GET", "/v1/anything", nil) - for i := 0; i < b.N; i++ { - router.ServeHTTP(nil, request) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/mux_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/mux_test.go deleted file mode 100644 index 98f73fe9c2..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/mux_test.go +++ /dev/null @@ -1,1358 +0,0 @@ -// Copyright 2012 The Gorilla Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package mux - -import ( - "fmt" - "net/http" - "strings" - "testing" - - "github.com/fsouza/go-dockerclient/external/github.com/gorilla/context" -) - -func (r *Route) GoString() string { - matchers := make([]string, len(r.matchers)) - for i, m := range r.matchers { - matchers[i] = fmt.Sprintf("%#v", m) - } - return fmt.Sprintf("&Route{matchers:[]matcher{%s}}", strings.Join(matchers, ", ")) -} - -func (r *routeRegexp) GoString() string { - return fmt.Sprintf("&routeRegexp{template: %q, matchHost: %t, matchQuery: %t, strictSlash: %t, regexp: regexp.MustCompile(%q), reverse: %q, varsN: %v, varsR: %v", r.template, r.matchHost, r.matchQuery, r.strictSlash, r.regexp.String(), r.reverse, r.varsN, r.varsR) -} - -type routeTest struct { - title string // title of the test - route *Route // the route being tested - request *http.Request // a request to test the route - vars map[string]string // the expected vars of the match - host string // the expected host of the match - path string // the expected path of the match - shouldMatch bool // whether the request is expected to match the route at all - shouldRedirect bool // whether the request should result in a redirect -} - -func TestHost(t *testing.T) { - // newRequestHost a new request with a method, url, and host header - newRequestHost := func(method, url, host string) *http.Request { - req, err := http.NewRequest(method, url, nil) - if err != nil { - panic(err) - } - req.Host = host - return req - } - - tests := []routeTest{ - { - title: "Host route match", - route: new(Route).Host("aaa.bbb.ccc"), - request: newRequest("GET", "http://aaa.bbb.ccc/111/222/333"), - vars: map[string]string{}, - host: "aaa.bbb.ccc", - path: "", - shouldMatch: true, - }, - { - title: "Host route, wrong host in request URL", - route: new(Route).Host("aaa.bbb.ccc"), - request: newRequest("GET", "http://aaa.222.ccc/111/222/333"), - vars: map[string]string{}, - host: "aaa.bbb.ccc", - path: "", - shouldMatch: false, - }, - { - title: "Host route with port, match", - route: new(Route).Host("aaa.bbb.ccc:1234"), - request: newRequest("GET", "http://aaa.bbb.ccc:1234/111/222/333"), - vars: map[string]string{}, - host: "aaa.bbb.ccc:1234", - path: "", - shouldMatch: true, - }, - { - title: "Host route with port, wrong port in request URL", - route: new(Route).Host("aaa.bbb.ccc:1234"), - request: newRequest("GET", "http://aaa.bbb.ccc:9999/111/222/333"), - vars: map[string]string{}, - host: "aaa.bbb.ccc:1234", - path: "", - shouldMatch: false, - }, - { - title: "Host route, match with host in request header", - route: new(Route).Host("aaa.bbb.ccc"), - request: newRequestHost("GET", "/111/222/333", "aaa.bbb.ccc"), - vars: map[string]string{}, - host: "aaa.bbb.ccc", - path: "", - shouldMatch: true, - }, - { - title: "Host route, wrong host in request header", - route: new(Route).Host("aaa.bbb.ccc"), - request: newRequestHost("GET", "/111/222/333", "aaa.222.ccc"), - vars: map[string]string{}, - host: "aaa.bbb.ccc", - path: "", - shouldMatch: false, - }, - // BUG {new(Route).Host("aaa.bbb.ccc:1234"), newRequestHost("GET", "/111/222/333", "aaa.bbb.ccc:1234"), map[string]string{}, "aaa.bbb.ccc:1234", "", true}, - { - title: "Host route with port, wrong host in request header", - route: new(Route).Host("aaa.bbb.ccc:1234"), - request: newRequestHost("GET", "/111/222/333", "aaa.bbb.ccc:9999"), - vars: map[string]string{}, - host: "aaa.bbb.ccc:1234", - path: "", - shouldMatch: false, - }, - { - title: "Host route with pattern, match", - route: new(Route).Host("aaa.{v1:[a-z]{3}}.ccc"), - request: newRequest("GET", "http://aaa.bbb.ccc/111/222/333"), - vars: map[string]string{"v1": "bbb"}, - host: "aaa.bbb.ccc", - path: "", - shouldMatch: true, - }, - { - title: "Host route with pattern, additional capturing group, match", - route: new(Route).Host("aaa.{v1:[a-z]{2}(b|c)}.ccc"), - request: newRequest("GET", "http://aaa.bbb.ccc/111/222/333"), - vars: map[string]string{"v1": "bbb"}, - host: "aaa.bbb.ccc", - path: "", - shouldMatch: true, - }, - { - title: "Host route with pattern, wrong host in request URL", - route: new(Route).Host("aaa.{v1:[a-z]{3}}.ccc"), - request: newRequest("GET", "http://aaa.222.ccc/111/222/333"), - vars: map[string]string{"v1": "bbb"}, - host: "aaa.bbb.ccc", - path: "", - shouldMatch: false, - }, - { - title: "Host route with multiple patterns, match", - route: new(Route).Host("{v1:[a-z]{3}}.{v2:[a-z]{3}}.{v3:[a-z]{3}}"), - request: newRequest("GET", "http://aaa.bbb.ccc/111/222/333"), - vars: map[string]string{"v1": "aaa", "v2": "bbb", "v3": "ccc"}, - host: "aaa.bbb.ccc", - path: "", - shouldMatch: true, - }, - { - title: "Host route with multiple patterns, wrong host in request URL", - route: new(Route).Host("{v1:[a-z]{3}}.{v2:[a-z]{3}}.{v3:[a-z]{3}}"), - request: newRequest("GET", "http://aaa.222.ccc/111/222/333"), - vars: map[string]string{"v1": "aaa", "v2": "bbb", "v3": "ccc"}, - host: "aaa.bbb.ccc", - path: "", - shouldMatch: false, - }, - { - title: "Host route with hyphenated name and pattern, match", - route: new(Route).Host("aaa.{v-1:[a-z]{3}}.ccc"), - request: newRequest("GET", "http://aaa.bbb.ccc/111/222/333"), - vars: map[string]string{"v-1": "bbb"}, - host: "aaa.bbb.ccc", - path: "", - shouldMatch: true, - }, - { - title: "Host route with hyphenated name and pattern, additional capturing group, match", - route: new(Route).Host("aaa.{v-1:[a-z]{2}(b|c)}.ccc"), - request: newRequest("GET", "http://aaa.bbb.ccc/111/222/333"), - vars: map[string]string{"v-1": "bbb"}, - host: "aaa.bbb.ccc", - path: "", - shouldMatch: true, - }, - { - title: "Host route with multiple hyphenated names and patterns, match", - route: new(Route).Host("{v-1:[a-z]{3}}.{v-2:[a-z]{3}}.{v-3:[a-z]{3}}"), - request: newRequest("GET", "http://aaa.bbb.ccc/111/222/333"), - vars: map[string]string{"v-1": "aaa", "v-2": "bbb", "v-3": "ccc"}, - host: "aaa.bbb.ccc", - path: "", - shouldMatch: true, - }, - { - title: "Path route with single pattern with pipe, match", - route: new(Route).Path("/{category:a|b/c}"), - request: newRequest("GET", "http://localhost/a"), - vars: map[string]string{"category": "a"}, - host: "", - path: "/a", - shouldMatch: true, - }, - { - title: "Path route with single pattern with pipe, match", - route: new(Route).Path("/{category:a|b/c}"), - request: newRequest("GET", "http://localhost/b/c"), - vars: map[string]string{"category": "b/c"}, - host: "", - path: "/b/c", - shouldMatch: true, - }, - { - title: "Path route with multiple patterns with pipe, match", - route: new(Route).Path("/{category:a|b/c}/{product}/{id:[0-9]+}"), - request: newRequest("GET", "http://localhost/a/product_name/1"), - vars: map[string]string{"category": "a", "product": "product_name", "id": "1"}, - host: "", - path: "/a/product_name/1", - shouldMatch: true, - }, - { - title: "Path route with multiple patterns with pipe, match", - route: new(Route).Path("/{category:a|b/c}/{product}/{id:[0-9]+}"), - request: newRequest("GET", "http://localhost/b/c/product_name/1"), - vars: map[string]string{"category": "b/c", "product": "product_name", "id": "1"}, - host: "", - path: "/b/c/product_name/1", - shouldMatch: true, - }, - } - for _, test := range tests { - testRoute(t, test) - } -} - -func TestPath(t *testing.T) { - tests := []routeTest{ - { - title: "Path route, match", - route: new(Route).Path("/111/222/333"), - request: newRequest("GET", "http://localhost/111/222/333"), - vars: map[string]string{}, - host: "", - path: "/111/222/333", - shouldMatch: true, - }, - { - title: "Path route, match with trailing slash in request and path", - route: new(Route).Path("/111/"), - request: newRequest("GET", "http://localhost/111/"), - vars: map[string]string{}, - host: "", - path: "/111/", - shouldMatch: true, - }, - { - title: "Path route, do not match with trailing slash in path", - route: new(Route).Path("/111/"), - request: newRequest("GET", "http://localhost/111"), - vars: map[string]string{}, - host: "", - path: "/111", - shouldMatch: false, - }, - { - title: "Path route, do not match with trailing slash in request", - route: new(Route).Path("/111"), - request: newRequest("GET", "http://localhost/111/"), - vars: map[string]string{}, - host: "", - path: "/111/", - shouldMatch: false, - }, - { - title: "Path route, wrong path in request in request URL", - route: new(Route).Path("/111/222/333"), - request: newRequest("GET", "http://localhost/1/2/3"), - vars: map[string]string{}, - host: "", - path: "/111/222/333", - shouldMatch: false, - }, - { - title: "Path route with pattern, match", - route: new(Route).Path("/111/{v1:[0-9]{3}}/333"), - request: newRequest("GET", "http://localhost/111/222/333"), - vars: map[string]string{"v1": "222"}, - host: "", - path: "/111/222/333", - shouldMatch: true, - }, - { - title: "Path route with pattern, URL in request does not match", - route: new(Route).Path("/111/{v1:[0-9]{3}}/333"), - request: newRequest("GET", "http://localhost/111/aaa/333"), - vars: map[string]string{"v1": "222"}, - host: "", - path: "/111/222/333", - shouldMatch: false, - }, - { - title: "Path route with multiple patterns, match", - route: new(Route).Path("/{v1:[0-9]{3}}/{v2:[0-9]{3}}/{v3:[0-9]{3}}"), - request: newRequest("GET", "http://localhost/111/222/333"), - vars: map[string]string{"v1": "111", "v2": "222", "v3": "333"}, - host: "", - path: "/111/222/333", - shouldMatch: true, - }, - { - title: "Path route with multiple patterns, URL in request does not match", - route: new(Route).Path("/{v1:[0-9]{3}}/{v2:[0-9]{3}}/{v3:[0-9]{3}}"), - request: newRequest("GET", "http://localhost/111/aaa/333"), - vars: map[string]string{"v1": "111", "v2": "222", "v3": "333"}, - host: "", - path: "/111/222/333", - shouldMatch: false, - }, - { - title: "Path route with multiple patterns with pipe, match", - route: new(Route).Path("/{category:a|(b/c)}/{product}/{id:[0-9]+}"), - request: newRequest("GET", "http://localhost/a/product_name/1"), - vars: map[string]string{"category": "a", "product": "product_name", "id": "1"}, - host: "", - path: "/a/product_name/1", - shouldMatch: true, - }, - { - title: "Path route with hyphenated name and pattern, match", - route: new(Route).Path("/111/{v-1:[0-9]{3}}/333"), - request: newRequest("GET", "http://localhost/111/222/333"), - vars: map[string]string{"v-1": "222"}, - host: "", - path: "/111/222/333", - shouldMatch: true, - }, - { - title: "Path route with multiple hyphenated names and patterns, match", - route: new(Route).Path("/{v-1:[0-9]{3}}/{v-2:[0-9]{3}}/{v-3:[0-9]{3}}"), - request: newRequest("GET", "http://localhost/111/222/333"), - vars: map[string]string{"v-1": "111", "v-2": "222", "v-3": "333"}, - host: "", - path: "/111/222/333", - shouldMatch: true, - }, - { - title: "Path route with multiple hyphenated names and patterns with pipe, match", - route: new(Route).Path("/{product-category:a|(b/c)}/{product-name}/{product-id:[0-9]+}"), - request: newRequest("GET", "http://localhost/a/product_name/1"), - vars: map[string]string{"product-category": "a", "product-name": "product_name", "product-id": "1"}, - host: "", - path: "/a/product_name/1", - shouldMatch: true, - }, - } - - for _, test := range tests { - testRoute(t, test) - } -} - -func TestPathPrefix(t *testing.T) { - tests := []routeTest{ - { - title: "PathPrefix route, match", - route: new(Route).PathPrefix("/111"), - request: newRequest("GET", "http://localhost/111/222/333"), - vars: map[string]string{}, - host: "", - path: "/111", - shouldMatch: true, - }, - { - title: "PathPrefix route, match substring", - route: new(Route).PathPrefix("/1"), - request: newRequest("GET", "http://localhost/111/222/333"), - vars: map[string]string{}, - host: "", - path: "/1", - shouldMatch: true, - }, - { - title: "PathPrefix route, URL prefix in request does not match", - route: new(Route).PathPrefix("/111"), - request: newRequest("GET", "http://localhost/1/2/3"), - vars: map[string]string{}, - host: "", - path: "/111", - shouldMatch: false, - }, - { - title: "PathPrefix route with pattern, match", - route: new(Route).PathPrefix("/111/{v1:[0-9]{3}}"), - request: newRequest("GET", "http://localhost/111/222/333"), - vars: map[string]string{"v1": "222"}, - host: "", - path: "/111/222", - shouldMatch: true, - }, - { - title: "PathPrefix route with pattern, URL prefix in request does not match", - route: new(Route).PathPrefix("/111/{v1:[0-9]{3}}"), - request: newRequest("GET", "http://localhost/111/aaa/333"), - vars: map[string]string{"v1": "222"}, - host: "", - path: "/111/222", - shouldMatch: false, - }, - { - title: "PathPrefix route with multiple patterns, match", - route: new(Route).PathPrefix("/{v1:[0-9]{3}}/{v2:[0-9]{3}}"), - request: newRequest("GET", "http://localhost/111/222/333"), - vars: map[string]string{"v1": "111", "v2": "222"}, - host: "", - path: "/111/222", - shouldMatch: true, - }, - { - title: "PathPrefix route with multiple patterns, URL prefix in request does not match", - route: new(Route).PathPrefix("/{v1:[0-9]{3}}/{v2:[0-9]{3}}"), - request: newRequest("GET", "http://localhost/111/aaa/333"), - vars: map[string]string{"v1": "111", "v2": "222"}, - host: "", - path: "/111/222", - shouldMatch: false, - }, - } - - for _, test := range tests { - testRoute(t, test) - } -} - -func TestHostPath(t *testing.T) { - tests := []routeTest{ - { - title: "Host and Path route, match", - route: new(Route).Host("aaa.bbb.ccc").Path("/111/222/333"), - request: newRequest("GET", "http://aaa.bbb.ccc/111/222/333"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Host and Path route, wrong host in request URL", - route: new(Route).Host("aaa.bbb.ccc").Path("/111/222/333"), - request: newRequest("GET", "http://aaa.222.ccc/111/222/333"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: false, - }, - { - title: "Host and Path route with pattern, match", - route: new(Route).Host("aaa.{v1:[a-z]{3}}.ccc").Path("/111/{v2:[0-9]{3}}/333"), - request: newRequest("GET", "http://aaa.bbb.ccc/111/222/333"), - vars: map[string]string{"v1": "bbb", "v2": "222"}, - host: "aaa.bbb.ccc", - path: "/111/222/333", - shouldMatch: true, - }, - { - title: "Host and Path route with pattern, URL in request does not match", - route: new(Route).Host("aaa.{v1:[a-z]{3}}.ccc").Path("/111/{v2:[0-9]{3}}/333"), - request: newRequest("GET", "http://aaa.222.ccc/111/222/333"), - vars: map[string]string{"v1": "bbb", "v2": "222"}, - host: "aaa.bbb.ccc", - path: "/111/222/333", - shouldMatch: false, - }, - { - title: "Host and Path route with multiple patterns, match", - route: new(Route).Host("{v1:[a-z]{3}}.{v2:[a-z]{3}}.{v3:[a-z]{3}}").Path("/{v4:[0-9]{3}}/{v5:[0-9]{3}}/{v6:[0-9]{3}}"), - request: newRequest("GET", "http://aaa.bbb.ccc/111/222/333"), - vars: map[string]string{"v1": "aaa", "v2": "bbb", "v3": "ccc", "v4": "111", "v5": "222", "v6": "333"}, - host: "aaa.bbb.ccc", - path: "/111/222/333", - shouldMatch: true, - }, - { - title: "Host and Path route with multiple patterns, URL in request does not match", - route: new(Route).Host("{v1:[a-z]{3}}.{v2:[a-z]{3}}.{v3:[a-z]{3}}").Path("/{v4:[0-9]{3}}/{v5:[0-9]{3}}/{v6:[0-9]{3}}"), - request: newRequest("GET", "http://aaa.222.ccc/111/222/333"), - vars: map[string]string{"v1": "aaa", "v2": "bbb", "v3": "ccc", "v4": "111", "v5": "222", "v6": "333"}, - host: "aaa.bbb.ccc", - path: "/111/222/333", - shouldMatch: false, - }, - } - - for _, test := range tests { - testRoute(t, test) - } -} - -func TestHeaders(t *testing.T) { - // newRequestHeaders creates a new request with a method, url, and headers - newRequestHeaders := func(method, url string, headers map[string]string) *http.Request { - req, err := http.NewRequest(method, url, nil) - if err != nil { - panic(err) - } - for k, v := range headers { - req.Header.Add(k, v) - } - return req - } - - tests := []routeTest{ - { - title: "Headers route, match", - route: new(Route).Headers("foo", "bar", "baz", "ding"), - request: newRequestHeaders("GET", "http://localhost", map[string]string{"foo": "bar", "baz": "ding"}), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Headers route, bad header values", - route: new(Route).Headers("foo", "bar", "baz", "ding"), - request: newRequestHeaders("GET", "http://localhost", map[string]string{"foo": "bar", "baz": "dong"}), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: false, - }, - { - title: "Headers route, regex header values to match", - route: new(Route).Headers("foo", "ba[zr]"), - request: newRequestHeaders("GET", "http://localhost", map[string]string{"foo": "bar"}), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: false, - }, - { - title: "Headers route, regex header values to match", - route: new(Route).HeadersRegexp("foo", "ba[zr]"), - request: newRequestHeaders("GET", "http://localhost", map[string]string{"foo": "baz"}), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: true, - }, - } - - for _, test := range tests { - testRoute(t, test) - } - -} - -func TestMethods(t *testing.T) { - tests := []routeTest{ - { - title: "Methods route, match GET", - route: new(Route).Methods("GET", "POST"), - request: newRequest("GET", "http://localhost"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Methods route, match POST", - route: new(Route).Methods("GET", "POST"), - request: newRequest("POST", "http://localhost"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Methods route, bad method", - route: new(Route).Methods("GET", "POST"), - request: newRequest("PUT", "http://localhost"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: false, - }, - } - - for _, test := range tests { - testRoute(t, test) - } -} - -func TestQueries(t *testing.T) { - tests := []routeTest{ - { - title: "Queries route, match", - route: new(Route).Queries("foo", "bar", "baz", "ding"), - request: newRequest("GET", "http://localhost?foo=bar&baz=ding"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Queries route, match with a query string", - route: new(Route).Host("www.example.com").Path("/api").Queries("foo", "bar", "baz", "ding"), - request: newRequest("GET", "http://www.example.com/api?foo=bar&baz=ding"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Queries route, match with a query string out of order", - route: new(Route).Host("www.example.com").Path("/api").Queries("foo", "bar", "baz", "ding"), - request: newRequest("GET", "http://www.example.com/api?baz=ding&foo=bar"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Queries route, bad query", - route: new(Route).Queries("foo", "bar", "baz", "ding"), - request: newRequest("GET", "http://localhost?foo=bar&baz=dong"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: false, - }, - { - title: "Queries route with pattern, match", - route: new(Route).Queries("foo", "{v1}"), - request: newRequest("GET", "http://localhost?foo=bar"), - vars: map[string]string{"v1": "bar"}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Queries route with multiple patterns, match", - route: new(Route).Queries("foo", "{v1}", "baz", "{v2}"), - request: newRequest("GET", "http://localhost?foo=bar&baz=ding"), - vars: map[string]string{"v1": "bar", "v2": "ding"}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Queries route with regexp pattern, match", - route: new(Route).Queries("foo", "{v1:[0-9]+}"), - request: newRequest("GET", "http://localhost?foo=10"), - vars: map[string]string{"v1": "10"}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Queries route with regexp pattern, regexp does not match", - route: new(Route).Queries("foo", "{v1:[0-9]+}"), - request: newRequest("GET", "http://localhost?foo=a"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: false, - }, - { - title: "Queries route with regexp pattern with quantifier, match", - route: new(Route).Queries("foo", "{v1:[0-9]{1}}"), - request: newRequest("GET", "http://localhost?foo=1"), - vars: map[string]string{"v1": "1"}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Queries route with regexp pattern with quantifier, additional variable in query string, match", - route: new(Route).Queries("foo", "{v1:[0-9]{1}}"), - request: newRequest("GET", "http://localhost?bar=2&foo=1"), - vars: map[string]string{"v1": "1"}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Queries route with regexp pattern with quantifier, regexp does not match", - route: new(Route).Queries("foo", "{v1:[0-9]{1}}"), - request: newRequest("GET", "http://localhost?foo=12"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: false, - }, - { - title: "Queries route with regexp pattern with quantifier, additional capturing group", - route: new(Route).Queries("foo", "{v1:[0-9]{1}(a|b)}"), - request: newRequest("GET", "http://localhost?foo=1a"), - vars: map[string]string{"v1": "1a"}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Queries route with regexp pattern with quantifier, additional variable in query string, regexp does not match", - route: new(Route).Queries("foo", "{v1:[0-9]{1}}"), - request: newRequest("GET", "http://localhost?foo=12"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: false, - }, - { - title: "Queries route with hyphenated name, match", - route: new(Route).Queries("foo", "{v-1}"), - request: newRequest("GET", "http://localhost?foo=bar"), - vars: map[string]string{"v-1": "bar"}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Queries route with multiple hyphenated names, match", - route: new(Route).Queries("foo", "{v-1}", "baz", "{v-2}"), - request: newRequest("GET", "http://localhost?foo=bar&baz=ding"), - vars: map[string]string{"v-1": "bar", "v-2": "ding"}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Queries route with hyphenate name and pattern, match", - route: new(Route).Queries("foo", "{v-1:[0-9]+}"), - request: newRequest("GET", "http://localhost?foo=10"), - vars: map[string]string{"v-1": "10"}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Queries route with hyphenated name and pattern with quantifier, additional capturing group", - route: new(Route).Queries("foo", "{v-1:[0-9]{1}(a|b)}"), - request: newRequest("GET", "http://localhost?foo=1a"), - vars: map[string]string{"v-1": "1a"}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Queries route with empty value, should match", - route: new(Route).Queries("foo", ""), - request: newRequest("GET", "http://localhost?foo=bar"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Queries route with empty value and no parameter in request, should not match", - route: new(Route).Queries("foo", ""), - request: newRequest("GET", "http://localhost"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: false, - }, - { - title: "Queries route with empty value and empty parameter in request, should match", - route: new(Route).Queries("foo", ""), - request: newRequest("GET", "http://localhost?foo="), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Queries route with overlapping value, should not match", - route: new(Route).Queries("foo", "bar"), - request: newRequest("GET", "http://localhost?foo=barfoo"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: false, - }, - { - title: "Queries route with no parameter in request, should not match", - route: new(Route).Queries("foo", "{bar}"), - request: newRequest("GET", "http://localhost"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: false, - }, - { - title: "Queries route with empty parameter in request, should match", - route: new(Route).Queries("foo", "{bar}"), - request: newRequest("GET", "http://localhost?foo="), - vars: map[string]string{"foo": ""}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Queries route, bad submatch", - route: new(Route).Queries("foo", "bar", "baz", "ding"), - request: newRequest("GET", "http://localhost?fffoo=bar&baz=dingggg"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: false, - }, - } - - for _, test := range tests { - testRoute(t, test) - } -} - -func TestSchemes(t *testing.T) { - tests := []routeTest{ - // Schemes - { - title: "Schemes route, match https", - route: new(Route).Schemes("https", "ftp"), - request: newRequest("GET", "https://localhost"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Schemes route, match ftp", - route: new(Route).Schemes("https", "ftp"), - request: newRequest("GET", "ftp://localhost"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "Schemes route, bad scheme", - route: new(Route).Schemes("https", "ftp"), - request: newRequest("GET", "http://localhost"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: false, - }, - } - for _, test := range tests { - testRoute(t, test) - } -} - -func TestMatcherFunc(t *testing.T) { - m := func(r *http.Request, m *RouteMatch) bool { - if r.URL.Host == "aaa.bbb.ccc" { - return true - } - return false - } - - tests := []routeTest{ - { - title: "MatchFunc route, match", - route: new(Route).MatcherFunc(m), - request: newRequest("GET", "http://aaa.bbb.ccc"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: true, - }, - { - title: "MatchFunc route, non-match", - route: new(Route).MatcherFunc(m), - request: newRequest("GET", "http://aaa.222.ccc"), - vars: map[string]string{}, - host: "", - path: "", - shouldMatch: false, - }, - } - - for _, test := range tests { - testRoute(t, test) - } -} - -func TestBuildVarsFunc(t *testing.T) { - tests := []routeTest{ - { - title: "BuildVarsFunc set on route", - route: new(Route).Path(`/111/{v1:\d}{v2:.*}`).BuildVarsFunc(func(vars map[string]string) map[string]string { - vars["v1"] = "3" - vars["v2"] = "a" - return vars - }), - request: newRequest("GET", "http://localhost/111/2"), - path: "/111/3a", - shouldMatch: true, - }, - { - title: "BuildVarsFunc set on route and parent route", - route: new(Route).PathPrefix(`/{v1:\d}`).BuildVarsFunc(func(vars map[string]string) map[string]string { - vars["v1"] = "2" - return vars - }).Subrouter().Path(`/{v2:\w}`).BuildVarsFunc(func(vars map[string]string) map[string]string { - vars["v2"] = "b" - return vars - }), - request: newRequest("GET", "http://localhost/1/a"), - path: "/2/b", - shouldMatch: true, - }, - } - - for _, test := range tests { - testRoute(t, test) - } -} - -func TestSubRouter(t *testing.T) { - subrouter1 := new(Route).Host("{v1:[a-z]+}.google.com").Subrouter() - subrouter2 := new(Route).PathPrefix("/foo/{v1}").Subrouter() - - tests := []routeTest{ - { - route: subrouter1.Path("/{v2:[a-z]+}"), - request: newRequest("GET", "http://aaa.google.com/bbb"), - vars: map[string]string{"v1": "aaa", "v2": "bbb"}, - host: "aaa.google.com", - path: "/bbb", - shouldMatch: true, - }, - { - route: subrouter1.Path("/{v2:[a-z]+}"), - request: newRequest("GET", "http://111.google.com/111"), - vars: map[string]string{"v1": "aaa", "v2": "bbb"}, - host: "aaa.google.com", - path: "/bbb", - shouldMatch: false, - }, - { - route: subrouter2.Path("/baz/{v2}"), - request: newRequest("GET", "http://localhost/foo/bar/baz/ding"), - vars: map[string]string{"v1": "bar", "v2": "ding"}, - host: "", - path: "/foo/bar/baz/ding", - shouldMatch: true, - }, - { - route: subrouter2.Path("/baz/{v2}"), - request: newRequest("GET", "http://localhost/foo/bar"), - vars: map[string]string{"v1": "bar", "v2": "ding"}, - host: "", - path: "/foo/bar/baz/ding", - shouldMatch: false, - }, - } - - for _, test := range tests { - testRoute(t, test) - } -} - -func TestNamedRoutes(t *testing.T) { - r1 := NewRouter() - r1.NewRoute().Name("a") - r1.NewRoute().Name("b") - r1.NewRoute().Name("c") - - r2 := r1.NewRoute().Subrouter() - r2.NewRoute().Name("d") - r2.NewRoute().Name("e") - r2.NewRoute().Name("f") - - r3 := r2.NewRoute().Subrouter() - r3.NewRoute().Name("g") - r3.NewRoute().Name("h") - r3.NewRoute().Name("i") - - if r1.namedRoutes == nil || len(r1.namedRoutes) != 9 { - t.Errorf("Expected 9 named routes, got %v", r1.namedRoutes) - } else if r1.Get("i") == nil { - t.Errorf("Subroute name not registered") - } -} - -func TestStrictSlash(t *testing.T) { - r := NewRouter() - r.StrictSlash(true) - - tests := []routeTest{ - { - title: "Redirect path without slash", - route: r.NewRoute().Path("/111/"), - request: newRequest("GET", "http://localhost/111"), - vars: map[string]string{}, - host: "", - path: "/111/", - shouldMatch: true, - shouldRedirect: true, - }, - { - title: "Do not redirect path with slash", - route: r.NewRoute().Path("/111/"), - request: newRequest("GET", "http://localhost/111/"), - vars: map[string]string{}, - host: "", - path: "/111/", - shouldMatch: true, - shouldRedirect: false, - }, - { - title: "Redirect path with slash", - route: r.NewRoute().Path("/111"), - request: newRequest("GET", "http://localhost/111/"), - vars: map[string]string{}, - host: "", - path: "/111", - shouldMatch: true, - shouldRedirect: true, - }, - { - title: "Do not redirect path without slash", - route: r.NewRoute().Path("/111"), - request: newRequest("GET", "http://localhost/111"), - vars: map[string]string{}, - host: "", - path: "/111", - shouldMatch: true, - shouldRedirect: false, - }, - { - title: "Propagate StrictSlash to subrouters", - route: r.NewRoute().PathPrefix("/static/").Subrouter().Path("/images/"), - request: newRequest("GET", "http://localhost/static/images"), - vars: map[string]string{}, - host: "", - path: "/static/images/", - shouldMatch: true, - shouldRedirect: true, - }, - { - title: "Ignore StrictSlash for path prefix", - route: r.NewRoute().PathPrefix("/static/"), - request: newRequest("GET", "http://localhost/static/logo.png"), - vars: map[string]string{}, - host: "", - path: "/static/", - shouldMatch: true, - shouldRedirect: false, - }, - } - - for _, test := range tests { - testRoute(t, test) - } -} - -func TestWalkSingleDepth(t *testing.T) { - r0 := NewRouter() - r1 := NewRouter() - r2 := NewRouter() - - r0.Path("/g") - r0.Path("/o") - r0.Path("/d").Handler(r1) - r0.Path("/r").Handler(r2) - r0.Path("/a") - - r1.Path("/z") - r1.Path("/i") - r1.Path("/l") - r1.Path("/l") - - r2.Path("/i") - r2.Path("/l") - r2.Path("/l") - - paths := []string{"g", "o", "r", "i", "l", "l", "a"} - depths := []int{0, 0, 0, 1, 1, 1, 0} - i := 0 - err := r0.Walk(func(route *Route, router *Router, ancestors []*Route) error { - matcher := route.matchers[0].(*routeRegexp) - if matcher.template == "/d" { - return SkipRouter - } - if len(ancestors) != depths[i] { - t.Errorf(`Expected depth of %d at i = %d; got "%d"`, depths[i], i, len(ancestors)) - } - if matcher.template != "/"+paths[i] { - t.Errorf(`Expected "/%s" at i = %d; got "%s"`, paths[i], i, matcher.template) - } - i++ - return nil - }) - if err != nil { - panic(err) - } - if i != len(paths) { - t.Errorf("Expected %d routes, found %d", len(paths), i) - } -} - -func TestWalkNested(t *testing.T) { - router := NewRouter() - - g := router.Path("/g").Subrouter() - o := g.PathPrefix("/o").Subrouter() - r := o.PathPrefix("/r").Subrouter() - i := r.PathPrefix("/i").Subrouter() - l1 := i.PathPrefix("/l").Subrouter() - l2 := l1.PathPrefix("/l").Subrouter() - l2.Path("/a") - - paths := []string{"/g", "/g/o", "/g/o/r", "/g/o/r/i", "/g/o/r/i/l", "/g/o/r/i/l/l", "/g/o/r/i/l/l/a"} - idx := 0 - err := router.Walk(func(route *Route, router *Router, ancestors []*Route) error { - path := paths[idx] - tpl := route.regexp.path.template - if tpl != path { - t.Errorf(`Expected %s got %s`, path, tpl) - } - idx++ - return nil - }) - if err != nil { - panic(err) - } - if idx != len(paths) { - t.Errorf("Expected %d routes, found %d", len(paths), idx) - } -} - -func TestSubrouterErrorHandling(t *testing.T) { - superRouterCalled := false - subRouterCalled := false - - router := NewRouter() - router.NotFoundHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - superRouterCalled = true - }) - subRouter := router.PathPrefix("/bign8").Subrouter() - subRouter.NotFoundHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - subRouterCalled = true - }) - - req, _ := http.NewRequest("GET", "http://localhost/bign8/was/here", nil) - router.ServeHTTP(NewRecorder(), req) - - if superRouterCalled { - t.Error("Super router 404 handler called when sub-router 404 handler is available.") - } - if !subRouterCalled { - t.Error("Sub-router 404 handler was not called.") - } -} - -// ---------------------------------------------------------------------------- -// Helpers -// ---------------------------------------------------------------------------- - -func getRouteTemplate(route *Route) string { - host, path := "none", "none" - if route.regexp != nil { - if route.regexp.host != nil { - host = route.regexp.host.template - } - if route.regexp.path != nil { - path = route.regexp.path.template - } - } - return fmt.Sprintf("Host: %v, Path: %v", host, path) -} - -func testRoute(t *testing.T, test routeTest) { - request := test.request - route := test.route - vars := test.vars - shouldMatch := test.shouldMatch - host := test.host - path := test.path - url := test.host + test.path - shouldRedirect := test.shouldRedirect - - var match RouteMatch - ok := route.Match(request, &match) - if ok != shouldMatch { - msg := "Should match" - if !shouldMatch { - msg = "Should not match" - } - t.Errorf("(%v) %v:\nRoute: %#v\nRequest: %#v\nVars: %v\n", test.title, msg, route, request, vars) - return - } - if shouldMatch { - if test.vars != nil && !stringMapEqual(test.vars, match.Vars) { - t.Errorf("(%v) Vars not equal: expected %v, got %v", test.title, vars, match.Vars) - return - } - if host != "" { - u, _ := test.route.URLHost(mapToPairs(match.Vars)...) - if host != u.Host { - t.Errorf("(%v) URLHost not equal: expected %v, got %v -- %v", test.title, host, u.Host, getRouteTemplate(route)) - return - } - } - if path != "" { - u, _ := route.URLPath(mapToPairs(match.Vars)...) - if path != u.Path { - t.Errorf("(%v) URLPath not equal: expected %v, got %v -- %v", test.title, path, u.Path, getRouteTemplate(route)) - return - } - } - if url != "" { - u, _ := route.URL(mapToPairs(match.Vars)...) - if url != u.Host+u.Path { - t.Errorf("(%v) URL not equal: expected %v, got %v -- %v", test.title, url, u.Host+u.Path, getRouteTemplate(route)) - return - } - } - if shouldRedirect && match.Handler == nil { - t.Errorf("(%v) Did not redirect", test.title) - return - } - if !shouldRedirect && match.Handler != nil { - t.Errorf("(%v) Unexpected redirect", test.title) - return - } - } -} - -// Tests that the context is cleared or not cleared properly depending on -// the configuration of the router -func TestKeepContext(t *testing.T) { - func1 := func(w http.ResponseWriter, r *http.Request) {} - - r := NewRouter() - r.HandleFunc("/", func1).Name("func1") - - req, _ := http.NewRequest("GET", "http://localhost/", nil) - context.Set(req, "t", 1) - - res := new(http.ResponseWriter) - r.ServeHTTP(*res, req) - - if _, ok := context.GetOk(req, "t"); ok { - t.Error("Context should have been cleared at end of request") - } - - r.KeepContext = true - - req, _ = http.NewRequest("GET", "http://localhost/", nil) - context.Set(req, "t", 1) - - r.ServeHTTP(*res, req) - if _, ok := context.GetOk(req, "t"); !ok { - t.Error("Context should NOT have been cleared at end of request") - } - -} - -type TestA301ResponseWriter struct { - hh http.Header - status int -} - -func (ho TestA301ResponseWriter) Header() http.Header { - return http.Header(ho.hh) -} - -func (ho TestA301ResponseWriter) Write(b []byte) (int, error) { - return 0, nil -} - -func (ho TestA301ResponseWriter) WriteHeader(code int) { - ho.status = code -} - -func Test301Redirect(t *testing.T) { - m := make(http.Header) - - func1 := func(w http.ResponseWriter, r *http.Request) {} - func2 := func(w http.ResponseWriter, r *http.Request) {} - - r := NewRouter() - r.HandleFunc("/api/", func2).Name("func2") - r.HandleFunc("/", func1).Name("func1") - - req, _ := http.NewRequest("GET", "http://localhost//api/?abc=def", nil) - - res := TestA301ResponseWriter{ - hh: m, - status: 0, - } - r.ServeHTTP(&res, req) - - if "http://localhost/api/?abc=def" != res.hh["Location"][0] { - t.Errorf("Should have complete URL with query string") - } -} - -// https://plus.google.com/101022900381697718949/posts/eWy6DjFJ6uW -func TestSubrouterHeader(t *testing.T) { - expected := "func1 response" - func1 := func(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, expected) - } - func2 := func(http.ResponseWriter, *http.Request) {} - - r := NewRouter() - s := r.Headers("SomeSpecialHeader", "").Subrouter() - s.HandleFunc("/", func1).Name("func1") - r.HandleFunc("/", func2).Name("func2") - - req, _ := http.NewRequest("GET", "http://localhost/", nil) - req.Header.Add("SomeSpecialHeader", "foo") - match := new(RouteMatch) - matched := r.Match(req, match) - if !matched { - t.Errorf("Should match request") - } - if match.Route.GetName() != "func1" { - t.Errorf("Expecting func1 handler, got %s", match.Route.GetName()) - } - resp := NewRecorder() - match.Handler.ServeHTTP(resp, req) - if resp.Body.String() != expected { - t.Errorf("Expecting %q", expected) - } -} - -// mapToPairs converts a string map to a slice of string pairs -func mapToPairs(m map[string]string) []string { - var i int - p := make([]string, len(m)*2) - for k, v := range m { - p[i] = k - p[i+1] = v - i += 2 - } - return p -} - -// stringMapEqual checks the equality of two string maps -func stringMapEqual(m1, m2 map[string]string) bool { - nil1 := m1 == nil - nil2 := m2 == nil - if nil1 != nil2 || len(m1) != len(m2) { - return false - } - for k, v := range m1 { - if v != m2[k] { - return false - } - } - return true -} - -// newRequest is a helper function to create a new request with a method and url -func newRequest(method, url string) *http.Request { - req, err := http.NewRequest(method, url, nil) - if err != nil { - panic(err) - } - return req -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/old_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/old_test.go deleted file mode 100644 index 755db483e8..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/old_test.go +++ /dev/null @@ -1,714 +0,0 @@ -// Old tests ported to Go1. This is a mess. Want to drop it one day. - -// Copyright 2011 Gorilla Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package mux - -import ( - "bytes" - "net/http" - "testing" -) - -// ---------------------------------------------------------------------------- -// ResponseRecorder -// ---------------------------------------------------------------------------- -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// ResponseRecorder is an implementation of http.ResponseWriter that -// records its mutations for later inspection in tests. -type ResponseRecorder struct { - Code int // the HTTP response code from WriteHeader - HeaderMap http.Header // the HTTP response headers - Body *bytes.Buffer // if non-nil, the bytes.Buffer to append written data to - Flushed bool -} - -// NewRecorder returns an initialized ResponseRecorder. -func NewRecorder() *ResponseRecorder { - return &ResponseRecorder{ - HeaderMap: make(http.Header), - Body: new(bytes.Buffer), - } -} - -// DefaultRemoteAddr is the default remote address to return in RemoteAddr if -// an explicit DefaultRemoteAddr isn't set on ResponseRecorder. -const DefaultRemoteAddr = "1.2.3.4" - -// Header returns the response headers. -func (rw *ResponseRecorder) Header() http.Header { - return rw.HeaderMap -} - -// Write always succeeds and writes to rw.Body, if not nil. -func (rw *ResponseRecorder) Write(buf []byte) (int, error) { - if rw.Body != nil { - rw.Body.Write(buf) - } - if rw.Code == 0 { - rw.Code = http.StatusOK - } - return len(buf), nil -} - -// WriteHeader sets rw.Code. -func (rw *ResponseRecorder) WriteHeader(code int) { - rw.Code = code -} - -// Flush sets rw.Flushed to true. -func (rw *ResponseRecorder) Flush() { - rw.Flushed = true -} - -// ---------------------------------------------------------------------------- - -func TestRouteMatchers(t *testing.T) { - var scheme, host, path, query, method string - var headers map[string]string - var resultVars map[bool]map[string]string - - router := NewRouter() - router.NewRoute().Host("{var1}.google.com"). - Path("/{var2:[a-z]+}/{var3:[0-9]+}"). - Queries("foo", "bar"). - Methods("GET"). - Schemes("https"). - Headers("x-requested-with", "XMLHttpRequest") - router.NewRoute().Host("www.{var4}.com"). - PathPrefix("/foo/{var5:[a-z]+}/{var6:[0-9]+}"). - Queries("baz", "ding"). - Methods("POST"). - Schemes("http"). - Headers("Content-Type", "application/json") - - reset := func() { - // Everything match. - scheme = "https" - host = "www.google.com" - path = "/product/42" - query = "?foo=bar" - method = "GET" - headers = map[string]string{"X-Requested-With": "XMLHttpRequest"} - resultVars = map[bool]map[string]string{ - true: {"var1": "www", "var2": "product", "var3": "42"}, - false: {}, - } - } - - reset2 := func() { - // Everything match. - scheme = "http" - host = "www.google.com" - path = "/foo/product/42/path/that/is/ignored" - query = "?baz=ding" - method = "POST" - headers = map[string]string{"Content-Type": "application/json"} - resultVars = map[bool]map[string]string{ - true: {"var4": "google", "var5": "product", "var6": "42"}, - false: {}, - } - } - - match := func(shouldMatch bool) { - url := scheme + "://" + host + path + query - request, _ := http.NewRequest(method, url, nil) - for key, value := range headers { - request.Header.Add(key, value) - } - - var routeMatch RouteMatch - matched := router.Match(request, &routeMatch) - if matched != shouldMatch { - // Need better messages. :) - if matched { - t.Errorf("Should match.") - } else { - t.Errorf("Should not match.") - } - } - - if matched { - currentRoute := routeMatch.Route - if currentRoute == nil { - t.Errorf("Expected a current route.") - } - vars := routeMatch.Vars - expectedVars := resultVars[shouldMatch] - if len(vars) != len(expectedVars) { - t.Errorf("Expected vars: %v Got: %v.", expectedVars, vars) - } - for name, value := range vars { - if expectedVars[name] != value { - t.Errorf("Expected vars: %v Got: %v.", expectedVars, vars) - } - } - } - } - - // 1st route -------------------------------------------------------------- - - // Everything match. - reset() - match(true) - - // Scheme doesn't match. - reset() - scheme = "http" - match(false) - - // Host doesn't match. - reset() - host = "www.mygoogle.com" - match(false) - - // Path doesn't match. - reset() - path = "/product/notdigits" - match(false) - - // Query doesn't match. - reset() - query = "?foo=baz" - match(false) - - // Method doesn't match. - reset() - method = "POST" - match(false) - - // Header doesn't match. - reset() - headers = map[string]string{} - match(false) - - // Everything match, again. - reset() - match(true) - - // 2nd route -------------------------------------------------------------- - - // Everything match. - reset2() - match(true) - - // Scheme doesn't match. - reset2() - scheme = "https" - match(false) - - // Host doesn't match. - reset2() - host = "sub.google.com" - match(false) - - // Path doesn't match. - reset2() - path = "/bar/product/42" - match(false) - - // Query doesn't match. - reset2() - query = "?foo=baz" - match(false) - - // Method doesn't match. - reset2() - method = "GET" - match(false) - - // Header doesn't match. - reset2() - headers = map[string]string{} - match(false) - - // Everything match, again. - reset2() - match(true) -} - -type headerMatcherTest struct { - matcher headerMatcher - headers map[string]string - result bool -} - -var headerMatcherTests = []headerMatcherTest{ - { - matcher: headerMatcher(map[string]string{"x-requested-with": "XMLHttpRequest"}), - headers: map[string]string{"X-Requested-With": "XMLHttpRequest"}, - result: true, - }, - { - matcher: headerMatcher(map[string]string{"x-requested-with": ""}), - headers: map[string]string{"X-Requested-With": "anything"}, - result: true, - }, - { - matcher: headerMatcher(map[string]string{"x-requested-with": "XMLHttpRequest"}), - headers: map[string]string{}, - result: false, - }, -} - -type hostMatcherTest struct { - matcher *Route - url string - vars map[string]string - result bool -} - -var hostMatcherTests = []hostMatcherTest{ - { - matcher: NewRouter().NewRoute().Host("{foo:[a-z][a-z][a-z]}.{bar:[a-z][a-z][a-z]}.{baz:[a-z][a-z][a-z]}"), - url: "http://abc.def.ghi/", - vars: map[string]string{"foo": "abc", "bar": "def", "baz": "ghi"}, - result: true, - }, - { - matcher: NewRouter().NewRoute().Host("{foo:[a-z][a-z][a-z]}.{bar:[a-z][a-z][a-z]}.{baz:[a-z][a-z][a-z]}"), - url: "http://a.b.c/", - vars: map[string]string{"foo": "abc", "bar": "def", "baz": "ghi"}, - result: false, - }, -} - -type methodMatcherTest struct { - matcher methodMatcher - method string - result bool -} - -var methodMatcherTests = []methodMatcherTest{ - { - matcher: methodMatcher([]string{"GET", "POST", "PUT"}), - method: "GET", - result: true, - }, - { - matcher: methodMatcher([]string{"GET", "POST", "PUT"}), - method: "POST", - result: true, - }, - { - matcher: methodMatcher([]string{"GET", "POST", "PUT"}), - method: "PUT", - result: true, - }, - { - matcher: methodMatcher([]string{"GET", "POST", "PUT"}), - method: "DELETE", - result: false, - }, -} - -type pathMatcherTest struct { - matcher *Route - url string - vars map[string]string - result bool -} - -var pathMatcherTests = []pathMatcherTest{ - { - matcher: NewRouter().NewRoute().Path("/{foo:[0-9][0-9][0-9]}/{bar:[0-9][0-9][0-9]}/{baz:[0-9][0-9][0-9]}"), - url: "http://localhost:8080/123/456/789", - vars: map[string]string{"foo": "123", "bar": "456", "baz": "789"}, - result: true, - }, - { - matcher: NewRouter().NewRoute().Path("/{foo:[0-9][0-9][0-9]}/{bar:[0-9][0-9][0-9]}/{baz:[0-9][0-9][0-9]}"), - url: "http://localhost:8080/1/2/3", - vars: map[string]string{"foo": "123", "bar": "456", "baz": "789"}, - result: false, - }, -} - -type schemeMatcherTest struct { - matcher schemeMatcher - url string - result bool -} - -var schemeMatcherTests = []schemeMatcherTest{ - { - matcher: schemeMatcher([]string{"http", "https"}), - url: "http://localhost:8080/", - result: true, - }, - { - matcher: schemeMatcher([]string{"http", "https"}), - url: "https://localhost:8080/", - result: true, - }, - { - matcher: schemeMatcher([]string{"https"}), - url: "http://localhost:8080/", - result: false, - }, - { - matcher: schemeMatcher([]string{"http"}), - url: "https://localhost:8080/", - result: false, - }, -} - -type urlBuildingTest struct { - route *Route - vars []string - url string -} - -var urlBuildingTests = []urlBuildingTest{ - { - route: new(Route).Host("foo.domain.com"), - vars: []string{}, - url: "http://foo.domain.com", - }, - { - route: new(Route).Host("{subdomain}.domain.com"), - vars: []string{"subdomain", "bar"}, - url: "http://bar.domain.com", - }, - { - route: new(Route).Host("foo.domain.com").Path("/articles"), - vars: []string{}, - url: "http://foo.domain.com/articles", - }, - { - route: new(Route).Path("/articles"), - vars: []string{}, - url: "/articles", - }, - { - route: new(Route).Path("/articles/{category}/{id:[0-9]+}"), - vars: []string{"category", "technology", "id", "42"}, - url: "/articles/technology/42", - }, - { - route: new(Route).Host("{subdomain}.domain.com").Path("/articles/{category}/{id:[0-9]+}"), - vars: []string{"subdomain", "foo", "category", "technology", "id", "42"}, - url: "http://foo.domain.com/articles/technology/42", - }, -} - -func TestHeaderMatcher(t *testing.T) { - for _, v := range headerMatcherTests { - request, _ := http.NewRequest("GET", "http://localhost:8080/", nil) - for key, value := range v.headers { - request.Header.Add(key, value) - } - var routeMatch RouteMatch - result := v.matcher.Match(request, &routeMatch) - if result != v.result { - if v.result { - t.Errorf("%#v: should match %v.", v.matcher, request.Header) - } else { - t.Errorf("%#v: should not match %v.", v.matcher, request.Header) - } - } - } -} - -func TestHostMatcher(t *testing.T) { - for _, v := range hostMatcherTests { - request, _ := http.NewRequest("GET", v.url, nil) - var routeMatch RouteMatch - result := v.matcher.Match(request, &routeMatch) - vars := routeMatch.Vars - if result != v.result { - if v.result { - t.Errorf("%#v: should match %v.", v.matcher, v.url) - } else { - t.Errorf("%#v: should not match %v.", v.matcher, v.url) - } - } - if result { - if len(vars) != len(v.vars) { - t.Errorf("%#v: vars length should be %v, got %v.", v.matcher, len(v.vars), len(vars)) - } - for name, value := range vars { - if v.vars[name] != value { - t.Errorf("%#v: expected value %v for key %v, got %v.", v.matcher, v.vars[name], name, value) - } - } - } else { - if len(vars) != 0 { - t.Errorf("%#v: vars length should be 0, got %v.", v.matcher, len(vars)) - } - } - } -} - -func TestMethodMatcher(t *testing.T) { - for _, v := range methodMatcherTests { - request, _ := http.NewRequest(v.method, "http://localhost:8080/", nil) - var routeMatch RouteMatch - result := v.matcher.Match(request, &routeMatch) - if result != v.result { - if v.result { - t.Errorf("%#v: should match %v.", v.matcher, v.method) - } else { - t.Errorf("%#v: should not match %v.", v.matcher, v.method) - } - } - } -} - -func TestPathMatcher(t *testing.T) { - for _, v := range pathMatcherTests { - request, _ := http.NewRequest("GET", v.url, nil) - var routeMatch RouteMatch - result := v.matcher.Match(request, &routeMatch) - vars := routeMatch.Vars - if result != v.result { - if v.result { - t.Errorf("%#v: should match %v.", v.matcher, v.url) - } else { - t.Errorf("%#v: should not match %v.", v.matcher, v.url) - } - } - if result { - if len(vars) != len(v.vars) { - t.Errorf("%#v: vars length should be %v, got %v.", v.matcher, len(v.vars), len(vars)) - } - for name, value := range vars { - if v.vars[name] != value { - t.Errorf("%#v: expected value %v for key %v, got %v.", v.matcher, v.vars[name], name, value) - } - } - } else { - if len(vars) != 0 { - t.Errorf("%#v: vars length should be 0, got %v.", v.matcher, len(vars)) - } - } - } -} - -func TestSchemeMatcher(t *testing.T) { - for _, v := range schemeMatcherTests { - request, _ := http.NewRequest("GET", v.url, nil) - var routeMatch RouteMatch - result := v.matcher.Match(request, &routeMatch) - if result != v.result { - if v.result { - t.Errorf("%#v: should match %v.", v.matcher, v.url) - } else { - t.Errorf("%#v: should not match %v.", v.matcher, v.url) - } - } - } -} - -func TestUrlBuilding(t *testing.T) { - - for _, v := range urlBuildingTests { - u, _ := v.route.URL(v.vars...) - url := u.String() - if url != v.url { - t.Errorf("expected %v, got %v", v.url, url) - /* - reversePath := "" - reverseHost := "" - if v.route.pathTemplate != nil { - reversePath = v.route.pathTemplate.Reverse - } - if v.route.hostTemplate != nil { - reverseHost = v.route.hostTemplate.Reverse - } - - t.Errorf("%#v:\nexpected: %q\ngot: %q\nreverse path: %q\nreverse host: %q", v.route, v.url, url, reversePath, reverseHost) - */ - } - } - - ArticleHandler := func(w http.ResponseWriter, r *http.Request) { - } - - router := NewRouter() - router.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler).Name("article") - - url, _ := router.Get("article").URL("category", "technology", "id", "42") - expected := "/articles/technology/42" - if url.String() != expected { - t.Errorf("Expected %v, got %v", expected, url.String()) - } -} - -func TestMatchedRouteName(t *testing.T) { - routeName := "stock" - router := NewRouter() - route := router.NewRoute().Path("/products/").Name(routeName) - - url := "http://www.example.com/products/" - request, _ := http.NewRequest("GET", url, nil) - var rv RouteMatch - ok := router.Match(request, &rv) - - if !ok || rv.Route != route { - t.Errorf("Expected same route, got %+v.", rv.Route) - } - - retName := rv.Route.GetName() - if retName != routeName { - t.Errorf("Expected %q, got %q.", routeName, retName) - } -} - -func TestSubRouting(t *testing.T) { - // Example from docs. - router := NewRouter() - subrouter := router.NewRoute().Host("www.example.com").Subrouter() - route := subrouter.NewRoute().Path("/products/").Name("products") - - url := "http://www.example.com/products/" - request, _ := http.NewRequest("GET", url, nil) - var rv RouteMatch - ok := router.Match(request, &rv) - - if !ok || rv.Route != route { - t.Errorf("Expected same route, got %+v.", rv.Route) - } - - u, _ := router.Get("products").URL() - builtUrl := u.String() - // Yay, subroute aware of the domain when building! - if builtUrl != url { - t.Errorf("Expected %q, got %q.", url, builtUrl) - } -} - -func TestVariableNames(t *testing.T) { - route := new(Route).Host("{arg1}.domain.com").Path("/{arg1}/{arg2:[0-9]+}") - if route.err == nil { - t.Errorf("Expected error for duplicated variable names") - } -} - -func TestRedirectSlash(t *testing.T) { - var route *Route - var routeMatch RouteMatch - r := NewRouter() - - r.StrictSlash(false) - route = r.NewRoute() - if route.strictSlash != false { - t.Errorf("Expected false redirectSlash.") - } - - r.StrictSlash(true) - route = r.NewRoute() - if route.strictSlash != true { - t.Errorf("Expected true redirectSlash.") - } - - route = new(Route) - route.strictSlash = true - route.Path("/{arg1}/{arg2:[0-9]+}/") - request, _ := http.NewRequest("GET", "http://localhost/foo/123", nil) - routeMatch = RouteMatch{} - _ = route.Match(request, &routeMatch) - vars := routeMatch.Vars - if vars["arg1"] != "foo" { - t.Errorf("Expected foo.") - } - if vars["arg2"] != "123" { - t.Errorf("Expected 123.") - } - rsp := NewRecorder() - routeMatch.Handler.ServeHTTP(rsp, request) - if rsp.HeaderMap.Get("Location") != "http://localhost/foo/123/" { - t.Errorf("Expected redirect header.") - } - - route = new(Route) - route.strictSlash = true - route.Path("/{arg1}/{arg2:[0-9]+}") - request, _ = http.NewRequest("GET", "http://localhost/foo/123/", nil) - routeMatch = RouteMatch{} - _ = route.Match(request, &routeMatch) - vars = routeMatch.Vars - if vars["arg1"] != "foo" { - t.Errorf("Expected foo.") - } - if vars["arg2"] != "123" { - t.Errorf("Expected 123.") - } - rsp = NewRecorder() - routeMatch.Handler.ServeHTTP(rsp, request) - if rsp.HeaderMap.Get("Location") != "http://localhost/foo/123" { - t.Errorf("Expected redirect header.") - } -} - -// Test for the new regexp library, still not available in stable Go. -func TestNewRegexp(t *testing.T) { - var p *routeRegexp - var matches []string - - tests := map[string]map[string][]string{ - "/{foo:a{2}}": { - "/a": nil, - "/aa": {"aa"}, - "/aaa": nil, - "/aaaa": nil, - }, - "/{foo:a{2,}}": { - "/a": nil, - "/aa": {"aa"}, - "/aaa": {"aaa"}, - "/aaaa": {"aaaa"}, - }, - "/{foo:a{2,3}}": { - "/a": nil, - "/aa": {"aa"}, - "/aaa": {"aaa"}, - "/aaaa": nil, - }, - "/{foo:[a-z]{3}}/{bar:[a-z]{2}}": { - "/a": nil, - "/ab": nil, - "/abc": nil, - "/abcd": nil, - "/abc/ab": {"abc", "ab"}, - "/abc/abc": nil, - "/abcd/ab": nil, - }, - `/{foo:\w{3,}}/{bar:\d{2,}}`: { - "/a": nil, - "/ab": nil, - "/abc": nil, - "/abc/1": nil, - "/abc/12": {"abc", "12"}, - "/abcd/12": {"abcd", "12"}, - "/abcd/123": {"abcd", "123"}, - }, - } - - for pattern, paths := range tests { - p, _ = newRouteRegexp(pattern, false, false, false, false) - for path, result := range paths { - matches = p.regexp.FindStringSubmatch(path) - if result == nil { - if matches != nil { - t.Errorf("%v should not match %v.", pattern, path) - } - } else { - if len(matches) != len(result)+1 { - t.Errorf("Expected %v matches, got %v.", len(result)+1, len(matches)) - } else { - for k, v := range result { - if matches[k+1] != v { - t.Errorf("Expected %v, got %v.", v, matches[k+1]) - } - } - } - } - } - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user/user_test.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user/user_test.go deleted file mode 100644 index 53b2289bf0..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user/user_test.go +++ /dev/null @@ -1,472 +0,0 @@ -package user - -import ( - "io" - "reflect" - "sort" - "strconv" - "strings" - "testing" -) - -func TestUserParseLine(t *testing.T) { - var ( - a, b string - c []string - d int - ) - - parseLine("", &a, &b) - if a != "" || b != "" { - t.Fatalf("a and b should be empty ('%v', '%v')", a, b) - } - - parseLine("a", &a, &b) - if a != "a" || b != "" { - t.Fatalf("a should be 'a' and b should be empty ('%v', '%v')", a, b) - } - - parseLine("bad boys:corny cows", &a, &b) - if a != "bad boys" || b != "corny cows" { - t.Fatalf("a should be 'bad boys' and b should be 'corny cows' ('%v', '%v')", a, b) - } - - parseLine("", &c) - if len(c) != 0 { - t.Fatalf("c should be empty (%#v)", c) - } - - parseLine("d,e,f:g:h:i,j,k", &c, &a, &b, &c) - if a != "g" || b != "h" || len(c) != 3 || c[0] != "i" || c[1] != "j" || c[2] != "k" { - t.Fatalf("a should be 'g', b should be 'h', and c should be ['i','j','k'] ('%v', '%v', '%#v')", a, b, c) - } - - parseLine("::::::::::", &a, &b, &c) - if a != "" || b != "" || len(c) != 0 { - t.Fatalf("a, b, and c should all be empty ('%v', '%v', '%#v')", a, b, c) - } - - parseLine("not a number", &d) - if d != 0 { - t.Fatalf("d should be 0 (%v)", d) - } - - parseLine("b:12:c", &a, &d, &b) - if a != "b" || b != "c" || d != 12 { - t.Fatalf("a should be 'b' and b should be 'c', and d should be 12 ('%v', '%v', %v)", a, b, d) - } -} - -func TestUserParsePasswd(t *testing.T) { - users, err := ParsePasswdFilter(strings.NewReader(` -root:x:0:0:root:/root:/bin/bash -adm:x:3:4:adm:/var/adm:/bin/false -this is just some garbage data -`), nil) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - if len(users) != 3 { - t.Fatalf("Expected 3 users, got %v", len(users)) - } - if users[0].Uid != 0 || users[0].Name != "root" { - t.Fatalf("Expected users[0] to be 0 - root, got %v - %v", users[0].Uid, users[0].Name) - } - if users[1].Uid != 3 || users[1].Name != "adm" { - t.Fatalf("Expected users[1] to be 3 - adm, got %v - %v", users[1].Uid, users[1].Name) - } -} - -func TestUserParseGroup(t *testing.T) { - groups, err := ParseGroupFilter(strings.NewReader(` -root:x:0:root -adm:x:4:root,adm,daemon -this is just some garbage data -`), nil) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - if len(groups) != 3 { - t.Fatalf("Expected 3 groups, got %v", len(groups)) - } - if groups[0].Gid != 0 || groups[0].Name != "root" || len(groups[0].List) != 1 { - t.Fatalf("Expected groups[0] to be 0 - root - 1 member, got %v - %v - %v", groups[0].Gid, groups[0].Name, len(groups[0].List)) - } - if groups[1].Gid != 4 || groups[1].Name != "adm" || len(groups[1].List) != 3 { - t.Fatalf("Expected groups[1] to be 4 - adm - 3 members, got %v - %v - %v", groups[1].Gid, groups[1].Name, len(groups[1].List)) - } -} - -func TestValidGetExecUser(t *testing.T) { - const passwdContent = ` -root:x:0:0:root user:/root:/bin/bash -adm:x:42:43:adm:/var/adm:/bin/false -this is just some garbage data -` - const groupContent = ` -root:x:0:root -adm:x:43: -grp:x:1234:root,adm -this is just some garbage data -` - defaultExecUser := ExecUser{ - Uid: 8888, - Gid: 8888, - Sgids: []int{8888}, - Home: "/8888", - } - - tests := []struct { - ref string - expected ExecUser - }{ - { - ref: "root", - expected: ExecUser{ - Uid: 0, - Gid: 0, - Sgids: []int{0, 1234}, - Home: "/root", - }, - }, - { - ref: "adm", - expected: ExecUser{ - Uid: 42, - Gid: 43, - Sgids: []int{1234}, - Home: "/var/adm", - }, - }, - { - ref: "root:adm", - expected: ExecUser{ - Uid: 0, - Gid: 43, - Sgids: defaultExecUser.Sgids, - Home: "/root", - }, - }, - { - ref: "adm:1234", - expected: ExecUser{ - Uid: 42, - Gid: 1234, - Sgids: defaultExecUser.Sgids, - Home: "/var/adm", - }, - }, - { - ref: "42:1234", - expected: ExecUser{ - Uid: 42, - Gid: 1234, - Sgids: defaultExecUser.Sgids, - Home: "/var/adm", - }, - }, - { - ref: "1337:1234", - expected: ExecUser{ - Uid: 1337, - Gid: 1234, - Sgids: defaultExecUser.Sgids, - Home: defaultExecUser.Home, - }, - }, - { - ref: "1337", - expected: ExecUser{ - Uid: 1337, - Gid: defaultExecUser.Gid, - Sgids: defaultExecUser.Sgids, - Home: defaultExecUser.Home, - }, - }, - { - ref: "", - expected: ExecUser{ - Uid: defaultExecUser.Uid, - Gid: defaultExecUser.Gid, - Sgids: defaultExecUser.Sgids, - Home: defaultExecUser.Home, - }, - }, - } - - for _, test := range tests { - passwd := strings.NewReader(passwdContent) - group := strings.NewReader(groupContent) - - execUser, err := GetExecUser(test.ref, &defaultExecUser, passwd, group) - if err != nil { - t.Logf("got unexpected error when parsing '%s': %s", test.ref, err.Error()) - t.Fail() - continue - } - - if !reflect.DeepEqual(test.expected, *execUser) { - t.Logf("got: %#v", execUser) - t.Logf("expected: %#v", test.expected) - t.Fail() - continue - } - } -} - -func TestInvalidGetExecUser(t *testing.T) { - const passwdContent = ` -root:x:0:0:root user:/root:/bin/bash -adm:x:42:43:adm:/var/adm:/bin/false -this is just some garbage data -` - const groupContent = ` -root:x:0:root -adm:x:43: -grp:x:1234:root,adm -this is just some garbage data -` - - tests := []string{ - // No such user/group. - "notuser", - "notuser:notgroup", - "root:notgroup", - "notuser:adm", - "8888:notgroup", - "notuser:8888", - - // Invalid user/group values. - "-1:0", - "0:-3", - "-5:-2", - } - - for _, test := range tests { - passwd := strings.NewReader(passwdContent) - group := strings.NewReader(groupContent) - - execUser, err := GetExecUser(test, nil, passwd, group) - if err == nil { - t.Logf("got unexpected success when parsing '%s': %#v", test, execUser) - t.Fail() - continue - } - } -} - -func TestGetExecUserNilSources(t *testing.T) { - const passwdContent = ` -root:x:0:0:root user:/root:/bin/bash -adm:x:42:43:adm:/var/adm:/bin/false -this is just some garbage data -` - const groupContent = ` -root:x:0:root -adm:x:43: -grp:x:1234:root,adm -this is just some garbage data -` - - defaultExecUser := ExecUser{ - Uid: 8888, - Gid: 8888, - Sgids: []int{8888}, - Home: "/8888", - } - - tests := []struct { - ref string - passwd, group bool - expected ExecUser - }{ - { - ref: "", - passwd: false, - group: false, - expected: ExecUser{ - Uid: 8888, - Gid: 8888, - Sgids: []int{8888}, - Home: "/8888", - }, - }, - { - ref: "root", - passwd: true, - group: false, - expected: ExecUser{ - Uid: 0, - Gid: 0, - Sgids: []int{8888}, - Home: "/root", - }, - }, - { - ref: "0", - passwd: false, - group: false, - expected: ExecUser{ - Uid: 0, - Gid: 8888, - Sgids: []int{8888}, - Home: "/8888", - }, - }, - { - ref: "0:0", - passwd: false, - group: false, - expected: ExecUser{ - Uid: 0, - Gid: 0, - Sgids: []int{8888}, - Home: "/8888", - }, - }, - } - - for _, test := range tests { - var passwd, group io.Reader - - if test.passwd { - passwd = strings.NewReader(passwdContent) - } - - if test.group { - group = strings.NewReader(groupContent) - } - - execUser, err := GetExecUser(test.ref, &defaultExecUser, passwd, group) - if err != nil { - t.Logf("got unexpected error when parsing '%s': %s", test.ref, err.Error()) - t.Fail() - continue - } - - if !reflect.DeepEqual(test.expected, *execUser) { - t.Logf("got: %#v", execUser) - t.Logf("expected: %#v", test.expected) - t.Fail() - continue - } - } -} - -func TestGetAdditionalGroups(t *testing.T) { - const groupContent = ` -root:x:0:root -adm:x:43: -grp:x:1234:root,adm -adm:x:4343:root,adm-duplicate -this is just some garbage data -` - tests := []struct { - groups []string - expected []int - hasError bool - }{ - { - // empty group - groups: []string{}, - expected: []int{}, - }, - { - // single group - groups: []string{"adm"}, - expected: []int{43}, - }, - { - // multiple groups - groups: []string{"adm", "grp"}, - expected: []int{43, 1234}, - }, - { - // invalid group - groups: []string{"adm", "grp", "not-exist"}, - expected: nil, - hasError: true, - }, - { - // group with numeric id - groups: []string{"43"}, - expected: []int{43}, - }, - { - // group with unknown numeric id - groups: []string{"adm", "10001"}, - expected: []int{43, 10001}, - }, - { - // groups specified twice with numeric and name - groups: []string{"adm", "43"}, - expected: []int{43}, - }, - { - // groups with too small id - groups: []string{"-1"}, - expected: nil, - hasError: true, - }, - { - // groups with too large id - groups: []string{strconv.Itoa(1 << 31)}, - expected: nil, - hasError: true, - }, - } - - for _, test := range tests { - group := strings.NewReader(groupContent) - - gids, err := GetAdditionalGroups(test.groups, group) - if test.hasError && err == nil { - t.Errorf("Parse(%#v) expects error but has none", test) - continue - } - if !test.hasError && err != nil { - t.Errorf("Parse(%#v) has error %v", test, err) - continue - } - sort.Sort(sort.IntSlice(gids)) - if !reflect.DeepEqual(gids, test.expected) { - t.Errorf("Gids(%v), expect %v from groups %v", gids, test.expected, test.groups) - } - } -} - -func TestGetAdditionalGroupsNumeric(t *testing.T) { - tests := []struct { - groups []string - expected []int - hasError bool - }{ - { - // numeric groups only - groups: []string{"1234", "5678"}, - expected: []int{1234, 5678}, - }, - { - // numeric and alphabetic - groups: []string{"1234", "fake"}, - expected: nil, - hasError: true, - }, - } - - for _, test := range tests { - gids, err := GetAdditionalGroups(test.groups, nil) - if test.hasError && err == nil { - t.Errorf("Parse(%#v) expects error but has none", test) - continue - } - if !test.hasError && err != nil { - t.Errorf("Parse(%#v) has error %v", test, err) - continue - } - sort.Sort(sort.IntSlice(gids)) - if !reflect.DeepEqual(gids, test.expected) { - t.Errorf("Gids(%v), expect %v from groups %v", gids, test.expected, test.groups) - } - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/net/context/context_test.go b/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/net/context/context_test.go deleted file mode 100644 index 05345fc5e5..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/net/context/context_test.go +++ /dev/null @@ -1,575 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package context - -import ( - "fmt" - "math/rand" - "runtime" - "strings" - "sync" - "testing" - "time" -) - -// otherContext is a Context that's not one of the types defined in context.go. -// This lets us test code paths that differ based on the underlying type of the -// Context. -type otherContext struct { - Context -} - -func TestBackground(t *testing.T) { - c := Background() - if c == nil { - t.Fatalf("Background returned nil") - } - select { - case x := <-c.Done(): - t.Errorf("<-c.Done() == %v want nothing (it should block)", x) - default: - } - if got, want := fmt.Sprint(c), "context.Background"; got != want { - t.Errorf("Background().String() = %q want %q", got, want) - } -} - -func TestTODO(t *testing.T) { - c := TODO() - if c == nil { - t.Fatalf("TODO returned nil") - } - select { - case x := <-c.Done(): - t.Errorf("<-c.Done() == %v want nothing (it should block)", x) - default: - } - if got, want := fmt.Sprint(c), "context.TODO"; got != want { - t.Errorf("TODO().String() = %q want %q", got, want) - } -} - -func TestWithCancel(t *testing.T) { - c1, cancel := WithCancel(Background()) - - if got, want := fmt.Sprint(c1), "context.Background.WithCancel"; got != want { - t.Errorf("c1.String() = %q want %q", got, want) - } - - o := otherContext{c1} - c2, _ := WithCancel(o) - contexts := []Context{c1, o, c2} - - for i, c := range contexts { - if d := c.Done(); d == nil { - t.Errorf("c[%d].Done() == %v want non-nil", i, d) - } - if e := c.Err(); e != nil { - t.Errorf("c[%d].Err() == %v want nil", i, e) - } - - select { - case x := <-c.Done(): - t.Errorf("<-c.Done() == %v want nothing (it should block)", x) - default: - } - } - - cancel() - time.Sleep(100 * time.Millisecond) // let cancelation propagate - - for i, c := range contexts { - select { - case <-c.Done(): - default: - t.Errorf("<-c[%d].Done() blocked, but shouldn't have", i) - } - if e := c.Err(); e != Canceled { - t.Errorf("c[%d].Err() == %v want %v", i, e, Canceled) - } - } -} - -func TestParentFinishesChild(t *testing.T) { - // Context tree: - // parent -> cancelChild - // parent -> valueChild -> timerChild - parent, cancel := WithCancel(Background()) - cancelChild, stop := WithCancel(parent) - defer stop() - valueChild := WithValue(parent, "key", "value") - timerChild, stop := WithTimeout(valueChild, 10000*time.Hour) - defer stop() - - select { - case x := <-parent.Done(): - t.Errorf("<-parent.Done() == %v want nothing (it should block)", x) - case x := <-cancelChild.Done(): - t.Errorf("<-cancelChild.Done() == %v want nothing (it should block)", x) - case x := <-timerChild.Done(): - t.Errorf("<-timerChild.Done() == %v want nothing (it should block)", x) - case x := <-valueChild.Done(): - t.Errorf("<-valueChild.Done() == %v want nothing (it should block)", x) - default: - } - - // The parent's children should contain the two cancelable children. - pc := parent.(*cancelCtx) - cc := cancelChild.(*cancelCtx) - tc := timerChild.(*timerCtx) - pc.mu.Lock() - if len(pc.children) != 2 || !pc.children[cc] || !pc.children[tc] { - t.Errorf("bad linkage: pc.children = %v, want %v and %v", - pc.children, cc, tc) - } - pc.mu.Unlock() - - if p, ok := parentCancelCtx(cc.Context); !ok || p != pc { - t.Errorf("bad linkage: parentCancelCtx(cancelChild.Context) = %v, %v want %v, true", p, ok, pc) - } - if p, ok := parentCancelCtx(tc.Context); !ok || p != pc { - t.Errorf("bad linkage: parentCancelCtx(timerChild.Context) = %v, %v want %v, true", p, ok, pc) - } - - cancel() - - pc.mu.Lock() - if len(pc.children) != 0 { - t.Errorf("pc.cancel didn't clear pc.children = %v", pc.children) - } - pc.mu.Unlock() - - // parent and children should all be finished. - check := func(ctx Context, name string) { - select { - case <-ctx.Done(): - default: - t.Errorf("<-%s.Done() blocked, but shouldn't have", name) - } - if e := ctx.Err(); e != Canceled { - t.Errorf("%s.Err() == %v want %v", name, e, Canceled) - } - } - check(parent, "parent") - check(cancelChild, "cancelChild") - check(valueChild, "valueChild") - check(timerChild, "timerChild") - - // WithCancel should return a canceled context on a canceled parent. - precanceledChild := WithValue(parent, "key", "value") - select { - case <-precanceledChild.Done(): - default: - t.Errorf("<-precanceledChild.Done() blocked, but shouldn't have") - } - if e := precanceledChild.Err(); e != Canceled { - t.Errorf("precanceledChild.Err() == %v want %v", e, Canceled) - } -} - -func TestChildFinishesFirst(t *testing.T) { - cancelable, stop := WithCancel(Background()) - defer stop() - for _, parent := range []Context{Background(), cancelable} { - child, cancel := WithCancel(parent) - - select { - case x := <-parent.Done(): - t.Errorf("<-parent.Done() == %v want nothing (it should block)", x) - case x := <-child.Done(): - t.Errorf("<-child.Done() == %v want nothing (it should block)", x) - default: - } - - cc := child.(*cancelCtx) - pc, pcok := parent.(*cancelCtx) // pcok == false when parent == Background() - if p, ok := parentCancelCtx(cc.Context); ok != pcok || (ok && pc != p) { - t.Errorf("bad linkage: parentCancelCtx(cc.Context) = %v, %v want %v, %v", p, ok, pc, pcok) - } - - if pcok { - pc.mu.Lock() - if len(pc.children) != 1 || !pc.children[cc] { - t.Errorf("bad linkage: pc.children = %v, cc = %v", pc.children, cc) - } - pc.mu.Unlock() - } - - cancel() - - if pcok { - pc.mu.Lock() - if len(pc.children) != 0 { - t.Errorf("child's cancel didn't remove self from pc.children = %v", pc.children) - } - pc.mu.Unlock() - } - - // child should be finished. - select { - case <-child.Done(): - default: - t.Errorf("<-child.Done() blocked, but shouldn't have") - } - if e := child.Err(); e != Canceled { - t.Errorf("child.Err() == %v want %v", e, Canceled) - } - - // parent should not be finished. - select { - case x := <-parent.Done(): - t.Errorf("<-parent.Done() == %v want nothing (it should block)", x) - default: - } - if e := parent.Err(); e != nil { - t.Errorf("parent.Err() == %v want nil", e) - } - } -} - -func testDeadline(c Context, wait time.Duration, t *testing.T) { - select { - case <-time.After(wait): - t.Fatalf("context should have timed out") - case <-c.Done(): - } - if e := c.Err(); e != DeadlineExceeded { - t.Errorf("c.Err() == %v want %v", e, DeadlineExceeded) - } -} - -func TestDeadline(t *testing.T) { - c, _ := WithDeadline(Background(), time.Now().Add(100*time.Millisecond)) - if got, prefix := fmt.Sprint(c), "context.Background.WithDeadline("; !strings.HasPrefix(got, prefix) { - t.Errorf("c.String() = %q want prefix %q", got, prefix) - } - testDeadline(c, 200*time.Millisecond, t) - - c, _ = WithDeadline(Background(), time.Now().Add(100*time.Millisecond)) - o := otherContext{c} - testDeadline(o, 200*time.Millisecond, t) - - c, _ = WithDeadline(Background(), time.Now().Add(100*time.Millisecond)) - o = otherContext{c} - c, _ = WithDeadline(o, time.Now().Add(300*time.Millisecond)) - testDeadline(c, 200*time.Millisecond, t) -} - -func TestTimeout(t *testing.T) { - c, _ := WithTimeout(Background(), 100*time.Millisecond) - if got, prefix := fmt.Sprint(c), "context.Background.WithDeadline("; !strings.HasPrefix(got, prefix) { - t.Errorf("c.String() = %q want prefix %q", got, prefix) - } - testDeadline(c, 200*time.Millisecond, t) - - c, _ = WithTimeout(Background(), 100*time.Millisecond) - o := otherContext{c} - testDeadline(o, 200*time.Millisecond, t) - - c, _ = WithTimeout(Background(), 100*time.Millisecond) - o = otherContext{c} - c, _ = WithTimeout(o, 300*time.Millisecond) - testDeadline(c, 200*time.Millisecond, t) -} - -func TestCanceledTimeout(t *testing.T) { - c, _ := WithTimeout(Background(), 200*time.Millisecond) - o := otherContext{c} - c, cancel := WithTimeout(o, 400*time.Millisecond) - cancel() - time.Sleep(100 * time.Millisecond) // let cancelation propagate - select { - case <-c.Done(): - default: - t.Errorf("<-c.Done() blocked, but shouldn't have") - } - if e := c.Err(); e != Canceled { - t.Errorf("c.Err() == %v want %v", e, Canceled) - } -} - -type key1 int -type key2 int - -var k1 = key1(1) -var k2 = key2(1) // same int as k1, different type -var k3 = key2(3) // same type as k2, different int - -func TestValues(t *testing.T) { - check := func(c Context, nm, v1, v2, v3 string) { - if v, ok := c.Value(k1).(string); ok == (len(v1) == 0) || v != v1 { - t.Errorf(`%s.Value(k1).(string) = %q, %t want %q, %t`, nm, v, ok, v1, len(v1) != 0) - } - if v, ok := c.Value(k2).(string); ok == (len(v2) == 0) || v != v2 { - t.Errorf(`%s.Value(k2).(string) = %q, %t want %q, %t`, nm, v, ok, v2, len(v2) != 0) - } - if v, ok := c.Value(k3).(string); ok == (len(v3) == 0) || v != v3 { - t.Errorf(`%s.Value(k3).(string) = %q, %t want %q, %t`, nm, v, ok, v3, len(v3) != 0) - } - } - - c0 := Background() - check(c0, "c0", "", "", "") - - c1 := WithValue(Background(), k1, "c1k1") - check(c1, "c1", "c1k1", "", "") - - if got, want := fmt.Sprint(c1), `context.Background.WithValue(1, "c1k1")`; got != want { - t.Errorf("c.String() = %q want %q", got, want) - } - - c2 := WithValue(c1, k2, "c2k2") - check(c2, "c2", "c1k1", "c2k2", "") - - c3 := WithValue(c2, k3, "c3k3") - check(c3, "c2", "c1k1", "c2k2", "c3k3") - - c4 := WithValue(c3, k1, nil) - check(c4, "c4", "", "c2k2", "c3k3") - - o0 := otherContext{Background()} - check(o0, "o0", "", "", "") - - o1 := otherContext{WithValue(Background(), k1, "c1k1")} - check(o1, "o1", "c1k1", "", "") - - o2 := WithValue(o1, k2, "o2k2") - check(o2, "o2", "c1k1", "o2k2", "") - - o3 := otherContext{c4} - check(o3, "o3", "", "c2k2", "c3k3") - - o4 := WithValue(o3, k3, nil) - check(o4, "o4", "", "c2k2", "") -} - -func TestAllocs(t *testing.T) { - bg := Background() - for _, test := range []struct { - desc string - f func() - limit float64 - gccgoLimit float64 - }{ - { - desc: "Background()", - f: func() { Background() }, - limit: 0, - gccgoLimit: 0, - }, - { - desc: fmt.Sprintf("WithValue(bg, %v, nil)", k1), - f: func() { - c := WithValue(bg, k1, nil) - c.Value(k1) - }, - limit: 3, - gccgoLimit: 3, - }, - { - desc: "WithTimeout(bg, 15*time.Millisecond)", - f: func() { - c, _ := WithTimeout(bg, 15*time.Millisecond) - <-c.Done() - }, - limit: 8, - gccgoLimit: 15, - }, - { - desc: "WithCancel(bg)", - f: func() { - c, cancel := WithCancel(bg) - cancel() - <-c.Done() - }, - limit: 5, - gccgoLimit: 8, - }, - { - desc: "WithTimeout(bg, 100*time.Millisecond)", - f: func() { - c, cancel := WithTimeout(bg, 100*time.Millisecond) - cancel() - <-c.Done() - }, - limit: 8, - gccgoLimit: 25, - }, - } { - limit := test.limit - if runtime.Compiler == "gccgo" { - // gccgo does not yet do escape analysis. - // TOOD(iant): Remove this when gccgo does do escape analysis. - limit = test.gccgoLimit - } - if n := testing.AllocsPerRun(100, test.f); n > limit { - t.Errorf("%s allocs = %f want %d", test.desc, n, int(limit)) - } - } -} - -func TestSimultaneousCancels(t *testing.T) { - root, cancel := WithCancel(Background()) - m := map[Context]CancelFunc{root: cancel} - q := []Context{root} - // Create a tree of contexts. - for len(q) != 0 && len(m) < 100 { - parent := q[0] - q = q[1:] - for i := 0; i < 4; i++ { - ctx, cancel := WithCancel(parent) - m[ctx] = cancel - q = append(q, ctx) - } - } - // Start all the cancels in a random order. - var wg sync.WaitGroup - wg.Add(len(m)) - for _, cancel := range m { - go func(cancel CancelFunc) { - cancel() - wg.Done() - }(cancel) - } - // Wait on all the contexts in a random order. - for ctx := range m { - select { - case <-ctx.Done(): - case <-time.After(1 * time.Second): - buf := make([]byte, 10<<10) - n := runtime.Stack(buf, true) - t.Fatalf("timed out waiting for <-ctx.Done(); stacks:\n%s", buf[:n]) - } - } - // Wait for all the cancel functions to return. - done := make(chan struct{}) - go func() { - wg.Wait() - close(done) - }() - select { - case <-done: - case <-time.After(1 * time.Second): - buf := make([]byte, 10<<10) - n := runtime.Stack(buf, true) - t.Fatalf("timed out waiting for cancel functions; stacks:\n%s", buf[:n]) - } -} - -func TestInterlockedCancels(t *testing.T) { - parent, cancelParent := WithCancel(Background()) - child, cancelChild := WithCancel(parent) - go func() { - parent.Done() - cancelChild() - }() - cancelParent() - select { - case <-child.Done(): - case <-time.After(1 * time.Second): - buf := make([]byte, 10<<10) - n := runtime.Stack(buf, true) - t.Fatalf("timed out waiting for child.Done(); stacks:\n%s", buf[:n]) - } -} - -func TestLayersCancel(t *testing.T) { - testLayers(t, time.Now().UnixNano(), false) -} - -func TestLayersTimeout(t *testing.T) { - testLayers(t, time.Now().UnixNano(), true) -} - -func testLayers(t *testing.T, seed int64, testTimeout bool) { - rand.Seed(seed) - errorf := func(format string, a ...interface{}) { - t.Errorf(fmt.Sprintf("seed=%d: %s", seed, format), a...) - } - const ( - timeout = 200 * time.Millisecond - minLayers = 30 - ) - type value int - var ( - vals []*value - cancels []CancelFunc - numTimers int - ctx = Background() - ) - for i := 0; i < minLayers || numTimers == 0 || len(cancels) == 0 || len(vals) == 0; i++ { - switch rand.Intn(3) { - case 0: - v := new(value) - ctx = WithValue(ctx, v, v) - vals = append(vals, v) - case 1: - var cancel CancelFunc - ctx, cancel = WithCancel(ctx) - cancels = append(cancels, cancel) - case 2: - var cancel CancelFunc - ctx, cancel = WithTimeout(ctx, timeout) - cancels = append(cancels, cancel) - numTimers++ - } - } - checkValues := func(when string) { - for _, key := range vals { - if val := ctx.Value(key).(*value); key != val { - errorf("%s: ctx.Value(%p) = %p want %p", when, key, val, key) - } - } - } - select { - case <-ctx.Done(): - errorf("ctx should not be canceled yet") - default: - } - if s, prefix := fmt.Sprint(ctx), "context.Background."; !strings.HasPrefix(s, prefix) { - t.Errorf("ctx.String() = %q want prefix %q", s, prefix) - } - t.Log(ctx) - checkValues("before cancel") - if testTimeout { - select { - case <-ctx.Done(): - case <-time.After(timeout + 100*time.Millisecond): - errorf("ctx should have timed out") - } - checkValues("after timeout") - } else { - cancel := cancels[rand.Intn(len(cancels))] - cancel() - select { - case <-ctx.Done(): - default: - errorf("ctx should be canceled") - } - checkValues("after cancel") - } -} - -func TestCancelRemoves(t *testing.T) { - checkChildren := func(when string, ctx Context, want int) { - if got := len(ctx.(*cancelCtx).children); got != want { - t.Errorf("%s: context has %d children, want %d", when, got, want) - } - } - - ctx, _ := WithCancel(Background()) - checkChildren("after creation", ctx, 0) - _, cancel := WithCancel(ctx) - checkChildren("with WithCancel child ", ctx, 1) - cancel() - checkChildren("after cancelling WithCancel child", ctx, 0) - - ctx, _ = WithCancel(Background()) - checkChildren("after creation", ctx, 0) - _, cancel = WithTimeout(ctx, 60*time.Minute) - checkChildren("with WithTimeout child ", ctx, 1) - cancel() - checkChildren("after cancelling WithTimeout child", ctx, 0) -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/net/context/withtimeout_test.go b/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/net/context/withtimeout_test.go deleted file mode 100644 index 00d5d1ca9c..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/net/context/withtimeout_test.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package context_test - -import ( - "fmt" - "time" - - "github.com/fsouza/go-dockerclient/external/golang.org/x/net/context" -) - -func ExampleWithTimeout() { - // Pass a context with a timeout to tell a blocking function that it - // should abandon its work after the timeout elapses. - ctx, _ := context.WithTimeout(context.Background(), 100*time.Millisecond) - select { - case <-time.After(200 * time.Millisecond): - fmt.Println("overslept") - case <-ctx.Done(): - fmt.Println(ctx.Err()) // prints "context deadline exceeded" - } - // Output: - // context deadline exceeded -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/creds_test.go b/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/creds_test.go deleted file mode 100644 index 31cf39b1e2..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/creds_test.go +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux - -package unix_test - -import ( - "bytes" - "net" - "os" - "syscall" - "testing" - - "github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix" -) - -// TestSCMCredentials tests the sending and receiving of credentials -// (PID, UID, GID) in an ancillary message between two UNIX -// sockets. The SO_PASSCRED socket option is enabled on the sending -// socket for this to work. -func TestSCMCredentials(t *testing.T) { - fds, err := unix.Socketpair(unix.AF_LOCAL, unix.SOCK_STREAM, 0) - if err != nil { - t.Fatalf("Socketpair: %v", err) - } - defer unix.Close(fds[0]) - defer unix.Close(fds[1]) - - err = unix.SetsockoptInt(fds[0], unix.SOL_SOCKET, unix.SO_PASSCRED, 1) - if err != nil { - t.Fatalf("SetsockoptInt: %v", err) - } - - srvFile := os.NewFile(uintptr(fds[0]), "server") - defer srvFile.Close() - srv, err := net.FileConn(srvFile) - if err != nil { - t.Errorf("FileConn: %v", err) - return - } - defer srv.Close() - - cliFile := os.NewFile(uintptr(fds[1]), "client") - defer cliFile.Close() - cli, err := net.FileConn(cliFile) - if err != nil { - t.Errorf("FileConn: %v", err) - return - } - defer cli.Close() - - var ucred unix.Ucred - if os.Getuid() != 0 { - ucred.Pid = int32(os.Getpid()) - ucred.Uid = 0 - ucred.Gid = 0 - oob := unix.UnixCredentials(&ucred) - _, _, err := cli.(*net.UnixConn).WriteMsgUnix(nil, oob, nil) - if op, ok := err.(*net.OpError); ok { - err = op.Err - } - if sys, ok := err.(*os.SyscallError); ok { - err = sys.Err - } - if err != syscall.EPERM { - t.Fatalf("WriteMsgUnix failed with %v, want EPERM", err) - } - } - - ucred.Pid = int32(os.Getpid()) - ucred.Uid = uint32(os.Getuid()) - ucred.Gid = uint32(os.Getgid()) - oob := unix.UnixCredentials(&ucred) - - // this is going to send a dummy byte - n, oobn, err := cli.(*net.UnixConn).WriteMsgUnix(nil, oob, nil) - if err != nil { - t.Fatalf("WriteMsgUnix: %v", err) - } - if n != 0 { - t.Fatalf("WriteMsgUnix n = %d, want 0", n) - } - if oobn != len(oob) { - t.Fatalf("WriteMsgUnix oobn = %d, want %d", oobn, len(oob)) - } - - oob2 := make([]byte, 10*len(oob)) - n, oobn2, flags, _, err := srv.(*net.UnixConn).ReadMsgUnix(nil, oob2) - if err != nil { - t.Fatalf("ReadMsgUnix: %v", err) - } - if flags != 0 { - t.Fatalf("ReadMsgUnix flags = 0x%x, want 0", flags) - } - if n != 1 { - t.Fatalf("ReadMsgUnix n = %d, want 1 (dummy byte)", n) - } - if oobn2 != oobn { - // without SO_PASSCRED set on the socket, ReadMsgUnix will - // return zero oob bytes - t.Fatalf("ReadMsgUnix oobn = %d, want %d", oobn2, oobn) - } - oob2 = oob2[:oobn2] - if !bytes.Equal(oob, oob2) { - t.Fatal("ReadMsgUnix oob bytes don't match") - } - - scm, err := unix.ParseSocketControlMessage(oob2) - if err != nil { - t.Fatalf("ParseSocketControlMessage: %v", err) - } - newUcred, err := unix.ParseUnixCredentials(&scm[0]) - if err != nil { - t.Fatalf("ParseUnixCredentials: %v", err) - } - if *newUcred != ucred { - t.Fatalf("ParseUnixCredentials = %+v, want %+v", newUcred, ucred) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/export_test.go b/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/export_test.go deleted file mode 100644 index b4fdd970b6..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/export_test.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux netbsd openbsd solaris - -package unix - -var Itoa = itoa diff --git a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/mmap_unix_test.go b/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/mmap_unix_test.go deleted file mode 100644 index 30aa6fe23a..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/mmap_unix_test.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux netbsd openbsd solaris - -package unix_test - -import ( - "testing" - - "github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix" -) - -func TestMmap(t *testing.T) { - b, err := unix.Mmap(-1, 0, unix.Getpagesize(), unix.PROT_NONE, unix.MAP_ANON|unix.MAP_PRIVATE) - if err != nil { - t.Fatalf("Mmap: %v", err) - } - if err := unix.Munmap(b); err != nil { - t.Fatalf("Munmap: %v", err) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/syscall_bsd_test.go b/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/syscall_bsd_test.go deleted file mode 100644 index 7cd360647e..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/syscall_bsd_test.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd openbsd - -package unix_test - -import ( - "testing" - - "github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix" -) - -const MNT_WAIT = 1 - -func TestGetfsstat(t *testing.T) { - n, err := unix.Getfsstat(nil, MNT_WAIT) - if err != nil { - t.Fatal(err) - } - - data := make([]unix.Statfs_t, n) - n, err = unix.Getfsstat(data, MNT_WAIT) - if err != nil { - t.Fatal(err) - } - - empty := unix.Statfs_t{} - for _, stat := range data { - if stat == empty { - t.Fatal("an empty Statfs_t struct was returned") - } - } -} - -func TestSysctlRaw(t *testing.T) { - _, err := unix.SysctlRaw("kern.proc.pid", unix.Getpid()) - if err != nil { - t.Fatal(err) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/syscall_freebsd_test.go b/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/syscall_freebsd_test.go deleted file mode 100644 index 62f8052a86..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/syscall_freebsd_test.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build freebsd - -package unix_test - -import ( - "testing" - - "github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix" -) - -func TestSysctUint64(t *testing.T) { - _, err := unix.SysctlUint64("vm.max_kernel_address") - if err != nil { - t.Fatal(err) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/syscall_test.go b/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/syscall_test.go deleted file mode 100644 index b1b2c23a01..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/syscall_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux netbsd openbsd solaris - -package unix_test - -import ( - "fmt" - "testing" - - "github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix" -) - -func testSetGetenv(t *testing.T, key, value string) { - err := unix.Setenv(key, value) - if err != nil { - t.Fatalf("Setenv failed to set %q: %v", value, err) - } - newvalue, found := unix.Getenv(key) - if !found { - t.Fatalf("Getenv failed to find %v variable (want value %q)", key, value) - } - if newvalue != value { - t.Fatalf("Getenv(%v) = %q; want %q", key, newvalue, value) - } -} - -func TestEnv(t *testing.T) { - testSetGetenv(t, "TESTENV", "AVALUE") - // make sure TESTENV gets set to "", not deleted - testSetGetenv(t, "TESTENV", "") -} - -func TestItoa(t *testing.T) { - // Make most negative integer: 0x8000... - i := 1 - for i<<1 != 0 { - i <<= 1 - } - if i >= 0 { - t.Fatal("bad math") - } - s := unix.Itoa(i) - f := fmt.Sprint(i) - if s != f { - t.Fatalf("itoa(%d) = %s, want %s", i, s, f) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/syscall_unix_test.go b/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/syscall_unix_test.go deleted file mode 100644 index ddad90e5fb..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix/syscall_unix_test.go +++ /dev/null @@ -1,318 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux netbsd openbsd solaris - -package unix_test - -import ( - "flag" - "fmt" - "io/ioutil" - "net" - "os" - "os/exec" - "path/filepath" - "runtime" - "testing" - "time" - - "github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix" -) - -// Tests that below functions, structures and constants are consistent -// on all Unix-like systems. -func _() { - // program scheduling priority functions and constants - var ( - _ func(int, int, int) error = unix.Setpriority - _ func(int, int) (int, error) = unix.Getpriority - ) - const ( - _ int = unix.PRIO_USER - _ int = unix.PRIO_PROCESS - _ int = unix.PRIO_PGRP - ) - - // termios constants - const ( - _ int = unix.TCIFLUSH - _ int = unix.TCIOFLUSH - _ int = unix.TCOFLUSH - ) - - // fcntl file locking structure and constants - var ( - _ = unix.Flock_t{ - Type: int16(0), - Whence: int16(0), - Start: int64(0), - Len: int64(0), - Pid: int32(0), - } - ) - const ( - _ = unix.F_GETLK - _ = unix.F_SETLK - _ = unix.F_SETLKW - ) -} - -// TestFcntlFlock tests whether the file locking structure matches -// the calling convention of each kernel. -func TestFcntlFlock(t *testing.T) { - name := filepath.Join(os.TempDir(), "TestFcntlFlock") - fd, err := unix.Open(name, unix.O_CREAT|unix.O_RDWR|unix.O_CLOEXEC, 0) - if err != nil { - t.Fatalf("Open failed: %v", err) - } - defer unix.Unlink(name) - defer unix.Close(fd) - flock := unix.Flock_t{ - Type: unix.F_RDLCK, - Start: 0, Len: 0, Whence: 1, - } - if err := unix.FcntlFlock(uintptr(fd), unix.F_GETLK, &flock); err != nil { - t.Fatalf("FcntlFlock failed: %v", err) - } -} - -// TestPassFD tests passing a file descriptor over a Unix socket. -// -// This test involved both a parent and child process. The parent -// process is invoked as a normal test, with "go test", which then -// runs the child process by running the current test binary with args -// "-test.run=^TestPassFD$" and an environment variable used to signal -// that the test should become the child process instead. -func TestPassFD(t *testing.T) { - switch runtime.GOOS { - case "dragonfly": - // TODO(jsing): Figure out why sendmsg is returning EINVAL. - t.Skip("skipping test on dragonfly") - case "solaris": - // TODO(aram): Figure out why ReadMsgUnix is returning empty message. - t.Skip("skipping test on solaris, see issue 7402") - } - if os.Getenv("GO_WANT_HELPER_PROCESS") == "1" { - passFDChild() - return - } - - tempDir, err := ioutil.TempDir("", "TestPassFD") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tempDir) - - fds, err := unix.Socketpair(unix.AF_LOCAL, unix.SOCK_STREAM, 0) - if err != nil { - t.Fatalf("Socketpair: %v", err) - } - defer unix.Close(fds[0]) - defer unix.Close(fds[1]) - writeFile := os.NewFile(uintptr(fds[0]), "child-writes") - readFile := os.NewFile(uintptr(fds[1]), "parent-reads") - defer writeFile.Close() - defer readFile.Close() - - cmd := exec.Command(os.Args[0], "-test.run=^TestPassFD$", "--", tempDir) - cmd.Env = []string{"GO_WANT_HELPER_PROCESS=1"} - if lp := os.Getenv("LD_LIBRARY_PATH"); lp != "" { - cmd.Env = append(cmd.Env, "LD_LIBRARY_PATH="+lp) - } - cmd.ExtraFiles = []*os.File{writeFile} - - out, err := cmd.CombinedOutput() - if len(out) > 0 || err != nil { - t.Fatalf("child process: %q, %v", out, err) - } - - c, err := net.FileConn(readFile) - if err != nil { - t.Fatalf("FileConn: %v", err) - } - defer c.Close() - - uc, ok := c.(*net.UnixConn) - if !ok { - t.Fatalf("unexpected FileConn type; expected UnixConn, got %T", c) - } - - buf := make([]byte, 32) // expect 1 byte - oob := make([]byte, 32) // expect 24 bytes - closeUnix := time.AfterFunc(5*time.Second, func() { - t.Logf("timeout reading from unix socket") - uc.Close() - }) - _, oobn, _, _, err := uc.ReadMsgUnix(buf, oob) - closeUnix.Stop() - - scms, err := unix.ParseSocketControlMessage(oob[:oobn]) - if err != nil { - t.Fatalf("ParseSocketControlMessage: %v", err) - } - if len(scms) != 1 { - t.Fatalf("expected 1 SocketControlMessage; got scms = %#v", scms) - } - scm := scms[0] - gotFds, err := unix.ParseUnixRights(&scm) - if err != nil { - t.Fatalf("unix.ParseUnixRights: %v", err) - } - if len(gotFds) != 1 { - t.Fatalf("wanted 1 fd; got %#v", gotFds) - } - - f := os.NewFile(uintptr(gotFds[0]), "fd-from-child") - defer f.Close() - - got, err := ioutil.ReadAll(f) - want := "Hello from child process!\n" - if string(got) != want { - t.Errorf("child process ReadAll: %q, %v; want %q", got, err, want) - } -} - -// passFDChild is the child process used by TestPassFD. -func passFDChild() { - defer os.Exit(0) - - // Look for our fd. It should be fd 3, but we work around an fd leak - // bug here (http://golang.org/issue/2603) to let it be elsewhere. - var uc *net.UnixConn - for fd := uintptr(3); fd <= 10; fd++ { - f := os.NewFile(fd, "unix-conn") - var ok bool - netc, _ := net.FileConn(f) - uc, ok = netc.(*net.UnixConn) - if ok { - break - } - } - if uc == nil { - fmt.Println("failed to find unix fd") - return - } - - // Make a file f to send to our parent process on uc. - // We make it in tempDir, which our parent will clean up. - flag.Parse() - tempDir := flag.Arg(0) - f, err := ioutil.TempFile(tempDir, "") - if err != nil { - fmt.Printf("TempFile: %v", err) - return - } - - f.Write([]byte("Hello from child process!\n")) - f.Seek(0, 0) - - rights := unix.UnixRights(int(f.Fd())) - dummyByte := []byte("x") - n, oobn, err := uc.WriteMsgUnix(dummyByte, rights, nil) - if err != nil { - fmt.Printf("WriteMsgUnix: %v", err) - return - } - if n != 1 || oobn != len(rights) { - fmt.Printf("WriteMsgUnix = %d, %d; want 1, %d", n, oobn, len(rights)) - return - } -} - -// TestUnixRightsRoundtrip tests that UnixRights, ParseSocketControlMessage, -// and ParseUnixRights are able to successfully round-trip lists of file descriptors. -func TestUnixRightsRoundtrip(t *testing.T) { - testCases := [...][][]int{ - {{42}}, - {{1, 2}}, - {{3, 4, 5}}, - {{}}, - {{1, 2}, {3, 4, 5}, {}, {7}}, - } - for _, testCase := range testCases { - b := []byte{} - var n int - for _, fds := range testCase { - // Last assignment to n wins - n = len(b) + unix.CmsgLen(4*len(fds)) - b = append(b, unix.UnixRights(fds...)...) - } - // Truncate b - b = b[:n] - - scms, err := unix.ParseSocketControlMessage(b) - if err != nil { - t.Fatalf("ParseSocketControlMessage: %v", err) - } - if len(scms) != len(testCase) { - t.Fatalf("expected %v SocketControlMessage; got scms = %#v", len(testCase), scms) - } - for i, scm := range scms { - gotFds, err := unix.ParseUnixRights(&scm) - if err != nil { - t.Fatalf("ParseUnixRights: %v", err) - } - wantFds := testCase[i] - if len(gotFds) != len(wantFds) { - t.Fatalf("expected %v fds, got %#v", len(wantFds), gotFds) - } - for j, fd := range gotFds { - if fd != wantFds[j] { - t.Fatalf("expected fd %v, got %v", wantFds[j], fd) - } - } - } - } -} - -func TestRlimit(t *testing.T) { - var rlimit, zero unix.Rlimit - err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlimit) - if err != nil { - t.Fatalf("Getrlimit: save failed: %v", err) - } - if zero == rlimit { - t.Fatalf("Getrlimit: save failed: got zero value %#v", rlimit) - } - set := rlimit - set.Cur = set.Max - 1 - err = unix.Setrlimit(unix.RLIMIT_NOFILE, &set) - if err != nil { - t.Fatalf("Setrlimit: set failed: %#v %v", set, err) - } - var get unix.Rlimit - err = unix.Getrlimit(unix.RLIMIT_NOFILE, &get) - if err != nil { - t.Fatalf("Getrlimit: get failed: %v", err) - } - set = rlimit - set.Cur = set.Max - 1 - if set != get { - // Seems like Darwin requires some privilege to - // increase the soft limit of rlimit sandbox, though - // Setrlimit never reports an error. - switch runtime.GOOS { - case "darwin": - default: - t.Fatalf("Rlimit: change failed: wanted %#v got %#v", set, get) - } - } - err = unix.Setrlimit(unix.RLIMIT_NOFILE, &rlimit) - if err != nil { - t.Fatalf("Setrlimit: restore failed: %#v %v", rlimit, err) - } -} - -func TestSeekFailure(t *testing.T) { - _, err := unix.Seek(-1, 0, 0) - if err == nil { - t.Fatalf("Seek(-1, 0, 0) did not fail") - } - str := err.Error() // used to crash on Linux - t.Logf("Seek: %v", str) - if str == "" { - t.Fatalf("Seek(-1, 0, 0) return error with empty message") - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/image_test.go b/vendor/github.com/fsouza/go-dockerclient/image_test.go deleted file mode 100644 index c7544a643e..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/image_test.go +++ /dev/null @@ -1,1018 +0,0 @@ -// Copyright 2015 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package docker - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "io/ioutil" - "net" - "net/http" - "net/url" - "os" - "reflect" - "strings" - "testing" - "time" -) - -func newTestClient(rt *FakeRoundTripper) Client { - endpoint := "http://localhost:4243" - u, _ := parseEndpoint("http://localhost:4243", false) - testAPIVersion, _ := NewAPIVersion("1.17") - client := Client{ - HTTPClient: &http.Client{Transport: rt}, - Dialer: &net.Dialer{}, - endpoint: endpoint, - endpointURL: u, - SkipServerVersionCheck: true, - serverAPIVersion: testAPIVersion, - } - return client -} - -type stdoutMock struct { - *bytes.Buffer -} - -func (m stdoutMock) Close() error { - return nil -} - -type stdinMock struct { - *bytes.Buffer -} - -func (m stdinMock) Close() error { - return nil -} - -func TestListImages(t *testing.T) { - body := `[ - { - "Repository":"base", - "Tag":"ubuntu-12.10", - "Id":"b750fe79269d", - "Created":1364102658 - }, - { - "Repository":"base", - "Tag":"ubuntu-quantal", - "Id":"b750fe79269d", - "Created":1364102658 - }, - { - "RepoTag": [ - "ubuntu:12.04", - "ubuntu:precise", - "ubuntu:latest" - ], - "Id": "8dbd9e392a964c", - "Created": 1365714795, - "Size": 131506275, - "VirtualSize": 131506275 - }, - { - "RepoTag": [ - "ubuntu:12.10", - "ubuntu:quantal" - ], - "ParentId": "27cf784147099545", - "Id": "b750fe79269d2e", - "Created": 1364102658, - "Size": 24653, - "VirtualSize": 180116135 - } -]` - var expected []APIImages - err := json.Unmarshal([]byte(body), &expected) - if err != nil { - t.Fatal(err) - } - client := newTestClient(&FakeRoundTripper{message: body, status: http.StatusOK}) - images, err := client.ListImages(ListImagesOptions{}) - if err != nil { - t.Error(err) - } - if !reflect.DeepEqual(images, expected) { - t.Errorf("ListImages: Wrong return value. Want %#v. Got %#v.", expected, images) - } -} - -func TestListImagesParameters(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "null", status: http.StatusOK} - client := newTestClient(fakeRT) - _, err := client.ListImages(ListImagesOptions{All: false}) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != "GET" { - t.Errorf("ListImages({All: false}: Wrong HTTP method. Want GET. Got %s.", req.Method) - } - if all := req.URL.Query().Get("all"); all != "0" && all != "" { - t.Errorf("ListImages({All: false}): Wrong parameter. Want all=0 or not present at all. Got all=%s", all) - } - fakeRT.Reset() - _, err = client.ListImages(ListImagesOptions{All: true}) - if err != nil { - t.Fatal(err) - } - req = fakeRT.requests[0] - if all := req.URL.Query().Get("all"); all != "1" { - t.Errorf("ListImages({All: true}): Wrong parameter. Want all=1. Got all=%s", all) - } - fakeRT.Reset() - _, err = client.ListImages(ListImagesOptions{Filters: map[string][]string{ - "dangling": {"true"}, - }}) - if err != nil { - t.Fatal(err) - } - req = fakeRT.requests[0] - body := req.URL.Query().Get("filters") - var filters map[string][]string - err = json.Unmarshal([]byte(body), &filters) - if err != nil { - t.Fatal(err) - } - if len(filters["dangling"]) != 1 || filters["dangling"][0] != "true" { - t.Errorf("ListImages(dangling=[true]): Wrong filter map. Want dangling=[true], got dangling=%v", filters["dangling"]) - } -} - -func TestImageHistory(t *testing.T) { - body := `[ - { - "Id": "25daec02219d2d852f7526137213a9b199926b4b24e732eab5b8bc6c49bd470e", - "Tags": [ - "debian:7.6", - "debian:latest", - "debian:7", - "debian:wheezy" - ], - "Created": 1409856216, - "CreatedBy": "/bin/sh -c #(nop) CMD [/bin/bash]" - }, - { - "Id": "41026a5347fb5be6ed16115bf22df8569697139f246186de9ae8d4f67c335dce", - "Created": 1409856213, - "CreatedBy": "/bin/sh -c #(nop) ADD file:1ee9e97209d00e3416a4543b23574cc7259684741a46bbcbc755909b8a053a38 in /", - "Size": 85178663 - }, - { - "Id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158", - "Tags": [ - "scratch:latest" - ], - "Created": 1371157430 - } -]` - var expected []ImageHistory - err := json.Unmarshal([]byte(body), &expected) - if err != nil { - t.Fatal(err) - } - client := newTestClient(&FakeRoundTripper{message: body, status: http.StatusOK}) - history, err := client.ImageHistory("debian:latest") - if err != nil { - t.Error(err) - } - if !reflect.DeepEqual(history, expected) { - t.Errorf("ImageHistory: Wrong return value. Want %#v. Got %#v.", expected, history) - } -} - -func TestRemoveImage(t *testing.T) { - name := "test" - fakeRT := &FakeRoundTripper{message: "", status: http.StatusNoContent} - client := newTestClient(fakeRT) - err := client.RemoveImage(name) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expectedMethod := "DELETE" - if req.Method != expectedMethod { - t.Errorf("RemoveImage(%q): Wrong HTTP method. Want %s. Got %s.", name, expectedMethod, req.Method) - } - u, _ := url.Parse(client.getURL("/images/" + name)) - if req.URL.Path != u.Path { - t.Errorf("RemoveImage(%q): Wrong request path. Want %q. Got %q.", name, u.Path, req.URL.Path) - } -} - -func TestRemoveImageNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such image", status: http.StatusNotFound}) - err := client.RemoveImage("test:") - if err != ErrNoSuchImage { - t.Errorf("RemoveImage: wrong error. Want %#v. Got %#v.", ErrNoSuchImage, err) - } -} - -func TestRemoveImageExtended(t *testing.T) { - name := "test" - fakeRT := &FakeRoundTripper{message: "", status: http.StatusNoContent} - client := newTestClient(fakeRT) - err := client.RemoveImageExtended(name, RemoveImageOptions{Force: true, NoPrune: true}) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expectedMethod := "DELETE" - if req.Method != expectedMethod { - t.Errorf("RemoveImage(%q): Wrong HTTP method. Want %s. Got %s.", name, expectedMethod, req.Method) - } - u, _ := url.Parse(client.getURL("/images/" + name)) - if req.URL.Path != u.Path { - t.Errorf("RemoveImage(%q): Wrong request path. Want %q. Got %q.", name, u.Path, req.URL.Path) - } - expectedQuery := "force=1&noprune=1" - if query := req.URL.Query().Encode(); query != expectedQuery { - t.Errorf("PushImage: Wrong query string. Want %q. Got %q.", expectedQuery, query) - } -} - -func TestInspectImage(t *testing.T) { - body := `{ - "Id":"b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", - "Parent":"27cf784147099545", - "Created":"2013-03-23T22:24:18.818426Z", - "Container":"3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0", - "ContainerConfig":{"Memory":1}, - "VirtualSize":12345 -}` - - created, err := time.Parse(time.RFC3339Nano, "2013-03-23T22:24:18.818426Z") - if err != nil { - t.Fatal(err) - } - - expected := Image{ - ID: "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", - Parent: "27cf784147099545", - Created: created, - Container: "3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0", - ContainerConfig: Config{ - Memory: 1, - }, - VirtualSize: 12345, - } - fakeRT := &FakeRoundTripper{message: body, status: http.StatusOK} - client := newTestClient(fakeRT) - image, err := client.InspectImage(expected.ID) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(*image, expected) { - t.Errorf("InspectImage(%q): Wrong image returned. Want %#v. Got %#v.", expected.ID, expected, *image) - } - req := fakeRT.requests[0] - if req.Method != "GET" { - t.Errorf("InspectImage(%q): Wrong HTTP method. Want GET. Got %s.", expected.ID, req.Method) - } - u, _ := url.Parse(client.getURL("/images/" + expected.ID + "/json")) - if req.URL.Path != u.Path { - t.Errorf("InspectImage(%q): Wrong request URL. Want %q. Got %q.", expected.ID, u.Path, req.URL.Path) - } -} - -func TestInspectImageNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such image", status: http.StatusNotFound}) - name := "test" - image, err := client.InspectImage(name) - if image != nil { - t.Errorf("InspectImage(%q): expected image, got %#v.", name, image) - } - if err != ErrNoSuchImage { - t.Errorf("InspectImage(%q): wrong error. Want %#v. Got %#v.", name, ErrNoSuchImage, err) - } -} - -func TestPushImage(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "Pushing 1/100", status: http.StatusOK} - client := newTestClient(fakeRT) - var buf bytes.Buffer - err := client.PushImage(PushImageOptions{Name: "test", OutputStream: &buf}, AuthConfiguration{}) - if err != nil { - t.Fatal(err) - } - expected := "Pushing 1/100" - if buf.String() != expected { - t.Errorf("PushImage: Wrong output. Want %q. Got %q.", expected, buf.String()) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("PushImage: Wrong HTTP method. Want POST. Got %s.", req.Method) - } - u, _ := url.Parse(client.getURL("/images/test/push")) - if req.URL.Path != u.Path { - t.Errorf("PushImage: Wrong request path. Want %q. Got %q.", u.Path, req.URL.Path) - } - if query := req.URL.Query().Encode(); query != "" { - t.Errorf("PushImage: Wrong query string. Want no parameters, got %q.", query) - } - - auth, err := base64.URLEncoding.DecodeString(req.Header.Get("X-Registry-Auth")) - if err != nil { - t.Errorf("PushImage: caught error decoding auth. %#v", err.Error()) - } - if strings.TrimSpace(string(auth)) != "{}" { - t.Errorf("PushImage: wrong body. Want %q. Got %q.", - base64.URLEncoding.EncodeToString([]byte("{}")), req.Header.Get("X-Registry-Auth")) - } -} - -func TestPushImageWithRawJSON(t *testing.T) { - body := ` - {"status":"Pushing..."} - {"status":"Pushing", "progress":"1/? (n/a)", "progressDetail":{"current":1}}} - {"status":"Image successfully pushed"} - ` - fakeRT := &FakeRoundTripper{ - message: body, - status: http.StatusOK, - header: map[string]string{ - "Content-Type": "application/json", - }, - } - client := newTestClient(fakeRT) - var buf bytes.Buffer - - err := client.PushImage(PushImageOptions{ - Name: "test", - OutputStream: &buf, - RawJSONStream: true, - }, AuthConfiguration{}) - if err != nil { - t.Fatal(err) - } - if buf.String() != body { - t.Errorf("PushImage: Wrong raw output. Want %q. Got %q.", body, buf.String()) - } -} - -func TestPushImageWithAuthentication(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "Pushing 1/100", status: http.StatusOK} - client := newTestClient(fakeRT) - var buf bytes.Buffer - inputAuth := AuthConfiguration{ - Username: "gopher", - Password: "gopher123", - Email: "gopher@tsuru.io", - } - err := client.PushImage(PushImageOptions{Name: "test", OutputStream: &buf}, inputAuth) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - var gotAuth AuthConfiguration - - auth, err := base64.URLEncoding.DecodeString(req.Header.Get("X-Registry-Auth")) - if err != nil { - t.Errorf("PushImage: caught error decoding auth. %#v", err.Error()) - } - - err = json.Unmarshal(auth, &gotAuth) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(gotAuth, inputAuth) { - t.Errorf("PushImage: wrong auth configuration. Want %#v. Got %#v.", inputAuth, gotAuth) - } -} - -func TestPushImageCustomRegistry(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "Pushing 1/100", status: http.StatusOK} - client := newTestClient(fakeRT) - var authConfig AuthConfiguration - var buf bytes.Buffer - opts := PushImageOptions{ - Name: "test", Registry: "docker.tsuru.io", - OutputStream: &buf, - } - err := client.PushImage(opts, authConfig) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expectedQuery := "registry=docker.tsuru.io" - if query := req.URL.Query().Encode(); query != expectedQuery { - t.Errorf("PushImage: Wrong query string. Want %q. Got %q.", expectedQuery, query) - } -} - -func TestPushImageNoName(t *testing.T) { - client := Client{} - err := client.PushImage(PushImageOptions{}, AuthConfiguration{}) - if err != ErrNoSuchImage { - t.Errorf("PushImage: got wrong error. Want %#v. Got %#v.", ErrNoSuchImage, err) - } -} - -func TestPullImage(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "Pulling 1/100", status: http.StatusOK} - client := newTestClient(fakeRT) - var buf bytes.Buffer - err := client.PullImage(PullImageOptions{Repository: "base", OutputStream: &buf}, - AuthConfiguration{}) - if err != nil { - t.Fatal(err) - } - expected := "Pulling 1/100" - if buf.String() != expected { - t.Errorf("PullImage: Wrong output. Want %q. Got %q.", expected, buf.String()) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("PullImage: Wrong HTTP method. Want POST. Got %s.", req.Method) - } - u, _ := url.Parse(client.getURL("/images/create")) - if req.URL.Path != u.Path { - t.Errorf("PullImage: Wrong request path. Want %q. Got %q.", u.Path, req.URL.Path) - } - expectedQuery := "fromImage=base" - if query := req.URL.Query().Encode(); query != expectedQuery { - t.Errorf("PullImage: Wrong query strin. Want %q. Got %q.", expectedQuery, query) - } -} - -func TestPullImageWithRawJSON(t *testing.T) { - body := ` - {"status":"Pulling..."} - {"status":"Pulling", "progress":"1 B/ 100 B", "progressDetail":{"current":1, "total":100}} - ` - fakeRT := &FakeRoundTripper{ - message: body, - status: http.StatusOK, - header: map[string]string{ - "Content-Type": "application/json", - }, - } - client := newTestClient(fakeRT) - var buf bytes.Buffer - err := client.PullImage(PullImageOptions{ - Repository: "base", - OutputStream: &buf, - RawJSONStream: true, - }, AuthConfiguration{}) - if err != nil { - t.Fatal(err) - } - if buf.String() != body { - t.Errorf("PullImage: Wrong raw output. Want %q. Got %q", body, buf.String()) - } -} - -func TestPullImageWithoutOutputStream(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "Pulling 1/100", status: http.StatusOK} - client := newTestClient(fakeRT) - opts := PullImageOptions{ - Repository: "base", - Registry: "docker.tsuru.io", - } - err := client.PullImage(opts, AuthConfiguration{}) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expected := map[string][]string{"fromImage": {"base"}, "registry": {"docker.tsuru.io"}} - got := map[string][]string(req.URL.Query()) - if !reflect.DeepEqual(got, expected) { - t.Errorf("PullImage: wrong query string. Want %#v. Got %#v.", expected, got) - } -} - -func TestPullImageCustomRegistry(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "Pulling 1/100", status: http.StatusOK} - client := newTestClient(fakeRT) - var buf bytes.Buffer - opts := PullImageOptions{ - Repository: "base", - Registry: "docker.tsuru.io", - OutputStream: &buf, - } - err := client.PullImage(opts, AuthConfiguration{}) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expected := map[string][]string{"fromImage": {"base"}, "registry": {"docker.tsuru.io"}} - got := map[string][]string(req.URL.Query()) - if !reflect.DeepEqual(got, expected) { - t.Errorf("PullImage: wrong query string. Want %#v. Got %#v.", expected, got) - } -} - -func TestPullImageTag(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "Pulling 1/100", status: http.StatusOK} - client := newTestClient(fakeRT) - var buf bytes.Buffer - opts := PullImageOptions{ - Repository: "base", - Registry: "docker.tsuru.io", - Tag: "latest", - OutputStream: &buf, - } - err := client.PullImage(opts, AuthConfiguration{}) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expected := map[string][]string{"fromImage": {"base"}, "registry": {"docker.tsuru.io"}, "tag": {"latest"}} - got := map[string][]string(req.URL.Query()) - if !reflect.DeepEqual(got, expected) { - t.Errorf("PullImage: wrong query string. Want %#v. Got %#v.", expected, got) - } -} - -func TestPullImageNoRepository(t *testing.T) { - var opts PullImageOptions - client := Client{} - err := client.PullImage(opts, AuthConfiguration{}) - if err != ErrNoSuchImage { - t.Errorf("PullImage: got wrong error. Want %#v. Got %#v.", ErrNoSuchImage, err) - } -} - -func TestImportImageFromUrl(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - var buf bytes.Buffer - opts := ImportImageOptions{ - Source: "http://mycompany.com/file.tar", - Repository: "testimage", - Tag: "tag", - OutputStream: &buf, - } - err := client.ImportImage(opts) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expected := map[string][]string{"fromSrc": {opts.Source}, "repo": {opts.Repository}, "tag": {opts.Tag}} - got := map[string][]string(req.URL.Query()) - if !reflect.DeepEqual(got, expected) { - t.Errorf("ImportImage: wrong query string. Want %#v. Got %#v.", expected, got) - } -} - -func TestImportImageFromInput(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - in := bytes.NewBufferString("tar content") - var buf bytes.Buffer - opts := ImportImageOptions{ - Source: "-", Repository: "testimage", - InputStream: in, OutputStream: &buf, - Tag: "tag", - } - err := client.ImportImage(opts) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expected := map[string][]string{"fromSrc": {opts.Source}, "repo": {opts.Repository}, "tag": {opts.Tag}} - got := map[string][]string(req.URL.Query()) - if !reflect.DeepEqual(got, expected) { - t.Errorf("ImportImage: wrong query string. Want %#v. Got %#v.", expected, got) - } - body, err := ioutil.ReadAll(req.Body) - if err != nil { - t.Errorf("ImportImage: caugth error while reading body %#v", err.Error()) - } - e := "tar content" - if string(body) != e { - t.Errorf("ImportImage: wrong body. Want %#v. Got %#v.", e, string(body)) - } -} - -func TestImportImageDoesNotPassesInputIfSourceIsNotDash(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - var buf bytes.Buffer - in := bytes.NewBufferString("foo") - opts := ImportImageOptions{ - Source: "http://test.com/container.tar", Repository: "testimage", - InputStream: in, OutputStream: &buf, - } - err := client.ImportImage(opts) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expected := map[string][]string{"fromSrc": {opts.Source}, "repo": {opts.Repository}} - got := map[string][]string(req.URL.Query()) - if !reflect.DeepEqual(got, expected) { - t.Errorf("ImportImage: wrong query string. Want %#v. Got %#v.", expected, got) - } - body, err := ioutil.ReadAll(req.Body) - if err != nil { - t.Errorf("ImportImage: caugth error while reading body %#v", err.Error()) - } - if string(body) != "" { - t.Errorf("ImportImage: wrong body. Want nothing. Got %#v.", string(body)) - } -} - -func TestImportImageShouldPassTarContentToBodyWhenSourceIsFilePath(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - var buf bytes.Buffer - tarPath := "testing/data/container.tar" - opts := ImportImageOptions{ - Source: tarPath, Repository: "testimage", - OutputStream: &buf, - } - err := client.ImportImage(opts) - if err != nil { - t.Fatal(err) - } - tar, err := os.Open(tarPath) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - tarContent, err := ioutil.ReadAll(tar) - body, err := ioutil.ReadAll(req.Body) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(tarContent, body) { - t.Errorf("ImportImage: wrong body. Want %#v content. Got %#v.", tarPath, body) - } -} - -func TestImportImageShouldChangeSourceToDashWhenItsAFilePath(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - var buf bytes.Buffer - tarPath := "testing/data/container.tar" - opts := ImportImageOptions{ - Source: tarPath, Repository: "testimage", - OutputStream: &buf, - } - err := client.ImportImage(opts) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expected := map[string][]string{"fromSrc": {"-"}, "repo": {opts.Repository}} - got := map[string][]string(req.URL.Query()) - if !reflect.DeepEqual(got, expected) { - t.Errorf("ImportImage: wrong query string. Want %#v. Got %#v.", expected, got) - } -} - -func TestBuildImageParameters(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - var buf bytes.Buffer - opts := BuildImageOptions{ - Name: "testImage", - NoCache: true, - SuppressOutput: true, - Pull: true, - RmTmpContainer: true, - ForceRmTmpContainer: true, - Memory: 1024, - Memswap: 2048, - CPUShares: 10, - CPUQuota: 7500, - CPUPeriod: 100000, - CPUSetCPUs: "0-3", - Ulimits: []ULimit{{Name: "nofile", Soft: 100, Hard: 200}}, - InputStream: &buf, - OutputStream: &buf, - } - err := client.BuildImage(opts) - if err != nil && strings.Index(err.Error(), "build image fail") == -1 { - t.Fatal(err) - } - req := fakeRT.requests[0] - expected := map[string][]string{ - "t": {opts.Name}, - "nocache": {"1"}, - "q": {"1"}, - "pull": {"1"}, - "rm": {"1"}, - "forcerm": {"1"}, - "memory": {"1024"}, - "memswap": {"2048"}, - "cpushares": {"10"}, - "cpuquota": {"7500"}, - "cpuperiod": {"100000"}, - "cpusetcpus": {"0-3"}, - "ulimits": {"[{\"Name\":\"nofile\",\"Soft\":100,\"Hard\":200}]"}, - } - got := map[string][]string(req.URL.Query()) - if !reflect.DeepEqual(got, expected) { - t.Errorf("BuildImage: wrong query string. Want %#v. Got %#v.", expected, got) - } -} - -func TestBuildImageParametersForRemoteBuild(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - var buf bytes.Buffer - opts := BuildImageOptions{ - Name: "testImage", - Remote: "testing/data/container.tar", - SuppressOutput: true, - OutputStream: &buf, - } - err := client.BuildImage(opts) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expected := map[string][]string{"t": {opts.Name}, "remote": {opts.Remote}, "q": {"1"}} - got := map[string][]string(req.URL.Query()) - if !reflect.DeepEqual(got, expected) { - t.Errorf("BuildImage: wrong query string. Want %#v. Got %#v.", expected, got) - } -} - -func TestBuildImageMissingRepoAndNilInput(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - var buf bytes.Buffer - opts := BuildImageOptions{ - Name: "testImage", - SuppressOutput: true, - OutputStream: &buf, - } - err := client.BuildImage(opts) - if err != ErrMissingRepo { - t.Errorf("BuildImage: wrong error returned. Want %#v. Got %#v.", ErrMissingRepo, err) - } -} - -func TestBuildImageMissingOutputStream(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - opts := BuildImageOptions{Name: "testImage"} - err := client.BuildImage(opts) - if err != ErrMissingOutputStream { - t.Errorf("BuildImage: wrong error returned. Want %#v. Got %#v.", ErrMissingOutputStream, err) - } -} - -func TestBuildImageWithRawJSON(t *testing.T) { - body := ` - {"stream":"Step 0 : FROM ubuntu:latest\n"} - {"stream":" ---\u003e 4300eb9d3c8d\n"} - {"stream":"Step 1 : MAINTAINER docker \n"} - {"stream":" ---\u003e Using cache\n"} - {"stream":" ---\u003e 3a3ed758c370\n"} - {"stream":"Step 2 : CMD /usr/bin/top\n"} - {"stream":" ---\u003e Running in 36b1479cc2e4\n"} - {"stream":" ---\u003e 4b6188aebe39\n"} - {"stream":"Removing intermediate container 36b1479cc2e4\n"} - {"stream":"Successfully built 4b6188aebe39\n"} - ` - fakeRT := &FakeRoundTripper{ - message: body, - status: http.StatusOK, - header: map[string]string{ - "Content-Type": "application/json", - }, - } - client := newTestClient(fakeRT) - var buf bytes.Buffer - opts := BuildImageOptions{ - Name: "testImage", - RmTmpContainer: true, - InputStream: &buf, - OutputStream: &buf, - RawJSONStream: true, - } - err := client.BuildImage(opts) - if err != nil { - t.Fatal(err) - } - if buf.String() != body { - t.Errorf("BuildImage: Wrong raw output. Want %q. Got %q.", body, buf.String()) - } -} - -func TestBuildImageRemoteWithoutName(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - var buf bytes.Buffer - opts := BuildImageOptions{ - Remote: "testing/data/container.tar", - SuppressOutput: true, - OutputStream: &buf, - } - err := client.BuildImage(opts) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expected := map[string][]string{"t": {opts.Remote}, "remote": {opts.Remote}, "q": {"1"}} - got := map[string][]string(req.URL.Query()) - if !reflect.DeepEqual(got, expected) { - t.Errorf("BuildImage: wrong query string. Want %#v. Got %#v.", expected, got) - } -} - -func TestTagImageParameters(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - opts := TagImageOptions{Repo: "testImage"} - err := client.TagImage("base", opts) - if err != nil && strings.Index(err.Error(), "tag image fail") == -1 { - t.Fatal(err) - } - req := fakeRT.requests[0] - expected := "http://localhost:4243/images/base/tag?repo=testImage" - got := req.URL.String() - if !reflect.DeepEqual(got, expected) { - t.Errorf("TagImage: wrong query string. Want %#v. Got %#v.", expected, got) - } -} - -func TestTagImageMissingRepo(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - opts := TagImageOptions{Repo: "testImage"} - err := client.TagImage("", opts) - if err != ErrNoSuchImage { - t.Errorf("TestTag: wrong error returned. Want %#v. Got %#v.", - ErrNoSuchImage, err) - } -} - -func TestIsUrl(t *testing.T) { - url := "http://foo.bar/" - result := isURL(url) - if !result { - t.Errorf("isURL: wrong match. Expected %#v to be a url. Got %#v.", url, result) - } - url = "/foo/bar.tar" - result = isURL(url) - if result { - t.Errorf("isURL: wrong match. Expected %#v to not be a url. Got %#v", url, result) - } -} - -func TestLoadImage(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - tar, err := os.Open("testing/data/container.tar") - if err != nil { - t.Fatal(err) - } else { - defer tar.Close() - } - opts := LoadImageOptions{InputStream: tar} - err = client.LoadImage(opts) - if nil != err { - t.Error(err) - } - req := fakeRT.requests[0] - if req.Method != "POST" { - t.Errorf("LoadImage: wrong method. Expected %q. Got %q.", "POST", req.Method) - } - if req.URL.Path != "/images/load" { - t.Errorf("LoadImage: wrong URL. Expected %q. Got %q.", "/images/load", req.URL.Path) - } -} - -func TestExportImage(t *testing.T) { - var buf bytes.Buffer - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - opts := ExportImageOptions{Name: "testimage", OutputStream: &buf} - err := client.ExportImage(opts) - if nil != err { - t.Error(err) - } - req := fakeRT.requests[0] - if req.Method != "GET" { - t.Errorf("ExportImage: wrong method. Expected %q. Got %q.", "GET", req.Method) - } - expectedPath := "/images/testimage/get" - if req.URL.Path != expectedPath { - t.Errorf("ExportIMage: wrong path. Expected %q. Got %q.", expectedPath, req.URL.Path) - } -} - -func TestExportImages(t *testing.T) { - var buf bytes.Buffer - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - opts := ExportImagesOptions{Names: []string{"testimage1", "testimage2:latest"}, OutputStream: &buf} - err := client.ExportImages(opts) - if nil != err { - t.Error(err) - } - req := fakeRT.requests[0] - if req.Method != "GET" { - t.Errorf("ExportImage: wrong method. Expected %q. Got %q.", "GET", req.Method) - } - expected := "http://localhost:4243/images/get?names=testimage1&names=testimage2%3Alatest" - got := req.URL.String() - if !reflect.DeepEqual(got, expected) { - t.Errorf("ExportIMage: wrong path. Expected %q. Got %q.", expected, got) - } -} - -func TestExportImagesNoNames(t *testing.T) { - var buf bytes.Buffer - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - opts := ExportImagesOptions{Names: []string{}, OutputStream: &buf} - err := client.ExportImages(opts) - if err == nil { - t.Error("Expected an error") - } - if err != ErrMustSpecifyNames { - t.Error(err) - } -} - -func TestSearchImages(t *testing.T) { - body := `[ - { - "description":"A container with Cassandra 2.0.3", - "is_official":true, - "is_automated":true, - "name":"poklet/cassandra", - "star_count":17 - }, - { - "description":"A container with Cassandra 2.0.3", - "is_official":true, - "is_automated":false, - "name":"poklet/cassandra", - "star_count":17 - } - , - { - "description":"A container with Cassandra 2.0.3", - "is_official":false, - "is_automated":true, - "name":"poklet/cassandra", - "star_count":17 - } -]` - var expected []APIImageSearch - err := json.Unmarshal([]byte(body), &expected) - if err != nil { - t.Fatal(err) - } - client := newTestClient(&FakeRoundTripper{message: body, status: http.StatusOK}) - result, err := client.SearchImages("cassandra") - if err != nil { - t.Error(err) - } - if !reflect.DeepEqual(result, expected) { - t.Errorf("SearchImages: Wrong return value. Want %#v. Got %#v.", expected, result) - } -} - -func TestSearchImagesEx(t *testing.T) { - body := `[ - { - "description":"A container with Cassandra 2.0.3", - "is_official":true, - "is_automated":true, - "name":"poklet/cassandra", - "star_count":17 - }, - { - "description":"A container with Cassandra 2.0.3", - "is_official":true, - "is_automated":false, - "name":"poklet/cassandra", - "star_count":17 - } - , - { - "description":"A container with Cassandra 2.0.3", - "is_official":false, - "is_automated":true, - "name":"poklet/cassandra", - "star_count":17 - } -]` - var expected []APIImageSearch - err := json.Unmarshal([]byte(body), &expected) - if err != nil { - t.Fatal(err) - } - client := newTestClient(&FakeRoundTripper{message: body, status: http.StatusOK}) - auth := AuthConfiguration{} - result, err := client.SearchImagesEx("cassandra", auth) - if err != nil { - t.Error(err) - } - if !reflect.DeepEqual(result, expected) { - t.Errorf("SearchImages: Wrong return value. Want %#v. Got %#v.", expected, result) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/integration_test.go b/vendor/github.com/fsouza/go-dockerclient/integration_test.go deleted file mode 100644 index f5aeea27a0..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/integration_test.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2015 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build docker_integration - -package docker - -import ( - "bytes" - "os" - "testing" -) - -var dockerEndpoint string - -func init() { - dockerEndpoint = os.Getenv("DOCKER_HOST") - if dockerEndpoint == "" { - dockerEndpoint = "unix:///var/run/docker.sock" - } -} - -func TestIntegrationPullCreateStartLogs(t *testing.T) { - imageName := pullImage(t) - client := getClient() - hostConfig := HostConfig{PublishAllPorts: true} - createOpts := CreateContainerOptions{ - Config: &Config{ - Image: imageName, - Cmd: []string{"cat", "/home/gopher/file.txt"}, - User: "gopher", - }, - HostConfig: &hostConfig, - } - container, err := client.CreateContainer(createOpts) - if err != nil { - t.Fatal(err) - } - err = client.StartContainer(container.ID, &hostConfig) - if err != nil { - t.Fatal(err) - } - status, err := client.WaitContainer(container.ID) - if err != nil { - t.Error(err) - } - if status != 0 { - t.Error("WaitContainer(%q): wrong status. Want 0. Got %d", container.ID, status) - } - var stdout, stderr bytes.Buffer - logsOpts := LogsOptions{ - Container: container.ID, - OutputStream: &stdout, - ErrorStream: &stderr, - Stdout: true, - Stderr: true, - } - err = client.Logs(logsOpts) - if err != nil { - t.Error(err) - } - if stderr.String() != "" { - t.Errorf("Got unexpected stderr from logs: %q", stderr.String()) - } - expected := `Welcome to reality, wake up and rejoice -Welcome to reality, you've made the right choice -Welcome to reality, and let them hear your voice, shout it out! -` - if stdout.String() != expected { - t.Errorf("Got wrong stdout from logs.\nWant:\n%#v.\n\nGot:\n%#v.", expected, stdout.String()) - } -} - -func pullImage(t *testing.T) string { - imageName := "fsouza/go-dockerclient-integration" - var buf bytes.Buffer - pullOpts := PullImageOptions{ - Repository: imageName, - OutputStream: &buf, - } - client := getClient() - err := client.PullImage(pullOpts, AuthConfiguration{}) - if err != nil { - t.Logf("Pull output: %s", buf.String()) - t.Fatal(err) - } - return imageName -} - -func getClient() *Client { - client, _ := NewClient(dockerEndpoint) - return client -} diff --git a/vendor/github.com/fsouza/go-dockerclient/misc_test.go b/vendor/github.com/fsouza/go-dockerclient/misc_test.go deleted file mode 100644 index ceaf076eda..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/misc_test.go +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2014 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package docker - -import ( - "net/http" - "net/url" - "reflect" - "sort" - "testing" -) - -type DockerVersion struct { - Version string - GitCommit string - GoVersion string -} - -func TestVersion(t *testing.T) { - body := `{ - "Version":"0.2.2", - "GitCommit":"5a2a5cc+CHANGES", - "GoVersion":"go1.0.3" -}` - fakeRT := FakeRoundTripper{message: body, status: http.StatusOK} - client := newTestClient(&fakeRT) - expected := DockerVersion{ - Version: "0.2.2", - GitCommit: "5a2a5cc+CHANGES", - GoVersion: "go1.0.3", - } - version, err := client.Version() - if err != nil { - t.Fatal(err) - } - - if result := version.Get("Version"); result != expected.Version { - t.Errorf("Version(): Wrong result. Want %#v. Got %#v.", expected.Version, version.Get("Version")) - } - if result := version.Get("GitCommit"); result != expected.GitCommit { - t.Errorf("GitCommit(): Wrong result. Want %#v. Got %#v.", expected.GitCommit, version.Get("GitCommit")) - } - if result := version.Get("GoVersion"); result != expected.GoVersion { - t.Errorf("GoVersion(): Wrong result. Want %#v. Got %#v.", expected.GoVersion, version.Get("GoVersion")) - } - req := fakeRT.requests[0] - if req.Method != "GET" { - t.Errorf("Version(): wrong request method. Want GET. Got %s.", req.Method) - } - u, _ := url.Parse(client.getURL("/version")) - if req.URL.Path != u.Path { - t.Errorf("Version(): wrong request path. Want %q. Got %q.", u.Path, req.URL.Path) - } -} - -func TestVersionError(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "internal error", status: http.StatusInternalServerError} - client := newTestClient(fakeRT) - version, err := client.Version() - if version != nil { - t.Errorf("Version(): expected value, got %#v.", version) - } - if err == nil { - t.Error("Version(): unexpected error") - } -} - -func TestInfo(t *testing.T) { - body := `{ - "Containers":11, - "Images":16, - "Debug":0, - "NFd":11, - "NGoroutines":21, - "MemoryLimit":1, - "SwapLimit":0 -}` - fakeRT := FakeRoundTripper{message: body, status: http.StatusOK} - client := newTestClient(&fakeRT) - expected := Env{} - expected.SetInt("Containers", 11) - expected.SetInt("Images", 16) - expected.SetBool("Debug", false) - expected.SetInt("NFd", 11) - expected.SetInt("NGoroutines", 21) - expected.SetBool("MemoryLimit", true) - expected.SetBool("SwapLimit", false) - info, err := client.Info() - if err != nil { - t.Fatal(err) - } - infoSlice := []string(*info) - expectedSlice := []string(expected) - sort.Strings(infoSlice) - sort.Strings(expectedSlice) - if !reflect.DeepEqual(expectedSlice, infoSlice) { - t.Errorf("Info(): Wrong result.\nWant %#v.\nGot %#v.", expected, *info) - } - req := fakeRT.requests[0] - if req.Method != "GET" { - t.Errorf("Info(): Wrong HTTP method. Want GET. Got %s.", req.Method) - } - u, _ := url.Parse(client.getURL("/info")) - if req.URL.Path != u.Path { - t.Errorf("Info(): Wrong request path. Want %q. Got %q.", u.Path, req.URL.Path) - } -} - -func TestInfoError(t *testing.T) { - fakeRT := &FakeRoundTripper{message: "internal error", status: http.StatusInternalServerError} - client := newTestClient(fakeRT) - version, err := client.Info() - if version != nil { - t.Errorf("Info(): expected value, got %#v.", version) - } - if err == nil { - t.Error("Info(): unexpected error") - } -} - -func TestParseRepositoryTag(t *testing.T) { - var tests = []struct { - input string - expectedRepo string - expectedTag string - }{ - { - "localhost.localdomain:5000/samalba/hipache:latest", - "localhost.localdomain:5000/samalba/hipache", - "latest", - }, - { - "localhost.localdomain:5000/samalba/hipache", - "localhost.localdomain:5000/samalba/hipache", - "", - }, - { - "tsuru/python", - "tsuru/python", - "", - }, - { - "tsuru/python:2.7", - "tsuru/python", - "2.7", - }, - } - for _, tt := range tests { - repo, tag := ParseRepositoryTag(tt.input) - if repo != tt.expectedRepo { - t.Errorf("ParseRepositoryTag(%q): wrong repository. Want %q. Got %q", tt.input, tt.expectedRepo, repo) - } - if tag != tt.expectedTag { - t.Errorf("ParseRepositoryTag(%q): wrong tag. Want %q. Got %q", tt.input, tt.expectedTag, tag) - } - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/network_test.go b/vendor/github.com/fsouza/go-dockerclient/network_test.go deleted file mode 100644 index 2bff70fe42..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/network_test.go +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright 2015 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package docker - -import ( - "encoding/json" - "net/http" - "net/url" - "reflect" - "testing" -) - -func TestListNetworks(t *testing.T) { - jsonNetworks := `[ - { - "ID": "8dfafdbc3a40", - "Name": "blah", - "Type": "bridge", - "Endpoints":[{"ID": "918c11c8288a", "Name": "dsafdsaf", "Network": "8dfafdbc3a40"}] - }, - { - "ID": "9fb1e39c", - "Name": "foo", - "Type": "bridge", - "Endpoints":[{"ID": "c080be979dda", "Name": "lllll2222", "Network": "9fb1e39c"}] - } -]` - var expected []Network - err := json.Unmarshal([]byte(jsonNetworks), &expected) - if err != nil { - t.Fatal(err) - } - client := newTestClient(&FakeRoundTripper{message: jsonNetworks, status: http.StatusOK}) - containers, err := client.ListNetworks() - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(containers, expected) { - t.Errorf("ListNetworks: Expected %#v. Got %#v.", expected, containers) - } -} - -func TestNetworkInfo(t *testing.T) { - jsonNetwork := `{ - "ID": "8dfafdbc3a40", - "Name": "blah", - "Type": "bridge", - "Endpoints":[{"ID": "918c11c8288a", "Name": "dsafdsaf", "Network": "8dfafdbc3a40"}] - }` - var expected Network - err := json.Unmarshal([]byte(jsonNetwork), &expected) - if err != nil { - t.Fatal(err) - } - fakeRT := &FakeRoundTripper{message: jsonNetwork, status: http.StatusOK} - client := newTestClient(fakeRT) - id := "8dfafdbc3a40" - network, err := client.NetworkInfo(id) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(*network, expected) { - t.Errorf("NetworkInfo(%q): Expected %#v. Got %#v.", id, expected, network) - } - expectedURL, _ := url.Parse(client.getURL("/networks/8dfafdbc3a40")) - if gotPath := fakeRT.requests[0].URL.Path; gotPath != expectedURL.Path { - t.Errorf("NetworkInfo(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } -} - -func TestNetworkCreate(t *testing.T) { - jsonID := `{"ID": "8dfafdbc3a40"}` - jsonNetwork := `{ - "ID": "8dfafdbc3a40", - "Name": "foobar", - "Driver": "bridge" - }` - var expected Network - err := json.Unmarshal([]byte(jsonNetwork), &expected) - if err != nil { - t.Fatal(err) - } - - client := newTestClient(&FakeRoundTripper{message: jsonID, status: http.StatusOK}) - opts := CreateNetworkOptions{"foobar", false, "bridge", IPAMOptions{}, nil} - network, err := client.CreateNetwork(opts) - if err != nil { - t.Fatal(err) - } - - if !reflect.DeepEqual(*network, expected) { - t.Errorf("CreateNetwork: Expected %#v. Got %#v.", expected, network) - } -} - -func TestNetworkRemove(t *testing.T) { - id := "8dfafdbc3a40" - fakeRT := &FakeRoundTripper{message: "", status: http.StatusNoContent} - client := newTestClient(fakeRT) - err := client.RemoveNetwork(id) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expectedMethod := "DELETE" - if req.Method != expectedMethod { - t.Errorf("RemoveNetwork(%q): Wrong HTTP method. Want %s. Got %s.", id, expectedMethod, req.Method) - } - u, _ := url.Parse(client.getURL("/networks/" + id)) - if req.URL.Path != u.Path { - t.Errorf("RemoveNetwork(%q): Wrong request path. Want %q. Got %q.", id, u.Path, req.URL.Path) - } -} - -func TestNetworkConnect(t *testing.T) { - id := "8dfafdbc3a40" - fakeRT := &FakeRoundTripper{message: "", status: http.StatusNoContent} - client := newTestClient(fakeRT) - opts := NetworkConnectionOptions{"foobar"} - err := client.ConnectNetwork(id, opts) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expectedMethod := "POST" - if req.Method != expectedMethod { - t.Errorf("ConnectNetwork(%q): Wrong HTTP method. Want %s. Got %s.", id, expectedMethod, req.Method) - } - u, _ := url.Parse(client.getURL("/networks/" + id + "/connect")) - if req.URL.Path != u.Path { - t.Errorf("ConnectNetwork(%q): Wrong request path. Want %q. Got %q.", id, u.Path, req.URL.Path) - } -} - -func TestNetworkConnectNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such network container", status: http.StatusNotFound}) - opts := NetworkConnectionOptions{"foobar"} - err := client.ConnectNetwork("8dfafdbc3a40", opts) - if serr, ok := err.(*NoSuchNetworkOrContainer); !ok { - t.Errorf("ConnectNetwork: wrong error type: %s.", serr) - } -} - -func TestNetworkDisconnect(t *testing.T) { - id := "8dfafdbc3a40" - fakeRT := &FakeRoundTripper{message: "", status: http.StatusNoContent} - client := newTestClient(fakeRT) - opts := NetworkConnectionOptions{"foobar"} - err := client.DisconnectNetwork(id, opts) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expectedMethod := "POST" - if req.Method != expectedMethod { - t.Errorf("DisconnectNetwork(%q): Wrong HTTP method. Want %s. Got %s.", id, expectedMethod, req.Method) - } - u, _ := url.Parse(client.getURL("/networks/" + id + "/disconnect")) - if req.URL.Path != u.Path { - t.Errorf("DisconnectNetwork(%q): Wrong request path. Want %q. Got %q.", id, u.Path, req.URL.Path) - } -} - -func TestNetworkDisconnectNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such network container", status: http.StatusNotFound}) - opts := NetworkConnectionOptions{"foobar"} - err := client.DisconnectNetwork("8dfafdbc3a40", opts) - if serr, ok := err.(*NoSuchNetworkOrContainer); !ok { - t.Errorf("DisconnectNetwork: wrong error type: %s.", serr) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/testing/server_test.go b/vendor/github.com/fsouza/go-dockerclient/testing/server_test.go deleted file mode 100644 index ddadcaab5d..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/testing/server_test.go +++ /dev/null @@ -1,2103 +0,0 @@ -// Copyright 2015 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package testing - -import ( - "bufio" - "bytes" - "encoding/json" - "fmt" - "io/ioutil" - "math/rand" - "net" - "net/http" - "net/http/httptest" - "os" - "reflect" - "strings" - "sync" - "testing" - "time" - - "github.com/fsouza/go-dockerclient" -) - -func TestNewServer(t *testing.T) { - server, err := NewServer("127.0.0.1:0", nil, nil) - if err != nil { - t.Fatal(err) - } - defer server.listener.Close() - conn, err := net.Dial("tcp", server.listener.Addr().String()) - if err != nil { - t.Fatal(err) - } - conn.Close() -} - -func TestServerStop(t *testing.T) { - server, err := NewServer("127.0.0.1:0", nil, nil) - if err != nil { - t.Fatal(err) - } - server.Stop() - _, err = net.Dial("tcp", server.listener.Addr().String()) - if err == nil { - t.Error("Unexpected error when dialing to stopped server") - } -} - -func TestServerStopNoListener(t *testing.T) { - server := DockerServer{} - server.Stop() -} - -func TestServerURL(t *testing.T) { - server, err := NewServer("127.0.0.1:0", nil, nil) - if err != nil { - t.Fatal(err) - } - defer server.Stop() - url := server.URL() - if expected := "http://" + server.listener.Addr().String() + "/"; url != expected { - t.Errorf("DockerServer.URL(): Want %q. Got %q.", expected, url) - } -} - -func TestServerURLNoListener(t *testing.T) { - server := DockerServer{} - url := server.URL() - if url != "" { - t.Errorf("DockerServer.URL(): Expected empty URL on handler mode, got %q.", url) - } -} - -func TestHandleWithHook(t *testing.T) { - var called bool - server, _ := NewServer("127.0.0.1:0", nil, func(*http.Request) { called = true }) - defer server.Stop() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if !called { - t.Error("ServeHTTP did not call the hook function.") - } -} - -func TestSetHook(t *testing.T) { - var called bool - server, _ := NewServer("127.0.0.1:0", nil, nil) - defer server.Stop() - server.SetHook(func(*http.Request) { called = true }) - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if !called { - t.Error("ServeHTTP did not call the hook function.") - } -} - -func TestCustomHandler(t *testing.T) { - var called bool - server, _ := NewServer("127.0.0.1:0", nil, nil) - addContainers(server, 2) - server.CustomHandler("/containers/json", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - called = true - fmt.Fprint(w, "Hello world") - })) - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if !called { - t.Error("Did not call the custom handler") - } - if got := recorder.Body.String(); got != "Hello world" { - t.Errorf("Wrong output for custom handler: want %q. Got %q.", "Hello world", got) - } -} - -func TestCustomHandlerRegexp(t *testing.T) { - var called bool - server, _ := NewServer("127.0.0.1:0", nil, nil) - addContainers(server, 2) - server.CustomHandler("/containers/.*/json", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - called = true - fmt.Fprint(w, "Hello world") - })) - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/.*/json?all=1", nil) - server.ServeHTTP(recorder, request) - if !called { - t.Error("Did not call the custom handler") - } - if got := recorder.Body.String(); got != "Hello world" { - t.Errorf("Wrong output for custom handler: want %q. Got %q.", "Hello world", got) - } -} - -func TestListContainers(t *testing.T) { - server := DockerServer{} - addContainers(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("ListContainers: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - expected := make([]docker.APIContainers, 2) - for i, container := range server.containers { - expected[i] = docker.APIContainers{ - ID: container.ID, - Image: container.Image, - Command: strings.Join(container.Config.Cmd, " "), - Created: container.Created.Unix(), - Status: container.State.String(), - Ports: container.NetworkSettings.PortMappingAPI(), - Names: []string{"/" + container.Name}, - } - } - var got []docker.APIContainers - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(got, expected) { - t.Errorf("ListContainers. Want %#v. Got %#v.", expected, got) - } -} - -func TestListRunningContainers(t *testing.T) { - server := DockerServer{} - addContainers(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/json?all=0", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("ListRunningContainers: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - var got []docker.APIContainers - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if len(got) != 0 { - t.Errorf("ListRunningContainers: Want 0. Got %d.", len(got)) - } -} - -func TestCreateContainer(t *testing.T) { - server := DockerServer{} - server.imgIDs = map[string]string{"base": "a1234"} - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Hostname":"", "User":"ubuntu", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, -"PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], "Image":"base", "Volumes":{}, "VolumesFrom":"","HostConfig":{"Binds":["/var/run/docker.sock:/var/run/docker.sock:rw"]}}` - request, _ := http.NewRequest("POST", "/containers/create", strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusCreated { - t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) - } - var returned docker.Container - err := json.NewDecoder(recorder.Body).Decode(&returned) - if err != nil { - t.Fatal(err) - } - stored := server.containers[0] - if returned.ID != stored.ID { - t.Errorf("CreateContainer: ID mismatch. Stored: %q. Returned: %q.", stored.ID, returned.ID) - } - if stored.State.Running { - t.Errorf("CreateContainer should not set container to running state.") - } - if stored.Config.User != "ubuntu" { - t.Errorf("CreateContainer: wrong config. Expected: %q. Returned: %q.", "ubuntu", stored.Config.User) - } - if stored.Config.Hostname != returned.ID[:12] { - t.Errorf("CreateContainer: wrong hostname. Expected: %q. Returned: %q.", returned.ID[:12], stored.Config.Hostname) - } - expectedBind := []string{"/var/run/docker.sock:/var/run/docker.sock:rw"} - if !reflect.DeepEqual(stored.HostConfig.Binds, expectedBind) { - t.Errorf("CreateContainer: wrong host config. Expected: %v. Returned %v.", expectedBind, stored.HostConfig.Binds) - } -} - -func TestCreateContainerWithNotifyChannel(t *testing.T) { - ch := make(chan *docker.Container, 1) - server := DockerServer{} - server.imgIDs = map[string]string{"base": "a1234"} - server.cChan = ch - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Hostname":"", "User":"", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, -"PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], "Image":"base", "Volumes":{}, "VolumesFrom":""}` - request, _ := http.NewRequest("POST", "/containers/create", strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusCreated { - t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) - } - if notified := <-ch; notified != server.containers[0] { - t.Errorf("CreateContainer: did not notify the proper container. Want %q. Got %q.", server.containers[0].ID, notified.ID) - } -} - -func TestCreateContainerInvalidBody(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/containers/create", strings.NewReader("whaaaaaat---")) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } -} - -func TestCreateContainerDuplicateName(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - server.imgIDs = map[string]string{"base": "a1234"} - addContainers(&server, 1) - server.containers[0].Name = "mycontainer" - recorder := httptest.NewRecorder() - body := `{"Hostname":"", "User":"ubuntu", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, -"PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], "Image":"base", "Volumes":{}, "VolumesFrom":"","HostConfig":{"Binds":["/var/run/docker.sock:/var/run/docker.sock:rw"]}}` - request, _ := http.NewRequest("POST", "/containers/create?name=mycontainer", strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusConflict { - t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusConflict, recorder.Code) - } -} - -func TestCreateMultipleContainersEmptyName(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - server.imgIDs = map[string]string{"base": "a1234"} - addContainers(&server, 1) - server.containers[0].Name = "" - recorder := httptest.NewRecorder() - body := `{"Hostname":"", "User":"ubuntu", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, -"PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], "Image":"base", "Volumes":{}, "VolumesFrom":"","HostConfig":{"Binds":["/var/run/docker.sock:/var/run/docker.sock:rw"]}}` - request, _ := http.NewRequest("POST", "/containers/create", strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusCreated { - t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) - } - var returned docker.Container - err := json.NewDecoder(recorder.Body).Decode(&returned) - if err != nil { - t.Fatal(err) - } - stored := server.containers[1] - if returned.ID != stored.ID { - t.Errorf("CreateContainer: ID mismatch. Stored: %q. Returned: %q.", stored.ID, returned.ID) - } - if stored.State.Running { - t.Errorf("CreateContainer should not set container to running state.") - } - if stored.Config.User != "ubuntu" { - t.Errorf("CreateContainer: wrong config. Expected: %q. Returned: %q.", "ubuntu", stored.Config.User) - } - expectedBind := []string{"/var/run/docker.sock:/var/run/docker.sock:rw"} - if !reflect.DeepEqual(stored.HostConfig.Binds, expectedBind) { - t.Errorf("CreateContainer: wrong host config. Expected: %v. Returned %v.", expectedBind, stored.HostConfig.Binds) - } -} - -func TestCreateContainerInvalidName(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Hostname":"", "User":"", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, -"PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], -"Image":"base", "Volumes":{}, "VolumesFrom":""}` - request, _ := http.NewRequest("POST", "/containers/create?name=myapp/container1", strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusInternalServerError { - t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusInternalServerError, recorder.Code) - } - expectedBody := "Invalid container name\n" - if got := recorder.Body.String(); got != expectedBody { - t.Errorf("CreateContainer: wrong body. Want %q. Got %q.", expectedBody, got) - } -} - -func TestCreateContainerImageNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Hostname":"", "User":"", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, -"PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], -"Image":"base", "Volumes":{}, "VolumesFrom":""}` - request, _ := http.NewRequest("POST", "/containers/create", strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestRenameContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - newName := server.containers[0].Name + "abc" - path := fmt.Sprintf("/containers/%s/rename?name=%s", server.containers[0].ID, newName) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("RenameContainer: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - container := server.containers[0] - if container.Name != newName { - t.Errorf("RenameContainer: did not rename the container. Want %q. Got %q.", newName, container.Name) - } -} - -func TestRenameContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/containers/blabla/rename?name=something", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("RenameContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestCommitContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/commit?container="+server.containers[0].ID, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("CommitContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - expected := fmt.Sprintf(`{"ID":"%s"}`, server.images[0].ID) - if got := recorder.Body.String(); got != expected { - t.Errorf("CommitContainer: wrong response body. Want %q. Got %q.", expected, got) - } -} - -func TestCommitContainerComplete(t *testing.T) { - server := DockerServer{} - server.imgIDs = make(map[string]string) - addContainers(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - queryString := "container=" + server.containers[0].ID + "&repo=tsuru/python&m=saving&author=developers" - queryString += `&run={"Cmd": ["cat", "/world"],"PortSpecs":["22"]}` - request, _ := http.NewRequest("POST", "/commit?"+queryString, nil) - server.ServeHTTP(recorder, request) - image := server.images[0] - if image.Parent != server.containers[0].Image { - t.Errorf("CommitContainer: wrong parent image. Want %q. Got %q.", server.containers[0].Image, image.Parent) - } - if image.Container != server.containers[0].ID { - t.Errorf("CommitContainer: wrong container. Want %q. Got %q.", server.containers[0].ID, image.Container) - } - message := "saving" - if image.Comment != message { - t.Errorf("CommitContainer: wrong comment (commit message). Want %q. Got %q.", message, image.Comment) - } - author := "developers" - if image.Author != author { - t.Errorf("CommitContainer: wrong author. Want %q. Got %q.", author, image.Author) - } - if id := server.imgIDs["tsuru/python"]; id != image.ID { - t.Errorf("CommitContainer: wrong ID saved for repository. Want %q. Got %q.", image.ID, id) - } - portSpecs := []string{"22"} - if !reflect.DeepEqual(image.Config.PortSpecs, portSpecs) { - t.Errorf("CommitContainer: wrong port spec in config. Want %#v. Got %#v.", portSpecs, image.Config.PortSpecs) - } - cmd := []string{"cat", "/world"} - if !reflect.DeepEqual(image.Config.Cmd, cmd) { - t.Errorf("CommitContainer: wrong cmd in config. Want %#v. Got %#v.", cmd, image.Config.Cmd) - } -} - -func TestCommitContainerWithTag(t *testing.T) { - server := DockerServer{} - server.imgIDs = make(map[string]string) - addContainers(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - queryString := "container=" + server.containers[0].ID + "&repo=tsuru/python&tag=v1" - request, _ := http.NewRequest("POST", "/commit?"+queryString, nil) - server.ServeHTTP(recorder, request) - image := server.images[0] - if image.Parent != server.containers[0].Image { - t.Errorf("CommitContainer: wrong parent image. Want %q. Got %q.", server.containers[0].Image, image.Parent) - } - if image.Container != server.containers[0].ID { - t.Errorf("CommitContainer: wrong container. Want %q. Got %q.", server.containers[0].ID, image.Container) - } - if id := server.imgIDs["tsuru/python:v1"]; id != image.ID { - t.Errorf("CommitContainer: wrong ID saved for repository. Want %q. Got %q.", image.ID, id) - } -} - -func TestCommitContainerInvalidRun(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/commit?container="+server.containers[0].ID+"&run=abc---", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("CommitContainer. Wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } -} - -func TestCommitContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/commit?container=abc123", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("CommitContainer. Wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestInspectContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/json", server.containers[0].ID) - request, _ := http.NewRequest("GET", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("InspectContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - expected := server.containers[0] - var got docker.Container - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(got.Config, expected.Config) { - t.Errorf("InspectContainer: wrong value. Want %#v. Got %#v.", *expected, got) - } - if !reflect.DeepEqual(got.NetworkSettings, expected.NetworkSettings) { - t.Errorf("InspectContainer: wrong value. Want %#v. Got %#v.", *expected, got) - } - got.State.StartedAt = expected.State.StartedAt - got.State.FinishedAt = expected.State.FinishedAt - got.Config = expected.Config - got.Created = expected.Created - got.NetworkSettings = expected.NetworkSettings - if !reflect.DeepEqual(got, *expected) { - t.Errorf("InspectContainer: wrong value. Want %#v. Got %#v.", *expected, got) - } -} - -func TestInspectContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/abc123/json", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("InspectContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestTopContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/top", server.containers[0].ID) - request, _ := http.NewRequest("GET", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("TopContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - var got docker.TopResult - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(got.Titles, []string{"UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"}) { - t.Fatalf("TopContainer: Unexpected titles, got: %#v", got.Titles) - } - if len(got.Processes) != 1 { - t.Fatalf("TopContainer: Unexpected process len, got: %d", len(got.Processes)) - } - if got.Processes[0][len(got.Processes[0])-1] != "ls -la .." { - t.Fatalf("TopContainer: Unexpected command name, got: %s", got.Processes[0][len(got.Processes[0])-1]) - } -} - -func TestTopContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/xyz/top", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("TopContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestTopContainerStopped(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/top", server.containers[0].ID) - request, _ := http.NewRequest("GET", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusInternalServerError { - t.Errorf("TopContainer: wrong status. Want %d. Got %d.", http.StatusInternalServerError, recorder.Code) - } -} - -func TestStartContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - memory := int64(536870912) - hostConfig := docker.HostConfig{Memory: memory} - configBytes, err := json.Marshal(hostConfig) - if err != nil { - t.Fatal(err) - } - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/start", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, bytes.NewBuffer(configBytes)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("StartContainer: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - if !server.containers[0].State.Running { - t.Error("StartContainer: did not set the container to running state") - } - if gotMemory := server.containers[0].HostConfig.Memory; gotMemory != memory { - t.Errorf("StartContainer: wrong HostConfig. Wants %d of memory. Got %d", memory, gotMemory) - } -} - -func TestStartContainerChangeNetwork(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - hostConfig := docker.HostConfig{ - PortBindings: map[docker.Port][]docker.PortBinding{ - "8888/tcp": {{HostIP: "", HostPort: "12345"}}, - }, - } - configBytes, err := json.Marshal(hostConfig) - if err != nil { - t.Fatal(err) - } - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/start", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, bytes.NewBuffer(configBytes)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("StartContainer: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - if !server.containers[0].State.Running { - t.Error("StartContainer: did not set the container to running state") - } - portMapping := server.containers[0].NetworkSettings.Ports["8888/tcp"] - expected := []docker.PortBinding{{HostIP: "0.0.0.0", HostPort: "12345"}} - if !reflect.DeepEqual(portMapping, expected) { - t.Errorf("StartContainer: network not updated. Wants %#v ports. Got %#v", expected, portMapping) - } -} - -func TestStartContainerWithNotifyChannel(t *testing.T) { - ch := make(chan *docker.Container, 1) - server := DockerServer{} - server.cChan = ch - addContainers(&server, 1) - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/start", server.containers[1].ID) - request, _ := http.NewRequest("POST", path, bytes.NewBuffer([]byte("{}"))) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("StartContainer: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - if notified := <-ch; notified != server.containers[1] { - t.Errorf("StartContainer: did not notify the proper container. Want %q. Got %q.", server.containers[1].ID, notified.ID) - } -} - -func TestStartContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - path := "/containers/abc123/start" - request, _ := http.NewRequest("POST", path, bytes.NewBuffer([]byte("null"))) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("StartContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestStartContainerAlreadyRunning(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/start", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, bytes.NewBuffer([]byte("null"))) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotModified { - t.Errorf("StartContainer: wrong status code. Want %d. Got %d.", http.StatusNotModified, recorder.Code) - } -} - -func TestStopContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/stop", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("StopContainer: wrong status code. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if server.containers[0].State.Running { - t.Error("StopContainer: did not stop the container") - } -} - -func TestKillContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/kill", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("KillContainer: wrong status code. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if server.containers[0].State.Running { - t.Error("KillContainer: did not stop the container") - } -} - -func TestStopContainerWithNotifyChannel(t *testing.T) { - ch := make(chan *docker.Container, 1) - server := DockerServer{} - server.cChan = ch - addContainers(&server, 1) - addContainers(&server, 1) - server.containers[1].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/stop", server.containers[1].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("StopContainer: wrong status code. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if notified := <-ch; notified != server.containers[1] { - t.Errorf("StopContainer: did not notify the proper container. Want %q. Got %q.", server.containers[1].ID, notified.ID) - } -} - -func TestStopContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - path := "/containers/abc123/stop" - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("StopContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestStopContainerNotRunning(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/stop", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("StopContainer: wrong status code. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } -} - -func TestPauseContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/pause", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("PauseContainer: wrong status code. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if !server.containers[0].State.Paused { - t.Error("PauseContainer: did not pause the container") - } -} - -func TestPauseContainerAlreadyPaused(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Paused = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/pause", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("PauseContainer: wrong status code. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } -} - -func TestPauseContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - path := "/containers/abc123/pause" - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("PauseContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestUnpauseContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Paused = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/unpause", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("UnpauseContainer: wrong status code. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if server.containers[0].State.Paused { - t.Error("UnpauseContainer: did not unpause the container") - } -} - -func TestUnpauseContainerNotPaused(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/unpause", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("UnpauseContainer: wrong status code. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } -} - -func TestUnpauseContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - path := "/containers/abc123/unpause" - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("UnpauseContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestWaitContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/wait", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - go func() { - server.cMut.Lock() - server.containers[0].State.Running = false - server.cMut.Unlock() - }() - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("WaitContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - expected := `{"StatusCode":0}` + "\n" - if body := recorder.Body.String(); body != expected { - t.Errorf("WaitContainer: wrong body. Want %q. Got %q.", expected, body) - } -} - -func TestWaitContainerStatus(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - server.containers[0].State.ExitCode = 63 - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/wait", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("WaitContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - expected := `{"StatusCode":63}` + "\n" - if body := recorder.Body.String(); body != expected { - t.Errorf("WaitContainer: wrong body. Want %q. Got %q.", expected, body) - } -} - -func TestWaitContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - path := "/containers/abc123/wait" - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("WaitContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -type HijackableResponseRecorder struct { - httptest.ResponseRecorder - readCh chan []byte -} - -func (r *HijackableResponseRecorder) Hijack() (net.Conn, *bufio.ReadWriter, error) { - myConn, otherConn := net.Pipe() - r.readCh = make(chan []byte) - go func() { - data, _ := ioutil.ReadAll(myConn) - r.readCh <- data - }() - return otherConn, nil, nil -} - -func (r *HijackableResponseRecorder) HijackBuffer() string { - return string(<-r.readCh) -} - -func TestAttachContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - recorder := &HijackableResponseRecorder{} - path := fmt.Sprintf("/containers/%s/attach?logs=1", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - lines := []string{ - "\x01\x00\x00\x00\x00\x00\x00\x15Container is running", - "\x01\x00\x00\x00\x00\x00\x00\x0fWhat happened?", - "\x01\x00\x00\x00\x00\x00\x00\x13Something happened", - } - expected := strings.Join(lines, "\n") + "\n" - if body := recorder.HijackBuffer(); body != expected { - t.Errorf("AttachContainer: wrong body. Want %q. Got %q.", expected, body) - } -} - -func TestAttachContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := &HijackableResponseRecorder{} - path := "/containers/abc123/attach?logs=1" - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("AttachContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestAttachContainerWithStreamBlocks(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - path := fmt.Sprintf("/containers/%s/attach?logs=1&stdout=1&stream=1", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - done := make(chan string) - go func() { - recorder := &HijackableResponseRecorder{} - server.ServeHTTP(recorder, request) - done <- recorder.HijackBuffer() - }() - select { - case <-done: - t.Fatalf("attach stream returned before container is stopped") - case <-time.After(500 * time.Millisecond): - } - server.cMut.Lock() - server.containers[0].State.Running = false - server.cMut.Unlock() - var body string - select { - case body = <-done: - case <-time.After(5 * time.Second): - t.Fatalf("timed out waiting for attach to finish") - } - lines := []string{ - "\x01\x00\x00\x00\x00\x00\x00\x15Container is running", - "\x01\x00\x00\x00\x00\x00\x00\x0fWhat happened?", - "\x01\x00\x00\x00\x00\x00\x00\x13Something happened", - } - expected := strings.Join(lines, "\n") + "\n" - if body != expected { - t.Errorf("AttachContainer: wrong body. Want %q. Got %q.", expected, body) - } -} - -func TestRemoveContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s", server.containers[0].ID) - request, _ := http.NewRequest("DELETE", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("RemoveContainer: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if len(server.containers) > 0 { - t.Error("RemoveContainer: did not remove the container.") - } -} - -func TestRemoveContainerByName(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s", server.containers[0].Name) - request, _ := http.NewRequest("DELETE", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("RemoveContainer: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if len(server.containers) > 0 { - t.Error("RemoveContainer: did not remove the container.") - } -} - -func TestRemoveContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/abc123") - request, _ := http.NewRequest("DELETE", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("RemoveContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestRemoveContainerRunning(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s", server.containers[0].ID) - request, _ := http.NewRequest("DELETE", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusInternalServerError { - t.Errorf("RemoveContainer: wrong status. Want %d. Got %d.", http.StatusInternalServerError, recorder.Code) - } - if len(server.containers) < 1 { - t.Error("RemoveContainer: should not remove the container.") - } -} - -func TestRemoveContainerRunningForce(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s?%s", server.containers[0].ID, "force=1") - request, _ := http.NewRequest("DELETE", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("RemoveContainer: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if len(server.containers) > 0 { - t.Error("RemoveContainer: did not remove the container.") - } -} - -func TestPullImage(t *testing.T) { - server := DockerServer{imgIDs: make(map[string]string)} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/images/create?fromImage=base", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("PullImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - if len(server.images) != 1 { - t.Errorf("PullImage: Want 1 image. Got %d.", len(server.images)) - } - if _, ok := server.imgIDs["base"]; !ok { - t.Error("PullImage: Repository should not be empty.") - } -} - -func TestPullImageWithTag(t *testing.T) { - server := DockerServer{imgIDs: make(map[string]string)} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/images/create?fromImage=base&tag=tag", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("PullImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - if len(server.images) != 1 { - t.Errorf("PullImage: Want 1 image. Got %d.", len(server.images)) - } - if _, ok := server.imgIDs["base:tag"]; !ok { - t.Error("PullImage: Repository should not be empty.") - } -} - -func TestPushImage(t *testing.T) { - server := DockerServer{imgIDs: map[string]string{"tsuru/python": "a123"}} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/images/tsuru/python/push", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("PushImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } -} - -func TestPushImageWithTag(t *testing.T) { - server := DockerServer{imgIDs: map[string]string{"tsuru/python:v1": "a123"}} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/images/tsuru/python/push?tag=v1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("PushImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } -} - -func TestPushImageNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/images/tsuru/python/push", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("PushImage: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestTagImage(t *testing.T) { - server := DockerServer{imgIDs: map[string]string{"tsuru/python": "a123"}} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/images/tsuru/python/tag?repo=tsuru/new-python", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusCreated { - t.Errorf("TagImage: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) - } - if server.imgIDs["tsuru/python"] != server.imgIDs["tsuru/new-python"] { - t.Errorf("TagImage: did not tag the image") - } -} - -func TestTagImageWithRepoAndTag(t *testing.T) { - server := DockerServer{imgIDs: map[string]string{"tsuru/python": "a123"}} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/images/tsuru/python/tag?repo=tsuru/new-python&tag=v1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusCreated { - t.Errorf("TagImage: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) - } - if server.imgIDs["tsuru/python"] != server.imgIDs["tsuru/new-python:v1"] { - t.Errorf("TagImage: did not tag the image") - } -} - -func TestTagImageNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/images/tsuru/python/tag", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("TagImage: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func addContainers(server *DockerServer, n int) { - server.cMut.Lock() - defer server.cMut.Unlock() - for i := 0; i < n; i++ { - date := time.Now().Add(time.Duration((rand.Int() % (i + 1))) * time.Hour) - container := docker.Container{ - Name: fmt.Sprintf("%x", rand.Int()%10000), - ID: fmt.Sprintf("%x", rand.Int()%10000), - Created: date, - Path: "ls", - Args: []string{"-la", ".."}, - Config: &docker.Config{ - Hostname: fmt.Sprintf("docker-%d", i), - AttachStdout: true, - AttachStderr: true, - Env: []string{"ME=you", fmt.Sprintf("NUMBER=%d", i)}, - Cmd: []string{"ls", "-la", ".."}, - Image: "base", - }, - State: docker.State{ - Running: false, - Pid: 400 + i, - ExitCode: 0, - StartedAt: date, - }, - Image: "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", - NetworkSettings: &docker.NetworkSettings{ - IPAddress: fmt.Sprintf("10.10.10.%d", i+2), - IPPrefixLen: 24, - Gateway: "10.10.10.1", - Bridge: "docker0", - PortMapping: map[string]docker.PortMapping{ - "Tcp": {"8888": fmt.Sprintf("%d", 49600+i)}, - }, - Ports: map[docker.Port][]docker.PortBinding{ - "8888/tcp": { - {HostIP: "0.0.0.0", HostPort: fmt.Sprintf("%d", 49600+i)}, - }, - }, - }, - ResolvConfPath: "/etc/resolv.conf", - } - server.containers = append(server.containers, &container) - } -} - -func addImages(server *DockerServer, n int, repo bool) { - server.iMut.Lock() - defer server.iMut.Unlock() - if server.imgIDs == nil { - server.imgIDs = make(map[string]string) - } - for i := 0; i < n; i++ { - date := time.Now().Add(time.Duration((rand.Int() % (i + 1))) * time.Hour) - image := docker.Image{ - ID: fmt.Sprintf("%x", rand.Int()%10000), - Created: date, - } - server.images = append(server.images, image) - if repo { - repo := "docker/python-" + image.ID - server.imgIDs[repo] = image.ID - } - } -} - -func TestListImages(t *testing.T) { - server := DockerServer{} - addImages(&server, 2, true) - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/images/json?all=1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("ListImages: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - expected := make([]docker.APIImages, 2) - for i, image := range server.images { - expected[i] = docker.APIImages{ - ID: image.ID, - Created: image.Created.Unix(), - RepoTags: []string{"docker/python-" + image.ID}, - } - } - var got []docker.APIImages - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(got, expected) { - t.Errorf("ListImages. Want %#v. Got %#v.", expected, got) - } -} - -func TestRemoveImage(t *testing.T) { - server := DockerServer{} - addImages(&server, 1, false) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/images/%s", server.images[0].ID) - request, _ := http.NewRequest("DELETE", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("RemoveImage: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if len(server.images) > 0 { - t.Error("RemoveImage: did not remove the image.") - } -} - -func TestRemoveImageByName(t *testing.T) { - server := DockerServer{} - addImages(&server, 1, true) - server.buildMuxer() - recorder := httptest.NewRecorder() - imgName := "docker/python-" + server.images[0].ID - path := "/images/" + imgName - request, _ := http.NewRequest("DELETE", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("RemoveImage: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if len(server.images) > 0 { - t.Error("RemoveImage: did not remove the image.") - } - _, ok := server.imgIDs[imgName] - if ok { - t.Error("RemoveImage: did not remove image tag name.") - } -} - -func TestRemoveImageWithMultipleTags(t *testing.T) { - server := DockerServer{} - addImages(&server, 1, true) - server.buildMuxer() - imgID := server.images[0].ID - imgName := "docker/python-" + imgID - server.imgIDs["docker/python-wat"] = imgID - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/images/%s", imgName) - request, _ := http.NewRequest("DELETE", path, nil) - server.ServeHTTP(recorder, request) - _, ok := server.imgIDs[imgName] - if ok { - t.Error("RemoveImage: did not remove image tag name.") - } - id, ok := server.imgIDs["docker/python-wat"] - if !ok { - t.Error("RemoveImage: removed the wrong tag name.") - } - if id != imgID { - t.Error("RemoveImage: disassociated the wrong ID from the tag") - } - if len(server.images) < 1 { - t.Fatal("RemoveImage: removed the image, but should keep it") - } - if server.images[0].ID != imgID { - t.Error("RemoveImage: changed the ID of the image!") - } -} - -func TestPrepareFailure(t *testing.T) { - server := DockerServer{failures: make(map[string]string)} - server.buildMuxer() - errorID := "my_error" - server.PrepareFailure(errorID, "containers/json") - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("PrepareFailure: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } - if recorder.Body.String() != errorID+"\n" { - t.Errorf("PrepareFailure: wrong message. Want %s. Got %s.", errorID, recorder.Body.String()) - } -} - -func TestPrepareMultiFailures(t *testing.T) { - server := DockerServer{multiFailures: []map[string]string{}} - server.buildMuxer() - errorID := "multi error" - server.PrepareMultiFailures(errorID, "containers/json") - server.PrepareMultiFailures(errorID, "containers/json") - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("PrepareFailure: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } - if recorder.Body.String() != errorID+"\n" { - t.Errorf("PrepareFailure: wrong message. Want %s. Got %s.", errorID, recorder.Body.String()) - } - recorder = httptest.NewRecorder() - request, _ = http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("PrepareFailure: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } - if recorder.Body.String() != errorID+"\n" { - t.Errorf("PrepareFailure: wrong message. Want %s. Got %s.", errorID, recorder.Body.String()) - } - recorder = httptest.NewRecorder() - request, _ = http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("PrepareFailure: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - if recorder.Body.String() == errorID+"\n" { - t.Errorf("PrepareFailure: wrong message. Want %s. Got %s.", errorID, recorder.Body.String()) - } -} - -func TestRemoveFailure(t *testing.T) { - server := DockerServer{failures: make(map[string]string)} - server.buildMuxer() - errorID := "my_error" - server.PrepareFailure(errorID, "containers/json") - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("PrepareFailure: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } - server.ResetFailure(errorID) - recorder = httptest.NewRecorder() - request, _ = http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("RemoveFailure: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } -} - -func TestResetMultiFailures(t *testing.T) { - server := DockerServer{multiFailures: []map[string]string{}} - server.buildMuxer() - errorID := "multi error" - server.PrepareMultiFailures(errorID, "containers/json") - server.PrepareMultiFailures(errorID, "containers/json") - if len(server.multiFailures) != 2 { - t.Errorf("PrepareMultiFailures: error adding multi failures.") - } - server.ResetMultiFailures() - if len(server.multiFailures) != 0 { - t.Errorf("ResetMultiFailures: error reseting multi failures.") - } -} - -func TestMutateContainer(t *testing.T) { - server := DockerServer{failures: make(map[string]string)} - server.buildMuxer() - server.containers = append(server.containers, &docker.Container{ID: "id123"}) - state := docker.State{Running: false, ExitCode: 1} - err := server.MutateContainer("id123", state) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(server.containers[0].State, state) { - t.Errorf("Wrong state after mutation.\nWant %#v.\nGot %#v.", - state, server.containers[0].State) - } -} - -func TestMutateContainerNotFound(t *testing.T) { - server := DockerServer{failures: make(map[string]string)} - server.buildMuxer() - state := docker.State{Running: false, ExitCode: 1} - err := server.MutateContainer("id123", state) - if err == nil { - t.Error("Unexpected error") - } - if err.Error() != "container not found" { - t.Errorf("wrong error message. Want %q. Got %q.", "container not found", err) - } -} - -func TestBuildImageWithContentTypeTar(t *testing.T) { - server := DockerServer{imgIDs: make(map[string]string)} - imageName := "teste" - recorder := httptest.NewRecorder() - tarFile, err := os.Open("data/dockerfile.tar") - if err != nil { - t.Fatal(err) - } - defer tarFile.Close() - request, _ := http.NewRequest("POST", "/build?t=teste", tarFile) - request.Header.Add("Content-Type", "application/tar") - server.buildImage(recorder, request) - if recorder.Body.String() == "miss Dockerfile" { - t.Errorf("BuildImage: miss Dockerfile") - return - } - if _, ok := server.imgIDs[imageName]; ok == false { - t.Errorf("BuildImage: image %s not builded", imageName) - } -} - -func TestBuildImageWithRemoteDockerfile(t *testing.T) { - server := DockerServer{imgIDs: make(map[string]string)} - imageName := "teste" - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/build?t=teste&remote=http://localhost/Dockerfile", nil) - server.buildImage(recorder, request) - if _, ok := server.imgIDs[imageName]; ok == false { - t.Errorf("BuildImage: image %s not builded", imageName) - } -} - -func TestPing(t *testing.T) { - server := DockerServer{} - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/_ping", nil) - server.pingDocker(recorder, request) - if recorder.Body.String() != "" { - t.Errorf("Ping: Unexpected body: %s", recorder.Body.String()) - } - if recorder.Code != http.StatusOK { - t.Errorf("Ping: Expected code %d, got: %d", http.StatusOK, recorder.Code) - } -} - -func TestDefaultHandler(t *testing.T) { - server, err := NewServer("127.0.0.1:0", nil, nil) - if err != nil { - t.Fatal(err) - } - defer server.listener.Close() - if server.mux != server.DefaultHandler() { - t.Fatalf("DefaultHandler: Expected to return server.mux, got: %#v", server.DefaultHandler()) - } -} - -func TestCreateExecContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Cmd": ["bash", "-c", "ls"]}` - path := fmt.Sprintf("/containers/%s/exec", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Fatalf("CreateExec: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - serverExec := server.execs[0] - var got docker.Exec - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if got.ID != serverExec.ID { - t.Errorf("CreateExec: wrong value. Want %#v. Got %#v.", serverExec.ID, got.ID) - } - - expected := docker.ExecInspect{ - ID: got.ID, - ProcessConfig: docker.ExecProcessConfig{ - EntryPoint: "bash", - Arguments: []string{"-c", "ls"}, - }, - Container: *server.containers[0], - } - - if !reflect.DeepEqual(*serverExec, expected) { - t.Errorf("InspectContainer: wrong value. Want:\n%#v\nGot:\n%#v\n", expected, *serverExec) - } -} - -func TestInspectExecContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Cmd": ["bash", "-c", "ls"]}` - path := fmt.Sprintf("/containers/%s/exec", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Fatalf("CreateExec: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - var got docker.Exec - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - path = fmt.Sprintf("/exec/%s/json", got.ID) - request, _ = http.NewRequest("GET", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Fatalf("CreateExec: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - var got2 docker.ExecInspect - err = json.NewDecoder(recorder.Body).Decode(&got2) - if err != nil { - t.Fatal(err) - } - expected := docker.ExecInspect{ - ID: got.ID, - ProcessConfig: docker.ExecProcessConfig{ - EntryPoint: "bash", - Arguments: []string{"-c", "ls"}, - }, - Container: *server.containers[0], - } - got2.Container.State.StartedAt = expected.Container.State.StartedAt - got2.Container.State.FinishedAt = expected.Container.State.FinishedAt - got2.Container.Config = expected.Container.Config - got2.Container.Created = expected.Container.Created - got2.Container.NetworkSettings = expected.Container.NetworkSettings - got2.Container.ExecIDs = expected.Container.ExecIDs - - if !reflect.DeepEqual(got2, expected) { - t.Errorf("InspectContainer: wrong value. Want:\n%#v\nGot:\n%#v\n", expected, got2) - } -} - -func TestStartExecContainer(t *testing.T) { - server, _ := NewServer("127.0.0.1:0", nil, nil) - addContainers(server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Cmd": ["bash", "-c", "ls"]}` - path := fmt.Sprintf("/containers/%s/exec", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Fatalf("CreateExec: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - var exec docker.Exec - err := json.NewDecoder(recorder.Body).Decode(&exec) - if err != nil { - t.Fatal(err) - } - unleash := make(chan bool) - server.PrepareExec(exec.ID, func() { - <-unleash - }) - codes := make(chan int, 1) - sent := make(chan bool) - go func() { - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/exec/%s/start", exec.ID) - body := `{"Tty":true}` - request, _ := http.NewRequest("POST", path, strings.NewReader(body)) - close(sent) - server.ServeHTTP(recorder, request) - codes <- recorder.Code - }() - <-sent - execInfo, err := waitExec(server.URL(), exec.ID, true, 5) - if err != nil { - t.Fatal(err) - } - if !execInfo.Running { - t.Error("StartExec: expected exec to be running, but it's not running") - } - close(unleash) - if code := <-codes; code != http.StatusOK { - t.Errorf("StartExec: wrong status. Want %d. Got %d.", http.StatusOK, code) - } - execInfo, err = waitExec(server.URL(), exec.ID, false, 5) - if err != nil { - t.Fatal(err) - } - if execInfo.Running { - t.Error("StartExec: expected exec to be not running after start returns, but it's running") - } -} - -func TestStartExecContainerWildcardCallback(t *testing.T) { - server, _ := NewServer("127.0.0.1:0", nil, nil) - addContainers(server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Cmd": ["bash", "-c", "ls"]}` - path := fmt.Sprintf("/containers/%s/exec", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Fatalf("CreateExec: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - unleash := make(chan bool) - server.PrepareExec("*", func() { - <-unleash - }) - var exec docker.Exec - err := json.NewDecoder(recorder.Body).Decode(&exec) - if err != nil { - t.Fatal(err) - } - codes := make(chan int, 1) - sent := make(chan bool) - go func() { - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/exec/%s/start", exec.ID) - body := `{"Tty":true}` - request, _ := http.NewRequest("POST", path, strings.NewReader(body)) - close(sent) - server.ServeHTTP(recorder, request) - codes <- recorder.Code - }() - <-sent - execInfo, err := waitExec(server.URL(), exec.ID, true, 5) - if err != nil { - t.Fatal(err) - } - if !execInfo.Running { - t.Error("StartExec: expected exec to be running, but it's not running") - } - close(unleash) - if code := <-codes; code != http.StatusOK { - t.Errorf("StartExec: wrong status. Want %d. Got %d.", http.StatusOK, code) - } - execInfo, err = waitExec(server.URL(), exec.ID, false, 5) - if err != nil { - t.Fatal(err) - } - if execInfo.Running { - t.Error("StartExec: expected exec to be not running after start returns, but it's running") - } -} - -func TestStartExecContainerNotFound(t *testing.T) { - server, _ := NewServer("127.0.0.1:0", nil, nil) - addContainers(server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Tty":true}` - request, _ := http.NewRequest("POST", "/exec/something-wat/start", strings.NewReader(body)) - server.ServeHTTP(recorder, request) -} - -func waitExec(url, execID string, running bool, maxTry int) (*docker.ExecInspect, error) { - client, err := docker.NewClient(url) - if err != nil { - return nil, err - } - exec, err := client.InspectExec(execID) - for i := 0; i < maxTry && exec.Running != running && err == nil; i++ { - time.Sleep(100e6) - exec, err = client.InspectExec(exec.ID) - } - return exec, err -} - -func TestStatsContainer(t *testing.T) { - server, err := NewServer("127.0.0.1:0", nil, nil) - if err != nil { - t.Fatal(err) - } - defer server.Stop() - addContainers(server, 2) - server.buildMuxer() - expected := docker.Stats{} - expected.CPUStats.CPUUsage.TotalUsage = 20 - server.PrepareStats(server.containers[0].ID, func(id string) docker.Stats { - return expected - }) - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/stats?stream=false", server.containers[0].ID) - request, _ := http.NewRequest("GET", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("StatsContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - body := recorder.Body.Bytes() - var got docker.Stats - err = json.Unmarshal(body, &got) - if err != nil { - t.Fatal(err) - } - got.Read = time.Time{} - if !reflect.DeepEqual(got, expected) { - t.Errorf("StatsContainer: wrong value. Want %#v. Got %#v.", expected, got) - } -} - -type safeWriter struct { - sync.Mutex - *httptest.ResponseRecorder -} - -func (w *safeWriter) Write(buf []byte) (int, error) { - w.Lock() - defer w.Unlock() - return w.ResponseRecorder.Write(buf) -} - -func TestStatsContainerStream(t *testing.T) { - server, err := NewServer("127.0.0.1:0", nil, nil) - if err != nil { - t.Fatal(err) - } - defer server.Stop() - addContainers(server, 2) - server.buildMuxer() - expected := docker.Stats{} - expected.CPUStats.CPUUsage.TotalUsage = 20 - server.PrepareStats(server.containers[0].ID, func(id string) docker.Stats { - time.Sleep(50 * time.Millisecond) - return expected - }) - recorder := &safeWriter{ - ResponseRecorder: httptest.NewRecorder(), - } - path := fmt.Sprintf("/containers/%s/stats?stream=true", server.containers[0].ID) - request, _ := http.NewRequest("GET", path, nil) - go func() { - server.ServeHTTP(recorder, request) - }() - time.Sleep(200 * time.Millisecond) - recorder.Lock() - defer recorder.Unlock() - body := recorder.Body.Bytes() - parts := bytes.Split(body, []byte("\n")) - if len(parts) < 2 { - t.Errorf("StatsContainer: wrong number of parts. Want at least 2. Got %#v.", len(parts)) - } - var got docker.Stats - err = json.Unmarshal(parts[0], &got) - if err != nil { - t.Fatal(err) - } - got.Read = time.Time{} - if !reflect.DeepEqual(got, expected) { - t.Errorf("StatsContainer: wrong value. Want %#v. Got %#v.", expected, got) - } -} - -func addNetworks(server *DockerServer, n int) { - server.netMut.Lock() - defer server.netMut.Unlock() - for i := 0; i < n; i++ { - netid := fmt.Sprintf("%x", rand.Int()%10000) - network := docker.Network{ - Name: netid, - ID: fmt.Sprintf("%x", rand.Int()%10000), - Driver: "bridge", - Containers: map[string]docker.Endpoint{ - "blah": { - Name: "blah", - ID: fmt.Sprintf("%x", rand.Int()%10000), - }, - }, - } - server.networks = append(server.networks, &network) - } -} - -func TestListNetworks(t *testing.T) { - server := DockerServer{} - addNetworks(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/networks", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("ListNetworks: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - expected := make([]docker.Network, 2) - for i, network := range server.networks { - expected[i] = docker.Network{ - ID: network.ID, - Name: network.Name, - Driver: network.Driver, - Containers: network.Containers, - } - } - var got []docker.Network - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(got, expected) { - t.Errorf("ListNetworks. Want %#v. Got %#v.", expected, got) - } -} - -type createNetworkResponse struct { - ID string `json:"ID"` -} - -func TestCreateNetwork(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - netid := fmt.Sprintf("%x", rand.Int()%10000) - netname := fmt.Sprintf("%x", rand.Int()%10000) - body := fmt.Sprintf(`{"ID": "%s", "Name": "%s", "Type": "bridge" }`, netid, netname) - request, _ := http.NewRequest("POST", "/networks", strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusCreated { - t.Errorf("CreateNetwork: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) - } - - var returned createNetworkResponse - err := json.NewDecoder(recorder.Body).Decode(&returned) - if err != nil { - t.Fatal(err) - } - stored := server.networks[0] - if returned.ID != stored.ID { - t.Errorf("CreateNetwork: ID mismatch. Stored: %q. Returned: %q.", stored.ID, returned) - } -} - -func TestCreateNetworkInvalidBody(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/networks", strings.NewReader("whaaaaaat---")) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("CreateNetwork: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } -} - -func TestCreateNetworkDuplicateName(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - addNetworks(&server, 1) - server.networks[0].Name = "mynetwork" - recorder := httptest.NewRecorder() - body := fmt.Sprintf(`{"ID": "%s", "Name": "mynetwork", "Type": "bridge" }`, fmt.Sprintf("%x", rand.Int()%10000)) - request, _ := http.NewRequest("POST", "/networks", strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusForbidden { - t.Errorf("CreateNetwork: wrong status. Want %d. Got %d.", http.StatusForbidden, recorder.Code) - } -} - -func TestListVolumes(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - expected := []docker.Volume{{ - Name: "test-vol-1", - Driver: "local", - Mountpoint: "/var/lib/docker/volumes/test-vol-1", - }} - server.volStore = make(map[string]*volumeCounter) - for _, vol := range expected { - server.volStore[vol.Name] = &volumeCounter{ - volume: vol, - count: 0, - } - } - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/volumes", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("ListVolumes: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) - } - var got []docker.Volume - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(got, expected) { - t.Errorf("ListVolumes. Want %#v. Got %#v.", expected, got) - } -} - -func TestCreateVolume(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Name":"test-volume"}` - request, _ := http.NewRequest("POST", "/volumes/create", strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusCreated { - t.Errorf("CreateVolume: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) - } - var returned docker.Volume - err := json.NewDecoder(recorder.Body).Decode(&returned) - if err != nil { - t.Error(err) - } - if returned.Name != "test-volume" { - t.Errorf("CreateVolume: Name mismatch. Expected: test-volume. Returned %q.", returned.Name) - } - if returned.Driver != "local" { - t.Errorf("CreateVolume: Driver mismatch. Expected: local. Returned: %q", returned.Driver) - } - if returned.Mountpoint != "/var/lib/docker/volumes/test-volume" { - t.Errorf("CreateVolume: Mountpoint mismatch. Expected: /var/lib/docker/volumes/test-volume. Returned: %q.", returned.Mountpoint) - } -} - -func TestCreateVolumeAlreadExists(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - server.volStore = make(map[string]*volumeCounter) - server.volStore["test-volume"] = &volumeCounter{ - volume: docker.Volume{ - Name: "test-volume", - Driver: "local", - Mountpoint: "/var/lib/docker/volumes/test-volume", - }, - count: 0, - } - body := `{"Name":"test-volume"}` - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/volumes/create", strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusCreated { - t.Errorf("CreateVolumeAlreadExists: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) - } - var returned docker.Volume - err := json.NewDecoder(recorder.Body).Decode(&returned) - if err != nil { - t.Error(err) - } - if returned.Name != "test-volume" { - t.Errorf("CreateVolumeAlreadExists: Name mismatch. Expected: test-volume. Returned %q.", returned.Name) - } - if returned.Driver != "local" { - t.Errorf("CreateVolumeAlreadExists: Driver mismatch. Expected: local. Returned: %q", returned.Driver) - } - if returned.Mountpoint != "/var/lib/docker/volumes/test-volume" { - t.Errorf("CreateVolumeAlreadExists: Mountpoint mismatch. Expected: /var/lib/docker/volumes/test-volume. Returned: %q.", returned.Mountpoint) - } -} - -func TestInspectVolume(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - expected := docker.Volume{ - Name: "test-volume", - Driver: "local", - Mountpoint: "/var/lib/docker/volumes/test-volume", - } - volC := &volumeCounter{ - volume: expected, - count: 0, - } - volStore := make(map[string]*volumeCounter) - volStore["test-volume"] = volC - server.volStore = volStore - request, _ := http.NewRequest("GET", "/volumes/test-volume", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("InspectVolume: wrong status. Want %d. God %d.", http.StatusOK, recorder.Code) - } - var returned docker.Volume - err := json.NewDecoder(recorder.Body).Decode(&returned) - if err != nil { - t.Error(err) - } - if returned.Name != "test-volume" { - t.Errorf("InspectVolume: Name mismatch. Expected: test-volume. Returned %q.", returned.Name) - } - if returned.Driver != "local" { - t.Errorf("InspectVolume: Driver mismatch. Expected: local. Returned: %q", returned.Driver) - } - if returned.Mountpoint != "/var/lib/docker/volumes/test-volume" { - t.Errorf("InspectVolume: Mountpoint mismatch. Expected: /var/lib/docker/volumes/test-volume. Returned: %q.", returned.Mountpoint) - } -} - -func TestInspectVolumeNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/volumes/test-volume", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("RemoveMissingVolume: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestRemoveVolume(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - server.volStore = make(map[string]*volumeCounter) - server.volStore["test-volume"] = &volumeCounter{ - volume: docker.Volume{ - Name: "test-volume", - Driver: "local", - Mountpoint: "/var/lib/docker/volumes/test-volume", - }, - count: 0, - } - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("DELETE", "/volumes/test-volume", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("RemoveVolume: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } -} - -func TestRemoveMissingVolume(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("DELETE", "/volumes/test-volume", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("RemoveMissingVolume: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestRemoveVolumeInuse(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - server.volStore = make(map[string]*volumeCounter) - server.volStore["test-volume"] = &volumeCounter{ - volume: docker.Volume{ - Name: "test-volume", - Driver: "local", - Mountpoint: "/var/lib/docker/volumes/test-volume", - }, - count: 1, - } - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("DELETE", "/volumes/test-volume", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusConflict { - t.Errorf("RemoveVolume: wrong status. Want %d. Got %d.", http.StatusConflict, recorder.Code) - } -} - -func TestUploadToContainer(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - cont := &docker.Container{ - ID: "id123", - State: docker.State{ - Running: true, - ExitCode: 0, - }, - } - server.containers = append(server.containers, cont) - server.uploadedFiles = make(map[string]string) - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("PUT", fmt.Sprintf("/containers/%s/archive?path=abcd", cont.ID), nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("UploadToContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } -} - -func TestUploadToContainerMissingContainer(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("PUT", "/containers/missing-container/archive?path=abcd", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("UploadToContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/volume_test.go b/vendor/github.com/fsouza/go-dockerclient/volume_test.go deleted file mode 100644 index e6bcca95ff..0000000000 --- a/vendor/github.com/fsouza/go-dockerclient/volume_test.go +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright 2015 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package docker - -import ( - "encoding/json" - "net/http" - "net/url" - "reflect" - "testing" -) - -func TestListVolumes(t *testing.T) { - volumesData := `[ - { - "Name": "tardis", - "Driver": "local", - "Mountpoint": "/var/lib/docker/volumes/tardis" - }, - { - "Name": "foo", - "Driver": "bar", - "Mountpoint": "/var/lib/docker/volumes/bar" - } -]` - body := `{ "Volumes": ` + volumesData + ` }` - var expected []Volume - if err := json.Unmarshal([]byte(volumesData), &expected); err != nil { - t.Fatal(err) - } - client := newTestClient(&FakeRoundTripper{message: body, status: http.StatusOK}) - volumes, err := client.ListVolumes(ListVolumesOptions{}) - if err != nil { - t.Error(err) - } - if !reflect.DeepEqual(volumes, expected) { - t.Errorf("ListVolumes: Wrong return value. Want %#v. Got %#v.", expected, volumes) - } -} - -func TestCreateVolume(t *testing.T) { - body := `{ - "Name": "tardis", - "Driver": "local", - "Mountpoint": "/var/lib/docker/volumes/tardis" - }` - var expected Volume - if err := json.Unmarshal([]byte(body), &expected); err != nil { - t.Fatal(err) - } - fakeRT := &FakeRoundTripper{message: body, status: http.StatusOK} - client := newTestClient(fakeRT) - volume, err := client.CreateVolume( - CreateVolumeOptions{ - Name: "tardis", - Driver: "local", - DriverOpts: map[string]string{ - "foo": "bar", - }, - }, - ) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(volume, &expected) { - t.Errorf("CreateVolume: Wrong return value. Want %#v. Got %#v.", expected, volume) - } - req := fakeRT.requests[0] - expectedMethod := "POST" - if req.Method != expectedMethod { - t.Errorf("CreateVolume(): Wrong HTTP method. Want %s. Got %s.", expectedMethod, req.Method) - } - u, _ := url.Parse(client.getURL("/volumes/create")) - if req.URL.Path != u.Path { - t.Errorf("CreateVolume(): Wrong request path. Want %q. Got %q.", u.Path, req.URL.Path) - } -} - -func TestInspectVolume(t *testing.T) { - body := `{ - "Name": "tardis", - "Driver": "local", - "Mountpoint": "/var/lib/docker/volumes/tardis" - }` - var expected Volume - if err := json.Unmarshal([]byte(body), &expected); err != nil { - t.Fatal(err) - } - fakeRT := &FakeRoundTripper{message: body, status: http.StatusOK} - client := newTestClient(fakeRT) - name := "tardis" - volume, err := client.InspectVolume(name) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(volume, &expected) { - t.Errorf("InspectVolume: Wrong return value. Want %#v. Got %#v.", expected, volume) - } - req := fakeRT.requests[0] - expectedMethod := "GET" - if req.Method != expectedMethod { - t.Errorf("InspectVolume(%q): Wrong HTTP method. Want %s. Got %s.", name, expectedMethod, req.Method) - } - u, _ := url.Parse(client.getURL("/volumes/" + name)) - if req.URL.Path != u.Path { - t.Errorf("CreateVolume(%q): Wrong request path. Want %q. Got %q.", name, u.Path, req.URL.Path) - } -} - -func TestRemoveVolume(t *testing.T) { - name := "test" - fakeRT := &FakeRoundTripper{message: "", status: http.StatusNoContent} - client := newTestClient(fakeRT) - if err := client.RemoveVolume(name); err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expectedMethod := "DELETE" - if req.Method != expectedMethod { - t.Errorf("RemoveVolume(%q): Wrong HTTP method. Want %s. Got %s.", name, expectedMethod, req.Method) - } - u, _ := url.Parse(client.getURL("/volumes/" + name)) - if req.URL.Path != u.Path { - t.Errorf("RemoveVolume(%q): Wrong request path. Want %q. Got %q.", name, u.Path, req.URL.Path) - } -} - -func TestRemoveVolumeNotFound(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "no such volume", status: http.StatusNotFound}) - if err := client.RemoveVolume("test:"); err != ErrNoSuchVolume { - t.Errorf("RemoveVolume: wrong error. Want %#v. Got %#v.", ErrNoSuchVolume, err) - } -} - -func TestRemoveVolumeInUse(t *testing.T) { - client := newTestClient(&FakeRoundTripper{message: "volume in use and cannot be removed", status: http.StatusConflict}) - if err := client.RemoveVolume("test:"); err != ErrVolumeInUse { - t.Errorf("RemoveVolume: wrong error. Want %#v. Got %#v.", ErrVolumeInUse, err) - } -} diff --git a/vendor/github.com/go-chef/chef/acl_test.go b/vendor/github.com/go-chef/chef/acl_test.go deleted file mode 100644 index 0924e43eaa..0000000000 --- a/vendor/github.com/go-chef/chef/acl_test.go +++ /dev/null @@ -1,102 +0,0 @@ -package chef - -import ( - "fmt" - "net/http" - "reflect" - "testing" -) - -func TestACLService_Get(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/nodes/hostname/_acl", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{ - "create": { - "actors": [ - "hostname", - "pivotal" - ], - "groups": [ - "clients", - "users", - "admins" - ] - }, - "read": { - "actors": [ - "hostname", - "pivotal" - ], - "groups": [ - "clients", - "users", - "admins" - ] - }, - "update": { - "actors": [ - "hostname", - "pivotal" - ], - "groups": [ - "users", - "admins" - ] - }, - "delete": { - "actors": [ - "hostname", - "pivotal" - ], - "groups": [ - "users", - "admins" - ] - }, - "grant": { - "actors": [ - "hostname", - "pivotal" - ], - "groups": [ - "admins" - ] - } - } - `) - }) - - acl, err := client.ACLs.Get("nodes", "hostname") - if err != nil { - t.Errorf("ACL.Get returned error: %v", err) - } - - want := ACL{ - "create": ACLitems{Groups: []string{"clients", "users", "admins"}, Actors: []string{"hostname", "pivotal"}}, - "read": ACLitems{Groups: []string{"clients", "users", "admins"}, Actors: []string{"hostname", "pivotal"}}, - "update": ACLitems{Groups: []string{"users", "admins"}, Actors: []string{"hostname", "pivotal"}}, - "delete": ACLitems{Groups: []string{"users", "admins"}, Actors: []string{"hostname", "pivotal"}}, - "grant": ACLitems{Groups: []string{"admins"}, Actors: []string{"hostname", "pivotal"}}, - } - - if !reflect.DeepEqual(acl, want) { - t.Errorf("ACL.Get returned %+v, want %+v", acl, want) - } -} - -func TestACLService_Put(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/nodes/hostname/_acl/create", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, ``) - }) - - acl := NewACL("create", []string{"pivotal"}, []string{"admins"}) - err := client.ACLs.Put("nodes", "hostname", "create", acl) - if err != nil { - t.Errorf("ACL.Put returned error: %v", err) - } -} diff --git a/vendor/github.com/go-chef/chef/client_test.go b/vendor/github.com/go-chef/chef/client_test.go deleted file mode 100644 index ea61744261..0000000000 --- a/vendor/github.com/go-chef/chef/client_test.go +++ /dev/null @@ -1,102 +0,0 @@ -package chef - -import ( - "encoding/json" - "fmt" - "io" - "log" - "net/http" - "os" - "reflect" - "testing" -) - -var ( - testClientJSON = "test/client.json" -) - -func TestClientFromJSONDecoder(t *testing.T) { - if file, err := os.Open(testClientJSON); err != nil { - t.Error("unexpected error", err, "during os.Open on", testClientJSON) - } else { - dec := json.NewDecoder(file) - var n Client - if err := dec.Decode(&n); err == io.EOF { - log.Println(n) - } else if err != nil { - log.Fatal(err) - } - } -} - -func TestClientsService_List(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/clients", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{"client1": "http://localhost/clients/client1", "client2": "http://localhost/clients/client2"}`) - }) - - response, err := client.Clients.List() - if err != nil { - t.Errorf("Clients.List returned error: %v", err) - } - - want := "client1 => http://localhost/clients/client1\nclient2 => http://localhost/clients/client2\n" - if response.String() != want { - t.Errorf("Clients.List returned:\n%+v\nwant:\n%+v\n", response.String(), want) - } -} - -func TestClientsService_Get(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/clients/client1", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{ - "clientname": "client1", - "orgname": "org_name", - "validator": false, - "certificate": "-----BEGIN CERTIFICATE-----", - "name": "node_name" - }`) - }) - - _, err := client.Clients.Get("client1") - if err != nil { - t.Errorf("Clients.Get returned error: %v", err) - } -} - -func TestClientsService_Create(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/clients", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{"uri": "http://localhost/clients/client", "private_key": "-----BEGIN PRIVATE KEY-----"}`) - }) - - response, err := client.Clients.Create("client", false) - if err != nil { - t.Errorf("Clients.Create returned error: %v", err) - } - - want := &ApiClientCreateResult{Uri: "http://localhost/clients/client", PrivateKey: "-----BEGIN PRIVATE KEY-----"} - if !reflect.DeepEqual(response, want) { - t.Errorf("Clients.Create returned %+v, want %+v", response, want) - } -} - -func TestClientsService_Delete(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/clients/client1", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{"name": "client1", "json_class": "Chef::Client", "chef_type": "client"}`) - }) - - err := client.Clients.Delete("client1") - if err != nil { - t.Errorf("Clients.Delete returned error: %v", err) - } -} diff --git a/vendor/github.com/go-chef/chef/cookbook_test.go b/vendor/github.com/go-chef/chef/cookbook_test.go deleted file mode 100644 index f0987a06c8..0000000000 --- a/vendor/github.com/go-chef/chef/cookbook_test.go +++ /dev/null @@ -1,139 +0,0 @@ -package chef - -import ( - "fmt" - "io/ioutil" - "net/http" - //"os" - "testing" -) - -const cookbookListResponseFile = "test/cookbooks_response.json" -const cookbookTestFile = "test/cookbook.json" - -func TestCookbookList(t *testing.T) { - setup() - defer teardown() - - file, err := ioutil.ReadFile(cookbookListResponseFile) - if err != nil { - t.Error(err) - } - - mux.HandleFunc("/cookbooks", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, string(file)) - }) - - data, err := client.Cookbooks.List() - if err != nil { - t.Error(err) - } - - if data == nil { - t.Fatal("WTF we should have some data") - } - fmt.Println(data) - - _, err = client.Cookbooks.ListAvailableVersions("3") - if err != nil { - t.Error(err) - } - - _, err = client.Cookbooks.ListAvailableVersions("0") - if err != nil { - t.Error(err) - } -} - -func TestCookbookListAvailableVersions_0(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/cookbooks", func(w http.ResponseWriter, r *http.Request) { - http.Error(w, "BAD FUCKING REQUEST", 503) - }) - - _, err := client.Cookbooks.ListAvailableVersions("2") - if err == nil { - t.Error("We expected this bad request to error", err) - } -} - -func TestCookBookDelete(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/cookbooks/good", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, "") - }) - mux.HandleFunc("/cookbooks/bad", func(w http.ResponseWriter, r *http.Request) { - http.Error(w, "Not Found", 404) - }) - - err := client.Cookbooks.Delete("bad", "1.1.1") - if err == nil { - t.Error("We expected this bad request to error", err) - } - - err = client.Cookbooks.Delete("good", "1.1.1") - if err != nil { - t.Error(err) - } -} - -func TestCookBookGet(t *testing.T) { - setup() - defer teardown() - - cookbookVerionJSON := `{"url": "http://localhost:4000/cookbooks/apache2/5.1.0", "version": "5.1.0"}` - mux.HandleFunc("/cookbooks/good", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, cookbookVerionJSON) - }) - mux.HandleFunc("/cookbooks/bad", func(w http.ResponseWriter, r *http.Request) { - http.Error(w, "Not Found", 404) - }) - - data, err := client.Cookbooks.Get("good") - if err != nil { - t.Error(err) - } - - if data.Version != "5.1.0" { - t.Errorf("We expected '5.1.0' and got '%s'\n", data.Version) - } - - _, err = client.Cookbooks.Get("bad") - if err == nil { - t.Error("We expected this bad request to error", err) - } -} - -func TestCookBookGetAvailableVersions(t *testing.T) { - setup() - defer teardown() - - cookbookVerionsJSON := ` - { "apache2": { - "url": "http://localhost:4000/cookbooks/apache2", - "versions": [ - {"url": "http://localhost:4000/cookbooks/apache2/5.1.0", - "version": "5.1.0"}, - {"url": "http://localhost:4000/cookbooks/apache2/4.2.0", - "version": "4.2.0"} - ] - }}` - - mux.HandleFunc("/cookbooks/good", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, cookbookVerionsJSON) - }) - mux.HandleFunc("/cookbooks/bad", func(w http.ResponseWriter, r *http.Request) { - http.Error(w, "Not Found", 404) - }) - - data, err := client.Cookbooks.GetAvailableVersions("good", "3") - if err != nil { - t.Error(err) - } - fmt.Println(data) - -} diff --git a/vendor/github.com/go-chef/chef/databag_test.go b/vendor/github.com/go-chef/chef/databag_test.go deleted file mode 100644 index 5ea7514616..0000000000 --- a/vendor/github.com/go-chef/chef/databag_test.go +++ /dev/null @@ -1,164 +0,0 @@ -package chef - -import ( - "fmt" - "net/http" - "reflect" - "testing" -) - -func TestDataBagsService_List(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/data", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{"bag1":"http://localhost/data/bag1", "bag2":"http://localhost/data/bag2"}`) - }) - - databags, err := client.DataBags.List() - if err != nil { - t.Errorf("DataBags.List returned error: %v", err) - } - - want := &DataBagListResult{"bag1": "http://localhost/data/bag1", "bag2": "http://localhost/data/bag2"} - if !reflect.DeepEqual(databags, want) { - t.Errorf("DataBags.List returned %+v, want %+v", databags, want) - } -} - -func TestDataBagsService_Create(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/data", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{"uri": "http://localhost/data/newdatabag"}`) - }) - - databag := &DataBag{Name: "newdatabag"} - response, err := client.DataBags.Create(databag) - if err != nil { - t.Errorf("DataBags.Create returned error: %v", err) - } - - want := &DataBagCreateResult{URI: "http://localhost/data/newdatabag"} - if !reflect.DeepEqual(response, want) { - t.Errorf("DataBags.Create returned %+v, want %+v", response, want) - } -} - -func TestDataBagsService_Delete(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/data/databag", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{"name": "databag", "json_class": "Chef::DataBag", "chef_type": "data_bag"}`) - }) - - response, err := client.DataBags.Delete("databag") - if err != nil { - t.Errorf("DataBags.Delete returned error: %v", err) - } - - want := &DataBag{ - Name: "databag", - JsonClass: "Chef::DataBag", - ChefType: "data_bag", - } - - if !reflect.DeepEqual(response, want) { - t.Errorf("DataBags.Delete returned %+v, want %+v", response, want) - } -} - -func TestDataBagsService_ListItems(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/data/bag1", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{"item1":"http://localhost/data/bag1/item1", "item2":"http://localhost/data/bag1/item2"}`) - }) - - databags, err := client.DataBags.ListItems("bag1") - if err != nil { - t.Errorf("DataBags.ListItems returned error: %v", err) - } - - want := &DataBagListResult{"item1": "http://localhost/data/bag1/item1", "item2": "http://localhost/data/bag1/item2"} - if !reflect.DeepEqual(databags, want) { - t.Errorf("DataBags.ListItems returned %+v, want %+v", databags, want) - } -} - -func TestDataBagsService_GetItem(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/data/bag1/item1", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{"id":"item1", "stuff":"things"}`) - }) - - _, err := client.DataBags.GetItem("bag1", "item1") - if err != nil { - t.Errorf("DataBags.GetItem returned error: %v", err) - } -} - -func TestDataBagsService_CreateItem(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/data/bag1", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, ``) - }) - - dbi := map[string]string{ - "id": "item1", - "foo": "test123", - } - - err := client.DataBags.CreateItem("bag1", dbi) - if err != nil { - t.Errorf("DataBags.CreateItem returned error: %v", err) - } -} - -func TestDataBagsService_DeleteItem(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/data/bag1/item1", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, ``) - }) - - err := client.DataBags.DeleteItem("bag1", "item1") - if err != nil { - t.Errorf("DataBags.DeleteItem returned error: %v", err) - } -} - -func TestDataBagsService_UpdateItem(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/data/bag1/item1", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, ``) - }) - - dbi := map[string]string{ - "id": "item1", - "foo": "test123", - } - - err := client.DataBags.UpdateItem("bag1", "item1", dbi) - if err != nil { - t.Errorf("DataBags.UpdateItem returned error: %v", err) - } -} - -func TestDataBagsService_DataBagListResultString(t *testing.T) { - e := &DataBagListResult{"bag1": "http://localhost/data/bag1", "bag2": "http://localhost/data/bag2"} - want := "bag1 => http://localhost/data/bag1\nbag2 => http://localhost/data/bag2\n" - if e.String() != want { - t.Errorf("DataBagListResult.String returned:\n%+v\nwant:\n%+v\n", e.String(), want) - } -} diff --git a/vendor/github.com/go-chef/chef/environment_test.go b/vendor/github.com/go-chef/chef/environment_test.go deleted file mode 100644 index 1bb74705dd..0000000000 --- a/vendor/github.com/go-chef/chef/environment_test.go +++ /dev/null @@ -1,158 +0,0 @@ -package chef - -import ( - "encoding/json" - "fmt" - _ "github.com/davecgh/go-spew/spew" - "io" - "log" - "net/http" - "os" - "reflect" - "testing" -) - -var ( - testEnvironmentJSON = "test/environment.json" -) - -// BUG(fujin): re-do with goconvey -func TestEnvironmentFromJSONDecoder(t *testing.T) { - if file, err := os.Open(testEnvironmentJSON); err != nil { - t.Error("unexpected error", err, "during os.Open on", testEnvironmentJSON) - } else { - dec := json.NewDecoder(file) - var e Environment - if err := dec.Decode(&e); err == io.EOF { - log.Println(e) - } else if err != nil { - log.Fatal(err) - } - } -} - -func TestEnvironmentsService_List(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/environments", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{"_default":"blah", "development":"blah"}`) - }) - - environments, err := client.Environments.List() - if err != nil { - t.Errorf("Environments.List returned error: %v", err) - } - - want := &EnvironmentResult{"_default": "blah", "development": "blah"} - if !reflect.DeepEqual(environments, want) { - //spew.Dump(environments) - //spew.Dump(want) - t.Errorf("Environments.List returned %+v, want %+v", environments, want) - } -} - -func TestEnvironmentsService_Get(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/environments/testenvironment", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{ - "name": "testenvironment", - "json_class": "Chef::Environment", - "chef_type": "environment" - }`) - }) - - environments, err := client.Environments.Get("testenvironment") - if err != nil { - t.Errorf("Environments.Get returned error: %v", err) - } - - want := &Environment{ - Name: "testenvironment", - JsonClass: "Chef::Environment", - ChefType: "environment", - } - - if !reflect.DeepEqual(environments, want) { - t.Errorf("Environments.Get returned %+v, want %+v", environments, want) - } -} - -func TestEnvironmentsService_Create(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/environments", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{ "uri": "http://localhost:4000/environments/dev" }`) - }) - - role := &Environment{ - Name: "dev", - ChefType: "environment", - JsonClass: "Chef::Environment", - Attributes: "", - Description: "", - CookbookVersions: map[string]string{}, - } - - uri, err := client.Environments.Create(role) - if err != nil { - t.Errorf("Environments.Create returned error: %v", err) - } - - want := &EnvironmentResult{"uri": "http://localhost:4000/environments/dev"} - - if !reflect.DeepEqual(uri, want) { - t.Errorf("Environments.Create returned %+v, want %+v", uri, want) - } -} - -func TestEnvironmentsService_Put(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/environments/dev", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{ - "name": "dev", - "json_class": "Chef::Environment", - "description": "The Dev Environment", - "cookbook_versions": {}, - "chef_type": "environment" - }`) - }) - - environment := &Environment{ - Name: "dev", - ChefType: "environment", - JsonClass: "Chef::Environment", - Description: "The Dev Environment", - CookbookVersions: map[string]string{}, - } - - updatedEnvironment, err := client.Environments.Put(environment) - if err != nil { - t.Errorf("Environments.Put returned error: %v", err) - } - - if !reflect.DeepEqual(updatedEnvironment, environment) { - t.Errorf("Environments.Put returned %+v, want %+v", updatedEnvironment, environment) - } -} - -func TestEnvironmentsService_EnvironmentListResultString(t *testing.T) { - e := &EnvironmentResult{"_default": "https://api.opscode.com/organizations/org_name/environments/_default", "webserver": "https://api.opscode.com/organizations/org_name/environments/webserver"} - want := "_default => https://api.opscode.com/organizations/org_name/environments/_default\nwebserver => https://api.opscode.com/organizations/org_name/environments/webserver\n" - if e.String() != want { - t.Errorf("EnvironmentResult.String returned:\n%+v\nwant:\n%+v\n", e.String(), want) - } -} - -func TestEnvironmentsService_EnvironmentCreateResultString(t *testing.T) { - e := &EnvironmentResult{"uri": "http://localhost:4000/environments/dev"} - want := "uri => http://localhost:4000/environments/dev\n" - if e.String() != want { - t.Errorf("EnvironmentResult.String returned %+v, want %+v", e.String(), want) - } -} diff --git a/vendor/github.com/go-chef/chef/http_test.go b/vendor/github.com/go-chef/chef/http_test.go deleted file mode 100644 index cf9a4395d3..0000000000 --- a/vendor/github.com/go-chef/chef/http_test.go +++ /dev/null @@ -1,571 +0,0 @@ -package chef - -import ( - "bytes" - "crypto/rsa" - "crypto/x509" - "encoding/pem" - "errors" - "fmt" - . "github.com/ctdk/goiardi/chefcrypto" - . "github.com/smartystreets/goconvey/convey" - "io" - "math/big" - "net/http" - "net/http/httptest" - "regexp" - "strconv" - "strings" - "testing" -) - -var ( - testRequiredHeaders = []string{ - "X-Ops-Timestamp", - "X-Ops-UserId", - "X-Ops-Sign", - "X-Ops-Content-Hash", - "X-Ops-Authorization-1", - } - - mux *http.ServeMux - server *httptest.Server - client *Client -) - -const ( - userid = "tester" - requestURL = "http://localhost:80" - // Generated from - // openssl genrsa -out privkey.pem 2048 - // perl -pe 's/\n/\\n/g' privkey.pem - privateKey = ` ------BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEAx12nDxxOwSPHRSJEDz67a0folBqElzlu2oGMiUTS+dqtj3FU -h5lJc1MjcprRVxcDVwhsSSo9948XEkk39IdblUCLohucqNMzOnIcdZn8zblN7Cnp -W03UwRM0iWX1HuwHnGvm6PKeqKGqplyIXYO0qlDWCzC+VaxFTwOUk31MfOHJQn4y -fTrfuE7h3FTElLBu065SFp3dPICIEmWCl9DadnxbnZ8ASxYQ9xG7hmZduDgjNW5l -3x6/EFkpym+//D6AbWDcVJ1ovCsJL3CfH/NZC3ekeJ/aEeLxP/vaCSH1VYC5VsYK -5Qg7SIa6Nth3+RZz1hYOoBJulEzwljznwoZYRQIDAQABAoIBADPQol+qAsnty5er -PTcdHcbXLJp5feZz1dzSeL0gdxja/erfEJIhg9aGUBs0I55X69VN6h7l7K8PsHZf -MzzJhUL4QJJETOYP5iuVhtIF0I+DTr5Hck/5nYcEv83KAvgjbiL4ZE486IF5awnL -2OE9HtJ5KfhEleNcX7MWgiIHGb8G1jCqu/tH0GI8Z4cNgUrXMbczGwfbN/5Wc0zo -Dtpe0Tec/Fd0DLFwRiAuheakPjlVWb7AGMDX4TyzCXfMpS1ul2jk6nGFk77uQozF -PQUawCRp+mVS4qecgq/WqfTZZbBlW2L18/kpafvsxG8kJ7OREtrb0SloZNFHEc2Q -70GbgKECgYEA6c/eOrI3Uour1gKezEBFmFKFH6YS/NZNpcSG5PcoqF6AVJwXg574 -Qy6RatC47e92be2TT1Oyplntj4vkZ3REv81yfz/tuXmtG0AylH7REbxubxAgYmUT -18wUAL4s3TST2AlK4R29KwBadwUAJeOLNW+Rc4xht1galsqQRb4pUzkCgYEA2kj2 -vUhKAB7QFCPST45/5q+AATut8WeHnI+t1UaiZoK41Jre8TwlYqUgcJ16Q0H6KIbJ -jlEZAu0IsJxjQxkD4oJgv8n5PFXdc14HcSQ512FmgCGNwtDY/AT7SQP3kOj0Rydg -N02uuRb/55NJ07Bh+yTQNGA+M5SSnUyaRPIAMW0CgYBgVU7grDDzB60C/g1jZk/G -VKmYwposJjfTxsc1a0gLJvSE59MgXc04EOXFNr4a+oC3Bh2dn4SJ2Z9xd1fh8Bur -UwCLwVE3DBTwl2C/ogiN4C83/1L4d2DXlrPfInvloBYR+rIpUlFweDLNuve2pKvk -llU9YGeaXOiHnGoY8iKgsQKBgQDZKMOHtZYhHoZlsul0ylCGAEz5bRT0V8n7QJlw -12+TSjN1F4n6Npr+00Y9ov1SUh38GXQFiLq4RXZitYKu6wEJZCm6Q8YXd1jzgDUp -IyAEHNsrV7Y/fSSRPKd9kVvGp2r2Kr825aqQasg16zsERbKEdrBHmwPmrsVZhi7n -rlXw1QKBgQDBOyUJKQOgDE2u9EHybhCIbfowyIE22qn9a3WjQgfxFJ+aAL9Bg124 -fJIEzz43fJ91fe5lTOgyMF5TtU5ClAOPGtlWnXU0e5j3L4LjbcqzEbeyxvP3sn1z -dYkX7NdNQ5E6tcJZuJCGq0HxIAQeKPf3x9DRKzMnLply6BEzyuAC4g== ------END RSA PRIVATE KEY----- -` - // Generated from - // openssl rsa -in privkey.pem -pubout -out pubkey.pem - // perl -pe 's/\n/\\n/g' pubkey.pem - publicKey = ` ------BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx12nDxxOwSPHRSJEDz67 -a0folBqElzlu2oGMiUTS+dqtj3FUh5lJc1MjcprRVxcDVwhsSSo9948XEkk39Idb -lUCLohucqNMzOnIcdZn8zblN7CnpW03UwRM0iWX1HuwHnGvm6PKeqKGqplyIXYO0 -qlDWCzC+VaxFTwOUk31MfOHJQn4yfTrfuE7h3FTElLBu065SFp3dPICIEmWCl9Da -dnxbnZ8ASxYQ9xG7hmZduDgjNW5l3x6/EFkpym+//D6AbWDcVJ1ovCsJL3CfH/NZ -C3ekeJ/aEeLxP/vaCSH1VYC5VsYK5Qg7SIa6Nth3+RZz1hYOoBJulEzwljznwoZY -RQIDAQAB ------END PUBLIC KEY----- -` - // Generated from - // openssl dsaparam -out dsaparam.pem 2048 - // openssl gendsa -out privkey.pem dsaparam.pem - // perl -pe 's/\n/\\n/g' privkey.pem - badPrivateKey = ` ------BEGIN DSA PRIVATE KEY----- -MIIDVgIBAAKCAQEApv0SsaKRWyn0IrbI6i547c/gldLQ3vB5xoSuTkVOvmD3HfuE -EVPKMS+XKlhgHOJy677zYNKUOIR78vfDVr1M89w19NSic81UwGGaOkrjQWOkoHaA -BS4046AzYKWqHWQNn9dm7WdQlbMBcBv9u+J6EqlzstPwWVaRdbAzyPtwQZRF5WfC -OcrQr8XpXbKsPh55FzfvFpu4KEKTY+8ynLz9uDNW2iAxj9NtRlUHQNqKQvjQsr/8 -4pVrEBh+CnzNrmPXQIbyxV0y8WukAo3I3ZXK5nsUcJhFoVCRx4aBlp9W96mYZ7OE -dPCkFsoVhUNFo0jlJhMPODR1NXy77c4v1Kh6xwIhAJwFm6CQBOWJxZdGo2luqExE -acUG9Hkr2qd0yccgs2tFAoIBAQCQJCwASD7X9l7nZyZvJpXMe6YreGaP3VbbHCz8 -GHs1P5exOausfJXa9gRLx2qDW0sa1ZyFUDnd2Dt810tgAhY143lufNoV3a4IRHpS -Fm8jjDRMyBQ/BrLBBXgpwiZ9LHBuUSeoRKY0BdyRsULmcq2OaBq9J38NUblWSe2R -NjQ45X6SGgUdHy3CrQtLjCA9l8+VPg3l05IBbXIhVSllP5AUmMG4T9x6M7NHEoSr -c7ewKSJNvc1C8+G66Kfz8xcChKcKC2z1YzvxrlcDHF+BBLw1Ppp+yMBfhQDWIZfe -6tpiKEEyWoyi4GkzQ+vooFIriaaL+Nnggh+iJ7BEUByHBaHnAoIBAFUxSB3bpbbp -Vna0HN6b+svuTCFhYi9AcmI1dcyEFKycUvZjP/X07HvX2yrL8aGxMJgF6RzPob/F -+SZar3u9Fd8DUYLxis6/B5d/ih7GnfPdChrDOJM1nwlferTGHXd1TBDzugpAovCe -JAjXiPsGmcCi9RNyoGib/FgniT7IKA7s3yJAzYSeW3wtLToSNGFJHn+TzFDBuWV4 -KH70bpEV84JIzWo0ejKzgMBQ0Zrjcsm4lGBtzaBqGSvOrlIVFuSWFYUxrSTTxthQ -/JYz4ch8+HsQC/0HBuJ48yALDCVKsWq4Y21LRRJIOC25DfjwEYWWaKNGlDDsJA1m -Y5WF0OX+ABcCIEXhrzI1NddyFwLnfDCQ+sy6HT8/xLKXfaipd2rpn3gL ------END DSA PRIVATE KEY----- -` -) - -// Gave up trying to implement this myself -// nopCloser came from https://groups.google.com/d/msg/golang-nuts/J-Y4LtdGNSw/wDSYbHWIKj0J -// yay for sharing -// nopCloser creates a io.ReadCloser to satisfy the request.Body input -type nopCloser struct { - io.Reader -} - -func (nopCloser) Close() error { return nil } - -func setup() { - mux = http.NewServeMux() - server = httptest.NewServer(mux) - client, _ = NewClient(&Config{ - Name: userid, - Key: privateKey, - BaseURL: server.URL, - }) -} - -func teardown() { - server.Close() -} - -func createServer() *httptest.Server { - return httptest.NewServer(http.HandlerFunc(checkHeader)) -} - -// publicKeyFromString parses an RSA public key from a string -func publicKeyFromString(key []byte) (*rsa.PublicKey, error) { - block, _ := pem.Decode(key) - if block == nil { - return nil, fmt.Errorf("block size invalid for '%s'", string(key)) - } - rsaKey, err := x509.ParsePKIXPublicKey(block.Bytes) - if err != nil { - return nil, err - } - - return rsaKey.(*rsa.PublicKey), nil -} - -func makeAuthConfig() (*AuthConfig, error) { - pk, err := PrivateKeyFromString([]byte(privateKey)) - if err != nil { - return nil, err - } - - ac := &AuthConfig{ - PrivateKey: pk, - ClientName: userid, - } - return ac, nil -} - -func TestAuthConfig(t *testing.T) { - _, err := makeAuthConfig() - if err != nil { - t.Error("Failed to create AuthConfig struct from privatekeys and stuff", err) - } -} - -func TestBase64BlockEncodeNoLimit(t *testing.T) { - ac, _ := makeAuthConfig() - var content string - for _, key := range []string{"header1", "header2", "header3"} { - content += fmt.Sprintf("%s:blahblahblah\n", key) - } - content = strings.TrimSuffix(content, "\n") - - signature, _ := GenerateSignature(ac.PrivateKey, content) - Base64BlockEncode(signature, 0) -} - -func TestSignRequestBadSignature(t *testing.T) { - ac, err := makeAuthConfig() - request, err := http.NewRequest("GET", requestURL, nil) - ac.PrivateKey.PublicKey.N = big.NewInt(23234728432324) - - err = ac.SignRequest(request) - if err == nil { - t.Fatal("failed to generate failed signature") - } -} - -func TestSignRequestNoBody(t *testing.T) { - setup() - defer teardown() - ac, err := makeAuthConfig() - request, err := client.NewRequest("GET", requestURL, nil) - - err = ac.SignRequest(request) - if err != nil { - t.Fatal("failed to generate RequestHeaders") - } - count := 0 - for _, requiredHeader := range testRequiredHeaders { - for header := range request.Header { - if strings.ToLower(requiredHeader) == strings.ToLower(header) { - count++ - break - } - } - } - if count != len(testRequiredHeaders) { - t.Error("apiRequestHeaders didn't return all of testRequiredHeaders") - } -} - -func TestSignRequestBody(t *testing.T) { - ac, err := makeAuthConfig() - if err != nil { - t.Fatal(err) - } - setup() - defer teardown() - - // Gave up trying to implement this myself - // nopCloser came from https://groups.google.com/d/msg/golang-nuts/J-Y4LtdGNSw/wDSYbHWIKj0J - // yay for sharing - requestBody := strings.NewReader("somecoolbodytext") - request, err := client.NewRequest("GET", requestURL, requestBody) - - err = ac.SignRequest(request) - if err != nil { - t.Fatal("failed to generate RequestHeaders") - } - count := 0 - for _, requiredHeader := range testRequiredHeaders { - for header := range request.Header { - if strings.ToLower(requiredHeader) == strings.ToLower(header) { - count++ - break - } - } - } - if count != len(testRequiredHeaders) { - t.Error("apiRequestHeaders didn't return all of testRequiredHeaders") - } -} - -// <3 goiardi -// Test our headers as goiardi would -// https://github.com/ctdk/goiardi/blob/master/authentication/authentication.go -// func checkHeader(user_id string, r *http.Request) string { -func checkHeader(rw http.ResponseWriter, req *http.Request) { - user_id := req.Header.Get("X-OPS-USERID") - // Since we don't have a real client or user to check against, - // we'll just verify that input user = output user - // user, err := actor.GetReqUser(user_id) - // if err != nil { - if user_id != userid { - fmt.Fprintf(rw, "Failed to authenticate as %s", user_id) - } - - contentHash := req.Header.Get("X-OPS-CONTENT-HASH") - if contentHash == "" { - fmt.Fprintf(rw, "no content hash provided") - } - - authTimestamp := req.Header.Get("x-ops-timestamp") - if authTimestamp == "" { - fmt.Fprintf(rw, "no timestamp header provided") - } - // TODO: Will want to implement this later - // else { - // // check the time stamp w/ allowed slew - // tok, terr := checkTimeStamp(authTimestamp, config.Config.TimeSlewDur) - // if !tok { - // return terr - // } - // } - - // Eventually this may be put to some sort of use, but for now just - // make sure that it's there. Presumably eventually it would be used to - // use algorithms other than sha1 for hashing the body, or using a - // different version of the header signing algorithm. - xopssign := req.Header.Get("x-ops-sign") - var apiVer string - var hashChk []string - if xopssign == "" { - fmt.Fprintf(rw, "missing X-Ops-Sign header") - } else { - re := regexp.MustCompile(`version=(\d+\.\d+)`) - shaRe := regexp.MustCompile(`algorithm=(\w+)`) - if verChk := re.FindStringSubmatch(xopssign); verChk != nil { - apiVer = verChk[1] - if apiVer != "1.0" && apiVer != "1.1" { - fmt.Fprintf(rw, "Bad version number '%s' in X-Ops-Header", apiVer) - - } - } else { - fmt.Fprintf(rw, "malformed version in X-Ops-Header") - } - - // if algorithm is missing, it uses sha1. Of course, no other - // hashing algorithm is supported yet... - if hashChk = shaRe.FindStringSubmatch(xopssign); hashChk != nil { - if hashChk[1] != "sha1" { - fmt.Fprintf(rw, "Unsupported hashing algorithm '%s' specified in X-Ops-Header", hashChk[1]) - } - } - } - - signedHeaders, sherr := assembleSignedHeader(req) - if sherr != nil { - fmt.Fprintf(rw, sherr.Error()) - } - - _, err := HeaderDecrypt(publicKey, signedHeaders) - if err != nil { - fmt.Fprintf(rw, "unexpected header decryption error '%s'", err) - } -} - -func TestRequest(t *testing.T) { - ac, err := makeAuthConfig() - server := createServer() - defer server.Close() - setup() - defer teardown() - - request, err := client.NewRequest("GET", server.URL, nil) - - err = ac.SignRequest(request) - if err != nil { - t.Fatal("failed to generate RequestHeaders") - } - - client := &http.Client{} - response, err := client.Do(request) - if err != nil { - t.Error(err) - } - - if response.StatusCode != 200 { - t.Error("Non 200 return code: " + response.Status) - } - - buf := new(bytes.Buffer) - buf.ReadFrom(response.Body) - bodyStr := buf.String() - - if bodyStr != "" { - t.Error(bodyStr) - } - -} - -func TestRequestToEndpoint(t *testing.T) { - ac, err := makeAuthConfig() - server := createServer() - defer server.Close() - - requestBody := strings.NewReader("somecoolbodytext") - request, err := client.NewRequest("GET", server.URL+"/clients", requestBody) - - err = ac.SignRequest(request) - if err != nil { - t.Fatal("failed to generate RequestHeaders") - } - - client := &http.Client{} - response, err := client.Do(request) - if err != nil { - t.Error(err) - } - - if response.StatusCode != 200 { - t.Error("Non 200 return code: " + response.Status) - } - - buf := new(bytes.Buffer) - buf.ReadFrom(response.Body) - bodyStr := buf.String() - - if bodyStr != "" { - t.Error(bodyStr) - } -} - -// More Goiardi <3 -func assembleSignedHeader(r *http.Request) (string, error) { - sHeadStore := make(map[int]string) - authHeader := regexp.MustCompile(`(?i)^X-Ops-Authorization-(\d+)`) - for k := range r.Header { - if c := authHeader.FindStringSubmatch(k); c != nil { - /* Have to put it into a map first, then sort, in case - * the headers don't come out in the right order */ - // skipping this error because we shouldn't even be - // able to get here with something that won't be an - // integer. Famous last words, I'm sure. - i, _ := strconv.Atoi(c[1]) - sHeadStore[i] = r.Header.Get(k) - } - } - if len(sHeadStore) == 0 { - return "", errors.New("no authentication headers found") - } - - sH := make([]string, len(sHeadStore)) - sHlimit := len(sH) - for k, v := range sHeadStore { - if k > sHlimit { - return "", errors.New("malformed authentication headers") - } - sH[k-1] = v - } - signedHeaders := strings.Join(sH, "") - - return signedHeaders, nil -} - -func assembleHeaderToCheck(r *http.Request) string { - - // To validate the signature it seems to be very particular - // Would like to use this loop to generate the content - // But it causes validation to fail.. so we do it explicitly - - // authHeader := regexp.MustCompile(`(?i)^X-Ops-Authorization-(\d+)`) - // acceptEncoding := regexp.MustCompile(`(?i)^Accept-Encoding`) - // userAgent := regexp.MustCompile(`(?i)^User-Agent`) - // - // var content string - // for key, value := range r.Header { - // if !authHeader.MatchString(key) && !acceptEncoding.MatchString(key) && !userAgent.MatchString(key) { - // content += fmt.Sprintf("%s:%s\n", key, value) - // } - // } - // return content - var content string - content += fmt.Sprintf("%s:%s\n", "Method", r.Header.Get("Method")) - content += fmt.Sprintf("%s:%s\n", "Hashed Path", r.Header.Get("Hashed Path")) - content += fmt.Sprintf("%s:%s\n", "Accept", r.Header.Get("Accept")) - content += fmt.Sprintf("%s:%s\n", "X-Chef-Version", r.Header.Get("X-Chef-Version")) - content += fmt.Sprintf("%s:%s\n", "X-Ops-Timestamp", r.Header.Get("X-Ops-Timestamp")) - content += fmt.Sprintf("%s:%s\n", "X-Ops-Userid", r.Header.Get("X-Ops-Userid")) - content += fmt.Sprintf("%s:%s\n", "X-Ops-Sign", r.Header.Get("X-Ops-Sign")) - content += fmt.Sprintf("%s:%s\n", "X-Ops-Content-Hash", r.Header.Get("X-Ops-Content-Hash")) - return content -} - -func TestGenerateHash(t *testing.T) { - input, output := HashStr("hi"), "witfkXg0JglCjW9RssWvTAveakI=" - - Convey("correctly hashes a given input string", t, func() { - So(input, ShouldEqual, output) - }) -} - -// BUG(fujin): @bradbeam: this doesn't make sense to me. -func TestGenerateSignatureError(t *testing.T) { - ac, _ := makeAuthConfig() - - // BUG(fujin): what about the 'hi' string is not meant to be signable? - sig, err := GenerateSignature(ac.PrivateKey, "hi") - - Convey("sig should be empty?", t, func() { - So(sig, ShouldNotBeEmpty) - }) - - Convey("errors for an unknown reason to fujin", t, func() { - So(err, ShouldBeNil) - }) -} - -func TestRequestError(t *testing.T) { - ac, err := makeAuthConfig() - if err != nil { - t.Fatal(err) - } - - // Gave up trying to implement this myself - // nopCloser came from https://groups.google.com/d/msg/golang-nuts/J-Y4LtdGNSw/wDSYbHWIKj0J - // yay for sharing - requestBody := nopCloser{bytes.NewBufferString("somecoolbodytext")} - request, err := http.NewRequest("GET", requestURL, requestBody) - - err = ac.SignRequest(request) - - // BUG(fujin): This should actually error not bubble nil? - Convey("should not sign a request with missing required information", t, func() { - So(err, ShouldBeNil) - }) -} - -func TestNewClient(t *testing.T) { - cfg := &Config{Name: "testclient", Key: privateKey, SkipSSL: false} - c, err := NewClient(cfg) - if err != nil { - t.Error("Couldn't make a valid client...\n", err) - } - // simple validation on the created client - if c.Auth.ClientName != "testclient" { - t.Error("unexpected client name: ", c.Auth.ClientName) - } - - // Bad PEM should be an error - cfg = &Config{Name: "blah", Key: "not a key", SkipSSL: false} - c, err = NewClient(cfg) - if err == nil { - t.Error("Built a client from a bad key string") - } - - // Not a proper key should be an error - cfg = &Config{Name: "blah", Key: badPrivateKey, SkipSSL: false} - c, err = NewClient(cfg) - if err == nil { - t.Error("Built a client from a bad key string") - } -} - -func TestNewRequest(t *testing.T) { - var err error - server := createServer() - cfg := &Config{Name: "testclient", Key: privateKey, SkipSSL: false} - c, _ := NewClient(cfg) - defer server.Close() - - request, err := c.NewRequest("GET", server.URL, nil) - if err != nil { - t.Error("HRRRM! we tried to make a request but it failed :`( ", err) - } - - resp, err := c.Do(request, nil) - if resp.StatusCode != 200 { - t.Error("Non 200 return code: ", resp.Status) - } - - // This should fail because we've got an invalid URI - _, err = c.NewRequest("GET", "%gh&%ij", nil) - if err == nil { - t.Error("This terrible request thing should fail and it didn't") - } - - // This should fail because there is no TOODLES! method :D - request, err = c.NewRequest("TOODLES!", "", nil) - _, err = c.Do(request, nil) - if err == nil { - t.Error("This terrible request thing should fail and it didn't") - } -} - -func TestDo_badjson(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/hashrocket", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, " pigthrusters => 100% ") - }) - - stupidData := struct{}{} - request, err := client.NewRequest("GET", "hashrocket", nil) - _, err = client.Do(request, &stupidData) - if err == nil { - t.Error(err) - } - -} diff --git a/vendor/github.com/go-chef/chef/node_test.go b/vendor/github.com/go-chef/chef/node_test.go deleted file mode 100644 index f372493e7d..0000000000 --- a/vendor/github.com/go-chef/chef/node_test.go +++ /dev/null @@ -1,122 +0,0 @@ -package chef - -import ( - "encoding/json" - "fmt" - "io" - "log" - "net/http" - "os" - "reflect" - "testing" -) - -var ( - testNodeJSON = "test/node.json" -) - -func TestNodeFromJSONDecoder(t *testing.T) { - if file, err := os.Open(testNodeJSON); err != nil { - t.Error("unexpected error", err, "during os.Open on", testNodeJSON) - } else { - dec := json.NewDecoder(file) - var n Node - if err := dec.Decode(&n); err == io.EOF { - log.Println(n) - } else if err != nil { - log.Fatal(err) - } - } -} - -func TestNode_NewNode(t *testing.T) { - n := NewNode("testnode") - expect := Node{ - Name: "testnode", - Environment: "_default", - ChefType: "node", - JsonClass: "Chef::Node", - } - - if !reflect.DeepEqual(n, expect) { - t.Errorf("NewNode returned %+v, want %+v", n, expect) - } -} - -func TestNodesService_Methods(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/nodes", func(w http.ResponseWriter, r *http.Request) { - switch { - case r.Method == "GET": - fmt.Fprintf(w, `{"node1":"https://chef/nodes/node1", "node2":"https://chef/nodes/node2"}`) - case r.Method == "POST": - fmt.Fprintf(w, `{ "uri": "http://localhost:4545/nodes/node1" }`) - } - }) - - mux.HandleFunc("/nodes/node1", func(w http.ResponseWriter, r *http.Request) { - switch { - case r.Method == "GET" || r.Method == "PUT": - fmt.Fprintf(w, `{ - "name": "node1", - "json_class": "Chef::Node", - "chef_type": "node", - "chef_environment": "development" - }`) - case r.Method == "DELETE": - } - }) - - // Test list - nodes, err := client.Nodes.List() - if err != nil { - t.Errorf("Nodes.List returned error: %v", err) - } - - listWant := map[string]string{"node1": "https://chef/nodes/node1", "node2": "https://chef/nodes/node2"} - - if !reflect.DeepEqual(nodes, listWant) { - t.Errorf("Nodes.List returned %+v, want %+v", nodes, listWant) - } - - // test Get - node, err := client.Nodes.Get("node1") - if err != nil { - t.Errorf("Nodes.Get returned error: %v", err) - } - - wantNode := NewNode("node1") - wantNode.Environment = "development" - if !reflect.DeepEqual(node, wantNode) { - t.Errorf("Nodes.Get returned %+v, want %+v", node, wantNode) - } - - // test Post - res, err := client.Nodes.Post(wantNode) - if err != nil { - t.Errorf("Nodes.Post returned error: %s", err.Error()) - } - - postResult := &NodeResult{"http://localhost:4545/nodes/node1"} - if !reflect.DeepEqual(postResult, res) { - t.Errorf("Nodes.Post returned %+v, want %+v", res, postResult) - } - - // test Put - putRes, err := client.Nodes.Put(node) - if err != nil { - t.Errorf("Nodes.Put returned error", err) - } - - if !reflect.DeepEqual(putRes, node) { - t.Errorf("Nodes.Post returned %+v, want %+v", putRes, node) - } - - // test Delete - err = client.Nodes.Delete(node.Name) - if err != nil { - t.Errorf("Nodes.Delete returned error", err) - } -} diff --git a/vendor/github.com/go-chef/chef/reader_test.go b/vendor/github.com/go-chef/chef/reader_test.go deleted file mode 100644 index 986ed46319..0000000000 --- a/vendor/github.com/go-chef/chef/reader_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package chef - -import ( - "io" - "io/ioutil" - "os" - "testing" -) - -type TestEncoder struct { - Name string - Awesome []string - OtherStuff map[string]string -} - -func TestEncoderJSONReader(t *testing.T) { - f, err := ioutil.TempFile("test/", "reader") - if err != nil { - t.Error(err) - } - - defer f.Close() - defer os.Remove(f.Name()) - - tr := &TestEncoder{ - Name: "Test Reader", - Awesome: []string{"foo", "bar", "baz"}, - OtherStuff: map[string]string{ - "foo": "bar", - "baz": "banana", - }, - } - - // Generate body - body, err := JSONReader(tr) - if err != nil { - t.Error(err) - } - - t.Log(body) - - _, err = io.Copy(f, body) - if err != nil { - t.Error(err) - } -} diff --git a/vendor/github.com/go-chef/chef/role_test.go b/vendor/github.com/go-chef/chef/role_test.go deleted file mode 100644 index 6a3dbf1f7e..0000000000 --- a/vendor/github.com/go-chef/chef/role_test.go +++ /dev/null @@ -1,192 +0,0 @@ -package chef - -import ( - "encoding/json" - "fmt" - "io" - "log" - "net/http" - "os" - "reflect" - "testing" - . "github.com/smartystreets/goconvey/convey" -) - -var ( - testRoleJSON = "test/role.json" - // FML - testRole = &Role{ - Name: "test", - ChefType: "role", - Description: "Test Role", - RunList: []string{"recipe[foo]", "recipe[baz]", "role[banana]"}, - JsonClass: "Chef::Role", - DefaultAttributes: struct{}{}, - OverrideAttributes: struct{}{}, - } -) - -func TestRoleName(t *testing.T) { - // BUG(spheromak): Pull these constructors out into a Convey Decorator - n1 := testRole - name := n1.Name - - Convey("Role name is 'test'", t, func() { - So(name, ShouldEqual, "test") - }) -} - -// BUG(fujin): re-do with goconvey -func TestRoleFromJSONDecoder(t *testing.T) { - if file, err := os.Open(testRoleJSON); err != nil { - t.Error("unexpected error", err, "during os.Open on", testRoleJSON) - } else { - dec := json.NewDecoder(file) - var n Role - if err := dec.Decode(&n); err == io.EOF { - log.Println(n) - } else if err != nil { - log.Fatal(err) - } - } -} - -func TestRolesService_List(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/roles", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{"foo":"http://localhost:4000/roles/foo", "webserver":"http://localhost:4000/roles/webserver"}`) - }) - - roles, err := client.Roles.List() - if err != nil { - t.Errorf("Roles.List returned error: %v", err) - } - - want := &RoleListResult{"foo": "http://localhost:4000/roles/foo", "webserver": "http://localhost:4000/roles/webserver"} - - if !reflect.DeepEqual(roles, want) { - t.Errorf("Roles.List returned %+v, want %+v", roles, want) - } -} - -func TestRolesService_Get(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/roles/webserver", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{ - "name": "webserver", - "chef_type": "role", - "json_class": "Chef::Role", - "default_attributes": "", - "description": "A webserver", - "run_list": [ - "recipe[unicorn]", - "recipe[apache2]" - ], - "override_attributes": "" - } - `) - }) - - role, err := client.Roles.Get("webserver") - if err != nil { - t.Errorf("Roles.Get returned error: %v", err) - } - - want := &Role{ - Name: "webserver", - ChefType: "role", - JsonClass: "Chef::Role", - DefaultAttributes: "", - Description: "A webserver", - RunList: []string{"recipe[unicorn]", "recipe[apache2]"}, - OverrideAttributes: "", - } - - if !reflect.DeepEqual(role, want) { - t.Errorf("Roles.Get returned %+v, want %+v", role, want) - } -} - -func TestRolesService_Create(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/roles", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{ "uri": "http://localhost:4000/roles/webserver" }`) - }) - - role := &Role{ - Name: "webserver", - ChefType: "role", - JsonClass: "Chef::Role", - DefaultAttributes: "", - Description: "A webserver", - RunList: []string{"recipe[unicorn]", "recipe[apache2]"}, - OverrideAttributes: "", - } - - uri, err := client.Roles.Create(role) - if err != nil { - t.Errorf("Roles.Create returned error: %v", err) - } - - want := &RoleCreateResult{"uri": "http://localhost:4000/roles/webserver"} - - if !reflect.DeepEqual(uri, want) { - t.Errorf("Roles.Create returned %+v, want %+v", uri, want) - } -} - -func TestRolesService_Put(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/roles/webserver", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{ - "name": "webserver", - "chef_type": "role", - "json_class": "Chef::Role", - "description": "A webserver", - "run_list": [ - "recipe[apache2]" - ] - }`) - }) - - role := &Role{ - Name: "webserver", - ChefType: "role", - JsonClass: "Chef::Role", - Description: "A webserver", - RunList: []string{"recipe[apache2]"}, - } - - updatedRole, err := client.Roles.Put(role) - if err != nil { - t.Errorf("Roles.Put returned error: %v", err) - } - - if !reflect.DeepEqual(updatedRole, role) { - t.Errorf("Roles.Put returned %+v, want %+v", updatedRole, role) - } -} - -func TestRolesService_RoleListResultString(t *testing.T) { - r := &RoleListResult{"foo": "http://localhost:4000/roles/foo"} - want := "foo => http://localhost:4000/roles/foo\n" - if r.String() != want { - t.Errorf("RoleListResult.String returned %+v, want %+v", r.String(), want) - } -} - -func TestRolesService_RoleCreateResultString(t *testing.T) { - r := &RoleCreateResult{"uri": "http://localhost:4000/roles/webserver"} - want := "uri => http://localhost:4000/roles/webserver\n" - if r.String() != want { - t.Errorf("RoleCreateResult.String returned %+v, want %+v", r.String(), want) - } -} diff --git a/vendor/github.com/go-chef/chef/run_list_test.go b/vendor/github.com/go-chef/chef/run_list_test.go deleted file mode 100644 index fc04ee135e..0000000000 --- a/vendor/github.com/go-chef/chef/run_list_test.go +++ /dev/null @@ -1,28 +0,0 @@ -package chef - -import ( - . "github.com/smartystreets/goconvey/convey" - "testing" -) - -var ( - rl = RunList{"recipe[foo]", "recipe[baz]", "role[banana]"} -) - -func TestNodeRunList(t *testing.T) { - Convey("Node.RunList() should be a RunList", t, func() { - So(rl, ShouldHaveSameTypeAs, RunList{}) - }) - - Convey("Node.RunList() should be populated", t, func() { - So(rl, ShouldContain, "recipe[foo]") - So(rl, ShouldContain, "recipe[baz]") - So(rl, ShouldContain, "role[banana]") - }) - - rl = RunList{} - Convey("Empty RunList should be valid", t, func() { - So(rl, ShouldBeEmpty) - }) - -} diff --git a/vendor/github.com/go-chef/chef/sandbox_test.go b/vendor/github.com/go-chef/chef/sandbox_test.go deleted file mode 100644 index 8af59da3bb..0000000000 --- a/vendor/github.com/go-chef/chef/sandbox_test.go +++ /dev/null @@ -1,96 +0,0 @@ -package chef - -import ( - "crypto/md5" - "crypto/rand" - "fmt" - "net/http" - _ "reflect" - "testing" - . "github.com/smartystreets/goconvey/convey" -) - -// generate random data for sandbox -func random_data(size int) (b []byte) { - b = make([]byte, size) - rand.Read(b) - return -} - -// mux.HandleFunc("/sandboxes/f1c560ccb472448e9cfb31ff98134247", func(w http.ResponseWriter, r *http.Request) { }) -func TestSandboxesPost(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/sandboxes", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{ - "sandbox_id": "f1c560ccb472448e9cfb31ff98134247", - "uri": "http://trendy.local:4545/sandboxes/f1c560ccb472448e9cfb31ff98134247", - "Checksums": { - "4bd9946774fff1fb53745c645e447c9d20a14cac410b9eea037299247e70aa1e": { - "url": "http://trendy.local:4545/file_store/4bd9946774fff1fb53745c645e447c9d20a14cac410b9eea037299247e70aa1e", - "needs_upload": true - }, - "548c6928e3f5a800a0e9cc146647a31a2353c42950a611cfca646819cdaa54fa": { - "url": "http://trendy.local:4545/file_store/548c6928e3f5a800a0e9cc146647a31a2353c42950a611cfca646819cdaa54fa", - "needs_upload": true - }}}`) - }) - - // create junk files and sums - files := make(map[string][]byte) - // slice of strings for holding our hashes - sums := make([]string, 10) - for i := 0; i <= 10; i++ { - data := random_data(1024) - hashstr := fmt.Sprintf("%x", md5.Sum(data)) - files[hashstr] = data - sums = append(sums, hashstr) - } - - // post the new sums/files to the sandbox - _, err := client.Sandboxes.Post(sums) - if err != nil { - t.Errorf("Snadbox Post error making request: ", err) - } -} - -func TestSandboxesPut(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/sandboxes/f1c560ccb472448e9cfb31ff98134247", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{ - "guid": "123", - "name": "123", - "CreateionTime": "2014-08-23 18:13:37", - "is_completed": true, - "uri": "https://127.0.0.1/sandboxes/f1c560ccb472448e9cfb31ff98134247", - "checksums": [ - "3124216defe5849089a577ffefb0bb05", - "e06ddfa07ca97c80c368d08e189b928a", - "eb65444f8adeb11c56cf0df201a07cb4" - ] - }`) - }) - - sandbox, err := client.Sandboxes.Put("f1c560ccb472448e9cfb31ff98134247") - if err != nil { - t.Errorf("Snadbox Put error making request: ", err) - } - - expected := Sandbox{ - ID: "123", - Name: "123", - Completed: true, - Checksums: []string{ - "3124216defe5849089a577ffefb0bb05", - "e06ddfa07ca97c80c368d08e189b928a", - "eb65444f8adeb11c56cf0df201a07cb4", - }, - } - - Convey("Sandbox Equality", t, func() { - So(sandbox, ShouldResemble, expected) - }) -} diff --git a/vendor/github.com/go-chef/chef/search_test.go b/vendor/github.com/go-chef/chef/search_test.go deleted file mode 100644 index 84b2081577..0000000000 --- a/vendor/github.com/go-chef/chef/search_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package chef - -import ( - "fmt" - "net/http" - "reflect" - "testing" -) - -func TestSearch_Get(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/search", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{ - "node": "http://localhost:4000/search/node", - "role": "http://localhost:4000/search/role", - "client": "http://localhost:4000/search/client", - "users": "http://localhost:4000/search/users" - }`) - }) - - indexes, err := client.Search.Indexes() - if err != nil { - t.Errorf("Search.Get returned error: %+v", err) - } - wantedIdx := map[string]string{ - "node": "http://localhost:4000/search/node", - "role": "http://localhost:4000/search/role", - "client": "http://localhost:4000/search/client", - "users": "http://localhost:4000/search/users", - } - if !reflect.DeepEqual(indexes, wantedIdx) { - t.Errorf("Search.Get returned %+v, want %+v", indexes, wantedIdx) - } -} - -func TestSearch_ExecDo(t *testing.T) { - setup() - defer teardown() - - mux.HandleFunc("/search/nodes", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{ - "total": 1, - "start": 0, - "rows": [ - { - "overrides": {"hardware_type": "laptop"}, - "name": "latte", - "chef_type": "node", - "json_class": "Chef::Node", - "attributes": {"hardware_type": "laptop"}, - "run_list": ["recipe[unicorn]"], - "defaults": {} - } - ] - }`) - }) - - // test the fail case - _, err := client.Search.NewQuery("foo", "failsauce") - if err == nil { - t.Errorf("Bad query wasn't caught") - } - - // test the fail case - _, err = client.Search.Exec("foo", "failsauce") - if err == nil { - t.Errorf("Bad query wasn't caught") - } - - // test the positive case - query, err := client.Search.NewQuery("nodes", "name:latte") - if err != nil { - t.Errorf("failed to create query") - } - - // for now we aren't testing the result.. - _, err = query.Do(client) - if err != nil { - t.Errorf("Search.Exec failed", err) - } - - _, err = client.Search.Exec("nodes", "name:latte") - if err != nil { - t.Errorf("Search.Exec failed", err) - } - -} diff --git a/vendor/github.com/go-ini/ini/ini_test.go b/vendor/github.com/go-ini/ini/ini_test.go deleted file mode 100644 index c0b0cc9aee..0000000000 --- a/vendor/github.com/go-ini/ini/ini_test.go +++ /dev/null @@ -1,574 +0,0 @@ -// Copyright 2014 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package ini - -import ( - "bytes" - "fmt" - "strings" - "testing" - "time" - - . "github.com/smartystreets/goconvey/convey" -) - -func Test_Version(t *testing.T) { - Convey("Get version", t, func() { - So(Version(), ShouldEqual, _VERSION) - }) -} - -const _CONF_DATA = ` -; Package name -NAME = ini -; Package version -VERSION = v1 -; Package import path -IMPORT_PATH = gopkg.in/%(NAME)s.%(VERSION)s - -# Information about package author -# Bio can be written in multiple lines. -[author] -NAME = Unknwon ; Succeeding comment -E-MAIL = fake@localhost -GITHUB = https://github.com/%(NAME)s -BIO = """Gopher. -Coding addict. -Good man. -""" # Succeeding comment - -[package] -CLONE_URL = https://%(IMPORT_PATH)s - -[package.sub] -UNUSED_KEY = should be deleted - -[features] --: Support read/write comments of keys and sections --: Support auto-increment of key names --: Support load multiple files to overwrite key values - -[types] -STRING = str -BOOL = true -BOOL_FALSE = false -FLOAT64 = 1.25 -INT = 10 -TIME = 2015-01-01T20:17:05Z -DURATION = 2h45m -UINT = 3 - -[array] -STRINGS = en, zh, de -FLOAT64S = 1.1, 2.2, 3.3 -INTS = 1, 2, 3 -UINTS = 1, 2, 3 -TIMES = 2015-01-01T20:17:05Z,2015-01-01T20:17:05Z,2015-01-01T20:17:05Z - -[note] -empty_lines = next line is empty\ - -; Comment before the section -[comments] ; This is a comment for the section too -; Comment before key -key = "value" -key2 = "value2" ; This is a comment for key2 -key3 = "one", "two", "three" - -[advance] -value with quotes = "some value" -value quote2 again = 'some value' -true = 2+3=5 -"1+1=2" = true -"""6+1=7""" = true -"""` + "`" + `5+5` + "`" + `""" = 10 -` + "`" + `"6+6"` + "`" + ` = 12 -` + "`" + `7-2=4` + "`" + ` = false -ADDRESS = ` + "`" + `404 road, -NotFound, State, 50000` + "`" + ` - -two_lines = how about \ - continuation lines? -lots_of_lines = 1 \ - 2 \ - 3 \ - 4 \ -` - -func Test_Load(t *testing.T) { - Convey("Load from data sources", t, func() { - - Convey("Load with empty data", func() { - So(Empty(), ShouldNotBeNil) - }) - - Convey("Load with multiple data sources", func() { - cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - }) - }) - - Convey("Bad load process", t, func() { - - Convey("Load from invalid data sources", func() { - _, err := Load(_CONF_DATA) - So(err, ShouldNotBeNil) - - f, err := Load("testdata/404.ini") - So(err, ShouldNotBeNil) - So(f, ShouldBeNil) - - _, err = Load(1) - So(err, ShouldNotBeNil) - - _, err = Load([]byte(""), 1) - So(err, ShouldNotBeNil) - }) - - Convey("Load with bad section name", func() { - _, err := Load([]byte("[]")) - So(err, ShouldNotBeNil) - - _, err = Load([]byte("[")) - So(err, ShouldNotBeNil) - }) - - Convey("Load with bad keys", func() { - _, err := Load([]byte(`"""name`)) - So(err, ShouldNotBeNil) - - _, err = Load([]byte(`"""name"""`)) - So(err, ShouldNotBeNil) - - _, err = Load([]byte(`""=1`)) - So(err, ShouldNotBeNil) - - _, err = Load([]byte(`=`)) - So(err, ShouldNotBeNil) - - _, err = Load([]byte(`name`)) - So(err, ShouldNotBeNil) - }) - - Convey("Load with bad values", func() { - _, err := Load([]byte(`name="""Unknwon`)) - So(err, ShouldNotBeNil) - }) - }) -} - -func Test_Values(t *testing.T) { - Convey("Test getting and setting values", t, func() { - cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - Convey("Get values in default section", func() { - sec := cfg.Section("") - So(sec, ShouldNotBeNil) - So(sec.Key("NAME").Value(), ShouldEqual, "ini") - So(sec.Key("NAME").String(), ShouldEqual, "ini") - So(sec.Key("NAME").Validate(func(in string) string { - return in - }), ShouldEqual, "ini") - So(sec.Key("NAME").Comment, ShouldEqual, "; Package name") - So(sec.Key("IMPORT_PATH").String(), ShouldEqual, "gopkg.in/ini.v1") - }) - - Convey("Get values in non-default section", func() { - sec := cfg.Section("author") - So(sec, ShouldNotBeNil) - So(sec.Key("NAME").String(), ShouldEqual, "Unknwon") - So(sec.Key("GITHUB").String(), ShouldEqual, "https://github.com/Unknwon") - - sec = cfg.Section("package") - So(sec, ShouldNotBeNil) - So(sec.Key("CLONE_URL").String(), ShouldEqual, "https://gopkg.in/ini.v1") - }) - - Convey("Get auto-increment key names", func() { - keys := cfg.Section("features").Keys() - for i, k := range keys { - So(k.Name(), ShouldEqual, fmt.Sprintf("#%d", i+1)) - } - }) - - Convey("Get overwrite value", func() { - So(cfg.Section("author").Key("E-MAIL").String(), ShouldEqual, "u@gogs.io") - }) - - Convey("Get sections", func() { - sections := cfg.Sections() - for i, name := range []string{DEFAULT_SECTION, "author", "package", "package.sub", "features", "types", "array", "note", "comments", "advance"} { - So(sections[i].Name(), ShouldEqual, name) - } - }) - - Convey("Get parent section value", func() { - So(cfg.Section("package.sub").Key("CLONE_URL").String(), ShouldEqual, "https://gopkg.in/ini.v1") - So(cfg.Section("package.fake.sub").Key("CLONE_URL").String(), ShouldEqual, "https://gopkg.in/ini.v1") - }) - - Convey("Get multiple line value", func() { - So(cfg.Section("author").Key("BIO").String(), ShouldEqual, "Gopher.\nCoding addict.\nGood man.\n") - }) - - Convey("Get values with type", func() { - sec := cfg.Section("types") - v1, err := sec.Key("BOOL").Bool() - So(err, ShouldBeNil) - So(v1, ShouldBeTrue) - - v1, err = sec.Key("BOOL_FALSE").Bool() - So(err, ShouldBeNil) - So(v1, ShouldBeFalse) - - v2, err := sec.Key("FLOAT64").Float64() - So(err, ShouldBeNil) - So(v2, ShouldEqual, 1.25) - - v3, err := sec.Key("INT").Int() - So(err, ShouldBeNil) - So(v3, ShouldEqual, 10) - - v4, err := sec.Key("INT").Int64() - So(err, ShouldBeNil) - So(v4, ShouldEqual, 10) - - v5, err := sec.Key("UINT").Uint() - So(err, ShouldBeNil) - So(v5, ShouldEqual, 3) - - v6, err := sec.Key("UINT").Uint64() - So(err, ShouldBeNil) - So(v6, ShouldEqual, 3) - - t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") - So(err, ShouldBeNil) - v7, err := sec.Key("TIME").Time() - So(err, ShouldBeNil) - So(v7.String(), ShouldEqual, t.String()) - - Convey("Must get values with type", func() { - So(sec.Key("STRING").MustString("404"), ShouldEqual, "str") - So(sec.Key("BOOL").MustBool(), ShouldBeTrue) - So(sec.Key("FLOAT64").MustFloat64(), ShouldEqual, 1.25) - So(sec.Key("INT").MustInt(), ShouldEqual, 10) - So(sec.Key("INT").MustInt64(), ShouldEqual, 10) - So(sec.Key("UINT").MustUint(), ShouldEqual, 3) - So(sec.Key("UINT").MustUint64(), ShouldEqual, 3) - So(sec.Key("TIME").MustTime().String(), ShouldEqual, t.String()) - - dur, err := time.ParseDuration("2h45m") - So(err, ShouldBeNil) - So(sec.Key("DURATION").MustDuration().Seconds(), ShouldEqual, dur.Seconds()) - - Convey("Must get values with default value", func() { - So(sec.Key("STRING_404").MustString("404"), ShouldEqual, "404") - So(sec.Key("BOOL_404").MustBool(true), ShouldBeTrue) - So(sec.Key("FLOAT64_404").MustFloat64(2.5), ShouldEqual, 2.5) - So(sec.Key("INT_404").MustInt(15), ShouldEqual, 15) - So(sec.Key("INT_404").MustInt64(15), ShouldEqual, 15) - So(sec.Key("UINT_404").MustUint(6), ShouldEqual, 6) - So(sec.Key("UINT_404").MustUint64(6), ShouldEqual, 6) - - t, err := time.Parse(time.RFC3339, "2014-01-01T20:17:05Z") - So(err, ShouldBeNil) - So(sec.Key("TIME_404").MustTime(t).String(), ShouldEqual, t.String()) - - So(sec.Key("DURATION_404").MustDuration(dur).Seconds(), ShouldEqual, dur.Seconds()) - }) - }) - }) - - Convey("Get value with candidates", func() { - sec := cfg.Section("types") - So(sec.Key("STRING").In("", []string{"str", "arr", "types"}), ShouldEqual, "str") - So(sec.Key("FLOAT64").InFloat64(0, []float64{1.25, 2.5, 3.75}), ShouldEqual, 1.25) - So(sec.Key("INT").InInt(0, []int{10, 20, 30}), ShouldEqual, 10) - So(sec.Key("INT").InInt64(0, []int64{10, 20, 30}), ShouldEqual, 10) - So(sec.Key("UINT").InUint(0, []uint{3, 6, 9}), ShouldEqual, 3) - So(sec.Key("UINT").InUint64(0, []uint64{3, 6, 9}), ShouldEqual, 3) - - zt, err := time.Parse(time.RFC3339, "0001-01-01T01:00:00Z") - So(err, ShouldBeNil) - t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") - So(err, ShouldBeNil) - So(sec.Key("TIME").InTime(zt, []time.Time{t, time.Now(), time.Now().Add(1 * time.Second)}).String(), ShouldEqual, t.String()) - - Convey("Get value with candidates and default value", func() { - So(sec.Key("STRING_404").In("str", []string{"str", "arr", "types"}), ShouldEqual, "str") - So(sec.Key("FLOAT64_404").InFloat64(1.25, []float64{1.25, 2.5, 3.75}), ShouldEqual, 1.25) - So(sec.Key("INT_404").InInt(10, []int{10, 20, 30}), ShouldEqual, 10) - So(sec.Key("INT64_404").InInt64(10, []int64{10, 20, 30}), ShouldEqual, 10) - So(sec.Key("UINT_404").InUint(3, []uint{3, 6, 9}), ShouldEqual, 3) - So(sec.Key("UINT_404").InUint64(3, []uint64{3, 6, 9}), ShouldEqual, 3) - So(sec.Key("TIME_404").InTime(t, []time.Time{time.Now(), time.Now(), time.Now().Add(1 * time.Second)}).String(), ShouldEqual, t.String()) - }) - }) - - Convey("Get values in range", func() { - sec := cfg.Section("types") - So(sec.Key("FLOAT64").RangeFloat64(0, 1, 2), ShouldEqual, 1.25) - So(sec.Key("INT").RangeInt(0, 10, 20), ShouldEqual, 10) - So(sec.Key("INT").RangeInt64(0, 10, 20), ShouldEqual, 10) - - minT, err := time.Parse(time.RFC3339, "0001-01-01T01:00:00Z") - So(err, ShouldBeNil) - midT, err := time.Parse(time.RFC3339, "2013-01-01T01:00:00Z") - So(err, ShouldBeNil) - maxT, err := time.Parse(time.RFC3339, "9999-01-01T01:00:00Z") - So(err, ShouldBeNil) - t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") - So(err, ShouldBeNil) - So(sec.Key("TIME").RangeTime(t, minT, maxT).String(), ShouldEqual, t.String()) - - Convey("Get value in range with default value", func() { - So(sec.Key("FLOAT64").RangeFloat64(5, 0, 1), ShouldEqual, 5) - So(sec.Key("INT").RangeInt(7, 0, 5), ShouldEqual, 7) - So(sec.Key("INT").RangeInt64(7, 0, 5), ShouldEqual, 7) - So(sec.Key("TIME").RangeTime(t, minT, midT).String(), ShouldEqual, t.String()) - }) - }) - - Convey("Get values into slice", func() { - sec := cfg.Section("array") - So(strings.Join(sec.Key("STRINGS").Strings(","), ","), ShouldEqual, "en,zh,de") - So(len(sec.Key("STRINGS_404").Strings(",")), ShouldEqual, 0) - - vals1 := sec.Key("FLOAT64S").Float64s(",") - for i, v := range []float64{1.1, 2.2, 3.3} { - So(vals1[i], ShouldEqual, v) - } - - vals2 := sec.Key("INTS").Ints(",") - for i, v := range []int{1, 2, 3} { - So(vals2[i], ShouldEqual, v) - } - - vals3 := sec.Key("INTS").Int64s(",") - for i, v := range []int64{1, 2, 3} { - So(vals3[i], ShouldEqual, v) - } - - vals4 := sec.Key("UINTS").Uints(",") - for i, v := range []uint{1, 2, 3} { - So(vals4[i], ShouldEqual, v) - } - - vals5 := sec.Key("UINTS").Uint64s(",") - for i, v := range []uint64{1, 2, 3} { - So(vals5[i], ShouldEqual, v) - } - - t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") - So(err, ShouldBeNil) - vals6 := sec.Key("TIMES").Times(",") - for i, v := range []time.Time{t, t, t} { - So(vals6[i].String(), ShouldEqual, v.String()) - } - }) - - Convey("Get key hash", func() { - cfg.Section("").KeysHash() - }) - - Convey("Set key value", func() { - k := cfg.Section("author").Key("NAME") - k.SetValue("无闻") - So(k.String(), ShouldEqual, "无闻") - }) - - Convey("Get key strings", func() { - So(strings.Join(cfg.Section("types").KeyStrings(), ","), ShouldEqual, "STRING,BOOL,BOOL_FALSE,FLOAT64,INT,TIME,DURATION,UINT") - }) - - Convey("Delete a key", func() { - cfg.Section("package.sub").DeleteKey("UNUSED_KEY") - _, err := cfg.Section("package.sub").GetKey("UNUSED_KEY") - So(err, ShouldNotBeNil) - }) - - Convey("Has Key (backwards compatible)", func() { - sec := cfg.Section("package.sub") - haskey1 := sec.Haskey("UNUSED_KEY") - haskey2 := sec.Haskey("CLONE_URL") - haskey3 := sec.Haskey("CLONE_URL_NO") - So(haskey1, ShouldBeTrue) - So(haskey2, ShouldBeTrue) - So(haskey3, ShouldBeFalse) - }) - - Convey("Has Key", func() { - sec := cfg.Section("package.sub") - haskey1 := sec.HasKey("UNUSED_KEY") - haskey2 := sec.HasKey("CLONE_URL") - haskey3 := sec.HasKey("CLONE_URL_NO") - So(haskey1, ShouldBeTrue) - So(haskey2, ShouldBeTrue) - So(haskey3, ShouldBeFalse) - }) - - Convey("Has Value", func() { - sec := cfg.Section("author") - hasvalue1 := sec.HasValue("Unknwon") - hasvalue2 := sec.HasValue("doc") - So(hasvalue1, ShouldBeTrue) - So(hasvalue2, ShouldBeFalse) - }) - - Convey("Get section strings", func() { - So(strings.Join(cfg.SectionStrings(), ","), ShouldEqual, "DEFAULT,author,package,package.sub,features,types,array,note,comments,advance") - }) - - Convey("Delete a section", func() { - cfg.DeleteSection("") - So(cfg.SectionStrings()[0], ShouldNotEqual, DEFAULT_SECTION) - }) - - Convey("Create new sections", func() { - cfg.NewSections("test", "test2") - _, err := cfg.GetSection("test") - So(err, ShouldBeNil) - _, err = cfg.GetSection("test2") - So(err, ShouldBeNil) - }) - }) - - Convey("Test getting and setting bad values", t, func() { - cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - Convey("Create new key with empty name", func() { - k, err := cfg.Section("").NewKey("", "") - So(err, ShouldNotBeNil) - So(k, ShouldBeNil) - }) - - Convey("Create new section with empty name", func() { - s, err := cfg.NewSection("") - So(err, ShouldNotBeNil) - So(s, ShouldBeNil) - }) - - Convey("Create new sections with empty name", func() { - So(cfg.NewSections(""), ShouldNotBeNil) - }) - - Convey("Get section that not exists", func() { - s, err := cfg.GetSection("404") - So(err, ShouldNotBeNil) - So(s, ShouldBeNil) - - s = cfg.Section("404") - So(s, ShouldNotBeNil) - }) - }) - - Convey("Test key hash clone", t, func() { - cfg, err := Load([]byte(strings.Replace("network=tcp,addr=127.0.0.1:6379,db=4,pool_size=100,idle_timeout=180", ",", "\n", -1))) - So(err, ShouldBeNil) - for _, v := range cfg.Section("").KeysHash() { - So(len(v), ShouldBeGreaterThan, 0) - } - }) - - Convey("Key has empty value", t, func() { - _conf := `key1= -key2= ; comment` - cfg, err := Load([]byte(_conf)) - So(err, ShouldBeNil) - So(cfg.Section("").Key("key1").Value(), ShouldBeEmpty) - }) -} - -func Test_File_Append(t *testing.T) { - Convey("Append data sources", t, func() { - cfg, err := Load([]byte("")) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - So(cfg.Append([]byte(""), []byte("")), ShouldBeNil) - - Convey("Append bad data sources", func() { - So(cfg.Append(1), ShouldNotBeNil) - So(cfg.Append([]byte(""), 1), ShouldNotBeNil) - }) - }) -} - -func Test_File_WriteTo(t *testing.T) { - Convey("Write to somewhere", t, func() { - var buf bytes.Buffer - cfg := Empty() - cfg.WriteTo(&buf) - }) -} - -func Test_File_SaveTo(t *testing.T) { - Convey("Save file", t, func() { - cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - cfg.Section("").Key("NAME").Comment = "Package name" - cfg.Section("author").Comment = `Information about package author -# Bio can be written in multiple lines.` - cfg.Section("advanced").Key("val w/ pound").SetValue("my#password") - So(cfg.SaveTo("testdata/conf_out.ini"), ShouldBeNil) - - cfg.Section("author").Key("NAME").Comment = "This is author name" - So(cfg.SaveToIndent("testdata/conf_out.ini", "\t"), ShouldBeNil) - }) -} - -func Benchmark_Key_Value(b *testing.B) { - c, _ := Load([]byte(_CONF_DATA)) - for i := 0; i < b.N; i++ { - c.Section("").Key("NAME").Value() - } -} - -func Benchmark_Key_String(b *testing.B) { - c, _ := Load([]byte(_CONF_DATA)) - for i := 0; i < b.N; i++ { - c.Section("").Key("NAME").String() - } -} - -func Benchmark_Key_Value_NonBlock(b *testing.B) { - c, _ := Load([]byte(_CONF_DATA)) - c.BlockMode = false - for i := 0; i < b.N; i++ { - c.Section("").Key("NAME").Value() - } -} - -func Benchmark_Key_String_NonBlock(b *testing.B) { - c, _ := Load([]byte(_CONF_DATA)) - c.BlockMode = false - for i := 0; i < b.N; i++ { - c.Section("").Key("NAME").String() - } -} - -func Benchmark_Key_SetValue(b *testing.B) { - c, _ := Load([]byte(_CONF_DATA)) - for i := 0; i < b.N; i++ { - c.Section("").Key("NAME").SetValue("10") - } -} diff --git a/vendor/github.com/go-ini/ini/struct_test.go b/vendor/github.com/go-ini/ini/struct_test.go deleted file mode 100644 index d865ad78eb..0000000000 --- a/vendor/github.com/go-ini/ini/struct_test.go +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright 2014 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package ini - -import ( - "strings" - "testing" - "time" - - . "github.com/smartystreets/goconvey/convey" -) - -type testNested struct { - Cities []string `delim:"|"` - Visits []time.Time - Note string - Unused int `ini:"-"` -} - -type testEmbeded struct { - GPA float64 -} - -type testStruct struct { - Name string `ini:"NAME"` - Age int - Male bool - Money float64 - Born time.Time - Time time.Duration `ini:"Duration"` - Others testNested - *testEmbeded `ini:"grade"` - Unused int `ini:"-"` - Unsigned uint -} - -const _CONF_DATA_STRUCT = ` -NAME = Unknwon -Age = 21 -Male = true -Money = 1.25 -Born = 1993-10-07T20:17:05Z -Duration = 2h45m -Unsigned = 3 - -[Others] -Cities = HangZhou|Boston -Visits = 1993-10-07T20:17:05Z, 1993-10-07T20:17:05Z -Note = Hello world! - -[grade] -GPA = 2.8 - -[foo.bar] -Here = there -When = then -` - -type unsupport struct { - Byte byte -} - -type unsupport2 struct { - Others struct { - Cities byte - } -} - -type unsupport3 struct { - Cities byte -} - -type unsupport4 struct { - *unsupport3 `ini:"Others"` -} - -type defaultValue struct { - Name string - Age int - Male bool - Money float64 - Born time.Time - Cities []string -} - -type fooBar struct { - Here, When string -} - -const _INVALID_DATA_CONF_STRUCT = ` -Name = -Age = age -Male = 123 -Money = money -Born = nil -Cities = -` - -func Test_Struct(t *testing.T) { - Convey("Map to struct", t, func() { - Convey("Map file to struct", func() { - ts := new(testStruct) - So(MapTo(ts, []byte(_CONF_DATA_STRUCT)), ShouldBeNil) - - So(ts.Name, ShouldEqual, "Unknwon") - So(ts.Age, ShouldEqual, 21) - So(ts.Male, ShouldBeTrue) - So(ts.Money, ShouldEqual, 1.25) - So(ts.Unsigned, ShouldEqual, 3) - - t, err := time.Parse(time.RFC3339, "1993-10-07T20:17:05Z") - So(err, ShouldBeNil) - So(ts.Born.String(), ShouldEqual, t.String()) - - dur, err := time.ParseDuration("2h45m") - So(err, ShouldBeNil) - So(ts.Time.Seconds(), ShouldEqual, dur.Seconds()) - - So(strings.Join(ts.Others.Cities, ","), ShouldEqual, "HangZhou,Boston") - So(ts.Others.Visits[0].String(), ShouldEqual, t.String()) - So(ts.Others.Note, ShouldEqual, "Hello world!") - So(ts.testEmbeded.GPA, ShouldEqual, 2.8) - }) - - Convey("Map section to struct", func() { - foobar := new(fooBar) - f, err := Load([]byte(_CONF_DATA_STRUCT)) - So(err, ShouldBeNil) - - So(f.Section("foo.bar").MapTo(foobar), ShouldBeNil) - So(foobar.Here, ShouldEqual, "there") - So(foobar.When, ShouldEqual, "then") - }) - - Convey("Map to non-pointer struct", func() { - cfg, err := Load([]byte(_CONF_DATA_STRUCT)) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - So(cfg.MapTo(testStruct{}), ShouldNotBeNil) - }) - - Convey("Map to unsupported type", func() { - cfg, err := Load([]byte(_CONF_DATA_STRUCT)) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - cfg.NameMapper = func(raw string) string { - if raw == "Byte" { - return "NAME" - } - return raw - } - So(cfg.MapTo(&unsupport{}), ShouldNotBeNil) - So(cfg.MapTo(&unsupport2{}), ShouldNotBeNil) - So(cfg.MapTo(&unsupport4{}), ShouldNotBeNil) - }) - - Convey("Map from invalid data source", func() { - So(MapTo(&testStruct{}, "hi"), ShouldNotBeNil) - }) - - Convey("Map to wrong types and gain default values", func() { - cfg, err := Load([]byte(_INVALID_DATA_CONF_STRUCT)) - So(err, ShouldBeNil) - - t, err := time.Parse(time.RFC3339, "1993-10-07T20:17:05Z") - So(err, ShouldBeNil) - dv := &defaultValue{"Joe", 10, true, 1.25, t, []string{"HangZhou", "Boston"}} - So(cfg.MapTo(dv), ShouldBeNil) - So(dv.Name, ShouldEqual, "Joe") - So(dv.Age, ShouldEqual, 10) - So(dv.Male, ShouldBeTrue) - So(dv.Money, ShouldEqual, 1.25) - So(dv.Born.String(), ShouldEqual, t.String()) - So(strings.Join(dv.Cities, ","), ShouldEqual, "HangZhou,Boston") - }) - }) - - Convey("Reflect from struct", t, func() { - type Embeded struct { - Dates []time.Time `delim:"|"` - Places []string - None []int - } - type Author struct { - Name string `ini:"NAME"` - Male bool - Age int - GPA float64 - NeverMind string `ini:"-"` - *Embeded `ini:"infos"` - } - a := &Author{"Unknwon", true, 21, 2.8, "", - &Embeded{ - []time.Time{time.Now(), time.Now()}, - []string{"HangZhou", "Boston"}, - []int{}, - }} - cfg := Empty() - So(ReflectFrom(cfg, a), ShouldBeNil) - cfg.SaveTo("testdata/conf_reflect.ini") - - Convey("Reflect from non-point struct", func() { - So(ReflectFrom(cfg, Author{}), ShouldNotBeNil) - }) - }) -} - -type testMapper struct { - PackageName string -} - -func Test_NameGetter(t *testing.T) { - Convey("Test name mappers", t, func() { - So(MapToWithMapper(&testMapper{}, TitleUnderscore, []byte("packag_name=ini")), ShouldBeNil) - - cfg, err := Load([]byte("PACKAGE_NAME=ini")) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - cfg.NameMapper = AllCapsUnderscore - tg := new(testMapper) - So(cfg.MapTo(tg), ShouldBeNil) - So(tg.PackageName, ShouldEqual, "ini") - }) -} diff --git a/vendor/github.com/go-ini/ini/testdata/conf.ini b/vendor/github.com/go-ini/ini/testdata/conf.ini deleted file mode 100644 index 2ed0ac1d3a..0000000000 --- a/vendor/github.com/go-ini/ini/testdata/conf.ini +++ /dev/null @@ -1,2 +0,0 @@ -[author] -E-MAIL = u@gogs.io \ No newline at end of file diff --git a/vendor/github.com/google/go-querystring/LICENSE b/vendor/github.com/google/go-querystring/LICENSE new file mode 100644 index 0000000000..ae121a1e46 --- /dev/null +++ b/vendor/github.com/google/go-querystring/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2013 Google. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/google/go-querystring/query/encode_test.go b/vendor/github.com/google/go-querystring/query/encode_test.go deleted file mode 100644 index e0b2a365ac..0000000000 --- a/vendor/github.com/google/go-querystring/query/encode_test.go +++ /dev/null @@ -1,301 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package query - -import ( - "fmt" - "net/url" - "reflect" - "testing" - "time" -) - -type Nested struct { - A SubNested `url:"a"` - B *SubNested `url:"b"` - Ptr *SubNested `url:"ptr,omitempty"` -} - -type SubNested struct { - Value string `url:"value"` -} - -func TestValues_types(t *testing.T) { - str := "string" - strPtr := &str - - tests := []struct { - in interface{} - want url.Values - }{ - { - // basic primitives - struct { - A string - B int - C uint - D float32 - E bool - }{}, - url.Values{ - "A": {""}, - "B": {"0"}, - "C": {"0"}, - "D": {"0"}, - "E": {"false"}, - }, - }, - { - // pointers - struct { - A *string - B *int - C **string - }{A: strPtr, C: &strPtr}, - url.Values{ - "A": {str}, - "B": {""}, - "C": {str}, - }, - }, - { - // slices and arrays - struct { - A []string - B []string `url:",comma"` - C []string `url:",space"` - D [2]string - E [2]string `url:",comma"` - F [2]string `url:",space"` - G []*string `url:",space"` - H []bool `url:",int,space"` - I []string `url:",brackets"` - }{ - A: []string{"a", "b"}, - B: []string{"a", "b"}, - C: []string{"a", "b"}, - D: [2]string{"a", "b"}, - E: [2]string{"a", "b"}, - F: [2]string{"a", "b"}, - G: []*string{&str, &str}, - H: []bool{true, false}, - I: []string{"a", "b"}, - }, - url.Values{ - "A": {"a", "b"}, - "B": {"a,b"}, - "C": {"a b"}, - "D": {"a", "b"}, - "E": {"a,b"}, - "F": {"a b"}, - "G": {"string string"}, - "H": {"1 0"}, - "I[]": {"a", "b"}, - }, - }, - { - // other types - struct { - A time.Time - B time.Time `url:",unix"` - C bool `url:",int"` - D bool `url:",int"` - }{ - A: time.Date(2000, 1, 1, 12, 34, 56, 0, time.UTC), - B: time.Date(2000, 1, 1, 12, 34, 56, 0, time.UTC), - C: true, - D: false, - }, - url.Values{ - "A": {"2000-01-01T12:34:56Z"}, - "B": {"946730096"}, - "C": {"1"}, - "D": {"0"}, - }, - }, - { - struct { - Nest Nested `url:"nest"` - }{ - Nested{ - A: SubNested{ - Value: "that", - }, - }, - }, - url.Values{ - "nest[a][value]": {"that"}, - "nest[b]": {""}, - }, - }, - { - struct { - Nest Nested `url:"nest"` - }{ - Nested{ - Ptr: &SubNested{ - Value: "that", - }, - }, - }, - url.Values{ - "nest[a][value]": {""}, - "nest[b]": {""}, - "nest[ptr][value]": {"that"}, - }, - }, - { - nil, - url.Values{}, - }, - } - - for i, tt := range tests { - v, err := Values(tt.in) - if err != nil { - t.Errorf("%d. Values(%q) returned error: %v", i, tt.in, err) - } - - if !reflect.DeepEqual(tt.want, v) { - t.Errorf("%d. Values(%q) returned %v, want %v", i, tt.in, v, tt.want) - } - } -} - -func TestValues_omitEmpty(t *testing.T) { - str := "" - s := struct { - a string - A string - B string `url:",omitempty"` - C string `url:"-"` - D string `url:"omitempty"` // actually named omitempty, not an option - E *string `url:",omitempty"` - }{E: &str} - - v, err := Values(s) - if err != nil { - t.Errorf("Values(%q) returned error: %v", s, err) - } - - want := url.Values{ - "A": {""}, - "omitempty": {""}, - "E": {""}, // E is included because the pointer is not empty, even though the string being pointed to is - } - if !reflect.DeepEqual(want, v) { - t.Errorf("Values(%q) returned %v, want %v", s, v, want) - } -} - -type A struct { - B -} - -type B struct { - C string -} - -type D struct { - B - C string -} - -func TestValues_embeddedStructs(t *testing.T) { - tests := []struct { - in interface{} - want url.Values - }{ - { - A{B{C: "foo"}}, - url.Values{"C": {"foo"}}, - }, - { - D{B: B{C: "bar"}, C: "foo"}, - url.Values{"C": {"foo", "bar"}}, - }, - } - - for i, tt := range tests { - v, err := Values(tt.in) - if err != nil { - t.Errorf("%d. Values(%q) returned error: %v", i, tt.in, err) - } - - if !reflect.DeepEqual(tt.want, v) { - t.Errorf("%d. Values(%q) returned %v, want %v", i, tt.in, v, tt.want) - } - } -} - -func TestValues_invalidInput(t *testing.T) { - _, err := Values("") - if err == nil { - t.Errorf("expected Values() to return an error on invalid input") - } -} - -type EncodedArgs []string - -func (m EncodedArgs) EncodeValues(key string, v *url.Values) error { - for i, arg := range m { - v.Set(fmt.Sprintf("%s.%d", key, i), arg) - } - return nil -} - -func TestValues_Marshaler(t *testing.T) { - s := struct { - Args EncodedArgs `url:"arg"` - }{[]string{"a", "b", "c"}} - v, err := Values(s) - if err != nil { - t.Errorf("Values(%q) returned error: %v", s, err) - } - - want := url.Values{ - "arg.0": {"a"}, - "arg.1": {"b"}, - "arg.2": {"c"}, - } - if !reflect.DeepEqual(want, v) { - t.Errorf("Values(%q) returned %v, want %v", s, v, want) - } -} - -func TestValues_MarshalerWithNilPointer(t *testing.T) { - s := struct { - Args *EncodedArgs `url:"arg"` - }{} - v, err := Values(s) - if err != nil { - t.Errorf("Values(%q) returned error: %v", s, err) - } - - want := url.Values{} - if !reflect.DeepEqual(want, v) { - t.Errorf("Values(%q) returned %v, want %v", s, v, want) - } -} - -func TestTagParsing(t *testing.T) { - name, opts := parseTag("field,foobar,foo") - if name != "field" { - t.Fatalf("name = %q, want field", name) - } - for _, tt := range []struct { - opt string - want bool - }{ - {"foobar", true}, - {"foo", true}, - {"bar", false}, - {"field", false}, - } { - if opts.Contains(tt.opt) != tt.want { - t.Errorf("Contains(%q) = %v", tt.opt, !tt.want) - } - } -} diff --git a/vendor/github.com/hashicorp/atlas-go/LICENSE b/vendor/github.com/hashicorp/atlas-go/LICENSE new file mode 100644 index 0000000000..82b4de97c7 --- /dev/null +++ b/vendor/github.com/hashicorp/atlas-go/LICENSE @@ -0,0 +1,353 @@ +Mozilla Public License, version 2.0 + +1. Definitions + +1.1. “Contributor” + + means each individual or legal entity that creates, contributes to the + creation of, or owns Covered Software. + +1.2. “Contributor Version” + + means the combination of the Contributions of others (if any) used by a + Contributor and that particular Contributor’s Contribution. + +1.3. “Contribution” + + means Covered Software of a particular Contributor. + +1.4. “Covered Software” + + means Source Code Form to which the initial Contributor has attached the + notice in Exhibit A, the Executable Form of such Source Code Form, and + Modifications of such Source Code Form, in each case including portions + thereof. + +1.5. “Incompatible With Secondary Licenses” + means + + a. that the initial Contributor has attached the notice described in + Exhibit B to the Covered Software; or + + b. that the Covered Software was made available under the terms of version + 1.1 or earlier of the License, but not also under the terms of a + Secondary License. + +1.6. “Executable Form” + + means any form of the work other than Source Code Form. + +1.7. “Larger Work” + + means a work that combines Covered Software with other material, in a separate + file or files, that is not Covered Software. + +1.8. “License” + + means this document. + +1.9. “Licensable” + + means having the right to grant, to the maximum extent possible, whether at the + time of the initial grant or subsequently, any and all of the rights conveyed by + this License. + +1.10. “Modifications” + + means any of the following: + + a. any file in Source Code Form that results from an addition to, deletion + from, or modification of the contents of Covered Software; or + + b. any new file in Source Code Form that contains any Covered Software. + +1.11. “Patent Claims” of a Contributor + + means any patent claim(s), including without limitation, method, process, + and apparatus claims, in any patent Licensable by such Contributor that + would be infringed, but for the grant of the License, by the making, + using, selling, offering for sale, having made, import, or transfer of + either its Contributions or its Contributor Version. + +1.12. “Secondary License” + + means either the GNU General Public License, Version 2.0, the GNU Lesser + General Public License, Version 2.1, the GNU Affero General Public + License, Version 3.0, or any later versions of those licenses. + +1.13. “Source Code Form” + + means the form of the work preferred for making modifications. + +1.14. “You” (or “Your”) + + means an individual or a legal entity exercising rights under this + License. For legal entities, “You” includes any entity that controls, is + controlled by, or is under common control with You. For purposes of this + definition, “control” means (a) the power, direct or indirect, to cause + the direction or management of such entity, whether by contract or + otherwise, or (b) ownership of more than fifty percent (50%) of the + outstanding shares or beneficial ownership of such entity. + + +2. License Grants and Conditions + +2.1. Grants + + Each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + a. under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or as + part of a Larger Work; and + + b. under Patent Claims of such Contributor to make, use, sell, offer for + sale, have made, import, and otherwise transfer either its Contributions + or its Contributor Version. + +2.2. Effective Date + + The licenses granted in Section 2.1 with respect to any Contribution become + effective for each Contribution on the date the Contributor first distributes + such Contribution. + +2.3. Limitations on Grant Scope + + The licenses granted in this Section 2 are the only rights granted under this + License. No additional rights or licenses will be implied from the distribution + or licensing of Covered Software under this License. Notwithstanding Section + 2.1(b) above, no patent license is granted by a Contributor: + + a. for any code that a Contributor has removed from Covered Software; or + + b. for infringements caused by: (i) Your and any other third party’s + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + + c. under Patent Claims infringed by Covered Software in the absence of its + Contributions. + + This License does not grant any rights in the trademarks, service marks, or + logos of any Contributor (except as may be necessary to comply with the + notice requirements in Section 3.4). + +2.4. Subsequent Licenses + + No Contributor makes additional grants as a result of Your choice to + distribute the Covered Software under a subsequent version of this License + (see Section 10.2) or under the terms of a Secondary License (if permitted + under the terms of Section 3.3). + +2.5. Representation + + Each Contributor represents that the Contributor believes its Contributions + are its original creation(s) or it has sufficient rights to grant the + rights to its Contributions conveyed by this License. + +2.6. Fair Use + + This License is not intended to limit any rights You have under applicable + copyright doctrines of fair use, fair dealing, or other equivalents. + +2.7. Conditions + + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in + Section 2.1. + + +3. Responsibilities + +3.1. Distribution of Source Form + + All distribution of Covered Software in Source Code Form, including any + Modifications that You create or to which You contribute, must be under the + terms of this License. You must inform recipients that the Source Code Form + of the Covered Software is governed by the terms of this License, and how + they can obtain a copy of this License. You may not attempt to alter or + restrict the recipients’ rights in the Source Code Form. + +3.2. Distribution of Executable Form + + If You distribute Covered Software in Executable Form then: + + a. such Covered Software must also be made available in Source Code Form, + as described in Section 3.1, and You must inform recipients of the + Executable Form how they can obtain a copy of such Source Code Form by + reasonable means in a timely manner, at a charge no more than the cost + of distribution to the recipient; and + + b. You may distribute such Executable Form under the terms of this License, + or sublicense it under different terms, provided that the license for + the Executable Form does not attempt to limit or alter the recipients’ + rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + + You may create and distribute a Larger Work under terms of Your choice, + provided that You also comply with the requirements of this License for the + Covered Software. If the Larger Work is a combination of Covered Software + with a work governed by one or more Secondary Licenses, and the Covered + Software is not Incompatible With Secondary Licenses, this License permits + You to additionally distribute such Covered Software under the terms of + such Secondary License(s), so that the recipient of the Larger Work may, at + their option, further distribute the Covered Software under the terms of + either this License or such Secondary License(s). + +3.4. Notices + + You may not remove or alter the substance of any license notices (including + copyright notices, patent notices, disclaimers of warranty, or limitations + of liability) contained within the Source Code Form of the Covered + Software, except that You may alter any license notices to the extent + required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + + You may choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of Covered + Software. However, You may do so only on Your own behalf, and not on behalf + of any Contributor. You must make it absolutely clear that any such + warranty, support, indemnity, or liability obligation is offered by You + alone, and You hereby agree to indemnify every Contributor for any + liability incurred by such Contributor as a result of warranty, support, + indemnity or liability terms You offer. You may include additional + disclaimers of warranty and limitations of liability specific to any + jurisdiction. + +4. Inability to Comply Due to Statute or Regulation + + If it is impossible for You to comply with any of the terms of this License + with respect to some or all of the Covered Software due to statute, judicial + order, or regulation then You must: (a) comply with the terms of this License + to the maximum extent possible; and (b) describe the limitations and the code + they affect. Such description must be placed in a text file included with all + distributions of the Covered Software under this License. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Termination + +5.1. The rights granted under this License will terminate automatically if You + fail to comply with any of its terms. However, if You become compliant, + then the rights granted under this License from a particular Contributor + are reinstated (a) provisionally, unless and until such Contributor + explicitly and finally terminates Your grants, and (b) on an ongoing basis, + if such Contributor fails to notify You of the non-compliance by some + reasonable means prior to 60 days after You have come back into compliance. + Moreover, Your grants from a particular Contributor are reinstated on an + ongoing basis if such Contributor notifies You of the non-compliance by + some reasonable means, this is the first time You have received notice of + non-compliance with this License from such Contributor, and You become + compliant prior to 30 days after Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent + infringement claim (excluding declaratory judgment actions, counter-claims, + and cross-claims) alleging that a Contributor Version directly or + indirectly infringes any patent, then the rights granted to You by any and + all Contributors for the Covered Software under Section 2.1 of this License + shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user + license agreements (excluding distributors and resellers) which have been + validly granted by You or Your distributors under this License prior to + termination shall survive termination. + +6. Disclaimer of Warranty + + Covered Software is provided under this License on an “as is” basis, without + warranty of any kind, either expressed, implied, or statutory, including, + without limitation, warranties that the Covered Software is free of defects, + merchantable, fit for a particular purpose or non-infringing. The entire + risk as to the quality and performance of the Covered Software is with You. + Should any Covered Software prove defective in any respect, You (not any + Contributor) assume the cost of any necessary servicing, repair, or + correction. This disclaimer of warranty constitutes an essential part of this + License. No use of any Covered Software is authorized under this License + except under this disclaimer. + +7. Limitation of Liability + + Under no circumstances and under no legal theory, whether tort (including + negligence), contract, or otherwise, shall any Contributor, or anyone who + distributes Covered Software as permitted above, be liable to You for any + direct, indirect, special, incidental, or consequential damages of any + character including, without limitation, damages for lost profits, loss of + goodwill, work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses, even if such party shall have been + informed of the possibility of such damages. This limitation of liability + shall not apply to liability for death or personal injury resulting from such + party’s negligence to the extent applicable law prohibits such limitation. + Some jurisdictions do not allow the exclusion or limitation of incidental or + consequential damages, so this exclusion and limitation may not apply to You. + +8. Litigation + + Any litigation relating to this License may be brought only in the courts of + a jurisdiction where the defendant maintains its principal place of business + and such litigation shall be governed by laws of that jurisdiction, without + reference to its conflict-of-law provisions. Nothing in this Section shall + prevent a party’s ability to bring cross-claims or counter-claims. + +9. Miscellaneous + + This License represents the complete agreement concerning the subject matter + hereof. If any provision of this License is held to be unenforceable, such + provision shall be reformed only to the extent necessary to make it + enforceable. Any law or regulation which provides that the language of a + contract shall be construed against the drafter shall not be used to construe + this License against a Contributor. + + +10. Versions of the License + +10.1. New Versions + + Mozilla Foundation is the license steward. Except as provided in Section + 10.3, no one other than the license steward has the right to modify or + publish new versions of this License. Each version will be given a + distinguishing version number. + +10.2. Effect of New Versions + + You may distribute the Covered Software under the terms of the version of + the License under which You originally received the Covered Software, or + under the terms of any subsequent version published by the license + steward. + +10.3. Modified Versions + + If you create software not governed by this License, and you want to + create a new license for such software, you may create and use a modified + version of this License if you rename the license and remove any + references to the name of the license steward (except to note that such + modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses + If You choose to distribute Source Code Form that is Incompatible With + Secondary Licenses under the terms of this version of the License, the + notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the + terms of the Mozilla Public License, v. + 2.0. If a copy of the MPL was not + distributed with this file, You can + obtain one at + http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular file, then +You may include the notice in a location (such as a LICENSE file in a relevant +directory) where a recipient would be likely to look for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - “Incompatible With Secondary Licenses” Notice + + This Source Code Form is “Incompatible + With Secondary Licenses”, as defined by + the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/hashicorp/atlas-go/archive/archive_test.go b/vendor/github.com/hashicorp/atlas-go/archive/archive_test.go deleted file mode 100644 index 1c8f2bc1f7..0000000000 --- a/vendor/github.com/hashicorp/atlas-go/archive/archive_test.go +++ /dev/null @@ -1,554 +0,0 @@ -package archive - -import ( - "archive/tar" - "bytes" - "compress/gzip" - "io" - "io/ioutil" - "os" - "os/exec" - "path/filepath" - "reflect" - "runtime" - "sort" - "testing" -) - -const fixturesDir = "./test-fixtures" - -var testHasGit bool -var testHasHg bool - -func init() { - if _, err := exec.LookPath("git"); err == nil { - testHasGit = true - } - - if _, err := exec.LookPath("hg"); err == nil { - testHasHg = true - } -} - -func TestArchiveOptsIsSet(t *testing.T) { - cases := []struct { - Opts *ArchiveOpts - Set bool - }{ - { - &ArchiveOpts{}, - false, - }, - { - &ArchiveOpts{VCS: true}, - true, - }, - { - &ArchiveOpts{Exclude: make([]string, 0, 0)}, - false, - }, - { - &ArchiveOpts{Exclude: []string{"foo"}}, - true, - }, - { - &ArchiveOpts{Include: make([]string, 0, 0)}, - false, - }, - { - &ArchiveOpts{Include: []string{"foo"}}, - true, - }, - } - - for i, tc := range cases { - if tc.Opts.IsSet() != tc.Set { - t.Fatalf("%d: expected %#v", i, tc.Set) - } - } -} - -func TestArchive_file(t *testing.T) { - path := filepath.Join(testFixture("archive-file"), "foo.txt") - r, err := CreateArchive(path, new(ArchiveOpts)) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{ - "foo.txt", - } - - entries := testArchive(t, r, false) - if !reflect.DeepEqual(entries, expected) { - t.Fatalf("bad: %#v", entries) - } -} - -func TestArchive_fileCompressed(t *testing.T) { - path := filepath.Join(testFixture("archive-file-compressed"), "file.tar.gz") - r, err := CreateArchive(path, new(ArchiveOpts)) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{ - "./foo.txt", - } - - entries := testArchive(t, r, false) - if !reflect.DeepEqual(entries, expected) { - t.Fatalf("bad: %#v", entries) - } -} - -func TestArchive_fileNoExist(t *testing.T) { - tf := tempFile(t) - if err := os.Remove(tf); err != nil { - t.Fatalf("err: %s", err) - } - - r, err := CreateArchive(tf, nil) - if err == nil { - t.Fatal("err should not be nil") - } - if r != nil { - t.Fatal("should be nil") - } -} - -func TestArchive_fileWithOpts(t *testing.T) { - r, err := CreateArchive(tempFile(t), &ArchiveOpts{VCS: true}) - if err == nil { - t.Fatal("err should not be nil") - } - if r != nil { - t.Fatal("should be nil") - } -} - -func TestArchive_dirExtra(t *testing.T) { - opts := &ArchiveOpts{ - Extra: map[string]string{ - "hello.txt": filepath.Join( - testFixture("archive-subdir"), "subdir", "hello.txt"), - }, - } - - r, err := CreateArchive(testFixture("archive-flat"), opts) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{ - "baz.txt", - "foo.txt", - "hello.txt", - } - - entries := testArchive(t, r, false) - if !reflect.DeepEqual(entries, expected) { - t.Fatalf("bad: %#v", entries) - } -} - -func TestArchive_dirExtraDir(t *testing.T) { - opts := &ArchiveOpts{ - Extra: map[string]string{ - "foo": filepath.Join(testFixture("archive-subdir"), "subdir"), - }, - } - - r, err := CreateArchive(testFixture("archive-flat"), opts) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{ - "baz.txt", - "foo.txt", - "foo/", - "foo/hello.txt", - } - - entries := testArchive(t, r, false) - if !reflect.DeepEqual(entries, expected) { - t.Fatalf("bad: %#v", entries) - } -} - -func TestArchive_dirMode(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("modes don't work on Windows") - } - - opts := &ArchiveOpts{} - - r, err := CreateArchive(testFixture("archive-dir-mode"), opts) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{ - "file.txt-exec", - } - - entries := testArchive(t, r, true) - if !reflect.DeepEqual(entries, expected) { - t.Fatalf("bad: %#v", entries) - } -} -func TestArchive_dirSymlink(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("git symlinks don't work on Windows") - } - - path := filepath.Join(testFixture("archive-symlink"), "link", "link") - r, err := CreateArchive(path, new(ArchiveOpts)) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{ - "foo.txt", - } - - entries := testArchive(t, r, false) - if !reflect.DeepEqual(entries, expected) { - t.Fatalf("bad: %#v", entries) - } -} - -func TestArchive_dirWithSymlink(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("git symlinks don't work on Windows") - } - - path := filepath.Join(testFixture("archive-symlink"), "link") - r, err := CreateArchive(path, new(ArchiveOpts)) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{ - "link/", - "link/foo.txt", - } - - entries := testArchive(t, r, false) - if !reflect.DeepEqual(entries, expected) { - t.Fatalf("bad: %#v", entries) - } -} - -func TestArchive_dirNoVCS(t *testing.T) { - r, err := CreateArchive(testFixture("archive-flat"), new(ArchiveOpts)) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{ - "baz.txt", - "foo.txt", - } - - entries := testArchive(t, r, false) - if !reflect.DeepEqual(entries, expected) { - t.Fatalf("bad: %#v", entries) - } -} - -func TestArchive_dirSubdirsNoVCS(t *testing.T) { - r, err := CreateArchive(testFixture("archive-subdir"), new(ArchiveOpts)) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{ - "bar.txt", - "foo.txt", - "subdir/", - "subdir/hello.txt", - } - - entries := testArchive(t, r, false) - if !reflect.DeepEqual(entries, expected) { - t.Fatalf("bad: %#v", entries) - } -} - -func TestArchive_dirExclude(t *testing.T) { - opts := &ArchiveOpts{ - Exclude: []string{"subdir", "subdir/*"}, - } - - r, err := CreateArchive(testFixture("archive-subdir"), opts) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{ - "bar.txt", - "foo.txt", - } - - entries := testArchive(t, r, false) - if !reflect.DeepEqual(entries, expected) { - t.Fatalf("bad: %#v", entries) - } -} - -func TestArchive_dirInclude(t *testing.T) { - opts := &ArchiveOpts{ - Include: []string{"bar.txt"}, - } - - r, err := CreateArchive(testFixture("archive-subdir"), opts) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{ - "bar.txt", - } - - entries := testArchive(t, r, false) - if !reflect.DeepEqual(entries, expected) { - t.Fatalf("bad: %#v", entries) - } -} - -func TestArchive_dirIncludeStar(t *testing.T) { - opts := &ArchiveOpts{ - Include: []string{"build/**/*"}, - } - - r, err := CreateArchive(testFixture("archive-subdir-splat"), opts) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{ - "build/", - "build/darwin-amd64/", - "build/darwin-amd64/build.txt", - "build/linux-amd64/", - "build/linux-amd64/build.txt", - } - - entries := testArchive(t, r, false) - if !reflect.DeepEqual(entries, expected) { - t.Fatalf("bad: %#v", entries) - } -} - -func TestArchive_git(t *testing.T) { - if !testHasGit { - t.Log("git not found, skipping") - t.Skip() - } - - // Git doesn't allow nested ".git" directories so we do some hackiness - // here to get around that... - testDir := testFixture("archive-git") - oldName := filepath.ToSlash(filepath.Join(testDir, "DOTgit")) - newName := filepath.ToSlash(filepath.Join(testDir, ".git")) - os.Remove(newName) - if err := os.Rename(oldName, newName); err != nil { - t.Fatalf("err: %s", err) - } - defer os.Rename(newName, oldName) - - // testDir with VCS set to true - r, err := CreateArchive(testDir, &ArchiveOpts{VCS: true}) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{ - "bar.txt", - "foo.txt", - "subdir/", - "subdir/hello.txt", - } - - entries := testArchive(t, r, false) - if !reflect.DeepEqual(entries, expected) { - t.Fatalf("bad: %#v", entries) - } - - // Test that metadata was added - if r.Metadata == nil { - t.Fatal("expected archive metadata to be set") - } - - expectedMetadata := map[string]string{ - "branch": "master", - "commit": "7525d17cbbb56f3253a20903ffddc07c6c935c76", - "remote.origin": "https://github.com/hashicorp/origin.git", - "remote.upstream": "https://github.com/hashicorp/upstream.git", - } - - if !reflect.DeepEqual(r.Metadata, expectedMetadata) { - t.Fatalf("expected %+v to be %+v", r.Metadata, expectedMetadata) - } -} - -func TestArchive_gitSubdir(t *testing.T) { - if !testHasGit { - t.Log("git not found, skipping") - t.Skip() - } - - // Git doesn't allow nested ".git" directories so we do some hackiness - // here to get around that... - testDir := testFixture("archive-git") - oldName := filepath.ToSlash(filepath.Join(testDir, "DOTgit")) - newName := filepath.ToSlash(filepath.Join(testDir, ".git")) - os.Remove(newName) - if err := os.Rename(oldName, newName); err != nil { - t.Fatalf("err: %s", err) - } - defer os.Rename(newName, oldName) - - // testDir with VCS set to true - r, err := CreateArchive(filepath.Join(testDir, "subdir"), &ArchiveOpts{VCS: true}) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{ - "hello.txt", - } - - entries := testArchive(t, r, false) - if !reflect.DeepEqual(entries, expected) { - t.Fatalf("bad: %#v", entries) - } -} - -func TestArchive_hg(t *testing.T) { - if !testHasHg { - t.Log("hg not found, skipping") - t.Skip() - } - - // testDir with VCS set to true - testDir := testFixture("archive-hg") - r, err := CreateArchive(testDir, &ArchiveOpts{VCS: true}) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{ - "bar.txt", - "foo.txt", - "subdir/", - "subdir/hello.txt", - } - - entries := testArchive(t, r, false) - if !reflect.DeepEqual(entries, expected) { - t.Fatalf("\n-- Expected --\n%#v\n-- Found --\n%#v", expected, entries) - } -} - -func TestArchive_hgSubdir(t *testing.T) { - if !testHasHg { - t.Log("hg not found, skipping") - t.Skip() - } - - // testDir with VCS set to true - testDir := filepath.Join(testFixture("archive-hg"), "subdir") - r, err := CreateArchive(testDir, &ArchiveOpts{VCS: true}) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{ - "hello.txt", - } - - entries := testArchive(t, r, false) - if !reflect.DeepEqual(entries, expected) { - t.Fatalf("\n-- Expected --\n%#v\n-- Found --\n%#v", expected, entries) - } -} - -func TestReadCloseRemover(t *testing.T) { - f, err := ioutil.TempFile("", "atlas-go") - if err != nil { - t.Fatalf("err: %s", err) - } - - r := &readCloseRemover{F: f} - if err := r.Close(); err != nil { - t.Fatalf("err: %s", err) - } - - if _, err := os.Stat(f.Name()); err == nil { - t.Fatal("file should not exist anymore") - } -} - -func testArchive(t *testing.T, r *Archive, detailed bool) []string { - // Finish the archiving process in-memory - var buf bytes.Buffer - n, err := io.Copy(&buf, r) - if err != nil { - t.Fatalf("err: %s", err) - } - if n != r.Size { - t.Fatalf("bad size: %d (expected: %d)", n, r.Size) - } - - gzipR, err := gzip.NewReader(&buf) - if err != nil { - t.Fatalf("err: %s", err) - } - tarR := tar.NewReader(gzipR) - - // Read all the entries - result := make([]string, 0, 5) - for { - hdr, err := tarR.Next() - if err == io.EOF { - break - } - if err != nil { - t.Fatalf("err: %s", err) - } - - text := hdr.Name - if detailed { - // Check if the file is executable. We use these stub names - // to compensate for umask differences in test environments - // and limitations in using "git clone". - if hdr.FileInfo().Mode()&0111 != 0 { - text = hdr.Name + "-exec" - } else { - text = hdr.Name + "-reg" - } - } - - result = append(result, text) - } - - sort.Strings(result) - return result -} - -func tempFile(t *testing.T) string { - tf, err := ioutil.TempFile("", "test") - if err != nil { - t.Fatalf("err: %s", err) - } - defer tf.Close() - - return tf.Name() -} - -func testFixture(n string) string { - return filepath.Join(fixturesDir, n) -} diff --git a/vendor/github.com/hashicorp/atlas-go/archive/vcs_test.go b/vendor/github.com/hashicorp/atlas-go/archive/vcs_test.go deleted file mode 100644 index b8f88e4988..0000000000 --- a/vendor/github.com/hashicorp/atlas-go/archive/vcs_test.go +++ /dev/null @@ -1,260 +0,0 @@ -package archive - -import ( - "bytes" - "os" - "os/exec" - "path/filepath" - "reflect" - "runtime" - "testing" -) - -func setupGitFixtures(t *testing.T) (string, func()) { - testDir := testFixture("archive-git") - oldName := filepath.Join(testDir, "DOTgit") - newName := filepath.Join(testDir, ".git") - - cleanup := func() { - os.Rename(newName, oldName) - // Windows leaves an empty folder lying around afterward - if runtime.GOOS == "windows" { - os.Remove(newName) - } - } - - // We call this BEFORE and after each setup for tests that make lower-level - // calls like runCommand - cleanup() - - if err := os.Rename(oldName, newName); err != nil { - t.Fatal(err) - } - - return testDir, cleanup -} - -func TestVCSPreflight(t *testing.T) { - if !testHasGit { - t.Skip("git not found") - } - - testDir, cleanup := setupGitFixtures(t) - defer cleanup() - - if err := vcsPreflight(testDir); err != nil { - t.Fatal(err) - } -} - -func TestGitBranch(t *testing.T) { - if !testHasGit { - t.Skip("git not found") - } - - testDir, cleanup := setupGitFixtures(t) - defer cleanup() - - branch, err := gitBranch(testDir) - if err != nil { - t.Fatal(err) - } - - expected := "master" - if branch != expected { - t.Fatalf("expected %q to be %q", branch, expected) - } -} - -func TestGitBranch_detached(t *testing.T) { - if !testHasGit { - t.Skip("git not found") - } - - testDir := testFixture("archive-git") - oldName := filepath.Join(testDir, "DOTgit") - newName := filepath.Join(testDir, ".git") - pwd, err := os.Getwd() - if err != nil { - t.Fatalf("err: %#v", err) - } - - // Copy and then remove the .git dir instead of moving and replacing like - // other tests, since the checkout below is going to write to the reflog and - // the index - runCommand(t, pwd, "cp", "-r", oldName, newName) - defer runCommand(t, pwd, "rm", "-rf", newName) - - runCommand(t, testDir, "git", "checkout", "--detach") - - branch, err := gitBranch(testDir) - if err != nil { - t.Fatal(err) - } - - if branch != "" { - t.Fatalf("expected branch to be empty, but it was: %s", branch) - } -} - -func TestGitCommit(t *testing.T) { - if !testHasGit { - t.Skip("git not found") - } - - testDir, cleanup := setupGitFixtures(t) - defer cleanup() - - commit, err := gitCommit(testDir) - if err != nil { - t.Fatal(err) - } - - expected := "7525d17cbbb56f3253a20903ffddc07c6c935c76" - if commit != expected { - t.Fatalf("expected %q to be %q", commit, expected) - } -} - -func TestGitRemotes(t *testing.T) { - if !testHasGit { - t.Skip("git not found") - } - - testDir, cleanup := setupGitFixtures(t) - defer cleanup() - - remotes, err := gitRemotes(testDir) - if err != nil { - t.Fatal(err) - } - - expected := map[string]string{ - "remote.origin": "https://github.com/hashicorp/origin.git", - "remote.upstream": "https://github.com/hashicorp/upstream.git", - } - - if !reflect.DeepEqual(remotes, expected) { - t.Fatalf("expected %+v to be %+v", remotes, expected) - } -} - -func TestVCSMetadata_git(t *testing.T) { - if !testHasGit { - t.Skip("git not found") - } - - testDir, cleanup := setupGitFixtures(t) - defer cleanup() - - metadata, err := vcsMetadata(testDir) - if err != nil { - t.Fatal(err) - } - - expected := map[string]string{ - "branch": "master", - "commit": "7525d17cbbb56f3253a20903ffddc07c6c935c76", - "remote.origin": "https://github.com/hashicorp/origin.git", - "remote.upstream": "https://github.com/hashicorp/upstream.git", - } - - if !reflect.DeepEqual(metadata, expected) { - t.Fatalf("expected %+v to be %+v", metadata, expected) - } -} - -func TestVCSMetadata_git_detached(t *testing.T) { - if !testHasGit { - t.Skip("git not found") - } - - testDir := testFixture("archive-git") - oldName := filepath.Join(testDir, "DOTgit") - newName := filepath.Join(testDir, ".git") - pwd, err := os.Getwd() - if err != nil { - t.Fatalf("err: %#v", err) - } - - // Copy and then remove the .git dir instead of moving and replacing like - // other tests, since the checkout below is going to write to the reflog and - // the index - runCommand(t, pwd, "cp", "-r", oldName, newName) - defer runCommand(t, pwd, "rm", "-rf", newName) - - runCommand(t, testDir, "git", "checkout", "--detach") - - metadata, err := vcsMetadata(testDir) - if err != nil { - t.Fatal(err) - } - - expected := map[string]string{ - "branch": "", - "commit": "7525d17cbbb56f3253a20903ffddc07c6c935c76", - "remote.origin": "https://github.com/hashicorp/origin.git", - "remote.upstream": "https://github.com/hashicorp/upstream.git", - } - - if !reflect.DeepEqual(metadata, expected) { - t.Fatalf("expected %+v to be %+v", metadata, expected) - } -} - -func TestVCSPathDetect_git(t *testing.T) { - testDir, cleanup := setupGitFixtures(t) - defer cleanup() - - vcs, err := vcsDetect(testDir) - if err != nil { - t.Errorf("VCS detection failed") - } - - if vcs.Name != "git" { - t.Errorf("Expected to find git; found %s", vcs.Name) - } -} - -func TestVCSPathDetect_git_failure(t *testing.T) { - _, err := vcsDetect(testFixture("archive-flat")) - // We expect to get an error because there is no git repo here - if err == nil { - t.Errorf("VCS detection failed") - } -} - -func TestVCSPathDetect_hg(t *testing.T) { - vcs, err := vcsDetect(testFixture("archive-hg")) - if err != nil { - t.Errorf("VCS detection failed") - } - - if vcs.Name != "hg" { - t.Errorf("Expected to find hg; found %s", vcs.Name) - } -} - -func TestVCSPathDetect_hg_absolute(t *testing.T) { - abspath, err := filepath.Abs(testFixture("archive-hg")) - vcs, err := vcsDetect(abspath) - if err != nil { - t.Errorf("VCS detection failed") - } - - if vcs.Name != "hg" { - t.Errorf("Expected to find hg; found %s", vcs.Name) - } -} - -func runCommand(t *testing.T, path, command string, args ...string) { - var stderr, stdout bytes.Buffer - cmd := exec.Command(command, args...) - cmd.Dir = path - cmd.Stdout = &stdout - cmd.Stderr = &stderr - if err := cmd.Run(); err != nil { - t.Fatalf("error running command: %s\nstdout: %s\nstderr: %s", - err, stdout.String(), stderr.String()) - } -} diff --git a/vendor/github.com/hashicorp/atlas-go/v1/application_test.go b/vendor/github.com/hashicorp/atlas-go/v1/application_test.go deleted file mode 100644 index 2144a7032f..0000000000 --- a/vendor/github.com/hashicorp/atlas-go/v1/application_test.go +++ /dev/null @@ -1,118 +0,0 @@ -package atlas - -import ( - "bytes" - "testing" -) - -func TestSlug_returnsSlug(t *testing.T) { - app := &App{ - User: "hashicorp", - Name: "project", - } - - expected := "hashicorp/project" - if app.Slug() != expected { - t.Fatalf("expected %q to be %q", app.Slug(), expected) - } -} - -func TestApp_fetchesApp(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - app, err := client.App("hashicorp", "existing") - if err != nil { - t.Fatal(err) - } - - if app.User != "hashicorp" { - t.Errorf("expected %q to be %q", app.User, "hashicorp") - } - - if app.Name != "existing" { - t.Errorf("expected %q to be %q", app.Name, "existing") - } -} - -func TestApp_returnsErrorNoApp(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - _, err = client.App("hashicorp", "newproject") - if err == nil { - t.Fatal("expected error, but nothing was returned") - } -} - -func TestCreateApp_createsAndReturnsApp(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - app, err := client.CreateApp("hashicorp", "newproject") - if err != nil { - t.Fatal(err) - } - - if app.User != "hashicorp" { - t.Errorf("expected %q to be %q", app.User, "hashicorp") - } - - if app.Name != "newproject" { - t.Errorf("expected %q to be %q", app.Name, "newproject") - } -} - -func TestCreateApp_returnsErrorExistingApp(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - _, err = client.CreateApp("hashicorp", "existing") - if err == nil { - t.Fatal("expected error, but nothing was returned") - } -} - -func TestUploadApp_createsAndReturnsVersion(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - app := &App{ - User: "hashicorp", - Name: "existing", - } - metadata := map[string]interface{}{"testing": true} - data := new(bytes.Buffer) - version, err := client.UploadApp(app, metadata, data, int64(data.Len())) - if err != nil { - t.Fatal(err) - } - if version != 125 { - t.Fatalf("bad: %#v", version) - } -} diff --git a/vendor/github.com/hashicorp/atlas-go/v1/artifact_test.go b/vendor/github.com/hashicorp/atlas-go/v1/artifact_test.go deleted file mode 100644 index fbdf542751..0000000000 --- a/vendor/github.com/hashicorp/atlas-go/v1/artifact_test.go +++ /dev/null @@ -1,167 +0,0 @@ -package atlas - -import ( - "bytes" - "testing" -) - -func TestArtifact_fetchesArtifact(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - art, err := client.Artifact("hashicorp", "existing") - if err != nil { - t.Fatal(err) - } - - if art.User != "hashicorp" { - t.Errorf("expected %q to be %q", art.User, "hashicorp") - } - - if art.Name != "existing" { - t.Errorf("expected %q to be %q", art.Name, "existing") - } -} - -func TestArtifact_returnsErrorNoArtifact(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - _, err = client.App("hashicorp", "newproject") - if err == nil { - t.Fatal("expected error, but nothing was returned") - } -} - -func TestArtifactSearch_fetches(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - vs, err := client.ArtifactSearch(&ArtifactSearchOpts{ - User: "hashicorp", - Name: "existing1", - Type: "amazon-ami", - }) - if err != nil { - t.Fatal(err) - } - - if len(vs) != 1 { - t.Fatalf("bad: %#v", vs) - } -} - -func TestArtifactSearch_metadata(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - vs, err := client.ArtifactSearch(&ArtifactSearchOpts{ - User: "hashicorp", - Name: "existing2", - Type: "amazon-ami", - Metadata: map[string]string{ - "foo": "bar", - "bar": MetadataAnyValue, - }, - }) - if err != nil { - t.Fatal(err) - } - - if len(vs) != 1 { - t.Fatalf("bad: %#v", vs) - } -} - -func TestArtifactFileURL(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - v := &ArtifactVersion{ - User: "foo", - Name: "bar", - Type: "vagrant-box", - File: true, - } - - u, err := client.ArtifactFileURL(v) - if err != nil { - t.Fatal(err) - } - - expected := *server.URL - expected.Path = "/api/v1/artifacts/foo/bar/vagrant-box/file" - if u.String() != expected.String() { - t.Fatalf("unexpected: %s\n\nexpected: %s", u, expected.String()) - } -} - -func TestArtifactFileURL_nil(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - v := &ArtifactVersion{ - User: "foo", - Name: "bar", - Type: "vagrant-box", - } - - u, err := client.ArtifactFileURL(v) - if err != nil { - t.Fatal(err) - } - if u != nil { - t.Fatal("should be nil") - } -} - -func TestUploadArtifact(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - data := new(bytes.Buffer) - _, err = client.UploadArtifact(&UploadArtifactOpts{ - User: "hashicorp", - Name: "existing", - Type: "amazon-ami", - File: data, - }) - if err != nil { - t.Fatal(err) - } -} diff --git a/vendor/github.com/hashicorp/atlas-go/v1/atlas_test.go b/vendor/github.com/hashicorp/atlas-go/v1/atlas_test.go deleted file mode 100644 index e76b7a94ac..0000000000 --- a/vendor/github.com/hashicorp/atlas-go/v1/atlas_test.go +++ /dev/null @@ -1,453 +0,0 @@ -package atlas - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "net" - "net/http" - "net/url" - "path" - "reflect" - "strconv" - "strings" - "testing" -) - -type atlasServer struct { - URL *url.URL - - t *testing.T - ln net.Listener - server http.Server -} - -func newTestAtlasServer(t *testing.T) *atlasServer { - hs := &atlasServer{t: t} - - ln, err := net.Listen("tcp", ":0") - if err != nil { - t.Fatal(err) - } - hs.ln = ln - - hs.URL = &url.URL{ - Scheme: "http", - Host: ln.Addr().String(), - } - - mux := http.NewServeMux() - hs.setupRoutes(mux) - - var server http.Server - server.Handler = mux - hs.server = server - go server.Serve(ln) - - return hs -} - -func (hs *atlasServer) Stop() { - hs.ln.Close() -} - -func (hs *atlasServer) setupRoutes(mux *http.ServeMux) { - mux.HandleFunc("/_json", hs.jsonHandler) - mux.HandleFunc("/_rails-error", hs.railsHandler) - mux.HandleFunc("/_status/", hs.statusHandler) - - mux.HandleFunc("/_binstore/", hs.binstoreHandler) - - mux.HandleFunc("/api/v1/authenticate", hs.authenticationHandler) - mux.HandleFunc("/api/v1/token", hs.tokenHandler) - - mux.HandleFunc("/api/v1/artifacts/hashicorp/existing", hs.vagrantArtifactExistingHandler) - mux.HandleFunc("/api/v1/artifacts/hashicorp/existing/amazon-ami", hs.vagrantArtifactUploadHandler) - mux.HandleFunc("/api/v1/artifacts/hashicorp/existing1/amazon-ami/search", hs.vagrantArtifactSearchHandler1) - mux.HandleFunc("/api/v1/artifacts/hashicorp/existing2/amazon-ami/search", hs.vagrantArtifactSearchHandler2) - - mux.HandleFunc("/api/v1/vagrant/applications", hs.vagrantCreateAppHandler) - mux.HandleFunc("/api/v1/vagrant/applications/", hs.vagrantCreateAppsHandler) - mux.HandleFunc("/api/v1/vagrant/applications/hashicorp/existing", hs.vagrantAppExistingHandler) - mux.HandleFunc("/api/v1/vagrant/applications/hashicorp/existing/versions", hs.vagrantUploadAppHandler) - - mux.HandleFunc("/api/v1/packer/build-configurations", hs.vagrantBCCreateHandler) - mux.HandleFunc("/api/v1/packer/build-configurations/hashicorp/existing", hs.vagrantBCExistingHandler) - mux.HandleFunc("/api/v1/packer/build-configurations/hashicorp/existing/versions", hs.vagrantBCCreateVersionHandler) - - mux.HandleFunc("/api/v1/terraform/configurations/hashicorp/existing/versions/latest", hs.tfConfigLatest) - mux.HandleFunc("/api/v1/terraform/configurations/hashicorp/existing/versions", hs.tfConfigUpload) -} - -func (hs *atlasServer) statusHandler(w http.ResponseWriter, r *http.Request) { - slice := strings.Split(r.URL.Path, "/") - codeStr := slice[len(slice)-1] - - code, err := strconv.ParseInt(codeStr, 10, 32) - if err != nil { - hs.t.Fatal(err) - } - - w.WriteHeader(int(code)) -} - -func (hs *atlasServer) railsHandler(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(422) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, `{"errors": ["this is an error", "this is another error"]}`) -} - -func (hs *atlasServer) jsonHandler(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, `{"ok": true}`) -} - -func (hs *atlasServer) authenticationHandler(w http.ResponseWriter, r *http.Request) { - if err := r.ParseForm(); err != nil { - hs.t.Fatal(err) - } - - login, password := r.Form["user[login]"][0], r.Form["user[password]"][0] - - if login == "sethloves" && password == "bacon" { - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, ` - { - "token": "pX4AQ5vO7T-xJrxsnvlB0cfeF-tGUX-A-280LPxoryhDAbwmox7PKinMgA1F6R3BKaT" - } - `) - } else { - w.WriteHeader(http.StatusUnauthorized) - } -} - -func (hs *atlasServer) tokenHandler(w http.ResponseWriter, r *http.Request) { - if r.Method != "GET" { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - token := r.Header.Get(atlasTokenHeader) - if token == "a.atlasv1.b" { - w.WriteHeader(http.StatusOK) - } else { - w.WriteHeader(http.StatusUnauthorized) - } -} - -func (hs *atlasServer) tfConfigLatest(w http.ResponseWriter, r *http.Request) { - if r.Method != "GET" { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - fmt.Fprintf(w, ` - { - "version": { - "version": 5, - "metadata": { "foo": "bar" }, - "variables": { "foo": "bar" } - } - } - `) -} - -func (hs *atlasServer) tfConfigUpload(w http.ResponseWriter, r *http.Request) { - if r.Method != "POST" { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - var buf bytes.Buffer - if _, err := io.Copy(&buf, r.Body); err != nil { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - if buf.Len() == 0 { - w.WriteHeader(http.StatusConflict) - return - } - - uploadPath := hs.URL.String() + "/_binstore/" - - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, ` - { - "version": 5, - "upload_path": "%s" - } - `, uploadPath) -} - -func (hs *atlasServer) vagrantArtifactExistingHandler(w http.ResponseWriter, r *http.Request) { - if r.Method != "GET" { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - fmt.Fprintf(w, ` - { - "artifact": { - "username": "hashicorp", - "name": "existing", - "tag": "hashicorp/existing" - } - } - `) -} - -func (hs *atlasServer) vagrantArtifactSearchHandler1(w http.ResponseWriter, r *http.Request) { - if r.Method != "GET" { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - fmt.Fprintf(w, ` - { - "versions": [{ - "username": "hashicorp", - "name": "existing", - "tag": "hashicorp/existing" - }] - } - `) -} - -func (hs *atlasServer) vagrantArtifactSearchHandler2(w http.ResponseWriter, r *http.Request) { - if r.Method != "GET" { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - if err := r.ParseForm(); err != nil { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - if r.Form.Get("metadata.1.key") == "" { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - if r.Form.Get("metadata.2.key") == "" { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - fmt.Fprintf(w, ` - { - "versions": [{ - "username": "hashicorp", - "name": "existing", - "tag": "hashicorp/existing" - }] - } - `) -} - -func (hs *atlasServer) vagrantArtifactUploadHandler(w http.ResponseWriter, r *http.Request) { - if r.Method != "POST" { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - var buf bytes.Buffer - if _, err := io.Copy(&buf, r.Body); err != nil { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - if buf.Len() == 0 { - w.WriteHeader(http.StatusConflict) - return - } - - uploadPath := hs.URL.String() + "/_binstore/" - - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, ` - { - "upload_path": "%s" - } - `, uploadPath) -} - -func (hs *atlasServer) vagrantAppExistingHandler(w http.ResponseWriter, r *http.Request) { - if r.Method != "GET" { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - fmt.Fprintf(w, ` - { - "username": "hashicorp", - "name": "existing", - "tag": "hashicorp/existing", - "private": true - } - `) -} - -func (hs *atlasServer) vagrantBCCreateHandler(w http.ResponseWriter, r *http.Request) { - if r.Method != "POST" { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - var wrapper bcWrapper - dec := json.NewDecoder(r.Body) - if err := dec.Decode(&wrapper); err != nil && err != io.EOF { - hs.t.Fatal(err) - } - bc := wrapper.BuildConfig - - if bc.User != "hashicorp" { - w.WriteHeader(http.StatusConflict) - return - } - - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, ` - { - "username":"hashicorp", - "name":"new", - "tag":"hashicorp/new", - "private":true - } - `) -} - -func (hs *atlasServer) vagrantBCCreateVersionHandler(w http.ResponseWriter, r *http.Request) { - if r.Method != "POST" { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - var wrapper bcCreateWrapper - dec := json.NewDecoder(r.Body) - if err := dec.Decode(&wrapper); err != nil && err != io.EOF { - hs.t.Fatal(err) - } - builds := wrapper.Version.Builds - - if len(builds) == 0 { - w.WriteHeader(http.StatusConflict) - return - } - - expected := map[string]interface{}{"testing": true} - if !reflect.DeepEqual(wrapper.Version.Metadata, expected) { - hs.t.Fatalf("expected %q to be %q", wrapper.Version.Metadata, expected) - } - - uploadPath := hs.URL.String() + "/_binstore/" - - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, ` - { - "upload_path": "%s" - } - `, uploadPath) -} - -func (hs *atlasServer) vagrantBCExistingHandler(w http.ResponseWriter, r *http.Request) { - if r.Method != "GET" { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - fmt.Fprintf(w, ` - { - "username": "hashicorp", - "name": "existing" - } - `) -} - -func (hs *atlasServer) vagrantCreateAppHandler(w http.ResponseWriter, r *http.Request) { - if r.Method != "POST" { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - var aw appWrapper - dec := json.NewDecoder(r.Body) - if err := dec.Decode(&aw); err != nil && err != io.EOF { - hs.t.Fatal(err) - } - app := aw.Application - - if app.User == "hashicorp" && app.Name == "existing" { - w.WriteHeader(http.StatusConflict) - } else { - body, err := json.Marshal(app) - if err != nil { - hs.t.Fatal(err) - } - - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, string(body)) - } -} - -func (hs *atlasServer) vagrantCreateAppsHandler(w http.ResponseWriter, r *http.Request) { - if r.Method != "GET" { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - split := strings.Split(r.RequestURI, "/") - parts := split[len(split)-2:] - user, name := parts[0], parts[1] - - if user == "hashicorp" && name == "existing" { - body, err := json.Marshal(&App{ - User: "hashicorp", - Name: "existing", - }) - if err != nil { - hs.t.Fatal(err) - } - - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, string(body)) - } else { - w.WriteHeader(http.StatusNotFound) - } -} - -func (hs *atlasServer) vagrantUploadAppHandler(w http.ResponseWriter, r *http.Request) { - u := *hs.URL - u.Path = path.Join(u.Path, "_binstore/630e42d9-2364-2412-4121-18266770468e") - - var buf bytes.Buffer - if _, err := io.Copy(&buf, r.Body); err != nil { - hs.t.Fatal(err) - } - expected := `{"application":{"metadata":{"testing":true}}}` - if buf.String() != expected { - hs.t.Fatalf("expected metadata to be %q, but was %q", expected, buf.String()) - } - - body, err := json.Marshal(&appVersion{ - UploadPath: u.String(), - Token: "630e42d9-2364-2412-4121-18266770468e", - Version: 125, - }) - if err != nil { - hs.t.Fatal(err) - } - - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, string(body)) -} - -func (hs *atlasServer) binstoreHandler(w http.ResponseWriter, r *http.Request) { - if r.Method != "PUT" { - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - w.WriteHeader(http.StatusOK) -} diff --git a/vendor/github.com/hashicorp/atlas-go/v1/authentication_test.go b/vendor/github.com/hashicorp/atlas-go/v1/authentication_test.go deleted file mode 100644 index f6f40761a2..0000000000 --- a/vendor/github.com/hashicorp/atlas-go/v1/authentication_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package atlas - -import "testing" - -func TestMaskString_emptyString(t *testing.T) { - result := maskString("") - expected := "*** (masked)" - - if result != expected { - t.Errorf("expected %s to be %s", result, expected) - } -} - -func TestMaskString_threeString(t *testing.T) { - result := maskString("123") - expected := "*** (masked)" - - if result != expected { - t.Errorf("expected %s to be %s", result, expected) - } -} - -func TestMaskString_longerString(t *testing.T) { - result := maskString("ABCD1234") - expected := "ABC*** (masked)" - - if result != expected { - t.Errorf("expected %s to be %s", result, expected) - } -} diff --git a/vendor/github.com/hashicorp/atlas-go/v1/build_config_test.go b/vendor/github.com/hashicorp/atlas-go/v1/build_config_test.go deleted file mode 100644 index 54a2affcdd..0000000000 --- a/vendor/github.com/hashicorp/atlas-go/v1/build_config_test.go +++ /dev/null @@ -1,95 +0,0 @@ -package atlas - -import ( - "bytes" - "reflect" - "testing" -) - -func TestBuildConfig_slug(t *testing.T) { - bc := &BuildConfig{User: "sethvargo", Name: "bacon"} - expected := "sethvargo/bacon" - if bc.Slug() != expected { - t.Errorf("expected %q to be %q", bc.Slug(), expected) - } -} - -func TestBuildConfigVersion_slug(t *testing.T) { - bc := &BuildConfigVersion{User: "sethvargo", Name: "bacon"} - expected := "sethvargo/bacon" - if bc.Slug() != expected { - t.Errorf("expected %q to be %q", bc.Slug(), expected) - } -} - -func TestBuildConfig_fetches(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - actual, err := client.BuildConfig("hashicorp", "existing") - if err != nil { - t.Fatal(err) - } - - expected := &BuildConfig{ - User: "hashicorp", - Name: "existing", - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("%#v", actual) - } -} - -func TestCreateBuildConfig(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - user, name := "hashicorp", "new" - bc, err := client.CreateBuildConfig(user, name) - if err != nil { - t.Fatal(err) - } - - if bc.User != user { - t.Errorf("expected %q to be %q", bc.User, user) - } - - if bc.Name != name { - t.Errorf("expected %q to be %q", bc.Name, name) - } -} - -func TestUploadBuildConfigVersion(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - bc := &BuildConfigVersion{ - User: "hashicorp", - Name: "existing", - Builds: []BuildConfigBuild{ - BuildConfigBuild{Name: "foo", Type: "ami"}, - }, - } - metadata := map[string]interface{}{"testing": true} - data := new(bytes.Buffer) - err = client.UploadBuildConfigVersion(bc, metadata, data, int64(data.Len())) - if err != nil { - t.Fatal(err) - } -} diff --git a/vendor/github.com/hashicorp/atlas-go/v1/client_test.go b/vendor/github.com/hashicorp/atlas-go/v1/client_test.go deleted file mode 100644 index c13ee3b50b..0000000000 --- a/vendor/github.com/hashicorp/atlas-go/v1/client_test.go +++ /dev/null @@ -1,268 +0,0 @@ -package atlas - -import ( - "net/url" - "os" - "reflect" - "strings" - "testing" -) - -func TestDefaultClient_url(t *testing.T) { - client := DefaultClient() - - if client.URL.String() != atlasDefaultEndpoint { - t.Fatalf("expected %q to be %q", client.URL.String(), atlasDefaultEndpoint) - } -} - -func TestDefaultClient_urlFromEnvVar(t *testing.T) { - defer os.Setenv(atlasEndpointEnvVar, os.Getenv(atlasEndpointEnvVar)) - otherEndpoint := "http://127.0.0.1:1234" - - err := os.Setenv(atlasEndpointEnvVar, otherEndpoint) - if err != nil { - t.Fatal(err) - } - - client := DefaultClient() - - if client.URL.String() != otherEndpoint { - t.Fatalf("expected %q to be %q", client.URL.String(), otherEndpoint) - } -} - -func TestNewClient_badURL(t *testing.T) { - _, err := NewClient("") - if err == nil { - t.Fatal("expected error, but nothing was returned") - } - - expected := "client: missing url" - if !strings.Contains(err.Error(), expected) { - t.Fatalf("expected %q to contain %q", err.Error(), expected) - } -} - -func TestNewClient_parsesURL(t *testing.T) { - client, err := NewClient("https://example.com/foo/bar") - if err != nil { - t.Fatal(err) - } - - expected := &url.URL{ - Scheme: "https", - Host: "example.com", - Path: "/foo/bar", - } - if !reflect.DeepEqual(client.URL, expected) { - t.Fatalf("expected %q to equal %q", client.URL, expected) - } -} - -func TestNewClient_setsDefaultHTTPClient(t *testing.T) { - _, err := NewClient("https://example.com/foo/bar") - if err != nil { - t.Fatal(err) - } -} - -func TestLogin_missingUsername(t *testing.T) { - client, err := NewClient("https://example.com/foo/bar") - if err != nil { - t.Fatal(err) - } - - _, err = client.Login("", "") - if err == nil { - t.Fatal("expected error, but nothing was returned") - } - - expected := "client: missing username" - if !strings.Contains(err.Error(), expected) { - t.Fatalf("expected %q to contain %q", err.Error(), expected) - } -} - -func TestLogin_missingPassword(t *testing.T) { - client, err := NewClient("https://example.com/foo/bar") - if err != nil { - t.Fatal(err) - } - - _, err = client.Login("username", "") - if err == nil { - t.Fatal("expected error, but nothing was returned") - } - - expected := "client: missing password" - if !strings.Contains(err.Error(), expected) { - t.Fatalf("expected %q to contain %q", err.Error(), expected) - } -} - -func TestLogin_serverErrorMessage(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - _, err = client.Login("username", "password") - if err == nil { - t.Fatal("expected error, but nothing was returned") - } - - if err != ErrAuth { - t.Fatalf("bad: %s", err) - } -} - -func TestLogin_success(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - token, err := client.Login("sethloves", "bacon") - if err != nil { - t.Fatal(err) - } - - if client.Token == "" { - t.Fatal("expected client token to be set") - } - - if token == "" { - t.Fatal("expected token to be returned") - } -} - -func TestRequest_tokenAuth(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - client.Token = "a.atlasv1.b" - - request, err := client.Request("GET", "/api/v1/token", nil) - if err != nil { - t.Fatal(err) - } - - _, err = checkResp(client.HTTPClient.Do(request)) - if err != nil { - t.Fatal(err) - } -} - -func TestRequest_getsData(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - request, err := client.Request("GET", "/_status/200", nil) - if err != nil { - t.Fatal(err) - } - - if _, err := checkResp(client.HTTPClient.Do(request)); err != nil { - t.Fatal(err) - } -} - -func TestRequest_railsError(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - request, err := client.Request("GET", "/_rails-error", nil) - if err != nil { - t.Fatal(err) - } - - _, err = checkResp(client.HTTPClient.Do(request)) - if err == nil { - t.Fatal("expected error, but nothing was returned") - } - - expected := &RailsError{ - Errors: []string{ - "this is an error", - "this is another error", - }, - } - - if !reflect.DeepEqual(err, expected) { - t.Fatalf("expected %+v to be %+v", err, expected) - } -} - -func TestRequest_notFoundError(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - request, err := client.Request("GET", "/_status/404", nil) - if err != nil { - t.Fatal(err) - } - - _, err = checkResp(client.HTTPClient.Do(request)) - if err == nil { - t.Fatal("expected error, but nothing was returned") - } - - if err != ErrNotFound { - t.Fatalf("bad error: %#v", err) - } -} - -func TestRequestJSON_decodesData(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - request, err := client.Request("GET", "/_json", nil) - if err != nil { - t.Fatal(err) - } - - response, err := checkResp(client.HTTPClient.Do(request)) - if err != nil { - t.Fatal(err) - } - - var decoded struct{ Ok bool } - if err := decodeJSON(response, &decoded); err != nil { - t.Fatal(err) - } - - if !decoded.Ok { - t.Fatal("expected decoded response to be Ok, but was not") - } -} diff --git a/vendor/github.com/hashicorp/atlas-go/v1/terraform_test.go b/vendor/github.com/hashicorp/atlas-go/v1/terraform_test.go deleted file mode 100644 index 02aa255b59..0000000000 --- a/vendor/github.com/hashicorp/atlas-go/v1/terraform_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package atlas - -import ( - "bytes" - "reflect" - "testing" -) - -func TestTerraformConfigLatest(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - actual, err := client.TerraformConfigLatest("hashicorp", "existing") - if err != nil { - t.Fatal(err) - } - - expected := &TerraformConfigVersion{ - Version: 5, - Metadata: map[string]string{"foo": "bar"}, - Variables: map[string]string{"foo": "bar"}, - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("%#v", actual) - } -} - -func TestCreateTerraformConfigVersion(t *testing.T) { - server := newTestAtlasServer(t) - defer server.Stop() - - client, err := NewClient(server.URL.String()) - if err != nil { - t.Fatal(err) - } - - v := &TerraformConfigVersion{ - Version: 5, - Metadata: map[string]string{"foo": "bar"}, - } - - data := new(bytes.Buffer) - vsn, err := client.CreateTerraformConfigVersion( - "hashicorp", "existing", v, data, int64(data.Len())) - if err != nil { - t.Fatal(err) - } - if vsn != 5 { - t.Fatalf("bad: %v", vsn) - } -} diff --git a/vendor/github.com/hashicorp/atlas-go/v1/util_test.go b/vendor/github.com/hashicorp/atlas-go/v1/util_test.go deleted file mode 100644 index d41a3e9886..0000000000 --- a/vendor/github.com/hashicorp/atlas-go/v1/util_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package atlas - -import ( - "strings" - "testing" -) - -func TestParseSlug_emptyString(t *testing.T) { - _, _, err := ParseSlug("") - if err == nil { - t.Fatal("expected error, but nothing was returned") - } - - expected := "missing slug" - if !strings.Contains(err.Error(), expected) { - t.Fatalf("expected %q to contain %q", err.Error(), expected) - } -} - -func TestParseSlug_noSlashes(t *testing.T) { - _, _, err := ParseSlug("bacon") - if err == nil { - t.Fatal("expected error, but nothing was returned") - } - - expected := "malformed slug" - if !strings.Contains(err.Error(), expected) { - t.Fatalf("expected %q to contain %q", err.Error(), expected) - } -} - -func TestParseSlug_multipleSlashes(t *testing.T) { - _, _, err := ParseSlug("bacon/is/delicious/but/this/is/not/valid") - if err == nil { - t.Fatal("expected error, but nothing was returned") - } - - expected := "malformed slug" - if !strings.Contains(err.Error(), expected) { - t.Fatalf("expected %q to contain %q", err.Error(), expected) - } -} - -func TestParseSlug_goodString(t *testing.T) { - user, name, err := ParseSlug("hashicorp/project") - if err != nil { - t.Fatal(err) - } - - if user != "hashicorp" { - t.Fatalf("expected %q to be %q", user, "hashicorp") - } - - if name != "project" { - t.Fatalf("expected %q to be %q", name, "project") - } -} diff --git a/vendor/github.com/hashicorp/consul/LICENSE b/vendor/github.com/hashicorp/consul/LICENSE new file mode 100644 index 0000000000..c33dcc7c92 --- /dev/null +++ b/vendor/github.com/hashicorp/consul/LICENSE @@ -0,0 +1,354 @@ +Mozilla Public License, version 2.0 + +1. Definitions + +1.1. “Contributor” + + means each individual or legal entity that creates, contributes to the + creation of, or owns Covered Software. + +1.2. “Contributor Version” + + means the combination of the Contributions of others (if any) used by a + Contributor and that particular Contributor’s Contribution. + +1.3. “Contribution” + + means Covered Software of a particular Contributor. + +1.4. “Covered Software” + + means Source Code Form to which the initial Contributor has attached the + notice in Exhibit A, the Executable Form of such Source Code Form, and + Modifications of such Source Code Form, in each case including portions + thereof. + +1.5. “Incompatible With Secondary Licenses” + means + + a. that the initial Contributor has attached the notice described in + Exhibit B to the Covered Software; or + + b. that the Covered Software was made available under the terms of version + 1.1 or earlier of the License, but not also under the terms of a + Secondary License. + +1.6. “Executable Form” + + means any form of the work other than Source Code Form. + +1.7. “Larger Work” + + means a work that combines Covered Software with other material, in a separate + file or files, that is not Covered Software. + +1.8. “License” + + means this document. + +1.9. “Licensable” + + means having the right to grant, to the maximum extent possible, whether at the + time of the initial grant or subsequently, any and all of the rights conveyed by + this License. + +1.10. “Modifications” + + means any of the following: + + a. any file in Source Code Form that results from an addition to, deletion + from, or modification of the contents of Covered Software; or + + b. any new file in Source Code Form that contains any Covered Software. + +1.11. “Patent Claims” of a Contributor + + means any patent claim(s), including without limitation, method, process, + and apparatus claims, in any patent Licensable by such Contributor that + would be infringed, but for the grant of the License, by the making, + using, selling, offering for sale, having made, import, or transfer of + either its Contributions or its Contributor Version. + +1.12. “Secondary License” + + means either the GNU General Public License, Version 2.0, the GNU Lesser + General Public License, Version 2.1, the GNU Affero General Public + License, Version 3.0, or any later versions of those licenses. + +1.13. “Source Code Form” + + means the form of the work preferred for making modifications. + +1.14. “You” (or “Your”) + + means an individual or a legal entity exercising rights under this + License. For legal entities, “You” includes any entity that controls, is + controlled by, or is under common control with You. For purposes of this + definition, “control” means (a) the power, direct or indirect, to cause + the direction or management of such entity, whether by contract or + otherwise, or (b) ownership of more than fifty percent (50%) of the + outstanding shares or beneficial ownership of such entity. + + +2. License Grants and Conditions + +2.1. Grants + + Each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + a. under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or as + part of a Larger Work; and + + b. under Patent Claims of such Contributor to make, use, sell, offer for + sale, have made, import, and otherwise transfer either its Contributions + or its Contributor Version. + +2.2. Effective Date + + The licenses granted in Section 2.1 with respect to any Contribution become + effective for each Contribution on the date the Contributor first distributes + such Contribution. + +2.3. Limitations on Grant Scope + + The licenses granted in this Section 2 are the only rights granted under this + License. No additional rights or licenses will be implied from the distribution + or licensing of Covered Software under this License. Notwithstanding Section + 2.1(b) above, no patent license is granted by a Contributor: + + a. for any code that a Contributor has removed from Covered Software; or + + b. for infringements caused by: (i) Your and any other third party’s + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + + c. under Patent Claims infringed by Covered Software in the absence of its + Contributions. + + This License does not grant any rights in the trademarks, service marks, or + logos of any Contributor (except as may be necessary to comply with the + notice requirements in Section 3.4). + +2.4. Subsequent Licenses + + No Contributor makes additional grants as a result of Your choice to + distribute the Covered Software under a subsequent version of this License + (see Section 10.2) or under the terms of a Secondary License (if permitted + under the terms of Section 3.3). + +2.5. Representation + + Each Contributor represents that the Contributor believes its Contributions + are its original creation(s) or it has sufficient rights to grant the + rights to its Contributions conveyed by this License. + +2.6. Fair Use + + This License is not intended to limit any rights You have under applicable + copyright doctrines of fair use, fair dealing, or other equivalents. + +2.7. Conditions + + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in + Section 2.1. + + +3. Responsibilities + +3.1. Distribution of Source Form + + All distribution of Covered Software in Source Code Form, including any + Modifications that You create or to which You contribute, must be under the + terms of this License. You must inform recipients that the Source Code Form + of the Covered Software is governed by the terms of this License, and how + they can obtain a copy of this License. You may not attempt to alter or + restrict the recipients’ rights in the Source Code Form. + +3.2. Distribution of Executable Form + + If You distribute Covered Software in Executable Form then: + + a. such Covered Software must also be made available in Source Code Form, + as described in Section 3.1, and You must inform recipients of the + Executable Form how they can obtain a copy of such Source Code Form by + reasonable means in a timely manner, at a charge no more than the cost + of distribution to the recipient; and + + b. You may distribute such Executable Form under the terms of this License, + or sublicense it under different terms, provided that the license for + the Executable Form does not attempt to limit or alter the recipients’ + rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + + You may create and distribute a Larger Work under terms of Your choice, + provided that You also comply with the requirements of this License for the + Covered Software. If the Larger Work is a combination of Covered Software + with a work governed by one or more Secondary Licenses, and the Covered + Software is not Incompatible With Secondary Licenses, this License permits + You to additionally distribute such Covered Software under the terms of + such Secondary License(s), so that the recipient of the Larger Work may, at + their option, further distribute the Covered Software under the terms of + either this License or such Secondary License(s). + +3.4. Notices + + You may not remove or alter the substance of any license notices (including + copyright notices, patent notices, disclaimers of warranty, or limitations + of liability) contained within the Source Code Form of the Covered + Software, except that You may alter any license notices to the extent + required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + + You may choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of Covered + Software. However, You may do so only on Your own behalf, and not on behalf + of any Contributor. You must make it absolutely clear that any such + warranty, support, indemnity, or liability obligation is offered by You + alone, and You hereby agree to indemnify every Contributor for any + liability incurred by such Contributor as a result of warranty, support, + indemnity or liability terms You offer. You may include additional + disclaimers of warranty and limitations of liability specific to any + jurisdiction. + +4. Inability to Comply Due to Statute or Regulation + + If it is impossible for You to comply with any of the terms of this License + with respect to some or all of the Covered Software due to statute, judicial + order, or regulation then You must: (a) comply with the terms of this License + to the maximum extent possible; and (b) describe the limitations and the code + they affect. Such description must be placed in a text file included with all + distributions of the Covered Software under this License. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Termination + +5.1. The rights granted under this License will terminate automatically if You + fail to comply with any of its terms. However, if You become compliant, + then the rights granted under this License from a particular Contributor + are reinstated (a) provisionally, unless and until such Contributor + explicitly and finally terminates Your grants, and (b) on an ongoing basis, + if such Contributor fails to notify You of the non-compliance by some + reasonable means prior to 60 days after You have come back into compliance. + Moreover, Your grants from a particular Contributor are reinstated on an + ongoing basis if such Contributor notifies You of the non-compliance by + some reasonable means, this is the first time You have received notice of + non-compliance with this License from such Contributor, and You become + compliant prior to 30 days after Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent + infringement claim (excluding declaratory judgment actions, counter-claims, + and cross-claims) alleging that a Contributor Version directly or + indirectly infringes any patent, then the rights granted to You by any and + all Contributors for the Covered Software under Section 2.1 of this License + shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user + license agreements (excluding distributors and resellers) which have been + validly granted by You or Your distributors under this License prior to + termination shall survive termination. + +6. Disclaimer of Warranty + + Covered Software is provided under this License on an “as is” basis, without + warranty of any kind, either expressed, implied, or statutory, including, + without limitation, warranties that the Covered Software is free of defects, + merchantable, fit for a particular purpose or non-infringing. The entire + risk as to the quality and performance of the Covered Software is with You. + Should any Covered Software prove defective in any respect, You (not any + Contributor) assume the cost of any necessary servicing, repair, or + correction. This disclaimer of warranty constitutes an essential part of this + License. No use of any Covered Software is authorized under this License + except under this disclaimer. + +7. Limitation of Liability + + Under no circumstances and under no legal theory, whether tort (including + negligence), contract, or otherwise, shall any Contributor, or anyone who + distributes Covered Software as permitted above, be liable to You for any + direct, indirect, special, incidental, or consequential damages of any + character including, without limitation, damages for lost profits, loss of + goodwill, work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses, even if such party shall have been + informed of the possibility of such damages. This limitation of liability + shall not apply to liability for death or personal injury resulting from such + party’s negligence to the extent applicable law prohibits such limitation. + Some jurisdictions do not allow the exclusion or limitation of incidental or + consequential damages, so this exclusion and limitation may not apply to You. + +8. Litigation + + Any litigation relating to this License may be brought only in the courts of + a jurisdiction where the defendant maintains its principal place of business + and such litigation shall be governed by laws of that jurisdiction, without + reference to its conflict-of-law provisions. Nothing in this Section shall + prevent a party’s ability to bring cross-claims or counter-claims. + +9. Miscellaneous + + This License represents the complete agreement concerning the subject matter + hereof. If any provision of this License is held to be unenforceable, such + provision shall be reformed only to the extent necessary to make it + enforceable. Any law or regulation which provides that the language of a + contract shall be construed against the drafter shall not be used to construe + this License against a Contributor. + + +10. Versions of the License + +10.1. New Versions + + Mozilla Foundation is the license steward. Except as provided in Section + 10.3, no one other than the license steward has the right to modify or + publish new versions of this License. Each version will be given a + distinguishing version number. + +10.2. Effect of New Versions + + You may distribute the Covered Software under the terms of the version of + the License under which You originally received the Covered Software, or + under the terms of any subsequent version published by the license + steward. + +10.3. Modified Versions + + If you create software not governed by this License, and you want to + create a new license for such software, you may create and use a modified + version of this License if you rename the license and remove any + references to the name of the license steward (except to note that such + modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses + If You choose to distribute Source Code Form that is Incompatible With + Secondary Licenses under the terms of this version of the License, the + notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the + terms of the Mozilla Public License, v. + 2.0. If a copy of the MPL was not + distributed with this file, You can + obtain one at + http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular file, then +You may include the notice in a location (such as a LICENSE file in a relevant +directory) where a recipient would be likely to look for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - “Incompatible With Secondary Licenses” Notice + + This Source Code Form is “Incompatible + With Secondary Licenses”, as defined by + the Mozilla Public License, v. 2.0. + diff --git a/vendor/github.com/hashicorp/consul/api/acl_test.go b/vendor/github.com/hashicorp/consul/api/acl_test.go deleted file mode 100644 index 2a5207a6ee..0000000000 --- a/vendor/github.com/hashicorp/consul/api/acl_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package api - -import ( - "testing" -) - -func TestACL_CreateDestroy(t *testing.T) { - t.Parallel() - c, s := makeACLClient(t) - defer s.Stop() - - acl := c.ACL() - - ae := ACLEntry{ - Name: "API test", - Type: ACLClientType, - Rules: `key "" { policy = "deny" }`, - } - - id, wm, err := acl.Create(&ae, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if wm.RequestTime == 0 { - t.Fatalf("bad: %v", wm) - } - - if id == "" { - t.Fatalf("invalid: %v", id) - } - - ae2, _, err := acl.Info(id, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if ae2.Name != ae.Name || ae2.Type != ae.Type || ae2.Rules != ae.Rules { - t.Fatalf("Bad: %#v", ae2) - } - - wm, err = acl.Destroy(id, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if wm.RequestTime == 0 { - t.Fatalf("bad: %v", wm) - } -} - -func TestACL_CloneDestroy(t *testing.T) { - t.Parallel() - c, s := makeACLClient(t) - defer s.Stop() - - acl := c.ACL() - - id, wm, err := acl.Clone(c.config.Token, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if wm.RequestTime == 0 { - t.Fatalf("bad: %v", wm) - } - - if id == "" { - t.Fatalf("invalid: %v", id) - } - - wm, err = acl.Destroy(id, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if wm.RequestTime == 0 { - t.Fatalf("bad: %v", wm) - } -} - -func TestACL_Info(t *testing.T) { - t.Parallel() - c, s := makeACLClient(t) - defer s.Stop() - - acl := c.ACL() - - ae, qm, err := acl.Info(c.config.Token, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if qm.LastIndex == 0 { - t.Fatalf("bad: %v", qm) - } - if !qm.KnownLeader { - t.Fatalf("bad: %v", qm) - } - - if ae == nil || ae.ID != c.config.Token || ae.Type != ACLManagementType { - t.Fatalf("bad: %#v", ae) - } -} - -func TestACL_List(t *testing.T) { - t.Parallel() - c, s := makeACLClient(t) - defer s.Stop() - - acl := c.ACL() - - acls, qm, err := acl.List(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if len(acls) < 2 { - t.Fatalf("bad: %v", acls) - } - - if qm.LastIndex == 0 { - t.Fatalf("bad: %v", qm) - } - if !qm.KnownLeader { - t.Fatalf("bad: %v", qm) - } -} diff --git a/vendor/github.com/hashicorp/consul/api/agent_test.go b/vendor/github.com/hashicorp/consul/api/agent_test.go deleted file mode 100644 index c49696aeba..0000000000 --- a/vendor/github.com/hashicorp/consul/api/agent_test.go +++ /dev/null @@ -1,568 +0,0 @@ -package api - -import ( - "strings" - "testing" -) - -func TestAgent_Self(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - - info, err := agent.Self() - if err != nil { - t.Fatalf("err: %v", err) - } - - name := info["Config"]["NodeName"] - if name == "" { - t.Fatalf("bad: %v", info) - } -} - -func TestAgent_Members(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - - members, err := agent.Members(false) - if err != nil { - t.Fatalf("err: %v", err) - } - - if len(members) != 1 { - t.Fatalf("bad: %v", members) - } -} - -func TestAgent_Services(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - - reg := &AgentServiceRegistration{ - Name: "foo", - Tags: []string{"bar", "baz"}, - Port: 8000, - Check: &AgentServiceCheck{ - TTL: "15s", - }, - } - if err := agent.ServiceRegister(reg); err != nil { - t.Fatalf("err: %v", err) - } - - services, err := agent.Services() - if err != nil { - t.Fatalf("err: %v", err) - } - if _, ok := services["foo"]; !ok { - t.Fatalf("missing service: %v", services) - } - checks, err := agent.Checks() - if err != nil { - t.Fatalf("err: %v", err) - } - chk, ok := checks["service:foo"] - if !ok { - t.Fatalf("missing check: %v", checks) - } - - // Checks should default to critical - if chk.Status != "critical" { - t.Fatalf("Bad: %#v", chk) - } - - if err := agent.ServiceDeregister("foo"); err != nil { - t.Fatalf("err: %v", err) - } -} - -func TestAgent_Services_CheckPassing(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - reg := &AgentServiceRegistration{ - Name: "foo", - Tags: []string{"bar", "baz"}, - Port: 8000, - Check: &AgentServiceCheck{ - TTL: "15s", - Status: "passing", - }, - } - if err := agent.ServiceRegister(reg); err != nil { - t.Fatalf("err: %v", err) - } - - services, err := agent.Services() - if err != nil { - t.Fatalf("err: %v", err) - } - if _, ok := services["foo"]; !ok { - t.Fatalf("missing service: %v", services) - } - - checks, err := agent.Checks() - if err != nil { - t.Fatalf("err: %v", err) - } - chk, ok := checks["service:foo"] - if !ok { - t.Fatalf("missing check: %v", checks) - } - - if chk.Status != "passing" { - t.Fatalf("Bad: %#v", chk) - } - if err := agent.ServiceDeregister("foo"); err != nil { - t.Fatalf("err: %v", err) - } -} - -func TestAgent_Services_CheckBadStatus(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - reg := &AgentServiceRegistration{ - Name: "foo", - Tags: []string{"bar", "baz"}, - Port: 8000, - Check: &AgentServiceCheck{ - TTL: "15s", - Status: "fluffy", - }, - } - if err := agent.ServiceRegister(reg); err == nil { - t.Fatalf("bad status accepted") - } -} - -func TestAgent_ServiceAddress(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - - reg1 := &AgentServiceRegistration{ - Name: "foo1", - Port: 8000, - Address: "192.168.0.42", - } - reg2 := &AgentServiceRegistration{ - Name: "foo2", - Port: 8000, - } - if err := agent.ServiceRegister(reg1); err != nil { - t.Fatalf("err: %v", err) - } - if err := agent.ServiceRegister(reg2); err != nil { - t.Fatalf("err: %v", err) - } - - services, err := agent.Services() - if err != nil { - t.Fatalf("err: %v", err) - } - - if _, ok := services["foo1"]; !ok { - t.Fatalf("missing service: %v", services) - } - if _, ok := services["foo2"]; !ok { - t.Fatalf("missing service: %v", services) - } - - if services["foo1"].Address != "192.168.0.42" { - t.Fatalf("missing Address field in service foo1: %v", services) - } - if services["foo2"].Address != "" { - t.Fatalf("missing Address field in service foo2: %v", services) - } - - if err := agent.ServiceDeregister("foo"); err != nil { - t.Fatalf("err: %v", err) - } -} - -func TestAgent_Services_MultipleChecks(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - - reg := &AgentServiceRegistration{ - Name: "foo", - Tags: []string{"bar", "baz"}, - Port: 8000, - Checks: AgentServiceChecks{ - &AgentServiceCheck{ - TTL: "15s", - }, - &AgentServiceCheck{ - TTL: "30s", - }, - }, - } - if err := agent.ServiceRegister(reg); err != nil { - t.Fatalf("err: %v", err) - } - - services, err := agent.Services() - if err != nil { - t.Fatalf("err: %v", err) - } - if _, ok := services["foo"]; !ok { - t.Fatalf("missing service: %v", services) - } - - checks, err := agent.Checks() - if err != nil { - t.Fatalf("err: %v", err) - } - if _, ok := checks["service:foo:1"]; !ok { - t.Fatalf("missing check: %v", checks) - } - if _, ok := checks["service:foo:2"]; !ok { - t.Fatalf("missing check: %v", checks) - } -} - -func TestAgent_SetTTLStatus(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - - reg := &AgentServiceRegistration{ - Name: "foo", - Check: &AgentServiceCheck{ - TTL: "15s", - }, - } - if err := agent.ServiceRegister(reg); err != nil { - t.Fatalf("err: %v", err) - } - - if err := agent.WarnTTL("service:foo", "test"); err != nil { - t.Fatalf("err: %v", err) - } - - checks, err := agent.Checks() - if err != nil { - t.Fatalf("err: %v", err) - } - chk, ok := checks["service:foo"] - if !ok { - t.Fatalf("missing check: %v", checks) - } - if chk.Status != "warning" { - t.Fatalf("Bad: %#v", chk) - } - if chk.Output != "test" { - t.Fatalf("Bad: %#v", chk) - } - - if err := agent.ServiceDeregister("foo"); err != nil { - t.Fatalf("err: %v", err) - } -} - -func TestAgent_Checks(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - - reg := &AgentCheckRegistration{ - Name: "foo", - } - reg.TTL = "15s" - if err := agent.CheckRegister(reg); err != nil { - t.Fatalf("err: %v", err) - } - - checks, err := agent.Checks() - if err != nil { - t.Fatalf("err: %v", err) - } - chk, ok := checks["foo"] - if !ok { - t.Fatalf("missing check: %v", checks) - } - if chk.Status != "critical" { - t.Fatalf("check not critical: %v", chk) - } - - if err := agent.CheckDeregister("foo"); err != nil { - t.Fatalf("err: %v", err) - } -} - -func TestAgent_CheckStartPassing(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - - reg := &AgentCheckRegistration{ - Name: "foo", - AgentServiceCheck: AgentServiceCheck{ - Status: "passing", - }, - } - reg.TTL = "15s" - if err := agent.CheckRegister(reg); err != nil { - t.Fatalf("err: %v", err) - } - - checks, err := agent.Checks() - if err != nil { - t.Fatalf("err: %v", err) - } - chk, ok := checks["foo"] - if !ok { - t.Fatalf("missing check: %v", checks) - } - if chk.Status != "passing" { - t.Fatalf("check not passing: %v", chk) - } - - if err := agent.CheckDeregister("foo"); err != nil { - t.Fatalf("err: %v", err) - } -} - -func TestAgent_Checks_serviceBound(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - - // First register a service - serviceReg := &AgentServiceRegistration{ - Name: "redis", - } - if err := agent.ServiceRegister(serviceReg); err != nil { - t.Fatalf("err: %v", err) - } - - // Register a check bound to the service - reg := &AgentCheckRegistration{ - Name: "redischeck", - ServiceID: "redis", - } - reg.TTL = "15s" - if err := agent.CheckRegister(reg); err != nil { - t.Fatalf("err: %v", err) - } - - checks, err := agent.Checks() - if err != nil { - t.Fatalf("err: %v", err) - } - - check, ok := checks["redischeck"] - if !ok { - t.Fatalf("missing check: %v", checks) - } - if check.ServiceID != "redis" { - t.Fatalf("missing service association for check: %v", check) - } -} - -func TestAgent_Checks_Docker(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - - // First register a service - serviceReg := &AgentServiceRegistration{ - Name: "redis", - } - if err := agent.ServiceRegister(serviceReg); err != nil { - t.Fatalf("err: %v", err) - } - - // Register a check bound to the service - reg := &AgentCheckRegistration{ - Name: "redischeck", - ServiceID: "redis", - AgentServiceCheck: AgentServiceCheck{ - DockerContainerID: "f972c95ebf0e", - Script: "/bin/true", - Shell: "/bin/bash", - Interval: "10s", - }, - } - if err := agent.CheckRegister(reg); err != nil { - t.Fatalf("err: %v", err) - } - - checks, err := agent.Checks() - if err != nil { - t.Fatalf("err: %v", err) - } - - check, ok := checks["redischeck"] - if !ok { - t.Fatalf("missing check: %v", checks) - } - if check.ServiceID != "redis" { - t.Fatalf("missing service association for check: %v", check) - } -} - -func TestAgent_Join(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - - info, err := agent.Self() - if err != nil { - t.Fatalf("err: %v", err) - } - - // Join ourself - addr := info["Config"]["AdvertiseAddr"].(string) - err = agent.Join(addr, false) - if err != nil { - t.Fatalf("err: %v", err) - } -} - -func TestAgent_ForceLeave(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - - // Eject somebody - err := agent.ForceLeave("foo") - if err != nil { - t.Fatalf("err: %v", err) - } -} - -func TestServiceMaintenance(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - - // First register a service - serviceReg := &AgentServiceRegistration{ - Name: "redis", - } - if err := agent.ServiceRegister(serviceReg); err != nil { - t.Fatalf("err: %v", err) - } - - // Enable maintenance mode - if err := agent.EnableServiceMaintenance("redis", "broken"); err != nil { - t.Fatalf("err: %s", err) - } - - // Ensure a critical check was added - checks, err := agent.Checks() - if err != nil { - t.Fatalf("err: %v", err) - } - found := false - for _, check := range checks { - if strings.Contains(check.CheckID, "maintenance") { - found = true - if check.Status != "critical" || check.Notes != "broken" { - t.Fatalf("bad: %#v", checks) - } - } - } - if !found { - t.Fatalf("bad: %#v", checks) - } - - // Disable maintenance mode - if err := agent.DisableServiceMaintenance("redis"); err != nil { - t.Fatalf("err: %s", err) - } - - // Ensure the critical health check was removed - checks, err = agent.Checks() - if err != nil { - t.Fatalf("err: %s", err) - } - for _, check := range checks { - if strings.Contains(check.CheckID, "maintenance") { - t.Fatalf("should have removed health check") - } - } -} - -func TestNodeMaintenance(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - - // Enable maintenance mode - if err := agent.EnableNodeMaintenance("broken"); err != nil { - t.Fatalf("err: %s", err) - } - - // Check that a critical check was added - checks, err := agent.Checks() - if err != nil { - t.Fatalf("err: %s", err) - } - found := false - for _, check := range checks { - if strings.Contains(check.CheckID, "maintenance") { - found = true - if check.Status != "critical" || check.Notes != "broken" { - t.Fatalf("bad: %#v", checks) - } - } - } - if !found { - t.Fatalf("bad: %#v", checks) - } - - // Disable maintenance mode - if err := agent.DisableNodeMaintenance(); err != nil { - t.Fatalf("err: %s", err) - } - - // Ensure the check was removed - checks, err = agent.Checks() - if err != nil { - t.Fatalf("err: %s", err) - } - for _, check := range checks { - if strings.Contains(check.CheckID, "maintenance") { - t.Fatalf("should have removed health check") - } - } -} diff --git a/vendor/github.com/hashicorp/consul/api/api_test.go b/vendor/github.com/hashicorp/consul/api/api_test.go deleted file mode 100644 index c2d178ddee..0000000000 --- a/vendor/github.com/hashicorp/consul/api/api_test.go +++ /dev/null @@ -1,288 +0,0 @@ -package api - -import ( - crand "crypto/rand" - "fmt" - "io/ioutil" - "net/http" - "os" - "path/filepath" - "runtime" - "testing" - "time" - - "github.com/hashicorp/consul/testutil" -) - -type configCallback func(c *Config) - -func makeClient(t *testing.T) (*Client, *testutil.TestServer) { - return makeClientWithConfig(t, nil, nil) -} - -func makeACLClient(t *testing.T) (*Client, *testutil.TestServer) { - return makeClientWithConfig(t, func(clientConfig *Config) { - clientConfig.Token = "root" - }, func(serverConfig *testutil.TestServerConfig) { - serverConfig.ACLMasterToken = "root" - serverConfig.ACLDatacenter = "dc1" - serverConfig.ACLDefaultPolicy = "deny" - }) -} - -func makeClientWithConfig( - t *testing.T, - cb1 configCallback, - cb2 testutil.ServerConfigCallback) (*Client, *testutil.TestServer) { - - // Make client config - conf := DefaultConfig() - if cb1 != nil { - cb1(conf) - } - - // Create server - server := testutil.NewTestServerConfig(t, cb2) - conf.Address = server.HTTPAddr - - // Create client - client, err := NewClient(conf) - if err != nil { - t.Fatalf("err: %v", err) - } - - return client, server -} - -func testKey() string { - buf := make([]byte, 16) - if _, err := crand.Read(buf); err != nil { - panic(fmt.Errorf("Failed to read random bytes: %v", err)) - } - - return fmt.Sprintf("%08x-%04x-%04x-%04x-%12x", - buf[0:4], - buf[4:6], - buf[6:8], - buf[8:10], - buf[10:16]) -} - -func TestDefaultConfig_env(t *testing.T) { - t.Parallel() - addr := "1.2.3.4:5678" - token := "abcd1234" - auth := "username:password" - - os.Setenv("CONSUL_HTTP_ADDR", addr) - defer os.Setenv("CONSUL_HTTP_ADDR", "") - os.Setenv("CONSUL_HTTP_TOKEN", token) - defer os.Setenv("CONSUL_HTTP_TOKEN", "") - os.Setenv("CONSUL_HTTP_AUTH", auth) - defer os.Setenv("CONSUL_HTTP_AUTH", "") - os.Setenv("CONSUL_HTTP_SSL", "1") - defer os.Setenv("CONSUL_HTTP_SSL", "") - os.Setenv("CONSUL_HTTP_SSL_VERIFY", "0") - defer os.Setenv("CONSUL_HTTP_SSL_VERIFY", "") - - config := DefaultConfig() - - if config.Address != addr { - t.Errorf("expected %q to be %q", config.Address, addr) - } - - if config.Token != token { - t.Errorf("expected %q to be %q", config.Token, token) - } - - if config.HttpAuth == nil { - t.Fatalf("expected HttpAuth to be enabled") - } - if config.HttpAuth.Username != "username" { - t.Errorf("expected %q to be %q", config.HttpAuth.Username, "username") - } - if config.HttpAuth.Password != "password" { - t.Errorf("expected %q to be %q", config.HttpAuth.Password, "password") - } - - if config.Scheme != "https" { - t.Errorf("expected %q to be %q", config.Scheme, "https") - } - - if !config.HttpClient.Transport.(*http.Transport).TLSClientConfig.InsecureSkipVerify { - t.Errorf("expected SSL verification to be off") - } -} - -func TestSetQueryOptions(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - r := c.newRequest("GET", "/v1/kv/foo") - q := &QueryOptions{ - Datacenter: "foo", - AllowStale: true, - RequireConsistent: true, - WaitIndex: 1000, - WaitTime: 100 * time.Second, - Token: "12345", - Near: "nodex", - } - r.setQueryOptions(q) - - if r.params.Get("dc") != "foo" { - t.Fatalf("bad: %v", r.params) - } - if _, ok := r.params["stale"]; !ok { - t.Fatalf("bad: %v", r.params) - } - if _, ok := r.params["consistent"]; !ok { - t.Fatalf("bad: %v", r.params) - } - if r.params.Get("index") != "1000" { - t.Fatalf("bad: %v", r.params) - } - if r.params.Get("wait") != "100000ms" { - t.Fatalf("bad: %v", r.params) - } - if r.params.Get("token") != "12345" { - t.Fatalf("bad: %v", r.params) - } - if r.params.Get("near") != "nodex" { - t.Fatalf("bad: %v", r.params) - } -} - -func TestSetWriteOptions(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - r := c.newRequest("GET", "/v1/kv/foo") - q := &WriteOptions{ - Datacenter: "foo", - Token: "23456", - } - r.setWriteOptions(q) - - if r.params.Get("dc") != "foo" { - t.Fatalf("bad: %v", r.params) - } - if r.params.Get("token") != "23456" { - t.Fatalf("bad: %v", r.params) - } -} - -func TestRequestToHTTP(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - r := c.newRequest("DELETE", "/v1/kv/foo") - q := &QueryOptions{ - Datacenter: "foo", - } - r.setQueryOptions(q) - req, err := r.toHTTP() - if err != nil { - t.Fatalf("err: %v", err) - } - - if req.Method != "DELETE" { - t.Fatalf("bad: %v", req) - } - if req.URL.RequestURI() != "/v1/kv/foo?dc=foo" { - t.Fatalf("bad: %v", req) - } -} - -func TestParseQueryMeta(t *testing.T) { - t.Parallel() - resp := &http.Response{ - Header: make(map[string][]string), - } - resp.Header.Set("X-Consul-Index", "12345") - resp.Header.Set("X-Consul-LastContact", "80") - resp.Header.Set("X-Consul-KnownLeader", "true") - - qm := &QueryMeta{} - if err := parseQueryMeta(resp, qm); err != nil { - t.Fatalf("err: %v", err) - } - - if qm.LastIndex != 12345 { - t.Fatalf("Bad: %v", qm) - } - if qm.LastContact != 80*time.Millisecond { - t.Fatalf("Bad: %v", qm) - } - if !qm.KnownLeader { - t.Fatalf("Bad: %v", qm) - } -} - -func TestAPI_UnixSocket(t *testing.T) { - t.Parallel() - if runtime.GOOS == "windows" { - t.SkipNow() - } - - tempDir, err := ioutil.TempDir("", "consul") - if err != nil { - t.Fatalf("err: %s", err) - } - defer os.RemoveAll(tempDir) - socket := filepath.Join(tempDir, "test.sock") - - c, s := makeClientWithConfig(t, func(c *Config) { - c.Address = "unix://" + socket - }, func(c *testutil.TestServerConfig) { - c.Addresses = &testutil.TestAddressConfig{ - HTTP: "unix://" + socket, - } - }) - defer s.Stop() - - agent := c.Agent() - - info, err := agent.Self() - if err != nil { - t.Fatalf("err: %s", err) - } - if info["Config"]["NodeName"] == "" { - t.Fatalf("bad: %v", info) - } -} - -func TestAPI_durToMsec(t *testing.T) { - if ms := durToMsec(0); ms != "0ms" { - t.Fatalf("bad: %s", ms) - } - - if ms := durToMsec(time.Millisecond); ms != "1ms" { - t.Fatalf("bad: %s", ms) - } - - if ms := durToMsec(time.Microsecond); ms != "1ms" { - t.Fatalf("bad: %s", ms) - } - - if ms := durToMsec(5 * time.Millisecond); ms != "5ms" { - t.Fatalf("bad: %s", ms) - } -} - -func TestAPI_IsServerError(t *testing.T) { - if IsServerError(nil) { - t.Fatalf("should not be a server error") - } - - if IsServerError(fmt.Errorf("not the error you are looking for")) { - t.Fatalf("should not be a server error") - } - - if !IsServerError(fmt.Errorf(serverError)) { - t.Fatalf("should be a server error") - } -} diff --git a/vendor/github.com/hashicorp/consul/api/catalog_test.go b/vendor/github.com/hashicorp/consul/api/catalog_test.go deleted file mode 100644 index bb8be25b00..0000000000 --- a/vendor/github.com/hashicorp/consul/api/catalog_test.go +++ /dev/null @@ -1,279 +0,0 @@ -package api - -import ( - "fmt" - "testing" - - "github.com/hashicorp/consul/testutil" -) - -func TestCatalog_Datacenters(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - catalog := c.Catalog() - - testutil.WaitForResult(func() (bool, error) { - datacenters, err := catalog.Datacenters() - if err != nil { - return false, err - } - - if len(datacenters) == 0 { - return false, fmt.Errorf("Bad: %v", datacenters) - } - - return true, nil - }, func(err error) { - t.Fatalf("err: %s", err) - }) -} - -func TestCatalog_Nodes(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - catalog := c.Catalog() - - testutil.WaitForResult(func() (bool, error) { - nodes, meta, err := catalog.Nodes(nil) - if err != nil { - return false, err - } - - if meta.LastIndex == 0 { - return false, fmt.Errorf("Bad: %v", meta) - } - - if len(nodes) == 0 { - return false, fmt.Errorf("Bad: %v", nodes) - } - - return true, nil - }, func(err error) { - t.Fatalf("err: %s", err) - }) -} - -func TestCatalog_Services(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - catalog := c.Catalog() - - testutil.WaitForResult(func() (bool, error) { - services, meta, err := catalog.Services(nil) - if err != nil { - return false, err - } - - if meta.LastIndex == 0 { - return false, fmt.Errorf("Bad: %v", meta) - } - - if len(services) == 0 { - return false, fmt.Errorf("Bad: %v", services) - } - - return true, nil - }, func(err error) { - t.Fatalf("err: %s", err) - }) -} - -func TestCatalog_Service(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - catalog := c.Catalog() - - testutil.WaitForResult(func() (bool, error) { - services, meta, err := catalog.Service("consul", "", nil) - if err != nil { - return false, err - } - - if meta.LastIndex == 0 { - return false, fmt.Errorf("Bad: %v", meta) - } - - if len(services) == 0 { - return false, fmt.Errorf("Bad: %v", services) - } - - return true, nil - }, func(err error) { - t.Fatalf("err: %s", err) - }) -} - -func TestCatalog_Node(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - catalog := c.Catalog() - name, _ := c.Agent().NodeName() - - testutil.WaitForResult(func() (bool, error) { - info, meta, err := catalog.Node(name, nil) - if err != nil { - return false, err - } - - if meta.LastIndex == 0 { - return false, fmt.Errorf("Bad: %v", meta) - } - if len(info.Services) == 0 { - return false, fmt.Errorf("Bad: %v", info) - } - - return true, nil - }, func(err error) { - t.Fatalf("err: %s", err) - }) -} - -func TestCatalog_Registration(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - catalog := c.Catalog() - - service := &AgentService{ - ID: "redis1", - Service: "redis", - Tags: []string{"master", "v1"}, - Port: 8000, - } - - check := &AgentCheck{ - Node: "foobar", - CheckID: "service:redis1", - Name: "Redis health check", - Notes: "Script based health check", - Status: "passing", - ServiceID: "redis1", - } - - reg := &CatalogRegistration{ - Datacenter: "dc1", - Node: "foobar", - Address: "192.168.10.10", - Service: service, - Check: check, - } - - testutil.WaitForResult(func() (bool, error) { - if _, err := catalog.Register(reg, nil); err != nil { - return false, err - } - - node, _, err := catalog.Node("foobar", nil) - if err != nil { - return false, err - } - - if _, ok := node.Services["redis1"]; !ok { - return false, fmt.Errorf("missing service: redis1") - } - - health, _, err := c.Health().Node("foobar", nil) - if err != nil { - return false, err - } - - if health[0].CheckID != "service:redis1" { - return false, fmt.Errorf("missing checkid service:redis1") - } - - return true, nil - }, func(err error) { - t.Fatalf("err: %s", err) - }) - - // Test catalog deregistration of the previously registered service - dereg := &CatalogDeregistration{ - Datacenter: "dc1", - Node: "foobar", - Address: "192.168.10.10", - ServiceID: "redis1", - } - - if _, err := catalog.Deregister(dereg, nil); err != nil { - t.Fatalf("err: %v", err) - } - - testutil.WaitForResult(func() (bool, error) { - node, _, err := catalog.Node("foobar", nil) - if err != nil { - return false, err - } - - if _, ok := node.Services["redis1"]; ok { - return false, fmt.Errorf("ServiceID:redis1 is not deregistered") - } - - return true, nil - }, func(err error) { - t.Fatalf("err: %s", err) - }) - - // Test deregistration of the previously registered check - dereg = &CatalogDeregistration{ - Datacenter: "dc1", - Node: "foobar", - Address: "192.168.10.10", - CheckID: "service:redis1", - } - - if _, err := catalog.Deregister(dereg, nil); err != nil { - t.Fatalf("err: %v", err) - } - - testutil.WaitForResult(func() (bool, error) { - health, _, err := c.Health().Node("foobar", nil) - if err != nil { - return false, err - } - - if len(health) != 0 { - return false, fmt.Errorf("CheckID:service:redis1 is not deregistered") - } - - return true, nil - }, func(err error) { - t.Fatalf("err: %s", err) - }) - - // Test node deregistration of the previously registered node - dereg = &CatalogDeregistration{ - Datacenter: "dc1", - Node: "foobar", - Address: "192.168.10.10", - } - - if _, err := catalog.Deregister(dereg, nil); err != nil { - t.Fatalf("err: %v", err) - } - - testutil.WaitForResult(func() (bool, error) { - node, _, err := catalog.Node("foobar", nil) - if err != nil { - return false, err - } - - if node != nil { - return false, fmt.Errorf("node is not deregistered: %v", node) - } - - return true, nil - }, func(err error) { - t.Fatalf("err: %s", err) - }) -} diff --git a/vendor/github.com/hashicorp/consul/api/coordinate_test.go b/vendor/github.com/hashicorp/consul/api/coordinate_test.go deleted file mode 100644 index 9d13d1c39d..0000000000 --- a/vendor/github.com/hashicorp/consul/api/coordinate_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package api - -import ( - "fmt" - "testing" - - "github.com/hashicorp/consul/testutil" -) - -func TestCoordinate_Datacenters(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - coordinate := c.Coordinate() - - testutil.WaitForResult(func() (bool, error) { - datacenters, err := coordinate.Datacenters() - if err != nil { - return false, err - } - - if len(datacenters) == 0 { - return false, fmt.Errorf("Bad: %v", datacenters) - } - - return true, nil - }, func(err error) { - t.Fatalf("err: %s", err) - }) -} - -func TestCoordinate_Nodes(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - coordinate := c.Coordinate() - - testutil.WaitForResult(func() (bool, error) { - _, _, err := coordinate.Nodes(nil) - if err != nil { - return false, err - } - - // There's not a good way to populate coordinates without - // waiting for them to calculate and update, so the best - // we can do is call the endpoint and make sure we don't - // get an error. - return true, nil - }, func(err error) { - t.Fatalf("err: %s", err) - }) -} diff --git a/vendor/github.com/hashicorp/consul/api/event_test.go b/vendor/github.com/hashicorp/consul/api/event_test.go deleted file mode 100644 index 1ca92e2331..0000000000 --- a/vendor/github.com/hashicorp/consul/api/event_test.go +++ /dev/null @@ -1,49 +0,0 @@ -package api - -import ( - "testing" - - "github.com/hashicorp/consul/testutil" -) - -func TestEvent_FireList(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - event := c.Event() - - params := &UserEvent{Name: "foo"} - id, meta, err := event.Fire(params, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if meta.RequestTime == 0 { - t.Fatalf("bad: %v", meta) - } - - if id == "" { - t.Fatalf("invalid: %v", id) - } - - var events []*UserEvent - var qm *QueryMeta - testutil.WaitForResult(func() (bool, error) { - events, qm, err = event.List("", nil) - if err != nil { - t.Fatalf("err: %v", err) - } - return len(events) > 0, err - }, func(err error) { - t.Fatalf("err: %#v", err) - }) - - if events[len(events)-1].ID != id { - t.Fatalf("bad: %#v", events) - } - - if qm.LastIndex != event.IDToIndex(id) { - t.Fatalf("Bad: %#v", qm) - } -} diff --git a/vendor/github.com/hashicorp/consul/api/health_test.go b/vendor/github.com/hashicorp/consul/api/health_test.go deleted file mode 100644 index d80a4693ae..0000000000 --- a/vendor/github.com/hashicorp/consul/api/health_test.go +++ /dev/null @@ -1,125 +0,0 @@ -package api - -import ( - "fmt" - "testing" - - "github.com/hashicorp/consul/testutil" -) - -func TestHealth_Node(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - health := c.Health() - - info, err := agent.Self() - if err != nil { - t.Fatalf("err: %v", err) - } - name := info["Config"]["NodeName"].(string) - - testutil.WaitForResult(func() (bool, error) { - checks, meta, err := health.Node(name, nil) - if err != nil { - return false, err - } - if meta.LastIndex == 0 { - return false, fmt.Errorf("bad: %v", meta) - } - if len(checks) == 0 { - return false, fmt.Errorf("bad: %v", checks) - } - return true, nil - }, func(err error) { - t.Fatalf("err: %s", err) - }) -} - -func TestHealth_Checks(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - agent := c.Agent() - health := c.Health() - - // Make a service with a check - reg := &AgentServiceRegistration{ - Name: "foo", - Check: &AgentServiceCheck{ - TTL: "15s", - }, - } - if err := agent.ServiceRegister(reg); err != nil { - t.Fatalf("err: %v", err) - } - defer agent.ServiceDeregister("foo") - - testutil.WaitForResult(func() (bool, error) { - checks, meta, err := health.Checks("foo", nil) - if err != nil { - return false, err - } - if meta.LastIndex == 0 { - return false, fmt.Errorf("bad: %v", meta) - } - if len(checks) == 0 { - return false, fmt.Errorf("Bad: %v", checks) - } - return true, nil - }, func(err error) { - t.Fatalf("err: %s", err) - }) -} - -func TestHealth_Service(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - health := c.Health() - - testutil.WaitForResult(func() (bool, error) { - // consul service should always exist... - checks, meta, err := health.Service("consul", "", true, nil) - if err != nil { - return false, err - } - if meta.LastIndex == 0 { - return false, fmt.Errorf("bad: %v", meta) - } - if len(checks) == 0 { - return false, fmt.Errorf("Bad: %v", checks) - } - return true, nil - }, func(err error) { - t.Fatalf("err: %s", err) - }) -} - -func TestHealth_State(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - health := c.Health() - - testutil.WaitForResult(func() (bool, error) { - checks, meta, err := health.State("any", nil) - if err != nil { - return false, err - } - if meta.LastIndex == 0 { - return false, fmt.Errorf("bad: %v", meta) - } - if len(checks) == 0 { - return false, fmt.Errorf("Bad: %v", checks) - } - return true, nil - }, func(err error) { - t.Fatalf("err: %s", err) - }) -} diff --git a/vendor/github.com/hashicorp/consul/api/kv_test.go b/vendor/github.com/hashicorp/consul/api/kv_test.go deleted file mode 100644 index 758595d895..0000000000 --- a/vendor/github.com/hashicorp/consul/api/kv_test.go +++ /dev/null @@ -1,447 +0,0 @@ -package api - -import ( - "bytes" - "path" - "testing" - "time" -) - -func TestClientPutGetDelete(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - kv := c.KV() - - // Get a get without a key - key := testKey() - pair, _, err := kv.Get(key, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if pair != nil { - t.Fatalf("unexpected value: %#v", pair) - } - - value := []byte("test") - - // Put a key that begins with a '/', this should fail - invalidKey := "/test" - p := &KVPair{Key: invalidKey, Flags: 42, Value: value} - if _, err := kv.Put(p, nil); err == nil { - t.Fatalf("Invalid key not detected: %s", invalidKey) - } - - // Put the key - p = &KVPair{Key: key, Flags: 42, Value: value} - if _, err := kv.Put(p, nil); err != nil { - t.Fatalf("err: %v", err) - } - - // Get should work - pair, meta, err := kv.Get(key, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if pair == nil { - t.Fatalf("expected value: %#v", pair) - } - if !bytes.Equal(pair.Value, value) { - t.Fatalf("unexpected value: %#v", pair) - } - if pair.Flags != 42 { - t.Fatalf("unexpected value: %#v", pair) - } - if meta.LastIndex == 0 { - t.Fatalf("unexpected value: %#v", meta) - } - - // Delete - if _, err := kv.Delete(key, nil); err != nil { - t.Fatalf("err: %v", err) - } - - // Get should fail - pair, _, err = kv.Get(key, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if pair != nil { - t.Fatalf("unexpected value: %#v", pair) - } -} - -func TestClient_List_DeleteRecurse(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - kv := c.KV() - - // Generate some test keys - prefix := testKey() - var keys []string - for i := 0; i < 100; i++ { - keys = append(keys, path.Join(prefix, testKey())) - } - - // Set values - value := []byte("test") - for _, key := range keys { - p := &KVPair{Key: key, Value: value} - if _, err := kv.Put(p, nil); err != nil { - t.Fatalf("err: %v", err) - } - } - - // List the values - pairs, meta, err := kv.List(prefix, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if len(pairs) != len(keys) { - t.Fatalf("got %d keys", len(pairs)) - } - for _, pair := range pairs { - if !bytes.Equal(pair.Value, value) { - t.Fatalf("unexpected value: %#v", pair) - } - } - if meta.LastIndex == 0 { - t.Fatalf("unexpected value: %#v", meta) - } - - // Delete all - if _, err := kv.DeleteTree(prefix, nil); err != nil { - t.Fatalf("err: %v", err) - } - - // List the values - pairs, _, err = kv.List(prefix, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if len(pairs) != 0 { - t.Fatalf("got %d keys", len(pairs)) - } -} - -func TestClient_DeleteCAS(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - kv := c.KV() - - // Put the key - key := testKey() - value := []byte("test") - p := &KVPair{Key: key, Value: value} - if work, _, err := kv.CAS(p, nil); err != nil { - t.Fatalf("err: %v", err) - } else if !work { - t.Fatalf("CAS failure") - } - - // Get should work - pair, meta, err := kv.Get(key, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if pair == nil { - t.Fatalf("expected value: %#v", pair) - } - if meta.LastIndex == 0 { - t.Fatalf("unexpected value: %#v", meta) - } - - // CAS update with bad index - p.ModifyIndex = 1 - if work, _, err := kv.DeleteCAS(p, nil); err != nil { - t.Fatalf("err: %v", err) - } else if work { - t.Fatalf("unexpected CAS") - } - - // CAS update with valid index - p.ModifyIndex = meta.LastIndex - if work, _, err := kv.DeleteCAS(p, nil); err != nil { - t.Fatalf("err: %v", err) - } else if !work { - t.Fatalf("unexpected CAS failure") - } -} - -func TestClient_CAS(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - kv := c.KV() - - // Put the key - key := testKey() - value := []byte("test") - p := &KVPair{Key: key, Value: value} - if work, _, err := kv.CAS(p, nil); err != nil { - t.Fatalf("err: %v", err) - } else if !work { - t.Fatalf("CAS failure") - } - - // Get should work - pair, meta, err := kv.Get(key, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if pair == nil { - t.Fatalf("expected value: %#v", pair) - } - if meta.LastIndex == 0 { - t.Fatalf("unexpected value: %#v", meta) - } - - // CAS update with bad index - newVal := []byte("foo") - p.Value = newVal - p.ModifyIndex = 1 - if work, _, err := kv.CAS(p, nil); err != nil { - t.Fatalf("err: %v", err) - } else if work { - t.Fatalf("unexpected CAS") - } - - // CAS update with valid index - p.ModifyIndex = meta.LastIndex - if work, _, err := kv.CAS(p, nil); err != nil { - t.Fatalf("err: %v", err) - } else if !work { - t.Fatalf("unexpected CAS failure") - } -} - -func TestClient_WatchGet(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - kv := c.KV() - - // Get a get without a key - key := testKey() - pair, meta, err := kv.Get(key, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if pair != nil { - t.Fatalf("unexpected value: %#v", pair) - } - if meta.LastIndex == 0 { - t.Fatalf("unexpected value: %#v", meta) - } - - // Put the key - value := []byte("test") - go func() { - kv := c.KV() - - time.Sleep(100 * time.Millisecond) - p := &KVPair{Key: key, Flags: 42, Value: value} - if _, err := kv.Put(p, nil); err != nil { - t.Fatalf("err: %v", err) - } - }() - - // Get should work - options := &QueryOptions{WaitIndex: meta.LastIndex} - pair, meta2, err := kv.Get(key, options) - if err != nil { - t.Fatalf("err: %v", err) - } - if pair == nil { - t.Fatalf("expected value: %#v", pair) - } - if !bytes.Equal(pair.Value, value) { - t.Fatalf("unexpected value: %#v", pair) - } - if pair.Flags != 42 { - t.Fatalf("unexpected value: %#v", pair) - } - if meta2.LastIndex <= meta.LastIndex { - t.Fatalf("unexpected value: %#v", meta2) - } -} - -func TestClient_WatchList(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - kv := c.KV() - - // Get a get without a key - prefix := testKey() - key := path.Join(prefix, testKey()) - pairs, meta, err := kv.List(prefix, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if len(pairs) != 0 { - t.Fatalf("unexpected value: %#v", pairs) - } - if meta.LastIndex == 0 { - t.Fatalf("unexpected value: %#v", meta) - } - - // Put the key - value := []byte("test") - go func() { - kv := c.KV() - - time.Sleep(100 * time.Millisecond) - p := &KVPair{Key: key, Flags: 42, Value: value} - if _, err := kv.Put(p, nil); err != nil { - t.Fatalf("err: %v", err) - } - }() - - // Get should work - options := &QueryOptions{WaitIndex: meta.LastIndex} - pairs, meta2, err := kv.List(prefix, options) - if err != nil { - t.Fatalf("err: %v", err) - } - if len(pairs) != 1 { - t.Fatalf("expected value: %#v", pairs) - } - if !bytes.Equal(pairs[0].Value, value) { - t.Fatalf("unexpected value: %#v", pairs) - } - if pairs[0].Flags != 42 { - t.Fatalf("unexpected value: %#v", pairs) - } - if meta2.LastIndex <= meta.LastIndex { - t.Fatalf("unexpected value: %#v", meta2) - } - -} - -func TestClient_Keys_DeleteRecurse(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - kv := c.KV() - - // Generate some test keys - prefix := testKey() - var keys []string - for i := 0; i < 100; i++ { - keys = append(keys, path.Join(prefix, testKey())) - } - - // Set values - value := []byte("test") - for _, key := range keys { - p := &KVPair{Key: key, Value: value} - if _, err := kv.Put(p, nil); err != nil { - t.Fatalf("err: %v", err) - } - } - - // List the values - out, meta, err := kv.Keys(prefix, "", nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if len(out) != len(keys) { - t.Fatalf("got %d keys", len(out)) - } - if meta.LastIndex == 0 { - t.Fatalf("unexpected value: %#v", meta) - } - - // Delete all - if _, err := kv.DeleteTree(prefix, nil); err != nil { - t.Fatalf("err: %v", err) - } - - // List the values - out, _, err = kv.Keys(prefix, "", nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if len(out) != 0 { - t.Fatalf("got %d keys", len(out)) - } -} - -func TestClient_AcquireRelease(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - session := c.Session() - kv := c.KV() - - // Make a session - id, _, err := session.CreateNoChecks(nil, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - defer session.Destroy(id, nil) - - // Acquire the key - key := testKey() - value := []byte("test") - p := &KVPair{Key: key, Value: value, Session: id} - if work, _, err := kv.Acquire(p, nil); err != nil { - t.Fatalf("err: %v", err) - } else if !work { - t.Fatalf("Lock failure") - } - - // Get should work - pair, meta, err := kv.Get(key, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if pair == nil { - t.Fatalf("expected value: %#v", pair) - } - if pair.LockIndex != 1 { - t.Fatalf("Expected lock: %v", pair) - } - if pair.Session != id { - t.Fatalf("Expected lock: %v", pair) - } - if meta.LastIndex == 0 { - t.Fatalf("unexpected value: %#v", meta) - } - - // Release - if work, _, err := kv.Release(p, nil); err != nil { - t.Fatalf("err: %v", err) - } else if !work { - t.Fatalf("Release fail") - } - - // Get should work - pair, meta, err = kv.Get(key, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if pair == nil { - t.Fatalf("expected value: %#v", pair) - } - if pair.LockIndex != 1 { - t.Fatalf("Expected lock: %v", pair) - } - if pair.Session != "" { - t.Fatalf("Expected unlock: %v", pair) - } - if meta.LastIndex == 0 { - t.Fatalf("unexpected value: %#v", meta) - } -} diff --git a/vendor/github.com/hashicorp/consul/api/lock_test.go b/vendor/github.com/hashicorp/consul/api/lock_test.go deleted file mode 100644 index 5cc74e19c3..0000000000 --- a/vendor/github.com/hashicorp/consul/api/lock_test.go +++ /dev/null @@ -1,560 +0,0 @@ -package api - -import ( - "log" - "net/http" - "net/http/httptest" - "net/http/httputil" - "strings" - "sync" - "testing" - "time" -) - -func TestLock_LockUnlock(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - lock, err := c.LockKey("test/lock") - if err != nil { - t.Fatalf("err: %v", err) - } - - // Initial unlock should fail - err = lock.Unlock() - if err != ErrLockNotHeld { - t.Fatalf("err: %v", err) - } - - // Should work - leaderCh, err := lock.Lock(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if leaderCh == nil { - t.Fatalf("not leader") - } - - // Double lock should fail - _, err = lock.Lock(nil) - if err != ErrLockHeld { - t.Fatalf("err: %v", err) - } - - // Should be leader - select { - case <-leaderCh: - t.Fatalf("should be leader") - default: - } - - // Initial unlock should work - err = lock.Unlock() - if err != nil { - t.Fatalf("err: %v", err) - } - - // Double unlock should fail - err = lock.Unlock() - if err != ErrLockNotHeld { - t.Fatalf("err: %v", err) - } - - // Should lose leadership - select { - case <-leaderCh: - case <-time.After(time.Second): - t.Fatalf("should not be leader") - } -} - -func TestLock_ForceInvalidate(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - lock, err := c.LockKey("test/lock") - if err != nil { - t.Fatalf("err: %v", err) - } - - // Should work - leaderCh, err := lock.Lock(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if leaderCh == nil { - t.Fatalf("not leader") - } - defer lock.Unlock() - - go func() { - // Nuke the session, simulator an operator invalidation - // or a health check failure - session := c.Session() - session.Destroy(lock.lockSession, nil) - }() - - // Should loose leadership - select { - case <-leaderCh: - case <-time.After(time.Second): - t.Fatalf("should not be leader") - } -} - -func TestLock_DeleteKey(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - // This uncovered some issues around special-case handling of low index - // numbers where it would work with a low number but fail for higher - // ones, so we loop this a bit to sweep the index up out of that - // territory. - for i := 0; i < 10; i++ { - func() { - lock, err := c.LockKey("test/lock") - if err != nil { - t.Fatalf("err: %v", err) - } - - // Should work - leaderCh, err := lock.Lock(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if leaderCh == nil { - t.Fatalf("not leader") - } - defer lock.Unlock() - - go func() { - // Nuke the key, simulate an operator intervention - kv := c.KV() - kv.Delete("test/lock", nil) - }() - - // Should loose leadership - select { - case <-leaderCh: - case <-time.After(time.Second): - t.Fatalf("should not be leader") - } - }() - } -} - -func TestLock_Contend(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - wg := &sync.WaitGroup{} - acquired := make([]bool, 3) - for idx := range acquired { - wg.Add(1) - go func(idx int) { - defer wg.Done() - lock, err := c.LockKey("test/lock") - if err != nil { - t.Fatalf("err: %v", err) - } - - // Should work eventually, will contend - leaderCh, err := lock.Lock(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if leaderCh == nil { - t.Fatalf("not leader") - } - defer lock.Unlock() - log.Printf("Contender %d acquired", idx) - - // Set acquired and then leave - acquired[idx] = true - }(idx) - } - - // Wait for termination - doneCh := make(chan struct{}) - go func() { - wg.Wait() - close(doneCh) - }() - - // Wait for everybody to get a turn - select { - case <-doneCh: - case <-time.After(3 * DefaultLockRetryTime): - t.Fatalf("timeout") - } - - for idx, did := range acquired { - if !did { - t.Fatalf("contender %d never acquired", idx) - } - } -} - -func TestLock_Destroy(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - lock, err := c.LockKey("test/lock") - if err != nil { - t.Fatalf("err: %v", err) - } - - // Should work - leaderCh, err := lock.Lock(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if leaderCh == nil { - t.Fatalf("not leader") - } - - // Destroy should fail - if err := lock.Destroy(); err != ErrLockHeld { - t.Fatalf("err: %v", err) - } - - // Should be able to release - err = lock.Unlock() - if err != nil { - t.Fatalf("err: %v", err) - } - - // Acquire with a different lock - l2, err := c.LockKey("test/lock") - if err != nil { - t.Fatalf("err: %v", err) - } - - // Should work - leaderCh, err = l2.Lock(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if leaderCh == nil { - t.Fatalf("not leader") - } - - // Destroy should still fail - if err := lock.Destroy(); err != ErrLockInUse { - t.Fatalf("err: %v", err) - } - - // Should release - err = l2.Unlock() - if err != nil { - t.Fatalf("err: %v", err) - } - - // Destroy should work - err = lock.Destroy() - if err != nil { - t.Fatalf("err: %v", err) - } - - // Double destroy should work - err = l2.Destroy() - if err != nil { - t.Fatalf("err: %v", err) - } -} - -func TestLock_Conflict(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - sema, err := c.SemaphorePrefix("test/lock/", 2) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Should work - lockCh, err := sema.Acquire(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if lockCh == nil { - t.Fatalf("not hold") - } - defer sema.Release() - - lock, err := c.LockKey("test/lock/.lock") - if err != nil { - t.Fatalf("err: %v", err) - } - - // Should conflict with semaphore - _, err = lock.Lock(nil) - if err != ErrLockConflict { - t.Fatalf("err: %v", err) - } - - // Should conflict with semaphore - err = lock.Destroy() - if err != ErrLockConflict { - t.Fatalf("err: %v", err) - } -} - -func TestLock_ReclaimLock(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - session, _, err := c.Session().Create(&SessionEntry{}, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - lock, err := c.LockOpts(&LockOptions{Key: "test/lock", Session: session}) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Should work - leaderCh, err := lock.Lock(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if leaderCh == nil { - t.Fatalf("not leader") - } - defer lock.Unlock() - - l2, err := c.LockOpts(&LockOptions{Key: "test/lock", Session: session}) - if err != nil { - t.Fatalf("err: %v", err) - } - - reclaimed := make(chan (<-chan struct{}), 1) - go func() { - l2Ch, err := l2.Lock(nil) - if err != nil { - t.Fatalf("not locked: %v", err) - } - reclaimed <- l2Ch - }() - - // Should reclaim the lock - var leader2Ch <-chan struct{} - - select { - case leader2Ch = <-reclaimed: - case <-time.After(time.Second): - t.Fatalf("should have locked") - } - - // unlock should work - err = l2.Unlock() - if err != nil { - t.Fatalf("err: %v", err) - } - - //Both locks should see the unlock - select { - case <-leader2Ch: - case <-time.After(time.Second): - t.Fatalf("should not be leader") - } - - select { - case <-leaderCh: - case <-time.After(time.Second): - t.Fatalf("should not be leader") - } -} - -func TestLock_MonitorRetry(t *testing.T) { - t.Parallel() - raw, s := makeClient(t) - defer s.Stop() - - // Set up a server that always responds with 500 errors. - failer := func(w http.ResponseWriter, req *http.Request) { - w.WriteHeader(500) - } - outage := httptest.NewServer(http.HandlerFunc(failer)) - defer outage.Close() - - // Set up a reverse proxy that will send some requests to the - // 500 server and pass everything else through to the real Consul - // server. - var mutex sync.Mutex - errors := 0 - director := func(req *http.Request) { - mutex.Lock() - defer mutex.Unlock() - - req.URL.Scheme = "http" - if errors > 0 && req.Method == "GET" && strings.Contains(req.URL.Path, "/v1/kv/test/lock") { - req.URL.Host = outage.URL[7:] // Strip off "http://". - errors-- - } else { - req.URL.Host = raw.config.Address - } - } - proxy := httptest.NewServer(&httputil.ReverseProxy{Director: director}) - defer proxy.Close() - - // Make another client that points at the proxy instead of the real - // Consul server. - config := raw.config - config.Address = proxy.URL[7:] // Strip off "http://". - c, err := NewClient(&config) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Set up a lock with retries enabled. - opts := &LockOptions{ - Key: "test/lock", - SessionTTL: "60s", - MonitorRetries: 3, - } - lock, err := c.LockOpts(opts) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Make sure the default got set. - if lock.opts.MonitorRetryTime != DefaultMonitorRetryTime { - t.Fatalf("bad: %d", lock.opts.MonitorRetryTime) - } - - // Now set a custom time for the test. - opts.MonitorRetryTime = 250 * time.Millisecond - lock, err = c.LockOpts(opts) - if err != nil { - t.Fatalf("err: %v", err) - } - if lock.opts.MonitorRetryTime != 250*time.Millisecond { - t.Fatalf("bad: %d", lock.opts.MonitorRetryTime) - } - - // Should get the lock. - leaderCh, err := lock.Lock(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if leaderCh == nil { - t.Fatalf("not leader") - } - - // Poke the key using the raw client to force the monitor to wake up - // and check the lock again. This time we will return errors for some - // of the responses. - mutex.Lock() - errors = 2 - mutex.Unlock() - pair, _, err := raw.KV().Get("test/lock", &QueryOptions{}) - if err != nil { - t.Fatalf("err: %v", err) - } - if _, err := raw.KV().Put(pair, &WriteOptions{}); err != nil { - t.Fatalf("err: %v", err) - } - time.Sleep(5 * opts.MonitorRetryTime) - - // Should still be the leader. - select { - case <-leaderCh: - t.Fatalf("should be leader") - default: - } - - // Now return an overwhelming number of errors. - mutex.Lock() - errors = 10 - mutex.Unlock() - if _, err := raw.KV().Put(pair, &WriteOptions{}); err != nil { - t.Fatalf("err: %v", err) - } - time.Sleep(5 * opts.MonitorRetryTime) - - // Should lose leadership. - select { - case <-leaderCh: - case <-time.After(time.Second): - t.Fatalf("should not be leader") - } -} - -func TestLock_OneShot(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - // Set up a lock as a one-shot. - opts := &LockOptions{ - Key: "test/lock", - LockTryOnce: true, - } - lock, err := c.LockOpts(opts) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Make sure the default got set. - if lock.opts.LockWaitTime != DefaultLockWaitTime { - t.Fatalf("bad: %d", lock.opts.LockWaitTime) - } - - // Now set a custom time for the test. - opts.LockWaitTime = 250 * time.Millisecond - lock, err = c.LockOpts(opts) - if err != nil { - t.Fatalf("err: %v", err) - } - if lock.opts.LockWaitTime != 250*time.Millisecond { - t.Fatalf("bad: %d", lock.opts.LockWaitTime) - } - - // Should get the lock. - ch, err := lock.Lock(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if ch == nil { - t.Fatalf("not leader") - } - - // Now try with another session. - contender, err := c.LockOpts(opts) - if err != nil { - t.Fatalf("err: %v", err) - } - start := time.Now() - ch, err = contender.Lock(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if ch != nil { - t.Fatalf("should not be leader") - } - diff := time.Now().Sub(start) - if diff < contender.opts.LockWaitTime || diff > 2*contender.opts.LockWaitTime { - t.Fatalf("time out of bounds: %9.6f", diff.Seconds()) - } - - // Unlock and then make sure the contender can get it. - if err := lock.Unlock(); err != nil { - t.Fatalf("err: %v", err) - } - ch, err = contender.Lock(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if ch == nil { - t.Fatalf("should be leader") - } -} diff --git a/vendor/github.com/hashicorp/consul/api/prepared_query_test.go b/vendor/github.com/hashicorp/consul/api/prepared_query_test.go deleted file mode 100644 index 011bfb195d..0000000000 --- a/vendor/github.com/hashicorp/consul/api/prepared_query_test.go +++ /dev/null @@ -1,123 +0,0 @@ -package api - -import ( - "reflect" - "testing" - - "github.com/hashicorp/consul/testutil" -) - -func TestPreparedQuery(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - // Set up a node and a service. - reg := &CatalogRegistration{ - Datacenter: "dc1", - Node: "foobar", - Address: "192.168.10.10", - Service: &AgentService{ - ID: "redis1", - Service: "redis", - Tags: []string{"master", "v1"}, - Port: 8000, - }, - } - - catalog := c.Catalog() - testutil.WaitForResult(func() (bool, error) { - if _, err := catalog.Register(reg, nil); err != nil { - return false, err - } - - if _, _, err := catalog.Node("foobar", nil); err != nil { - return false, err - } - - return true, nil - }, func(err error) { - t.Fatalf("err: %s", err) - }) - - // Create a simple prepared query. - def := &PreparedQueryDefinition{ - Service: ServiceQuery{ - Service: "redis", - }, - } - - query := c.PreparedQuery() - var err error - def.ID, _, err = query.Create(def, nil) - if err != nil { - t.Fatalf("err: %s", err) - } - - // Read it back. - defs, _, err := query.Get(def.ID, nil) - if err != nil { - t.Fatalf("err: %s", err) - } - if len(defs) != 1 || !reflect.DeepEqual(defs[0], def) { - t.Fatalf("bad: %v", defs) - } - - // List them all. - defs, _, err = query.List(nil) - if err != nil { - t.Fatalf("err: %s", err) - } - if len(defs) != 1 || !reflect.DeepEqual(defs[0], def) { - t.Fatalf("bad: %v", defs) - } - - // Make an update. - def.Name = "my-query" - _, err = query.Update(def, nil) - if err != nil { - t.Fatalf("err: %s", err) - } - - // Read it back again to verify the update worked. - defs, _, err = query.Get(def.ID, nil) - if err != nil { - t.Fatalf("err: %s", err) - } - if len(defs) != 1 || !reflect.DeepEqual(defs[0], def) { - t.Fatalf("bad: %v", defs) - } - - // Execute by ID. - results, _, err := query.Execute(def.ID, nil) - if err != nil { - t.Fatalf("err: %s", err) - } - if len(results.Nodes) != 1 || results.Nodes[0].Node.Node != "foobar" { - t.Fatalf("bad: %v", results) - } - - // Execute by name. - results, _, err = query.Execute("my-query", nil) - if err != nil { - t.Fatalf("err: %s", err) - } - if len(results.Nodes) != 1 || results.Nodes[0].Node.Node != "foobar" { - t.Fatalf("bad: %v", results) - } - - // Delete it. - _, err = query.Delete(def.ID, nil) - if err != nil { - t.Fatalf("err: %s", err) - } - - // Make sure there are no longer any queries. - defs, _, err = query.List(nil) - if err != nil { - t.Fatalf("err: %s", err) - } - if len(defs) != 0 { - t.Fatalf("bad: %v", defs) - } -} diff --git a/vendor/github.com/hashicorp/consul/api/semaphore_test.go b/vendor/github.com/hashicorp/consul/api/semaphore_test.go deleted file mode 100644 index 4cec164f4e..0000000000 --- a/vendor/github.com/hashicorp/consul/api/semaphore_test.go +++ /dev/null @@ -1,518 +0,0 @@ -package api - -import ( - "log" - "net/http" - "net/http/httptest" - "net/http/httputil" - "strings" - "sync" - "testing" - "time" -) - -func TestSemaphore_AcquireRelease(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - sema, err := c.SemaphorePrefix("test/semaphore", 2) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Initial release should fail - err = sema.Release() - if err != ErrSemaphoreNotHeld { - t.Fatalf("err: %v", err) - } - - // Should work - lockCh, err := sema.Acquire(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if lockCh == nil { - t.Fatalf("not hold") - } - - // Double lock should fail - _, err = sema.Acquire(nil) - if err != ErrSemaphoreHeld { - t.Fatalf("err: %v", err) - } - - // Should be held - select { - case <-lockCh: - t.Fatalf("should be held") - default: - } - - // Initial release should work - err = sema.Release() - if err != nil { - t.Fatalf("err: %v", err) - } - - // Double unlock should fail - err = sema.Release() - if err != ErrSemaphoreNotHeld { - t.Fatalf("err: %v", err) - } - - // Should lose resource - select { - case <-lockCh: - case <-time.After(time.Second): - t.Fatalf("should not be held") - } -} - -func TestSemaphore_ForceInvalidate(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - sema, err := c.SemaphorePrefix("test/semaphore", 2) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Should work - lockCh, err := sema.Acquire(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if lockCh == nil { - t.Fatalf("not acquired") - } - defer sema.Release() - - go func() { - // Nuke the session, simulator an operator invalidation - // or a health check failure - session := c.Session() - session.Destroy(sema.lockSession, nil) - }() - - // Should loose slot - select { - case <-lockCh: - case <-time.After(time.Second): - t.Fatalf("should not be locked") - } -} - -func TestSemaphore_DeleteKey(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - sema, err := c.SemaphorePrefix("test/semaphore", 2) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Should work - lockCh, err := sema.Acquire(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if lockCh == nil { - t.Fatalf("not locked") - } - defer sema.Release() - - go func() { - // Nuke the key, simulate an operator intervention - kv := c.KV() - kv.DeleteTree("test/semaphore", nil) - }() - - // Should loose leadership - select { - case <-lockCh: - case <-time.After(time.Second): - t.Fatalf("should not be locked") - } -} - -func TestSemaphore_Contend(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - wg := &sync.WaitGroup{} - acquired := make([]bool, 4) - for idx := range acquired { - wg.Add(1) - go func(idx int) { - defer wg.Done() - sema, err := c.SemaphorePrefix("test/semaphore", 2) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Should work eventually, will contend - lockCh, err := sema.Acquire(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if lockCh == nil { - t.Fatalf("not locked") - } - defer sema.Release() - log.Printf("Contender %d acquired", idx) - - // Set acquired and then leave - acquired[idx] = true - }(idx) - } - - // Wait for termination - doneCh := make(chan struct{}) - go func() { - wg.Wait() - close(doneCh) - }() - - // Wait for everybody to get a turn - select { - case <-doneCh: - case <-time.After(3 * DefaultLockRetryTime): - t.Fatalf("timeout") - } - - for idx, did := range acquired { - if !did { - t.Fatalf("contender %d never acquired", idx) - } - } -} - -func TestSemaphore_BadLimit(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - sema, err := c.SemaphorePrefix("test/semaphore", 0) - if err == nil { - t.Fatalf("should error") - } - - sema, err = c.SemaphorePrefix("test/semaphore", 1) - if err != nil { - t.Fatalf("err: %v", err) - } - - _, err = sema.Acquire(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - sema2, err := c.SemaphorePrefix("test/semaphore", 2) - if err != nil { - t.Fatalf("err: %v", err) - } - - _, err = sema2.Acquire(nil) - if err.Error() != "semaphore limit conflict (lock: 1, local: 2)" { - t.Fatalf("err: %v", err) - } -} - -func TestSemaphore_Destroy(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - sema, err := c.SemaphorePrefix("test/semaphore", 2) - if err != nil { - t.Fatalf("err: %v", err) - } - - sema2, err := c.SemaphorePrefix("test/semaphore", 2) - if err != nil { - t.Fatalf("err: %v", err) - } - - _, err = sema.Acquire(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - _, err = sema2.Acquire(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Destroy should fail, still held - if err := sema.Destroy(); err != ErrSemaphoreHeld { - t.Fatalf("err: %v", err) - } - - err = sema.Release() - if err != nil { - t.Fatalf("err: %v", err) - } - - // Destroy should fail, still in use - if err := sema.Destroy(); err != ErrSemaphoreInUse { - t.Fatalf("err: %v", err) - } - - err = sema2.Release() - if err != nil { - t.Fatalf("err: %v", err) - } - - // Destroy should work - if err := sema.Destroy(); err != nil { - t.Fatalf("err: %v", err) - } - - // Destroy should work - if err := sema2.Destroy(); err != nil { - t.Fatalf("err: %v", err) - } -} - -func TestSemaphore_Conflict(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - lock, err := c.LockKey("test/sema/.lock") - if err != nil { - t.Fatalf("err: %v", err) - } - - // Should work - leaderCh, err := lock.Lock(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if leaderCh == nil { - t.Fatalf("not leader") - } - defer lock.Unlock() - - sema, err := c.SemaphorePrefix("test/sema/", 2) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Should conflict with lock - _, err = sema.Acquire(nil) - if err != ErrSemaphoreConflict { - t.Fatalf("err: %v", err) - } - - // Should conflict with lock - err = sema.Destroy() - if err != ErrSemaphoreConflict { - t.Fatalf("err: %v", err) - } -} - -func TestSemaphore_MonitorRetry(t *testing.T) { - t.Parallel() - raw, s := makeClient(t) - defer s.Stop() - - // Set up a server that always responds with 500 errors. - failer := func(w http.ResponseWriter, req *http.Request) { - w.WriteHeader(500) - } - outage := httptest.NewServer(http.HandlerFunc(failer)) - defer outage.Close() - - // Set up a reverse proxy that will send some requests to the - // 500 server and pass everything else through to the real Consul - // server. - var mutex sync.Mutex - errors := 0 - director := func(req *http.Request) { - mutex.Lock() - defer mutex.Unlock() - - req.URL.Scheme = "http" - if errors > 0 && req.Method == "GET" && strings.Contains(req.URL.Path, "/v1/kv/test/sema/.lock") { - req.URL.Host = outage.URL[7:] // Strip off "http://". - errors-- - } else { - req.URL.Host = raw.config.Address - } - } - proxy := httptest.NewServer(&httputil.ReverseProxy{Director: director}) - defer proxy.Close() - - // Make another client that points at the proxy instead of the real - // Consul server. - config := raw.config - config.Address = proxy.URL[7:] // Strip off "http://". - c, err := NewClient(&config) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Set up a lock with retries enabled. - opts := &SemaphoreOptions{ - Prefix: "test/sema/.lock", - Limit: 2, - SessionTTL: "60s", - MonitorRetries: 3, - } - sema, err := c.SemaphoreOpts(opts) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Make sure the default got set. - if sema.opts.MonitorRetryTime != DefaultMonitorRetryTime { - t.Fatalf("bad: %d", sema.opts.MonitorRetryTime) - } - - // Now set a custom time for the test. - opts.MonitorRetryTime = 250 * time.Millisecond - sema, err = c.SemaphoreOpts(opts) - if err != nil { - t.Fatalf("err: %v", err) - } - if sema.opts.MonitorRetryTime != 250*time.Millisecond { - t.Fatalf("bad: %d", sema.opts.MonitorRetryTime) - } - - // Should get the lock. - ch, err := sema.Acquire(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if ch == nil { - t.Fatalf("didn't acquire") - } - - // Take the semaphore using the raw client to force the monitor to wake - // up and check the lock again. This time we will return errors for some - // of the responses. - mutex.Lock() - errors = 2 - mutex.Unlock() - another, err := raw.SemaphoreOpts(opts) - if err != nil { - t.Fatalf("err: %v", err) - } - if _, err := another.Acquire(nil); err != nil { - t.Fatalf("err: %v", err) - } - time.Sleep(5 * opts.MonitorRetryTime) - - // Should still have the semaphore. - select { - case <-ch: - t.Fatalf("lost the semaphore") - default: - } - - // Now return an overwhelming number of errors, using the raw client to - // poke the key and get the monitor to run again. - mutex.Lock() - errors = 10 - mutex.Unlock() - if err := another.Release(); err != nil { - t.Fatalf("err: %v", err) - } - time.Sleep(5 * opts.MonitorRetryTime) - - // Should lose the semaphore. - select { - case <-ch: - case <-time.After(time.Second): - t.Fatalf("should not have the semaphore") - } -} - -func TestSemaphore_OneShot(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - // Set up a semaphore as a one-shot. - opts := &SemaphoreOptions{ - Prefix: "test/sema/.lock", - Limit: 2, - SemaphoreTryOnce: true, - } - sema, err := c.SemaphoreOpts(opts) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Make sure the default got set. - if sema.opts.SemaphoreWaitTime != DefaultSemaphoreWaitTime { - t.Fatalf("bad: %d", sema.opts.SemaphoreWaitTime) - } - - // Now set a custom time for the test. - opts.SemaphoreWaitTime = 250 * time.Millisecond - sema, err = c.SemaphoreOpts(opts) - if err != nil { - t.Fatalf("err: %v", err) - } - if sema.opts.SemaphoreWaitTime != 250*time.Millisecond { - t.Fatalf("bad: %d", sema.opts.SemaphoreWaitTime) - } - - // Should acquire the semaphore. - ch, err := sema.Acquire(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if ch == nil { - t.Fatalf("should have acquired the semaphore") - } - - // Try with another session. - another, err := c.SemaphoreOpts(opts) - if err != nil { - t.Fatalf("err: %v", err) - } - ch, err = another.Acquire(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if ch == nil { - t.Fatalf("should have acquired the semaphore") - } - - // Try with a third one that shouldn't get it. - contender, err := c.SemaphoreOpts(opts) - if err != nil { - t.Fatalf("err: %v", err) - } - start := time.Now() - ch, err = contender.Acquire(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if ch != nil { - t.Fatalf("should not have acquired the semaphore") - } - diff := time.Now().Sub(start) - if diff < contender.opts.SemaphoreWaitTime || diff > 2*contender.opts.SemaphoreWaitTime { - t.Fatalf("time out of bounds: %9.6f", diff.Seconds()) - } - - // Give up a slot and make sure the third one can get it. - if err := another.Release(); err != nil { - t.Fatalf("err: %v", err) - } - ch, err = contender.Acquire(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if ch == nil { - t.Fatalf("should have acquired the semaphore") - } -} diff --git a/vendor/github.com/hashicorp/consul/api/session_test.go b/vendor/github.com/hashicorp/consul/api/session_test.go deleted file mode 100644 index 85bea228e6..0000000000 --- a/vendor/github.com/hashicorp/consul/api/session_test.go +++ /dev/null @@ -1,314 +0,0 @@ -package api - -import ( - "testing" - "time" -) - -func TestSession_CreateDestroy(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - session := c.Session() - - id, meta, err := session.Create(nil, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if meta.RequestTime == 0 { - t.Fatalf("bad: %v", meta) - } - - if id == "" { - t.Fatalf("invalid: %v", id) - } - - meta, err = session.Destroy(id, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if meta.RequestTime == 0 { - t.Fatalf("bad: %v", meta) - } -} - -func TestSession_CreateRenewDestroy(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - session := c.Session() - - se := &SessionEntry{ - TTL: "10s", - } - - id, meta, err := session.Create(se, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - defer session.Destroy(id, nil) - - if meta.RequestTime == 0 { - t.Fatalf("bad: %v", meta) - } - - if id == "" { - t.Fatalf("invalid: %v", id) - } - - if meta.RequestTime == 0 { - t.Fatalf("bad: %v", meta) - } - - renew, meta, err := session.Renew(id, nil) - - if err != nil { - t.Fatalf("err: %v", err) - } - if meta.RequestTime == 0 { - t.Fatalf("bad: %v", meta) - } - - if renew == nil { - t.Fatalf("should get session") - } - - if renew.ID != id { - t.Fatalf("should have matching id") - } - - if renew.TTL != "10s" { - t.Fatalf("should get session with TTL") - } -} - -func TestSession_CreateRenewDestroyRenew(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - session := c.Session() - - entry := &SessionEntry{ - Behavior: SessionBehaviorDelete, - TTL: "500s", // disable ttl - } - - id, meta, err := session.Create(entry, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if meta.RequestTime == 0 { - t.Fatalf("bad: %v", meta) - } - - if id == "" { - t.Fatalf("invalid: %v", id) - } - - // Extend right after create. Everything should be fine. - entry, _, err = session.Renew(id, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if entry == nil { - t.Fatal("session unexpectedly vanished") - } - - // Simulate TTL loss by manually destroying the session. - meta, err = session.Destroy(id, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if meta.RequestTime == 0 { - t.Fatalf("bad: %v", meta) - } - - // Extend right after delete. The 404 should proxy as a nil. - entry, _, err = session.Renew(id, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - if entry != nil { - t.Fatal("session still exists") - } -} - -func TestSession_CreateDestroyRenewPeriodic(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - session := c.Session() - - entry := &SessionEntry{ - Behavior: SessionBehaviorDelete, - TTL: "500s", // disable ttl - } - - id, meta, err := session.Create(entry, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if meta.RequestTime == 0 { - t.Fatalf("bad: %v", meta) - } - - if id == "" { - t.Fatalf("invalid: %v", id) - } - - // This only tests Create/Destroy/RenewPeriodic to avoid the more - // difficult case of testing all of the timing code. - - // Simulate TTL loss by manually destroying the session. - meta, err = session.Destroy(id, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if meta.RequestTime == 0 { - t.Fatalf("bad: %v", meta) - } - - // Extend right after delete. The 404 should terminate the loop quickly and return ErrSessionExpired. - errCh := make(chan error, 1) - doneCh := make(chan struct{}) - go func() { errCh <- session.RenewPeriodic("1s", id, nil, doneCh) }() - defer close(doneCh) - - select { - case <-time.After(1 * time.Second): - t.Fatal("timedout: missing session did not terminate renewal loop") - case err = <-errCh: - if err != ErrSessionExpired { - t.Fatalf("err: %v", err) - } - } -} - -func TestSession_Info(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - session := c.Session() - - id, _, err := session.Create(nil, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - defer session.Destroy(id, nil) - - info, qm, err := session.Info(id, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if qm.LastIndex == 0 { - t.Fatalf("bad: %v", qm) - } - if !qm.KnownLeader { - t.Fatalf("bad: %v", qm) - } - - if info == nil { - t.Fatalf("should get session") - } - if info.CreateIndex == 0 { - t.Fatalf("bad: %v", info) - } - if info.ID != id { - t.Fatalf("bad: %v", info) - } - if info.Name != "" { - t.Fatalf("bad: %v", info) - } - if info.Node == "" { - t.Fatalf("bad: %v", info) - } - if len(info.Checks) == 0 { - t.Fatalf("bad: %v", info) - } - if info.LockDelay == 0 { - t.Fatalf("bad: %v", info) - } - if info.Behavior != "release" { - t.Fatalf("bad: %v", info) - } - if info.TTL != "" { - t.Fatalf("bad: %v", info) - } -} - -func TestSession_Node(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - session := c.Session() - - id, _, err := session.Create(nil, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - defer session.Destroy(id, nil) - - info, qm, err := session.Info(id, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - sessions, qm, err := session.Node(info.Node, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if len(sessions) != 1 { - t.Fatalf("bad: %v", sessions) - } - - if qm.LastIndex == 0 { - t.Fatalf("bad: %v", qm) - } - if !qm.KnownLeader { - t.Fatalf("bad: %v", qm) - } -} - -func TestSession_List(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - session := c.Session() - - id, _, err := session.Create(nil, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - defer session.Destroy(id, nil) - - sessions, qm, err := session.List(nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - if len(sessions) != 1 { - t.Fatalf("bad: %v", sessions) - } - - if qm.LastIndex == 0 { - t.Fatalf("bad: %v", qm) - } - if !qm.KnownLeader { - t.Fatalf("bad: %v", qm) - } -} diff --git a/vendor/github.com/hashicorp/consul/api/status_test.go b/vendor/github.com/hashicorp/consul/api/status_test.go deleted file mode 100644 index 62dc1550ff..0000000000 --- a/vendor/github.com/hashicorp/consul/api/status_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package api - -import ( - "testing" -) - -func TestStatusLeader(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - status := c.Status() - - leader, err := status.Leader() - if err != nil { - t.Fatalf("err: %v", err) - } - if leader == "" { - t.Fatalf("Expected leader") - } -} - -func TestStatusPeers(t *testing.T) { - t.Parallel() - c, s := makeClient(t) - defer s.Stop() - - status := c.Status() - - peers, err := status.Peers() - if err != nil { - t.Fatalf("err: %v", err) - } - if len(peers) == 0 { - t.Fatalf("Expected peers ") - } -} diff --git a/vendor/github.com/hashicorp/consul/website/LICENSE.md b/vendor/github.com/hashicorp/consul/website/LICENSE.md new file mode 100644 index 0000000000..ac2c064678 --- /dev/null +++ b/vendor/github.com/hashicorp/consul/website/LICENSE.md @@ -0,0 +1,10 @@ +# Proprietary License + +This license is temporary while a more official one is drafted. However, +this should make it clear: + +* The text contents of this website are MPL 2.0 licensed. + +* The design contents of this website are proprietary and may not be reproduced + or reused in any way other than to run the Consul website locally. The license + for the design is owned solely by HashiCorp, Inc. diff --git a/vendor/github.com/hashicorp/errwrap/errwrap_test.go b/vendor/github.com/hashicorp/errwrap/errwrap_test.go deleted file mode 100644 index 5ae5f8e3cd..0000000000 --- a/vendor/github.com/hashicorp/errwrap/errwrap_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package errwrap - -import ( - "fmt" - "testing" -) - -func TestWrappedError_impl(t *testing.T) { - var _ error = new(wrappedError) -} - -func TestGetAll(t *testing.T) { - cases := []struct { - Err error - Msg string - Len int - }{ - {}, - { - fmt.Errorf("foo"), - "foo", - 1, - }, - { - fmt.Errorf("bar"), - "foo", - 0, - }, - { - Wrapf("bar", fmt.Errorf("foo")), - "foo", - 1, - }, - { - Wrapf("{{err}}", fmt.Errorf("foo")), - "foo", - 2, - }, - { - Wrapf("bar", Wrapf("baz", fmt.Errorf("foo"))), - "foo", - 1, - }, - } - - for i, tc := range cases { - actual := GetAll(tc.Err, tc.Msg) - if len(actual) != tc.Len { - t.Fatalf("%d: bad: %#v", i, actual) - } - for _, v := range actual { - if v.Error() != tc.Msg { - t.Fatalf("%d: bad: %#v", i, actual) - } - } - } -} - -func TestGetAllType(t *testing.T) { - cases := []struct { - Err error - Type interface{} - Len int - }{ - {}, - { - fmt.Errorf("foo"), - "foo", - 0, - }, - { - fmt.Errorf("bar"), - fmt.Errorf("foo"), - 1, - }, - { - Wrapf("bar", fmt.Errorf("foo")), - fmt.Errorf("baz"), - 2, - }, - { - Wrapf("bar", Wrapf("baz", fmt.Errorf("foo"))), - Wrapf("", nil), - 0, - }, - } - - for i, tc := range cases { - actual := GetAllType(tc.Err, tc.Type) - if len(actual) != tc.Len { - t.Fatalf("%d: bad: %#v", i, actual) - } - } -} diff --git a/vendor/github.com/hashicorp/go-checkpoint/checkpoint_test.go b/vendor/github.com/hashicorp/go-checkpoint/checkpoint_test.go deleted file mode 100644 index 6d0a5addc3..0000000000 --- a/vendor/github.com/hashicorp/go-checkpoint/checkpoint_test.go +++ /dev/null @@ -1,201 +0,0 @@ -package checkpoint - -import ( - "io/ioutil" - "os" - "path/filepath" - "reflect" - "testing" - "time" -) - -func TestCheck(t *testing.T) { - expected := &CheckResponse{ - Product: "test", - CurrentVersion: "1.0", - CurrentReleaseDate: 0, - CurrentDownloadURL: "http://www.hashicorp.com", - CurrentChangelogURL: "http://www.hashicorp.com", - ProjectWebsite: "http://www.hashicorp.com", - Outdated: false, - Alerts: []*CheckAlert{}, - } - - actual, err := Check(&CheckParams{ - Product: "test", - Version: "1.0", - }) - - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("bad: %#v", actual) - } -} - -func TestCheck_disabled(t *testing.T) { - os.Setenv("CHECKPOINT_DISABLE", "1") - defer os.Setenv("CHECKPOINT_DISABLE", "") - - expected := &CheckResponse{} - - actual, err := Check(&CheckParams{ - Product: "test", - Version: "1.0", - }) - - if err != nil { - t.Fatal(err) - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("expected %+v to equal %+v", actual, expected) - } -} - -func TestCheck_cache(t *testing.T) { - dir, err := ioutil.TempDir("", "checkpoint") - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := &CheckResponse{ - Product: "test", - CurrentVersion: "1.0", - CurrentReleaseDate: 0, - CurrentDownloadURL: "http://www.hashicorp.com", - CurrentChangelogURL: "http://www.hashicorp.com", - ProjectWebsite: "http://www.hashicorp.com", - Outdated: false, - Alerts: []*CheckAlert{}, - } - - var actual *CheckResponse - for i := 0; i < 5; i++ { - var err error - actual, err = Check(&CheckParams{ - Product: "test", - Version: "1.0", - CacheFile: filepath.Join(dir, "cache"), - }) - if err != nil { - t.Fatalf("err: %s", err) - } - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("bad: %#v", actual) - } -} - -func TestCheck_cacheNested(t *testing.T) { - dir, err := ioutil.TempDir("", "checkpoint") - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := &CheckResponse{ - Product: "test", - CurrentVersion: "1.0", - CurrentReleaseDate: 0, - CurrentDownloadURL: "http://www.hashicorp.com", - CurrentChangelogURL: "http://www.hashicorp.com", - ProjectWebsite: "http://www.hashicorp.com", - Outdated: false, - Alerts: []*CheckAlert{}, - } - - var actual *CheckResponse - for i := 0; i < 5; i++ { - var err error - actual, err = Check(&CheckParams{ - Product: "test", - Version: "1.0", - CacheFile: filepath.Join(dir, "nested", "cache"), - }) - if err != nil { - t.Fatalf("err: %s", err) - } - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("bad: %#v", actual) - } -} - -func TestCheckInterval(t *testing.T) { - expected := &CheckResponse{ - Product: "test", - CurrentVersion: "1.0", - CurrentReleaseDate: 0, - CurrentDownloadURL: "http://www.hashicorp.com", - CurrentChangelogURL: "http://www.hashicorp.com", - ProjectWebsite: "http://www.hashicorp.com", - Outdated: false, - Alerts: []*CheckAlert{}, - } - - params := &CheckParams{ - Product: "test", - Version: "1.0", - } - - calledCh := make(chan struct{}) - checkFn := func(actual *CheckResponse, err error) { - defer close(calledCh) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("bad: %#v", actual) - } - } - - doneCh := CheckInterval(params, 500*time.Millisecond, checkFn) - defer close(doneCh) - - select { - case <-calledCh: - case <-time.After(time.Second): - t.Fatalf("timeout") - } -} - -func TestCheckInterval_disabled(t *testing.T) { - os.Setenv("CHECKPOINT_DISABLE", "1") - defer os.Setenv("CHECKPOINT_DISABLE", "") - - params := &CheckParams{ - Product: "test", - Version: "1.0", - } - - calledCh := make(chan struct{}) - checkFn := func(actual *CheckResponse, err error) { - defer close(calledCh) - } - - doneCh := CheckInterval(params, 500*time.Millisecond, checkFn) - defer close(doneCh) - - select { - case <-calledCh: - t.Fatal("expected callback to not invoke") - case <-time.After(time.Second): - } -} - -func TestRandomStagger(t *testing.T) { - intv := 24 * time.Hour - min := 18 * time.Hour - max := 30 * time.Hour - for i := 0; i < 1000; i++ { - out := randomStagger(intv) - if out < min || out > max { - t.Fatalf("bad: %v", out) - } - } -} diff --git a/vendor/github.com/hashicorp/go-getter/Vagrantfile b/vendor/github.com/hashicorp/go-getter/Vagrantfile deleted file mode 100644 index 74f2ae14f8..0000000000 --- a/vendor/github.com/hashicorp/go-getter/Vagrantfile +++ /dev/null @@ -1,18 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -# All Vagrant configuration is done below. The "2" in Vagrant.configure -# configures the configuration version (we support older styles for -# backwards compatibility). Please don't change it unless you know what -# you're doing. -Vagrant.configure(2) do |config| - config.vm.box = "hashicorp/windows_81" - config.vm.provider "vmware_fusion" do |v| - v.gui = true - v.cpus = 4 - v.memory = 4096 - - # Prevents problems with incorrect ip lookup when using `vagrant ssh` - v.enable_vmrun_ip_lookup = false - end -end diff --git a/vendor/github.com/hashicorp/go-getter/decompress_bzip2_test.go b/vendor/github.com/hashicorp/go-getter/decompress_bzip2_test.go deleted file mode 100644 index 9d49c47ae4..0000000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_bzip2_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package getter - -import ( - "path/filepath" - "testing" -) - -func TestBzip2Decompressor(t *testing.T) { - cases := []TestDecompressCase{ - { - "single.bz2", - false, - false, - nil, - "d3b07384d113edec49eaa6238ad5ff00", - }, - - { - "single.bz2", - true, - true, - nil, - "", - }, - } - - for i, tc := range cases { - cases[i].Input = filepath.Join("./test-fixtures", "decompress-bz2", tc.Input) - } - - TestDecompressor(t, new(Bzip2Decompressor), cases) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_gzip_test.go b/vendor/github.com/hashicorp/go-getter/decompress_gzip_test.go deleted file mode 100644 index 0aa9e27d89..0000000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_gzip_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package getter - -import ( - "path/filepath" - "testing" -) - -func TestGzipDecompressor(t *testing.T) { - cases := []TestDecompressCase{ - { - "single.gz", - false, - false, - nil, - "d3b07384d113edec49eaa6238ad5ff00", - }, - - { - "single.gz", - true, - true, - nil, - "", - }, - } - - for i, tc := range cases { - cases[i].Input = filepath.Join("./test-fixtures", "decompress-gz", tc.Input) - } - - TestDecompressor(t, new(GzipDecompressor), cases) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_tbz2_test.go b/vendor/github.com/hashicorp/go-getter/decompress_tbz2_test.go deleted file mode 100644 index c6fbc52769..0000000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_tbz2_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package getter - -import ( - "path/filepath" - "testing" -) - -func TestTarBzip2Decompressor(t *testing.T) { - cases := []TestDecompressCase{ - { - "empty.tar.bz2", - false, - true, - nil, - "", - }, - - { - "single.tar.bz2", - false, - false, - nil, - "d3b07384d113edec49eaa6238ad5ff00", - }, - - { - "single.tar.bz2", - true, - false, - []string{"file"}, - "", - }, - - { - "multiple.tar.bz2", - true, - false, - []string{"file1", "file2"}, - "", - }, - - { - "multiple.tar.bz2", - false, - true, - nil, - "", - }, - } - - for i, tc := range cases { - cases[i].Input = filepath.Join("./test-fixtures", "decompress-tbz2", tc.Input) - } - - TestDecompressor(t, new(TarBzip2Decompressor), cases) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_tgz_test.go b/vendor/github.com/hashicorp/go-getter/decompress_tgz_test.go deleted file mode 100644 index ce36580b23..0000000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_tgz_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package getter - -import ( - "path/filepath" - "testing" -) - -func TestTarGzipDecompressor(t *testing.T) { - cases := []TestDecompressCase{ - { - "empty.tar.gz", - false, - true, - nil, - "", - }, - - { - "single.tar.gz", - false, - false, - nil, - "d3b07384d113edec49eaa6238ad5ff00", - }, - - { - "single.tar.gz", - true, - false, - []string{"file"}, - "", - }, - - { - "multiple.tar.gz", - true, - false, - []string{"file1", "file2"}, - "", - }, - - { - "multiple.tar.gz", - false, - true, - nil, - "", - }, - } - - for i, tc := range cases { - cases[i].Input = filepath.Join("./test-fixtures", "decompress-tgz", tc.Input) - } - - TestDecompressor(t, new(TarGzipDecompressor), cases) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_zip_test.go b/vendor/github.com/hashicorp/go-getter/decompress_zip_test.go deleted file mode 100644 index fb227cf342..0000000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_zip_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package getter - -import ( - "path/filepath" - "testing" -) - -func TestZipDecompressor(t *testing.T) { - cases := []TestDecompressCase{ - { - "empty.zip", - false, - true, - nil, - "", - }, - - { - "single.zip", - false, - false, - nil, - "d3b07384d113edec49eaa6238ad5ff00", - }, - - { - "single.zip", - true, - false, - []string{"file"}, - "", - }, - - { - "multiple.zip", - true, - false, - []string{"file1", "file2"}, - "", - }, - - { - "multiple.zip", - false, - true, - nil, - "", - }, - } - - for i, tc := range cases { - cases[i].Input = filepath.Join("./test-fixtures", "decompress-zip", tc.Input) - } - - TestDecompressor(t, new(ZipDecompressor), cases) -} diff --git a/vendor/github.com/hashicorp/go-getter/detect_bitbucket_test.go b/vendor/github.com/hashicorp/go-getter/detect_bitbucket_test.go deleted file mode 100644 index 202c932560..0000000000 --- a/vendor/github.com/hashicorp/go-getter/detect_bitbucket_test.go +++ /dev/null @@ -1,67 +0,0 @@ -package getter - -import ( - "net/http" - "strings" - "testing" -) - -const testBBUrl = "https://bitbucket.org/hashicorp/tf-test-git" - -func TestBitBucketDetector(t *testing.T) { - t.Parallel() - - if _, err := http.Get(testBBUrl); err != nil { - t.Log("internet may not be working, skipping BB tests") - t.Skip() - } - - cases := []struct { - Input string - Output string - }{ - // HTTP - { - "bitbucket.org/hashicorp/tf-test-git", - "git::https://bitbucket.org/hashicorp/tf-test-git.git", - }, - { - "bitbucket.org/hashicorp/tf-test-git.git", - "git::https://bitbucket.org/hashicorp/tf-test-git.git", - }, - { - "bitbucket.org/hashicorp/tf-test-hg", - "hg::https://bitbucket.org/hashicorp/tf-test-hg", - }, - } - - pwd := "/pwd" - f := new(BitBucketDetector) - for i, tc := range cases { - var err error - for i := 0; i < 3; i++ { - var output string - var ok bool - output, ok, err = f.Detect(tc.Input, pwd) - if err != nil { - if strings.Contains(err.Error(), "invalid character") { - continue - } - - t.Fatalf("err: %s", err) - } - if !ok { - t.Fatal("not ok") - } - - if output != tc.Output { - t.Fatalf("%d: bad: %#v", i, output) - } - - break - } - if i >= 3 { - t.Fatalf("failure from bitbucket: %s", err) - } - } -} diff --git a/vendor/github.com/hashicorp/go-getter/detect_file_test.go b/vendor/github.com/hashicorp/go-getter/detect_file_test.go deleted file mode 100644 index aa4ff2aaf8..0000000000 --- a/vendor/github.com/hashicorp/go-getter/detect_file_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package getter - -import ( - "runtime" - "testing" -) - -type fileTest struct { - in, pwd, out string - err bool -} - -var fileTests = []fileTest{ - {"./foo", "/pwd", "file:///pwd/foo", false}, - {"./foo?foo=bar", "/pwd", "file:///pwd/foo?foo=bar", false}, - {"foo", "/pwd", "file:///pwd/foo", false}, -} - -var unixFileTests = []fileTest{ - {"/foo", "/pwd", "file:///foo", false}, - {"/foo?bar=baz", "/pwd", "file:///foo?bar=baz", false}, -} - -var winFileTests = []fileTest{ - {"/foo", "/pwd", "file:///pwd/foo", false}, - {`C:\`, `/pwd`, `file://C:/`, false}, - {`C:\?bar=baz`, `/pwd`, `file://C:/?bar=baz`, false}, -} - -func TestFileDetector(t *testing.T) { - if runtime.GOOS == "windows" { - fileTests = append(fileTests, winFileTests...) - } else { - fileTests = append(fileTests, unixFileTests...) - } - - f := new(FileDetector) - for i, tc := range fileTests { - out, ok, err := f.Detect(tc.in, tc.pwd) - if err != nil { - t.Fatalf("err: %s", err) - } - if !ok { - t.Fatal("not ok") - } - - if out != tc.out { - t.Fatalf("%d: bad: %#v", i, out) - } - } -} - -var noPwdFileTests = []fileTest{ - {in: "./foo", pwd: "", out: "", err: true}, - {in: "foo", pwd: "", out: "", err: true}, -} - -var noPwdUnixFileTests = []fileTest{ - {in: "/foo", pwd: "", out: "file:///foo", err: false}, -} - -var noPwdWinFileTests = []fileTest{ - {in: "/foo", pwd: "", out: "", err: true}, - {in: `C:\`, pwd: ``, out: `file://C:/`, err: false}, -} - -func TestFileDetector_noPwd(t *testing.T) { - if runtime.GOOS == "windows" { - noPwdFileTests = append(noPwdFileTests, noPwdWinFileTests...) - } else { - noPwdFileTests = append(noPwdFileTests, noPwdUnixFileTests...) - } - - f := new(FileDetector) - for i, tc := range noPwdFileTests { - out, ok, err := f.Detect(tc.in, tc.pwd) - if err != nil != tc.err { - t.Fatalf("%d: err: %s", i, err) - } - if !ok { - t.Fatal("not ok") - } - - if out != tc.out { - t.Fatalf("%d: bad: %#v", i, out) - } - } -} diff --git a/vendor/github.com/hashicorp/go-getter/detect_github_test.go b/vendor/github.com/hashicorp/go-getter/detect_github_test.go deleted file mode 100644 index 43ed9fcc69..0000000000 --- a/vendor/github.com/hashicorp/go-getter/detect_github_test.go +++ /dev/null @@ -1,55 +0,0 @@ -package getter - -import ( - "testing" -) - -func TestGitHubDetector(t *testing.T) { - cases := []struct { - Input string - Output string - }{ - // HTTP - {"github.com/hashicorp/foo", "git::https://github.com/hashicorp/foo.git"}, - {"github.com/hashicorp/foo.git", "git::https://github.com/hashicorp/foo.git"}, - { - "github.com/hashicorp/foo/bar", - "git::https://github.com/hashicorp/foo.git//bar", - }, - { - "github.com/hashicorp/foo?foo=bar", - "git::https://github.com/hashicorp/foo.git?foo=bar", - }, - { - "github.com/hashicorp/foo.git?foo=bar", - "git::https://github.com/hashicorp/foo.git?foo=bar", - }, - - // SSH - {"git@github.com:hashicorp/foo.git", "git::ssh://git@github.com/hashicorp/foo.git"}, - { - "git@github.com:hashicorp/foo.git//bar", - "git::ssh://git@github.com/hashicorp/foo.git//bar", - }, - { - "git@github.com:hashicorp/foo.git?foo=bar", - "git::ssh://git@github.com/hashicorp/foo.git?foo=bar", - }, - } - - pwd := "/pwd" - f := new(GitHubDetector) - for i, tc := range cases { - output, ok, err := f.Detect(tc.Input, pwd) - if err != nil { - t.Fatalf("err: %s", err) - } - if !ok { - t.Fatal("not ok") - } - - if output != tc.Output { - t.Fatalf("%d: bad: %#v", i, output) - } - } -} diff --git a/vendor/github.com/hashicorp/go-getter/detect_s3_test.go b/vendor/github.com/hashicorp/go-getter/detect_s3_test.go deleted file mode 100644 index f410c785c1..0000000000 --- a/vendor/github.com/hashicorp/go-getter/detect_s3_test.go +++ /dev/null @@ -1,84 +0,0 @@ -package getter - -import ( - "testing" -) - -func TestS3Detector(t *testing.T) { - cases := []struct { - Input string - Output string - }{ - // Virtual hosted style - { - "bucket.s3.amazonaws.com/foo", - "s3::https://s3.amazonaws.com/bucket/foo", - }, - { - "bucket.s3.amazonaws.com/foo/bar", - "s3::https://s3.amazonaws.com/bucket/foo/bar", - }, - { - "bucket.s3.amazonaws.com/foo/bar.baz", - "s3::https://s3.amazonaws.com/bucket/foo/bar.baz", - }, - { - "bucket.s3-eu-west-1.amazonaws.com/foo", - "s3::https://s3-eu-west-1.amazonaws.com/bucket/foo", - }, - { - "bucket.s3-eu-west-1.amazonaws.com/foo/bar", - "s3::https://s3-eu-west-1.amazonaws.com/bucket/foo/bar", - }, - { - "bucket.s3-eu-west-1.amazonaws.com/foo/bar.baz", - "s3::https://s3-eu-west-1.amazonaws.com/bucket/foo/bar.baz", - }, - // Path style - { - "s3.amazonaws.com/bucket/foo", - "s3::https://s3.amazonaws.com/bucket/foo", - }, - { - "s3.amazonaws.com/bucket/foo/bar", - "s3::https://s3.amazonaws.com/bucket/foo/bar", - }, - { - "s3.amazonaws.com/bucket/foo/bar.baz", - "s3::https://s3.amazonaws.com/bucket/foo/bar.baz", - }, - { - "s3-eu-west-1.amazonaws.com/bucket/foo", - "s3::https://s3-eu-west-1.amazonaws.com/bucket/foo", - }, - { - "s3-eu-west-1.amazonaws.com/bucket/foo/bar", - "s3::https://s3-eu-west-1.amazonaws.com/bucket/foo/bar", - }, - { - "s3-eu-west-1.amazonaws.com/bucket/foo/bar.baz", - "s3::https://s3-eu-west-1.amazonaws.com/bucket/foo/bar.baz", - }, - // Misc tests - { - "s3-eu-west-1.amazonaws.com/bucket/foo/bar.baz?version=1234", - "s3::https://s3-eu-west-1.amazonaws.com/bucket/foo/bar.baz?version=1234", - }, - } - - pwd := "/pwd" - f := new(S3Detector) - for i, tc := range cases { - output, ok, err := f.Detect(tc.Input, pwd) - if err != nil { - t.Fatalf("err: %s", err) - } - if !ok { - t.Fatal("not ok") - } - - if output != tc.Output { - t.Fatalf("%d: bad: %#v", i, output) - } - } -} diff --git a/vendor/github.com/hashicorp/go-getter/detect_test.go b/vendor/github.com/hashicorp/go-getter/detect_test.go deleted file mode 100644 index a339f28884..0000000000 --- a/vendor/github.com/hashicorp/go-getter/detect_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package getter - -import ( - "testing" -) - -func TestDetect(t *testing.T) { - cases := []struct { - Input string - Pwd string - Output string - Err bool - }{ - {"./foo", "/foo", "file:///foo/foo", false}, - {"git::./foo", "/foo", "git::file:///foo/foo", false}, - { - "git::github.com/hashicorp/foo", - "", - "git::https://github.com/hashicorp/foo.git", - false, - }, - { - "./foo//bar", - "/foo", - "file:///foo/foo//bar", - false, - }, - { - "git::github.com/hashicorp/foo//bar", - "", - "git::https://github.com/hashicorp/foo.git//bar", - false, - }, - { - "git::https://github.com/hashicorp/consul.git", - "", - "git::https://github.com/hashicorp/consul.git", - false, - }, - } - - for i, tc := range cases { - output, err := Detect(tc.Input, tc.Pwd, Detectors) - if err != nil != tc.Err { - t.Fatalf("%d: bad err: %s", i, err) - } - if output != tc.Output { - t.Fatalf("%d: bad output: %s\nexpected: %s", i, output, tc.Output) - } - } -} diff --git a/vendor/github.com/hashicorp/go-getter/folder_storage_test.go b/vendor/github.com/hashicorp/go-getter/folder_storage_test.go deleted file mode 100644 index feb8d34252..0000000000 --- a/vendor/github.com/hashicorp/go-getter/folder_storage_test.go +++ /dev/null @@ -1,48 +0,0 @@ -package getter - -import ( - "os" - "path/filepath" - "testing" -) - -func TestFolderStorage_impl(t *testing.T) { - var _ Storage = new(FolderStorage) -} - -func TestFolderStorage(t *testing.T) { - s := &FolderStorage{StorageDir: tempDir(t)} - - module := testModule("basic") - - // A module shouldn't exist at first... - _, ok, err := s.Dir(module) - if err != nil { - t.Fatalf("err: %s", err) - } - if ok { - t.Fatal("should not exist") - } - - key := "foo" - - // We can get it - err = s.Get(key, module, false) - if err != nil { - t.Fatalf("err: %s", err) - } - - // Now the module exists - dir, ok, err := s.Dir(key) - if err != nil { - t.Fatalf("err: %s", err) - } - if !ok { - t.Fatal("should exist") - } - - mainPath := filepath.Join(dir, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} diff --git a/vendor/github.com/hashicorp/go-getter/get_file_test.go b/vendor/github.com/hashicorp/go-getter/get_file_test.go deleted file mode 100644 index 0c136d2cd9..0000000000 --- a/vendor/github.com/hashicorp/go-getter/get_file_test.go +++ /dev/null @@ -1,150 +0,0 @@ -package getter - -import ( - "os" - "path/filepath" - "testing" -) - -func TestFileGetter_impl(t *testing.T) { - var _ Getter = new(FileGetter) -} - -func TestFileGetter(t *testing.T) { - g := new(FileGetter) - dst := tempDir(t) - - // With a dir that doesn't exist - if err := g.Get(dst, testModuleURL("basic")); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the destination folder is a symlink - fi, err := os.Lstat(dst) - if err != nil { - t.Fatalf("err: %s", err) - } - if fi.Mode()&os.ModeSymlink == 0 { - t.Fatal("destination is not a symlink") - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestFileGetter_sourceFile(t *testing.T) { - g := new(FileGetter) - dst := tempDir(t) - - // With a source URL that is a path to a file - u := testModuleURL("basic") - u.Path += "/main.tf" - if err := g.Get(dst, u); err == nil { - t.Fatal("should error") - } -} - -func TestFileGetter_sourceNoExist(t *testing.T) { - g := new(FileGetter) - dst := tempDir(t) - - // With a source URL that doesn't exist - u := testModuleURL("basic") - u.Path += "/main" - if err := g.Get(dst, u); err == nil { - t.Fatal("should error") - } -} - -func TestFileGetter_dir(t *testing.T) { - g := new(FileGetter) - dst := tempDir(t) - - if err := os.MkdirAll(dst, 0755); err != nil { - t.Fatalf("err: %s", err) - } - - // With a dir that exists that isn't a symlink - if err := g.Get(dst, testModuleURL("basic")); err == nil { - t.Fatal("should error") - } -} - -func TestFileGetter_dirSymlink(t *testing.T) { - g := new(FileGetter) - dst := tempDir(t) - dst2 := tempDir(t) - - // Make parents - if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { - t.Fatalf("err: %s", err) - } - if err := os.MkdirAll(dst2, 0755); err != nil { - t.Fatalf("err: %s", err) - } - - // Make a symlink - if err := os.Symlink(dst2, dst); err != nil { - t.Fatalf("err: %s", err) - } - - // With a dir that exists that isn't a symlink - if err := g.Get(dst, testModuleURL("basic")); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestFileGetter_GetFile(t *testing.T) { - g := new(FileGetter) - dst := tempFile(t) - - // With a dir that doesn't exist - if err := g.GetFile(dst, testModuleURL("basic-file/foo.txt")); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the destination folder is a symlink - fi, err := os.Lstat(dst) - if err != nil { - t.Fatalf("err: %s", err) - } - if fi.Mode()&os.ModeSymlink == 0 { - t.Fatal("destination is not a symlink") - } - - // Verify the main file exists - assertContents(t, dst, "Hello\n") -} - -func TestFileGetter_GetFile_Copy(t *testing.T) { - g := new(FileGetter) - g.Copy = true - - dst := tempFile(t) - - // With a dir that doesn't exist - if err := g.GetFile(dst, testModuleURL("basic-file/foo.txt")); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the destination folder is a symlink - fi, err := os.Lstat(dst) - if err != nil { - t.Fatalf("err: %s", err) - } - if fi.Mode()&os.ModeSymlink != 0 { - t.Fatal("destination is a symlink") - } - - // Verify the main file exists - assertContents(t, dst, "Hello\n") -} diff --git a/vendor/github.com/hashicorp/go-getter/get_git_test.go b/vendor/github.com/hashicorp/go-getter/get_git_test.go deleted file mode 100644 index 08298cb2e5..0000000000 --- a/vendor/github.com/hashicorp/go-getter/get_git_test.go +++ /dev/null @@ -1,231 +0,0 @@ -package getter - -import ( - "os" - "os/exec" - "path/filepath" - "testing" -) - -var testHasGit bool - -func init() { - if _, err := exec.LookPath("git"); err == nil { - testHasGit = true - } -} - -func TestGitGetter_impl(t *testing.T) { - var _ Getter = new(GitGetter) -} - -func TestGitGetter(t *testing.T) { - if !testHasGit { - t.Log("git not found, skipping") - t.Skip() - } - - g := new(GitGetter) - dst := tempDir(t) - - // Git doesn't allow nested ".git" directories so we do some hackiness - // here to get around that... - moduleDir := filepath.Join(fixtureDir, "basic-git") - oldName := filepath.Join(moduleDir, "DOTgit") - newName := filepath.Join(moduleDir, ".git") - if err := os.Rename(oldName, newName); err != nil { - t.Fatalf("err: %s", err) - } - defer os.Rename(newName, oldName) - - // With a dir that doesn't exist - if err := g.Get(dst, testModuleURL("basic-git")); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGitGetter_branch(t *testing.T) { - if !testHasGit { - t.Log("git not found, skipping") - t.Skip() - } - - g := new(GitGetter) - dst := tempDir(t) - - // Git doesn't allow nested ".git" directories so we do some hackiness - // here to get around that... - moduleDir := filepath.Join(fixtureDir, "basic-git") - oldName := filepath.Join(moduleDir, "DOTgit") - newName := filepath.Join(moduleDir, ".git") - if err := os.Rename(oldName, newName); err != nil { - t.Fatalf("err: %s", err) - } - defer os.Rename(newName, oldName) - - url := testModuleURL("basic-git") - q := url.Query() - q.Add("ref", "test-branch") - url.RawQuery = q.Encode() - - if err := g.Get(dst, url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main_branch.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } - - // Get again should work - if err := g.Get(dst, url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath = filepath.Join(dst, "main_branch.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGitGetter_branchUpdate(t *testing.T) { - if !testHasGit { - t.Log("git not found, skipping") - t.Skip() - } - - g := new(GitGetter) - dst := tempDir(t) - - // First setup the state with a fresh branch - moduleDir := filepath.Join(fixtureDir, "git-branch-update") - oldName := filepath.Join(moduleDir, "DOTgit-1") - newName := filepath.Join(moduleDir, ".git") - if err := os.Rename(oldName, newName); err != nil { - t.Fatalf("err: %s", err) - } - defer os.Rename(newName, oldName) - - // Get the "test-branch" branch - url := testModuleURL("git-branch-update") - q := url.Query() - q.Add("ref", "test-branch") - url.RawQuery = q.Encode() - if err := g.Get(dst, url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main_branch.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } - - // Swap the data to have a branch update - if err := os.Rename(newName, oldName); err != nil { - t.Fatalf("err: %s", err) - } - defer os.Rename(oldName, newName) - oldName = filepath.Join(moduleDir, "DOTgit-2") - newName = filepath.Join(moduleDir, ".git") - if err := os.Rename(oldName, newName); err != nil { - t.Fatalf("err: %s", err) - } - defer os.Rename(newName, oldName) - - // Get again should work - if err := g.Get(dst, url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath = filepath.Join(dst, "main_branch_update.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGitGetter_tag(t *testing.T) { - if !testHasGit { - t.Log("git not found, skipping") - t.Skip() - } - - g := new(GitGetter) - dst := tempDir(t) - - // Git doesn't allow nested ".git" directories so we do some hackiness - // here to get around that... - moduleDir := filepath.Join(fixtureDir, "basic-git") - oldName := filepath.Join(moduleDir, "DOTgit") - newName := filepath.Join(moduleDir, ".git") - if err := os.Rename(oldName, newName); err != nil { - t.Fatalf("err: %s", err) - } - defer os.Rename(newName, oldName) - - url := testModuleURL("basic-git") - q := url.Query() - q.Add("ref", "v1.0") - url.RawQuery = q.Encode() - - if err := g.Get(dst, url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main_tag1.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } - - // Get again should work - if err := g.Get(dst, url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath = filepath.Join(dst, "main_tag1.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGitGetter_GetFile(t *testing.T) { - if !testHasGit { - t.Log("git not found, skipping") - t.Skip() - } - - g := new(GitGetter) - dst := tempFile(t) - - // Git doesn't allow nested ".git" directories so we do some hackiness - // here to get around that... - moduleDir := filepath.Join(fixtureDir, "basic-git") - oldName := filepath.Join(moduleDir, "DOTgit") - newName := filepath.Join(moduleDir, ".git") - if err := os.Rename(oldName, newName); err != nil { - t.Fatalf("err: %s", err) - } - defer os.Rename(newName, oldName) - - // Download - if err := g.GetFile(dst, testModuleURL("basic-git/foo.txt")); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - if _, err := os.Stat(dst); err != nil { - t.Fatalf("err: %s", err) - } - assertContents(t, dst, "Hello\n") -} diff --git a/vendor/github.com/hashicorp/go-getter/get_hg_test.go b/vendor/github.com/hashicorp/go-getter/get_hg_test.go deleted file mode 100644 index 9a5ce5db77..0000000000 --- a/vendor/github.com/hashicorp/go-getter/get_hg_test.go +++ /dev/null @@ -1,98 +0,0 @@ -package getter - -import ( - "os" - "os/exec" - "path/filepath" - "testing" -) - -var testHasHg bool - -func init() { - if _, err := exec.LookPath("hg"); err == nil { - testHasHg = true - } -} - -func TestHgGetter_impl(t *testing.T) { - var _ Getter = new(HgGetter) -} - -func TestHgGetter(t *testing.T) { - if !testHasHg { - t.Log("hg not found, skipping") - t.Skip() - } - - g := new(HgGetter) - dst := tempDir(t) - - // With a dir that doesn't exist - if err := g.Get(dst, testModuleURL("basic-hg")); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestHgGetter_branch(t *testing.T) { - if !testHasHg { - t.Log("hg not found, skipping") - t.Skip() - } - - g := new(HgGetter) - dst := tempDir(t) - - url := testModuleURL("basic-hg") - q := url.Query() - q.Add("rev", "test-branch") - url.RawQuery = q.Encode() - - if err := g.Get(dst, url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main_branch.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } - - // Get again should work - if err := g.Get(dst, url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath = filepath.Join(dst, "main_branch.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestHgGetter_GetFile(t *testing.T) { - if !testHasHg { - t.Log("hg not found, skipping") - t.Skip() - } - - g := new(HgGetter) - dst := tempFile(t) - - // Download - if err := g.GetFile(dst, testModuleURL("basic-hg/foo.txt")); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - if _, err := os.Stat(dst); err != nil { - t.Fatalf("err: %s", err) - } - assertContents(t, dst, "Hello\n") -} diff --git a/vendor/github.com/hashicorp/go-getter/get_http_test.go b/vendor/github.com/hashicorp/go-getter/get_http_test.go deleted file mode 100644 index 4175231649..0000000000 --- a/vendor/github.com/hashicorp/go-getter/get_http_test.go +++ /dev/null @@ -1,184 +0,0 @@ -package getter - -import ( - "fmt" - "net" - "net/http" - "net/url" - "os" - "path/filepath" - "testing" -) - -func TestHttpGetter_impl(t *testing.T) { - var _ Getter = new(HttpGetter) -} - -func TestHttpGetter_header(t *testing.T) { - ln := testHttpServer(t) - defer ln.Close() - - g := new(HttpGetter) - dst := tempDir(t) - - var u url.URL - u.Scheme = "http" - u.Host = ln.Addr().String() - u.Path = "/header" - - // Get it! - if err := g.Get(dst, &u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestHttpGetter_meta(t *testing.T) { - ln := testHttpServer(t) - defer ln.Close() - - g := new(HttpGetter) - dst := tempDir(t) - - var u url.URL - u.Scheme = "http" - u.Host = ln.Addr().String() - u.Path = "/meta" - - // Get it! - if err := g.Get(dst, &u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestHttpGetter_metaSubdir(t *testing.T) { - ln := testHttpServer(t) - defer ln.Close() - - g := new(HttpGetter) - dst := tempDir(t) - - var u url.URL - u.Scheme = "http" - u.Host = ln.Addr().String() - u.Path = "/meta-subdir" - - // Get it! - if err := g.Get(dst, &u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "sub.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestHttpGetter_none(t *testing.T) { - ln := testHttpServer(t) - defer ln.Close() - - g := new(HttpGetter) - dst := tempDir(t) - - var u url.URL - u.Scheme = "http" - u.Host = ln.Addr().String() - u.Path = "/none" - - // Get it! - if err := g.Get(dst, &u); err == nil { - t.Fatal("should error") - } -} - -func TestHttpGetter_file(t *testing.T) { - ln := testHttpServer(t) - defer ln.Close() - - g := new(HttpGetter) - dst := tempFile(t) - - var u url.URL - u.Scheme = "http" - u.Host = ln.Addr().String() - u.Path = "/file" - - // Get it! - if err := g.GetFile(dst, &u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - if _, err := os.Stat(dst); err != nil { - t.Fatalf("err: %s", err) - } - assertContents(t, dst, "Hello\n") -} - -func testHttpServer(t *testing.T) net.Listener { - ln, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - t.Fatalf("err: %s", err) - } - - mux := http.NewServeMux() - mux.HandleFunc("/file", testHttpHandlerFile) - mux.HandleFunc("/header", testHttpHandlerHeader) - mux.HandleFunc("/meta", testHttpHandlerMeta) - mux.HandleFunc("/meta-subdir", testHttpHandlerMetaSubdir) - - var server http.Server - server.Handler = mux - go server.Serve(ln) - - return ln -} - -func testHttpHandlerFile(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("Hello\n")) -} - -func testHttpHandlerHeader(w http.ResponseWriter, r *http.Request) { - w.Header().Add("X-Terraform-Get", testModuleURL("basic").String()) - w.WriteHeader(200) -} - -func testHttpHandlerMeta(w http.ResponseWriter, r *http.Request) { - w.Write([]byte(fmt.Sprintf(testHttpMetaStr, testModuleURL("basic").String()))) -} - -func testHttpHandlerMetaSubdir(w http.ResponseWriter, r *http.Request) { - w.Write([]byte(fmt.Sprintf(testHttpMetaStr, testModuleURL("basic//subdir").String()))) -} - -func testHttpHandlerNone(w http.ResponseWriter, r *http.Request) { - w.Write([]byte(testHttpNoneStr)) -} - -const testHttpMetaStr = ` - - - - - -` - -const testHttpNoneStr = ` - - - - -` diff --git a/vendor/github.com/hashicorp/go-getter/get_s3_test.go b/vendor/github.com/hashicorp/go-getter/get_s3_test.go deleted file mode 100644 index dd8b30351e..0000000000 --- a/vendor/github.com/hashicorp/go-getter/get_s3_test.go +++ /dev/null @@ -1,108 +0,0 @@ -package getter - -import ( - "os" - "path/filepath" - "testing" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -func init() { - // These are well known restricted IAM keys to a HashiCorp-managed bucket - // in a private AWS account that only has access to the open source test - // resources. - // - // We do the string concat below to avoid AWS autodetection of a key. This - // key is locked down an IAM policy that is read-only so we're purposely - // exposing it. - os.Setenv("AWS_ACCESS_KEY", "AKIAJCTNQ" + "IOBWAYXKGZA") - os.Setenv("AWS_SECRET_KEY", "jcQOTYdXNzU5MO" + "5ExqbE1U995dIfKCKQtiVobMvr") -} - -func TestS3Getter_impl(t *testing.T) { - var _ Getter = new(S3Getter) -} - -func TestS3Getter(t *testing.T) { - g := new(S3Getter) - dst := tempDir(t) - - // With a dir that doesn't exist - err := g.Get( - dst, testURL("https://s3.amazonaws.com/hc-oss-test/go-getter/folder")) - if err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestS3Getter_subdir(t *testing.T) { - g := new(S3Getter) - dst := tempDir(t) - - // With a dir that doesn't exist - err := g.Get( - dst, testURL("https://s3.amazonaws.com/hc-oss-test/go-getter/folder/subfolder")) - if err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - subPath := filepath.Join(dst, "sub.tf") - if _, err := os.Stat(subPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestS3Getter_GetFile(t *testing.T) { - g := new(S3Getter) - dst := tempFile(t) - - // Download - err := g.GetFile( - dst, testURL("https://s3.amazonaws.com/hc-oss-test/go-getter/folder/main.tf")) - if err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - if _, err := os.Stat(dst); err != nil { - t.Fatalf("err: %s", err) - } - assertContents(t, dst, "# Main\n") -} - -func TestS3Getter_GetFile_badParams(t *testing.T) { - g := new(S3Getter) - dst := tempFile(t) - - // Download - err := g.GetFile( - dst, - testURL("https://s3.amazonaws.com/hc-oss-test/go-getter/folder/main.tf?aws_access_key_id=foo&aws_access_key_secret=bar&aws_access_token=baz")) - if err == nil { - t.Fatalf("expected error, got none") - } - - if reqerr, ok := err.(awserr.RequestFailure); !ok || reqerr.StatusCode() != 403 { - t.Fatalf("expected InvalidAccessKeyId error") - } -} - -func TestS3Getter_GetFile_notfound(t *testing.T) { - g := new(S3Getter) - dst := tempFile(t) - - // Download - err := g.GetFile( - dst, testURL("https://s3.amazonaws.com/hc-oss-test/go-getter/folder/404.tf")) - if err == nil { - t.Fatalf("expected error, got none") - } -} diff --git a/vendor/github.com/hashicorp/go-getter/get_test.go b/vendor/github.com/hashicorp/go-getter/get_test.go deleted file mode 100644 index fc758df54b..0000000000 --- a/vendor/github.com/hashicorp/go-getter/get_test.go +++ /dev/null @@ -1,245 +0,0 @@ -package getter - -import ( - "os" - "path/filepath" - "strings" - "testing" -) - -func TestGet_badSchema(t *testing.T) { - dst := tempDir(t) - u := testModule("basic") - u = strings.Replace(u, "file", "nope", -1) - - if err := Get(dst, u); err == nil { - t.Fatal("should error") - } -} - -func TestGet_file(t *testing.T) { - dst := tempDir(t) - u := testModule("basic") - - if err := Get(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGet_fileDetect(t *testing.T) { - dst := tempDir(t) - u := filepath.Join("./test-fixtures", "basic") - pwd, err := os.Getwd() - if err != nil { - t.Fatalf("err: %s", err) - } - - client := &Client{ - Src: u, - Dst: dst, - Pwd: pwd, - Dir: true, - } - - if err := client.Get(); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGet_fileForced(t *testing.T) { - dst := tempDir(t) - u := testModule("basic") - u = "file::" + u - - if err := Get(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGet_fileSubdir(t *testing.T) { - dst := tempDir(t) - u := testModule("basic//subdir") - - if err := Get(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "sub.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGet_archive(t *testing.T) { - dst := tempDir(t) - u := filepath.Join("./test-fixtures", "archive.tar.gz") - u, _ = filepath.Abs(u) - - if err := Get(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGetFile(t *testing.T) { - dst := tempFile(t) - u := testModule("basic-file/foo.txt") - - if err := GetFile(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - assertContents(t, dst, "Hello\n") -} - -func TestGetFile_archive(t *testing.T) { - dst := tempFile(t) - u := testModule("basic-file-archive/archive.tar.gz") - - if err := GetFile(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - assertContents(t, dst, "Hello\n") -} - -func TestGetFile_archiveChecksum(t *testing.T) { - dst := tempFile(t) - u := testModule( - "basic-file-archive/archive.tar.gz?checksum=md5:fbd90037dacc4b1ab40811d610dde2f0") - - if err := GetFile(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - assertContents(t, dst, "Hello\n") -} - -func TestGetFile_archiveNoUnarchive(t *testing.T) { - dst := tempFile(t) - u := testModule("basic-file-archive/archive.tar.gz") - u += "?archive=false" - - if err := GetFile(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - actual := testMD5(t, dst) - expected := "fbd90037dacc4b1ab40811d610dde2f0" - if actual != expected { - t.Fatalf("bad: %s", actual) - } -} - -func TestGetFile_checksum(t *testing.T) { - cases := []struct { - Append string - Err bool - }{ - { - "", - false, - }, - - // MD5 - { - "?checksum=md5:09f7e02f1290be211da707a266f153b3", - false, - }, - { - "?checksum=md5:09f7e02f1290be211da707a266f153b4", - true, - }, - - // SHA1 - { - "?checksum=sha1:1d229271928d3f9e2bb0375bd6ce5db6c6d348d9", - false, - }, - { - "?checksum=sha1:1d229271928d3f9e2bb0375bd6ce5db6c6d348d0", - true, - }, - - // SHA256 - { - "?checksum=sha256:66a045b452102c59d840ec097d59d9467e13a3f34f6494e539ffd32c1bb35f18", - false, - }, - { - "?checksum=sha256:66a045b452102c59d840ec097d59d9467e13a3f34f6494e539ffd32c1bb35f19", - true, - }, - - // SHA512 - { - "?checksum=sha512:c2bad2223811194582af4d1508ac02cd69eeeeedeeb98d54fcae4dcefb13cc882e7640328206603d3fb9cd5f949a9be0db054dd34fbfa190c498a5fe09750cef", - false, - }, - { - "?checksum=sha512:c2bad2223811194582af4d1508ac02cd69eeeeedeeb98d54fcae4dcefb13cc882e7640328206603d3fb9cd5f949a9be0db054dd34fbfa190c498a5fe09750ced", - true, - }, - } - - for _, tc := range cases { - u := testModule("basic-file/foo.txt") + tc.Append - - func() { - dst := tempFile(t) - defer os.Remove(dst) - if err := GetFile(dst, u); (err != nil) != tc.Err { - t.Fatalf("append: %s\n\nerr: %s", tc.Append, err) - } - - // Verify the main file exists - assertContents(t, dst, "Hello\n") - }() - } -} - -func TestGetFile_checksumURL(t *testing.T) { - dst := tempFile(t) - u := testModule("basic-file/foo.txt") + "?checksum=md5:09f7e02f1290be211da707a266f153b3" - - getter := &MockGetter{Proxy: new(FileGetter)} - client := &Client{ - Src: u, - Dst: dst, - Dir: false, - Getters: map[string]Getter{ - "file": getter, - }, - } - - if err := client.Get(); err != nil { - t.Fatalf("err: %s", err) - } - - if v := getter.GetFileURL.Query().Get("checksum"); v != "" { - t.Fatalf("bad: %s", v) - } -} diff --git a/vendor/github.com/hashicorp/go-getter/helper/url/url_test.go b/vendor/github.com/hashicorp/go-getter/helper/url/url_test.go deleted file mode 100644 index ce3226b4bd..0000000000 --- a/vendor/github.com/hashicorp/go-getter/helper/url/url_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package url - -import ( - "runtime" - "testing" -) - -type parseTest struct { - rawURL string - scheme string - host string - path string - str string - err bool -} - -var parseTests = []parseTest{ - { - rawURL: "/foo/bar", - scheme: "", - host: "", - path: "/foo/bar", - str: "/foo/bar", - err: false, - }, - { - rawURL: "file:///dir/", - scheme: "file", - host: "", - path: "/dir/", - str: "file:///dir/", - err: false, - }, -} - -var winParseTests = []parseTest{ - { - rawURL: `C:\`, - scheme: ``, - host: ``, - path: `C:/`, - str: `C:/`, - err: false, - }, - { - rawURL: `file://C:\`, - scheme: `file`, - host: ``, - path: `C:/`, - str: `file://C:/`, - err: false, - }, - { - rawURL: `file:///C:\`, - scheme: `file`, - host: ``, - path: `C:/`, - str: `file://C:/`, - err: false, - }, -} - -func TestParse(t *testing.T) { - if runtime.GOOS == "windows" { - parseTests = append(parseTests, winParseTests...) - } - for i, pt := range parseTests { - url, err := Parse(pt.rawURL) - if err != nil && !pt.err { - t.Errorf("test %d: unexpected error: %s", i, err) - } - if err == nil && pt.err { - t.Errorf("test %d: expected an error", i) - } - if url.Scheme != pt.scheme { - t.Errorf("test %d: expected Scheme = %q, got %q", i, pt.scheme, url.Scheme) - } - if url.Host != pt.host { - t.Errorf("test %d: expected Host = %q, got %q", i, pt.host, url.Host) - } - if url.Path != pt.path { - t.Errorf("test %d: expected Path = %q, got %q", i, pt.path, url.Path) - } - if url.String() != pt.str { - t.Errorf("test %d: expected url.String() = %q, got %q", i, pt.str, url.String()) - } - } -} diff --git a/vendor/github.com/hashicorp/go-getter/module_test.go b/vendor/github.com/hashicorp/go-getter/module_test.go deleted file mode 100644 index 332f34ef06..0000000000 --- a/vendor/github.com/hashicorp/go-getter/module_test.go +++ /dev/null @@ -1,83 +0,0 @@ -package getter - -import ( - "io/ioutil" - "net/url" - "os" - "path/filepath" - "reflect" - "testing" - - urlhelper "github.com/hashicorp/go-getter/helper/url" - "github.com/hashicorp/terraform/config" -) - -const fixtureDir = "./test-fixtures" - -func tempDir(t *testing.T) string { - dir, err := ioutil.TempDir("", "tf") - if err != nil { - t.Fatalf("err: %s", err) - } - if err := os.RemoveAll(dir); err != nil { - t.Fatalf("err: %s", err) - } - - return dir -} - -func tempFile(t *testing.T) string { - dir := tempDir(t) - return filepath.Join(dir, "foo") -} - -func testConfig(t *testing.T, n string) *config.Config { - c, err := config.LoadDir(filepath.Join(fixtureDir, n)) - if err != nil { - t.Fatalf("err: %s", err) - } - - return c -} - -func testModule(n string) string { - p := filepath.Join(fixtureDir, n) - p, err := filepath.Abs(p) - if err != nil { - panic(err) - } - return fmtFileURL(p) -} - -func testModuleURL(n string) *url.URL { - u, err := urlhelper.Parse(testModule(n)) - if err != nil { - panic(err) - } - - return u -} - -func testURL(s string) *url.URL { - u, err := urlhelper.Parse(s) - if err != nil { - panic(err) - } - - return u -} - -func testStorage(t *testing.T) Storage { - return &FolderStorage{StorageDir: tempDir(t)} -} - -func assertContents(t *testing.T, path string, contents string) { - data, err := ioutil.ReadFile(path) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(data, []byte(contents)) { - t.Fatalf("bad. expected:\n\n%s\n\nGot:\n\n%s", contents, string(data)) - } -} diff --git a/vendor/github.com/hashicorp/go-getter/source_test.go b/vendor/github.com/hashicorp/go-getter/source_test.go deleted file mode 100644 index ca97ab5339..0000000000 --- a/vendor/github.com/hashicorp/go-getter/source_test.go +++ /dev/null @@ -1,39 +0,0 @@ -package getter - -import ( - "testing" -) - -func TestSourceDirSubdir(t *testing.T) { - cases := []struct { - Input string - Dir, Sub string - }{ - { - "hashicorp.com", - "hashicorp.com", "", - }, - { - "hashicorp.com//foo", - "hashicorp.com", "foo", - }, - { - "hashicorp.com//foo?bar=baz", - "hashicorp.com?bar=baz", "foo", - }, - { - "file://foo//bar", - "file://foo", "bar", - }, - } - - for i, tc := range cases { - adir, asub := SourceDirSubdir(tc.Input) - if adir != tc.Dir { - t.Fatalf("%d: bad dir: %#v", i, adir) - } - if asub != tc.Sub { - t.Fatalf("%d: bad sub: %#v", i, asub) - } - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/append_test.go b/vendor/github.com/hashicorp/go-multierror/append_test.go deleted file mode 100644 index dfa79e289e..0000000000 --- a/vendor/github.com/hashicorp/go-multierror/append_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package multierror - -import ( - "errors" - "testing" -) - -func TestAppend_Error(t *testing.T) { - original := &Error{ - Errors: []error{errors.New("foo")}, - } - - result := Append(original, errors.New("bar")) - if len(result.Errors) != 2 { - t.Fatalf("wrong len: %d", len(result.Errors)) - } - - original = &Error{} - result = Append(original, errors.New("bar")) - if len(result.Errors) != 1 { - t.Fatalf("wrong len: %d", len(result.Errors)) - } - - // Test when a typed nil is passed - var e *Error - result = Append(e, errors.New("baz")) - if len(result.Errors) != 1 { - t.Fatalf("wrong len: %d", len(result.Errors)) - } - - // Test flattening - original = &Error{ - Errors: []error{errors.New("foo")}, - } - - result = Append(original, Append(nil, errors.New("foo"), errors.New("bar"))) - if len(result.Errors) != 3 { - t.Fatalf("wrong len: %d", len(result.Errors)) - } -} - -func TestAppend_NilError(t *testing.T) { - var err error - result := Append(err, errors.New("bar")) - if len(result.Errors) != 1 { - t.Fatalf("wrong len: %d", len(result.Errors)) - } -} - -func TestAppend_NonError(t *testing.T) { - original := errors.New("foo") - result := Append(original, errors.New("bar")) - if len(result.Errors) != 2 { - t.Fatalf("wrong len: %d", len(result.Errors)) - } -} - -func TestAppend_NonError_Error(t *testing.T) { - original := errors.New("foo") - result := Append(original, Append(nil, errors.New("bar"))) - if len(result.Errors) != 2 { - t.Fatalf("wrong len: %d", len(result.Errors)) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/flatten_test.go b/vendor/github.com/hashicorp/go-multierror/flatten_test.go deleted file mode 100644 index 75218f1031..0000000000 --- a/vendor/github.com/hashicorp/go-multierror/flatten_test.go +++ /dev/null @@ -1,48 +0,0 @@ -package multierror - -import ( - "errors" - "fmt" - "reflect" - "strings" - "testing" -) - -func TestFlatten(t *testing.T) { - original := &Error{ - Errors: []error{ - errors.New("one"), - &Error{ - Errors: []error{ - errors.New("two"), - &Error{ - Errors: []error{ - errors.New("three"), - }, - }, - }, - }, - }, - } - - expected := strings.TrimSpace(` -3 error(s) occurred: - -* one -* two -* three - `) - actual := fmt.Sprintf("%s", Flatten(original)) - - if expected != actual { - t.Fatalf("expected: %s, got: %s", expected, actual) - } -} - -func TestFlatten_nonError(t *testing.T) { - err := errors.New("foo") - actual := Flatten(err) - if !reflect.DeepEqual(actual, err) { - t.Fatalf("bad: %#v", actual) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/format_test.go b/vendor/github.com/hashicorp/go-multierror/format_test.go deleted file mode 100644 index d7cee5d7d9..0000000000 --- a/vendor/github.com/hashicorp/go-multierror/format_test.go +++ /dev/null @@ -1,23 +0,0 @@ -package multierror - -import ( - "errors" - "testing" -) - -func TestListFormatFunc(t *testing.T) { - expected := `2 error(s) occurred: - -* foo -* bar` - - errors := []error{ - errors.New("foo"), - errors.New("bar"), - } - - actual := ListFormatFunc(errors) - if actual != expected { - t.Fatalf("bad: %#v", actual) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/multierror_test.go b/vendor/github.com/hashicorp/go-multierror/multierror_test.go deleted file mode 100644 index 3e78079c00..0000000000 --- a/vendor/github.com/hashicorp/go-multierror/multierror_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package multierror - -import ( - "errors" - "reflect" - "testing" -) - -func TestError_Impl(t *testing.T) { - var _ error = new(Error) -} - -func TestErrorError_custom(t *testing.T) { - errors := []error{ - errors.New("foo"), - errors.New("bar"), - } - - fn := func(es []error) string { - return "foo" - } - - multi := &Error{Errors: errors, ErrorFormat: fn} - if multi.Error() != "foo" { - t.Fatalf("bad: %s", multi.Error()) - } -} - -func TestErrorError_default(t *testing.T) { - expected := `2 error(s) occurred: - -* foo -* bar` - - errors := []error{ - errors.New("foo"), - errors.New("bar"), - } - - multi := &Error{Errors: errors} - if multi.Error() != expected { - t.Fatalf("bad: %s", multi.Error()) - } -} - -func TestErrorErrorOrNil(t *testing.T) { - err := new(Error) - if err.ErrorOrNil() != nil { - t.Fatalf("bad: %#v", err.ErrorOrNil()) - } - - err.Errors = []error{errors.New("foo")} - if v := err.ErrorOrNil(); v == nil { - t.Fatal("should not be nil") - } else if !reflect.DeepEqual(v, err) { - t.Fatalf("bad: %#v", v) - } -} - -func TestErrorWrappedErrors(t *testing.T) { - errors := []error{ - errors.New("foo"), - errors.New("bar"), - } - - multi := &Error{Errors: errors} - if !reflect.DeepEqual(multi.Errors, multi.WrappedErrors()) { - t.Fatalf("bad: %s", multi.WrappedErrors()) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/prefix_test.go b/vendor/github.com/hashicorp/go-multierror/prefix_test.go deleted file mode 100644 index 1d4a6f6d33..0000000000 --- a/vendor/github.com/hashicorp/go-multierror/prefix_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package multierror - -import ( - "errors" - "testing" -) - -func TestPrefix_Error(t *testing.T) { - original := &Error{ - Errors: []error{errors.New("foo")}, - } - - result := Prefix(original, "bar") - if result.(*Error).Errors[0].Error() != "bar foo" { - t.Fatalf("bad: %s", result) - } -} - -func TestPrefix_NilError(t *testing.T) { - var err error - result := Prefix(err, "bar") - if result != nil { - t.Fatalf("bad: %#v", result) - } -} - -func TestPrefix_NonError(t *testing.T) { - original := errors.New("foo") - result := Prefix(original, "bar") - if result.Error() != "bar foo" { - t.Fatalf("bad: %s", result) - } -} diff --git a/vendor/github.com/hashicorp/go-retryablehttp/client_test.go b/vendor/github.com/hashicorp/go-retryablehttp/client_test.go deleted file mode 100644 index 36a829a16a..0000000000 --- a/vendor/github.com/hashicorp/go-retryablehttp/client_test.go +++ /dev/null @@ -1,342 +0,0 @@ -package retryablehttp - -import ( - "bytes" - "io/ioutil" - "net" - "net/http" - "net/http/httptest" - "net/url" - "strings" - "sync/atomic" - "testing" - "time" -) - -func TestRequest(t *testing.T) { - // Fails on invalid request - _, err := NewRequest("GET", "://foo", nil) - if err == nil { - t.Fatalf("should error") - } - - // Works with no request body - _, err = NewRequest("GET", "http://foo", nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Works with request body - body := bytes.NewReader([]byte("yo")) - req, err := NewRequest("GET", "/", body) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Request allows typical HTTP request forming methods - req.Header.Set("X-Test", "foo") - if v, ok := req.Header["X-Test"]; !ok || len(v) != 1 || v[0] != "foo" { - t.Fatalf("bad headers: %v", req.Header) - } - - // Sets the Content-Length automatically for LenReaders - if req.ContentLength != 2 { - t.Fatalf("bad ContentLength: %d", req.ContentLength) - } -} - -func TestClient_Do(t *testing.T) { - // Create a request - body := bytes.NewReader([]byte("hello")) - req, err := NewRequest("PUT", "http://127.0.0.1:28934/v1/foo", body) - if err != nil { - t.Fatalf("err: %v", err) - } - req.Header.Set("foo", "bar") - - // Create the client. Use short retry windows. - client := NewClient() - client.RetryWaitMin = 10 * time.Millisecond - client.RetryWaitMax = 50 * time.Millisecond - client.RetryMax = 50 - - // Send the request - var resp *http.Response - doneCh := make(chan struct{}) - go func() { - defer close(doneCh) - var err error - resp, err = client.Do(req) - if err != nil { - t.Fatalf("err: %v", err) - } - }() - - select { - case <-doneCh: - t.Fatalf("should retry on error") - case <-time.After(200 * time.Millisecond): - // Client should still be retrying due to connection failure. - } - - // Create the mock handler. First we return a 500-range response to ensure - // that we power through and keep retrying in the face of recoverable - // errors. - code := int64(500) - handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - // Check the request details - if r.Method != "PUT" { - t.Fatalf("bad method: %s", r.Method) - } - if r.RequestURI != "/v1/foo" { - t.Fatalf("bad uri: %s", r.RequestURI) - } - - // Check the headers - if v := r.Header.Get("foo"); v != "bar" { - t.Fatalf("bad header: expect foo=bar, got foo=%v", v) - } - - // Check the payload - body, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("err: %s", err) - } - expected := []byte("hello") - if !bytes.Equal(body, expected) { - t.Fatalf("bad: %v", body) - } - - w.WriteHeader(int(atomic.LoadInt64(&code))) - }) - - // Create a test server - list, err := net.Listen("tcp", ":28934") - if err != nil { - t.Fatalf("err: %v", err) - } - defer list.Close() - go http.Serve(list, handler) - - // Wait again - select { - case <-doneCh: - t.Fatalf("should retry on 500-range") - case <-time.After(200 * time.Millisecond): - // Client should still be retrying due to 500's. - } - - // Start returning 200's - atomic.StoreInt64(&code, 200) - - // Wait again - select { - case <-doneCh: - case <-time.After(time.Second): - t.Fatalf("timed out") - } - - if resp.StatusCode != 200 { - t.Fatalf("exected 200, got: %d", resp.StatusCode) - } -} - -func TestClient_Do_fails(t *testing.T) { - // Mock server which always responds 500. - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(500) - })) - defer ts.Close() - - // Create the client. Use short retry windows so we fail faster. - client := NewClient() - client.RetryWaitMin = 10 * time.Millisecond - client.RetryWaitMax = 10 * time.Millisecond - client.RetryMax = 2 - - // Create the request - req, err := NewRequest("POST", ts.URL, nil) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Send the request. - _, err = client.Do(req) - if err == nil || !strings.Contains(err.Error(), "giving up") { - t.Fatalf("expected giving up error, got: %#v", err) - } -} - -func TestClient_Get(t *testing.T) { - // Mock server which always responds 500. - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.Method != "GET" { - t.Fatalf("bad method: %s", r.Method) - } - if r.RequestURI != "/foo/bar" { - t.Fatalf("bad uri: %s", r.RequestURI) - } - w.WriteHeader(200) - })) - defer ts.Close() - - // Make the request. - resp, err := NewClient().Get(ts.URL + "/foo/bar") - if err != nil { - t.Fatalf("err: %v", err) - } - resp.Body.Close() -} - -func TestClient_Head(t *testing.T) { - // Mock server which always responds 200. - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.Method != "HEAD" { - t.Fatalf("bad method: %s", r.Method) - } - if r.RequestURI != "/foo/bar" { - t.Fatalf("bad uri: %s", r.RequestURI) - } - w.WriteHeader(200) - })) - defer ts.Close() - - // Make the request. - resp, err := NewClient().Head(ts.URL + "/foo/bar") - if err != nil { - t.Fatalf("err: %v", err) - } - resp.Body.Close() -} - -func TestClient_Post(t *testing.T) { - // Mock server which always responds 200. - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.Method != "POST" { - t.Fatalf("bad method: %s", r.Method) - } - if r.RequestURI != "/foo/bar" { - t.Fatalf("bad uri: %s", r.RequestURI) - } - if ct := r.Header.Get("Content-Type"); ct != "application/json" { - t.Fatalf("bad content-type: %s", ct) - } - - // Check the payload - body, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("err: %s", err) - } - expected := []byte(`{"hello":"world"}`) - if !bytes.Equal(body, expected) { - t.Fatalf("bad: %v", body) - } - - w.WriteHeader(200) - })) - defer ts.Close() - - // Make the request. - resp, err := NewClient().Post( - ts.URL+"/foo/bar", - "application/json", - strings.NewReader(`{"hello":"world"}`)) - if err != nil { - t.Fatalf("err: %v", err) - } - resp.Body.Close() -} - -func TestClient_PostForm(t *testing.T) { - // Mock server which always responds 200. - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.Method != "POST" { - t.Fatalf("bad method: %s", r.Method) - } - if r.RequestURI != "/foo/bar" { - t.Fatalf("bad uri: %s", r.RequestURI) - } - if ct := r.Header.Get("Content-Type"); ct != "application/x-www-form-urlencoded" { - t.Fatalf("bad content-type: %s", ct) - } - - // Check the payload - body, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("err: %s", err) - } - expected := []byte(`hello=world`) - if !bytes.Equal(body, expected) { - t.Fatalf("bad: %v", body) - } - - w.WriteHeader(200) - })) - defer ts.Close() - - // Create the form data. - form, err := url.ParseQuery("hello=world") - if err != nil { - t.Fatalf("err: %v", err) - } - - // Make the request. - resp, err := NewClient().PostForm(ts.URL+"/foo/bar", form) - if err != nil { - t.Fatalf("err: %v", err) - } - resp.Body.Close() -} - -func TestBackoff(t *testing.T) { - type tcase struct { - min time.Duration - max time.Duration - i int - expect time.Duration - } - cases := []tcase{ - { - time.Second, - 5 * time.Minute, - 0, - time.Second, - }, - { - time.Second, - 5 * time.Minute, - 1, - 2 * time.Second, - }, - { - time.Second, - 5 * time.Minute, - 2, - 4 * time.Second, - }, - { - time.Second, - 5 * time.Minute, - 3, - 8 * time.Second, - }, - { - time.Second, - 5 * time.Minute, - 63, - 5 * time.Minute, - }, - { - time.Second, - 5 * time.Minute, - 128, - 5 * time.Minute, - }, - } - - for _, tc := range cases { - if v := backoff(tc.min, tc.max, tc.i); v != tc.expect { - t.Fatalf("bad: %#v -> %s", tc, v) - } - } -} diff --git a/vendor/github.com/hashicorp/go-version/constraint_test.go b/vendor/github.com/hashicorp/go-version/constraint_test.go deleted file mode 100644 index 3abf70bbbc..0000000000 --- a/vendor/github.com/hashicorp/go-version/constraint_test.go +++ /dev/null @@ -1,103 +0,0 @@ -package version - -import ( - "testing" -) - -func TestNewConstraint(t *testing.T) { - cases := []struct { - input string - count int - err bool - }{ - {">= 1.2", 1, false}, - {"1.0", 1, false}, - {">= 1.x", 0, true}, - {">= 1.2, < 1.0", 2, false}, - - // Out of bounds - {"11387778780781445675529500000000000000000", 0, true}, - } - - for _, tc := range cases { - v, err := NewConstraint(tc.input) - if tc.err && err == nil { - t.Fatalf("expected error for input: %s", tc.input) - } else if !tc.err && err != nil { - t.Fatalf("error for input %s: %s", tc.input, err) - } - - if len(v) != tc.count { - t.Fatalf("input: %s\nexpected len: %d\nactual: %d", - tc.input, tc.count, len(v)) - } - } -} - -func TestConstraintCheck(t *testing.T) { - cases := []struct { - constraint string - version string - check bool - }{ - {">= 1.0, < 1.2", "1.1.5", true}, - {"< 1.0, < 1.2", "1.1.5", false}, - {"= 1.0", "1.1.5", false}, - {"= 1.0", "1.0.0", true}, - {"1.0", "1.0.0", true}, - {"~> 1.0", "2.0", false}, - {"~> 1.0", "1.1", true}, - {"~> 1.0", "1.2.3", true}, - {"~> 1.0.0", "1.2.3", false}, - {"~> 1.0.0", "1.0.7", true}, - {"~> 1.0.0", "1.1.0", false}, - {"~> 1.0.7", "1.0.4", false}, - } - - for _, tc := range cases { - c, err := NewConstraint(tc.constraint) - if err != nil { - t.Fatalf("err: %s", err) - } - - v, err := NewVersion(tc.version) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := c.Check(v) - expected := tc.check - if actual != expected { - t.Fatalf("Version: %s\nConstraint: %s\nExpected: %#v", - tc.version, tc.constraint, expected) - } - } -} - -func TestConstraintsString(t *testing.T) { - cases := []struct { - constraint string - result string - }{ - {">= 1.0, < 1.2", ""}, - {"~> 1.0.7", ""}, - } - - for _, tc := range cases { - c, err := NewConstraint(tc.constraint) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := c.String() - expected := tc.result - if expected == "" { - expected = tc.constraint - } - - if actual != expected { - t.Fatalf("Constraint: %s\nExpected: %#v\nActual: %s", - tc.constraint, expected, actual) - } - } -} diff --git a/vendor/github.com/hashicorp/go-version/version_collection_test.go b/vendor/github.com/hashicorp/go-version/version_collection_test.go deleted file mode 100644 index 14783d7e74..0000000000 --- a/vendor/github.com/hashicorp/go-version/version_collection_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package version - -import ( - "reflect" - "sort" - "testing" -) - -func TestCollection(t *testing.T) { - versionsRaw := []string{ - "1.1.1", - "1.0", - "1.2", - "2", - "0.7.1", - } - - versions := make([]*Version, len(versionsRaw)) - for i, raw := range versionsRaw { - v, err := NewVersion(raw) - if err != nil { - t.Fatalf("err: %s", err) - } - - versions[i] = v - } - - sort.Sort(Collection(versions)) - - actual := make([]string, len(versions)) - for i, v := range versions { - actual[i] = v.String() - } - - expected := []string{ - "0.7.1", - "1.0.0", - "1.1.1", - "1.2.0", - "2.0.0", - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("bad: %#v", actual) - } -} diff --git a/vendor/github.com/hashicorp/go-version/version_test.go b/vendor/github.com/hashicorp/go-version/version_test.go deleted file mode 100644 index cc96a048e3..0000000000 --- a/vendor/github.com/hashicorp/go-version/version_test.go +++ /dev/null @@ -1,208 +0,0 @@ -package version - -import ( - "reflect" - "testing" -) - -func TestNewVersion(t *testing.T) { - cases := []struct { - version string - err bool - }{ - {"1.2.3", false}, - {"1.0", false}, - {"1", false}, - {"1.2.beta", true}, - {"foo", true}, - {"1.2-5", false}, - {"1.2-beta.5", false}, - {"\n1.2", true}, - {"1.2.0-x.Y.0+metadata", false}, - {"1.2.0-x.Y.0+metadata-width-hypen", false}, - {"1.2.3-rc1-with-hypen", false}, - {"1.2.3.4", true}, - } - - for _, tc := range cases { - _, err := NewVersion(tc.version) - if tc.err && err == nil { - t.Fatalf("expected error for version: %s", tc.version) - } else if !tc.err && err != nil { - t.Fatalf("error for version %s: %s", tc.version, err) - } - } -} - -func TestVersionCompare(t *testing.T) { - cases := []struct { - v1 string - v2 string - expected int - }{ - {"1.2.3", "1.4.5", -1}, - {"1.2-beta", "1.2-beta", 0}, - {"1.2", "1.1.4", 1}, - {"1.2", "1.2-beta", 1}, - {"1.2+foo", "1.2+beta", 0}, - } - - for _, tc := range cases { - v1, err := NewVersion(tc.v1) - if err != nil { - t.Fatalf("err: %s", err) - } - - v2, err := NewVersion(tc.v2) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := v1.Compare(v2) - expected := tc.expected - if actual != expected { - t.Fatalf( - "%s <=> %s\nexpected: %d\nactual: %d", - tc.v1, tc.v2, - expected, actual) - } - } -} - -func TestComparePreReleases(t *testing.T) { - cases := []struct { - v1 string - v2 string - expected int - }{ - {"1.2-beta.2", "1.2-beta.2", 0}, - {"1.2-beta.1", "1.2-beta.2", -1}, - {"3.2-alpha.1", "3.2-alpha", 1}, - {"1.2-beta.2", "1.2-beta.1", 1}, - {"1.2-beta", "1.2-beta.3", -1}, - {"1.2-alpha", "1.2-beta.3", -1}, - {"1.2-beta", "1.2-alpha.3", 1}, - {"3.0-alpha.3", "3.0-rc.1", -1}, - {"3.0-alpha3", "3.0-rc1", -1}, - {"3.0-alpha.1", "3.0-alpha.beta", -1}, - {"5.4-alpha", "5.4-alpha.beta", 1}, - } - - for _, tc := range cases { - v1, err := NewVersion(tc.v1) - if err != nil { - t.Fatalf("err: %s", err) - } - - v2, err := NewVersion(tc.v2) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := v1.Compare(v2) - expected := tc.expected - if actual != expected { - t.Fatalf( - "%s <=> %s\nexpected: %d\nactual: %d", - tc.v1, tc.v2, - expected, actual) - } - } -} - -func TestVersionMetadata(t *testing.T) { - cases := []struct { - version string - expected string - }{ - {"1.2.3", ""}, - {"1.2-beta", ""}, - {"1.2.0-x.Y.0", ""}, - {"1.2.0-x.Y.0+metadata", "metadata"}, - } - - for _, tc := range cases { - v, err := NewVersion(tc.version) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := v.Metadata() - expected := tc.expected - if actual != expected { - t.Fatalf("expected: %s\nactual: %s", expected, actual) - } - } -} - -func TestVersionPrerelease(t *testing.T) { - cases := []struct { - version string - expected string - }{ - {"1.2.3", ""}, - {"1.2-beta", "beta"}, - {"1.2.0-x.Y.0", "x.Y.0"}, - {"1.2.0-x.Y.0+metadata", "x.Y.0"}, - } - - for _, tc := range cases { - v, err := NewVersion(tc.version) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := v.Prerelease() - expected := tc.expected - if actual != expected { - t.Fatalf("expected: %s\nactual: %s", expected, actual) - } - } -} - -func TestVersionSegments(t *testing.T) { - cases := []struct { - version string - expected []int - }{ - {"1.2.3", []int{1, 2, 3}}, - {"1.2-beta", []int{1, 2, 0}}, - {"1-x.Y.0", []int{1, 0, 0}}, - {"1.2.0-x.Y.0+metadata", []int{1, 2, 0}}, - } - - for _, tc := range cases { - v, err := NewVersion(tc.version) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := v.Segments() - expected := tc.expected - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("expected: %#v\nactual: %#v", expected, actual) - } - } -} - -func TestVersionString(t *testing.T) { - cases := [][]string{ - {"1.2.3", "1.2.3"}, - {"1.2-beta", "1.2.0-beta"}, - {"1.2.0-x.Y.0", "1.2.0-x.Y.0"}, - {"1.2.0-x.Y.0+metadata", "1.2.0-x.Y.0+metadata"}, - } - - for _, tc := range cases { - v, err := NewVersion(tc[0]) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := v.String() - expected := tc[1] - if actual != expected { - t.Fatalf("expected: %s\nactual: %s", expected, actual) - } - } -} diff --git a/vendor/github.com/hashicorp/hcl/decoder_test.go b/vendor/github.com/hashicorp/hcl/decoder_test.go deleted file mode 100644 index c02bb57fbc..0000000000 --- a/vendor/github.com/hashicorp/hcl/decoder_test.go +++ /dev/null @@ -1,664 +0,0 @@ -package hcl - -import ( - "io/ioutil" - "path/filepath" - "reflect" - "testing" - - "github.com/hashicorp/hcl/hcl/ast" -) - -func TestDecode_interface(t *testing.T) { - cases := []struct { - File string - Err bool - Out interface{} - }{ - { - "basic.hcl", - false, - map[string]interface{}{ - "foo": "bar", - "bar": "${file(\"bing/bong.txt\")}", - }, - }, - { - "basic_squish.hcl", - false, - map[string]interface{}{ - "foo": "bar", - "bar": "${file(\"bing/bong.txt\")}", - "foo-bar": "baz", - }, - }, - { - "empty.hcl", - false, - map[string]interface{}{ - "resource": []map[string]interface{}{ - map[string]interface{}{ - "foo": []map[string]interface{}{ - map[string]interface{}{}, - }, - }, - }, - }, - }, - { - "tfvars.hcl", - false, - map[string]interface{}{ - "regularvar": "Should work", - "map.key1": "Value", - "map.key2": "Other value", - }, - }, - { - "escape.hcl", - false, - map[string]interface{}{ - "foo": "bar\"baz\\n", - }, - }, - { - "interpolate_escape.hcl", - false, - map[string]interface{}{ - "foo": "${file(\"bing/bong.txt\")}", - }, - }, - { - "float.hcl", - false, - map[string]interface{}{ - "a": 1.02, - }, - }, - { - "multiline_bad.hcl", - true, - nil, - }, - { - "multiline_no_marker.hcl", - true, - nil, - }, - { - "multiline.hcl", - false, - map[string]interface{}{"foo": "bar\nbaz\n"}, - }, - { - "multiline_no_eof.hcl", - false, - map[string]interface{}{"foo": "bar\nbaz\n", "key": "value"}, - }, - { - "multiline.json", - false, - map[string]interface{}{"foo": "bar\nbaz"}, - }, - { - "scientific.json", - false, - map[string]interface{}{ - "a": 1e-10, - "b": 1e+10, - "c": 1e10, - "d": 1.2e-10, - "e": 1.2e+10, - "f": 1.2e10, - }, - }, - { - "scientific.hcl", - false, - map[string]interface{}{ - "a": 1e-10, - "b": 1e+10, - "c": 1e10, - "d": 1.2e-10, - "e": 1.2e+10, - "f": 1.2e10, - }, - }, - { - "terraform_heroku.hcl", - false, - map[string]interface{}{ - "name": "terraform-test-app", - "config_vars": []map[string]interface{}{ - map[string]interface{}{ - "FOO": "bar", - }, - }, - }, - }, - { - "structure_multi.hcl", - false, - map[string]interface{}{ - "foo": []map[string]interface{}{ - map[string]interface{}{ - "baz": []map[string]interface{}{ - map[string]interface{}{"key": 7}, - }, - }, - map[string]interface{}{ - "bar": []map[string]interface{}{ - map[string]interface{}{"key": 12}, - }, - }, - }, - }, - }, - { - "structure_multi.json", - false, - map[string]interface{}{ - "foo": []map[string]interface{}{ - map[string]interface{}{ - "baz": []map[string]interface{}{ - map[string]interface{}{"key": 7}, - }, - }, - map[string]interface{}{ - "bar": []map[string]interface{}{ - map[string]interface{}{"key": 12}, - }, - }, - }, - }, - }, - { - "structure_list.hcl", - false, - map[string]interface{}{ - "foo": []map[string]interface{}{ - map[string]interface{}{ - "key": 7, - }, - map[string]interface{}{ - "key": 12, - }, - }, - }, - }, - { - "structure_list.json", - false, - map[string]interface{}{ - "foo": []map[string]interface{}{ - map[string]interface{}{ - "key": 7, - }, - map[string]interface{}{ - "key": 12, - }, - }, - }, - }, - { - "structure_list_deep.json", - false, - map[string]interface{}{ - "bar": []map[string]interface{}{ - map[string]interface{}{ - "foo": []map[string]interface{}{ - map[string]interface{}{ - "name": "terraform_example", - "ingress": []map[string]interface{}{ - map[string]interface{}{ - "from_port": 22, - }, - map[string]interface{}{ - "from_port": 80, - }, - }, - }, - }, - }, - }, - }, - }, - - { - "nested_block_comment.hcl", - false, - map[string]interface{}{ - "bar": "value", - }, - }, - - { - "unterminated_block_comment.hcl", - true, - nil, - }, - - { - "object_list.json", - false, - map[string]interface{}{ - "resource": []map[string]interface{}{ - map[string]interface{}{ - "aws_instance": []map[string]interface{}{ - map[string]interface{}{ - "db": []map[string]interface{}{ - map[string]interface{}{ - "vpc": "foo", - "provisioner": []map[string]interface{}{ - map[string]interface{}{ - "file": []map[string]interface{}{ - map[string]interface{}{ - "source": "foo", - "destination": "bar", - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - } - - for _, tc := range cases { - t.Logf("Testing: %s", tc.File) - d, err := ioutil.ReadFile(filepath.Join(fixtureDir, tc.File)) - if err != nil { - t.Fatalf("err: %s", err) - } - - var out interface{} - err = Decode(&out, string(d)) - if (err != nil) != tc.Err { - t.Fatalf("Input: %s\n\nError: %s", tc.File, err) - } - - if !reflect.DeepEqual(out, tc.Out) { - t.Fatalf("Input: %s. Actual, Expected.\n\n%#v\n\n%#v", tc.File, out, tc.Out) - } - } -} - -func TestDecode_equal(t *testing.T) { - cases := []struct { - One, Two string - }{ - { - "basic.hcl", - "basic.json", - }, - { - "float.hcl", - "float.json", - }, - /* - { - "structure.hcl", - "structure.json", - }, - */ - { - "structure.hcl", - "structure_flat.json", - }, - { - "terraform_heroku.hcl", - "terraform_heroku.json", - }, - } - - for _, tc := range cases { - p1 := filepath.Join(fixtureDir, tc.One) - p2 := filepath.Join(fixtureDir, tc.Two) - - d1, err := ioutil.ReadFile(p1) - if err != nil { - t.Fatalf("err: %s", err) - } - - d2, err := ioutil.ReadFile(p2) - if err != nil { - t.Fatalf("err: %s", err) - } - - var i1, i2 interface{} - err = Decode(&i1, string(d1)) - if err != nil { - t.Fatalf("err: %s", err) - } - - err = Decode(&i2, string(d2)) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(i1, i2) { - t.Fatalf( - "%s != %s\n\n%#v\n\n%#v", - tc.One, tc.Two, - i1, i2) - } - } -} - -func TestDecode_flatMap(t *testing.T) { - var val map[string]map[string]string - - err := Decode(&val, testReadFile(t, "structure_flatmap.hcl")) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := map[string]map[string]string{ - "foo": map[string]string{ - "foo": "bar", - "key": "7", - }, - } - - if !reflect.DeepEqual(val, expected) { - t.Fatalf("Actual: %#v\n\nExpected: %#v", val, expected) - } -} - -func TestDecode_structure(t *testing.T) { - type V struct { - Key int - Foo string - } - - var actual V - - err := Decode(&actual, testReadFile(t, "flat.hcl")) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := V{ - Key: 7, - Foo: "bar", - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("Actual: %#v\n\nExpected: %#v", actual, expected) - } -} - -func TestDecode_structurePtr(t *testing.T) { - type V struct { - Key int - Foo string - } - - var actual *V - - err := Decode(&actual, testReadFile(t, "flat.hcl")) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := &V{ - Key: 7, - Foo: "bar", - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("Actual: %#v\n\nExpected: %#v", actual, expected) - } -} - -func TestDecode_structureArray(t *testing.T) { - // This test is extracted from a failure in Consul (consul.io), - // hence the interesting structure naming. - - type KeyPolicyType string - - type KeyPolicy struct { - Prefix string `hcl:",key"` - Policy KeyPolicyType - } - - type Policy struct { - Keys []KeyPolicy `hcl:"key,expand"` - } - - expected := Policy{ - Keys: []KeyPolicy{ - KeyPolicy{ - Prefix: "", - Policy: "read", - }, - KeyPolicy{ - Prefix: "foo/", - Policy: "write", - }, - KeyPolicy{ - Prefix: "foo/bar/", - Policy: "read", - }, - KeyPolicy{ - Prefix: "foo/bar/baz", - Policy: "deny", - }, - }, - } - - files := []string{ - "decode_policy.hcl", - "decode_policy.json", - } - - for _, f := range files { - var actual Policy - - err := Decode(&actual, testReadFile(t, f)) - if err != nil { - t.Fatalf("Input: %s\n\nerr: %s", f, err) - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("Input: %s\n\nActual: %#v\n\nExpected: %#v", f, actual, expected) - } - } -} - -func TestDecode_sliceExpand(t *testing.T) { - type testInner struct { - Name string `hcl:",key"` - Key string - } - - type testStruct struct { - Services []testInner `hcl:"service,expand"` - } - - expected := testStruct{ - Services: []testInner{ - testInner{ - Name: "my-service-0", - Key: "value", - }, - testInner{ - Name: "my-service-1", - Key: "value", - }, - }, - } - - files := []string{ - "slice_expand.hcl", - } - - for _, f := range files { - t.Logf("Testing: %s", f) - - var actual testStruct - err := Decode(&actual, testReadFile(t, f)) - if err != nil { - t.Fatalf("Input: %s\n\nerr: %s", f, err) - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("Input: %s\n\nActual: %#v\n\nExpected: %#v", f, actual, expected) - } - } -} - -func TestDecode_structureMap(t *testing.T) { - // This test is extracted from a failure in Terraform (terraform.io), - // hence the interesting structure naming. - - type hclVariable struct { - Default interface{} - Description string - Fields []string `hcl:",decodedFields"` - } - - type rawConfig struct { - Variable map[string]hclVariable - } - - expected := rawConfig{ - Variable: map[string]hclVariable{ - "foo": hclVariable{ - Default: "bar", - Description: "bar", - Fields: []string{"Default", "Description"}, - }, - - "amis": hclVariable{ - Default: []map[string]interface{}{ - map[string]interface{}{ - "east": "foo", - }, - }, - Fields: []string{"Default"}, - }, - }, - } - - files := []string{ - "decode_tf_variable.hcl", - "decode_tf_variable.json", - } - - for _, f := range files { - t.Logf("Testing: %s", f) - - var actual rawConfig - err := Decode(&actual, testReadFile(t, f)) - if err != nil { - t.Fatalf("Input: %s\n\nerr: %s", f, err) - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("Input: %s\n\nActual: %#v\n\nExpected: %#v", f, actual, expected) - } - } -} - -func TestDecode_interfaceNonPointer(t *testing.T) { - var value interface{} - err := Decode(value, testReadFile(t, "basic_int_string.hcl")) - if err == nil { - t.Fatal("should error") - } -} - -func TestDecode_intString(t *testing.T) { - var value struct { - Count int - } - - err := Decode(&value, testReadFile(t, "basic_int_string.hcl")) - if err != nil { - t.Fatalf("err: %s", err) - } - - if value.Count != 3 { - t.Fatalf("bad: %#v", value.Count) - } -} - -func TestDecode_Node(t *testing.T) { - // given - var value struct { - Content ast.Node - Nested struct { - Content ast.Node - } - } - - content := ` -content { - hello = "world" -} -` - - // when - err := Decode(&value, content) - - // then - if err != nil { - t.Errorf("unable to decode content, %v", err) - return - } - - // verify ast.Node can be decoded later - var v map[string]interface{} - err = DecodeObject(&v, value.Content) - if err != nil { - t.Errorf("unable to decode content, %v", err) - return - } - - if v["hello"] != "world" { - t.Errorf("expected mapping to be returned") - } -} - -func TestDecode_NestedNode(t *testing.T) { - // given - var value struct { - Nested struct { - Content ast.Node - } - } - - content := ` -nested "content" { - hello = "world" -} -` - - // when - err := Decode(&value, content) - - // then - if err != nil { - t.Errorf("unable to decode content, %v", err) - return - } - - // verify ast.Node can be decoded later - var v map[string]interface{} - err = DecodeObject(&v, value.Nested.Content) - if err != nil { - t.Errorf("unable to decode content, %v", err) - return - } - - if v["hello"] != "world" { - t.Errorf("expected mapping to be returned") - } -} - diff --git a/vendor/github.com/hashicorp/hcl/hcl/ast/ast_test.go b/vendor/github.com/hashicorp/hcl/hcl/ast/ast_test.go deleted file mode 100644 index 942256cadc..0000000000 --- a/vendor/github.com/hashicorp/hcl/hcl/ast/ast_test.go +++ /dev/null @@ -1,200 +0,0 @@ -package ast - -import ( - "reflect" - "strings" - "testing" - - "github.com/hashicorp/hcl/hcl/token" -) - -func TestObjectListFilter(t *testing.T) { - var cases = []struct { - Filter []string - Input []*ObjectItem - Output []*ObjectItem - }{ - { - []string{"foo"}, - []*ObjectItem{ - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{ - Token: token.Token{Type: token.STRING, Text: `"foo"`}, - }, - }, - }, - }, - []*ObjectItem{ - &ObjectItem{ - Keys: []*ObjectKey{}, - }, - }, - }, - - { - []string{"foo"}, - []*ObjectItem{ - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"foo"`}}, - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}}, - }, - }, - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"baz"`}}, - }, - }, - }, - []*ObjectItem{ - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}}, - }, - }, - }, - }, - } - - for _, tc := range cases { - input := &ObjectList{Items: tc.Input} - expected := &ObjectList{Items: tc.Output} - if actual := input.Filter(tc.Filter...); !reflect.DeepEqual(actual, expected) { - t.Fatalf("in order: input, expected, actual\n\n%#v\n\n%#v\n\n%#v", input, expected, actual) - } - } -} - -func TestWalk(t *testing.T) { - items := []*ObjectItem{ - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"foo"`}}, - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}}, - }, - Val: &LiteralType{Token: token.Token{Type: token.STRING, Text: `"example"`}}, - }, - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"baz"`}}, - }, - }, - } - - node := &ObjectList{Items: items} - - order := []string{ - "*ast.ObjectList", - "*ast.ObjectItem", - "*ast.ObjectKey", - "*ast.ObjectKey", - "*ast.LiteralType", - "*ast.ObjectItem", - "*ast.ObjectKey", - } - count := 0 - - Walk(node, func(n Node) (Node, bool) { - if n == nil { - return n, false - } - - typeName := reflect.TypeOf(n).String() - if order[count] != typeName { - t.Errorf("expected '%s' got: '%s'", order[count], typeName) - } - count++ - return n, true - }) -} - -func TestWalkEquality(t *testing.T) { - items := []*ObjectItem{ - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"foo"`}}, - }, - }, - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}}, - }, - }, - } - - node := &ObjectList{Items: items} - - rewritten := Walk(node, func(n Node) (Node, bool) { return n, true }) - - newNode, ok := rewritten.(*ObjectList) - if !ok { - t.Fatalf("expected Objectlist, got %T", rewritten) - } - - if !reflect.DeepEqual(node, newNode) { - t.Fatal("rewritten node is not equal to the given node") - } - - if len(newNode.Items) != 2 { - t.Error("expected newNode length 2, got: %d", len(newNode.Items)) - } - - expected := []string{ - `"foo"`, - `"bar"`, - } - - for i, item := range newNode.Items { - if len(item.Keys) != 1 { - t.Error("expected keys newNode length 1, got: %d", len(item.Keys)) - } - - if item.Keys[0].Token.Text != expected[i] { - t.Errorf("expected key %s, got %s", expected[i], item.Keys[0].Token.Text) - } - - if item.Val != nil { - t.Errorf("expected item value should be nil") - } - } -} - -func TestWalkRewrite(t *testing.T) { - items := []*ObjectItem{ - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"foo"`}}, - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}}, - }, - }, - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"baz"`}}, - }, - }, - } - - node := &ObjectList{Items: items} - - suffix := "_example" - node = Walk(node, func(n Node) (Node, bool) { - switch i := n.(type) { - case *ObjectKey: - i.Token.Text = i.Token.Text + suffix - n = i - } - return n, true - }).(*ObjectList) - - Walk(node, func(n Node) (Node, bool) { - switch i := n.(type) { - case *ObjectKey: - if !strings.HasSuffix(i.Token.Text, suffix) { - t.Errorf("Token '%s' should have suffix: %s", i.Token.Text, suffix) - } - } - return n, true - }) - -} diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/error_test.go b/vendor/github.com/hashicorp/hcl/hcl/parser/error_test.go deleted file mode 100644 index 32399fec5d..0000000000 --- a/vendor/github.com/hashicorp/hcl/hcl/parser/error_test.go +++ /dev/null @@ -1,9 +0,0 @@ -package parser - -import ( - "testing" -) - -func TestPosError_impl(t *testing.T) { - var _ error = new(PosError) -} diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/parser_test.go b/vendor/github.com/hashicorp/hcl/hcl/parser/parser_test.go deleted file mode 100644 index f5cca64d0b..0000000000 --- a/vendor/github.com/hashicorp/hcl/hcl/parser/parser_test.go +++ /dev/null @@ -1,323 +0,0 @@ -package parser - -import ( - "fmt" - "io/ioutil" - "path/filepath" - "reflect" - "runtime" - "testing" - - "github.com/hashicorp/hcl/hcl/ast" - "github.com/hashicorp/hcl/hcl/token" -) - -func TestType(t *testing.T) { - var literals = []struct { - typ token.Type - src string - }{ - {token.STRING, `foo = "foo"`}, - {token.NUMBER, `foo = 123`}, - {token.FLOAT, `foo = 123.12`}, - {token.FLOAT, `foo = -123.12`}, - {token.BOOL, `foo = true`}, - {token.HEREDOC, "foo = < 0 { - return errors.New(buf.String()) - } - return nil -} - -// format parses src, prints the corresponding AST, verifies the resulting -// src is syntactically correct, and returns the resulting src or an error -// if any. -func format(src []byte) ([]byte, error) { - // parse src - node, err := parser.Parse(src) - if err != nil { - return nil, fmt.Errorf("parse: %s\n%s", err, src) - } - - var buf bytes.Buffer - - cfg := &Config{} - if err := cfg.Fprint(&buf, node); err != nil { - return nil, fmt.Errorf("print: %s", err) - } - - // make sure formatted output is syntactically correct - res := buf.Bytes() - - if _, err := parser.Parse(src); err != nil { - return nil, fmt.Errorf("parse: %s\n%s", err, src) - } - - return res, nil -} - -// lineAt returns the line in text starting at offset offs. -func lineAt(text []byte, offs int) []byte { - i := offs - for i < len(text) && text[i] != '\n' { - i++ - } - return text[offs:i] -} diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.golden deleted file mode 100644 index e86215f53f..0000000000 --- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.golden +++ /dev/null @@ -1,36 +0,0 @@ -// A standalone comment is a comment which is not attached to any kind of node - -// This comes from Terraform, as a test -variable "foo" { - # Standalone comment should be still here - - default = "bar" - description = "bar" # yooo -} - -/* This is a multi line standalone -comment*/ - -// fatih arslan -/* This is a developer test -account and a multine comment */ -developer = ["fatih", "arslan"] // fatih arslan - -# One line here -numbers = [1, 2] // another line here - -# Another comment -variable = { - description = "bar" # another yooo - - foo { - # Nested standalone - - bar = "fatih" - } -} - -// lead comment -foo { - bar = "fatih" // line comment 2 -} // line comment 3 \ No newline at end of file diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.input deleted file mode 100644 index 57c37ac1de..0000000000 --- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.input +++ /dev/null @@ -1,37 +0,0 @@ -// A standalone comment is a comment which is not attached to any kind of node - - // This comes from Terraform, as a test -variable "foo" { - # Standalone comment should be still here - - default = "bar" - description = "bar" # yooo -} - -/* This is a multi line standalone -comment*/ - - -// fatih arslan -/* This is a developer test -account and a multine comment */ -developer = [ "fatih", "arslan"] // fatih arslan - -# One line here -numbers = [1,2] // another line here - - # Another comment -variable = { - description = "bar" # another yooo - foo { - # Nested standalone - - bar = "fatih" - } -} - - // lead comment -foo { - bar = "fatih" // line comment 2 -} // line comment 3 - diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.golden deleted file mode 100644 index 5d0e8d6951..0000000000 --- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.golden +++ /dev/null @@ -1,25 +0,0 @@ -aligned { - # We have some aligned items below - foo = "fatih" # yoo1 - default = "bar" # yoo2 - bar = "bar and foo" # yoo3 - - default = { - bar = "example" - } - - #deneme arslan - fatih = ["fatih"] # yoo4 - - #fatih arslan - fatiharslan = ["arslan"] // yoo5 - - default = { - bar = "example" - } - - security_groups = [ - "foo", # kenya 1 - "${aws_security_group.firewall.foo}", # kenya 2 - ] -} \ No newline at end of file diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.input deleted file mode 100644 index 1c6ba0de7b..0000000000 --- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.input +++ /dev/null @@ -1,21 +0,0 @@ -aligned { -# We have some aligned items below - foo = "fatih" # yoo1 - default = "bar" # yoo2 - bar = "bar and foo" # yoo3 - default = { - bar = "example" - } - #deneme arslan - fatih = ["fatih"] # yoo4 - #fatih arslan - fatiharslan = ["arslan"] // yoo5 - default = { - bar = "example" - } - -security_groups = [ - "foo", # kenya 1 - "${aws_security_group.firewall.foo}", # kenya 2 -] -} diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.golden deleted file mode 100644 index 962dbf2b36..0000000000 --- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.golden +++ /dev/null @@ -1,16 +0,0 @@ -// A standalone comment - -aligned { - # Standalone 1 - - a = "bar" # yoo1 - default = "bar" # yoo2 - - # Standalone 2 -} - -# Standalone 3 - -numbers = [1, 2] // another line here - -# Standalone 4 diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.input deleted file mode 100644 index 4436cb16c0..0000000000 --- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.input +++ /dev/null @@ -1,16 +0,0 @@ -// A standalone comment - -aligned { - # Standalone 1 - - a = "bar" # yoo1 - default = "bar" # yoo2 - - # Standalone 2 -} - - # Standalone 3 - -numbers = [1,2] // another line here - - # Standalone 4 diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/complexhcl.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/complexhcl.golden deleted file mode 100644 index b733a27e46..0000000000 --- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/complexhcl.golden +++ /dev/null @@ -1,54 +0,0 @@ -variable "foo" { - default = "bar" - description = "bar" -} - -developer = ["fatih", "arslan"] - -provider "aws" { - access_key = "foo" - secret_key = "bar" -} - -provider "do" { - api_key = "${var.foo}" -} - -resource "aws_security_group" "firewall" { - count = 5 -} - -resource aws_instance "web" { - ami = "${var.foo}" - - security_groups = [ - "foo", - "${aws_security_group.firewall.foo}", - ] - - network_interface { - device_index = 0 - description = "Main network interface" - } - - network_interface = { - device_index = 1 - - description = < 0 for %q", s.ErrorCount, src) - } -} - -func testTokenList(t *testing.T, tokenList []tokenPair) { - // create artifical source code - buf := new(bytes.Buffer) - for _, ident := range tokenList { - fmt.Fprintf(buf, "%s\n", ident.text) - } - - s := New(buf.Bytes()) - for _, ident := range tokenList { - tok := s.Scan() - if tok.Type != ident.tok { - t.Errorf("tok = %q want %q for %q\n", tok, ident.tok, ident.text) - } - - if tok.Text != ident.text { - t.Errorf("text = %q want %q", tok.String(), ident.text) - } - - } -} - -func countNewlines(s string) int { - n := 0 - for _, ch := range s { - if ch == '\n' { - n++ - } - } - return n -} diff --git a/vendor/github.com/hashicorp/hcl/hcl/strconv/quote_test.go b/vendor/github.com/hashicorp/hcl/hcl/strconv/quote_test.go deleted file mode 100644 index 4a810aa38a..0000000000 --- a/vendor/github.com/hashicorp/hcl/hcl/strconv/quote_test.go +++ /dev/null @@ -1,93 +0,0 @@ -package strconv - -import "testing" - -type quoteTest struct { - in string - out string - ascii string -} - -var quotetests = []quoteTest{ - {"\a\b\f\r\n\t\v", `"\a\b\f\r\n\t\v"`, `"\a\b\f\r\n\t\v"`}, - {"\\", `"\\"`, `"\\"`}, - {"abc\xffdef", `"abc\xffdef"`, `"abc\xffdef"`}, - {"\u263a", `"☺"`, `"\u263a"`}, - {"\U0010ffff", `"\U0010ffff"`, `"\U0010ffff"`}, - {"\x04", `"\x04"`, `"\x04"`}, -} - -type unQuoteTest struct { - in string - out string -} - -var unquotetests = []unQuoteTest{ - {`""`, ""}, - {`"a"`, "a"}, - {`"abc"`, "abc"}, - {`"☺"`, "☺"}, - {`"hello world"`, "hello world"}, - {`"\xFF"`, "\xFF"}, - {`"\377"`, "\377"}, - {`"\u1234"`, "\u1234"}, - {`"\U00010111"`, "\U00010111"}, - {`"\U0001011111"`, "\U0001011111"}, - {`"\a\b\f\n\r\t\v\\\""`, "\a\b\f\n\r\t\v\\\""}, - {`"'"`, "'"}, - {`"${file("foo")}"`, `${file("foo")}`}, - {`"${file(\"foo\")}"`, `${file("foo")}`}, - {`"echo ${var.region}${element(split(",",var.zones),0)}"`, - `echo ${var.region}${element(split(",",var.zones),0)}`}, -} - -var misquoted = []string{ - ``, - `"`, - `"a`, - `"'`, - `b"`, - `"\"`, - `"\9"`, - `"\19"`, - `"\129"`, - `'\'`, - `'\9'`, - `'\19'`, - `'\129'`, - `'ab'`, - `"\x1!"`, - `"\U12345678"`, - `"\z"`, - "`", - "`xxx", - "`\"", - `"\'"`, - `'\"'`, - "\"\n\"", - "\"\\n\n\"", - "'\n'", - `"${"`, - `"${foo{}"`, -} - -func TestUnquote(t *testing.T) { - for _, tt := range unquotetests { - if out, err := Unquote(tt.in); err != nil || out != tt.out { - t.Errorf("Unquote(%#q) = %q, %v want %q, nil", tt.in, out, err, tt.out) - } - } - - // run the quote tests too, backward - for _, tt := range quotetests { - if in, err := Unquote(tt.out); in != tt.in { - t.Errorf("Unquote(%#q) = %q, %v, want %q, nil", tt.out, in, err, tt.in) - } - } - - for _, s := range misquoted { - if out, err := Unquote(s); out != "" || err != ErrSyntax { - t.Errorf("Unquote(%#q) = %q, %v want %q, %v", s, out, err, "", ErrSyntax) - } - } -} diff --git a/vendor/github.com/hashicorp/hcl/hcl/token/token_test.go b/vendor/github.com/hashicorp/hcl/hcl/token/token_test.go deleted file mode 100644 index b5b766c16a..0000000000 --- a/vendor/github.com/hashicorp/hcl/hcl/token/token_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package token - -import ( - "reflect" - "testing" -) - -func TestTypeString(t *testing.T) { - var tokens = []struct { - tt Type - str string - }{ - {ILLEGAL, "ILLEGAL"}, - {EOF, "EOF"}, - {COMMENT, "COMMENT"}, - {IDENT, "IDENT"}, - {NUMBER, "NUMBER"}, - {FLOAT, "FLOAT"}, - {BOOL, "BOOL"}, - {STRING, "STRING"}, - {HEREDOC, "HEREDOC"}, - {LBRACK, "LBRACK"}, - {LBRACE, "LBRACE"}, - {COMMA, "COMMA"}, - {PERIOD, "PERIOD"}, - {RBRACK, "RBRACK"}, - {RBRACE, "RBRACE"}, - {ASSIGN, "ASSIGN"}, - {ADD, "ADD"}, - {SUB, "SUB"}, - } - - for _, token := range tokens { - if token.tt.String() != token.str { - t.Errorf("want: %q got:%q\n", token.str, token.tt) - } - } - -} - -func TestTokenValue(t *testing.T) { - var tokens = []struct { - tt Token - v interface{} - }{ - {Token{Type: BOOL, Text: `true`}, true}, - {Token{Type: BOOL, Text: `false`}, false}, - {Token{Type: FLOAT, Text: `3.14`}, float64(3.14)}, - {Token{Type: NUMBER, Text: `42`}, int64(42)}, - {Token{Type: IDENT, Text: `foo`}, "foo"}, - {Token{Type: STRING, Text: `"foo"`}, "foo"}, - {Token{Type: STRING, Text: `"foo\nbar"`}, "foo\nbar"}, - {Token{Type: STRING, Text: `"${file(\"foo\")}"`}, `${file("foo")}`}, - {Token{Type: HEREDOC, Text: "< 0 for %q", s.ErrorCount, src) - } -} - -func testTokenList(t *testing.T, tokenList []tokenPair) { - // create artifical source code - buf := new(bytes.Buffer) - for _, ident := range tokenList { - fmt.Fprintf(buf, "%s\n", ident.text) - } - - s := New(buf.Bytes()) - for _, ident := range tokenList { - tok := s.Scan() - if tok.Type != ident.tok { - t.Errorf("tok = %q want %q for %q\n", tok, ident.tok, ident.text) - } - - if tok.Text != ident.text { - t.Errorf("text = %q want %q", tok.String(), ident.text) - } - - } -} - -func countNewlines(s string) int { - n := 0 - for _, ch := range s { - if ch == '\n' { - n++ - } - } - return n -} diff --git a/vendor/github.com/hashicorp/hcl/json/token/token_test.go b/vendor/github.com/hashicorp/hcl/json/token/token_test.go deleted file mode 100644 index a83fdd55bb..0000000000 --- a/vendor/github.com/hashicorp/hcl/json/token/token_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package token - -import ( - "testing" -) - -func TestTypeString(t *testing.T) { - var tokens = []struct { - tt Type - str string - }{ - {ILLEGAL, "ILLEGAL"}, - {EOF, "EOF"}, - {NUMBER, "NUMBER"}, - {FLOAT, "FLOAT"}, - {BOOL, "BOOL"}, - {STRING, "STRING"}, - {NULL, "NULL"}, - {LBRACK, "LBRACK"}, - {LBRACE, "LBRACE"}, - {COMMA, "COMMA"}, - {PERIOD, "PERIOD"}, - {RBRACK, "RBRACK"}, - {RBRACE, "RBRACE"}, - } - - for _, token := range tokens { - if token.tt.String() != token.str { - t.Errorf("want: %q got:%q\n", token.str, token.tt) - - } - } - -} diff --git a/vendor/github.com/hashicorp/hcl/lex_test.go b/vendor/github.com/hashicorp/hcl/lex_test.go deleted file mode 100644 index f7ee37886b..0000000000 --- a/vendor/github.com/hashicorp/hcl/lex_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package hcl - -import ( - "testing" -) - -func TestLexMode(t *testing.T) { - cases := []struct { - Input string - Mode lexModeValue - }{ - { - "", - lexModeHcl, - }, - { - "foo", - lexModeHcl, - }, - { - "{}", - lexModeJson, - }, - { - " {}", - lexModeJson, - }, - } - - for i, tc := range cases { - actual := lexMode(tc.Input) - - if actual != tc.Mode { - t.Fatalf("%d: %#v", i, actual) - } - } -} diff --git a/vendor/github.com/hashicorp/logutils/level_benchmark_test.go b/vendor/github.com/hashicorp/logutils/level_benchmark_test.go deleted file mode 100644 index 3c2caf70e1..0000000000 --- a/vendor/github.com/hashicorp/logutils/level_benchmark_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package logutils - -import ( - "io/ioutil" - "testing" -) - -var messages [][]byte - -func init() { - messages = [][]byte{ - []byte("[TRACE] foo"), - []byte("[DEBUG] foo"), - []byte("[INFO] foo"), - []byte("[WARN] foo"), - []byte("[ERROR] foo"), - } -} - -func BenchmarkDiscard(b *testing.B) { - for i := 0; i < b.N; i++ { - ioutil.Discard.Write(messages[i%len(messages)]) - } -} - -func BenchmarkLevelFilter(b *testing.B) { - filter := &LevelFilter{ - Levels: []LogLevel{"TRACE", "DEBUG", "INFO", "WARN", "ERROR"}, - MinLevel: "WARN", - Writer: ioutil.Discard, - } - - b.ResetTimer() - for i := 0; i < b.N; i++ { - filter.Write(messages[i%len(messages)]) - } -} diff --git a/vendor/github.com/hashicorp/logutils/level_test.go b/vendor/github.com/hashicorp/logutils/level_test.go deleted file mode 100644 index f6b6ac3c37..0000000000 --- a/vendor/github.com/hashicorp/logutils/level_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package logutils - -import ( - "bytes" - "io" - "log" - "testing" -) - -func TestLevelFilter_impl(t *testing.T) { - var _ io.Writer = new(LevelFilter) -} - -func TestLevelFilter(t *testing.T) { - buf := new(bytes.Buffer) - filter := &LevelFilter{ - Levels: []LogLevel{"DEBUG", "WARN", "ERROR"}, - MinLevel: "WARN", - Writer: buf, - } - - logger := log.New(filter, "", 0) - logger.Print("[WARN] foo") - logger.Println("[ERROR] bar") - logger.Println("[DEBUG] baz") - logger.Println("[WARN] buzz") - - result := buf.String() - expected := "[WARN] foo\n[ERROR] bar\n[WARN] buzz\n" - if result != expected { - t.Fatalf("bad: %#v", result) - } -} - -func TestLevelFilterCheck(t *testing.T) { - filter := &LevelFilter{ - Levels: []LogLevel{"DEBUG", "WARN", "ERROR"}, - MinLevel: "WARN", - Writer: nil, - } - - testCases := []struct { - line string - check bool - }{ - {"[WARN] foo\n", true}, - {"[ERROR] bar\n", true}, - {"[DEBUG] baz\n", false}, - {"[WARN] buzz\n", true}, - } - - for _, testCase := range testCases { - result := filter.Check([]byte(testCase.line)) - if result != testCase.check { - t.Errorf("Fail: %s", testCase.line) - } - } -} - -func TestLevelFilter_SetMinLevel(t *testing.T) { - filter := &LevelFilter{ - Levels: []LogLevel{"DEBUG", "WARN", "ERROR"}, - MinLevel: "ERROR", - Writer: nil, - } - - testCases := []struct { - line string - checkBefore bool - checkAfter bool - }{ - {"[WARN] foo\n", false, true}, - {"[ERROR] bar\n", true, true}, - {"[DEBUG] baz\n", false, false}, - {"[WARN] buzz\n", false, true}, - } - - for _, testCase := range testCases { - result := filter.Check([]byte(testCase.line)) - if result != testCase.checkBefore { - t.Errorf("Fail: %s", testCase.line) - } - } - - // Update the minimum level to WARN - filter.SetMinLevel("WARN") - - for _, testCase := range testCases { - result := filter.Check([]byte(testCase.line)) - if result != testCase.checkAfter { - t.Errorf("Fail: %s", testCase.line) - } - } -} diff --git a/vendor/github.com/hashicorp/serf/LICENSE b/vendor/github.com/hashicorp/serf/LICENSE new file mode 100644 index 0000000000..c33dcc7c92 --- /dev/null +++ b/vendor/github.com/hashicorp/serf/LICENSE @@ -0,0 +1,354 @@ +Mozilla Public License, version 2.0 + +1. Definitions + +1.1. “Contributor” + + means each individual or legal entity that creates, contributes to the + creation of, or owns Covered Software. + +1.2. “Contributor Version” + + means the combination of the Contributions of others (if any) used by a + Contributor and that particular Contributor’s Contribution. + +1.3. “Contribution” + + means Covered Software of a particular Contributor. + +1.4. “Covered Software” + + means Source Code Form to which the initial Contributor has attached the + notice in Exhibit A, the Executable Form of such Source Code Form, and + Modifications of such Source Code Form, in each case including portions + thereof. + +1.5. “Incompatible With Secondary Licenses” + means + + a. that the initial Contributor has attached the notice described in + Exhibit B to the Covered Software; or + + b. that the Covered Software was made available under the terms of version + 1.1 or earlier of the License, but not also under the terms of a + Secondary License. + +1.6. “Executable Form” + + means any form of the work other than Source Code Form. + +1.7. “Larger Work” + + means a work that combines Covered Software with other material, in a separate + file or files, that is not Covered Software. + +1.8. “License” + + means this document. + +1.9. “Licensable” + + means having the right to grant, to the maximum extent possible, whether at the + time of the initial grant or subsequently, any and all of the rights conveyed by + this License. + +1.10. “Modifications” + + means any of the following: + + a. any file in Source Code Form that results from an addition to, deletion + from, or modification of the contents of Covered Software; or + + b. any new file in Source Code Form that contains any Covered Software. + +1.11. “Patent Claims” of a Contributor + + means any patent claim(s), including without limitation, method, process, + and apparatus claims, in any patent Licensable by such Contributor that + would be infringed, but for the grant of the License, by the making, + using, selling, offering for sale, having made, import, or transfer of + either its Contributions or its Contributor Version. + +1.12. “Secondary License” + + means either the GNU General Public License, Version 2.0, the GNU Lesser + General Public License, Version 2.1, the GNU Affero General Public + License, Version 3.0, or any later versions of those licenses. + +1.13. “Source Code Form” + + means the form of the work preferred for making modifications. + +1.14. “You” (or “Your”) + + means an individual or a legal entity exercising rights under this + License. For legal entities, “You” includes any entity that controls, is + controlled by, or is under common control with You. For purposes of this + definition, “control” means (a) the power, direct or indirect, to cause + the direction or management of such entity, whether by contract or + otherwise, or (b) ownership of more than fifty percent (50%) of the + outstanding shares or beneficial ownership of such entity. + + +2. License Grants and Conditions + +2.1. Grants + + Each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + a. under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or as + part of a Larger Work; and + + b. under Patent Claims of such Contributor to make, use, sell, offer for + sale, have made, import, and otherwise transfer either its Contributions + or its Contributor Version. + +2.2. Effective Date + + The licenses granted in Section 2.1 with respect to any Contribution become + effective for each Contribution on the date the Contributor first distributes + such Contribution. + +2.3. Limitations on Grant Scope + + The licenses granted in this Section 2 are the only rights granted under this + License. No additional rights or licenses will be implied from the distribution + or licensing of Covered Software under this License. Notwithstanding Section + 2.1(b) above, no patent license is granted by a Contributor: + + a. for any code that a Contributor has removed from Covered Software; or + + b. for infringements caused by: (i) Your and any other third party’s + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + + c. under Patent Claims infringed by Covered Software in the absence of its + Contributions. + + This License does not grant any rights in the trademarks, service marks, or + logos of any Contributor (except as may be necessary to comply with the + notice requirements in Section 3.4). + +2.4. Subsequent Licenses + + No Contributor makes additional grants as a result of Your choice to + distribute the Covered Software under a subsequent version of this License + (see Section 10.2) or under the terms of a Secondary License (if permitted + under the terms of Section 3.3). + +2.5. Representation + + Each Contributor represents that the Contributor believes its Contributions + are its original creation(s) or it has sufficient rights to grant the + rights to its Contributions conveyed by this License. + +2.6. Fair Use + + This License is not intended to limit any rights You have under applicable + copyright doctrines of fair use, fair dealing, or other equivalents. + +2.7. Conditions + + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in + Section 2.1. + + +3. Responsibilities + +3.1. Distribution of Source Form + + All distribution of Covered Software in Source Code Form, including any + Modifications that You create or to which You contribute, must be under the + terms of this License. You must inform recipients that the Source Code Form + of the Covered Software is governed by the terms of this License, and how + they can obtain a copy of this License. You may not attempt to alter or + restrict the recipients’ rights in the Source Code Form. + +3.2. Distribution of Executable Form + + If You distribute Covered Software in Executable Form then: + + a. such Covered Software must also be made available in Source Code Form, + as described in Section 3.1, and You must inform recipients of the + Executable Form how they can obtain a copy of such Source Code Form by + reasonable means in a timely manner, at a charge no more than the cost + of distribution to the recipient; and + + b. You may distribute such Executable Form under the terms of this License, + or sublicense it under different terms, provided that the license for + the Executable Form does not attempt to limit or alter the recipients’ + rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + + You may create and distribute a Larger Work under terms of Your choice, + provided that You also comply with the requirements of this License for the + Covered Software. If the Larger Work is a combination of Covered Software + with a work governed by one or more Secondary Licenses, and the Covered + Software is not Incompatible With Secondary Licenses, this License permits + You to additionally distribute such Covered Software under the terms of + such Secondary License(s), so that the recipient of the Larger Work may, at + their option, further distribute the Covered Software under the terms of + either this License or such Secondary License(s). + +3.4. Notices + + You may not remove or alter the substance of any license notices (including + copyright notices, patent notices, disclaimers of warranty, or limitations + of liability) contained within the Source Code Form of the Covered + Software, except that You may alter any license notices to the extent + required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + + You may choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of Covered + Software. However, You may do so only on Your own behalf, and not on behalf + of any Contributor. You must make it absolutely clear that any such + warranty, support, indemnity, or liability obligation is offered by You + alone, and You hereby agree to indemnify every Contributor for any + liability incurred by such Contributor as a result of warranty, support, + indemnity or liability terms You offer. You may include additional + disclaimers of warranty and limitations of liability specific to any + jurisdiction. + +4. Inability to Comply Due to Statute or Regulation + + If it is impossible for You to comply with any of the terms of this License + with respect to some or all of the Covered Software due to statute, judicial + order, or regulation then You must: (a) comply with the terms of this License + to the maximum extent possible; and (b) describe the limitations and the code + they affect. Such description must be placed in a text file included with all + distributions of the Covered Software under this License. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Termination + +5.1. The rights granted under this License will terminate automatically if You + fail to comply with any of its terms. However, if You become compliant, + then the rights granted under this License from a particular Contributor + are reinstated (a) provisionally, unless and until such Contributor + explicitly and finally terminates Your grants, and (b) on an ongoing basis, + if such Contributor fails to notify You of the non-compliance by some + reasonable means prior to 60 days after You have come back into compliance. + Moreover, Your grants from a particular Contributor are reinstated on an + ongoing basis if such Contributor notifies You of the non-compliance by + some reasonable means, this is the first time You have received notice of + non-compliance with this License from such Contributor, and You become + compliant prior to 30 days after Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent + infringement claim (excluding declaratory judgment actions, counter-claims, + and cross-claims) alleging that a Contributor Version directly or + indirectly infringes any patent, then the rights granted to You by any and + all Contributors for the Covered Software under Section 2.1 of this License + shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user + license agreements (excluding distributors and resellers) which have been + validly granted by You or Your distributors under this License prior to + termination shall survive termination. + +6. Disclaimer of Warranty + + Covered Software is provided under this License on an “as is” basis, without + warranty of any kind, either expressed, implied, or statutory, including, + without limitation, warranties that the Covered Software is free of defects, + merchantable, fit for a particular purpose or non-infringing. The entire + risk as to the quality and performance of the Covered Software is with You. + Should any Covered Software prove defective in any respect, You (not any + Contributor) assume the cost of any necessary servicing, repair, or + correction. This disclaimer of warranty constitutes an essential part of this + License. No use of any Covered Software is authorized under this License + except under this disclaimer. + +7. Limitation of Liability + + Under no circumstances and under no legal theory, whether tort (including + negligence), contract, or otherwise, shall any Contributor, or anyone who + distributes Covered Software as permitted above, be liable to You for any + direct, indirect, special, incidental, or consequential damages of any + character including, without limitation, damages for lost profits, loss of + goodwill, work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses, even if such party shall have been + informed of the possibility of such damages. This limitation of liability + shall not apply to liability for death or personal injury resulting from such + party’s negligence to the extent applicable law prohibits such limitation. + Some jurisdictions do not allow the exclusion or limitation of incidental or + consequential damages, so this exclusion and limitation may not apply to You. + +8. Litigation + + Any litigation relating to this License may be brought only in the courts of + a jurisdiction where the defendant maintains its principal place of business + and such litigation shall be governed by laws of that jurisdiction, without + reference to its conflict-of-law provisions. Nothing in this Section shall + prevent a party’s ability to bring cross-claims or counter-claims. + +9. Miscellaneous + + This License represents the complete agreement concerning the subject matter + hereof. If any provision of this License is held to be unenforceable, such + provision shall be reformed only to the extent necessary to make it + enforceable. Any law or regulation which provides that the language of a + contract shall be construed against the drafter shall not be used to construe + this License against a Contributor. + + +10. Versions of the License + +10.1. New Versions + + Mozilla Foundation is the license steward. Except as provided in Section + 10.3, no one other than the license steward has the right to modify or + publish new versions of this License. Each version will be given a + distinguishing version number. + +10.2. Effect of New Versions + + You may distribute the Covered Software under the terms of the version of + the License under which You originally received the Covered Software, or + under the terms of any subsequent version published by the license + steward. + +10.3. Modified Versions + + If you create software not governed by this License, and you want to + create a new license for such software, you may create and use a modified + version of this License if you rename the license and remove any + references to the name of the license steward (except to note that such + modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses + If You choose to distribute Source Code Form that is Incompatible With + Secondary Licenses under the terms of this version of the License, the + notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the + terms of the Mozilla Public License, v. + 2.0. If a copy of the MPL was not + distributed with this file, You can + obtain one at + http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular file, then +You may include the notice in a location (such as a LICENSE file in a relevant +directory) where a recipient would be likely to look for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - “Incompatible With Secondary Licenses” Notice + + This Source Code Form is “Incompatible + With Secondary Licenses”, as defined by + the Mozilla Public License, v. 2.0. + diff --git a/vendor/github.com/hashicorp/serf/coordinate/client_test.go b/vendor/github.com/hashicorp/serf/coordinate/client_test.go deleted file mode 100644 index ae7d58c0db..0000000000 --- a/vendor/github.com/hashicorp/serf/coordinate/client_test.go +++ /dev/null @@ -1,109 +0,0 @@ -package coordinate - -import ( - "reflect" - "strings" - "testing" - "time" -) - -func TestClient_NewClient(t *testing.T) { - config := DefaultConfig() - - config.Dimensionality = 0 - client, err := NewClient(config) - if err == nil || !strings.Contains(err.Error(), "dimensionality") { - t.Fatal(err) - } - - config.Dimensionality = 7 - client, err = NewClient(config) - if err != nil { - t.Fatal(err) - } - - origin := NewCoordinate(config) - if !reflect.DeepEqual(client.GetCoordinate(), origin) { - t.Fatalf("fresh client should be located at the origin") - } -} - -func TestClient_Update(t *testing.T) { - config := DefaultConfig() - config.Dimensionality = 3 - - client, err := NewClient(config) - if err != nil { - t.Fatal(err) - } - - // Make sure the Euclidean part of our coordinate is what we expect. - c := client.GetCoordinate() - verifyEqualVectors(t, c.Vec, []float64{0.0, 0.0, 0.0}) - - // Place a node right above the client and observe an RTT longer than the - // client expects, given its distance. - other := NewCoordinate(config) - other.Vec[2] = 0.001 - rtt := time.Duration(2.0 * other.Vec[2] * secondsToNanoseconds) - c = client.Update("node", other, rtt) - - // The client should have scooted down to get away from it. - if !(c.Vec[2] < 0.0) { - t.Fatalf("client z coordinate %9.6f should be < 0.0", c.Vec[2]) - } - - // Set the coordinate to a known state. - c.Vec[2] = 99.0 - client.SetCoordinate(c) - c = client.GetCoordinate() - verifyEqualFloats(t, c.Vec[2], 99.0) -} - -func TestClient_DistanceTo(t *testing.T) { - config := DefaultConfig() - config.Dimensionality = 3 - config.HeightMin = 0 - - client, err := NewClient(config) - if err != nil { - t.Fatal(err) - } - - // Fiddle a raw coordinate to put it a specific number of seconds away. - other := NewCoordinate(config) - other.Vec[2] = 12.345 - expected := time.Duration(other.Vec[2] * secondsToNanoseconds) - dist := client.DistanceTo(other) - if dist != expected { - t.Fatalf("distance doesn't match %9.6f != %9.6f", dist.Seconds(), expected.Seconds()) - } -} - -func TestClient_latencyFilter(t *testing.T) { - config := DefaultConfig() - config.LatencyFilterSize = 3 - - client, err := NewClient(config) - if err != nil { - t.Fatal(err) - } - - // Make sure we get the median, and that things age properly. - verifyEqualFloats(t, client.latencyFilter("alice", 0.201), 0.201) - verifyEqualFloats(t, client.latencyFilter("alice", 0.200), 0.201) - verifyEqualFloats(t, client.latencyFilter("alice", 0.207), 0.201) - - // This glitch will get median-ed out and never seen by Vivaldi. - verifyEqualFloats(t, client.latencyFilter("alice", 1.9), 0.207) - verifyEqualFloats(t, client.latencyFilter("alice", 0.203), 0.207) - verifyEqualFloats(t, client.latencyFilter("alice", 0.199), 0.203) - verifyEqualFloats(t, client.latencyFilter("alice", 0.211), 0.203) - - // Make sure different nodes are not coupled. - verifyEqualFloats(t, client.latencyFilter("bob", 0.310), 0.310) - - // Make sure we don't leak coordinates for nodes that leave. - client.ForgetNode("alice") - verifyEqualFloats(t, client.latencyFilter("alice", 0.888), 0.888) -} diff --git a/vendor/github.com/hashicorp/serf/coordinate/coordinate_test.go b/vendor/github.com/hashicorp/serf/coordinate/coordinate_test.go deleted file mode 100644 index 17f68ac51b..0000000000 --- a/vendor/github.com/hashicorp/serf/coordinate/coordinate_test.go +++ /dev/null @@ -1,260 +0,0 @@ -package coordinate - -import ( - "math" - "reflect" - "testing" - "time" -) - -// verifyDimensionPanic will run the supplied func and make sure it panics with -// the expected error type. -func verifyDimensionPanic(t *testing.T, f func()) { - defer func() { - if r := recover(); r != nil { - if _, ok := r.(DimensionalityConflictError); !ok { - t.Fatalf("panic isn't the right type") - } - } else { - t.Fatalf("didn't get expected panic") - } - }() - f() -} - -func TestCoordinate_NewCoordinate(t *testing.T) { - config := DefaultConfig() - c := NewCoordinate(config) - if uint(len(c.Vec)) != config.Dimensionality { - t.Fatalf("dimensionality not set correctly %d != %d", - len(c.Vec), config.Dimensionality) - } -} - -func TestCoordinate_Clone(t *testing.T) { - c := NewCoordinate(DefaultConfig()) - c.Vec[0], c.Vec[1], c.Vec[2] = 1.0, 2.0, 3.0 - c.Error = 5.0 - c.Adjustment = 10.0 - c.Height = 4.2 - - other := c.Clone() - if !reflect.DeepEqual(c, other) { - t.Fatalf("coordinate clone didn't make a proper copy") - } - - other.Vec[0] = c.Vec[0] + 0.5 - if reflect.DeepEqual(c, other) { - t.Fatalf("cloned coordinate is still pointing at its ancestor") - } -} - -func TestCoordinate_IsCompatibleWith(t *testing.T) { - config := DefaultConfig() - - config.Dimensionality = 3 - c1 := NewCoordinate(config) - c2 := NewCoordinate(config) - - config.Dimensionality = 2 - alien := NewCoordinate(config) - - if !c1.IsCompatibleWith(c1) || !c2.IsCompatibleWith(c2) || - !alien.IsCompatibleWith(alien) { - t.Fatalf("coordinates should be compatible with themselves") - } - - if !c1.IsCompatibleWith(c2) || !c2.IsCompatibleWith(c1) { - t.Fatalf("coordinates should be compatible with each other") - } - - if c1.IsCompatibleWith(alien) || c2.IsCompatibleWith(alien) || - alien.IsCompatibleWith(c1) || alien.IsCompatibleWith(c2) { - t.Fatalf("alien should not be compatible with the other coordinates") - } -} - -func TestCoordinate_ApplyForce(t *testing.T) { - config := DefaultConfig() - config.Dimensionality = 3 - config.HeightMin = 0 - - origin := NewCoordinate(config) - - // This proves that we normalize, get the direction right, and apply the - // force multiplier correctly. - above := NewCoordinate(config) - above.Vec = []float64{0.0, 0.0, 2.9} - c := origin.ApplyForce(config, 5.3, above) - verifyEqualVectors(t, c.Vec, []float64{0.0, 0.0, -5.3}) - - // Scoot a point not starting at the origin to make sure there's nothing - // special there. - right := NewCoordinate(config) - right.Vec = []float64{3.4, 0.0, -5.3} - c = c.ApplyForce(config, 2.0, right) - verifyEqualVectors(t, c.Vec, []float64{-2.0, 0.0, -5.3}) - - // If the points are right on top of each other, then we should end up - // in a random direction, one unit away. This makes sure the unit vector - // build up doesn't divide by zero. - c = origin.ApplyForce(config, 1.0, origin) - verifyEqualFloats(t, origin.DistanceTo(c).Seconds(), 1.0) - - // Enable a minimum height and make sure that gets factored in properly. - config.HeightMin = 10.0e-6 - origin = NewCoordinate(config) - c = origin.ApplyForce(config, 5.3, above) - verifyEqualVectors(t, c.Vec, []float64{0.0, 0.0, -5.3}) - verifyEqualFloats(t, c.Height, config.HeightMin+5.3*config.HeightMin/2.9) - - // Make sure the height minimum is enforced. - c = origin.ApplyForce(config, -5.3, above) - verifyEqualVectors(t, c.Vec, []float64{0.0, 0.0, 5.3}) - verifyEqualFloats(t, c.Height, config.HeightMin) - - // Shenanigans should get called if the dimensions don't match. - bad := c.Clone() - bad.Vec = make([]float64, len(bad.Vec)+1) - verifyDimensionPanic(t, func() { c.ApplyForce(config, 1.0, bad) }) -} - -func TestCoordinate_DistanceTo(t *testing.T) { - config := DefaultConfig() - config.Dimensionality = 3 - config.HeightMin = 0 - - c1, c2 := NewCoordinate(config), NewCoordinate(config) - c1.Vec = []float64{-0.5, 1.3, 2.4} - c2.Vec = []float64{1.2, -2.3, 3.4} - - verifyEqualFloats(t, c1.DistanceTo(c1).Seconds(), 0.0) - verifyEqualFloats(t, c1.DistanceTo(c2).Seconds(), c2.DistanceTo(c1).Seconds()) - verifyEqualFloats(t, c1.DistanceTo(c2).Seconds(), 4.104875150354758) - - // Make sure negative adjustment factors are ignored. - c1.Adjustment = -1.0e6 - verifyEqualFloats(t, c1.DistanceTo(c2).Seconds(), 4.104875150354758) - - // Make sure positive adjustment factors affect the distance. - c1.Adjustment = 0.1 - c2.Adjustment = 0.2 - verifyEqualFloats(t, c1.DistanceTo(c2).Seconds(), 4.104875150354758+0.3) - - // Make sure the heights affect the distance. - c1.Height = 0.7 - c2.Height = 0.1 - verifyEqualFloats(t, c1.DistanceTo(c2).Seconds(), 4.104875150354758+0.3+0.8) - - // Shenanigans should get called if the dimensions don't match. - bad := c1.Clone() - bad.Vec = make([]float64, len(bad.Vec)+1) - verifyDimensionPanic(t, func() { _ = c1.DistanceTo(bad) }) -} - -// dist is a self-contained example that appears in documentation. -func dist(a *Coordinate, b *Coordinate) time.Duration { - // Coordinates will always have the same dimensionality, so this is - // just a sanity check. - if len(a.Vec) != len(b.Vec) { - panic("dimensions aren't compatible") - } - - // Calculate the Euclidean distance plus the heights. - sumsq := 0.0 - for i := 0; i < len(a.Vec); i++ { - diff := a.Vec[i] - b.Vec[i] - sumsq += diff * diff - } - rtt := math.Sqrt(sumsq) + a.Height + b.Height - - // Apply the adjustment components, guarding against negatives. - adjusted := rtt + a.Adjustment + b.Adjustment - if adjusted > 0.0 { - rtt = adjusted - } - - // Go's times are natively nanoseconds, so we convert from seconds. - const secondsToNanoseconds = 1.0e9 - return time.Duration(rtt * secondsToNanoseconds) -} - -func TestCoordinate_dist_Example(t *testing.T) { - config := DefaultConfig() - c1, c2 := NewCoordinate(config), NewCoordinate(config) - c1.Vec = []float64{-0.5, 1.3, 2.4} - c2.Vec = []float64{1.2, -2.3, 3.4} - c1.Adjustment = 0.1 - c2.Adjustment = 0.2 - c1.Height = 0.7 - c2.Height = 0.1 - verifyEqualFloats(t, c1.DistanceTo(c2).Seconds(), dist(c1, c2).Seconds()) -} - -func TestCoordinate_rawDistanceTo(t *testing.T) { - config := DefaultConfig() - config.Dimensionality = 3 - config.HeightMin = 0 - - c1, c2 := NewCoordinate(config), NewCoordinate(config) - c1.Vec = []float64{-0.5, 1.3, 2.4} - c2.Vec = []float64{1.2, -2.3, 3.4} - - verifyEqualFloats(t, c1.rawDistanceTo(c1), 0.0) - verifyEqualFloats(t, c1.rawDistanceTo(c2), c2.rawDistanceTo(c1)) - verifyEqualFloats(t, c1.rawDistanceTo(c2), 4.104875150354758) - - // Make sure that the adjustment doesn't factor into the raw - // distance. - c1.Adjustment = 1.0e6 - verifyEqualFloats(t, c1.rawDistanceTo(c2), 4.104875150354758) - - // Make sure the heights affect the distance. - c1.Height = 0.7 - c2.Height = 0.1 - verifyEqualFloats(t, c1.rawDistanceTo(c2), 4.104875150354758+0.8) -} - -func TestCoordinate_add(t *testing.T) { - vec1 := []float64{1.0, -3.0, 3.0} - vec2 := []float64{-4.0, 5.0, 6.0} - verifyEqualVectors(t, add(vec1, vec2), []float64{-3.0, 2.0, 9.0}) - - zero := []float64{0.0, 0.0, 0.0} - verifyEqualVectors(t, add(vec1, zero), vec1) -} - -func TestCoordinate_diff(t *testing.T) { - vec1 := []float64{1.0, -3.0, 3.0} - vec2 := []float64{-4.0, 5.0, 6.0} - verifyEqualVectors(t, diff(vec1, vec2), []float64{5.0, -8.0, -3.0}) - - zero := []float64{0.0, 0.0, 0.0} - verifyEqualVectors(t, diff(vec1, zero), vec1) -} - -func TestCoordinate_magnitude(t *testing.T) { - zero := []float64{0.0, 0.0, 0.0} - verifyEqualFloats(t, magnitude(zero), 0.0) - - vec := []float64{1.0, -2.0, 3.0} - verifyEqualFloats(t, magnitude(vec), 3.7416573867739413) -} - -func TestCoordinate_unitVectorAt(t *testing.T) { - vec1 := []float64{1.0, 2.0, 3.0} - vec2 := []float64{0.5, 0.6, 0.7} - u, mag := unitVectorAt(vec1, vec2) - verifyEqualVectors(t, u, []float64{0.18257418583505536, 0.511207720338155, 0.8398412548412546}) - verifyEqualFloats(t, magnitude(u), 1.0) - verifyEqualFloats(t, mag, magnitude(diff(vec1, vec2))) - - // If we give positions that are equal we should get a random unit vector - // returned to us, rather than a divide by zero. - u, mag = unitVectorAt(vec1, vec1) - verifyEqualFloats(t, magnitude(u), 1.0) - verifyEqualFloats(t, mag, 0.0) - - // We can't hit the final clause without heroics so I manually forced it - // there to verify it works. -} diff --git a/vendor/github.com/hashicorp/serf/coordinate/performance_test.go b/vendor/github.com/hashicorp/serf/coordinate/performance_test.go deleted file mode 100644 index fc676e20f9..0000000000 --- a/vendor/github.com/hashicorp/serf/coordinate/performance_test.go +++ /dev/null @@ -1,182 +0,0 @@ -package coordinate - -import ( - "math" - "testing" - "time" -) - -func TestPerformance_Line(t *testing.T) { - const spacing = 10 * time.Millisecond - const nodes, cycles = 10, 1000 - config := DefaultConfig() - clients, err := GenerateClients(nodes, config) - if err != nil { - t.Fatal(err) - } - truth := GenerateLine(nodes, spacing) - Simulate(clients, truth, cycles) - stats := Evaluate(clients, truth) - if stats.ErrorAvg > 0.0018 || stats.ErrorMax > 0.0092 { - t.Fatalf("performance stats are out of spec: %v", stats) - } -} - -func TestPerformance_Grid(t *testing.T) { - const spacing = 10 * time.Millisecond - const nodes, cycles = 25, 1000 - config := DefaultConfig() - clients, err := GenerateClients(nodes, config) - if err != nil { - t.Fatal(err) - } - truth := GenerateGrid(nodes, spacing) - Simulate(clients, truth, cycles) - stats := Evaluate(clients, truth) - if stats.ErrorAvg > 0.0015 || stats.ErrorMax > 0.022 { - t.Fatalf("performance stats are out of spec: %v", stats) - } -} - -func TestPerformance_Split(t *testing.T) { - const lan, wan = 1 * time.Millisecond, 10 * time.Millisecond - const nodes, cycles = 25, 1000 - config := DefaultConfig() - clients, err := GenerateClients(nodes, config) - if err != nil { - t.Fatal(err) - } - truth := GenerateSplit(nodes, lan, wan) - Simulate(clients, truth, cycles) - stats := Evaluate(clients, truth) - if stats.ErrorAvg > 0.000060 || stats.ErrorMax > 0.00048 { - t.Fatalf("performance stats are out of spec: %v", stats) - } -} - -func TestPerformance_Height(t *testing.T) { - const radius = 100 * time.Millisecond - const nodes, cycles = 25, 1000 - - // Constrain us to two dimensions so that we can just exactly represent - // the circle. - config := DefaultConfig() - config.Dimensionality = 2 - clients, err := GenerateClients(nodes, config) - if err != nil { - t.Fatal(err) - } - - // Generate truth where the first coordinate is in the "middle" because - // it's equidistant from all the nodes, but it will have an extra radius - // added to the distance, so it should come out above all the others. - truth := GenerateCircle(nodes, radius) - Simulate(clients, truth, cycles) - - // Make sure the height looks reasonable with the regular nodes all in a - // plane, and the center node up above. - for i, _ := range clients { - coord := clients[i].GetCoordinate() - if i == 0 { - if coord.Height < 0.97*radius.Seconds() { - t.Fatalf("height is out of spec: %9.6f", coord.Height) - } - } else { - if coord.Height > 0.03*radius.Seconds() { - t.Fatalf("height is out of spec: %9.6f", coord.Height) - } - } - } - stats := Evaluate(clients, truth) - if stats.ErrorAvg > 0.0025 || stats.ErrorMax > 0.064 { - t.Fatalf("performance stats are out of spec: %v", stats) - } -} - -func TestPerformance_Drift(t *testing.T) { - const dist = 500 * time.Millisecond - const nodes = 4 - config := DefaultConfig() - config.Dimensionality = 2 - clients, err := GenerateClients(nodes, config) - if err != nil { - t.Fatal(err) - } - - // Do some icky surgery on the clients to put them into a square, up in - // the first quadrant. - clients[0].coord.Vec = []float64{0.0, 0.0} - clients[1].coord.Vec = []float64{0.0, dist.Seconds()} - clients[2].coord.Vec = []float64{dist.Seconds(), dist.Seconds()} - clients[3].coord.Vec = []float64{dist.Seconds(), dist.Seconds()} - - // Make a corresponding truth matrix. The nodes are laid out like this - // so the distances are all equal, except for the diagonal: - // - // (1) <- dist -> (2) - // - // | <- dist | - // | | - // | dist -> | - // - // (0) <- dist -> (3) - // - truth := make([][]time.Duration, nodes) - for i := range truth { - truth[i] = make([]time.Duration, nodes) - } - for i := 0; i < nodes; i++ { - for j := i + 1; j < nodes; j++ { - rtt := dist - if (i%2 == 0) && (j%2 == 0) { - rtt = time.Duration(math.Sqrt2 * float64(rtt)) - } - truth[i][j], truth[j][i] = rtt, rtt - } - } - - calcCenterError := func() float64 { - min, max := clients[0].GetCoordinate(), clients[0].GetCoordinate() - for i := 1; i < nodes; i++ { - coord := clients[i].GetCoordinate() - for j, v := range coord.Vec { - min.Vec[j] = math.Min(min.Vec[j], v) - max.Vec[j] = math.Max(max.Vec[j], v) - } - } - - mid := make([]float64, config.Dimensionality) - for i, _ := range mid { - mid[i] = min.Vec[i] + (max.Vec[i]-min.Vec[i])/2 - } - return magnitude(mid) - } - - // Let the simulation run for a while to stabilize, then snap a baseline - // for the center error. - Simulate(clients, truth, 1000) - baseline := calcCenterError() - - // Now run for a bunch more cycles and see if gravity pulls the center - // in the right direction. - Simulate(clients, truth, 10000) - if error := calcCenterError(); error > 0.8*baseline { - t.Fatalf("drift performance out of spec: %9.6f -> %9.6f", baseline, error) - } -} - -func TestPerformance_Random(t *testing.T) { - const mean, deviation = 100 * time.Millisecond, 10 * time.Millisecond - const nodes, cycles = 25, 1000 - config := DefaultConfig() - clients, err := GenerateClients(nodes, config) - if err != nil { - t.Fatal(err) - } - truth := GenerateRandom(nodes, mean, deviation) - Simulate(clients, truth, cycles) - stats := Evaluate(clients, truth) - if stats.ErrorAvg > 0.075 || stats.ErrorMax > 0.33 { - t.Fatalf("performance stats are out of spec: %v", stats) - } -} diff --git a/vendor/github.com/hashicorp/serf/ops-misc/debian/copyright b/vendor/github.com/hashicorp/serf/ops-misc/debian/copyright new file mode 100644 index 0000000000..21a1a1b532 --- /dev/null +++ b/vendor/github.com/hashicorp/serf/ops-misc/debian/copyright @@ -0,0 +1,2 @@ +Name: serf +Copyright: Hashicorp 2013 diff --git a/vendor/github.com/hashicorp/serf/website/LICENSE.md b/vendor/github.com/hashicorp/serf/website/LICENSE.md new file mode 100644 index 0000000000..36c29d7f7b --- /dev/null +++ b/vendor/github.com/hashicorp/serf/website/LICENSE.md @@ -0,0 +1,10 @@ +# Proprietary License + +This license is temporary while a more official one is drafted. However, +this should make it clear: + +* The text contents of this website are MPL 2.0 licensed. + +* The design contents of this website are proprietary and may not be reproduced + or reused in any way other than to run the Serf website locally. The license + for the design is owned solely by HashiCorp, Inc. diff --git a/vendor/github.com/hashicorp/yamux/bench_test.go b/vendor/github.com/hashicorp/yamux/bench_test.go deleted file mode 100644 index 4377b839cd..0000000000 --- a/vendor/github.com/hashicorp/yamux/bench_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package yamux - -import ( - "testing" -) - -func BenchmarkPing(b *testing.B) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - for i := 0; i < b.N; i++ { - rtt, err := client.Ping() - if err != nil { - b.Fatalf("err: %v", err) - } - if rtt == 0 { - b.Fatalf("bad: %v", rtt) - } - } -} - -func BenchmarkAccept(b *testing.B) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - go func() { - for i := 0; i < b.N; i++ { - stream, err := server.AcceptStream() - if err != nil { - return - } - stream.Close() - } - }() - - for i := 0; i < b.N; i++ { - stream, err := client.Open() - if err != nil { - b.Fatalf("err: %v", err) - } - stream.Close() - } -} - -func BenchmarkSendRecv(b *testing.B) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - sendBuf := make([]byte, 512) - recvBuf := make([]byte, 512) - - doneCh := make(chan struct{}) - go func() { - stream, err := server.AcceptStream() - if err != nil { - return - } - defer stream.Close() - for i := 0; i < b.N; i++ { - if _, err := stream.Read(recvBuf); err != nil { - b.Fatalf("err: %v", err) - } - } - close(doneCh) - }() - - stream, err := client.Open() - if err != nil { - b.Fatalf("err: %v", err) - } - defer stream.Close() - for i := 0; i < b.N; i++ { - if _, err := stream.Write(sendBuf); err != nil { - b.Fatalf("err: %v", err) - } - } - <-doneCh -} diff --git a/vendor/github.com/hashicorp/yamux/const_test.go b/vendor/github.com/hashicorp/yamux/const_test.go deleted file mode 100644 index 153da18b95..0000000000 --- a/vendor/github.com/hashicorp/yamux/const_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package yamux - -import ( - "testing" -) - -func TestConst(t *testing.T) { - if protoVersion != 0 { - t.Fatalf("bad: %v", protoVersion) - } - - if typeData != 0 { - t.Fatalf("bad: %v", typeData) - } - if typeWindowUpdate != 1 { - t.Fatalf("bad: %v", typeWindowUpdate) - } - if typePing != 2 { - t.Fatalf("bad: %v", typePing) - } - if typeGoAway != 3 { - t.Fatalf("bad: %v", typeGoAway) - } - - if flagSYN != 1 { - t.Fatalf("bad: %v", flagSYN) - } - if flagACK != 2 { - t.Fatalf("bad: %v", flagACK) - } - if flagFIN != 4 { - t.Fatalf("bad: %v", flagFIN) - } - if flagRST != 8 { - t.Fatalf("bad: %v", flagRST) - } - - if goAwayNormal != 0 { - t.Fatalf("bad: %v", goAwayNormal) - } - if goAwayProtoErr != 1 { - t.Fatalf("bad: %v", goAwayProtoErr) - } - if goAwayInternalErr != 2 { - t.Fatalf("bad: %v", goAwayInternalErr) - } - - if headerSize != 12 { - t.Fatalf("bad header size") - } -} - -func TestEncodeDecode(t *testing.T) { - hdr := header(make([]byte, headerSize)) - hdr.encode(typeWindowUpdate, flagACK|flagRST, 1234, 4321) - - if hdr.Version() != protoVersion { - t.Fatalf("bad: %v", hdr) - } - if hdr.MsgType() != typeWindowUpdate { - t.Fatalf("bad: %v", hdr) - } - if hdr.Flags() != flagACK|flagRST { - t.Fatalf("bad: %v", hdr) - } - if hdr.StreamID() != 1234 { - t.Fatalf("bad: %v", hdr) - } - if hdr.Length() != 4321 { - t.Fatalf("bad: %v", hdr) - } -} diff --git a/vendor/github.com/hashicorp/yamux/session_test.go b/vendor/github.com/hashicorp/yamux/session_test.go deleted file mode 100644 index 8a1b7d5de9..0000000000 --- a/vendor/github.com/hashicorp/yamux/session_test.go +++ /dev/null @@ -1,1153 +0,0 @@ -package yamux - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "log" - "reflect" - "runtime" - "strings" - "sync" - "testing" - "time" -) - -type logCapture struct{ bytes.Buffer } - -func (l *logCapture) logs() []string { - return strings.Split(strings.TrimSpace(l.String()), "\n") -} - -func (l *logCapture) match(expect []string) bool { - return reflect.DeepEqual(l.logs(), expect) -} - -func captureLogs(s *Session) *logCapture { - buf := new(logCapture) - s.logger = log.New(buf, "", 0) - return buf -} - -type pipeConn struct { - reader *io.PipeReader - writer *io.PipeWriter - writeBlocker sync.Mutex -} - -func (p *pipeConn) Read(b []byte) (int, error) { - return p.reader.Read(b) -} - -func (p *pipeConn) Write(b []byte) (int, error) { - p.writeBlocker.Lock() - defer p.writeBlocker.Unlock() - return p.writer.Write(b) -} - -func (p *pipeConn) Close() error { - p.reader.Close() - return p.writer.Close() -} - -func testConn() (io.ReadWriteCloser, io.ReadWriteCloser) { - read1, write1 := io.Pipe() - read2, write2 := io.Pipe() - conn1 := &pipeConn{reader: read1, writer: write2} - conn2 := &pipeConn{reader: read2, writer: write1} - return conn1, conn2 -} - -func testConf() *Config { - conf := DefaultConfig() - conf.AcceptBacklog = 64 - conf.KeepAliveInterval = 100 * time.Millisecond - conf.ConnectionWriteTimeout = 250 * time.Millisecond - return conf -} - -func testConfNoKeepAlive() *Config { - conf := testConf() - conf.EnableKeepAlive = false - return conf -} - -func testClientServer() (*Session, *Session) { - return testClientServerConfig(testConf()) -} - -func testClientServerConfig(conf *Config) (*Session, *Session) { - conn1, conn2 := testConn() - client, _ := Client(conn1, conf) - server, _ := Server(conn2, conf) - return client, server -} - -func TestPing(t *testing.T) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - rtt, err := client.Ping() - if err != nil { - t.Fatalf("err: %v", err) - } - if rtt == 0 { - t.Fatalf("bad: %v", rtt) - } - - rtt, err = server.Ping() - if err != nil { - t.Fatalf("err: %v", err) - } - if rtt == 0 { - t.Fatalf("bad: %v", rtt) - } -} - -func TestPing_Timeout(t *testing.T) { - client, server := testClientServerConfig(testConfNoKeepAlive()) - defer client.Close() - defer server.Close() - - // Prevent the client from responding - clientConn := client.conn.(*pipeConn) - clientConn.writeBlocker.Lock() - - errCh := make(chan error, 1) - go func() { - _, err := server.Ping() // Ping via the server session - errCh <- err - }() - - select { - case err := <-errCh: - if err != ErrTimeout { - t.Fatalf("err: %v", err) - } - case <-time.After(client.config.ConnectionWriteTimeout * 2): - t.Fatalf("failed to timeout within expected %v", client.config.ConnectionWriteTimeout) - } - - // Verify that we recover, even if we gave up - clientConn.writeBlocker.Unlock() - - go func() { - _, err := server.Ping() // Ping via the server session - errCh <- err - }() - - select { - case err := <-errCh: - if err != nil { - t.Fatalf("err: %v", err) - } - case <-time.After(client.config.ConnectionWriteTimeout): - t.Fatalf("timeout") - } -} - -func TestAccept(t *testing.T) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - if client.NumStreams() != 0 { - t.Fatalf("bad") - } - if server.NumStreams() != 0 { - t.Fatalf("bad") - } - - wg := &sync.WaitGroup{} - wg.Add(4) - - go func() { - defer wg.Done() - stream, err := server.AcceptStream() - if err != nil { - t.Fatalf("err: %v", err) - } - if id := stream.StreamID(); id != 1 { - t.Fatalf("bad: %v", id) - } - if err := stream.Close(); err != nil { - t.Fatalf("err: %v", err) - } - }() - - go func() { - defer wg.Done() - stream, err := client.AcceptStream() - if err != nil { - t.Fatalf("err: %v", err) - } - if id := stream.StreamID(); id != 2 { - t.Fatalf("bad: %v", id) - } - if err := stream.Close(); err != nil { - t.Fatalf("err: %v", err) - } - }() - - go func() { - defer wg.Done() - stream, err := server.OpenStream() - if err != nil { - t.Fatalf("err: %v", err) - } - if id := stream.StreamID(); id != 2 { - t.Fatalf("bad: %v", id) - } - if err := stream.Close(); err != nil { - t.Fatalf("err: %v", err) - } - }() - - go func() { - defer wg.Done() - stream, err := client.OpenStream() - if err != nil { - t.Fatalf("err: %v", err) - } - if id := stream.StreamID(); id != 1 { - t.Fatalf("bad: %v", id) - } - if err := stream.Close(); err != nil { - t.Fatalf("err: %v", err) - } - }() - - doneCh := make(chan struct{}) - go func() { - wg.Wait() - close(doneCh) - }() - - select { - case <-doneCh: - case <-time.After(time.Second): - panic("timeout") - } -} - -func TestNonNilInterface(t *testing.T) { - _, server := testClientServer() - server.Close() - - conn, err := server.Accept() - if err != nil && conn != nil { - t.Error("bad: accept should return a connection of nil value") - } - - conn, err = server.Open() - if err != nil && conn != nil { - t.Error("bad: open should return a connection of nil value") - } -} - -func TestSendData_Small(t *testing.T) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - wg := &sync.WaitGroup{} - wg.Add(2) - - go func() { - defer wg.Done() - stream, err := server.AcceptStream() - if err != nil { - t.Fatalf("err: %v", err) - } - - if server.NumStreams() != 1 { - t.Fatalf("bad") - } - - buf := make([]byte, 4) - for i := 0; i < 1000; i++ { - n, err := stream.Read(buf) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != 4 { - t.Fatalf("short read: %d", n) - } - if string(buf) != "test" { - t.Fatalf("bad: %s", buf) - } - } - - if err := stream.Close(); err != nil { - t.Fatalf("err: %v", err) - } - }() - - go func() { - defer wg.Done() - stream, err := client.Open() - if err != nil { - t.Fatalf("err: %v", err) - } - - if client.NumStreams() != 1 { - t.Fatalf("bad") - } - - for i := 0; i < 1000; i++ { - n, err := stream.Write([]byte("test")) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != 4 { - t.Fatalf("short write %d", n) - } - } - - if err := stream.Close(); err != nil { - t.Fatalf("err: %v", err) - } - }() - - doneCh := make(chan struct{}) - go func() { - wg.Wait() - close(doneCh) - }() - select { - case <-doneCh: - case <-time.After(time.Second): - panic("timeout") - } - - if client.NumStreams() != 0 { - t.Fatalf("bad") - } - if server.NumStreams() != 0 { - t.Fatalf("bad") - } -} - -func TestSendData_Large(t *testing.T) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - data := make([]byte, 512*1024) - for idx := range data { - data[idx] = byte(idx % 256) - } - - wg := &sync.WaitGroup{} - wg.Add(2) - - go func() { - defer wg.Done() - stream, err := server.AcceptStream() - if err != nil { - t.Fatalf("err: %v", err) - } - - buf := make([]byte, 4*1024) - for i := 0; i < 128; i++ { - n, err := stream.Read(buf) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != 4*1024 { - t.Fatalf("short read: %d", n) - } - for idx := range buf { - if buf[idx] != byte(idx%256) { - t.Fatalf("bad: %v %v %v", i, idx, buf[idx]) - } - } - } - - if err := stream.Close(); err != nil { - t.Fatalf("err: %v", err) - } - }() - - go func() { - defer wg.Done() - stream, err := client.Open() - if err != nil { - t.Fatalf("err: %v", err) - } - - n, err := stream.Write(data) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != len(data) { - t.Fatalf("short write %d", n) - } - - if err := stream.Close(); err != nil { - t.Fatalf("err: %v", err) - } - }() - - doneCh := make(chan struct{}) - go func() { - wg.Wait() - close(doneCh) - }() - select { - case <-doneCh: - case <-time.After(time.Second): - panic("timeout") - } -} - -func TestGoAway(t *testing.T) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - if err := server.GoAway(); err != nil { - t.Fatalf("err: %v", err) - } - - _, err := client.Open() - if err != ErrRemoteGoAway { - t.Fatalf("err: %v", err) - } -} - -func TestManyStreams(t *testing.T) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - wg := &sync.WaitGroup{} - - acceptor := func(i int) { - defer wg.Done() - stream, err := server.AcceptStream() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - buf := make([]byte, 512) - for { - n, err := stream.Read(buf) - if err == io.EOF { - return - } - if err != nil { - t.Fatalf("err: %v", err) - } - if n == 0 { - t.Fatalf("err: %v", err) - } - } - } - sender := func(i int) { - defer wg.Done() - stream, err := client.Open() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - msg := fmt.Sprintf("%08d", i) - for i := 0; i < 1000; i++ { - n, err := stream.Write([]byte(msg)) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != len(msg) { - t.Fatalf("short write %d", n) - } - } - } - - for i := 0; i < 50; i++ { - wg.Add(2) - go acceptor(i) - go sender(i) - } - - wg.Wait() -} - -func TestManyStreams_PingPong(t *testing.T) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - wg := &sync.WaitGroup{} - - ping := []byte("ping") - pong := []byte("pong") - - acceptor := func(i int) { - defer wg.Done() - stream, err := server.AcceptStream() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - buf := make([]byte, 4) - for { - // Read the 'ping' - n, err := stream.Read(buf) - if err == io.EOF { - return - } - if err != nil { - t.Fatalf("err: %v", err) - } - if n != 4 { - t.Fatalf("err: %v", err) - } - if !bytes.Equal(buf, ping) { - t.Fatalf("bad: %s", buf) - } - - // Shrink the internal buffer! - stream.Shrink() - - // Write out the 'pong' - n, err = stream.Write(pong) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != 4 { - t.Fatalf("err: %v", err) - } - } - } - sender := func(i int) { - defer wg.Done() - stream, err := client.OpenStream() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - buf := make([]byte, 4) - for i := 0; i < 1000; i++ { - // Send the 'ping' - n, err := stream.Write(ping) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != 4 { - t.Fatalf("short write %d", n) - } - - // Read the 'pong' - n, err = stream.Read(buf) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != 4 { - t.Fatalf("err: %v", err) - } - if !bytes.Equal(buf, pong) { - t.Fatalf("bad: %s", buf) - } - - // Shrink the buffer - stream.Shrink() - } - } - - for i := 0; i < 50; i++ { - wg.Add(2) - go acceptor(i) - go sender(i) - } - - wg.Wait() -} - -func TestHalfClose(t *testing.T) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - stream, err := client.Open() - if err != nil { - t.Fatalf("err: %v", err) - } - if _, err := stream.Write([]byte("a")); err != nil { - t.Fatalf("err: %v", err) - } - - stream2, err := server.Accept() - if err != nil { - t.Fatalf("err: %v", err) - } - stream2.Close() // Half close - - buf := make([]byte, 4) - n, err := stream2.Read(buf) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != 1 { - t.Fatalf("bad: %v", n) - } - - // Send more - if _, err := stream.Write([]byte("bcd")); err != nil { - t.Fatalf("err: %v", err) - } - stream.Close() - - // Read after close - n, err = stream2.Read(buf) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != 3 { - t.Fatalf("bad: %v", n) - } - - // EOF after close - n, err = stream2.Read(buf) - if err != io.EOF { - t.Fatalf("err: %v", err) - } - if n != 0 { - t.Fatalf("bad: %v", n) - } -} - -func TestReadDeadline(t *testing.T) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - stream, err := client.Open() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - stream2, err := server.Accept() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream2.Close() - - if err := stream.SetReadDeadline(time.Now().Add(5 * time.Millisecond)); err != nil { - t.Fatalf("err: %v", err) - } - - buf := make([]byte, 4) - if _, err := stream.Read(buf); err != ErrTimeout { - t.Fatalf("err: %v", err) - } -} - -func TestWriteDeadline(t *testing.T) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - stream, err := client.Open() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - stream2, err := server.Accept() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream2.Close() - - if err := stream.SetWriteDeadline(time.Now().Add(50 * time.Millisecond)); err != nil { - t.Fatalf("err: %v", err) - } - - buf := make([]byte, 512) - for i := 0; i < int(initialStreamWindow); i++ { - _, err := stream.Write(buf) - if err != nil && err == ErrTimeout { - return - } else if err != nil { - t.Fatalf("err: %v", err) - } - } - t.Fatalf("Expected timeout") -} - -func TestBacklogExceeded(t *testing.T) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - // Fill the backlog - max := client.config.AcceptBacklog - for i := 0; i < max; i++ { - stream, err := client.Open() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - if _, err := stream.Write([]byte("foo")); err != nil { - t.Fatalf("err: %v", err) - } - } - - // Attempt to open a new stream - errCh := make(chan error, 1) - go func() { - _, err := client.Open() - errCh <- err - }() - - // Shutdown the server - go func() { - time.Sleep(10 * time.Millisecond) - server.Close() - }() - - select { - case err := <-errCh: - if err == nil { - t.Fatalf("open should fail") - } - case <-time.After(time.Second): - t.Fatalf("timeout") - } -} - -func TestKeepAlive(t *testing.T) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - time.Sleep(200 * time.Millisecond) - - // Ping value should increase - client.pingLock.Lock() - defer client.pingLock.Unlock() - if client.pingID == 0 { - t.Fatalf("should ping") - } - - server.pingLock.Lock() - defer server.pingLock.Unlock() - if server.pingID == 0 { - t.Fatalf("should ping") - } -} - -func TestKeepAlive_Timeout(t *testing.T) { - conn1, conn2 := testConn() - - clientConf := testConf() - clientConf.ConnectionWriteTimeout = time.Hour // We're testing keep alives, not connection writes - clientConf.EnableKeepAlive = false // Just test one direction, so it's deterministic who hangs up on whom - client, _ := Client(conn1, clientConf) - defer client.Close() - - server, _ := Server(conn2, testConf()) - defer server.Close() - - _ = captureLogs(client) // Client logs aren't part of the test - serverLogs := captureLogs(server) - - errCh := make(chan error, 1) - go func() { - _, err := server.Accept() // Wait until server closes - errCh <- err - }() - - // Prevent the client from responding - clientConn := client.conn.(*pipeConn) - clientConn.writeBlocker.Lock() - - select { - case err := <-errCh: - if err != ErrKeepAliveTimeout { - t.Fatalf("unexpected error: %v", err) - } - case <-time.After(1 * time.Second): - t.Fatalf("timeout waiting for timeout") - } - - if !server.IsClosed() { - t.Fatalf("server should have closed") - } - - if !serverLogs.match([]string{"[ERR] yamux: keepalive failed: i/o deadline reached"}) { - t.Fatalf("server log incorect: %v", serverLogs.logs()) - } -} - -func TestLargeWindow(t *testing.T) { - conf := DefaultConfig() - conf.MaxStreamWindowSize *= 2 - - client, server := testClientServerConfig(conf) - defer client.Close() - defer server.Close() - - stream, err := client.Open() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - stream2, err := server.Accept() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream2.Close() - - stream.SetWriteDeadline(time.Now().Add(10 * time.Millisecond)) - buf := make([]byte, conf.MaxStreamWindowSize) - n, err := stream.Write(buf) - if err != nil { - t.Fatalf("err: %v", err) - } - if n != len(buf) { - t.Fatalf("short write: %d", n) - } -} - -type UnlimitedReader struct{} - -func (u *UnlimitedReader) Read(p []byte) (int, error) { - runtime.Gosched() - return len(p), nil -} - -func TestSendData_VeryLarge(t *testing.T) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - var n int64 = 1 * 1024 * 1024 * 1024 - var workers int = 16 - - wg := &sync.WaitGroup{} - wg.Add(workers * 2) - - for i := 0; i < workers; i++ { - go func() { - defer wg.Done() - stream, err := server.AcceptStream() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - buf := make([]byte, 4) - _, err = stream.Read(buf) - if err != nil { - t.Fatalf("err: %v", err) - } - if !bytes.Equal(buf, []byte{0, 1, 2, 3}) { - t.Fatalf("bad header") - } - - recv, err := io.Copy(ioutil.Discard, stream) - if err != nil { - t.Fatalf("err: %v", err) - } - if recv != n { - t.Fatalf("bad: %v", recv) - } - }() - } - for i := 0; i < workers; i++ { - go func() { - defer wg.Done() - stream, err := client.Open() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - _, err = stream.Write([]byte{0, 1, 2, 3}) - if err != nil { - t.Fatalf("err: %v", err) - } - - unlimited := &UnlimitedReader{} - sent, err := io.Copy(stream, io.LimitReader(unlimited, n)) - if err != nil { - t.Fatalf("err: %v", err) - } - if sent != n { - t.Fatalf("bad: %v", sent) - } - }() - } - - doneCh := make(chan struct{}) - go func() { - wg.Wait() - close(doneCh) - }() - select { - case <-doneCh: - case <-time.After(20 * time.Second): - panic("timeout") - } -} - -func TestBacklogExceeded_Accept(t *testing.T) { - client, server := testClientServer() - defer client.Close() - defer server.Close() - - max := 5 * client.config.AcceptBacklog - go func() { - for i := 0; i < max; i++ { - stream, err := server.Accept() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - } - }() - - // Fill the backlog - for i := 0; i < max; i++ { - stream, err := client.Open() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - if _, err := stream.Write([]byte("foo")); err != nil { - t.Fatalf("err: %v", err) - } - } -} - -func TestSession_WindowUpdateWriteDuringRead(t *testing.T) { - client, server := testClientServerConfig(testConfNoKeepAlive()) - defer client.Close() - defer server.Close() - - var wg sync.WaitGroup - wg.Add(2) - - // Choose a huge flood size that we know will result in a window update. - flood := int64(client.config.MaxStreamWindowSize) - 1 - - // The server will accept a new stream and then flood data to it. - go func() { - defer wg.Done() - - stream, err := server.AcceptStream() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - n, err := stream.Write(make([]byte, flood)) - if err != nil { - t.Fatalf("err: %v", err) - } - if int64(n) != flood { - t.Fatalf("short write: %d", n) - } - }() - - // The client will open a stream, block outbound writes, and then - // listen to the flood from the server, which should time out since - // it won't be able to send the window update. - go func() { - defer wg.Done() - - stream, err := client.OpenStream() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - conn := client.conn.(*pipeConn) - conn.writeBlocker.Lock() - - _, err = stream.Read(make([]byte, flood)) - if err != ErrConnectionWriteTimeout { - t.Fatalf("err: %v", err) - } - }() - - wg.Wait() -} - -func TestSession_sendNoWait_Timeout(t *testing.T) { - client, server := testClientServerConfig(testConfNoKeepAlive()) - defer client.Close() - defer server.Close() - - var wg sync.WaitGroup - wg.Add(2) - - go func() { - defer wg.Done() - - stream, err := server.AcceptStream() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - }() - - // The client will open the stream and then block outbound writes, we'll - // probe sendNoWait once it gets into that state. - go func() { - defer wg.Done() - - stream, err := client.OpenStream() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - conn := client.conn.(*pipeConn) - conn.writeBlocker.Lock() - - hdr := header(make([]byte, headerSize)) - hdr.encode(typePing, flagACK, 0, 0) - for { - err = client.sendNoWait(hdr) - if err == nil { - continue - } else if err == ErrConnectionWriteTimeout { - break - } else { - t.Fatalf("err: %v", err) - } - } - }() - - wg.Wait() -} - -func TestSession_PingOfDeath(t *testing.T) { - client, server := testClientServerConfig(testConfNoKeepAlive()) - defer client.Close() - defer server.Close() - - var wg sync.WaitGroup - wg.Add(2) - - var doPingOfDeath sync.Mutex - doPingOfDeath.Lock() - - // This is used later to block outbound writes. - conn := server.conn.(*pipeConn) - - // The server will accept a stream, block outbound writes, and then - // flood its send channel so that no more headers can be queued. - go func() { - defer wg.Done() - - stream, err := server.AcceptStream() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - conn.writeBlocker.Lock() - for { - hdr := header(make([]byte, headerSize)) - hdr.encode(typePing, 0, 0, 0) - err = server.sendNoWait(hdr) - if err == nil { - continue - } else if err == ErrConnectionWriteTimeout { - break - } else { - t.Fatalf("err: %v", err) - } - } - - doPingOfDeath.Unlock() - }() - - // The client will open a stream and then send the server a ping once it - // can no longer write. This makes sure the server doesn't deadlock reads - // while trying to reply to the ping with no ability to write. - go func() { - defer wg.Done() - - stream, err := client.OpenStream() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - // This ping will never unblock because the ping id will never - // show up in a response. - doPingOfDeath.Lock() - go func() { client.Ping() }() - - // Wait for a while to make sure the previous ping times out, - // then turn writes back on and make sure a ping works again. - time.Sleep(2 * server.config.ConnectionWriteTimeout) - conn.writeBlocker.Unlock() - if _, err = client.Ping(); err != nil { - t.Fatalf("err: %v", err) - } - }() - - wg.Wait() -} - -func TestSession_ConnectionWriteTimeout(t *testing.T) { - client, server := testClientServerConfig(testConfNoKeepAlive()) - defer client.Close() - defer server.Close() - - var wg sync.WaitGroup - wg.Add(2) - - go func() { - defer wg.Done() - - stream, err := server.AcceptStream() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - }() - - // The client will open the stream and then block outbound writes, we'll - // tee up a write and make sure it eventually times out. - go func() { - defer wg.Done() - - stream, err := client.OpenStream() - if err != nil { - t.Fatalf("err: %v", err) - } - defer stream.Close() - - conn := client.conn.(*pipeConn) - conn.writeBlocker.Lock() - - // Since the write goroutine is blocked then this will return a - // timeout since it can't get feedback about whether the write - // worked. - n, err := stream.Write([]byte("hello")) - if err != ErrConnectionWriteTimeout { - t.Fatalf("err: %v", err) - } - if n != 0 { - t.Fatalf("lied about writes: %d", n) - } - }() - - wg.Wait() -} diff --git a/vendor/github.com/hashicorp/yamux/util_test.go b/vendor/github.com/hashicorp/yamux/util_test.go deleted file mode 100644 index dd14623af7..0000000000 --- a/vendor/github.com/hashicorp/yamux/util_test.go +++ /dev/null @@ -1,50 +0,0 @@ -package yamux - -import ( - "testing" -) - -func TestAsyncSendErr(t *testing.T) { - ch := make(chan error) - asyncSendErr(ch, ErrTimeout) - select { - case <-ch: - t.Fatalf("should not get") - default: - } - - ch = make(chan error, 1) - asyncSendErr(ch, ErrTimeout) - select { - case <-ch: - default: - t.Fatalf("should get") - } -} - -func TestAsyncNotify(t *testing.T) { - ch := make(chan struct{}) - asyncNotify(ch) - select { - case <-ch: - t.Fatalf("should not get") - default: - } - - ch = make(chan struct{}, 1) - asyncNotify(ch) - select { - case <-ch: - default: - t.Fatalf("should get") - } -} - -func TestMin(t *testing.T) { - if min(1, 2) != 1 { - t.Fatalf("bad") - } - if min(2, 1) != 1 { - t.Fatalf("bad") - } -} diff --git a/vendor/github.com/hmrc/vmware-govcd/api_test.go b/vendor/github.com/hmrc/vmware-govcd/api_test.go deleted file mode 100644 index d7e7a52089..0000000000 --- a/vendor/github.com/hmrc/vmware-govcd/api_test.go +++ /dev/null @@ -1,3 +0,0 @@ -package govcd - -import () diff --git a/vendor/github.com/hmrc/vmware-govcd/api_vca_test.go b/vendor/github.com/hmrc/vmware-govcd/api_vca_test.go deleted file mode 100644 index 9f3a5cf9c2..0000000000 --- a/vendor/github.com/hmrc/vmware-govcd/api_vca_test.go +++ /dev/null @@ -1,749 +0,0 @@ -/* - * @Author: frapposelli - * @Project: govcloudair - * @Filename: api_test.go - * @Last Modified by: frapposelli - */ - -package govcd - -import ( - "net/url" - "os" - "testing" - - "github.com/hmrc/vmware-govcd/testutil" - . "gopkg.in/check.v1" -) - -var au, _ = url.ParseRequestURI("http://localhost:4444/api") -var aus, _ = url.ParseRequestURI("http://localhost:4444/api/vchs/services") -var auc, _ = url.ParseRequestURI("http://localhost:4444/api/vchs/compute/00000000-0000-0000-0000-000000000000") -var aucs, _ = url.ParseRequestURI("http://localhost:4444/api/vchs/compute/00000000-0000-0000-0000-000000000000/vdc/00000000-0000-0000-0000-000000000000/vcloudsession") - -func Test(t *testing.T) { TestingT(t) } - -type S struct { - client *VAClient - vdc Vdc - vapp *VApp -} - -var _ = Suite(&S{}) - -var testServer = testutil.NewHTTPServer() - -var authheader = map[string]string{"x-vchs-authorization": "012345678901234567890123456789"} - -func (s *S) SetUpSuite(c *C) { - testServer.Start() - var err error - - os.Setenv("VCLOUDAIR_ENDPOINT", "http://localhost:4444/api") - - s.client, err = NewVAClient() - if err != nil { - panic(err) - } - - testServer.ResponseMap(5, testutil.ResponseMap{ - "/api/vchs/sessions": testutil.Response{201, authheader, vaauthorization}, - "/api/vchs/services": testutil.Response{200, nil, vaservices}, - "/api/vchs/compute/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vacompute}, - "/api/vchs/compute/00000000-0000-0000-0000-000000000000/vdc/00000000-0000-0000-0000-000000000000/vcloudsession": testutil.Response{201, nil, vabackend}, - "/api/vdc/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vdcExample}, - }) - - s.vdc, err = s.client.Authenticate("username", "password", "CI123456-789", "VDC12345-6789") - s.vapp = NewVApp(&s.client.Client) - _ = testServer.WaitRequests(5) - testServer.Flush() - if err != nil { - panic(err) - } -} - -func (s *S) TearDownTest(c *C) { - testServer.Flush() -} - -func TestClient_vaauthorize(t *testing.T) { - testServer.Start() - var err error - - // Set up a working client - os.Setenv("VCLOUDAIR_ENDPOINT", "http://localhost:4444/api") - - client, err := NewVAClient() - if err != nil { - t.Fatalf("err: %v", err) - } - - // Set up a correct conversation - testServer.Response(201, authheader, vaauthorization) - _, err = client.vaauthorize("username", "password") - _ = testServer.WaitRequest() - if err != nil { - t.Fatalf("err: %v", err) - } - - // Test if token is correctly set on client. - if client.VAToken != "012345678901234567890123456789" { - t.Fatalf("VAtoken not set on client: %s", client.VAToken) - } - - // Test client errors - - // Test a correct response with a wrong status code - testServer.Response(404, authheader, notfoundErr) - _, err = client.vaauthorize("username", "password") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - - // Test an API error - testServer.Response(500, authheader, vcdError) - _, err = client.vaauthorize("username", "password") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - - // Test an API response that doesn't contain the param we're looking for. - testServer.Response(200, authheader, vaauthorizationErr) - _, err = client.vaauthorize("username", "password") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - - // Test an un-parsable response. - testServer.Response(200, authheader, notfoundErr) - _, err = client.vaauthorize("username", "password") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - -} - -func TestClient_vaacquireservice(t *testing.T) { - testServer.Start() - var err error - - // Set up a working client - os.Setenv("VCLOUDAIR_ENDPOINT", "http://localhost:4444/api") - client, err := NewVAClient() - if err != nil { - t.Fatalf("err: %v", err) - } - client.VAToken = "012345678901234567890123456789" - - // Test a correct conversation - testServer.Response(200, nil, vaservices) - vacomputehref, err := client.vaacquireservice(*aus, "CI123456-789") - _ = testServer.WaitRequest() - if err != nil { - t.Fatalf("err: %v", err) - } - - if vacomputehref.String() != "http://localhost:4444/api/vchs/compute/00000000-0000-0000-0000-000000000000" { - t.Fatalf("VAComputeHREF not set on client: %s", vacomputehref) - } - - if client.Region != "US - Anywhere" { - t.Fatalf("Region not set on client: %s", client.Region) - } - - // Test client errors - - // Test a 404 - testServer.Response(404, nil, notfoundErr) - _, err = client.vaacquireservice(*aus, "CI123456-789") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - - // Test an API error - testServer.Response(500, nil, vcdError) - _, err = client.vaacquireservice(*aus, "CI123456-789") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - - // Test an unknown Compute ID - testServer.Response(200, nil, vaservices) - _, err = client.vaacquireservice(*aus, "NOTVALID-789") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - - // Test an un-parsable response - testServer.Response(200, nil, notfoundErr) - _, err = client.vaacquireservice(*aus, "CI123456-789") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - -} - -func TestClient_vaacquirecompute(t *testing.T) { - testServer.Start() - var err error - - os.Setenv("VCLOUDAIR_ENDPOINT", "http://localhost:4444/api") - client, err := NewVAClient() - if err != nil { - t.Fatalf("err: %v", err) - } - client.VAToken = "012345678901234567890123456789" - client.Region = "US - Anywhere" - - testServer.Response(200, nil, vacompute) - vavdchref, err := client.vaacquirecompute(*auc, "VDC12345-6789") - _ = testServer.WaitRequest() - if err != nil { - t.Fatalf("err: %v", err) - } - - if vavdchref.String() != "http://localhost:4444/api/vchs/compute/00000000-0000-0000-0000-000000000000/vdc/00000000-0000-0000-0000-000000000000/vcloudsession" { - t.Fatalf("VAVDCHREF not set on client: %s", vavdchref) - } - - // Test client errors - - // Test a 404 - testServer.Response(404, nil, notfoundErr) - _, err = client.vaacquirecompute(*auc, "VDC12345-6789") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - // Test an API error - testServer.Response(500, nil, vcdError) - _, err = client.vaacquirecompute(*auc, "VDC12345-6789") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - - // Test an unknown VDC ID - testServer.Response(200, nil, vacompute) - _, err = client.vaacquirecompute(*auc, "INVALID-6789") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - - // Test an un-parsable response - testServer.Response(200, nil, notfoundErr) - _, err = client.vaacquirecompute(*auc, "VDC12345-6789") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - -} - -func TestClient_vagetbackendauth(t *testing.T) { - testServer.Start() - var err error - - os.Setenv("VCLOUDAIR_ENDPOINT", "http://localhost:4444/api") - client, err := NewVAClient() - if err != nil { - t.Fatalf("err: %v", err) - } - client.VAToken = "012345678901234567890123456789" - client.Region = "US - Anywhere" - - testServer.Response(201, nil, vabackend) - err = client.vagetbackendauth(*aucs, "CI123456-789") - _ = testServer.WaitRequest() - if err != nil { - t.Fatalf("err: %v", err) - } - - if client.Client.VCDToken != "01234567890123456789012345678901" { - t.Fatalf("VCDToken not set on client: %s", client.Client.VCDToken) - } - if client.Client.VCDAuthHeader != "x-vcloud-authorization" { - t.Fatalf("VCDAuthHeader not set on client: %s", client.Client.VCDAuthHeader) - } - if client.Client.VCDVDCHREF.String() != "http://localhost:4444/api/vdc/00000000-0000-0000-0000-000000000000" { - t.Fatalf("VDC not set on client: %s", client.Client.VCDVDCHREF) - } - - // Test client errors - - // Test a 404 - testServer.Response(404, nil, notfoundErr) - err = client.vagetbackendauth(*aucs, "VDC12345-6789") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - // Test an API error - testServer.Response(500, nil, vcdError) - err = client.vagetbackendauth(*aucs, "VDC12345-6789") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - // Test an unknown backend VDC IC - testServer.Response(201, nil, vabackend) - err = client.vagetbackendauth(*aucs, "INVALID-6789") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - // Test an un-parsable response - testServer.Response(201, nil, notfoundErr) - err = client.vagetbackendauth(*aucs, "VDC12345-6789") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - // Test a botched backend VDC IC - testServer.Response(201, nil, vabackendErr) - err = client.vagetbackendauth(*aucs, "VDC12345-6789") - _ = testServer.WaitRequest() - if err == nil { - t.Fatalf("Request error not caught: %v", err) - } - -} - -// Env variable tests - -func TestClient_vaauthorize_env(t *testing.T) { - - os.Setenv("VCLOUDAIR_USERNAME", "username") - os.Setenv("VCLOUDAIR_PASSWORD", "password") - - testServer.Start() - var err error - os.Setenv("VCLOUDAIR_ENDPOINT", "http://localhost:4444/api") - client, err := NewVAClient() - if err != nil { - t.Fatalf("err: %v", err) - } - - testServer.Response(201, authheader, vaauthorization) - _, err = client.vaauthorize("", "") - _ = testServer.WaitRequest() - if err != nil { - t.Fatalf("err: %v", err) - } - - if client.VAToken != "012345678901234567890123456789" { - t.Fatalf("VAtoken not set on client: %s", client.VAToken) - } - -} - -func TestClient_vaacquireservice_env(t *testing.T) { - - os.Setenv("VCLOUDAIR_COMPUTEID", "CI123456-789") - - testServer.Start() - var err error - os.Setenv("VCLOUDAIR_ENDPOINT", "http://localhost:4444/api") - client, err := NewVAClient() - if err != nil { - t.Fatalf("err: %v", err) - } - client.VAToken = "012345678901234567890123456789" - - testServer.Response(200, nil, vaservices) - vacomputehref, err := client.vaacquireservice(*aus, "") - _ = testServer.WaitRequest() - if err != nil { - t.Fatalf("err: %v", err) - } - - if vacomputehref.String() != "http://localhost:4444/api/vchs/compute/00000000-0000-0000-0000-000000000000" { - t.Fatalf("VAComputeHREF not set on client: %s", vacomputehref) - } - - if client.Region != "US - Anywhere" { - t.Fatalf("Region not set on client: %s", client.Region) - } - -} - -func TestClient_vaacquirecompute_env(t *testing.T) { - - os.Setenv("VCLOUDAIR_VDCID", "VDC12345-6789") - - testServer.Start() - var err error - os.Setenv("VCLOUDAIR_ENDPOINT", "http://localhost:4444/api") - client, err := NewVAClient() - if err != nil { - t.Fatalf("err: %v", err) - } - client.VAToken = "012345678901234567890123456789" - client.Region = "US - Anywhere" - - testServer.Response(200, nil, vacompute) - vavdchref, err := client.vaacquirecompute(*auc, "") - _ = testServer.WaitRequest() - if err != nil { - t.Fatalf("err: %v", err) - } - - if vavdchref.String() != "http://localhost:4444/api/vchs/compute/00000000-0000-0000-0000-000000000000/vdc/00000000-0000-0000-0000-000000000000/vcloudsession" { - t.Fatalf("VAVDCHREF not set on client: %s", vavdchref) - } - -} - -func TestClient_vagetbackendauth_env(t *testing.T) { - - os.Setenv("VCLOUDAIR_VDCID", "VDC12345-6789") - - testServer.Start() - var err error - os.Setenv("VCLOUDAIR_ENDPOINT", "http://localhost:4444/api") - client, err := NewVAClient() - if err != nil { - t.Fatalf("err: %v", err) - } - client.VAToken = "012345678901234567890123456789" - client.Region = "US - Anywhere" - - testServer.Response(201, nil, vabackend) - err = client.vagetbackendauth(*aucs, "") - _ = testServer.WaitRequest() - if err != nil { - t.Fatalf("err: %v", err) - } - - if client.Client.VCDToken != "01234567890123456789012345678901" { - t.Fatalf("VCDToken not set on client: %s", client.Client.VCDToken) - } - if client.Client.VCDAuthHeader != "x-vcloud-authorization" { - t.Fatalf("VCDAuthHeader not set on client: %s", client.Client.VCDAuthHeader) - } - if client.Client.VCDVDCHREF.String() != "http://localhost:4444/api/vdc/00000000-0000-0000-0000-000000000000" { - t.Fatalf("VDC not set on client: %s", client.Client.VCDVDCHREF) - } - -} - -func TestClient_NewClient(t *testing.T) { - - var err error - os.Setenv("VCLOUDAIR_ENDPOINT", "") - if _, err = NewVAClient(); err != nil { - t.Fatalf("err: %v", err) - } - - os.Setenv("VCLOUDAIR_ENDPOINT", "💩") - if _, err = NewVAClient(); err == nil { - t.Fatalf("err: %v", err) - } - -} - -func TestClient_Disconnect(t *testing.T) { - - testServer.Start() - var err error - - // Test an authenticated client - c := makeClient(t) - testServer.Response(201, nil, "") - err = c.Disconnect() - if err != nil { - t.Fatalf("err: %v", err) - } - - // Test an empty client - client, err := NewVAClient() - if err != nil { - t.Fatalf("err: %v", err) - } - err = client.Disconnect() - if err == nil { - t.Fatalf("err: %v", err) - } - -} - -func TestVAClient_Authenticate(t *testing.T) { - - testServer.Start() - var err error - os.Setenv("VCLOUDAIR_ENDPOINT", "http://localhost:4444/api") - client, err := NewVAClient() - if err != nil { - t.Fatalf("err: %v", err) - } - - // Botched auth - testServer.ResponseMap(5, testutil.ResponseMap{ - "/api/vchs/sessions": testutil.Response{401, nil, vcdError}, - "/api/vchs/services": testutil.Response{200, nil, vaservices}, - "/api/vchs/compute/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vacompute}, - "/api/vchs/compute/00000000-0000-0000-0000-000000000000/vdc/00000000-0000-0000-0000-000000000000/vcloudsession": testutil.Response{201, nil, vabackend}, - "/api/vdc/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vdcExample}, - }) - - _, err = client.Authenticate("username", "password", "CI123456-789", "VDC12345-6789") - _ = testServer.WaitRequests(1) - testServer.Flush() - if err == nil { - t.Fatalf("Uncatched error: %v", err) - } - - // Botched services - testServer.ResponseMap(5, testutil.ResponseMap{ - "/api/vchs/sessions": testutil.Response{201, authheader, vaauthorization}, - "/api/vchs/services": testutil.Response{500, nil, vcdError}, - "/api/vchs/compute/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vacompute}, - "/api/vchs/compute/00000000-0000-0000-0000-000000000000/vdc/00000000-0000-0000-0000-000000000000/vcloudsession": testutil.Response{201, nil, vabackend}, - "/api/vdc/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vdcExample}, - }) - - _, err = client.Authenticate("username", "password", "CI123456-789", "VDC12345-6789") - _ = testServer.WaitRequests(2) - testServer.Flush() - if err == nil { - t.Fatalf("Uncatched error: %v", err) - } - - // Botched compute - testServer.ResponseMap(5, testutil.ResponseMap{ - "/api/vchs/sessions": testutil.Response{201, authheader, vaauthorization}, - "/api/vchs/services": testutil.Response{200, nil, vaservices}, - "/api/vchs/compute/00000000-0000-0000-0000-000000000000": testutil.Response{500, nil, vcdError}, - "/api/vchs/compute/00000000-0000-0000-0000-000000000000/vdc/00000000-0000-0000-0000-000000000000/vcloudsession": testutil.Response{201, nil, vabackend}, - "/api/vdc/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vdcExample}, - }) - - _, err = client.Authenticate("username", "password", "CI123456-789", "VDC12345-6789") - _ = testServer.WaitRequests(3) - testServer.Flush() - if err == nil { - t.Fatalf("Uncatched error: %v", err) - } - - // Botched backend - testServer.ResponseMap(5, testutil.ResponseMap{ - "/api/vchs/sessions": testutil.Response{201, authheader, vaauthorization}, - "/api/vchs/services": testutil.Response{200, nil, vaservices}, - "/api/vchs/compute/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vacompute}, - "/api/vchs/compute/00000000-0000-0000-0000-000000000000/vdc/00000000-0000-0000-0000-000000000000/vcloudsession": testutil.Response{500, nil, vcdError}, - "/api/vdc/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vdcExample}, - }) - - _, err = client.Authenticate("username", "password", "CI123456-789", "VDC12345-6789") - _ = testServer.WaitRequests(4) - testServer.Flush() - if err == nil { - t.Fatalf("Uncatched error: %v", err) - } - - // Botched vdc - testServer.ResponseMap(5, testutil.ResponseMap{ - "/api/vchs/sessions": testutil.Response{201, authheader, vaauthorization}, - "/api/vchs/services": testutil.Response{200, nil, vaservices}, - "/api/vchs/compute/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vacompute}, - "/api/vchs/compute/00000000-0000-0000-0000-000000000000/vdc/00000000-0000-0000-0000-000000000000/vcloudsession": testutil.Response{201, nil, vabackend}, - "/api/vdc/00000000-0000-0000-0000-000000000000": testutil.Response{500, nil, vcdError}, - }) - - _, err = client.Authenticate("username", "password", "CI123456-789", "VDC12345-6789") - _ = testServer.WaitRequests(5) - testServer.Flush() - if err == nil { - t.Fatalf("Uncatched error: %v", err) - } - -} - -func makeClient(t *testing.T) VAClient { - - testServer.Start() - var err error - os.Setenv("VCLOUDAIR_ENDPOINT", "http://localhost:4444/api") - client, err := NewVAClient() - if err != nil { - t.Fatalf("err: %v", err) - } - - testServer.ResponseMap(5, testutil.ResponseMap{ - "/api/vchs/sessions": testutil.Response{201, authheader, vaauthorization}, - "/api/vchs/services": testutil.Response{200, nil, vaservices}, - "/api/vchs/compute/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vacompute}, - "/api/vchs/compute/00000000-0000-0000-0000-000000000000/vdc/00000000-0000-0000-0000-000000000000/vcloudsession": testutil.Response{201, nil, vabackend}, - "/api/vdc/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vdcExample}, - }) - - _, err = client.Authenticate("username", "password", "CI123456-789", "VDC12345-6789") - - _ = testServer.WaitRequests(5) - testServer.Flush() - - if err != nil { - t.Fatalf("err: %v", err) - } - - if client.VAToken != "012345678901234567890123456789" { - t.Fatalf("VAtoken not set on client: %s", client.VAToken) - } - - if client.Region != "US - Anywhere" { - t.Fatalf("Region not set on client: %s", client.Region) - } - - if client.Client.VCDToken != "01234567890123456789012345678901" { - t.Fatalf("VCDToken not set on client: %s", client.Client.VCDToken) - } - if client.Client.VCDAuthHeader != "x-vcloud-authorization" { - t.Fatalf("VCDAuthHeader not set on client: %s", client.Client.VCDAuthHeader) - } - if client.Client.VCDVDCHREF.String() != "http://localhost:4444/api/vdc/00000000-0000-0000-0000-000000000000" { - t.Fatalf("VDC not set on client: %s", client.Client.VCDVDCHREF) - } - - return *client -} - -func TestClient_parseErr(t *testing.T) { - testServer.Start() - var err error - os.Setenv("VCLOUDAIR_ENDPOINT", "http://localhost:4444/api") - client, err := NewVAClient() - if err != nil { - t.Fatalf("err: %v", err) - } - - // I'M A TEAPOT! - testServer.ResponseMap(5, testutil.ResponseMap{ - "/api/vchs/sessions": testutil.Response{201, authheader, vaauthorization}, - "/api/vchs/services": testutil.Response{200, nil, vaservices}, - "/api/vchs/compute/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vacompute}, - "/api/vchs/compute/00000000-0000-0000-0000-000000000000/vdc/00000000-0000-0000-0000-000000000000/vcloudsession": testutil.Response{418, nil, notfoundErr}, - "/api/vdc/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vdcExample}, - }) - - _, err = client.Authenticate("username", "password", "CI123456-789", "VDC12345-6789") - - _ = testServer.WaitRequests(4) - testServer.Flush() - - if err == nil { - t.Fatalf("Uncatched error: %v", err) - } - -} - -func TestClient_NewRequest(t *testing.T) { - c := makeClient(t) - - params := map[string]string{ - "foo": "bar", - "baz": "bar", - } - - uri, _ := url.ParseRequestURI("http://localhost:4444/api/bar") - - req := c.Client.NewRequest(params, "POST", *uri, nil) - - encoded := req.URL.Query() - if encoded.Get("foo") != "bar" { - t.Fatalf("bad: %v", encoded) - } - - if encoded.Get("baz") != "bar" { - t.Fatalf("bad: %v", encoded) - } - - if req.URL.String() != "http://localhost:4444/api/bar?baz=bar&foo=bar" { - t.Fatalf("bad base url: %v", req.URL.String()) - } - - if req.Header.Get("x-vcloud-authorization") != "01234567890123456789012345678901" { - t.Fatalf("bad auth header: %v", req.Header) - } - - if req.Method != "POST" { - t.Fatalf("bad method: %v", req.Method) - } - -} - -// status: 404 -var notfoundErr = ` - - 404 Not Found - -

404 Not Found

-
nginx/1.4.6 (Ubuntu)
- - - ` - -// status: 201 -var vaauthorization = ` - - - - - - ` -var vaauthorizationErr = ` - - - - - ` - -// status: 200 -var vaservices = ` - - - - - ` - -// status: 200 -var vacompute = ` - - - - - - - - ` - -// status: 201 -var vabackend = ` - - - - - - ` - -// status: 201 -var vabackendErr = ` - - - - - - ` - -var vcdError = ` - - ` diff --git a/vendor/github.com/hmrc/vmware-govcd/api_vcd_test.go b/vendor/github.com/hmrc/vmware-govcd/api_vcd_test.go deleted file mode 100644 index 905e15af42..0000000000 --- a/vendor/github.com/hmrc/vmware-govcd/api_vcd_test.go +++ /dev/null @@ -1,208 +0,0 @@ -package govcd - -import ( - "net/url" - "testing" - - "github.com/hmrc/vmware-govcd/testutil" - . "gopkg.in/check.v1" -) - -type K struct { - client *VCDClient - org Org - vdc Vdc -} - -var vcdu_api, _ = url.Parse("http://localhost:4444/api") -var vcdu_v, _ = url.Parse("http://localhost:4444/api/versions") -var vcdu_s, _ = url.Parse("http://localhost:4444/api/vchs/services") - -var _ = Suite(&S{}) - -var vcdauthheader = map[string]string{"x-vcloud-authorization": "012345678901234567890123456789"} - -func (s *K) SetUpSuite(c *C) { - testServer.Start() - var err error - s.client = NewVCDClient(*vcdu_api, false) - if err != nil { - panic(err) - } - - testServer.ResponseMap(5, testutil.ResponseMap{ - "/api/versions": testutil.Response{200, map[string]string{}, vcdversions}, - }) - - s.org, s.vdc, err = s.client.Authenticate("username", "password", "organization", "VDC") - if err != nil { - panic(err) - } -} - -func (s *K) TearDownTest(c *C) { - testServer.Flush() -} - -func TestClient_getloginurl(t *testing.T) { - testServer.Start() - var err error - - // Set up a working client - client := NewVCDClient(*vcdu_api, false) - if err != nil { - t.Fatalf("err: %v", err) - } - - // Set up a correct conversation - testServer.ResponseMap(200, testutil.ResponseMap{ - "/api/versions": testutil.Response{200, nil, vcdversions}, - }) - - err = client.vcdloginurl() - testServer.Flush() - if err != nil { - t.Fatalf("err: %v", err) - } - - // Test if token is correctly set on client. - if client.sessionHREF.Path != "/api/sessions" { - t.Fatalf("Getting LoginUrl failed, url: %s", client.sessionHREF.Path) - } -} - -func TestVCDClient_Authenticate(t *testing.T) { - - testServer.Start() - var err error - - client := NewVCDClient(*vcdu_api, false) - if err != nil { - t.Fatalf("err: %v", err) - } - - // OK auth - testServer.ResponseMap(5, testutil.ResponseMap{ - "/api/versions": testutil.Response{200, nil, vcdversions}, - "/api/sessions": testutil.Response{201, vcdauthheader, vcdsessions}, - "/api/org/00000000-0000-0000-0000-000000000000": testutil.Response{201, vcdauthheader, vcdorg}, - "/api/vdc/00000000-0000-0000-0000-000000000000": testutil.Response{201, vcdauthheader, vcdorg}, - }) - - org, _, err := client.Authenticate("username", "password", "organization", "organization vDC") - testServer.Flush() - if err != nil { - t.Fatalf("Error authenticating: %v", err) - } - - if org.Org.FullName != "Organization (full)" { - t.Fatalf("Orgname not parsed, got: %s", org.Org.FullName) - } -} - -// status: 200 -var vcdversions = ` - - - - 1.5 - http://localhost:4444/api/sessions - - application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml - InstantiateVAppTemplateParamsType - http://localhost:4444/api/v1.5/schema/master.xsd - - - application/vnd.vmware.admin.vmwProviderVdcReferences+xml - VMWProviderVdcReferencesType - http://localhost:4444/api/v1.5/schema/vmwextensions.xsd - - - -` - -var vcdsessions = ` - - - - - - - - - -` - -var vcdorg = ` - - - - - - - Organization (full) - -` - -var vcdvdc = ` - - - - - - - - - - - - - organization vDC - AllocationVApp - - - MHz - 0 - 0 - 0 - 0 - 0 - - - MB - 0 - 0 - 0 - 0 - 0 - - - - - - - - - - - - - vmx-04 - vmx-07 - vmx-08 - vmx-09 - vmx-10 - - - 0 - 100 - 0 - 0 - true - - - - - - -` diff --git a/vendor/github.com/hmrc/vmware-govcd/catalog_test.go b/vendor/github.com/hmrc/vmware-govcd/catalog_test.go deleted file mode 100644 index e6ee677cfd..0000000000 --- a/vendor/github.com/hmrc/vmware-govcd/catalog_test.go +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2014 VMware, Inc. All rights reserved. Licensed under the Apache v2 License. - */ - -package govcd - -import ( - . "gopkg.in/check.v1" -) - -func (s *S) Test_FindCatalogItem(c *C) { - - // Get the Org populated - testServer.Response(200, nil, orgExample) - org, err := s.vdc.GetVDCOrg() - _ = testServer.WaitRequest() - testServer.Flush() - c.Assert(err, IsNil) - - // Populate Catalog - testServer.Response(200, nil, catalogExample) - cat, err := org.FindCatalog("Public Catalog") - _ = testServer.WaitRequest() - testServer.Flush() - - // Find Catalog Item - testServer.Response(200, nil, catalogitemExample) - catitem, err := cat.FindCatalogItem("CentOS64-32bit") - _ = testServer.WaitRequest() - testServer.Flush() - - c.Assert(err, IsNil) - c.Assert(catitem.CatalogItem.HREF, Equals, "http://localhost:4444/api/catalogItem/1176e485-8858-4e15-94e5-ae4face605ae") - c.Assert(catitem.CatalogItem.Description, Equals, "id: cts-6.4-32bit") - - // Test non-existant catalog item - catitem, err = cat.FindCatalogItem("INVALID") - c.Assert(err, NotNil) - -} - -var catalogExample = ` - - - - vCHS service catalog - - - - - - - - - - - - - - - - - - true - 2013-10-15T01:14:22.370Z - 60 - -` diff --git a/vendor/github.com/hmrc/vmware-govcd/catalogitem_test.go b/vendor/github.com/hmrc/vmware-govcd/catalogitem_test.go deleted file mode 100644 index f8db37fcfd..0000000000 --- a/vendor/github.com/hmrc/vmware-govcd/catalogitem_test.go +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2014 VMware, Inc. All rights reserved. Licensed under the Apache v2 License. - */ - -package govcd - -import ( - . "gopkg.in/check.v1" -) - -func (s *S) Test_GetVAppTemplate(c *C) { - - // Get the Org populated - testServer.Response(200, nil, orgExample) - org, err := s.vdc.GetVDCOrg() - _ = testServer.WaitRequest() - testServer.Flush() - c.Assert(err, IsNil) - - // Populate Catalog - testServer.Response(200, nil, catalogExample) - cat, err := org.FindCatalog("Public Catalog") - _ = testServer.WaitRequest() - testServer.Flush() - - // Populate Catalog Item - testServer.Response(200, nil, catalogitemExample) - catitem, err := cat.FindCatalogItem("CentOS64-32bit") - _ = testServer.WaitRequest() - testServer.Flush() - - // Get VAppTemplate - testServer.Response(200, nil, vapptemplateExample) - vapptemplate, err := catitem.GetVAppTemplate() - _ = testServer.WaitRequest() - testServer.Flush() - - c.Assert(err, IsNil) - c.Assert(vapptemplate.VAppTemplate.HREF, Equals, "http://localhost:4444/api/vAppTemplate/vappTemplate-40cb9721-5f1a-44f9-b5c3-98c5f518c4f5") - c.Assert(vapptemplate.VAppTemplate.Name, Equals, "CentOS64-32bit") - c.Assert(vapptemplate.VAppTemplate.Description, Equals, "id: cts-6.4-32bit") - -} - -var catalogitemExample = ` - - - - - id: cts-6.4-32bit - - 2014-06-04T21:06:43.750Z - 4 - -` diff --git a/vendor/github.com/hmrc/vmware-govcd/edgegateway_test.go b/vendor/github.com/hmrc/vmware-govcd/edgegateway_test.go deleted file mode 100644 index 6aebd6d787..0000000000 --- a/vendor/github.com/hmrc/vmware-govcd/edgegateway_test.go +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Copyright 2014 VMware, Inc. All rights reserved. Licensed under the Apache v2 License. - */ - -package govcd - -import ( - "github.com/hmrc/vmware-govcd/testutil" - - . "gopkg.in/check.v1" -) - -func (s *S) Test_Refresh(c *C) { - - // Get the Org populated - testServer.ResponseMap(2, testutil.ResponseMap{ - "/api/vdc/00000000-0000-0000-0000-000000000000/edgeGateways": testutil.Response{200, nil, edgegatewayqueryresultsExample}, - "/api/admin/edgeGateway/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, edgegatewayExample}, - }) - - edge, err := s.vdc.FindEdgeGateway("M916272752-5793") - _ = testServer.WaitRequests(2) - testServer.Flush() - - c.Assert(err, IsNil) - c.Assert(edge.EdgeGateway.Name, Equals, "M916272752-5793") - - testServer.Response(200, nil, edgegatewayExample) - err = edge.Refresh() - _ = testServer.WaitRequest() - testServer.Flush() - - c.Assert(err, IsNil) - c.Assert(edge.EdgeGateway.Name, Equals, "M916272752-5793") - -} - -func (s *S) Test_NATMapping(c *C) { - testServer.ResponseMap(2, testutil.ResponseMap{ - "/api/vdc/00000000-0000-0000-0000-000000000000/edgeGateways": testutil.Response{200, nil, edgegatewayqueryresultsExample}, - "/api/admin/edgeGateway/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, edgegatewayExample}, - }) - - edge, err := s.vdc.FindEdgeGateway("M916272752-5793") - _ = testServer.WaitRequests(2) - testServer.Flush() - - c.Assert(err, IsNil) - c.Assert(edge.EdgeGateway.Name, Equals, "M916272752-5793") - - testServer.ResponseMap(2, testutil.ResponseMap{ - "/api/admin/edgeGateway/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, edgegatewayExample}, - "/api/admin/edgeGateway/00000000-0000-0000-0000-000000000000/action/configureServices": testutil.Response{200, nil, taskExample}, - }) - - _, err = edge.AddNATMapping("DNAT", "10.0.0.1", "20.0.0.2", "77") - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - - testServer.ResponseMap(2, testutil.ResponseMap{ - "/api/admin/edgeGateway/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, edgegatewayExample}, - "/api/admin/edgeGateway/00000000-0000-0000-0000-000000000000/action/configureServices": testutil.Response{200, nil, taskExample}, - }) - - _, err = edge.RemoveNATMapping("DNAT", "10.0.0.1", "20.0.0.2", "77") - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - -} - -func (s *S) Test_1to1Mappings(c *C) { - - testServer.ResponseMap(2, testutil.ResponseMap{ - "/api/vdc/00000000-0000-0000-0000-000000000000/edgeGateways": testutil.Response{200, nil, edgegatewayqueryresultsExample}, - "/api/admin/edgeGateway/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, edgegatewayExample}, - }) - - edge, err := s.vdc.FindEdgeGateway("M916272752-5793") - _ = testServer.WaitRequests(2) - testServer.Flush() - - c.Assert(err, IsNil) - c.Assert(edge.EdgeGateway.Name, Equals, "M916272752-5793") - - testServer.ResponseMap(2, testutil.ResponseMap{ - "/api/admin/edgeGateway/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, edgegatewayExample}, - "/api/admin/edgeGateway/00000000-0000-0000-0000-000000000000/action/configureServices": testutil.Response{200, nil, taskExample}, - }) - - _, err = edge.Create1to1Mapping("10.0.0.1", "20.0.0.2", "description") - _ = testServer.WaitRequests(2) - - c.Assert(err, IsNil) - - testServer.ResponseMap(2, testutil.ResponseMap{ - "/api/admin/edgeGateway/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, edgegatewayExample}, - "/api/admin/edgeGateway/00000000-0000-0000-0000-000000000000/action/configureServices": testutil.Response{200, nil, taskExample}, - }) - - _, err = edge.Remove1to1Mapping("10.0.0.1", "20.0.0.2") - _ = testServer.WaitRequests(2) - - c.Assert(err, IsNil) - -} - -var edgegatewayqueryresultsExample = ` - - - - - -` - -var edgegatewayExample = ` - - - - - - - - compact - - - JGray Network - JGray Network - - internal - - 192.168.108.1 - 255.255.255.0 - 192.168.108.1 - - false - false - - - M916272752-5793-default-routed - M916272752-5793-default-routed - - internal - - 192.168.109.1 - 255.255.255.0 - 192.168.109.1 - - false - false - - - d2p3-ext - d2p3-ext - - uplink - - 23.92.224.1 - 255.255.254.0 - 23.92.225.51 - - - 23.92.225.73 - 23.92.225.75 - - - 23.92.225.27 - 23.92.225.27 - - - 23.92.225.11 - 23.92.225.11 - - - 23.92.225.54 - 23.92.225.54 - - - 23.92.224.34 - 23.92.224.34 - - - 23.92.225.5 - 23.92.225.5 - - - 23.92.225.34 - 23.92.225.34 - - - 23.92.224.255 - 23.92.224.255 - - - 23.92.225.49 - 23.92.225.51 - - - 23.92.225.62 - 23.92.225.62 - - - 23.92.225.43 - 23.92.225.43 - - - 23.92.225.30 - 23.92.225.30 - - - - true - 1024.0 - 1024.0 - true - - - - - true - drop - false - - 1 - true - false - ssh prd-001 - allow - - true - - 999 - 999 - 23.92.225.51 - -1 - Any - 60.241.110.111 - false - - - 2 - true - false - inet prd-001 - allow - - true - - -1 - Any - Any - -1 - Any - 192.168.109.8 - false - - - 3 - true - false - suppah megah rulez creati0nz - allow - - true - - -1 - Any - 23.92.224.255 - -1 - Any - Any - false - - - 4 - true - false - suppah megah rulez creati0nz - allow - - true - - -1 - Any - Any - -1 - Any - 192.168.109.3 - false - - - - false - - DNAT - true - 65537 - - - 23.92.225.51 - 999 - 192.168.109.8 - 22 - Tcp - - - - SNAT - true - 65538 - - - 192.168.109.8 - 23.92.225.51 - - - - SNAT - true - 65539 - - - 192.168.109.3 - 23.92.224.255 - - - - DNAT - true - 65540 - - - 23.92.224.255 - any - 192.168.109.3 - any - any - - - - - true - - Test VPN Alpha - For OC Pod Testing - - 192.168.110.99 - - 64.184.133.62 - 192.168.110.99 - 23.92.225.51 - 23.92.225.51 - - M916272752-5793-default-routed - 192.168.109.1 - 255.255.255.0 - - - 192.168.120.0/24 - 192.168.120.0 - 255.255.255.0 - - Blah1Blah2Blah3Blah1Blah2Blah3Blah1Blah2Blah3 - false - AES256 - 1500 - true - false - - - JGray VPN - - 67.172.148.74 - - 67.172.148.74 - 67.172.148.74 - 23.92.225.51 - 23.92.225.51 - - JGray Network - 192.168.108.1 - 255.255.255.0 - - - 192.168.1.0/24 - 192.168.1.0 - 255.255.255.0 - - fM7puHkGbg6tqpd4jKNhBo45mbs8fw3yapgt3H7f97a2jrkLyYjP9eSH4oGwps7u - false - AES256 - 1500 - false - false - - - - false - - - false - - - true - true - - - ` diff --git a/vendor/github.com/hmrc/vmware-govcd/org_test.go b/vendor/github.com/hmrc/vmware-govcd/org_test.go deleted file mode 100644 index 1440c7b4d0..0000000000 --- a/vendor/github.com/hmrc/vmware-govcd/org_test.go +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2014 VMware, Inc. All rights reserved. Licensed under the Apache v2 License. - */ - -package govcd - -import ( - . "gopkg.in/check.v1" -) - -func (s *S) Test_FindCatalog(c *C) { - - // Get the Org populated - testServer.Response(200, nil, orgExample) - org, err := s.vdc.GetVDCOrg() - _ = testServer.WaitRequest() - testServer.Flush() - c.Assert(err, IsNil) - - // Find Catalog - testServer.Response(200, nil, catalogExample) - cat, err := org.FindCatalog("Public Catalog") - _ = testServer.WaitRequest() - testServer.Flush() - c.Assert(err, IsNil) - c.Assert(cat.Catalog.Description, Equals, "vCHS service catalog") - -} - -var orgExample = ` - - - - - - - - - - - - - - - - - - - - - - - OrganizationName - - ` diff --git a/vendor/github.com/hmrc/vmware-govcd/orgvdcnetwork_test.go b/vendor/github.com/hmrc/vmware-govcd/orgvdcnetwork_test.go deleted file mode 100644 index 0e74214126..0000000000 --- a/vendor/github.com/hmrc/vmware-govcd/orgvdcnetwork_test.go +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2014 VMware, Inc. All rights reserved. Licensed under the Apache v2 License. - */ - -package govcd - -import ( - "github.com/hmrc/vmware-govcd/testutil" - - . "gopkg.in/check.v1" -) - -func (s *S) Test_NetRefresh(c *C) { - - // Get the Org populated - testServer.ResponseMap(1, testutil.ResponseMap{ - "/api/network/44444444-4444-4444-4444-4444444444444": testutil.Response{200, nil, orgvdcnetExample}, - }) - - network, err := s.vdc.FindVDCNetwork("networkName") - _ = testServer.WaitRequest() - testServer.Flush() - - c.Assert(err, IsNil) - c.Assert(network.OrgVDCNetwork.Name, Equals, "networkName") - - testServer.Response(200, nil, orgvdcnetExample) - err = network.Refresh() - _ = testServer.WaitRequest() - testServer.Flush() - - c.Assert(err, IsNil) - c.Assert(network.OrgVDCNetwork.Name, Equals, "networkName") - -} - -var orgvdcnetExample = ` - - - - - - This routed network was created with Create VDC. - - - - false - 192.168.109.1 - 255.255.255.0 - true - - - 192.168.109.2 - 192.168.109.100 - - - - - natRouted - false - - false - - ` diff --git a/vendor/github.com/hmrc/vmware-govcd/task_test.go b/vendor/github.com/hmrc/vmware-govcd/task_test.go deleted file mode 100644 index 4b94b9c6de..0000000000 --- a/vendor/github.com/hmrc/vmware-govcd/task_test.go +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2014 VMware, Inc. All rights reserved. Licensed under the Apache v2 License. - */ - -package govcd - -import ( - . "gopkg.in/check.v1" -) - -func (s *S) Test_WaitTaskCompletion(c *C) { - - testServer.Response(200, nil, taskExample) - task, err := s.vapp.Deploy() - _ = testServer.WaitRequest() - testServer.Flush() - c.Assert(err, IsNil) - - testServer.Response(200, nil, taskExample) - err = task.WaitTaskCompletion() - _ = testServer.WaitRequest() - testServer.Flush() - c.Assert(err, IsNil) - -} - -var taskExample = ` - - - - - 100 -
- - ` diff --git a/vendor/github.com/hmrc/vmware-govcd/vapp_test.go b/vendor/github.com/hmrc/vmware-govcd/vapp_test.go deleted file mode 100644 index 475cc21eec..0000000000 --- a/vendor/github.com/hmrc/vmware-govcd/vapp_test.go +++ /dev/null @@ -1,692 +0,0 @@ -/* - * Copyright 2014 VMware, Inc. All rights reserved. Licensed under the Apache v2 License. - */ - -package govcd - -import ( - "github.com/hmrc/vmware-govcd/testutil" - - . "gopkg.in/check.v1" -) - -func (s *S) Test_ComposeVApp(c *C) { - - testServer.ResponseMap(7, testutil.ResponseMap{ - "/api/org/11111111-1111-1111-1111-111111111111": testutil.Response{200, nil, orgExample}, - "/api/network/44444444-4444-4444-4444-4444444444444": testutil.Response{200, nil, orgvdcnetExample}, - "/api/catalog/e8a20fdf-8a78-440c-ac71-0420db59f854": testutil.Response{200, nil, catalogExample}, - "/api/catalogItem/1176e485-8858-4e15-94e5-ae4face605ae": testutil.Response{200, nil, catalogitemExample}, - "/api/vAppTemplate/vappTemplate-40cb9721-5f1a-44f9-b5c3-98c5f518c4f5": testutil.Response{200, nil, vapptemplateExample}, - "/api/vdc/00000000-0000-0000-0000-000000000000/action/composeVApp": testutil.Response{200, nil, instantiatedvappExample}, - "/api/vApp/vapp-00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vappExample}, - }) - - // Get the Org populated - org, err := s.vdc.GetVDCOrg() - c.Assert(err, IsNil) - - // Populate OrgVDCNetwork - net, err := s.vdc.FindVDCNetwork("networkName") - c.Assert(err, IsNil) - - // Populate Catalog - cat, err := org.FindCatalog("Public Catalog") - c.Assert(err, IsNil) - - // Populate Catalog Item - catitem, err := cat.FindCatalogItem("CentOS64-32bit") - c.Assert(err, IsNil) - - // Get VAppTemplate - vapptemplate, err := catitem.GetVAppTemplate() - c.Assert(err, IsNil) - - // Compose VApp - task, err := s.vapp.ComposeVApp(net, vapptemplate, "name", "description") - c.Assert(err, IsNil) - c.Assert(task.Task.OperationName, Equals, "vdcInstantiateVapp") - c.Assert(s.vapp.VApp.HREF, Equals, "http://localhost:4444/api/vApp/vapp-00000000-0000-0000-0000-000000000000") - - status, err := s.vapp.GetStatus() - - c.Assert(err, IsNil) - c.Assert(status, Equals, "POWERED_OFF") - - _ = testServer.WaitRequests(7) - -} - -func (s *S) Test_PowerOn(c *C) { - - testServer.Response(200, nil, taskExample) - task, err := s.vapp.PowerOn() - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(task.Task.Status, Equals, "success") - -} - -func (s *S) Test_PowerOff(c *C) { - - testServer.Response(200, nil, taskExample) - task, err := s.vapp.PowerOff() - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(task.Task.Status, Equals, "success") - -} - -func (s *S) Test_Reboot(c *C) { - - testServer.Response(200, nil, taskExample) - task, err := s.vapp.Reboot() - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(task.Task.Status, Equals, "success") - -} - -func (s *S) Test_AddMetadata(c *C) { - testServer.ResponseMap(8, testutil.ResponseMap{ - "/api/org/11111111-1111-1111-1111-111111111111": testutil.Response{200, nil, orgExample}, - "/api/network/44444444-4444-4444-4444-4444444444444": testutil.Response{200, nil, orgvdcnetExample}, - "/api/catalog/e8a20fdf-8a78-440c-ac71-0420db59f854": testutil.Response{200, nil, catalogExample}, - "/api/catalogItem/1176e485-8858-4e15-94e5-ae4face605ae": testutil.Response{200, nil, catalogitemExample}, - "/api/vAppTemplate/vappTemplate-40cb9721-5f1a-44f9-b5c3-98c5f518c4f5": testutil.Response{200, nil, vapptemplateExample}, - "/api/vdc/00000000-0000-0000-0000-000000000000/action/composeVApp": testutil.Response{200, nil, instantiatedvappExample}, - "/api/vApp/vapp-00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vappExample}, - "/api/vApp/vm-00000000-0000-0000-0000-000000000000/metadata/key": testutil.Response{200, nil, taskExample}, - }) - - // Get the Org populated - org, err := s.vdc.GetVDCOrg() - c.Assert(err, IsNil) - - // Populate OrgVDCNetwork - net, err := s.vdc.FindVDCNetwork("networkName") - c.Assert(err, IsNil) - - // Populate Catalog - cat, err := org.FindCatalog("Public Catalog") - c.Assert(err, IsNil) - - // Populate Catalog Item - catitem, err := cat.FindCatalogItem("CentOS64-32bit") - c.Assert(err, IsNil) - - // Get VAppTemplate - vapptemplate, err := catitem.GetVAppTemplate() - c.Assert(err, IsNil) - - // Compose VApp - task, err := s.vapp.ComposeVApp(net, vapptemplate, "name", "description") - c.Assert(err, IsNil) - c.Assert(task.Task.OperationName, Equals, "vdcInstantiateVapp") - c.Assert(s.vapp.VApp.HREF, Equals, "http://localhost:4444/api/vApp/vapp-00000000-0000-0000-0000-000000000000") - - task, err = s.vapp.AddMetadata("key", "value") - - c.Assert(err, IsNil) - c.Assert(task.Task.Status, Equals, "success") - - _ = testServer.WaitRequests(8) - -} - -func (s *S) Test_ChangeVMName(c *C) { - - testServer.ResponseMap(8, testutil.ResponseMap{ - "/api/org/11111111-1111-1111-1111-111111111111": testutil.Response{200, nil, orgExample}, - "/api/network/44444444-4444-4444-4444-4444444444444": testutil.Response{200, nil, orgvdcnetExample}, - "/api/catalog/e8a20fdf-8a78-440c-ac71-0420db59f854": testutil.Response{200, nil, catalogExample}, - "/api/catalogItem/1176e485-8858-4e15-94e5-ae4face605ae": testutil.Response{200, nil, catalogitemExample}, - "/api/vAppTemplate/vappTemplate-40cb9721-5f1a-44f9-b5c3-98c5f518c4f5": testutil.Response{200, nil, vapptemplateExample}, - "/api/vdc/00000000-0000-0000-0000-000000000000/action/composeVApp": testutil.Response{200, nil, instantiatedvappExample}, - "/api/vApp/vapp-00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vappExample}, - "/api/vApp/vm-00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, taskExample}, - }) - - // Get the Org populated - org, err := s.vdc.GetVDCOrg() - c.Assert(err, IsNil) - - // Populate OrgVDCNetwork - net, err := s.vdc.FindVDCNetwork("networkName") - c.Assert(err, IsNil) - - // Populate Catalog - cat, err := org.FindCatalog("Public Catalog") - c.Assert(err, IsNil) - - // Populate Catalog Item - catitem, err := cat.FindCatalogItem("CentOS64-32bit") - c.Assert(err, IsNil) - - // Get VAppTemplate - vapptemplate, err := catitem.GetVAppTemplate() - c.Assert(err, IsNil) - - // Compose VApp - task, err := s.vapp.ComposeVApp(net, vapptemplate, "name", "description") - c.Assert(err, IsNil) - c.Assert(task.Task.OperationName, Equals, "vdcInstantiateVapp") - c.Assert(s.vapp.VApp.HREF, Equals, "http://localhost:4444/api/vApp/vapp-00000000-0000-0000-0000-000000000000") - - task, err = s.vapp.ChangeVMName("My-vm") - - c.Assert(err, IsNil) - c.Assert(task.Task.Status, Equals, "success") - - _ = testServer.WaitRequests(8) - -} - -func (s *S) Test_Reset(c *C) { - - testServer.Response(200, nil, taskExample) - task, err := s.vapp.Reset() - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(task.Task.Status, Equals, "success") - -} - -func (s *S) Test_Suspend(c *C) { - - testServer.Response(200, nil, taskExample) - task, err := s.vapp.Suspend() - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(task.Task.Status, Equals, "success") - -} - -func (s *S) Test_Shutdown(c *C) { - - testServer.Response(200, nil, taskExample) - task, err := s.vapp.Shutdown() - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(task.Task.Status, Equals, "success") - -} - -func (s *S) Test_Undeploy(c *C) { - - testServer.Response(200, nil, taskExample) - task, err := s.vapp.Undeploy() - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(task.Task.Status, Equals, "success") - -} - -func (s *S) Test_Deploy(c *C) { - - testServer.Response(200, nil, taskExample) - task, err := s.vapp.Deploy() - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(task.Task.Status, Equals, "success") - -} - -func (s *S) Test_Delete(c *C) { - - testServer.Response(200, nil, taskExample) - task, err := s.vapp.Delete() - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(task.Task.Status, Equals, "success") - -} - -func (s *S) Test_RunCustomizationScript(c *C) { - - testServer.ResponseMap(8, testutil.ResponseMap{ - "/api/org/11111111-1111-1111-1111-111111111111": testutil.Response{200, nil, orgExample}, - "/api/network/44444444-4444-4444-4444-4444444444444": testutil.Response{200, nil, orgvdcnetExample}, - "/api/catalog/e8a20fdf-8a78-440c-ac71-0420db59f854": testutil.Response{200, nil, catalogExample}, - "/api/catalogItem/1176e485-8858-4e15-94e5-ae4face605ae": testutil.Response{200, nil, catalogitemExample}, - "/api/vAppTemplate/vappTemplate-40cb9721-5f1a-44f9-b5c3-98c5f518c4f5": testutil.Response{200, nil, vapptemplateExample}, - "/api/vdc/00000000-0000-0000-0000-000000000000/action/composeVApp": testutil.Response{200, nil, instantiatedvappExample}, - "/api/vApp/vapp-00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vappExample}, - "/api/vApp/vm-00000000-0000-0000-0000-000000000000/guestCustomizationSection/": testutil.Response{200, nil, taskExample}, - }) - - // Get the Org populated - org, err := s.vdc.GetVDCOrg() - c.Assert(err, IsNil) - - // Populate OrgVDCNetwork - net, err := s.vdc.FindVDCNetwork("networkName") - c.Assert(err, IsNil) - - // Populate Catalog - cat, err := org.FindCatalog("Public Catalog") - c.Assert(err, IsNil) - - // Populate Catalog Item - catitem, err := cat.FindCatalogItem("CentOS64-32bit") - c.Assert(err, IsNil) - - // Get VAppTemplate - vapptemplate, err := catitem.GetVAppTemplate() - c.Assert(err, IsNil) - - // Compose VApp - task, err := s.vapp.ComposeVApp(net, vapptemplate, "name", "description") - c.Assert(err, IsNil) - c.Assert(task.Task.OperationName, Equals, "vdcInstantiateVapp") - c.Assert(s.vapp.VApp.HREF, Equals, "http://localhost:4444/api/vApp/vapp-00000000-0000-0000-0000-000000000000") - - task, err = s.vapp.RunCustomizationScript("computername", "this is my script") - - c.Assert(err, IsNil) - c.Assert(task.Task.Status, Equals, "success") - - _ = testServer.WaitRequests(8) - -} - -func (s *S) Test_ChangeCPUcount(c *C) { - - testServer.ResponseMap(8, testutil.ResponseMap{ - "/api/org/11111111-1111-1111-1111-111111111111": testutil.Response{200, nil, orgExample}, - "/api/network/44444444-4444-4444-4444-4444444444444": testutil.Response{200, nil, orgvdcnetExample}, - "/api/catalog/e8a20fdf-8a78-440c-ac71-0420db59f854": testutil.Response{200, nil, catalogExample}, - "/api/catalogItem/1176e485-8858-4e15-94e5-ae4face605ae": testutil.Response{200, nil, catalogitemExample}, - "/api/vAppTemplate/vappTemplate-40cb9721-5f1a-44f9-b5c3-98c5f518c4f5": testutil.Response{200, nil, vapptemplateExample}, - "/api/vdc/00000000-0000-0000-0000-000000000000/action/composeVApp": testutil.Response{200, nil, instantiatedvappExample}, - "/api/vApp/vapp-00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vappExample}, - "/api/vApp/vm-00000000-0000-0000-0000-000000000000/virtualHardwareSection/cpu": testutil.Response{200, nil, taskExample}, - }) - - // Get the Org populated - org, err := s.vdc.GetVDCOrg() - c.Assert(err, IsNil) - - // Populate OrgVDCNetwork - net, err := s.vdc.FindVDCNetwork("networkName") - c.Assert(err, IsNil) - - // Populate Catalog - cat, err := org.FindCatalog("Public Catalog") - c.Assert(err, IsNil) - - // Populate Catalog Item - catitem, err := cat.FindCatalogItem("CentOS64-32bit") - c.Assert(err, IsNil) - - // Get VAppTemplate - vapptemplate, err := catitem.GetVAppTemplate() - c.Assert(err, IsNil) - - // Compose VApp - task, err := s.vapp.ComposeVApp(net, vapptemplate, "name", "description") - c.Assert(err, IsNil) - c.Assert(task.Task.OperationName, Equals, "vdcInstantiateVapp") - c.Assert(s.vapp.VApp.HREF, Equals, "http://localhost:4444/api/vApp/vapp-00000000-0000-0000-0000-000000000000") - - task, err = s.vapp.ChangeCPUcount(2) - - c.Assert(err, IsNil) - c.Assert(task.Task.Status, Equals, "success") - - _ = testServer.WaitRequests(8) - -} - -func (s *S) Test_ChangeMemorySize(c *C) { - - testServer.ResponseMap(8, testutil.ResponseMap{ - "/api/org/11111111-1111-1111-1111-111111111111": testutil.Response{200, nil, orgExample}, - "/api/network/44444444-4444-4444-4444-4444444444444": testutil.Response{200, nil, orgvdcnetExample}, - "/api/catalog/e8a20fdf-8a78-440c-ac71-0420db59f854": testutil.Response{200, nil, catalogExample}, - "/api/catalogItem/1176e485-8858-4e15-94e5-ae4face605ae": testutil.Response{200, nil, catalogitemExample}, - "/api/vAppTemplate/vappTemplate-40cb9721-5f1a-44f9-b5c3-98c5f518c4f5": testutil.Response{200, nil, vapptemplateExample}, - "/api/vdc/00000000-0000-0000-0000-000000000000/action/composeVApp": testutil.Response{200, nil, instantiatedvappExample}, - "/api/vApp/vapp-00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vappExample}, - "/api/vApp/vm-00000000-0000-0000-0000-000000000000/virtualHardwareSection/memory": testutil.Response{200, nil, taskExample}, - }) - - // Get the Org populated - org, err := s.vdc.GetVDCOrg() - c.Assert(err, IsNil) - - // Populate OrgVDCNetwork - net, err := s.vdc.FindVDCNetwork("networkName") - c.Assert(err, IsNil) - - // Populate Catalog - cat, err := org.FindCatalog("Public Catalog") - c.Assert(err, IsNil) - - // Populate Catalog Item - catitem, err := cat.FindCatalogItem("CentOS64-32bit") - c.Assert(err, IsNil) - - // Get VAppTemplate - vapptemplate, err := catitem.GetVAppTemplate() - c.Assert(err, IsNil) - - // Compose VApp - task, err := s.vapp.ComposeVApp(net, vapptemplate, "name", "description") - c.Assert(err, IsNil) - c.Assert(task.Task.OperationName, Equals, "vdcInstantiateVapp") - c.Assert(s.vapp.VApp.HREF, Equals, "http://localhost:4444/api/vApp/vapp-00000000-0000-0000-0000-000000000000") - - task, err = s.vapp.ChangeMemorySize(4096) - - c.Assert(err, IsNil) - c.Assert(task.Task.Status, Equals, "success") - - _ = testServer.WaitRequests(8) - -} - -var instantiatedvappExample = ` - - - - - - - - - - - - - My vApp to be deployed - - - - - - - 1 -
- - - 2014-10-24T15:26:59.067Z - - - - false - - ` - -var vappExample = ` - - - - - - - - - - - - - - - - - - - - - - Test API GO4444! - - Lease settings section - - 0 - 0 - - - VApp startup section - - - - - The list of logical networks - - This isolated network was created with Create VDC. - - - This is a special place-holder used for disconnected network interfaces. - - - - The configuration parameters for logical networks - - - - This isolated network was created with Create VDC. - - - - true - 192.168.99.1 - 255.255.255.0 - true - - - 192.168.99.2 - 192.168.99.100 - - - - - - bridged - false - - false - - - This is a special place-holder used for disconnected network interfaces. - - - - false - 196.254.254.254 - 255.255.0.0 - 196.254.254.254 - - - isolated - - false - - - - Snapshot information section - - 2014-11-06T22:24:43.913Z - - - - false - - - - - - - - - - - - - - - - - - - - - - id: cts-6.4-32bit - - Virtual hardware requirements - - Virtual Hardware Family - 0 - CentOS64-32bit - vmx-09 - - - 00:50:56:02:0b:36 - 0 - false - none - E1000 ethernet adapter on "none" - Network adapter 0 - 1 - E1000 - 10 - - - 0 - SCSI Controller - SCSI Controller 0 - 2 - lsilogic - 6 - - - 0 - Hard disk - Hard disk 1 - - 2000 - 2 - 17 - - - 1 - IDE Controller - IDE Controller 1 - 3 - 5 - - - 0 - false - CD/DVD Drive - CD/DVD Drive 1 - - 3002 - 3 - 15 - - - 0 - false - Floppy Drive - Floppy Drive 1 - - 8000 - 14 - - - hertz * 10^6 - Number of Virtual CPUs - 1 virtual CPU(s) - 4 - 0 - 3 - 1 - 0 - 1 - - - - byte * 2^20 - Memory Size - 1024 MB of memory - 5 - 0 - 4 - 1024 - 0 - - - - - - - - - - - - - - - - - Specifies the operating system installed - CentOS 4/5/6 (32-bit) - - - - Specifies the available VM network connections - 0 - - 0 - false - 00:50:56:02:0b:36 - NONE - - - - - Specifies Guest OS Customization Settings - true - false - 00000000-0000-0000-0000-000000000000 - false - false - true - true - false - 0 - true - cts-6.4-32bit - - - - Specifies Runtime info - - - - Snapshot information section - - CentOS64-32bit - - - false - false - - - - - - ` diff --git a/vendor/github.com/hmrc/vmware-govcd/vapptemplate_test.go b/vendor/github.com/hmrc/vmware-govcd/vapptemplate_test.go deleted file mode 100644 index 48b10acebe..0000000000 --- a/vendor/github.com/hmrc/vmware-govcd/vapptemplate_test.go +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright 2014 VMware, Inc. All rights reserved. Licensed under the Apache v2 License. - */ - -package govcd - -var vapptemplateExample = ` - - - - - - - - - - - id: cts-6.4-32bit - - - - - - - - - - id: cts-6.4-32bit - - Specifies the available VM network connections - 0 - - 0 - false - 00:50:56:02:00:39 - NONE - - - - Specifies Guest OS Customization Settings - true - false - 3a3934d2-1f3f-4782-a911-f143da27e88c - false - false - true - true - false - 0 - true - cts-6.4-32bit - - - Virtual hardware requirements - - Virtual Hardware Family - 0 - CentOS64-32bit - vmx-09 - - - 00:50:56:02:00:39 - 0 - false - none - E1000 ethernet adapter on "none" - Network adapter 0 - 1 - E1000 - 10 - - - 0 - SCSI Controller - SCSI Controller 0 - 2 - lsilogic - 6 - - - 0 - Hard disk - Hard disk 1 - - 2000 - 2 - 17 - - - 1 - IDE Controller - IDE Controller 1 - 3 - 5 - - - 0 - false - CD/DVD Drive - CD/DVD Drive 1 - - 3002 - 3 - 15 - - - 0 - false - Floppy Drive - Floppy Drive 1 - - 8000 - 14 - - - hertz * 10^6 - Number of Virtual CPUs - 1 virtual CPU(s) - 4 - 0 - 3 - 1 - 0 - 1 - - - byte * 2^20 - Memory Size - 1024 MB of memory - 5 - 0 - 4 - 1024 - 0 - - - - - - - - - CentOS64-32bit - 2014-06-04T21:06:43.547Z - - - - The list of logical networks - - This is a special place-holder used for disconnected network interfaces. - - - - The configuration parameters for logical networks - - This is a special place-holder used for disconnected network interfaces. - - - - false - 196.254.254.254 - 255.255.0.0 - 196.254.254.254 - - - isolated - - false - - - - Lease settings section - - 0 - - - VApp template customization section - true - - 2014-06-04T21:06:43.547Z - - - ` diff --git a/vendor/github.com/hmrc/vmware-govcd/vdc_test.go b/vendor/github.com/hmrc/vmware-govcd/vdc_test.go deleted file mode 100644 index ad30afb8e6..0000000000 --- a/vendor/github.com/hmrc/vmware-govcd/vdc_test.go +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2014 VMware, Inc. All rights reserved. Licensed under the Apache v2 License. - */ - -package govcd - -import ( - "github.com/hmrc/vmware-govcd/testutil" - - . "gopkg.in/check.v1" -) - -func (s *S) Test_FindVDCNetwork(c *C) { - - testServer.Response(200, nil, orgvdcnetExample) - - net, err := s.vdc.FindVDCNetwork("networkName") - - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(net, NotNil) - c.Assert(net.OrgVDCNetwork.HREF, Equals, "http://localhost:4444/api/network/cb0f4c9e-1a46-49d4-9fcb-d228000a6bc1") - - // find Invalid Network - net, err = s.vdc.FindVDCNetwork("INVALID") - c.Assert(err, NotNil) -} - -func (s *S) Test_GetVDCOrg(c *C) { - - testServer.Response(200, nil, orgExample) - - org, err := s.vdc.GetVDCOrg() - - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(org, NotNil) - c.Assert(org.Org.HREF, Equals, "http://localhost:4444/api/org/23bd2339-c55f-403c-baf3-13109e8c8d57") -} - -func (s *S) Test_NewVdc(c *C) { - - testServer.Response(200, nil, vdcExample) - err := s.vdc.Refresh() - _ = testServer.WaitRequest() - c.Assert(err, IsNil) - - c.Assert(s.vdc.Vdc.Link[0].Rel, Equals, "up") - c.Assert(s.vdc.Vdc.Link[0].Type, Equals, "application/vnd.vmware.vcloud.org+xml") - c.Assert(s.vdc.Vdc.Link[0].HREF, Equals, "http://localhost:4444/api/org/11111111-1111-1111-1111-111111111111") - - c.Assert(s.vdc.Vdc.AllocationModel, Equals, "AllocationPool") - - for _, v := range s.vdc.Vdc.ComputeCapacity { - c.Assert(v.CPU.Units, Equals, "MHz") - c.Assert(v.CPU.Allocated, Equals, int64(30000)) - c.Assert(v.CPU.Limit, Equals, int64(30000)) - c.Assert(v.CPU.Reserved, Equals, int64(15000)) - c.Assert(v.CPU.Used, Equals, int64(0)) - c.Assert(v.CPU.Overhead, Equals, int64(0)) - c.Assert(v.Memory.Units, Equals, "MB") - c.Assert(v.Memory.Allocated, Equals, int64(61440)) - c.Assert(v.Memory.Limit, Equals, int64(61440)) - c.Assert(v.Memory.Reserved, Equals, int64(61440)) - c.Assert(v.Memory.Used, Equals, int64(6144)) - c.Assert(v.Memory.Overhead, Equals, int64(95)) - } - - c.Assert(s.vdc.Vdc.ResourceEntities[0].ResourceEntity[0].Name, Equals, "vAppTemplate") - c.Assert(s.vdc.Vdc.ResourceEntities[0].ResourceEntity[0].Type, Equals, "application/vnd.vmware.vcloud.vAppTemplate+xml") - c.Assert(s.vdc.Vdc.ResourceEntities[0].ResourceEntity[0].HREF, Equals, "http://localhost:4444/api/vAppTemplate/vappTemplate-22222222-2222-2222-2222-222222222222") - - for _, v := range s.vdc.Vdc.AvailableNetworks { - for _, v2 := range v.Network { - c.Assert(v2.Name, Equals, "networkName") - c.Assert(v2.Type, Equals, "application/vnd.vmware.vcloud.network+xml") - c.Assert(v2.HREF, Equals, "http://localhost:4444/api/network/44444444-4444-4444-4444-4444444444444") - } - } - - c.Assert(s.vdc.Vdc.NicQuota, Equals, 0) - c.Assert(s.vdc.Vdc.NetworkQuota, Equals, 20) - c.Assert(s.vdc.Vdc.UsedNetworkCount, Equals, 0) - c.Assert(s.vdc.Vdc.VMQuota, Equals, 0) - c.Assert(s.vdc.Vdc.IsEnabled, Equals, true) - - for _, v := range s.vdc.Vdc.VdcStorageProfiles { - for _, v2 := range v.VdcStorageProfile { - c.Assert(v2.Name, Equals, "storageProfile") - c.Assert(v2.Type, Equals, "application/vnd.vmware.vcloud.vdcStorageProfile+xml") - c.Assert(v2.HREF, Equals, "http://localhost:4444/api/vdcStorageProfile/88888888-8888-8888-8888-888888888888") - } - } - -} - -func (s *S) Test_FindVApp(c *C) { - - // testServer.Response(200, nil, vappExample) - - // vapp, err := s.vdc.FindVAppByID("") - - // _ = testServer.WaitRequest() - // testServer.Flush() - // c.Assert(err, IsNil) - - testServer.ResponseMap(2, testutil.ResponseMap{ - "/api/vdc/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vdcExample}, - "/api/vApp/vapp-00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vappExample}, - }) - - _, err := s.vdc.FindVAppByName("myVApp") - - _ = testServer.WaitRequests(2) - - c.Assert(err, IsNil) - - testServer.ResponseMap(2, testutil.ResponseMap{ - "/api/vdc/00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vdcExample}, - "/api/vApp/vapp-00000000-0000-0000-0000-000000000000": testutil.Response{200, nil, vappExample}, - }) - - _, err = s.vdc.FindVAppByID("urn:vcloud:vapp:00000000-0000-0000-0000-000000000000") - - _ = testServer.WaitRequests(2) - - c.Assert(err, IsNil) - -} - -var vdcExample = ` - - - - - AllocationPool - - - MHz - 30000 - 30000 - 15000 - 0 - 0 - - - MB - 61440 - 61440 - 61440 - 6144 - 95 - - - - - - - - - - - - vmx-10 - - - 0 - 20 - 0 - 0 - true - - - - - ` diff --git a/vendor/github.com/imdario/mergo/issue17_test.go b/vendor/github.com/imdario/mergo/issue17_test.go deleted file mode 100644 index 0ee96f3771..0000000000 --- a/vendor/github.com/imdario/mergo/issue17_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package mergo - -import ( - "encoding/json" - "testing" -) - -var ( - request = `{"timestamp":null, "name": "foo"}` - maprequest = map[string]interface{}{ - "timestamp": nil, - "name": "foo", - "newStuff": "foo", - } -) - -func TestIssue17MergeWithOverwrite(t *testing.T) { - var something map[string]interface{} - if err := json.Unmarshal([]byte(request), &something); err != nil { - t.Errorf("Error while Unmarshalling maprequest %s", err) - } - if err := MergeWithOverwrite(&something, maprequest); err != nil { - t.Errorf("Error while merging %s", err) - } -} diff --git a/vendor/github.com/imdario/mergo/mergo_test.go b/vendor/github.com/imdario/mergo/mergo_test.go deleted file mode 100644 index cabf993a3f..0000000000 --- a/vendor/github.com/imdario/mergo/mergo_test.go +++ /dev/null @@ -1,502 +0,0 @@ -// Copyright 2013 Dario Castañé. All rights reserved. -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package mergo - -import ( - "gopkg.in/yaml.v1" - "io/ioutil" - "reflect" - "testing" - "time" -) - -type simpleTest struct { - Value int -} - -type complexTest struct { - St simpleTest - sz int - Id string -} - -type moreComplextText struct { - Ct complexTest - St simpleTest - Nt simpleTest -} - -type pointerTest struct { - C *simpleTest -} - -type sliceTest struct { - S []int -} - -func TestKb(t *testing.T) { - type testStruct struct { - Name string - KeyValue map[string]interface{} - } - - akv := make(map[string]interface{}) - akv["Key1"] = "not value 1" - akv["Key2"] = "value2" - a := testStruct{} - a.Name = "A" - a.KeyValue = akv - - bkv := make(map[string]interface{}) - bkv["Key1"] = "value1" - bkv["Key3"] = "value3" - b := testStruct{} - b.Name = "B" - b.KeyValue = bkv - - ekv := make(map[string]interface{}) - ekv["Key1"] = "value1" - ekv["Key2"] = "value2" - ekv["Key3"] = "value3" - expected := testStruct{} - expected.Name = "B" - expected.KeyValue = ekv - - Merge(&b, a) - - if !reflect.DeepEqual(b, expected) { - t.Errorf("Actual: %#v did not match \nExpected: %#v", b, expected) - } -} - -func TestNil(t *testing.T) { - if err := Merge(nil, nil); err != ErrNilArguments { - t.Fail() - } -} - -func TestDifferentTypes(t *testing.T) { - a := simpleTest{42} - b := 42 - if err := Merge(&a, b); err != ErrDifferentArgumentsTypes { - t.Fail() - } -} - -func TestSimpleStruct(t *testing.T) { - a := simpleTest{} - b := simpleTest{42} - if err := Merge(&a, b); err != nil { - t.FailNow() - } - if a.Value != 42 { - t.Fatalf("b not merged in properly: a.Value(%d) != b.Value(%d)", a.Value, b.Value) - } - if !reflect.DeepEqual(a, b) { - t.FailNow() - } -} - -func TestComplexStruct(t *testing.T) { - a := complexTest{} - a.Id = "athing" - b := complexTest{simpleTest{42}, 1, "bthing"} - if err := Merge(&a, b); err != nil { - t.FailNow() - } - if a.St.Value != 42 { - t.Fatalf("b not merged in properly: a.St.Value(%d) != b.St.Value(%d)", a.St.Value, b.St.Value) - } - if a.sz == 1 { - t.Fatalf("a's private field sz not preserved from merge: a.sz(%d) == b.sz(%d)", a.sz, b.sz) - } - if a.Id == b.Id { - t.Fatalf("a's field Id merged unexpectedly: a.Id(%s) == b.Id(%s)", a.Id, b.Id) - } -} - -func TestComplexStructWithOverwrite(t *testing.T) { - a := complexTest{simpleTest{1}, 1, "do-not-overwrite-with-empty-value"} - b := complexTest{simpleTest{42}, 2, ""} - - expect := complexTest{simpleTest{42}, 1, "do-not-overwrite-with-empty-value"} - if err := MergeWithOverwrite(&a, b); err != nil { - t.FailNow() - } - - if !reflect.DeepEqual(a, expect) { - t.Fatalf("Test failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", a, expect) - } -} - -func TestPointerStruct(t *testing.T) { - s1 := simpleTest{} - s2 := simpleTest{19} - a := pointerTest{&s1} - b := pointerTest{&s2} - if err := Merge(&a, b); err != nil { - t.FailNow() - } - if a.C.Value != b.C.Value { - t.Fatalf("b not merged in properly: a.C.Value(%d) != b.C.Value(%d)", a.C.Value, b.C.Value) - } -} - -type embeddingStruct struct { - embeddedStruct -} - -type embeddedStruct struct { - A string -} - -func TestEmbeddedStruct(t *testing.T) { - tests := []struct { - src embeddingStruct - dst embeddingStruct - expected embeddingStruct - }{ - { - src: embeddingStruct{ - embeddedStruct{"foo"}, - }, - dst: embeddingStruct{ - embeddedStruct{""}, - }, - expected: embeddingStruct{ - embeddedStruct{"foo"}, - }, - }, - { - src: embeddingStruct{ - embeddedStruct{""}, - }, - dst: embeddingStruct{ - embeddedStruct{"bar"}, - }, - expected: embeddingStruct{ - embeddedStruct{"bar"}, - }, - }, - { - src: embeddingStruct{ - embeddedStruct{"foo"}, - }, - dst: embeddingStruct{ - embeddedStruct{"bar"}, - }, - expected: embeddingStruct{ - embeddedStruct{"bar"}, - }, - }, - } - - for _, test := range tests { - err := Merge(&test.dst, test.src) - if err != nil { - t.Errorf("unexpected error: %v", err) - continue - } - if !reflect.DeepEqual(test.dst, test.expected) { - t.Errorf("unexpected output\nexpected:\n%+v\nsaw:\n%+v\n", test.expected, test.dst) - } - } -} - -func TestPointerStructNil(t *testing.T) { - a := pointerTest{nil} - b := pointerTest{&simpleTest{19}} - if err := Merge(&a, b); err != nil { - t.FailNow() - } - if a.C.Value != b.C.Value { - t.Fatalf("b not merged in a properly: a.C.Value(%d) != b.C.Value(%d)", a.C.Value, b.C.Value) - } -} - -func TestSliceStruct(t *testing.T) { - a := sliceTest{} - b := sliceTest{[]int{1, 2, 3}} - if err := Merge(&a, b); err != nil { - t.FailNow() - } - if len(b.S) != 3 { - t.FailNow() - } - if len(a.S) != len(b.S) { - t.Fatalf("b not merged in a proper way %d != %d", len(a.S), len(b.S)) - } - - a = sliceTest{[]int{1}} - b = sliceTest{[]int{1, 2, 3}} - if err := Merge(&a, b); err != nil { - t.FailNow() - } - if len(a.S) != 1 { - t.FailNow() - } - if len(a.S) == len(b.S) { - t.Fatalf("b merged unexpectedly %d != %d", len(a.S), len(b.S)) - } -} - -func TestMapsWithOverwrite(t *testing.T) { - m := map[string]simpleTest{ - "a": simpleTest{}, // overwritten by 16 - "b": simpleTest{42}, // not overwritten by empty value - "c": simpleTest{13}, // overwritten by 12 - "d": simpleTest{61}, - } - n := map[string]simpleTest{ - "a": simpleTest{16}, - "b": simpleTest{}, - "c": simpleTest{12}, - "e": simpleTest{14}, - } - expect := map[string]simpleTest{ - "a": simpleTest{16}, - "b": simpleTest{}, - "c": simpleTest{12}, - "d": simpleTest{61}, - "e": simpleTest{14}, - } - - if err := MergeWithOverwrite(&m, n); err != nil { - t.Fatalf(err.Error()) - } - - if !reflect.DeepEqual(m, expect) { - t.Fatalf("Test failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", m, expect) - } -} - -func TestMaps(t *testing.T) { - m := map[string]simpleTest{ - "a": simpleTest{}, - "b": simpleTest{42}, - "c": simpleTest{13}, - "d": simpleTest{61}, - } - n := map[string]simpleTest{ - "a": simpleTest{16}, - "b": simpleTest{}, - "c": simpleTest{12}, - "e": simpleTest{14}, - } - expect := map[string]simpleTest{ - "a": simpleTest{0}, - "b": simpleTest{42}, - "c": simpleTest{13}, - "d": simpleTest{61}, - "e": simpleTest{14}, - } - - if err := Merge(&m, n); err != nil { - t.Fatalf(err.Error()) - } - - if !reflect.DeepEqual(m, expect) { - t.Fatalf("Test failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", m, expect) - } - if m["a"].Value != 0 { - t.Fatalf(`n merged in m because I solved non-addressable map values TODO: m["a"].Value(%d) != n["a"].Value(%d)`, m["a"].Value, n["a"].Value) - } - if m["b"].Value != 42 { - t.Fatalf(`n wrongly merged in m: m["b"].Value(%d) != n["b"].Value(%d)`, m["b"].Value, n["b"].Value) - } - if m["c"].Value != 13 { - t.Fatalf(`n overwritten in m: m["c"].Value(%d) != n["c"].Value(%d)`, m["c"].Value, n["c"].Value) - } -} - -func TestYAMLMaps(t *testing.T) { - thing := loadYAML("testdata/thing.yml") - license := loadYAML("testdata/license.yml") - ft := thing["fields"].(map[interface{}]interface{}) - fl := license["fields"].(map[interface{}]interface{}) - expectedLength := len(ft) + len(fl) - if err := Merge(&license, thing); err != nil { - t.Fatal(err.Error()) - } - currentLength := len(license["fields"].(map[interface{}]interface{})) - if currentLength != expectedLength { - t.Fatalf(`thing not merged in license properly, license must have %d elements instead of %d`, expectedLength, currentLength) - } - fields := license["fields"].(map[interface{}]interface{}) - if _, ok := fields["id"]; !ok { - t.Fatalf(`thing not merged in license properly, license must have a new id field from thing`) - } -} - -func TestTwoPointerValues(t *testing.T) { - a := &simpleTest{} - b := &simpleTest{42} - if err := Merge(a, b); err != nil { - t.Fatalf(`Boom. You crossed the streams: %s`, err) - } -} - -func TestMap(t *testing.T) { - a := complexTest{} - a.Id = "athing" - c := moreComplextText{a, simpleTest{}, simpleTest{}} - b := map[string]interface{}{ - "ct": map[string]interface{}{ - "st": map[string]interface{}{ - "value": 42, - }, - "sz": 1, - "id": "bthing", - }, - "st": &simpleTest{144}, // Mapping a reference - "zt": simpleTest{299}, // Mapping a missing field (zt doesn't exist) - "nt": simpleTest{3}, - } - if err := Map(&c, b); err != nil { - t.FailNow() - } - m := b["ct"].(map[string]interface{}) - n := m["st"].(map[string]interface{}) - o := b["st"].(*simpleTest) - p := b["nt"].(simpleTest) - if c.Ct.St.Value != 42 { - t.Fatalf("b not merged in properly: c.Ct.St.Value(%d) != b.Ct.St.Value(%d)", c.Ct.St.Value, n["value"]) - } - if c.St.Value != 144 { - t.Fatalf("b not merged in properly: c.St.Value(%d) != b.St.Value(%d)", c.St.Value, o.Value) - } - if c.Nt.Value != 3 { - t.Fatalf("b not merged in properly: c.Nt.Value(%d) != b.Nt.Value(%d)", c.St.Value, p.Value) - } - if c.Ct.sz == 1 { - t.Fatalf("a's private field sz not preserved from merge: c.Ct.sz(%d) == b.Ct.sz(%d)", c.Ct.sz, m["sz"]) - } - if c.Ct.Id == m["id"] { - t.Fatalf("a's field Id merged unexpectedly: c.Ct.Id(%s) == b.Ct.Id(%s)", c.Ct.Id, m["id"]) - } -} - -func TestSimpleMap(t *testing.T) { - a := simpleTest{} - b := map[string]interface{}{ - "value": 42, - } - if err := Map(&a, b); err != nil { - t.FailNow() - } - if a.Value != 42 { - t.Fatalf("b not merged in properly: a.Value(%d) != b.Value(%v)", a.Value, b["value"]) - } -} - -type pointerMapTest struct { - A int - hidden int - B *simpleTest -} - -func TestBackAndForth(t *testing.T) { - pt := pointerMapTest{42, 1, &simpleTest{66}} - m := make(map[string]interface{}) - if err := Map(&m, pt); err != nil { - t.FailNow() - } - var ( - v interface{} - ok bool - ) - if v, ok = m["a"]; v.(int) != pt.A || !ok { - t.Fatalf("pt not merged in properly: m[`a`](%d) != pt.A(%d)", v, pt.A) - } - if v, ok = m["b"]; !ok { - t.Fatalf("pt not merged in properly: B is missing in m") - } - var st *simpleTest - if st = v.(*simpleTest); st.Value != 66 { - t.Fatalf("something went wrong while mapping pt on m, B wasn't copied") - } - bpt := pointerMapTest{} - if err := Map(&bpt, m); err != nil { - t.Fatal(err) - } - if bpt.A != pt.A { - t.Fatalf("pt not merged in properly: bpt.A(%d) != pt.A(%d)", bpt.A, pt.A) - } - if bpt.hidden == pt.hidden { - t.Fatalf("pt unexpectedly merged: bpt.hidden(%d) == pt.hidden(%d)", bpt.hidden, pt.hidden) - } - if bpt.B.Value != pt.B.Value { - t.Fatalf("pt not merged in properly: bpt.B.Value(%d) != pt.B.Value(%d)", bpt.B.Value, pt.B.Value) - } -} - -type structWithTimePointer struct { - Birth *time.Time -} - -func TestTime(t *testing.T) { - now := time.Now() - dataStruct := structWithTimePointer{ - Birth: &now, - } - dataMap := map[string]interface{}{ - "Birth": &now, - } - b := structWithTimePointer{} - if err := Merge(&b, dataStruct); err != nil { - t.FailNow() - } - if b.Birth.IsZero() { - t.Fatalf("time.Time not merged in properly: b.Birth(%v) != dataStruct['Birth'](%v)", b.Birth, dataStruct.Birth) - } - if b.Birth != dataStruct.Birth { - t.Fatalf("time.Time not merged in properly: b.Birth(%v) != dataStruct['Birth'](%v)", b.Birth, dataStruct.Birth) - } - b = structWithTimePointer{} - if err := Map(&b, dataMap); err != nil { - t.FailNow() - } - if b.Birth.IsZero() { - t.Fatalf("time.Time not merged in properly: b.Birth(%v) != dataMap['Birth'](%v)", b.Birth, dataMap["Birth"]) - } -} - -type simpleNested struct { - A int -} - -type structWithNestedPtrValueMap struct { - NestedPtrValue map[string]*simpleNested -} - -func TestNestedPtrValueInMap(t *testing.T) { - src := &structWithNestedPtrValueMap{ - NestedPtrValue: map[string]*simpleNested{ - "x": &simpleNested{ - A: 1, - }, - }, - } - dst := &structWithNestedPtrValueMap{ - NestedPtrValue: map[string]*simpleNested{ - "x": &simpleNested{ - }, - }, - } - if err := Map(dst, src); err != nil { - t.FailNow() - } - if dst.NestedPtrValue["x"].A == 0 { - t.Fatalf("Nested Ptr value not merged in properly: dst.NestedPtrValue[\"x\"].A(%v) != src.NestedPtrValue[\"x\"].A(%v)", dst.NestedPtrValue["x"].A, src.NestedPtrValue["x"].A) - } -} - -func loadYAML(path string) (m map[string]interface{}) { - m = make(map[string]interface{}) - raw, _ := ioutil.ReadFile(path) - _ = yaml.Unmarshal(raw, &m) - return -} diff --git a/vendor/github.com/imdario/mergo/testdata/license.yml b/vendor/github.com/imdario/mergo/testdata/license.yml deleted file mode 100644 index 62fdb61ec3..0000000000 --- a/vendor/github.com/imdario/mergo/testdata/license.yml +++ /dev/null @@ -1,3 +0,0 @@ -import: ../../../../fossene/db/schema/thing.yml -fields: - site: string diff --git a/vendor/github.com/imdario/mergo/testdata/thing.yml b/vendor/github.com/imdario/mergo/testdata/thing.yml deleted file mode 100644 index c28eab0d05..0000000000 --- a/vendor/github.com/imdario/mergo/testdata/thing.yml +++ /dev/null @@ -1,5 +0,0 @@ -fields: - id: int - name: string - parent: ref "datu:thing" - status: enum(draft, public, private) diff --git a/vendor/github.com/jmespath/go-jmespath/api_test.go b/vendor/github.com/jmespath/go-jmespath/api_test.go deleted file mode 100644 index b0b106d3d7..0000000000 --- a/vendor/github.com/jmespath/go-jmespath/api_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package jmespath - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestValidPrecompiledExpressionSearches(t *testing.T) { - assert := assert.New(t) - data := make(map[string]interface{}) - data["foo"] = "bar" - precompiled, err := Compile("foo") - assert.Nil(err) - result, err := precompiled.Search(data) - assert.Nil(err) - assert.Equal("bar", result) -} - -func TestInvalidPrecompileErrors(t *testing.T) { - assert := assert.New(t) - _, err := Compile("not a valid expression") - assert.NotNil(err) -} - -func TestInvalidMustCompilePanics(t *testing.T) { - defer func() { - r := recover() - assert.NotNil(t, r) - }() - MustCompile("not a valid expression") -} diff --git a/vendor/github.com/jmespath/go-jmespath/compliance_test.go b/vendor/github.com/jmespath/go-jmespath/compliance_test.go deleted file mode 100644 index 4ee9c959dc..0000000000 --- a/vendor/github.com/jmespath/go-jmespath/compliance_test.go +++ /dev/null @@ -1,123 +0,0 @@ -package jmespath - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "os" - "path/filepath" - "testing" - - "github.com/stretchr/testify/assert" -) - -type TestSuite struct { - Given interface{} - TestCases []TestCase `json:"cases"` - Comment string -} -type TestCase struct { - Comment string - Expression string - Result interface{} - Error string -} - -var whiteListed = []string{ - "compliance/basic.json", - "compliance/current.json", - "compliance/escape.json", - "compliance/filters.json", - "compliance/functions.json", - "compliance/identifiers.json", - "compliance/indices.json", - "compliance/literal.json", - "compliance/multiselect.json", - "compliance/ormatch.json", - "compliance/pipe.json", - "compliance/slice.json", - "compliance/syntax.json", - "compliance/unicode.json", - "compliance/wildcard.json", - "compliance/boolean.json", -} - -func allowed(path string) bool { - for _, el := range whiteListed { - if el == path { - return true - } - } - return false -} - -func TestCompliance(t *testing.T) { - assert := assert.New(t) - - var complianceFiles []string - err := filepath.Walk("compliance", func(path string, _ os.FileInfo, _ error) error { - //if strings.HasSuffix(path, ".json") { - if allowed(path) { - complianceFiles = append(complianceFiles, path) - } - return nil - }) - if assert.Nil(err) { - for _, filename := range complianceFiles { - runComplianceTest(assert, filename) - } - } -} - -func runComplianceTest(assert *assert.Assertions, filename string) { - var testSuites []TestSuite - data, err := ioutil.ReadFile(filename) - if assert.Nil(err) { - err := json.Unmarshal(data, &testSuites) - if assert.Nil(err) { - for _, testsuite := range testSuites { - runTestSuite(assert, testsuite, filename) - } - } - } -} - -func runTestSuite(assert *assert.Assertions, testsuite TestSuite, filename string) { - for _, testcase := range testsuite.TestCases { - if testcase.Error != "" { - // This is a test case that verifies we error out properly. - runSyntaxTestCase(assert, testsuite.Given, testcase, filename) - } else { - runTestCase(assert, testsuite.Given, testcase, filename) - } - } -} - -func runSyntaxTestCase(assert *assert.Assertions, given interface{}, testcase TestCase, filename string) { - // Anything with an .Error means that we expect that JMESPath should return - // an error when we try to evaluate the expression. - _, err := Search(testcase.Expression, given) - assert.NotNil(err, fmt.Sprintf("Expression: %s", testcase.Expression)) -} - -func runTestCase(assert *assert.Assertions, given interface{}, testcase TestCase, filename string) { - lexer := NewLexer() - var err error - _, err = lexer.tokenize(testcase.Expression) - if err != nil { - errMsg := fmt.Sprintf("(%s) Could not lex expression: %s -- %s", filename, testcase.Expression, err.Error()) - assert.Fail(errMsg) - return - } - parser := NewParser() - _, err = parser.Parse(testcase.Expression) - if err != nil { - errMsg := fmt.Sprintf("(%s) Could not parse expression: %s -- %s", filename, testcase.Expression, err.Error()) - assert.Fail(errMsg) - return - } - actual, err := Search(testcase.Expression, given) - if assert.Nil(err, fmt.Sprintf("Expression: %s", testcase.Expression)) { - assert.Equal(testcase.Result, actual, fmt.Sprintf("Expression: %s", testcase.Expression)) - } -} diff --git a/vendor/github.com/jmespath/go-jmespath/interpreter_test.go b/vendor/github.com/jmespath/go-jmespath/interpreter_test.go deleted file mode 100644 index 5b529c4f31..0000000000 --- a/vendor/github.com/jmespath/go-jmespath/interpreter_test.go +++ /dev/null @@ -1,213 +0,0 @@ -package jmespath - -import ( - "encoding/json" - "testing" - - "github.com/stretchr/testify/assert" -) - -type scalars struct { - Foo string - Bar string -} - -type sliceType struct { - A string - B []scalars - C []*scalars -} - -type benchmarkStruct struct { - Fooasdfasdfasdfasdf string -} - -type benchmarkNested struct { - Fooasdfasdfasdfasdf nestedA -} - -type nestedA struct { - Fooasdfasdfasdfasdf nestedB -} - -type nestedB struct { - Fooasdfasdfasdfasdf nestedC -} - -type nestedC struct { - Fooasdfasdfasdfasdf string -} - -type nestedSlice struct { - A []sliceType -} - -func TestCanSupportEmptyInterface(t *testing.T) { - assert := assert.New(t) - data := make(map[string]interface{}) - data["foo"] = "bar" - result, err := Search("foo", data) - assert.Nil(err) - assert.Equal("bar", result) -} - -func TestCanSupportUserDefinedStructsValue(t *testing.T) { - assert := assert.New(t) - s := scalars{Foo: "one", Bar: "bar"} - result, err := Search("Foo", s) - assert.Nil(err) - assert.Equal("one", result) -} - -func TestCanSupportUserDefinedStructsRef(t *testing.T) { - assert := assert.New(t) - s := scalars{Foo: "one", Bar: "bar"} - result, err := Search("Foo", &s) - assert.Nil(err) - assert.Equal("one", result) -} - -func TestCanSupportStructWithSliceAll(t *testing.T) { - assert := assert.New(t) - data := sliceType{A: "foo", B: []scalars{scalars{"f1", "b1"}, scalars{"correct", "b2"}}} - result, err := Search("B[].Foo", data) - assert.Nil(err) - assert.Equal([]interface{}{"f1", "correct"}, result) -} - -func TestCanSupportStructWithSlicingExpression(t *testing.T) { - assert := assert.New(t) - data := sliceType{A: "foo", B: []scalars{scalars{"f1", "b1"}, scalars{"correct", "b2"}}} - result, err := Search("B[:].Foo", data) - assert.Nil(err) - assert.Equal([]interface{}{"f1", "correct"}, result) -} - -func TestCanSupportStructWithFilterProjection(t *testing.T) { - assert := assert.New(t) - data := sliceType{A: "foo", B: []scalars{scalars{"f1", "b1"}, scalars{"correct", "b2"}}} - result, err := Search("B[? `true` ].Foo", data) - assert.Nil(err) - assert.Equal([]interface{}{"f1", "correct"}, result) -} - -func TestCanSupportStructWithSlice(t *testing.T) { - assert := assert.New(t) - data := sliceType{A: "foo", B: []scalars{scalars{"f1", "b1"}, scalars{"correct", "b2"}}} - result, err := Search("B[-1].Foo", data) - assert.Nil(err) - assert.Equal("correct", result) -} - -func TestCanSupportStructWithOrExpressions(t *testing.T) { - assert := assert.New(t) - data := sliceType{A: "foo", C: nil} - result, err := Search("C || A", data) - assert.Nil(err) - assert.Equal("foo", result) -} - -func TestCanSupportStructWithSlicePointer(t *testing.T) { - assert := assert.New(t) - data := sliceType{A: "foo", C: []*scalars{&scalars{"f1", "b1"}, &scalars{"correct", "b2"}}} - result, err := Search("C[-1].Foo", data) - assert.Nil(err) - assert.Equal("correct", result) -} - -func TestWillAutomaticallyCapitalizeFieldNames(t *testing.T) { - assert := assert.New(t) - s := scalars{Foo: "one", Bar: "bar"} - // Note that there's a lower cased "foo" instead of "Foo", - // but it should still correspond to the Foo field in the - // scalars struct - result, err := Search("foo", &s) - assert.Nil(err) - assert.Equal("one", result) -} - -func TestCanSupportStructWithSliceLowerCased(t *testing.T) { - assert := assert.New(t) - data := sliceType{A: "foo", B: []scalars{scalars{"f1", "b1"}, scalars{"correct", "b2"}}} - result, err := Search("b[-1].foo", data) - assert.Nil(err) - assert.Equal("correct", result) -} - -func TestCanSupportStructWithNestedPointers(t *testing.T) { - assert := assert.New(t) - data := struct{ A *struct{ B int } }{} - result, err := Search("A.B", data) - assert.Nil(err) - assert.Nil(result) -} - -func TestCanSupportFlattenNestedSlice(t *testing.T) { - assert := assert.New(t) - data := nestedSlice{A: []sliceType{ - {B: []scalars{{Foo: "f1a"}, {Foo: "f1b"}}}, - {B: []scalars{{Foo: "f2a"}, {Foo: "f2b"}}}, - }} - result, err := Search("A[].B[].Foo", data) - assert.Nil(err) - assert.Equal([]interface{}{"f1a", "f1b", "f2a", "f2b"}, result) -} - -func TestCanSupportFlattenNestedEmptySlice(t *testing.T) { - assert := assert.New(t) - data := nestedSlice{A: []sliceType{ - {}, {B: []scalars{{Foo: "a"}}}, - }} - result, err := Search("A[].B[].Foo", data) - assert.Nil(err) - assert.Equal([]interface{}{"a"}, result) -} - -func TestCanSupportProjectionsWithStructs(t *testing.T) { - assert := assert.New(t) - data := nestedSlice{A: []sliceType{ - {A: "first"}, {A: "second"}, {A: "third"}, - }} - result, err := Search("A[*].A", data) - assert.Nil(err) - assert.Equal([]interface{}{"first", "second", "third"}, result) -} - -func BenchmarkInterpretSingleFieldStruct(b *testing.B) { - intr := newInterpreter() - parser := NewParser() - ast, _ := parser.Parse("fooasdfasdfasdfasdf") - data := benchmarkStruct{"foobarbazqux"} - for i := 0; i < b.N; i++ { - intr.Execute(ast, &data) - } -} - -func BenchmarkInterpretNestedStruct(b *testing.B) { - intr := newInterpreter() - parser := NewParser() - ast, _ := parser.Parse("fooasdfasdfasdfasdf.fooasdfasdfasdfasdf.fooasdfasdfasdfasdf.fooasdfasdfasdfasdf") - data := benchmarkNested{ - nestedA{ - nestedB{ - nestedC{"foobarbazqux"}, - }, - }, - } - for i := 0; i < b.N; i++ { - intr.Execute(ast, &data) - } -} - -func BenchmarkInterpretNestedMaps(b *testing.B) { - jsonData := []byte(`{"fooasdfasdfasdfasdf": {"fooasdfasdfasdfasdf": {"fooasdfasdfasdfasdf": {"fooasdfasdfasdfasdf": "foobarbazqux"}}}}`) - var data interface{} - json.Unmarshal(jsonData, &data) - - intr := newInterpreter() - parser := NewParser() - ast, _ := parser.Parse("fooasdfasdfasdfasdf.fooasdfasdfasdfasdf.fooasdfasdfasdfasdf.fooasdfasdfasdfasdf") - for i := 0; i < b.N; i++ { - intr.Execute(ast, data) - } -} diff --git a/vendor/github.com/jmespath/go-jmespath/lexer_test.go b/vendor/github.com/jmespath/go-jmespath/lexer_test.go deleted file mode 100644 index 7a9a9ee24b..0000000000 --- a/vendor/github.com/jmespath/go-jmespath/lexer_test.go +++ /dev/null @@ -1,161 +0,0 @@ -package jmespath - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/assert" -) - -var lexingTests = []struct { - expression string - expected []token -}{ - {"*", []token{token{tStar, "*", 0, 1}}}, - {".", []token{token{tDot, ".", 0, 1}}}, - {"[?", []token{token{tFilter, "[?", 0, 2}}}, - {"[]", []token{token{tFlatten, "[]", 0, 2}}}, - {"(", []token{token{tLparen, "(", 0, 1}}}, - {")", []token{token{tRparen, ")", 0, 1}}}, - {"[", []token{token{tLbracket, "[", 0, 1}}}, - {"]", []token{token{tRbracket, "]", 0, 1}}}, - {"{", []token{token{tLbrace, "{", 0, 1}}}, - {"}", []token{token{tRbrace, "}", 0, 1}}}, - {"||", []token{token{tOr, "||", 0, 2}}}, - {"|", []token{token{tPipe, "|", 0, 1}}}, - {"29", []token{token{tNumber, "29", 0, 2}}}, - {"2", []token{token{tNumber, "2", 0, 1}}}, - {"0", []token{token{tNumber, "0", 0, 1}}}, - {"-20", []token{token{tNumber, "-20", 0, 3}}}, - {"foo", []token{token{tUnquotedIdentifier, "foo", 0, 3}}}, - {`"bar"`, []token{token{tQuotedIdentifier, "bar", 0, 3}}}, - // Escaping the delimiter - {`"bar\"baz"`, []token{token{tQuotedIdentifier, `bar"baz`, 0, 7}}}, - {",", []token{token{tComma, ",", 0, 1}}}, - {":", []token{token{tColon, ":", 0, 1}}}, - {"<", []token{token{tLT, "<", 0, 1}}}, - {"<=", []token{token{tLTE, "<=", 0, 2}}}, - {">", []token{token{tGT, ">", 0, 1}}}, - {">=", []token{token{tGTE, ">=", 0, 2}}}, - {"==", []token{token{tEQ, "==", 0, 2}}}, - {"!=", []token{token{tNE, "!=", 0, 2}}}, - {"`[0, 1, 2]`", []token{token{tJSONLiteral, "[0, 1, 2]", 1, 9}}}, - {"'foo'", []token{token{tStringLiteral, "foo", 1, 3}}}, - {"'a'", []token{token{tStringLiteral, "a", 1, 1}}}, - {`'foo\'bar'`, []token{token{tStringLiteral, "foo'bar", 1, 7}}}, - {"@", []token{token{tCurrent, "@", 0, 1}}}, - {"&", []token{token{tExpref, "&", 0, 1}}}, - // Quoted identifier unicode escape sequences - {`"\u2713"`, []token{token{tQuotedIdentifier, "✓", 0, 3}}}, - {`"\\"`, []token{token{tQuotedIdentifier, `\`, 0, 1}}}, - {"`\"foo\"`", []token{token{tJSONLiteral, "\"foo\"", 1, 5}}}, - // Combinations of tokens. - {"foo.bar", []token{ - token{tUnquotedIdentifier, "foo", 0, 3}, - token{tDot, ".", 3, 1}, - token{tUnquotedIdentifier, "bar", 4, 3}, - }}, - {"foo[0]", []token{ - token{tUnquotedIdentifier, "foo", 0, 3}, - token{tLbracket, "[", 3, 1}, - token{tNumber, "0", 4, 1}, - token{tRbracket, "]", 5, 1}, - }}, - {"foo[?a= len(r.content) { - r.pos = r.prefixLen - } - return -} - -func (r *circularConn) Write(b []byte) (n int, err error) { return len(b), nil } - -func (r *circularConn) Close() error { return nil } - -func fakeConn(content string, prefixLen int) *conn { - c := &circularConn{content: content, prefixLen: prefixLen} - return &conn{buf: bufio.NewReader(c), c: c} -} - -// This benchmark is meant to be the same as BenchmarkSelectString, but takes -// out some of the factors this package can't control. The numbers are less noisy, -// but also the costs of network communication aren't accurately represented. -func BenchmarkMockSelectString(b *testing.B) { - b.StopTimer() - // taken from a recorded run of BenchmarkSelectString - // See: http://www.postgresql.org/docs/current/static/protocol-message-formats.html - const response = "1\x00\x00\x00\x04" + - "t\x00\x00\x00\x06\x00\x00" + - "T\x00\x00\x00!\x00\x01?column?\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xc1\xff\xfe\xff\xff\xff\xff\x00\x00" + - "Z\x00\x00\x00\x05I" + - "2\x00\x00\x00\x04" + - "D\x00\x00\x00n\x00\x01\x00\x00\x00d0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" + - "C\x00\x00\x00\rSELECT 1\x00" + - "Z\x00\x00\x00\x05I" + - "3\x00\x00\x00\x04" + - "Z\x00\x00\x00\x05I" - c := fakeConn(response, 0) - b.StartTimer() - - for i := 0; i < b.N; i++ { - benchMockQuery(b, c, selectStringQuery) - } -} - -var seriesRowData = func() string { - var buf bytes.Buffer - for i := 1; i <= 100; i++ { - digits := byte(2) - if i >= 100 { - digits = 3 - } else if i < 10 { - digits = 1 - } - buf.WriteString("D\x00\x00\x00") - buf.WriteByte(10 + digits) - buf.WriteString("\x00\x01\x00\x00\x00") - buf.WriteByte(digits) - buf.WriteString(strconv.Itoa(i)) - } - return buf.String() -}() - -func BenchmarkMockSelectSeries(b *testing.B) { - b.StopTimer() - var response = "1\x00\x00\x00\x04" + - "t\x00\x00\x00\x06\x00\x00" + - "T\x00\x00\x00!\x00\x01?column?\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xc1\xff\xfe\xff\xff\xff\xff\x00\x00" + - "Z\x00\x00\x00\x05I" + - "2\x00\x00\x00\x04" + - seriesRowData + - "C\x00\x00\x00\x0fSELECT 100\x00" + - "Z\x00\x00\x00\x05I" + - "3\x00\x00\x00\x04" + - "Z\x00\x00\x00\x05I" - c := fakeConn(response, 0) - b.StartTimer() - - for i := 0; i < b.N; i++ { - benchMockQuery(b, c, selectSeriesQuery) - } -} - -func benchMockQuery(b *testing.B, c *conn, query string) { - stmt, err := c.Prepare(query) - if err != nil { - b.Fatal(err) - } - defer stmt.Close() - rows, err := stmt.Query(nil) - if err != nil { - b.Fatal(err) - } - defer rows.Close() - var dest [1]driver.Value - for { - if err := rows.Next(dest[:]); err != nil { - if err == io.EOF { - break - } - b.Fatal(err) - } - } -} - -func BenchmarkPreparedSelectString(b *testing.B) { - var result string - benchPreparedQuery(b, selectStringQuery, &result) -} - -func BenchmarkPreparedSelectSeries(b *testing.B) { - var result int - benchPreparedQuery(b, selectSeriesQuery, &result) -} - -func benchPreparedQuery(b *testing.B, query string, result interface{}) { - b.StopTimer() - db := openTestConn(b) - defer db.Close() - stmt, err := db.Prepare(query) - if err != nil { - b.Fatal(err) - } - defer stmt.Close() - b.StartTimer() - - for i := 0; i < b.N; i++ { - benchPreparedQueryLoop(b, db, stmt, result) - } -} - -func benchPreparedQueryLoop(b *testing.B, db *sql.DB, stmt *sql.Stmt, result interface{}) { - rows, err := stmt.Query() - if err != nil { - b.Fatal(err) - } - if !rows.Next() { - rows.Close() - b.Fatal("no rows") - } - defer rows.Close() - for rows.Next() { - err = rows.Scan(&result) - if err != nil { - b.Fatal("failed to scan") - } - } -} - -// See the comment for BenchmarkMockSelectString. -func BenchmarkMockPreparedSelectString(b *testing.B) { - b.StopTimer() - const parseResponse = "1\x00\x00\x00\x04" + - "t\x00\x00\x00\x06\x00\x00" + - "T\x00\x00\x00!\x00\x01?column?\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xc1\xff\xfe\xff\xff\xff\xff\x00\x00" + - "Z\x00\x00\x00\x05I" - const responses = parseResponse + - "2\x00\x00\x00\x04" + - "D\x00\x00\x00n\x00\x01\x00\x00\x00d0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" + - "C\x00\x00\x00\rSELECT 1\x00" + - "Z\x00\x00\x00\x05I" - c := fakeConn(responses, len(parseResponse)) - - stmt, err := c.Prepare(selectStringQuery) - if err != nil { - b.Fatal(err) - } - b.StartTimer() - - for i := 0; i < b.N; i++ { - benchPreparedMockQuery(b, c, stmt) - } -} - -func BenchmarkMockPreparedSelectSeries(b *testing.B) { - b.StopTimer() - const parseResponse = "1\x00\x00\x00\x04" + - "t\x00\x00\x00\x06\x00\x00" + - "T\x00\x00\x00!\x00\x01?column?\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xc1\xff\xfe\xff\xff\xff\xff\x00\x00" + - "Z\x00\x00\x00\x05I" - var responses = parseResponse + - "2\x00\x00\x00\x04" + - seriesRowData + - "C\x00\x00\x00\x0fSELECT 100\x00" + - "Z\x00\x00\x00\x05I" - c := fakeConn(responses, len(parseResponse)) - - stmt, err := c.Prepare(selectSeriesQuery) - if err != nil { - b.Fatal(err) - } - b.StartTimer() - - for i := 0; i < b.N; i++ { - benchPreparedMockQuery(b, c, stmt) - } -} - -func benchPreparedMockQuery(b *testing.B, c *conn, stmt driver.Stmt) { - rows, err := stmt.Query(nil) - if err != nil { - b.Fatal(err) - } - defer rows.Close() - var dest [1]driver.Value - for { - if err := rows.Next(dest[:]); err != nil { - if err == io.EOF { - break - } - b.Fatal(err) - } - } -} - -func BenchmarkEncodeInt64(b *testing.B) { - for i := 0; i < b.N; i++ { - encode(¶meterStatus{}, int64(1234), oid.T_int8) - } -} - -func BenchmarkEncodeFloat64(b *testing.B) { - for i := 0; i < b.N; i++ { - encode(¶meterStatus{}, 3.14159, oid.T_float8) - } -} - -var testByteString = []byte("abcdefghijklmnopqrstuvwxyz") - -func BenchmarkEncodeByteaHex(b *testing.B) { - for i := 0; i < b.N; i++ { - encode(¶meterStatus{serverVersion: 90000}, testByteString, oid.T_bytea) - } -} -func BenchmarkEncodeByteaEscape(b *testing.B) { - for i := 0; i < b.N; i++ { - encode(¶meterStatus{serverVersion: 84000}, testByteString, oid.T_bytea) - } -} - -func BenchmarkEncodeBool(b *testing.B) { - for i := 0; i < b.N; i++ { - encode(¶meterStatus{}, true, oid.T_bool) - } -} - -var testTimestamptz = time.Date(2001, time.January, 1, 0, 0, 0, 0, time.Local) - -func BenchmarkEncodeTimestamptz(b *testing.B) { - for i := 0; i < b.N; i++ { - encode(¶meterStatus{}, testTimestamptz, oid.T_timestamptz) - } -} - -var testIntBytes = []byte("1234") - -func BenchmarkDecodeInt64(b *testing.B) { - for i := 0; i < b.N; i++ { - decode(¶meterStatus{}, testIntBytes, oid.T_int8, formatText) - } -} - -var testFloatBytes = []byte("3.14159") - -func BenchmarkDecodeFloat64(b *testing.B) { - for i := 0; i < b.N; i++ { - decode(¶meterStatus{}, testFloatBytes, oid.T_float8, formatText) - } -} - -var testBoolBytes = []byte{'t'} - -func BenchmarkDecodeBool(b *testing.B) { - for i := 0; i < b.N; i++ { - decode(¶meterStatus{}, testBoolBytes, oid.T_bool, formatText) - } -} - -func TestDecodeBool(t *testing.T) { - db := openTestConn(t) - rows, err := db.Query("select true") - if err != nil { - t.Fatal(err) - } - rows.Close() -} - -var testTimestamptzBytes = []byte("2013-09-17 22:15:32.360754-07") - -func BenchmarkDecodeTimestamptz(b *testing.B) { - for i := 0; i < b.N; i++ { - decode(¶meterStatus{}, testTimestamptzBytes, oid.T_timestamptz, formatText) - } -} - -func BenchmarkDecodeTimestamptzMultiThread(b *testing.B) { - oldProcs := runtime.GOMAXPROCS(0) - defer runtime.GOMAXPROCS(oldProcs) - runtime.GOMAXPROCS(runtime.NumCPU()) - globalLocationCache = newLocationCache() - - f := func(wg *sync.WaitGroup, loops int) { - defer wg.Done() - for i := 0; i < loops; i++ { - decode(¶meterStatus{}, testTimestamptzBytes, oid.T_timestamptz, formatText) - } - } - - wg := &sync.WaitGroup{} - b.ResetTimer() - for j := 0; j < 10; j++ { - wg.Add(1) - go f(wg, b.N/10) - } - wg.Wait() -} - -func BenchmarkLocationCache(b *testing.B) { - globalLocationCache = newLocationCache() - for i := 0; i < b.N; i++ { - globalLocationCache.getLocation(rand.Intn(10000)) - } -} - -func BenchmarkLocationCacheMultiThread(b *testing.B) { - oldProcs := runtime.GOMAXPROCS(0) - defer runtime.GOMAXPROCS(oldProcs) - runtime.GOMAXPROCS(runtime.NumCPU()) - globalLocationCache = newLocationCache() - - f := func(wg *sync.WaitGroup, loops int) { - defer wg.Done() - for i := 0; i < loops; i++ { - globalLocationCache.getLocation(rand.Intn(10000)) - } - } - - wg := &sync.WaitGroup{} - b.ResetTimer() - for j := 0; j < 10; j++ { - wg.Add(1) - go f(wg, b.N/10) - } - wg.Wait() -} - -// Stress test the performance of parsing results from the wire. -func BenchmarkResultParsing(b *testing.B) { - b.StopTimer() - - db := openTestConn(b) - defer db.Close() - _, err := db.Exec("BEGIN") - if err != nil { - b.Fatal(err) - } - - b.StartTimer() - for i := 0; i < b.N; i++ { - res, err := db.Query("SELECT generate_series(1, 50000)") - if err != nil { - b.Fatal(err) - } - res.Close() - } -} diff --git a/vendor/github.com/lib/pq/conn_test.go b/vendor/github.com/lib/pq/conn_test.go deleted file mode 100644 index 2639c8efd3..0000000000 --- a/vendor/github.com/lib/pq/conn_test.go +++ /dev/null @@ -1,1433 +0,0 @@ -package pq - -import ( - "database/sql" - "database/sql/driver" - "fmt" - "io" - "os" - "reflect" - "strings" - "testing" - "time" -) - -type Fatalistic interface { - Fatal(args ...interface{}) -} - -func forceBinaryParameters() bool { - bp := os.Getenv("PQTEST_BINARY_PARAMETERS") - if bp == "yes" { - return true - } else if bp == "" || bp == "no" { - return false - } else { - panic("unexpected value for PQTEST_BINARY_PARAMETERS") - } -} - -func openTestConnConninfo(conninfo string) (*sql.DB, error) { - defaultTo := func(envvar string, value string) { - if os.Getenv(envvar) == "" { - os.Setenv(envvar, value) - } - } - defaultTo("PGDATABASE", "pqgotest") - defaultTo("PGSSLMODE", "disable") - defaultTo("PGCONNECT_TIMEOUT", "20") - - if forceBinaryParameters() && - !strings.HasPrefix(conninfo, "postgres://") && - !strings.HasPrefix(conninfo, "postgresql://") { - conninfo = conninfo + " binary_parameters=yes" - } - - return sql.Open("postgres", conninfo) -} - -func openTestConn(t Fatalistic) *sql.DB { - conn, err := openTestConnConninfo("") - if err != nil { - t.Fatal(err) - } - - return conn -} - -func getServerVersion(t *testing.T, db *sql.DB) int { - var version int - err := db.QueryRow("SHOW server_version_num").Scan(&version) - if err != nil { - t.Fatal(err) - } - return version -} - -func TestReconnect(t *testing.T) { - db1 := openTestConn(t) - defer db1.Close() - tx, err := db1.Begin() - if err != nil { - t.Fatal(err) - } - var pid1 int - err = tx.QueryRow("SELECT pg_backend_pid()").Scan(&pid1) - if err != nil { - t.Fatal(err) - } - db2 := openTestConn(t) - defer db2.Close() - _, err = db2.Exec("SELECT pg_terminate_backend($1)", pid1) - if err != nil { - t.Fatal(err) - } - // The rollback will probably "fail" because we just killed - // its connection above - _ = tx.Rollback() - - const expected int = 42 - var result int - err = db1.QueryRow(fmt.Sprintf("SELECT %d", expected)).Scan(&result) - if err != nil { - t.Fatal(err) - } - if result != expected { - t.Errorf("got %v; expected %v", result, expected) - } -} - -func TestCommitInFailedTransaction(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - txn, err := db.Begin() - if err != nil { - t.Fatal(err) - } - rows, err := txn.Query("SELECT error") - if err == nil { - rows.Close() - t.Fatal("expected failure") - } - err = txn.Commit() - if err != ErrInFailedTransaction { - t.Fatalf("expected ErrInFailedTransaction; got %#v", err) - } -} - -func TestOpenURL(t *testing.T) { - testURL := func(url string) { - db, err := openTestConnConninfo(url) - if err != nil { - t.Fatal(err) - } - defer db.Close() - // database/sql might not call our Open at all unless we do something with - // the connection - txn, err := db.Begin() - if err != nil { - t.Fatal(err) - } - txn.Rollback() - } - testURL("postgres://") - testURL("postgresql://") -} - -const pgpass_file = "/tmp/pqgotest_pgpass" -func TestPgpass(t *testing.T) { - testAssert := func(conninfo string, expected string, reason string) { - conn, err := openTestConnConninfo(conninfo) - if err != nil { - t.Fatal(err) - } - defer conn.Close() - - txn, err := conn.Begin() - if err != nil { - if expected != "fail" { - t.Fatalf(reason, err) - } - return - } - rows, err := txn.Query("SELECT USER") - if err != nil { - txn.Rollback() - rows.Close() - if expected != "fail" { - t.Fatalf(reason, err) - } - } else { - if expected != "ok" { - t.Fatalf(reason, err) - } - } - txn.Rollback() - } - testAssert("", "ok", "missing .pgpass, unexpected error %#v") - os.Setenv("PGPASSFILE", pgpass_file) - testAssert("host=/tmp", "fail", ", unexpected error %#v") - os.Remove(pgpass_file) - pgpass, err := os.OpenFile(pgpass_file, os.O_RDWR|os.O_CREATE, 0644) - if err != nil { - t.Fatalf("Unexpected error writing pgpass file %#v", err) - } - _, err = pgpass.WriteString(`# comment -server:5432:some_db:some_user:pass_A -*:5432:some_db:some_user:pass_B -localhost:*:*:*:pass_C -*:*:*:*:pass_fallback -`) - if err != nil { - t.Fatalf("Unexpected error writing pgpass file %#v", err) - } - pgpass.Close() - - assertPassword := func(extra values, expected string) { - o := &values{"host": "localhost", "sslmode": "disable", "connect_timeout": "20", "user": "majid", "port": "5432", "extra_float_digits": "2", "dbname": "pqgotest", "client_encoding": "UTF8", "datestyle": "ISO, MDY"} - for k, v := range extra { - (*o)[k] = v - } - (&conn{}).handlePgpass(*o) - if o.Get("password") != expected { - t.Fatalf("For %v expected %s got %s", extra, expected, o.Get("password")) - } - } - // wrong permissions for the pgpass file means it should be ignored - assertPassword(values{"host": "example.com", "user": "foo"}, "") - // fix the permissions and check if it has taken effect - os.Chmod(pgpass_file, 0600) - assertPassword(values{"host": "server", "dbname": "some_db", "user": "some_user"}, "pass_A") - assertPassword(values{"host": "example.com", "user": "foo"}, "pass_fallback") - assertPassword(values{"host": "example.com", "dbname": "some_db", "user": "some_user"}, "pass_B") - // localhost also matches the default "" and UNIX sockets - assertPassword(values{"host": "", "user": "some_user"}, "pass_C") - assertPassword(values{"host": "/tmp", "user": "some_user"}, "pass_C") - // cleanup - os.Remove(pgpass_file) - os.Setenv("PGPASSFILE", "") -} - -func TestExec(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - _, err := db.Exec("CREATE TEMP TABLE temp (a int)") - if err != nil { - t.Fatal(err) - } - - r, err := db.Exec("INSERT INTO temp VALUES (1)") - if err != nil { - t.Fatal(err) - } - - if n, _ := r.RowsAffected(); n != 1 { - t.Fatalf("expected 1 row affected, not %d", n) - } - - r, err = db.Exec("INSERT INTO temp VALUES ($1), ($2), ($3)", 1, 2, 3) - if err != nil { - t.Fatal(err) - } - - if n, _ := r.RowsAffected(); n != 3 { - t.Fatalf("expected 3 rows affected, not %d", n) - } - - // SELECT doesn't send the number of returned rows in the command tag - // before 9.0 - if getServerVersion(t, db) >= 90000 { - r, err = db.Exec("SELECT g FROM generate_series(1, 2) g") - if err != nil { - t.Fatal(err) - } - if n, _ := r.RowsAffected(); n != 2 { - t.Fatalf("expected 2 rows affected, not %d", n) - } - - r, err = db.Exec("SELECT g FROM generate_series(1, $1) g", 3) - if err != nil { - t.Fatal(err) - } - if n, _ := r.RowsAffected(); n != 3 { - t.Fatalf("expected 3 rows affected, not %d", n) - } - } -} - -func TestStatment(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - st, err := db.Prepare("SELECT 1") - if err != nil { - t.Fatal(err) - } - - st1, err := db.Prepare("SELECT 2") - if err != nil { - t.Fatal(err) - } - - r, err := st.Query() - if err != nil { - t.Fatal(err) - } - defer r.Close() - - if !r.Next() { - t.Fatal("expected row") - } - - var i int - err = r.Scan(&i) - if err != nil { - t.Fatal(err) - } - - if i != 1 { - t.Fatalf("expected 1, got %d", i) - } - - // st1 - - r1, err := st1.Query() - if err != nil { - t.Fatal(err) - } - defer r1.Close() - - if !r1.Next() { - if r.Err() != nil { - t.Fatal(r1.Err()) - } - t.Fatal("expected row") - } - - err = r1.Scan(&i) - if err != nil { - t.Fatal(err) - } - - if i != 2 { - t.Fatalf("expected 2, got %d", i) - } -} - -func TestRowsCloseBeforeDone(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - r, err := db.Query("SELECT 1") - if err != nil { - t.Fatal(err) - } - - err = r.Close() - if err != nil { - t.Fatal(err) - } - - if r.Next() { - t.Fatal("unexpected row") - } - - if r.Err() != nil { - t.Fatal(r.Err()) - } -} - -func TestParameterCountMismatch(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - var notused int - err := db.QueryRow("SELECT false", 1).Scan(¬used) - if err == nil { - t.Fatal("expected err") - } - // make sure we clean up correctly - err = db.QueryRow("SELECT 1").Scan(¬used) - if err != nil { - t.Fatal(err) - } - - err = db.QueryRow("SELECT $1").Scan(¬used) - if err == nil { - t.Fatal("expected err") - } - // make sure we clean up correctly - err = db.QueryRow("SELECT 1").Scan(¬used) - if err != nil { - t.Fatal(err) - } -} - -// Test that EmptyQueryResponses are handled correctly. -func TestEmptyQuery(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - _, err := db.Exec("") - if err != nil { - t.Fatal(err) - } - rows, err := db.Query("") - if err != nil { - t.Fatal(err) - } - cols, err := rows.Columns() - if err != nil { - t.Fatal(err) - } - if len(cols) != 0 { - t.Fatalf("unexpected number of columns %d in response to an empty query", len(cols)) - } - if rows.Next() { - t.Fatal("unexpected row") - } - if rows.Err() != nil { - t.Fatal(rows.Err()) - } - - stmt, err := db.Prepare("") - if err != nil { - t.Fatal(err) - } - _, err = stmt.Exec() - if err != nil { - t.Fatal(err) - } - rows, err = stmt.Query() - if err != nil { - t.Fatal(err) - } - cols, err = rows.Columns() - if err != nil { - t.Fatal(err) - } - if len(cols) != 0 { - t.Fatalf("unexpected number of columns %d in response to an empty query", len(cols)) - } - if rows.Next() { - t.Fatal("unexpected row") - } - if rows.Err() != nil { - t.Fatal(rows.Err()) - } -} - -// Test that rows.Columns() is correct even if there are no result rows. -func TestEmptyResultSetColumns(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - rows, err := db.Query("SELECT 1 AS a, text 'bar' AS bar WHERE FALSE") - if err != nil { - t.Fatal(err) - } - cols, err := rows.Columns() - if err != nil { - t.Fatal(err) - } - if len(cols) != 2 { - t.Fatalf("unexpected number of columns %d in response to an empty query", len(cols)) - } - if rows.Next() { - t.Fatal("unexpected row") - } - if rows.Err() != nil { - t.Fatal(rows.Err()) - } - if cols[0] != "a" || cols[1] != "bar" { - t.Fatalf("unexpected Columns result %v", cols) - } - - stmt, err := db.Prepare("SELECT $1::int AS a, text 'bar' AS bar WHERE FALSE") - if err != nil { - t.Fatal(err) - } - rows, err = stmt.Query(1) - if err != nil { - t.Fatal(err) - } - cols, err = rows.Columns() - if err != nil { - t.Fatal(err) - } - if len(cols) != 2 { - t.Fatalf("unexpected number of columns %d in response to an empty query", len(cols)) - } - if rows.Next() { - t.Fatal("unexpected row") - } - if rows.Err() != nil { - t.Fatal(rows.Err()) - } - if cols[0] != "a" || cols[1] != "bar" { - t.Fatalf("unexpected Columns result %v", cols) - } - -} - -func TestEncodeDecode(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - q := ` - SELECT - E'\\000\\001\\002'::bytea, - 'foobar'::text, - NULL::integer, - '2000-1-1 01:02:03.04-7'::timestamptz, - 0::boolean, - 123, - -321, - 3.14::float8 - WHERE - E'\\000\\001\\002'::bytea = $1 - AND 'foobar'::text = $2 - AND $3::integer is NULL - ` - // AND '2000-1-1 12:00:00.000000-7'::timestamp = $3 - - exp1 := []byte{0, 1, 2} - exp2 := "foobar" - - r, err := db.Query(q, exp1, exp2, nil) - if err != nil { - t.Fatal(err) - } - defer r.Close() - - if !r.Next() { - if r.Err() != nil { - t.Fatal(r.Err()) - } - t.Fatal("expected row") - } - - var got1 []byte - var got2 string - var got3 = sql.NullInt64{Valid: true} - var got4 time.Time - var got5, got6, got7, got8 interface{} - - err = r.Scan(&got1, &got2, &got3, &got4, &got5, &got6, &got7, &got8) - if err != nil { - t.Fatal(err) - } - - if !reflect.DeepEqual(exp1, got1) { - t.Errorf("expected %q byte: %q", exp1, got1) - } - - if !reflect.DeepEqual(exp2, got2) { - t.Errorf("expected %q byte: %q", exp2, got2) - } - - if got3.Valid { - t.Fatal("expected invalid") - } - - if got4.Year() != 2000 { - t.Fatal("wrong year") - } - - if got5 != false { - t.Fatalf("expected false, got %q", got5) - } - - if got6 != int64(123) { - t.Fatalf("expected 123, got %d", got6) - } - - if got7 != int64(-321) { - t.Fatalf("expected -321, got %d", got7) - } - - if got8 != float64(3.14) { - t.Fatalf("expected 3.14, got %f", got8) - } -} - -func TestNoData(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - st, err := db.Prepare("SELECT 1 WHERE true = false") - if err != nil { - t.Fatal(err) - } - defer st.Close() - - r, err := st.Query() - if err != nil { - t.Fatal(err) - } - defer r.Close() - - if r.Next() { - if r.Err() != nil { - t.Fatal(r.Err()) - } - t.Fatal("unexpected row") - } - - _, err = db.Query("SELECT * FROM nonexistenttable WHERE age=$1", 20) - if err == nil { - t.Fatal("Should have raised an error on non existent table") - } - - _, err = db.Query("SELECT * FROM nonexistenttable") - if err == nil { - t.Fatal("Should have raised an error on non existent table") - } -} - -func TestErrorDuringStartup(t *testing.T) { - // Don't use the normal connection setup, this is intended to - // blow up in the startup packet from a non-existent user. - db, err := openTestConnConninfo("user=thisuserreallydoesntexist") - if err != nil { - t.Fatal(err) - } - defer db.Close() - - _, err = db.Begin() - if err == nil { - t.Fatal("expected error") - } - - e, ok := err.(*Error) - if !ok { - t.Fatalf("expected Error, got %#v", err) - } else if e.Code.Name() != "invalid_authorization_specification" && e.Code.Name() != "invalid_password" { - t.Fatalf("expected invalid_authorization_specification or invalid_password, got %s (%+v)", e.Code.Name(), err) - } -} - -func TestBadConn(t *testing.T) { - var err error - - cn := conn{} - func() { - defer cn.errRecover(&err) - panic(io.EOF) - }() - if err != driver.ErrBadConn { - t.Fatalf("expected driver.ErrBadConn, got: %#v", err) - } - if !cn.bad { - t.Fatalf("expected cn.bad") - } - - cn = conn{} - func() { - defer cn.errRecover(&err) - e := &Error{Severity: Efatal} - panic(e) - }() - if err != driver.ErrBadConn { - t.Fatalf("expected driver.ErrBadConn, got: %#v", err) - } - if !cn.bad { - t.Fatalf("expected cn.bad") - } -} - -func TestErrorOnExec(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - txn, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer txn.Rollback() - - _, err = txn.Exec("CREATE TEMPORARY TABLE foo(f1 int PRIMARY KEY)") - if err != nil { - t.Fatal(err) - } - - _, err = txn.Exec("INSERT INTO foo VALUES (0), (0)") - if err == nil { - t.Fatal("Should have raised error") - } - - e, ok := err.(*Error) - if !ok { - t.Fatalf("expected Error, got %#v", err) - } else if e.Code.Name() != "unique_violation" { - t.Fatalf("expected unique_violation, got %s (%+v)", e.Code.Name(), err) - } -} - -func TestErrorOnQuery(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - txn, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer txn.Rollback() - - _, err = txn.Exec("CREATE TEMPORARY TABLE foo(f1 int PRIMARY KEY)") - if err != nil { - t.Fatal(err) - } - - _, err = txn.Query("INSERT INTO foo VALUES (0), (0)") - if err == nil { - t.Fatal("Should have raised error") - } - - e, ok := err.(*Error) - if !ok { - t.Fatalf("expected Error, got %#v", err) - } else if e.Code.Name() != "unique_violation" { - t.Fatalf("expected unique_violation, got %s (%+v)", e.Code.Name(), err) - } -} - -func TestErrorOnQueryRowSimpleQuery(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - txn, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer txn.Rollback() - - _, err = txn.Exec("CREATE TEMPORARY TABLE foo(f1 int PRIMARY KEY)") - if err != nil { - t.Fatal(err) - } - - var v int - err = txn.QueryRow("INSERT INTO foo VALUES (0), (0)").Scan(&v) - if err == nil { - t.Fatal("Should have raised error") - } - - e, ok := err.(*Error) - if !ok { - t.Fatalf("expected Error, got %#v", err) - } else if e.Code.Name() != "unique_violation" { - t.Fatalf("expected unique_violation, got %s (%+v)", e.Code.Name(), err) - } -} - -// Test the QueryRow bug workarounds in stmt.exec() and simpleQuery() -func TestQueryRowBugWorkaround(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - // stmt.exec() - _, err := db.Exec("CREATE TEMP TABLE notnulltemp (a varchar(10) not null)") - if err != nil { - t.Fatal(err) - } - - var a string - err = db.QueryRow("INSERT INTO notnulltemp(a) values($1) RETURNING a", nil).Scan(&a) - if err == sql.ErrNoRows { - t.Fatalf("expected constraint violation error; got: %v", err) - } - pge, ok := err.(*Error) - if !ok { - t.Fatalf("expected *Error; got: %#v", err) - } - if pge.Code.Name() != "not_null_violation" { - t.Fatalf("expected not_null_violation; got: %s (%+v)", pge.Code.Name(), err) - } - - // Test workaround in simpleQuery() - tx, err := db.Begin() - if err != nil { - t.Fatalf("unexpected error %s in Begin", err) - } - defer tx.Rollback() - - _, err = tx.Exec("SET LOCAL check_function_bodies TO FALSE") - if err != nil { - t.Fatalf("could not disable check_function_bodies: %s", err) - } - _, err = tx.Exec(` -CREATE OR REPLACE FUNCTION bad_function() -RETURNS integer --- hack to prevent the function from being inlined -SET check_function_bodies TO TRUE -AS $$ - SELECT text 'bad' -$$ LANGUAGE sql`) - if err != nil { - t.Fatalf("could not create function: %s", err) - } - - err = tx.QueryRow("SELECT * FROM bad_function()").Scan(&a) - if err == nil { - t.Fatalf("expected error") - } - pge, ok = err.(*Error) - if !ok { - t.Fatalf("expected *Error; got: %#v", err) - } - if pge.Code.Name() != "invalid_function_definition" { - t.Fatalf("expected invalid_function_definition; got: %s (%+v)", pge.Code.Name(), err) - } - - err = tx.Rollback() - if err != nil { - t.Fatalf("unexpected error %s in Rollback", err) - } - - // Also test that simpleQuery()'s workaround works when the query fails - // after a row has been received. - rows, err := db.Query(` -select - (select generate_series(1, ss.i)) -from (select gs.i - from generate_series(1, 2) gs(i) - order by gs.i limit 2) ss`) - if err != nil { - t.Fatalf("query failed: %s", err) - } - if !rows.Next() { - t.Fatalf("expected at least one result row; got %s", rows.Err()) - } - var i int - err = rows.Scan(&i) - if err != nil { - t.Fatalf("rows.Scan() failed: %s", err) - } - if i != 1 { - t.Fatalf("unexpected value for i: %d", i) - } - if rows.Next() { - t.Fatalf("unexpected row") - } - pge, ok = rows.Err().(*Error) - if !ok { - t.Fatalf("expected *Error; got: %#v", err) - } - if pge.Code.Name() != "cardinality_violation" { - t.Fatalf("expected cardinality_violation; got: %s (%+v)", pge.Code.Name(), rows.Err()) - } -} - -func TestSimpleQuery(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - r, err := db.Query("select 1") - if err != nil { - t.Fatal(err) - } - defer r.Close() - - if !r.Next() { - t.Fatal("expected row") - } -} - -func TestBindError(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - _, err := db.Exec("create temp table test (i integer)") - if err != nil { - t.Fatal(err) - } - - _, err = db.Query("select * from test where i=$1", "hhh") - if err == nil { - t.Fatal("expected an error") - } - - // Should not get error here - r, err := db.Query("select * from test where i=$1", 1) - if err != nil { - t.Fatal(err) - } - defer r.Close() -} - -func TestParseErrorInExtendedQuery(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - rows, err := db.Query("PARSE_ERROR $1", 1) - if err == nil { - t.Fatal("expected error") - } - - rows, err = db.Query("SELECT 1") - if err != nil { - t.Fatal(err) - } - rows.Close() -} - -// TestReturning tests that an INSERT query using the RETURNING clause returns a row. -func TestReturning(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - _, err := db.Exec("CREATE TEMP TABLE distributors (did integer default 0, dname text)") - if err != nil { - t.Fatal(err) - } - - rows, err := db.Query("INSERT INTO distributors (did, dname) VALUES (DEFAULT, 'XYZ Widgets') " + - "RETURNING did;") - if err != nil { - t.Fatal(err) - } - if !rows.Next() { - t.Fatal("no rows") - } - var did int - err = rows.Scan(&did) - if err != nil { - t.Fatal(err) - } - if did != 0 { - t.Fatalf("bad value for did: got %d, want %d", did, 0) - } - - if rows.Next() { - t.Fatal("unexpected next row") - } - err = rows.Err() - if err != nil { - t.Fatal(err) - } -} - -func TestIssue186(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - // Exec() a query which returns results - _, err := db.Exec("VALUES (1), (2), (3)") - if err != nil { - t.Fatal(err) - } - - _, err = db.Exec("VALUES ($1), ($2), ($3)", 1, 2, 3) - if err != nil { - t.Fatal(err) - } - - // Query() a query which doesn't return any results - txn, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer txn.Rollback() - - rows, err := txn.Query("CREATE TEMP TABLE foo(f1 int)") - if err != nil { - t.Fatal(err) - } - if err = rows.Close(); err != nil { - t.Fatal(err) - } - - // small trick to get NoData from a parameterized query - _, err = txn.Exec("CREATE RULE nodata AS ON INSERT TO foo DO INSTEAD NOTHING") - if err != nil { - t.Fatal(err) - } - rows, err = txn.Query("INSERT INTO foo VALUES ($1)", 1) - if err != nil { - t.Fatal(err) - } - if err = rows.Close(); err != nil { - t.Fatal(err) - } -} - -func TestIssue196(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - row := db.QueryRow("SELECT float4 '0.10000122' = $1, float8 '35.03554004971999' = $2", - float32(0.10000122), float64(35.03554004971999)) - - var float4match, float8match bool - err := row.Scan(&float4match, &float8match) - if err != nil { - t.Fatal(err) - } - if !float4match { - t.Errorf("Expected float4 fidelity to be maintained; got no match") - } - if !float8match { - t.Errorf("Expected float8 fidelity to be maintained; got no match") - } -} - -// Test that any CommandComplete messages sent before the query results are -// ignored. -func TestIssue282(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - var search_path string - err := db.QueryRow(` - SET LOCAL search_path TO pg_catalog; - SET LOCAL search_path TO pg_catalog; - SHOW search_path`).Scan(&search_path) - if err != nil { - t.Fatal(err) - } - if search_path != "pg_catalog" { - t.Fatalf("unexpected search_path %s", search_path) - } -} - -func TestReadFloatPrecision(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - row := db.QueryRow("SELECT float4 '0.10000122', float8 '35.03554004971999'") - var float4val float32 - var float8val float64 - err := row.Scan(&float4val, &float8val) - if err != nil { - t.Fatal(err) - } - if float4val != float32(0.10000122) { - t.Errorf("Expected float4 fidelity to be maintained; got no match") - } - if float8val != float64(35.03554004971999) { - t.Errorf("Expected float8 fidelity to be maintained; got no match") - } -} - -func TestXactMultiStmt(t *testing.T) { - // minified test case based on bug reports from - // pico303@gmail.com and rangelspam@gmail.com - t.Skip("Skipping failing test") - db := openTestConn(t) - defer db.Close() - - tx, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer tx.Commit() - - rows, err := tx.Query("select 1") - if err != nil { - t.Fatal(err) - } - - if rows.Next() { - var val int32 - if err = rows.Scan(&val); err != nil { - t.Fatal(err) - } - } else { - t.Fatal("Expected at least one row in first query in xact") - } - - rows2, err := tx.Query("select 2") - if err != nil { - t.Fatal(err) - } - - if rows2.Next() { - var val2 int32 - if err := rows2.Scan(&val2); err != nil { - t.Fatal(err) - } - } else { - t.Fatal("Expected at least one row in second query in xact") - } - - if err = rows.Err(); err != nil { - t.Fatal(err) - } - - if err = rows2.Err(); err != nil { - t.Fatal(err) - } - - if err = tx.Commit(); err != nil { - t.Fatal(err) - } -} - -var envParseTests = []struct { - Expected map[string]string - Env []string -}{ - { - Env: []string{"PGDATABASE=hello", "PGUSER=goodbye"}, - Expected: map[string]string{"dbname": "hello", "user": "goodbye"}, - }, - { - Env: []string{"PGDATESTYLE=ISO, MDY"}, - Expected: map[string]string{"datestyle": "ISO, MDY"}, - }, - { - Env: []string{"PGCONNECT_TIMEOUT=30"}, - Expected: map[string]string{"connect_timeout": "30"}, - }, -} - -func TestParseEnviron(t *testing.T) { - for i, tt := range envParseTests { - results := parseEnviron(tt.Env) - if !reflect.DeepEqual(tt.Expected, results) { - t.Errorf("%d: Expected: %#v Got: %#v", i, tt.Expected, results) - } - } -} - -func TestParseComplete(t *testing.T) { - tpc := func(commandTag string, command string, affectedRows int64, shouldFail bool) { - defer func() { - if p := recover(); p != nil { - if !shouldFail { - t.Error(p) - } - } - }() - cn := &conn{} - res, c := cn.parseComplete(commandTag) - if c != command { - t.Errorf("Expected %v, got %v", command, c) - } - n, err := res.RowsAffected() - if err != nil { - t.Fatal(err) - } - if n != affectedRows { - t.Errorf("Expected %d, got %d", affectedRows, n) - } - } - - tpc("ALTER TABLE", "ALTER TABLE", 0, false) - tpc("INSERT 0 1", "INSERT", 1, false) - tpc("UPDATE 100", "UPDATE", 100, false) - tpc("SELECT 100", "SELECT", 100, false) - tpc("FETCH 100", "FETCH", 100, false) - // allow COPY (and others) without row count - tpc("COPY", "COPY", 0, false) - // don't fail on command tags we don't recognize - tpc("UNKNOWNCOMMANDTAG", "UNKNOWNCOMMANDTAG", 0, false) - - // failure cases - tpc("INSERT 1", "", 0, true) // missing oid - tpc("UPDATE 0 1", "", 0, true) // too many numbers - tpc("SELECT foo", "", 0, true) // invalid row count -} - -func TestExecerInterface(t *testing.T) { - // Gin up a straw man private struct just for the type check - cn := &conn{c: nil} - var cni interface{} = cn - - _, ok := cni.(driver.Execer) - if !ok { - t.Fatal("Driver doesn't implement Execer") - } -} - -func TestNullAfterNonNull(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - r, err := db.Query("SELECT 9::integer UNION SELECT NULL::integer") - if err != nil { - t.Fatal(err) - } - - var n sql.NullInt64 - - if !r.Next() { - if r.Err() != nil { - t.Fatal(err) - } - t.Fatal("expected row") - } - - if err := r.Scan(&n); err != nil { - t.Fatal(err) - } - - if n.Int64 != 9 { - t.Fatalf("expected 2, not %d", n.Int64) - } - - if !r.Next() { - if r.Err() != nil { - t.Fatal(err) - } - t.Fatal("expected row") - } - - if err := r.Scan(&n); err != nil { - t.Fatal(err) - } - - if n.Valid { - t.Fatal("expected n to be invalid") - } - - if n.Int64 != 0 { - t.Fatalf("expected n to 2, not %d", n.Int64) - } -} - -func Test64BitErrorChecking(t *testing.T) { - defer func() { - if err := recover(); err != nil { - t.Fatal("panic due to 0xFFFFFFFF != -1 " + - "when int is 64 bits") - } - }() - - db := openTestConn(t) - defer db.Close() - - r, err := db.Query(`SELECT * -FROM (VALUES (0::integer, NULL::text), (1, 'test string')) AS t;`) - - if err != nil { - t.Fatal(err) - } - - defer r.Close() - - for r.Next() { - } -} - -func TestCommit(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - _, err := db.Exec("CREATE TEMP TABLE temp (a int)") - if err != nil { - t.Fatal(err) - } - sqlInsert := "INSERT INTO temp VALUES (1)" - sqlSelect := "SELECT * FROM temp" - tx, err := db.Begin() - if err != nil { - t.Fatal(err) - } - _, err = tx.Exec(sqlInsert) - if err != nil { - t.Fatal(err) - } - err = tx.Commit() - if err != nil { - t.Fatal(err) - } - var i int - err = db.QueryRow(sqlSelect).Scan(&i) - if err != nil { - t.Fatal(err) - } - if i != 1 { - t.Fatalf("expected 1, got %d", i) - } -} - -func TestErrorClass(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - _, err := db.Query("SELECT int 'notint'") - if err == nil { - t.Fatal("expected error") - } - pge, ok := err.(*Error) - if !ok { - t.Fatalf("expected *pq.Error, got %#+v", err) - } - if pge.Code.Class() != "22" { - t.Fatalf("expected class 28, got %v", pge.Code.Class()) - } - if pge.Code.Class().Name() != "data_exception" { - t.Fatalf("expected data_exception, got %v", pge.Code.Class().Name()) - } -} - -func TestParseOpts(t *testing.T) { - tests := []struct { - in string - expected values - valid bool - }{ - {"dbname=hello user=goodbye", values{"dbname": "hello", "user": "goodbye"}, true}, - {"dbname=hello user=goodbye ", values{"dbname": "hello", "user": "goodbye"}, true}, - {"dbname = hello user=goodbye", values{"dbname": "hello", "user": "goodbye"}, true}, - {"dbname=hello user =goodbye", values{"dbname": "hello", "user": "goodbye"}, true}, - {"dbname=hello user= goodbye", values{"dbname": "hello", "user": "goodbye"}, true}, - {"host=localhost password='correct horse battery staple'", values{"host": "localhost", "password": "correct horse battery staple"}, true}, - {"dbname=データベース password=パスワード", values{"dbname": "データベース", "password": "パスワード"}, true}, - {"dbname=hello user=''", values{"dbname": "hello", "user": ""}, true}, - {"user='' dbname=hello", values{"dbname": "hello", "user": ""}, true}, - // The last option value is an empty string if there's no non-whitespace after its = - {"dbname=hello user= ", values{"dbname": "hello", "user": ""}, true}, - - // The parser ignores spaces after = and interprets the next set of non-whitespace characters as the value. - {"user= password=foo", values{"user": "password=foo"}, true}, - - // Backslash escapes next char - {`user=a\ \'\\b`, values{"user": `a '\b`}, true}, - {`user='a \'b'`, values{"user": `a 'b`}, true}, - - // Incomplete escape - {`user=x\`, values{}, false}, - - // No '=' after the key - {"postgre://marko@internet", values{}, false}, - {"dbname user=goodbye", values{}, false}, - {"user=foo blah", values{}, false}, - {"user=foo blah ", values{}, false}, - - // Unterminated quoted value - {"dbname=hello user='unterminated", values{}, false}, - } - - for _, test := range tests { - o := make(values) - err := parseOpts(test.in, o) - - switch { - case err != nil && test.valid: - t.Errorf("%q got unexpected error: %s", test.in, err) - case err == nil && test.valid && !reflect.DeepEqual(test.expected, o): - t.Errorf("%q got: %#v want: %#v", test.in, o, test.expected) - case err == nil && !test.valid: - t.Errorf("%q expected an error", test.in) - } - } -} - -func TestRuntimeParameters(t *testing.T) { - type RuntimeTestResult int - const ( - ResultUnknown RuntimeTestResult = iota - ResultSuccess - ResultError // other error - ) - - tests := []struct { - conninfo string - param string - expected string - expectedOutcome RuntimeTestResult - }{ - // invalid parameter - {"DOESNOTEXIST=foo", "", "", ResultError}, - // we can only work with a specific value for these two - {"client_encoding=SQL_ASCII", "", "", ResultError}, - {"datestyle='ISO, YDM'", "", "", ResultError}, - // "options" should work exactly as it does in libpq - {"options='-c search_path=pqgotest'", "search_path", "pqgotest", ResultSuccess}, - // pq should override client_encoding in this case - {"options='-c client_encoding=SQL_ASCII'", "client_encoding", "UTF8", ResultSuccess}, - // allow client_encoding to be set explicitly - {"client_encoding=UTF8", "client_encoding", "UTF8", ResultSuccess}, - // test a runtime parameter not supported by libpq - {"work_mem='139kB'", "work_mem", "139kB", ResultSuccess}, - // test fallback_application_name - {"application_name=foo fallback_application_name=bar", "application_name", "foo", ResultSuccess}, - {"application_name='' fallback_application_name=bar", "application_name", "", ResultSuccess}, - {"fallback_application_name=bar", "application_name", "bar", ResultSuccess}, - } - - for _, test := range tests { - db, err := openTestConnConninfo(test.conninfo) - if err != nil { - t.Fatal(err) - } - - // application_name didn't exist before 9.0 - if test.param == "application_name" && getServerVersion(t, db) < 90000 { - db.Close() - continue - } - - tryGetParameterValue := func() (value string, outcome RuntimeTestResult) { - defer db.Close() - row := db.QueryRow("SELECT current_setting($1)", test.param) - err = row.Scan(&value) - if err != nil { - return "", ResultError - } - return value, ResultSuccess - } - - value, outcome := tryGetParameterValue() - if outcome != test.expectedOutcome && outcome == ResultError { - t.Fatalf("%v: unexpected error: %v", test.conninfo, err) - } - if outcome != test.expectedOutcome { - t.Fatalf("unexpected outcome %v (was expecting %v) for conninfo \"%s\"", - outcome, test.expectedOutcome, test.conninfo) - } - if value != test.expected { - t.Fatalf("bad value for %s: got %s, want %s with conninfo \"%s\"", - test.param, value, test.expected, test.conninfo) - } - } -} - -func TestIsUTF8(t *testing.T) { - var cases = []struct { - name string - want bool - }{ - {"unicode", true}, - {"utf-8", true}, - {"utf_8", true}, - {"UTF-8", true}, - {"UTF8", true}, - {"utf8", true}, - {"u n ic_ode", true}, - {"ut_f%8", true}, - {"ubf8", false}, - {"punycode", false}, - } - - for _, test := range cases { - if g := isUTF8(test.name); g != test.want { - t.Errorf("isUTF8(%q) = %v want %v", test.name, g, test.want) - } - } -} - -func TestQuoteIdentifier(t *testing.T) { - var cases = []struct { - input string - want string - }{ - {`foo`, `"foo"`}, - {`foo bar baz`, `"foo bar baz"`}, - {`foo"bar`, `"foo""bar"`}, - {"foo\x00bar", `"foo"`}, - {"\x00foo", `""`}, - } - - for _, test := range cases { - got := QuoteIdentifier(test.input) - if got != test.want { - t.Errorf("QuoteIdentifier(%q) = %v want %v", test.input, got, test.want) - } - } -} diff --git a/vendor/github.com/lib/pq/copy_test.go b/vendor/github.com/lib/pq/copy_test.go deleted file mode 100644 index 86745b38fd..0000000000 --- a/vendor/github.com/lib/pq/copy_test.go +++ /dev/null @@ -1,465 +0,0 @@ -package pq - -import ( - "bytes" - "database/sql" - "database/sql/driver" - "strings" - "testing" -) - -func TestCopyInStmt(t *testing.T) { - var stmt string - stmt = CopyIn("table name") - if stmt != `COPY "table name" () FROM STDIN` { - t.Fatal(stmt) - } - - stmt = CopyIn("table name", "column 1", "column 2") - if stmt != `COPY "table name" ("column 1", "column 2") FROM STDIN` { - t.Fatal(stmt) - } - - stmt = CopyIn(`table " name """`, `co"lumn""`) - if stmt != `COPY "table "" name """"""" ("co""lumn""""") FROM STDIN` { - t.Fatal(stmt) - } -} - -func TestCopyInSchemaStmt(t *testing.T) { - var stmt string - stmt = CopyInSchema("schema name", "table name") - if stmt != `COPY "schema name"."table name" () FROM STDIN` { - t.Fatal(stmt) - } - - stmt = CopyInSchema("schema name", "table name", "column 1", "column 2") - if stmt != `COPY "schema name"."table name" ("column 1", "column 2") FROM STDIN` { - t.Fatal(stmt) - } - - stmt = CopyInSchema(`schema " name """`, `table " name """`, `co"lumn""`) - if stmt != `COPY "schema "" name """"""".`+ - `"table "" name """"""" ("co""lumn""""") FROM STDIN` { - t.Fatal(stmt) - } -} - -func TestCopyInMultipleValues(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - txn, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer txn.Rollback() - - _, err = txn.Exec("CREATE TEMP TABLE temp (a int, b varchar)") - if err != nil { - t.Fatal(err) - } - - stmt, err := txn.Prepare(CopyIn("temp", "a", "b")) - if err != nil { - t.Fatal(err) - } - - longString := strings.Repeat("#", 500) - - for i := 0; i < 500; i++ { - _, err = stmt.Exec(int64(i), longString) - if err != nil { - t.Fatal(err) - } - } - - _, err = stmt.Exec() - if err != nil { - t.Fatal(err) - } - - err = stmt.Close() - if err != nil { - t.Fatal(err) - } - - var num int - err = txn.QueryRow("SELECT COUNT(*) FROM temp").Scan(&num) - if err != nil { - t.Fatal(err) - } - - if num != 500 { - t.Fatalf("expected 500 items, not %d", num) - } -} - -func TestCopyInRaiseStmtTrigger(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - if getServerVersion(t, db) < 90000 { - var exists int - err := db.QueryRow("SELECT 1 FROM pg_language WHERE lanname = 'plpgsql'").Scan(&exists) - if err == sql.ErrNoRows { - t.Skip("language PL/PgSQL does not exist; skipping TestCopyInRaiseStmtTrigger") - } else if err != nil { - t.Fatal(err) - } - } - - txn, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer txn.Rollback() - - _, err = txn.Exec("CREATE TEMP TABLE temp (a int, b varchar)") - if err != nil { - t.Fatal(err) - } - - _, err = txn.Exec(` - CREATE OR REPLACE FUNCTION pg_temp.temptest() - RETURNS trigger AS - $BODY$ begin - raise notice 'Hello world'; - return new; - end $BODY$ - LANGUAGE plpgsql`) - if err != nil { - t.Fatal(err) - } - - _, err = txn.Exec(` - CREATE TRIGGER temptest_trigger - BEFORE INSERT - ON temp - FOR EACH ROW - EXECUTE PROCEDURE pg_temp.temptest()`) - if err != nil { - t.Fatal(err) - } - - stmt, err := txn.Prepare(CopyIn("temp", "a", "b")) - if err != nil { - t.Fatal(err) - } - - longString := strings.Repeat("#", 500) - - _, err = stmt.Exec(int64(1), longString) - if err != nil { - t.Fatal(err) - } - - _, err = stmt.Exec() - if err != nil { - t.Fatal(err) - } - - err = stmt.Close() - if err != nil { - t.Fatal(err) - } - - var num int - err = txn.QueryRow("SELECT COUNT(*) FROM temp").Scan(&num) - if err != nil { - t.Fatal(err) - } - - if num != 1 { - t.Fatalf("expected 1 items, not %d", num) - } -} - -func TestCopyInTypes(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - txn, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer txn.Rollback() - - _, err = txn.Exec("CREATE TEMP TABLE temp (num INTEGER, text VARCHAR, blob BYTEA, nothing VARCHAR)") - if err != nil { - t.Fatal(err) - } - - stmt, err := txn.Prepare(CopyIn("temp", "num", "text", "blob", "nothing")) - if err != nil { - t.Fatal(err) - } - - _, err = stmt.Exec(int64(1234567890), "Héllö\n ☃!\r\t\\", []byte{0, 255, 9, 10, 13}, nil) - if err != nil { - t.Fatal(err) - } - - _, err = stmt.Exec() - if err != nil { - t.Fatal(err) - } - - err = stmt.Close() - if err != nil { - t.Fatal(err) - } - - var num int - var text string - var blob []byte - var nothing sql.NullString - - err = txn.QueryRow("SELECT * FROM temp").Scan(&num, &text, &blob, ¬hing) - if err != nil { - t.Fatal(err) - } - - if num != 1234567890 { - t.Fatal("unexpected result", num) - } - if text != "Héllö\n ☃!\r\t\\" { - t.Fatal("unexpected result", text) - } - if bytes.Compare(blob, []byte{0, 255, 9, 10, 13}) != 0 { - t.Fatal("unexpected result", blob) - } - if nothing.Valid { - t.Fatal("unexpected result", nothing.String) - } -} - -func TestCopyInWrongType(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - txn, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer txn.Rollback() - - _, err = txn.Exec("CREATE TEMP TABLE temp (num INTEGER)") - if err != nil { - t.Fatal(err) - } - - stmt, err := txn.Prepare(CopyIn("temp", "num")) - if err != nil { - t.Fatal(err) - } - defer stmt.Close() - - _, err = stmt.Exec("Héllö\n ☃!\r\t\\") - if err != nil { - t.Fatal(err) - } - - _, err = stmt.Exec() - if err == nil { - t.Fatal("expected error") - } - if pge := err.(*Error); pge.Code.Name() != "invalid_text_representation" { - t.Fatalf("expected 'invalid input syntax for integer' error, got %s (%+v)", pge.Code.Name(), pge) - } -} - -func TestCopyOutsideOfTxnError(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - _, err := db.Prepare(CopyIn("temp", "num")) - if err == nil { - t.Fatal("COPY outside of transaction did not return an error") - } - if err != errCopyNotSupportedOutsideTxn { - t.Fatalf("expected %s, got %s", err, err.Error()) - } -} - -func TestCopyInBinaryError(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - txn, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer txn.Rollback() - - _, err = txn.Exec("CREATE TEMP TABLE temp (num INTEGER)") - if err != nil { - t.Fatal(err) - } - _, err = txn.Prepare("COPY temp (num) FROM STDIN WITH binary") - if err != errBinaryCopyNotSupported { - t.Fatalf("expected %s, got %+v", errBinaryCopyNotSupported, err) - } - // check that the protocol is in a valid state - err = txn.Rollback() - if err != nil { - t.Fatal(err) - } -} - -func TestCopyFromError(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - txn, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer txn.Rollback() - - _, err = txn.Exec("CREATE TEMP TABLE temp (num INTEGER)") - if err != nil { - t.Fatal(err) - } - _, err = txn.Prepare("COPY temp (num) TO STDOUT") - if err != errCopyToNotSupported { - t.Fatalf("expected %s, got %+v", errCopyToNotSupported, err) - } - // check that the protocol is in a valid state - err = txn.Rollback() - if err != nil { - t.Fatal(err) - } -} - -func TestCopySyntaxError(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - txn, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer txn.Rollback() - - _, err = txn.Prepare("COPY ") - if err == nil { - t.Fatal("expected error") - } - if pge := err.(*Error); pge.Code.Name() != "syntax_error" { - t.Fatalf("expected syntax error, got %s (%+v)", pge.Code.Name(), pge) - } - // check that the protocol is in a valid state - err = txn.Rollback() - if err != nil { - t.Fatal(err) - } -} - -// Tests for connection errors in copyin.resploop() -func TestCopyRespLoopConnectionError(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - txn, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer txn.Rollback() - - var pid int - err = txn.QueryRow("SELECT pg_backend_pid()").Scan(&pid) - if err != nil { - t.Fatal(err) - } - - _, err = txn.Exec("CREATE TEMP TABLE temp (a int)") - if err != nil { - t.Fatal(err) - } - - stmt, err := txn.Prepare(CopyIn("temp", "a")) - if err != nil { - t.Fatal(err) - } - defer stmt.Close() - - _, err = db.Exec("SELECT pg_terminate_backend($1)", pid) - if err != nil { - t.Fatal(err) - } - - if getServerVersion(t, db) < 90500 { - // We have to try and send something over, since postgres before - // version 9.5 won't process SIGTERMs while it's waiting for - // CopyData/CopyEnd messages; see tcop/postgres.c. - _, err = stmt.Exec(1) - if err != nil { - t.Fatal(err) - } - } - _, err = stmt.Exec() - if err == nil { - t.Fatalf("expected error") - } - pge, ok := err.(*Error) - if !ok { - if err == driver.ErrBadConn { - // likely an EPIPE - } else { - t.Fatalf("expected *pq.Error or driver.ErrBadConn, got %+#v", err) - } - } else if pge.Code.Name() != "admin_shutdown" { - t.Fatalf("expected admin_shutdown, got %s", pge.Code.Name()) - } - - _ = stmt.Close() -} - -func BenchmarkCopyIn(b *testing.B) { - db := openTestConn(b) - defer db.Close() - - txn, err := db.Begin() - if err != nil { - b.Fatal(err) - } - defer txn.Rollback() - - _, err = txn.Exec("CREATE TEMP TABLE temp (a int, b varchar)") - if err != nil { - b.Fatal(err) - } - - stmt, err := txn.Prepare(CopyIn("temp", "a", "b")) - if err != nil { - b.Fatal(err) - } - - for i := 0; i < b.N; i++ { - _, err = stmt.Exec(int64(i), "hello world!") - if err != nil { - b.Fatal(err) - } - } - - _, err = stmt.Exec() - if err != nil { - b.Fatal(err) - } - - err = stmt.Close() - if err != nil { - b.Fatal(err) - } - - var num int - err = txn.QueryRow("SELECT COUNT(*) FROM temp").Scan(&num) - if err != nil { - b.Fatal(err) - } - - if num != b.N { - b.Fatalf("expected %d items, not %d", b.N, num) - } -} diff --git a/vendor/github.com/lib/pq/encode_test.go b/vendor/github.com/lib/pq/encode_test.go deleted file mode 100644 index 97b6638864..0000000000 --- a/vendor/github.com/lib/pq/encode_test.go +++ /dev/null @@ -1,719 +0,0 @@ -package pq - -import ( - "bytes" - "database/sql" - "fmt" - "testing" - "time" - - "github.com/lib/pq/oid" -) - -func TestScanTimestamp(t *testing.T) { - var nt NullTime - tn := time.Now() - nt.Scan(tn) - if !nt.Valid { - t.Errorf("Expected Valid=false") - } - if nt.Time != tn { - t.Errorf("Time value mismatch") - } -} - -func TestScanNilTimestamp(t *testing.T) { - var nt NullTime - nt.Scan(nil) - if nt.Valid { - t.Errorf("Expected Valid=false") - } -} - -var timeTests = []struct { - str string - timeval time.Time -}{ - {"22001-02-03", time.Date(22001, time.February, 3, 0, 0, 0, 0, time.FixedZone("", 0))}, - {"2001-02-03", time.Date(2001, time.February, 3, 0, 0, 0, 0, time.FixedZone("", 0))}, - {"2001-02-03 04:05:06", time.Date(2001, time.February, 3, 4, 5, 6, 0, time.FixedZone("", 0))}, - {"2001-02-03 04:05:06.000001", time.Date(2001, time.February, 3, 4, 5, 6, 1000, time.FixedZone("", 0))}, - {"2001-02-03 04:05:06.00001", time.Date(2001, time.February, 3, 4, 5, 6, 10000, time.FixedZone("", 0))}, - {"2001-02-03 04:05:06.0001", time.Date(2001, time.February, 3, 4, 5, 6, 100000, time.FixedZone("", 0))}, - {"2001-02-03 04:05:06.001", time.Date(2001, time.February, 3, 4, 5, 6, 1000000, time.FixedZone("", 0))}, - {"2001-02-03 04:05:06.01", time.Date(2001, time.February, 3, 4, 5, 6, 10000000, time.FixedZone("", 0))}, - {"2001-02-03 04:05:06.1", time.Date(2001, time.February, 3, 4, 5, 6, 100000000, time.FixedZone("", 0))}, - {"2001-02-03 04:05:06.12", time.Date(2001, time.February, 3, 4, 5, 6, 120000000, time.FixedZone("", 0))}, - {"2001-02-03 04:05:06.123", time.Date(2001, time.February, 3, 4, 5, 6, 123000000, time.FixedZone("", 0))}, - {"2001-02-03 04:05:06.1234", time.Date(2001, time.February, 3, 4, 5, 6, 123400000, time.FixedZone("", 0))}, - {"2001-02-03 04:05:06.12345", time.Date(2001, time.February, 3, 4, 5, 6, 123450000, time.FixedZone("", 0))}, - {"2001-02-03 04:05:06.123456", time.Date(2001, time.February, 3, 4, 5, 6, 123456000, time.FixedZone("", 0))}, - {"2001-02-03 04:05:06.123-07", time.Date(2001, time.February, 3, 4, 5, 6, 123000000, - time.FixedZone("", -7*60*60))}, - {"2001-02-03 04:05:06-07", time.Date(2001, time.February, 3, 4, 5, 6, 0, - time.FixedZone("", -7*60*60))}, - {"2001-02-03 04:05:06-07:42", time.Date(2001, time.February, 3, 4, 5, 6, 0, - time.FixedZone("", -(7*60*60+42*60)))}, - {"2001-02-03 04:05:06-07:30:09", time.Date(2001, time.February, 3, 4, 5, 6, 0, - time.FixedZone("", -(7*60*60+30*60+9)))}, - {"2001-02-03 04:05:06+07", time.Date(2001, time.February, 3, 4, 5, 6, 0, - time.FixedZone("", 7*60*60))}, - {"0011-02-03 04:05:06 BC", time.Date(-10, time.February, 3, 4, 5, 6, 0, time.FixedZone("", 0))}, - {"0011-02-03 04:05:06.123 BC", time.Date(-10, time.February, 3, 4, 5, 6, 123000000, time.FixedZone("", 0))}, - {"0011-02-03 04:05:06.123-07 BC", time.Date(-10, time.February, 3, 4, 5, 6, 123000000, - time.FixedZone("", -7*60*60))}, - {"0001-02-03 04:05:06.123", time.Date(1, time.February, 3, 4, 5, 6, 123000000, time.FixedZone("", 0))}, - {"0001-02-03 04:05:06.123 BC", time.Date(1, time.February, 3, 4, 5, 6, 123000000, time.FixedZone("", 0)).AddDate(-1, 0, 0)}, - {"0001-02-03 04:05:06.123 BC", time.Date(0, time.February, 3, 4, 5, 6, 123000000, time.FixedZone("", 0))}, - {"0002-02-03 04:05:06.123 BC", time.Date(0, time.February, 3, 4, 5, 6, 123000000, time.FixedZone("", 0)).AddDate(-1, 0, 0)}, - {"0002-02-03 04:05:06.123 BC", time.Date(-1, time.February, 3, 4, 5, 6, 123000000, time.FixedZone("", 0))}, - {"12345-02-03 04:05:06.1", time.Date(12345, time.February, 3, 4, 5, 6, 100000000, time.FixedZone("", 0))}, - {"123456-02-03 04:05:06.1", time.Date(123456, time.February, 3, 4, 5, 6, 100000000, time.FixedZone("", 0))}, -} - -// Helper function for the two tests below -func tryParse(str string) (t time.Time, err error) { - defer func() { - if p := recover(); p != nil { - err = fmt.Errorf("%v", p) - return - } - }() - i := parseTs(nil, str) - t, ok := i.(time.Time) - if !ok { - err = fmt.Errorf("Not a time.Time type, got %#v", i) - } - return -} - -// Test that parsing the string results in the expected value. -func TestParseTs(t *testing.T) { - for i, tt := range timeTests { - val, err := tryParse(tt.str) - if err != nil { - t.Errorf("%d: got error: %v", i, err) - } else if val.String() != tt.timeval.String() { - t.Errorf("%d: expected to parse %q into %q; got %q", - i, tt.str, tt.timeval, val) - } - } -} - -// Now test that sending the value into the database and parsing it back -// returns the same time.Time value. -func TestEncodeAndParseTs(t *testing.T) { - db, err := openTestConnConninfo("timezone='Etc/UTC'") - if err != nil { - t.Fatal(err) - } - defer db.Close() - - for i, tt := range timeTests { - var dbstr string - err = db.QueryRow("SELECT ($1::timestamptz)::text", tt.timeval).Scan(&dbstr) - if err != nil { - t.Errorf("%d: could not send value %q to the database: %s", i, tt.timeval, err) - continue - } - - val, err := tryParse(dbstr) - if err != nil { - t.Errorf("%d: could not parse value %q: %s", i, dbstr, err) - continue - } - val = val.In(tt.timeval.Location()) - if val.String() != tt.timeval.String() { - t.Errorf("%d: expected to parse %q into %q; got %q", i, dbstr, tt.timeval, val) - } - } -} - -var formatTimeTests = []struct { - time time.Time - expected string -}{ - {time.Time{}, "0001-01-01T00:00:00Z"}, - {time.Date(2001, time.February, 3, 4, 5, 6, 123456789, time.FixedZone("", 0)), "2001-02-03T04:05:06.123456789Z"}, - {time.Date(2001, time.February, 3, 4, 5, 6, 123456789, time.FixedZone("", 2*60*60)), "2001-02-03T04:05:06.123456789+02:00"}, - {time.Date(2001, time.February, 3, 4, 5, 6, 123456789, time.FixedZone("", -6*60*60)), "2001-02-03T04:05:06.123456789-06:00"}, - {time.Date(2001, time.February, 3, 4, 5, 6, 0, time.FixedZone("", -(7*60*60+30*60+9))), "2001-02-03T04:05:06-07:30:09"}, - - {time.Date(1, time.February, 3, 4, 5, 6, 123456789, time.FixedZone("", 0)), "0001-02-03T04:05:06.123456789Z"}, - {time.Date(1, time.February, 3, 4, 5, 6, 123456789, time.FixedZone("", 2*60*60)), "0001-02-03T04:05:06.123456789+02:00"}, - {time.Date(1, time.February, 3, 4, 5, 6, 123456789, time.FixedZone("", -6*60*60)), "0001-02-03T04:05:06.123456789-06:00"}, - - {time.Date(0, time.February, 3, 4, 5, 6, 123456789, time.FixedZone("", 0)), "0001-02-03T04:05:06.123456789Z BC"}, - {time.Date(0, time.February, 3, 4, 5, 6, 123456789, time.FixedZone("", 2*60*60)), "0001-02-03T04:05:06.123456789+02:00 BC"}, - {time.Date(0, time.February, 3, 4, 5, 6, 123456789, time.FixedZone("", -6*60*60)), "0001-02-03T04:05:06.123456789-06:00 BC"}, - - {time.Date(1, time.February, 3, 4, 5, 6, 0, time.FixedZone("", -(7*60*60+30*60+9))), "0001-02-03T04:05:06-07:30:09"}, - {time.Date(0, time.February, 3, 4, 5, 6, 0, time.FixedZone("", -(7*60*60+30*60+9))), "0001-02-03T04:05:06-07:30:09 BC"}, -} - -func TestFormatTs(t *testing.T) { - for i, tt := range formatTimeTests { - val := string(formatTs(tt.time)) - if val != tt.expected { - t.Errorf("%d: incorrect time format %q, want %q", i, val, tt.expected) - } - } -} - -func TestTimestampWithTimeZone(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - tx, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer tx.Rollback() - - // try several different locations, all included in Go's zoneinfo.zip - for _, locName := range []string{ - "UTC", - "America/Chicago", - "America/New_York", - "Australia/Darwin", - "Australia/Perth", - } { - loc, err := time.LoadLocation(locName) - if err != nil { - t.Logf("Could not load time zone %s - skipping", locName) - continue - } - - // Postgres timestamps have a resolution of 1 microsecond, so don't - // use the full range of the Nanosecond argument - refTime := time.Date(2012, 11, 6, 10, 23, 42, 123456000, loc) - - for _, pgTimeZone := range []string{"US/Eastern", "Australia/Darwin"} { - // Switch Postgres's timezone to test different output timestamp formats - _, err = tx.Exec(fmt.Sprintf("set time zone '%s'", pgTimeZone)) - if err != nil { - t.Fatal(err) - } - - var gotTime time.Time - row := tx.QueryRow("select $1::timestamp with time zone", refTime) - err = row.Scan(&gotTime) - if err != nil { - t.Fatal(err) - } - - if !refTime.Equal(gotTime) { - t.Errorf("timestamps not equal: %s != %s", refTime, gotTime) - } - - // check that the time zone is set correctly based on TimeZone - pgLoc, err := time.LoadLocation(pgTimeZone) - if err != nil { - t.Logf("Could not load time zone %s - skipping", pgLoc) - continue - } - translated := refTime.In(pgLoc) - if translated.String() != gotTime.String() { - t.Errorf("timestamps not equal: %s != %s", translated, gotTime) - } - } - } -} - -func TestTimestampWithOutTimezone(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - test := func(ts, pgts string) { - r, err := db.Query("SELECT $1::timestamp", pgts) - if err != nil { - t.Fatalf("Could not run query: %v", err) - } - - n := r.Next() - - if n != true { - t.Fatal("Expected at least one row") - } - - var result time.Time - err = r.Scan(&result) - if err != nil { - t.Fatalf("Did not expect error scanning row: %v", err) - } - - expected, err := time.Parse(time.RFC3339, ts) - if err != nil { - t.Fatalf("Could not parse test time literal: %v", err) - } - - if !result.Equal(expected) { - t.Fatalf("Expected time to match %v: got mismatch %v", - expected, result) - } - - n = r.Next() - if n != false { - t.Fatal("Expected only one row") - } - } - - test("2000-01-01T00:00:00Z", "2000-01-01T00:00:00") - - // Test higher precision time - test("2013-01-04T20:14:58.80033Z", "2013-01-04 20:14:58.80033") -} - -func TestInfinityTimestamp(t *testing.T) { - db := openTestConn(t) - defer db.Close() - var err error - var resultT time.Time - - expectedError := fmt.Errorf(`sql: Scan error on column index 0: unsupported driver -> Scan pair: []uint8 -> *time.Time`) - type testCases []struct { - Query string - Param string - ExpectedErr error - ExpectedVal interface{} - } - tc := testCases{ - {"SELECT $1::timestamp", "-infinity", expectedError, "-infinity"}, - {"SELECT $1::timestamptz", "-infinity", expectedError, "-infinity"}, - {"SELECT $1::timestamp", "infinity", expectedError, "infinity"}, - {"SELECT $1::timestamptz", "infinity", expectedError, "infinity"}, - } - // try to assert []byte to time.Time - for _, q := range tc { - err = db.QueryRow(q.Query, q.Param).Scan(&resultT) - if err.Error() != q.ExpectedErr.Error() { - t.Errorf("Scanning -/+infinity, expected error, %q, got %q", q.ExpectedErr, err) - } - } - // yield []byte - for _, q := range tc { - var resultI interface{} - err = db.QueryRow(q.Query, q.Param).Scan(&resultI) - if err != nil { - t.Errorf("Scanning -/+infinity, expected no error, got %q", err) - } - result, ok := resultI.([]byte) - if !ok { - t.Errorf("Scanning -/+infinity, expected []byte, got %#v", resultI) - } - if string(result) != q.ExpectedVal { - t.Errorf("Scanning -/+infinity, expected %q, got %q", q.ExpectedVal, result) - } - } - - y1500 := time.Date(1500, time.January, 1, 0, 0, 0, 0, time.UTC) - y2500 := time.Date(2500, time.January, 1, 0, 0, 0, 0, time.UTC) - EnableInfinityTs(y1500, y2500) - - err = db.QueryRow("SELECT $1::timestamp", "infinity").Scan(&resultT) - if err != nil { - t.Errorf("Scanning infinity, expected no error, got %q", err) - } - if !resultT.Equal(y2500) { - t.Errorf("Scanning infinity, expected %q, got %q", y2500, resultT) - } - - err = db.QueryRow("SELECT $1::timestamptz", "infinity").Scan(&resultT) - if err != nil { - t.Errorf("Scanning infinity, expected no error, got %q", err) - } - if !resultT.Equal(y2500) { - t.Errorf("Scanning Infinity, expected time %q, got %q", y2500, resultT.String()) - } - - err = db.QueryRow("SELECT $1::timestamp", "-infinity").Scan(&resultT) - if err != nil { - t.Errorf("Scanning -infinity, expected no error, got %q", err) - } - if !resultT.Equal(y1500) { - t.Errorf("Scanning -infinity, expected time %q, got %q", y1500, resultT.String()) - } - - err = db.QueryRow("SELECT $1::timestamptz", "-infinity").Scan(&resultT) - if err != nil { - t.Errorf("Scanning -infinity, expected no error, got %q", err) - } - if !resultT.Equal(y1500) { - t.Errorf("Scanning -infinity, expected time %q, got %q", y1500, resultT.String()) - } - - y_1500 := time.Date(-1500, time.January, 1, 0, 0, 0, 0, time.UTC) - y11500 := time.Date(11500, time.January, 1, 0, 0, 0, 0, time.UTC) - var s string - err = db.QueryRow("SELECT $1::timestamp::text", y_1500).Scan(&s) - if err != nil { - t.Errorf("Encoding -infinity, expected no error, got %q", err) - } - if s != "-infinity" { - t.Errorf("Encoding -infinity, expected %q, got %q", "-infinity", s) - } - err = db.QueryRow("SELECT $1::timestamptz::text", y_1500).Scan(&s) - if err != nil { - t.Errorf("Encoding -infinity, expected no error, got %q", err) - } - if s != "-infinity" { - t.Errorf("Encoding -infinity, expected %q, got %q", "-infinity", s) - } - - err = db.QueryRow("SELECT $1::timestamp::text", y11500).Scan(&s) - if err != nil { - t.Errorf("Encoding infinity, expected no error, got %q", err) - } - if s != "infinity" { - t.Errorf("Encoding infinity, expected %q, got %q", "infinity", s) - } - err = db.QueryRow("SELECT $1::timestamptz::text", y11500).Scan(&s) - if err != nil { - t.Errorf("Encoding infinity, expected no error, got %q", err) - } - if s != "infinity" { - t.Errorf("Encoding infinity, expected %q, got %q", "infinity", s) - } - - disableInfinityTs() - - var panicErrorString string - func() { - defer func() { - panicErrorString, _ = recover().(string) - }() - EnableInfinityTs(y2500, y1500) - }() - if panicErrorString != infinityTsNegativeMustBeSmaller { - t.Errorf("Expected error, %q, got %q", infinityTsNegativeMustBeSmaller, panicErrorString) - } -} - -func TestStringWithNul(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - hello0world := string("hello\x00world") - _, err := db.Query("SELECT $1::text", &hello0world) - if err == nil { - t.Fatal("Postgres accepts a string with nul in it; " + - "injection attacks may be plausible") - } -} - -func TestByteSliceToText(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - b := []byte("hello world") - row := db.QueryRow("SELECT $1::text", b) - - var result []byte - err := row.Scan(&result) - if err != nil { - t.Fatal(err) - } - - if string(result) != string(b) { - t.Fatalf("expected %v but got %v", b, result) - } -} - -func TestStringToBytea(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - b := "hello world" - row := db.QueryRow("SELECT $1::bytea", b) - - var result []byte - err := row.Scan(&result) - if err != nil { - t.Fatal(err) - } - - if !bytes.Equal(result, []byte(b)) { - t.Fatalf("expected %v but got %v", b, result) - } -} - -func TestTextByteSliceToUUID(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - b := []byte("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11") - row := db.QueryRow("SELECT $1::uuid", b) - - var result string - err := row.Scan(&result) - if forceBinaryParameters() { - pqErr := err.(*Error) - if pqErr == nil { - t.Errorf("Expected to get error") - } else if pqErr.Code != "22P03" { - t.Fatalf("Expected to get invalid binary encoding error (22P03), got %s", pqErr.Code) - } - } else { - if err != nil { - t.Fatal(err) - } - - if result != string(b) { - t.Fatalf("expected %v but got %v", b, result) - } - } -} - -func TestBinaryByteSlicetoUUID(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - b := []byte{'\xa0','\xee','\xbc','\x99', - '\x9c', '\x0b', - '\x4e', '\xf8', - '\xbb', '\x00', '\x6b', - '\xb9', '\xbd', '\x38', '\x0a', '\x11'} - row := db.QueryRow("SELECT $1::uuid", b) - - var result string - err := row.Scan(&result) - if forceBinaryParameters() { - if err != nil { - t.Fatal(err) - } - - if result != string("a0eebc99-9c0b-4ef8-bb00-6bb9bd380a11") { - t.Fatalf("expected %v but got %v", b, result) - } - } else { - pqErr := err.(*Error) - if pqErr == nil { - t.Errorf("Expected to get error") - } else if pqErr.Code != "22021" { - t.Fatalf("Expected to get invalid byte sequence for encoding error (22021), got %s", pqErr.Code) - } - } -} - -func TestStringToUUID(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - s := "a0eebc99-9c0b-4ef8-bb00-6bb9bd380a11" - row := db.QueryRow("SELECT $1::uuid", s) - - var result string - err := row.Scan(&result) - if err != nil { - t.Fatal(err) - } - - if result != s { - t.Fatalf("expected %v but got %v", s, result) - } -} - -func TestTextByteSliceToInt(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - expected := 12345678 - b := []byte(fmt.Sprintf("%d", expected)) - row := db.QueryRow("SELECT $1::int", b) - - var result int - err := row.Scan(&result) - if forceBinaryParameters() { - pqErr := err.(*Error) - if pqErr == nil { - t.Errorf("Expected to get error") - } else if pqErr.Code != "22P03" { - t.Fatalf("Expected to get invalid binary encoding error (22P03), got %s", pqErr.Code) - } - } else { - if err != nil { - t.Fatal(err) - } - if result != expected { - t.Fatalf("expected %v but got %v", expected, result) - } - } -} - -func TestBinaryByteSliceToInt(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - expected := 12345678 - b := []byte{'\x00', '\xbc', '\x61', '\x4e'} - row := db.QueryRow("SELECT $1::int", b) - - var result int - err := row.Scan(&result) - if forceBinaryParameters() { - if err != nil { - t.Fatal(err) - } - if result != expected { - t.Fatalf("expected %v but got %v", expected, result) - } - } else { - pqErr := err.(*Error) - if pqErr == nil { - t.Errorf("Expected to get error") - } else if pqErr.Code != "22021" { - t.Fatalf("Expected to get invalid byte sequence for encoding error (22021), got %s", pqErr.Code) - } - } -} - -func TestByteaOutputFormatEncoding(t *testing.T) { - input := []byte("\\x\x00\x01\x02\xFF\xFEabcdefg0123") - want := []byte("\\x5c78000102fffe6162636465666730313233") - got := encode(¶meterStatus{serverVersion: 90000}, input, oid.T_bytea) - if !bytes.Equal(want, got) { - t.Errorf("invalid hex bytea output, got %v but expected %v", got, want) - } - - want = []byte("\\\\x\\000\\001\\002\\377\\376abcdefg0123") - got = encode(¶meterStatus{serverVersion: 84000}, input, oid.T_bytea) - if !bytes.Equal(want, got) { - t.Errorf("invalid escape bytea output, got %v but expected %v", got, want) - } -} - -func TestByteaOutputFormats(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - if getServerVersion(t, db) < 90000 { - // skip - return - } - - testByteaOutputFormat := func(f string, usePrepared bool) { - expectedData := []byte("\x5c\x78\x00\xff\x61\x62\x63\x01\x08") - sqlQuery := "SELECT decode('5c7800ff6162630108', 'hex')" - - var data []byte - - // use a txn to avoid relying on getting the same connection - txn, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer txn.Rollback() - - _, err = txn.Exec("SET LOCAL bytea_output TO " + f) - if err != nil { - t.Fatal(err) - } - var rows *sql.Rows - var stmt *sql.Stmt - if usePrepared { - stmt, err = txn.Prepare(sqlQuery) - if err != nil { - t.Fatal(err) - } - rows, err = stmt.Query() - } else { - // use Query; QueryRow would hide the actual error - rows, err = txn.Query(sqlQuery) - } - if err != nil { - t.Fatal(err) - } - if !rows.Next() { - if rows.Err() != nil { - t.Fatal(rows.Err()) - } - t.Fatal("shouldn't happen") - } - err = rows.Scan(&data) - if err != nil { - t.Fatal(err) - } - err = rows.Close() - if err != nil { - t.Fatal(err) - } - if stmt != nil { - err = stmt.Close() - if err != nil { - t.Fatal(err) - } - } - if !bytes.Equal(data, expectedData) { - t.Errorf("unexpected bytea value %v for format %s; expected %v", data, f, expectedData) - } - } - - testByteaOutputFormat("hex", false) - testByteaOutputFormat("escape", false) - testByteaOutputFormat("hex", true) - testByteaOutputFormat("escape", true) -} - -func TestAppendEncodedText(t *testing.T) { - var buf []byte - - buf = appendEncodedText(¶meterStatus{serverVersion: 90000}, buf, int64(10)) - buf = append(buf, '\t') - buf = appendEncodedText(¶meterStatus{serverVersion: 90000}, buf, 42.0000000001) - buf = append(buf, '\t') - buf = appendEncodedText(¶meterStatus{serverVersion: 90000}, buf, "hello\tworld") - buf = append(buf, '\t') - buf = appendEncodedText(¶meterStatus{serverVersion: 90000}, buf, []byte{0, 128, 255}) - - if string(buf) != "10\t42.0000000001\thello\\tworld\t\\\\x0080ff" { - t.Fatal(string(buf)) - } -} - -func TestAppendEscapedText(t *testing.T) { - if esc := appendEscapedText(nil, "hallo\tescape"); string(esc) != "hallo\\tescape" { - t.Fatal(string(esc)) - } - if esc := appendEscapedText(nil, "hallo\\tescape\n"); string(esc) != "hallo\\\\tescape\\n" { - t.Fatal(string(esc)) - } - if esc := appendEscapedText(nil, "\n\r\t\f"); string(esc) != "\\n\\r\\t\f" { - t.Fatal(string(esc)) - } -} - -func TestAppendEscapedTextExistingBuffer(t *testing.T) { - var buf []byte - buf = []byte("123\t") - if esc := appendEscapedText(buf, "hallo\tescape"); string(esc) != "123\thallo\\tescape" { - t.Fatal(string(esc)) - } - buf = []byte("123\t") - if esc := appendEscapedText(buf, "hallo\\tescape\n"); string(esc) != "123\thallo\\\\tescape\\n" { - t.Fatal(string(esc)) - } - buf = []byte("123\t") - if esc := appendEscapedText(buf, "\n\r\t\f"); string(esc) != "123\t\\n\\r\\t\f" { - t.Fatal(string(esc)) - } -} - -func BenchmarkAppendEscapedText(b *testing.B) { - longString := "" - for i := 0; i < 100; i++ { - longString += "123456789\n" - } - for i := 0; i < b.N; i++ { - appendEscapedText(nil, longString) - } -} - -func BenchmarkAppendEscapedTextNoEscape(b *testing.B) { - longString := "" - for i := 0; i < 100; i++ { - longString += "1234567890" - } - for i := 0; i < b.N; i++ { - appendEscapedText(nil, longString) - } -} diff --git a/vendor/github.com/lib/pq/hstore/hstore_test.go b/vendor/github.com/lib/pq/hstore/hstore_test.go deleted file mode 100644 index c9c108fc34..0000000000 --- a/vendor/github.com/lib/pq/hstore/hstore_test.go +++ /dev/null @@ -1,148 +0,0 @@ -package hstore - -import ( - "database/sql" - "os" - "testing" - - _ "github.com/lib/pq" -) - -type Fatalistic interface { - Fatal(args ...interface{}) -} - -func openTestConn(t Fatalistic) *sql.DB { - datname := os.Getenv("PGDATABASE") - sslmode := os.Getenv("PGSSLMODE") - - if datname == "" { - os.Setenv("PGDATABASE", "pqgotest") - } - - if sslmode == "" { - os.Setenv("PGSSLMODE", "disable") - } - - conn, err := sql.Open("postgres", "") - if err != nil { - t.Fatal(err) - } - - return conn -} - -func TestHstore(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - // quitely create hstore if it doesn't exist - _, err := db.Exec("CREATE EXTENSION IF NOT EXISTS hstore") - if err != nil { - t.Skipf("Skipping hstore tests - hstore extension create failed: %s", err.Error()) - } - - hs := Hstore{} - - // test for null-valued hstores - err = db.QueryRow("SELECT NULL::hstore").Scan(&hs) - if err != nil { - t.Fatal(err) - } - if hs.Map != nil { - t.Fatalf("expected null map") - } - - err = db.QueryRow("SELECT $1::hstore", hs).Scan(&hs) - if err != nil { - t.Fatalf("re-query null map failed: %s", err.Error()) - } - if hs.Map != nil { - t.Fatalf("expected null map") - } - - // test for empty hstores - err = db.QueryRow("SELECT ''::hstore").Scan(&hs) - if err != nil { - t.Fatal(err) - } - if hs.Map == nil { - t.Fatalf("expected empty map, got null map") - } - if len(hs.Map) != 0 { - t.Fatalf("expected empty map, got len(map)=%d", len(hs.Map)) - } - - err = db.QueryRow("SELECT $1::hstore", hs).Scan(&hs) - if err != nil { - t.Fatalf("re-query empty map failed: %s", err.Error()) - } - if hs.Map == nil { - t.Fatalf("expected empty map, got null map") - } - if len(hs.Map) != 0 { - t.Fatalf("expected empty map, got len(map)=%d", len(hs.Map)) - } - - // a few example maps to test out - hsOnePair := Hstore{ - Map: map[string]sql.NullString{ - "key1": {"value1", true}, - }, - } - - hsThreePairs := Hstore{ - Map: map[string]sql.NullString{ - "key1": {"value1", true}, - "key2": {"value2", true}, - "key3": {"value3", true}, - }, - } - - hsSmorgasbord := Hstore{ - Map: map[string]sql.NullString{ - "nullstring": {"NULL", true}, - "actuallynull": {"", false}, - "NULL": {"NULL string key", true}, - "withbracket": {"value>42", true}, - "withequal": {"value=42", true}, - `"withquotes1"`: {`this "should" be fine`, true}, - `"withquotes"2"`: {`this "should\" also be fine`, true}, - "embedded1": {"value1=>x1", true}, - "embedded2": {`"value2"=>x2`, true}, - "withnewlines": {"\n\nvalue\t=>2", true}, - "<>": {`this, "should,\" also, => be fine`, true}, - }, - } - - // test encoding in query params, then decoding during Scan - testBidirectional := func(h Hstore) { - err = db.QueryRow("SELECT $1::hstore", h).Scan(&hs) - if err != nil { - t.Fatalf("re-query %d-pair map failed: %s", len(h.Map), err.Error()) - } - if hs.Map == nil { - t.Fatalf("expected %d-pair map, got null map", len(h.Map)) - } - if len(hs.Map) != len(h.Map) { - t.Fatalf("expected %d-pair map, got len(map)=%d", len(h.Map), len(hs.Map)) - } - - for key, val := range hs.Map { - otherval, found := h.Map[key] - if !found { - t.Fatalf(" key '%v' not found in %d-pair map", key, len(h.Map)) - } - if otherval.Valid != val.Valid { - t.Fatalf(" value %v <> %v in %d-pair map", otherval, val, len(h.Map)) - } - if otherval.String != val.String { - t.Fatalf(" value '%v' <> '%v' in %d-pair map", otherval.String, val.String, len(h.Map)) - } - } - } - - testBidirectional(hsOnePair) - testBidirectional(hsThreePairs) - testBidirectional(hsSmorgasbord) -} diff --git a/vendor/github.com/lib/pq/notify_test.go b/vendor/github.com/lib/pq/notify_test.go deleted file mode 100644 index fe8941a4e0..0000000000 --- a/vendor/github.com/lib/pq/notify_test.go +++ /dev/null @@ -1,574 +0,0 @@ -package pq - -import ( - "errors" - "fmt" - "io" - "os" - "runtime" - "sync" - "sync/atomic" - "testing" - "time" -) - -var errNilNotification = errors.New("nil notification") - -func expectNotification(t *testing.T, ch <-chan *Notification, relname string, extra string) error { - select { - case n := <-ch: - if n == nil { - return errNilNotification - } - if n.Channel != relname || n.Extra != extra { - return fmt.Errorf("unexpected notification %v", n) - } - return nil - case <-time.After(1500 * time.Millisecond): - return fmt.Errorf("timeout") - } -} - -func expectNoNotification(t *testing.T, ch <-chan *Notification) error { - select { - case n := <-ch: - return fmt.Errorf("unexpected notification %v", n) - case <-time.After(100 * time.Millisecond): - return nil - } -} - -func expectEvent(t *testing.T, eventch <-chan ListenerEventType, et ListenerEventType) error { - select { - case e := <-eventch: - if e != et { - return fmt.Errorf("unexpected event %v", e) - } - return nil - case <-time.After(1500 * time.Millisecond): - panic("expectEvent timeout") - } -} - -func expectNoEvent(t *testing.T, eventch <-chan ListenerEventType) error { - select { - case e := <-eventch: - return fmt.Errorf("unexpected event %v", e) - case <-time.After(100 * time.Millisecond): - return nil - } -} - -func newTestListenerConn(t *testing.T) (*ListenerConn, <-chan *Notification) { - datname := os.Getenv("PGDATABASE") - sslmode := os.Getenv("PGSSLMODE") - - if datname == "" { - os.Setenv("PGDATABASE", "pqgotest") - } - - if sslmode == "" { - os.Setenv("PGSSLMODE", "disable") - } - - notificationChan := make(chan *Notification) - l, err := NewListenerConn("", notificationChan) - if err != nil { - t.Fatal(err) - } - - return l, notificationChan -} - -func TestNewListenerConn(t *testing.T) { - l, _ := newTestListenerConn(t) - - defer l.Close() -} - -func TestConnListen(t *testing.T) { - l, channel := newTestListenerConn(t) - - defer l.Close() - - db := openTestConn(t) - defer db.Close() - - ok, err := l.Listen("notify_test") - if !ok || err != nil { - t.Fatal(err) - } - - _, err = db.Exec("NOTIFY notify_test") - if err != nil { - t.Fatal(err) - } - - err = expectNotification(t, channel, "notify_test", "") - if err != nil { - t.Fatal(err) - } -} - -func TestConnUnlisten(t *testing.T) { - l, channel := newTestListenerConn(t) - - defer l.Close() - - db := openTestConn(t) - defer db.Close() - - ok, err := l.Listen("notify_test") - if !ok || err != nil { - t.Fatal(err) - } - - _, err = db.Exec("NOTIFY notify_test") - - err = expectNotification(t, channel, "notify_test", "") - if err != nil { - t.Fatal(err) - } - - ok, err = l.Unlisten("notify_test") - if !ok || err != nil { - t.Fatal(err) - } - - _, err = db.Exec("NOTIFY notify_test") - if err != nil { - t.Fatal(err) - } - - err = expectNoNotification(t, channel) - if err != nil { - t.Fatal(err) - } -} - -func TestConnUnlistenAll(t *testing.T) { - l, channel := newTestListenerConn(t) - - defer l.Close() - - db := openTestConn(t) - defer db.Close() - - ok, err := l.Listen("notify_test") - if !ok || err != nil { - t.Fatal(err) - } - - _, err = db.Exec("NOTIFY notify_test") - - err = expectNotification(t, channel, "notify_test", "") - if err != nil { - t.Fatal(err) - } - - ok, err = l.UnlistenAll() - if !ok || err != nil { - t.Fatal(err) - } - - _, err = db.Exec("NOTIFY notify_test") - if err != nil { - t.Fatal(err) - } - - err = expectNoNotification(t, channel) - if err != nil { - t.Fatal(err) - } -} - -func TestConnClose(t *testing.T) { - l, _ := newTestListenerConn(t) - defer l.Close() - - err := l.Close() - if err != nil { - t.Fatal(err) - } - err = l.Close() - if err != errListenerConnClosed { - t.Fatalf("expected errListenerConnClosed; got %v", err) - } -} - -func TestConnPing(t *testing.T) { - l, _ := newTestListenerConn(t) - defer l.Close() - err := l.Ping() - if err != nil { - t.Fatal(err) - } - err = l.Close() - if err != nil { - t.Fatal(err) - } - err = l.Ping() - if err != errListenerConnClosed { - t.Fatalf("expected errListenerConnClosed; got %v", err) - } -} - -// Test for deadlock where a query fails while another one is queued -func TestConnExecDeadlock(t *testing.T) { - l, _ := newTestListenerConn(t) - defer l.Close() - - var wg sync.WaitGroup - wg.Add(2) - - go func() { - l.ExecSimpleQuery("SELECT pg_sleep(60)") - wg.Done() - }() - runtime.Gosched() - go func() { - l.ExecSimpleQuery("SELECT 1") - wg.Done() - }() - // give the two goroutines some time to get into position - runtime.Gosched() - // calls Close on the net.Conn; equivalent to a network failure - l.Close() - - var done int32 = 0 - go func() { - time.Sleep(10 * time.Second) - if atomic.LoadInt32(&done) != 1 { - panic("timed out") - } - }() - wg.Wait() - atomic.StoreInt32(&done, 1) -} - -// Test for ListenerConn being closed while a slow query is executing -func TestListenerConnCloseWhileQueryIsExecuting(t *testing.T) { - l, _ := newTestListenerConn(t) - defer l.Close() - - var wg sync.WaitGroup - wg.Add(1) - - go func() { - sent, err := l.ExecSimpleQuery("SELECT pg_sleep(60)") - if sent { - panic("expected sent=false") - } - // could be any of a number of errors - if err == nil { - panic("expected error") - } - wg.Done() - }() - // give the above goroutine some time to get into position - runtime.Gosched() - err := l.Close() - if err != nil { - t.Fatal(err) - } - var done int32 = 0 - go func() { - time.Sleep(10 * time.Second) - if atomic.LoadInt32(&done) != 1 { - panic("timed out") - } - }() - wg.Wait() - atomic.StoreInt32(&done, 1) -} - -func TestNotifyExtra(t *testing.T) { - db := openTestConn(t) - defer db.Close() - - if getServerVersion(t, db) < 90000 { - t.Skip("skipping NOTIFY payload test since the server does not appear to support it") - } - - l, channel := newTestListenerConn(t) - defer l.Close() - - ok, err := l.Listen("notify_test") - if !ok || err != nil { - t.Fatal(err) - } - - _, err = db.Exec("NOTIFY notify_test, 'something'") - if err != nil { - t.Fatal(err) - } - - err = expectNotification(t, channel, "notify_test", "something") - if err != nil { - t.Fatal(err) - } -} - -// create a new test listener and also set the timeouts -func newTestListenerTimeout(t *testing.T, min time.Duration, max time.Duration) (*Listener, <-chan ListenerEventType) { - datname := os.Getenv("PGDATABASE") - sslmode := os.Getenv("PGSSLMODE") - - if datname == "" { - os.Setenv("PGDATABASE", "pqgotest") - } - - if sslmode == "" { - os.Setenv("PGSSLMODE", "disable") - } - - eventch := make(chan ListenerEventType, 16) - l := NewListener("", min, max, func(t ListenerEventType, err error) { eventch <- t }) - err := expectEvent(t, eventch, ListenerEventConnected) - if err != nil { - t.Fatal(err) - } - return l, eventch -} - -func newTestListener(t *testing.T) (*Listener, <-chan ListenerEventType) { - return newTestListenerTimeout(t, time.Hour, time.Hour) -} - -func TestListenerListen(t *testing.T) { - l, _ := newTestListener(t) - defer l.Close() - - db := openTestConn(t) - defer db.Close() - - err := l.Listen("notify_listen_test") - if err != nil { - t.Fatal(err) - } - - _, err = db.Exec("NOTIFY notify_listen_test") - if err != nil { - t.Fatal(err) - } - - err = expectNotification(t, l.Notify, "notify_listen_test", "") - if err != nil { - t.Fatal(err) - } -} - -func TestListenerUnlisten(t *testing.T) { - l, _ := newTestListener(t) - defer l.Close() - - db := openTestConn(t) - defer db.Close() - - err := l.Listen("notify_listen_test") - if err != nil { - t.Fatal(err) - } - - _, err = db.Exec("NOTIFY notify_listen_test") - if err != nil { - t.Fatal(err) - } - - err = l.Unlisten("notify_listen_test") - if err != nil { - t.Fatal(err) - } - - err = expectNotification(t, l.Notify, "notify_listen_test", "") - if err != nil { - t.Fatal(err) - } - - _, err = db.Exec("NOTIFY notify_listen_test") - if err != nil { - t.Fatal(err) - } - - err = expectNoNotification(t, l.Notify) - if err != nil { - t.Fatal(err) - } -} - -func TestListenerUnlistenAll(t *testing.T) { - l, _ := newTestListener(t) - defer l.Close() - - db := openTestConn(t) - defer db.Close() - - err := l.Listen("notify_listen_test") - if err != nil { - t.Fatal(err) - } - - _, err = db.Exec("NOTIFY notify_listen_test") - if err != nil { - t.Fatal(err) - } - - err = l.UnlistenAll() - if err != nil { - t.Fatal(err) - } - - err = expectNotification(t, l.Notify, "notify_listen_test", "") - if err != nil { - t.Fatal(err) - } - - _, err = db.Exec("NOTIFY notify_listen_test") - if err != nil { - t.Fatal(err) - } - - err = expectNoNotification(t, l.Notify) - if err != nil { - t.Fatal(err) - } -} - -func TestListenerFailedQuery(t *testing.T) { - l, eventch := newTestListener(t) - defer l.Close() - - db := openTestConn(t) - defer db.Close() - - err := l.Listen("notify_listen_test") - if err != nil { - t.Fatal(err) - } - - _, err = db.Exec("NOTIFY notify_listen_test") - if err != nil { - t.Fatal(err) - } - - err = expectNotification(t, l.Notify, "notify_listen_test", "") - if err != nil { - t.Fatal(err) - } - - // shouldn't cause a disconnect - ok, err := l.cn.ExecSimpleQuery("SELECT error") - if !ok { - t.Fatalf("could not send query to server: %v", err) - } - _, ok = err.(PGError) - if !ok { - t.Fatalf("unexpected error %v", err) - } - err = expectNoEvent(t, eventch) - if err != nil { - t.Fatal(err) - } - - // should still work - _, err = db.Exec("NOTIFY notify_listen_test") - if err != nil { - t.Fatal(err) - } - - err = expectNotification(t, l.Notify, "notify_listen_test", "") - if err != nil { - t.Fatal(err) - } -} - -func TestListenerReconnect(t *testing.T) { - l, eventch := newTestListenerTimeout(t, 20*time.Millisecond, time.Hour) - defer l.Close() - - db := openTestConn(t) - defer db.Close() - - err := l.Listen("notify_listen_test") - if err != nil { - t.Fatal(err) - } - - _, err = db.Exec("NOTIFY notify_listen_test") - if err != nil { - t.Fatal(err) - } - - err = expectNotification(t, l.Notify, "notify_listen_test", "") - if err != nil { - t.Fatal(err) - } - - // kill the connection and make sure it comes back up - ok, err := l.cn.ExecSimpleQuery("SELECT pg_terminate_backend(pg_backend_pid())") - if ok { - t.Fatalf("could not kill the connection: %v", err) - } - if err != io.EOF { - t.Fatalf("unexpected error %v", err) - } - err = expectEvent(t, eventch, ListenerEventDisconnected) - if err != nil { - t.Fatal(err) - } - err = expectEvent(t, eventch, ListenerEventReconnected) - if err != nil { - t.Fatal(err) - } - - // should still work - _, err = db.Exec("NOTIFY notify_listen_test") - if err != nil { - t.Fatal(err) - } - - // should get nil after Reconnected - err = expectNotification(t, l.Notify, "", "") - if err != errNilNotification { - t.Fatal(err) - } - - err = expectNotification(t, l.Notify, "notify_listen_test", "") - if err != nil { - t.Fatal(err) - } -} - -func TestListenerClose(t *testing.T) { - l, _ := newTestListenerTimeout(t, 20*time.Millisecond, time.Hour) - defer l.Close() - - err := l.Close() - if err != nil { - t.Fatal(err) - } - err = l.Close() - if err != errListenerClosed { - t.Fatalf("expected errListenerClosed; got %v", err) - } -} - -func TestListenerPing(t *testing.T) { - l, _ := newTestListenerTimeout(t, 20*time.Millisecond, time.Hour) - defer l.Close() - - err := l.Ping() - if err != nil { - t.Fatal(err) - } - - err = l.Close() - if err != nil { - t.Fatal(err) - } - - err = l.Ping() - if err != errListenerClosed { - t.Fatalf("expected errListenerClosed; got %v", err) - } -} diff --git a/vendor/github.com/lib/pq/ssl_test.go b/vendor/github.com/lib/pq/ssl_test.go deleted file mode 100644 index 932b336f53..0000000000 --- a/vendor/github.com/lib/pq/ssl_test.go +++ /dev/null @@ -1,226 +0,0 @@ -package pq - -// This file contains SSL tests - -import ( - _ "crypto/sha256" - "crypto/x509" - "database/sql" - "fmt" - "os" - "path/filepath" - "testing" -) - -func maybeSkipSSLTests(t *testing.T) { - // Require some special variables for testing certificates - if os.Getenv("PQSSLCERTTEST_PATH") == "" { - t.Skip("PQSSLCERTTEST_PATH not set, skipping SSL tests") - } - - value := os.Getenv("PQGOSSLTESTS") - if value == "" || value == "0" { - t.Skip("PQGOSSLTESTS not enabled, skipping SSL tests") - } else if value != "1" { - t.Fatalf("unexpected value %q for PQGOSSLTESTS", value) - } -} - -func openSSLConn(t *testing.T, conninfo string) (*sql.DB, error) { - db, err := openTestConnConninfo(conninfo) - if err != nil { - // should never fail - t.Fatal(err) - } - // Do something with the connection to see whether it's working or not. - tx, err := db.Begin() - if err == nil { - return db, tx.Rollback() - } - _ = db.Close() - return nil, err -} - -func checkSSLSetup(t *testing.T, conninfo string) { - db, err := openSSLConn(t, conninfo) - if err == nil { - db.Close() - t.Fatalf("expected error with conninfo=%q", conninfo) - } -} - -// Connect over SSL and run a simple query to test the basics -func TestSSLConnection(t *testing.T) { - maybeSkipSSLTests(t) - // Environment sanity check: should fail without SSL - checkSSLSetup(t, "sslmode=disable user=pqgossltest") - - db, err := openSSLConn(t, "sslmode=require user=pqgossltest") - if err != nil { - t.Fatal(err) - } - rows, err := db.Query("SELECT 1") - if err != nil { - t.Fatal(err) - } - rows.Close() -} - -// Test sslmode=verify-full -func TestSSLVerifyFull(t *testing.T) { - maybeSkipSSLTests(t) - // Environment sanity check: should fail without SSL - checkSSLSetup(t, "sslmode=disable user=pqgossltest") - - // Not OK according to the system CA - _, err := openSSLConn(t, "host=postgres sslmode=verify-full user=pqgossltest") - if err == nil { - t.Fatal("expected error") - } - _, ok := err.(x509.UnknownAuthorityError) - if !ok { - t.Fatalf("expected x509.UnknownAuthorityError, got %#+v", err) - } - - rootCertPath := filepath.Join(os.Getenv("PQSSLCERTTEST_PATH"), "root.crt") - rootCert := "sslrootcert=" + rootCertPath + " " - // No match on Common Name - _, err = openSSLConn(t, rootCert+"host=127.0.0.1 sslmode=verify-full user=pqgossltest") - if err == nil { - t.Fatal("expected error") - } - _, ok = err.(x509.HostnameError) - if !ok { - t.Fatalf("expected x509.HostnameError, got %#+v", err) - } - // OK - _, err = openSSLConn(t, rootCert+"host=postgres sslmode=verify-full user=pqgossltest") - if err != nil { - t.Fatal(err) - } -} - -// Test sslmode=verify-ca -func TestSSLVerifyCA(t *testing.T) { - maybeSkipSSLTests(t) - // Environment sanity check: should fail without SSL - checkSSLSetup(t, "sslmode=disable user=pqgossltest") - - // Not OK according to the system CA - _, err := openSSLConn(t, "host=postgres sslmode=verify-ca user=pqgossltest") - if err == nil { - t.Fatal("expected error") - } - _, ok := err.(x509.UnknownAuthorityError) - if !ok { - t.Fatalf("expected x509.UnknownAuthorityError, got %#+v", err) - } - - rootCertPath := filepath.Join(os.Getenv("PQSSLCERTTEST_PATH"), "root.crt") - rootCert := "sslrootcert=" + rootCertPath + " " - // No match on Common Name, but that's OK - _, err = openSSLConn(t, rootCert+"host=127.0.0.1 sslmode=verify-ca user=pqgossltest") - if err != nil { - t.Fatal(err) - } - // Everything OK - _, err = openSSLConn(t, rootCert+"host=postgres sslmode=verify-ca user=pqgossltest") - if err != nil { - t.Fatal(err) - } -} - -func getCertConninfo(t *testing.T, source string) string { - var sslkey string - var sslcert string - - certpath := os.Getenv("PQSSLCERTTEST_PATH") - - switch source { - case "missingkey": - sslkey = "/tmp/filedoesnotexist" - sslcert = filepath.Join(certpath, "postgresql.crt") - case "missingcert": - sslkey = filepath.Join(certpath, "postgresql.key") - sslcert = "/tmp/filedoesnotexist" - case "certtwice": - sslkey = filepath.Join(certpath, "postgresql.crt") - sslcert = filepath.Join(certpath, "postgresql.crt") - case "valid": - sslkey = filepath.Join(certpath, "postgresql.key") - sslcert = filepath.Join(certpath, "postgresql.crt") - default: - t.Fatalf("invalid source %q", source) - } - return fmt.Sprintf("sslmode=require user=pqgosslcert sslkey=%s sslcert=%s", sslkey, sslcert) -} - -// Authenticate over SSL using client certificates -func TestSSLClientCertificates(t *testing.T) { - maybeSkipSSLTests(t) - // Environment sanity check: should fail without SSL - checkSSLSetup(t, "sslmode=disable user=pqgossltest") - - // Should also fail without a valid certificate - db, err := openSSLConn(t, "sslmode=require user=pqgosslcert") - if err == nil { - db.Close() - t.Fatal("expected error") - } - pge, ok := err.(*Error) - if !ok { - t.Fatal("expected pq.Error") - } - if pge.Code.Name() != "invalid_authorization_specification" { - t.Fatalf("unexpected error code %q", pge.Code.Name()) - } - - // Should work - db, err = openSSLConn(t, getCertConninfo(t, "valid")) - if err != nil { - t.Fatal(err) - } - rows, err := db.Query("SELECT 1") - if err != nil { - t.Fatal(err) - } - rows.Close() -} - -// Test errors with ssl certificates -func TestSSLClientCertificatesMissingFiles(t *testing.T) { - maybeSkipSSLTests(t) - // Environment sanity check: should fail without SSL - checkSSLSetup(t, "sslmode=disable user=pqgossltest") - - // Key missing, should fail - _, err := openSSLConn(t, getCertConninfo(t, "missingkey")) - if err == nil { - t.Fatal("expected error") - } - // should be a PathError - _, ok := err.(*os.PathError) - if !ok { - t.Fatalf("expected PathError, got %#+v", err) - } - - // Cert missing, should fail - _, err = openSSLConn(t, getCertConninfo(t, "missingcert")) - if err == nil { - t.Fatal("expected error") - } - // should be a PathError - _, ok = err.(*os.PathError) - if !ok { - t.Fatalf("expected PathError, got %#+v", err) - } - - // Key has wrong permissions, should fail - _, err = openSSLConn(t, getCertConninfo(t, "certtwice")) - if err == nil { - t.Fatal("expected error") - } - if err != ErrSSLKeyHasWorldPermissions { - t.Fatalf("expected ErrSSLKeyHasWorldPermissions, got %#+v", err) - } -} diff --git a/vendor/github.com/lib/pq/url_test.go b/vendor/github.com/lib/pq/url_test.go deleted file mode 100644 index 29f4a7c751..0000000000 --- a/vendor/github.com/lib/pq/url_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package pq - -import ( - "testing" -) - -func TestSimpleParseURL(t *testing.T) { - expected := "host=hostname.remote" - str, err := ParseURL("postgres://hostname.remote") - if err != nil { - t.Fatal(err) - } - - if str != expected { - t.Fatalf("unexpected result from ParseURL:\n+ %v\n- %v", str, expected) - } -} - -func TestFullParseURL(t *testing.T) { - expected := `dbname=database host=hostname.remote password=top\ secret port=1234 user=username` - str, err := ParseURL("postgres://username:top%20secret@hostname.remote:1234/database") - if err != nil { - t.Fatal(err) - } - - if str != expected { - t.Fatalf("unexpected result from ParseURL:\n+ %s\n- %s", str, expected) - } -} - -func TestInvalidProtocolParseURL(t *testing.T) { - _, err := ParseURL("http://hostname.remote") - switch err { - case nil: - t.Fatal("Expected an error from parsing invalid protocol") - default: - msg := "invalid connection protocol: http" - if err.Error() != msg { - t.Fatalf("Unexpected error message:\n+ %s\n- %s", - err.Error(), msg) - } - } -} - -func TestMinimalURL(t *testing.T) { - cs, err := ParseURL("postgres://") - if err != nil { - t.Fatal(err) - } - - if cs != "" { - t.Fatalf("expected blank connection string, got: %q", cs) - } -} diff --git a/vendor/github.com/vmware/govmomi/object/folder_test.go b/vendor/github.com/lusis/go-artifactory/LICENSE similarity index 77% rename from vendor/github.com/vmware/govmomi/object/folder_test.go rename to vendor/github.com/lusis/go-artifactory/LICENSE index 4423961f74..7c588406b0 100644 --- a/vendor/github.com/vmware/govmomi/object/folder_test.go +++ b/vendor/github.com/lusis/go-artifactory/LICENSE @@ -1,5 +1,6 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. +Apache License, Version 2.0 + +Copyright (c) 2016 John E. Vincent Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -12,9 +13,3 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -*/ - -package object - -// Folder should implement the Reference interface. -var _ Reference = Folder{} diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/api_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/api_test.go deleted file mode 100644 index a60755a8b0..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/api_test.go +++ /dev/null @@ -1 +0,0 @@ -package artifactory diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/archive_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/archive_test.go deleted file mode 100644 index a60755a8b0..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/archive_test.go +++ /dev/null @@ -1 +0,0 @@ -package artifactory diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/artifact_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/artifact_test.go deleted file mode 100644 index a60755a8b0..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/artifact_test.go +++ /dev/null @@ -1 +0,0 @@ -package artifactory diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/bintray_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/bintray_test.go deleted file mode 100644 index a60755a8b0..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/bintray_test.go +++ /dev/null @@ -1 +0,0 @@ -package artifactory diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/build_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/build_test.go deleted file mode 100644 index a60755a8b0..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/build_test.go +++ /dev/null @@ -1 +0,0 @@ -package artifactory diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/client_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/client_test.go deleted file mode 100644 index cfe421c76a..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/client_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package artifactory - -import ( - "fmt" - "github.com/stretchr/testify/assert" - _ "io/ioutil" - "net/http" - "net/http/httptest" - "net/url" - _ "os" - "testing" -) - -func TestNewClientCustomTransport(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(200) - w.Header().Set("Content-Type", "application/json") - fmt.Fprint(w, "pong") - })) - transport := &http.Transport{ - Proxy: func(req *http.Request) (*url.URL, error) { - return url.Parse(server.URL) - }, - } - defer server.Close() - conf := &ClientConfig{ - BaseURL: "http://127.0.0.1:8080/", - Username: "username", - Password: "password", - VerifySSL: false, - Transport: transport, - } - - client := NewClient(conf) - res, err := client.Get("/ping", make(map[string]string)) - assert.Nil(t, err, "should not return an error") - assert.Equal(t, "pong", string(res), "should return the testmsg") -} diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/compliance_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/compliance_test.go deleted file mode 100644 index a60755a8b0..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/compliance_test.go +++ /dev/null @@ -1 +0,0 @@ -package artifactory diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/groups_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/groups_test.go deleted file mode 100644 index 0b3868e05f..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/groups_test.go +++ /dev/null @@ -1,158 +0,0 @@ -package artifactory - -import ( - "bytes" - "fmt" - "github.com/stretchr/testify/assert" - "io/ioutil" - "net/http" - "net/http/httptest" - "net/url" - "os" - "testing" -) - -func TestGetGroups(t *testing.T) { - responseFile, err := os.Open("assets/test/groups.json") - if err != nil { - t.Fatalf("Unable to read test data: %s", err.Error()) - } - defer responseFile.Close() - responseBody, _ := ioutil.ReadAll(responseFile) - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(200) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, string(responseBody)) - })) - defer server.Close() - - transport := &http.Transport{ - Proxy: func(req *http.Request) (*url.URL, error) { - return url.Parse(server.URL) - }, - } - - conf := &ClientConfig{ - BaseURL: "http://127.0.0.1:8080/", - Username: "username", - Password: "password", - VerifySSL: false, - Transport: transport, - } - - client := NewClient(conf) - groups, err := client.GetGroups() - assert.NoError(t, err, "should not return an error") - assert.Len(t, groups, 5, "should have five groups") - assert.Equal(t, groups[0].Name, "administrators", "Should have the administrators group") - assert.Equal(t, groups[0].Uri, "https://artifactory/artifactory/api/security/groups/administrators", "should have a uri") - for _, g := range groups { - assert.NotNil(t, g.Name, "Name should not be empty") - assert.NotNil(t, g.Uri, "Uri should not be empty") - } -} - -func TestGetGroupDetails(t *testing.T) { - responseFile, err := os.Open("assets/test/single_group.json") - if err != nil { - t.Fatalf("Unable to read test data: %s", err.Error()) - } - defer responseFile.Close() - responseBody, _ := ioutil.ReadAll(responseFile) - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(200) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, string(responseBody)) - })) - defer server.Close() - - transport := &http.Transport{ - Proxy: func(req *http.Request) (*url.URL, error) { - return url.Parse(server.URL) - }, - } - - conf := &ClientConfig{ - BaseURL: "http://127.0.0.1:8080/", - Username: "username", - Password: "password", - VerifySSL: false, - Transport: transport, - } - - client := NewClient(conf) - group, err := client.GetGroupDetails("docker-readers") - assert.NoError(t, err, "should not return an error") - assert.Equal(t, group.Name, "docker-readers", "name should be docker-readers") - assert.Equal(t, group.Description, "Can read from Docker repositories", "description should match") - assert.False(t, group.AutoJoin, "autojoin should be false") - assert.Equal(t, group.Realm, "artifactory", "realm should be artifactory") -} - -func TestCreateGroupNoDetails(t *testing.T) { - var buf bytes.Buffer - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(200) - w.Header().Set("Content-Type", "application/json") - req, _ := ioutil.ReadAll(r.Body) - buf.Write(req) - fmt.Fprintf(w, "") - })) - defer server.Close() - - transport := &http.Transport{ - Proxy: func(req *http.Request) (*url.URL, error) { - return url.Parse(server.URL) - }, - } - - conf := &ClientConfig{ - BaseURL: "http://127.0.0.1:8080/", - Username: "username", - Password: "password", - VerifySSL: false, - Transport: transport, - } - - client := NewClient(conf) - var details GroupDetails = GroupDetails{} - err := client.CreateGroup("testgroup", details) - assert.NoError(t, err, "should not return an error") - assert.Equal(t, "{}", string(buf.Bytes()), "should send empty json") -} - -func TestCreateGroupDetails(t *testing.T) { - var buf bytes.Buffer - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(200) - w.Header().Set("Content-Type", "application/json") - req, _ := ioutil.ReadAll(r.Body) - buf.Write(req) - fmt.Fprintf(w, "") - })) - defer server.Close() - - transport := &http.Transport{ - Proxy: func(req *http.Request) (*url.URL, error) { - return url.Parse(server.URL) - }, - } - - conf := &ClientConfig{ - BaseURL: "http://127.0.0.1:8080/", - Username: "username", - Password: "password", - VerifySSL: false, - Transport: transport, - } - - client := NewClient(conf) - var details GroupDetails = GroupDetails{ - Description: "test group desc", - AutoJoin: true, - } - expectedJson := `{"description":"test group desc","autoJoin":true}` - err := client.CreateGroup("testgroup", details) - assert.NoError(t, err, "should not return an error") - assert.Equal(t, expectedJson, string(buf.Bytes()), "should send empty json") -} diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/http_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/http_test.go deleted file mode 100644 index a60755a8b0..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/http_test.go +++ /dev/null @@ -1 +0,0 @@ -package artifactory diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/mimetypes_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/mimetypes_test.go deleted file mode 100644 index a60755a8b0..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/mimetypes_test.go +++ /dev/null @@ -1 +0,0 @@ -package artifactory diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/permissions_targets_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/permissions_targets_test.go deleted file mode 100644 index c880f86ba2..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/permissions_targets_test.go +++ /dev/null @@ -1,99 +0,0 @@ -package artifactory - -import ( - _ "bytes" - "fmt" - "github.com/stretchr/testify/assert" - "io/ioutil" - "net/http" - "net/http/httptest" - "net/url" - "os" - "testing" -) - -func TestGetPermissions(t *testing.T) { - responseFile, err := os.Open("assets/test/permissions.json") - if err != nil { - t.Fatalf("Unable to read test data: %s", err.Error()) - } - defer responseFile.Close() - responseBody, _ := ioutil.ReadAll(responseFile) - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(200) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, string(responseBody)) - })) - defer server.Close() - - transport := &http.Transport{ - Proxy: func(req *http.Request) (*url.URL, error) { - return url.Parse(server.URL) - }, - } - - conf := &ClientConfig{ - BaseURL: "http://127.0.0.1:8080/", - Username: "username", - Password: "password", - VerifySSL: false, - Transport: transport, - } - - client := NewClient(conf) - perms, err := client.GetPermissionTargets() - assert.NoError(t, err, "should not return an error") - assert.Len(t, perms, 5, "should have five targets") - assert.Equal(t, perms[0].Name, "snapshot-write", "Should have the snapshot-write target") - assert.Equal(t, perms[0].Uri, "https://artifactory/artifactory/api/security/permissions/snapshot-write", "should have a uri") - for _, p := range perms { - assert.NotNil(t, p.Name, "Name should not be empty") - assert.NotNil(t, p.Uri, "Uri should not be empty") - } -} - -func TestGetPermissionDetails(t *testing.T) { - responseFile, err := os.Open("assets/test/permissions_details.json") - if err != nil { - t.Fatalf("Unable to read test data: %s", err.Error()) - } - defer responseFile.Close() - responseBody, _ := ioutil.ReadAll(responseFile) - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(200) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, string(responseBody)) - })) - defer server.Close() - - transport := &http.Transport{ - Proxy: func(req *http.Request) (*url.URL, error) { - return url.Parse(server.URL) - }, - } - - conf := &ClientConfig{ - BaseURL: "http://127.0.0.1:8080/", - Username: "username", - Password: "password", - VerifySSL: false, - Transport: transport, - } - - client := NewClient(conf) - perms, err := client.GetPermissionTargetDetails("release-commiter") - assert.NoError(t, err, "should not return an error") - assert.Equal(t, perms.Name, "release-commiter", "Should be release-commiter") - assert.Equal(t, perms.IncludesPattern, "**", "Includes should be **") - assert.Equal(t, perms.ExcludesPattern, "", "Excludes should be nil") - assert.Len(t, perms.Repositories, 3, "Should have 3 repositories") - assert.Contains(t, perms.Repositories, "docker-local-v2", "Should have repos") - assert.NotNil(t, perms.Principals.Groups, "should have a group principal") - groups := []string{} - for g := range perms.Principals.Groups { - groups = append(groups, g) - } - assert.Contains(t, groups, "java-committers", "Should have the java committers group") - assert.Len(t, perms.Principals.Groups["java-committers"], 4, "should have 4 permissions") - assert.Contains(t, perms.Principals.Groups["java-committers"], "r", "Should have the r permission") -} diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/repos_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/repos_test.go deleted file mode 100644 index a60755a8b0..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/repos_test.go +++ /dev/null @@ -1 +0,0 @@ -package artifactory diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/responses_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/responses_test.go deleted file mode 100644 index a60755a8b0..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/responses_test.go +++ /dev/null @@ -1 +0,0 @@ -package artifactory diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/search_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/search_test.go deleted file mode 100644 index a60755a8b0..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/search_test.go +++ /dev/null @@ -1 +0,0 @@ -package artifactory diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/security_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/security_test.go deleted file mode 100644 index a60755a8b0..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/security_test.go +++ /dev/null @@ -1 +0,0 @@ -package artifactory diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/storage_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/storage_test.go deleted file mode 100644 index a60755a8b0..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/storage_test.go +++ /dev/null @@ -1 +0,0 @@ -package artifactory diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/system_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/system_test.go deleted file mode 100644 index a60755a8b0..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/system_test.go +++ /dev/null @@ -1 +0,0 @@ -package artifactory diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/users_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/users_test.go deleted file mode 100644 index 9cc6a3560e..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/users_test.go +++ /dev/null @@ -1,188 +0,0 @@ -package artifactory - -import ( - "fmt" - "github.com/stretchr/testify/assert" - "io/ioutil" - "net/http" - "net/http/httptest" - "net/url" - "os" - "testing" -) - -func TestCreateUserFailure(t *testing.T) { - conf := &ClientConfig{ - BaseURL: "http://127.0.0.1:8080/", - Username: "username", - Password: "password", - VerifySSL: false, - } - - client := NewClient(conf) - var details UserDetails = UserDetails{} - err := client.CreateUser("testuser", details) - assert.Error(t, err, "should return an error") -} - -func TestDeleteUser(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(200) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, "") - })) - defer server.Close() - - transport := &http.Transport{ - Proxy: func(req *http.Request) (*url.URL, error) { - return url.Parse(server.URL) - }, - } - - conf := &ClientConfig{ - BaseURL: "http://127.0.0.1:8080/", - Username: "username", - Password: "password", - VerifySSL: false, - Transport: transport, - } - - client := NewClient(conf) - err := client.DeleteUser("testuser") - assert.NoError(t, err, "should not return an error") -} - -func TestCreateUser(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(200) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, "user created") - })) - defer server.Close() - - transport := &http.Transport{ - Proxy: func(req *http.Request) (*url.URL, error) { - return url.Parse(server.URL) - }, - } - - conf := &ClientConfig{ - BaseURL: "http://127.0.0.1:8080/", - Username: "username", - Password: "password", - VerifySSL: false, - Transport: transport, - } - - client := NewClient(conf) - var details UserDetails = UserDetails{ - Email: "test@test.com", - Password: "somepass", - } - err := client.CreateUser("testuser", details) - assert.NoError(t, err, "should not return an error") -} - -func TestGetUsers(t *testing.T) { - responseFile, err := os.Open("assets/test/users.json") - if err != nil { - t.Fatalf("Unable to read test data: %s", err.Error()) - } - defer responseFile.Close() - responseBody, _ := ioutil.ReadAll(responseFile) - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(200) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, string(responseBody)) - })) - defer server.Close() - - transport := &http.Transport{ - Proxy: func(req *http.Request) (*url.URL, error) { - return url.Parse(server.URL) - }, - } - - conf := &ClientConfig{ - BaseURL: "http://127.0.0.1:8080/", - Username: "username", - Password: "password", - VerifySSL: false, - Transport: transport, - } - - client := NewClient(conf) - users, err := client.GetUsers() - assert.NoError(t, err, "should not return an error") - assert.Len(t, users, 2, "should have two users") -} - -func TestGetUserDetails(t *testing.T) { - responseFile, err := os.Open("assets/test/single_user.json") - if err != nil { - t.Fatalf("Unable to read test data: %s", err.Error()) - } - defer responseFile.Close() - responseBody, _ := ioutil.ReadAll(responseFile) - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(200) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, string(responseBody)) - })) - defer server.Close() - - transport := &http.Transport{ - Proxy: func(req *http.Request) (*url.URL, error) { - return url.Parse(server.URL) - }, - } - - conf := &ClientConfig{ - BaseURL: "http://127.0.0.1:8080/", - Username: "username", - Password: "password", - VerifySSL: false, - Transport: transport, - } - - client := NewClient(conf) - user, err := client.GetUserDetails("admin") - assert.NoError(t, err, "should not return an error") - assert.Equal(t, user.Name, "admin", "name should be admin") - assert.Equal(t, user.Email, "admin@admin.com", "should have email of admin@admin.com") - assert.True(t, user.Admin, "user should be an admin") - assert.True(t, user.ProfileUpdatable, "profile updatable should be true") - assert.False(t, user.InternalPasswordDisabled, "Internal password should not be disabled") - assert.Len(t, user.Groups, 1, "User should be in one group") - assert.Equal(t, user.Groups[0], "administrators", "user should be in the administrators group") - assert.Equal(t, user.Realm, "internal", "user realm should be internal") - assert.NotNil(t, user.LastLoggedIn, "lastLoggedIn should not be empty") -} - -func TestGetUserEncryptedPassword(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(200) - w.Header().Set("Content-Type", "text/plain") - fmt.Fprintf(w, "ABCDEFGH") - })) - defer server.Close() - - transport := &http.Transport{ - Proxy: func(req *http.Request) (*url.URL, error) { - return url.Parse(server.URL) - }, - } - - conf := &ClientConfig{ - BaseURL: "http://127.0.0.1:8080/", - Username: "username", - Password: "password", - VerifySSL: false, - Transport: transport, - } - - client := NewClient(conf) - d, err := client.GetUserEncryptedPassword() - assert.NoError(t, err, "should not return an error") - assert.Equal(t, d, "ABCDEFGH", "encrypted password should be returned") -} diff --git a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/version_test.go b/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/version_test.go deleted file mode 100644 index a60755a8b0..0000000000 --- a/vendor/github.com/lusis/go-artifactory/src/artifactory.v401/version_test.go +++ /dev/null @@ -1 +0,0 @@ -package artifactory diff --git a/vendor/github.com/masterzen/simplexml/LICENSE b/vendor/github.com/masterzen/simplexml/LICENSE new file mode 100644 index 0000000000..ef51da2b0e --- /dev/null +++ b/vendor/github.com/masterzen/simplexml/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/vendor/github.com/masterzen/simplexml/dom/dom_test.go b/vendor/github.com/masterzen/simplexml/dom/dom_test.go deleted file mode 100644 index 057efc84e6..0000000000 --- a/vendor/github.com/masterzen/simplexml/dom/dom_test.go +++ /dev/null @@ -1,105 +0,0 @@ -package dom - -import ( - . "launchpad.net/gocheck" - "testing" -) - -// Hook up gocheck into the "go test" runner. -func Test(t *testing.T) { TestingT(t) } - -type DomSuite struct{} - -var _ = Suite(&DomSuite{}) - -func (s *DomSuite) TestEmptyDocument(c *C) { - doc := CreateDocument() - doc.PrettyPrint = true - c.Assert(doc.String(), Equals, "\n") -} - -func (s *DomSuite) TestOneEmptyNode(c *C) { - doc := CreateDocument() - doc.PrettyPrint = true - root := CreateElement("root") - doc.SetRoot(root) - c.Assert(doc.String(), Equals, "\n\n") -} - -func (s *DomSuite) TestMoreNodes(c *C) { - doc := CreateDocument() - doc.PrettyPrint = true - root := CreateElement("root") - node1 := CreateElement("node1") - root.AddChild(node1) - subnode := CreateElement("sub") - node1.AddChild(subnode) - node2 := CreateElement("node2") - root.AddChild(node2) - doc.SetRoot(root) - - expected := ` - - - - - - -` - - c.Assert(doc.String(), Equals, expected) -} - -func (s *DomSuite) TestAttributes(c *C) { - doc := CreateDocument() - doc.PrettyPrint = true - root := CreateElement("root") - node1 := CreateElement("node1") - node1.SetAttr("attr1", "pouet") - root.AddChild(node1) - doc.SetRoot(root) - - expected := ` - - - -` - c.Assert(doc.String(), Equals, expected) -} - -func (s *DomSuite) TestContent(c *C) { - doc := CreateDocument() - doc.PrettyPrint = true - root := CreateElement("root") - node1 := CreateElement("node1") - node1.SetContent("this is a text content") - root.AddChild(node1) - doc.SetRoot(root) - - expected := ` - - this is a text content - -` - c.Assert(doc.String(), Equals, expected) -} - -func (s *DomSuite) TestNamespace(c *C) { - doc := CreateDocument() - doc.PrettyPrint = true - root := CreateElement("root") - root.DeclareNamespace(Namespace { Prefix: "a", Uri: "http://schemas.xmlsoap.org/ws/2004/08/addressing"}) - node1 := CreateElement("node1") - root.AddChild(node1) - node1.SetNamespace("a", "http://schemas.xmlsoap.org/ws/2004/08/addressing") - node1.SetContent("this is a text content") - doc.SetRoot(root) - - expected := ` - - this is a text content - -` - c.Assert(doc.String(), Equals, expected) -} - diff --git a/vendor/github.com/masterzen/winrm/LICENSE b/vendor/github.com/masterzen/winrm/LICENSE new file mode 100644 index 0000000000..ef51da2b0e --- /dev/null +++ b/vendor/github.com/masterzen/winrm/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/vendor/github.com/masterzen/winrm/soap/header_test.go b/vendor/github.com/masterzen/winrm/soap/header_test.go deleted file mode 100644 index 82ce938706..0000000000 --- a/vendor/github.com/masterzen/winrm/soap/header_test.go +++ /dev/null @@ -1,48 +0,0 @@ -package soap - -import ( - "github.com/masterzen/simplexml/dom" - . "gopkg.in/check.v1" - "testing" -) - -// Hook up gocheck into the "go test" runner. -func Test(t *testing.T) { TestingT(t) } - -type MySuite struct{} - -var _ = Suite(&MySuite{}) - -func initDocument() (h *SoapHeader) { - doc := dom.CreateDocument() - doc.PrettyPrint = true - e := dom.CreateElement("Envelope") - doc.SetRoot(e) - AddUsualNamespaces(e) - NS_SOAP_ENV.SetTo(e) - h = &SoapHeader{message: &SoapMessage{document: doc, envelope: e}} - return -} - -func (s *MySuite) TestHeaderBuild(c *C) { - h := initDocument() - msg := h.To("http://winrm:5985/wsman").ReplyTo("http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous").MaxEnvelopeSize(153600).Id("1-2-3-4").Locale("en_US").Timeout("PT60S").Build() - - expected := ` - - - http://winrm:5985/wsman - - http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous - - 153600 - PT60S - 1-2-3-4 - - - - -` - - c.Check(msg.String(), Equals, expected) -} diff --git a/vendor/github.com/masterzen/winrm/soap/namespaces_test.go b/vendor/github.com/masterzen/winrm/soap/namespaces_test.go deleted file mode 100644 index f299de741f..0000000000 --- a/vendor/github.com/masterzen/winrm/soap/namespaces_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package soap - -import ( - "github.com/masterzen/simplexml/dom" - "testing" -) - -func TestAddUsualNamespaces(t *testing.T) { - doc := dom.CreateDocument() - root := dom.CreateElement("root") - doc.SetRoot(root) - AddUsualNamespaces(root) - - for ns := range root.DeclaredNamespaces() { - found := false - for ns2 := range MostUsed { - if ns2 == ns { - found = true - } - } - if !found { - t.Errorf("Test failed - Namespace %s not found", ns) - } - } - -} - -func TestSetTo(t *testing.T) { - doc := dom.CreateDocument() - root := dom.CreateElement("root") - doc.SetRoot(root) - NS_SOAP_ENV.SetTo(root) - - if root.String() != `` { - t.Errorf("Test failed - root has not the correct NS: %s", root.String()) - } -} diff --git a/vendor/github.com/masterzen/winrm/winrm/client_test.go b/vendor/github.com/masterzen/winrm/winrm/client_test.go deleted file mode 100644 index c0203aca68..0000000000 --- a/vendor/github.com/masterzen/winrm/winrm/client_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package winrm - -import ( - "github.com/masterzen/winrm/soap" - . "gopkg.in/check.v1" - "io/ioutil" - "net/http" - "strings" -) - -func (s *WinRMSuite) TestNewClient(c *C) { - client, err := NewClient(&Endpoint{Host: "localhost", Port: 5985}, "Administrator", "v3r1S3cre7") - - c.Assert(err, IsNil) - c.Assert(client.url, Equals, "http://localhost:5985/wsman") - c.Assert(client.username, Equals, "Administrator") - c.Assert(client.password, Equals, "v3r1S3cre7") -} - -func (s *WinRMSuite) TestClientCreateShell(c *C) { - client, err := NewClient(&Endpoint{Host: "localhost", Port: 5985}, "Administrator", "v3r1S3cre7") - c.Assert(err, IsNil) - client.http = func(client *Client, message *soap.SoapMessage) (string, error) { - c.Assert(message.String(), Contains, "http://schemas.xmlsoap.org/ws/2004/09/transfer/Create") - return createShellResponse, nil - } - - shell, _ := client.CreateShell() - c.Assert(shell.ShellId, Equals, "67A74734-DD32-4F10-89DE-49A060483810") -} - -func (s *WinRMSuite) TestReplaceTransportWithDecorator(c *C) { - var myrt rtfunc = func(req *http.Request) (*http.Response, error) { - req.Body.Close() - return &http.Response{StatusCode: 500, Body: ioutil.NopCloser(strings.NewReader("yeehaw"))}, nil - } - - params := DefaultParameters() - params.TransportDecorator = func(*http.Transport) http.RoundTripper { return myrt } - - client, err := NewClientWithParameters(&Endpoint{Host: "localhost", Port: 5985}, "Administrator", "password", params) - c.Assert(err, IsNil) - _, err = client.http(client, soap.NewMessage()) - c.Assert(err.Error(), Equals, "http error: 500 - yeehaw") -} - -type rtfunc func(*http.Request) (*http.Response, error) - -func (f rtfunc) RoundTrip(req *http.Request) (*http.Response, error) { - return f(req) -} diff --git a/vendor/github.com/masterzen/winrm/winrm/command_test.go b/vendor/github.com/masterzen/winrm/winrm/command_test.go deleted file mode 100644 index 3ee9efc9e1..0000000000 --- a/vendor/github.com/masterzen/winrm/winrm/command_test.go +++ /dev/null @@ -1,164 +0,0 @@ -package winrm - -import ( - "bytes" - "io" - "io/ioutil" - "strings" - "sync" - "time" - - "github.com/masterzen/winrm/soap" - . "gopkg.in/check.v1" -) - -func (s *WinRMSuite) TestExecuteCommand(c *C) { - client, err := NewClient(&Endpoint{Host: "localhost", Port: 5985}, "Administrator", "v3r1S3cre7") - c.Assert(err, IsNil) - - shell := &Shell{client: client, ShellId: "67A74734-DD32-4F10-89DE-49A060483810"} - count := 0 - client.http = func(client *Client, message *soap.SoapMessage) (string, error) { - switch count { - case 0: - { - c.Assert(message.String(), Contains, "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Command") - count = 1 - return executeCommandResponse, nil - } - case 1: - { - c.Assert(message.String(), Contains, "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Receive") - count = 2 - return outputResponse, nil - } - default: - { - return doneCommandResponse, nil - } - } - } - - command, _ := shell.Execute("ipconfig /all") - var stdout, stderr bytes.Buffer - var wg sync.WaitGroup - f := func(b *bytes.Buffer, r *commandReader) { - wg.Add(1) - defer wg.Done() - io.Copy(b, r) - } - go f(&stdout, command.Stdout) - go f(&stderr, command.Stderr) - command.Wait() - wg.Wait() - c.Assert(stdout.String(), Equals, "That's all folks!!!") - c.Assert(stderr.String(), Equals, "This is stderr, I'm pretty sure!") -} - -func (s *WinRMSuite) TestStdinCommand(c *C) { - client, err := NewClient(&Endpoint{Host: "localhost", Port: 5985}, "Administrator", "v3r1S3cre7") - c.Assert(err, IsNil) - - shell := &Shell{client: client, ShellId: "67A74734-DD32-4F10-89DE-49A060483810"} - count := 0 - client.http = func(client *Client, message *soap.SoapMessage) (string, error) { - if strings.Contains(message.String(), "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Send") { - c.Assert(message.String(), Contains, "c3RhbmRhcmQgaW5wdXQ=") - return "", nil - } else { - if strings.Contains(message.String(), "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Command") { - return executeCommandResponse, nil - } else if count != 1 && strings.Contains(message.String(), "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Receive") { - count = 1 - return outputResponse, nil - } else { - return doneCommandResponse, nil - } - } - } - - command, _ := shell.Execute("ipconfig /all") - command.Stdin.Write([]byte("standard input")) - // slurp output from command - var outWriter, errWriter bytes.Buffer - go io.Copy(&outWriter, command.Stdout) - go io.Copy(&errWriter, command.Stderr) - command.Wait() -} - -func (s *WinRMSuite) TestCommandExitCode(c *C) { - client, err := NewClient(&Endpoint{Host: "localhost", Port: 5985}, "Administrator", "v3r1S3cre7") - c.Assert(err, IsNil) - - shell := &Shell{client: client, ShellId: "67A74734-DD32-4F10-89DE-49A060483810"} - count := 0 - client.http = func(client *Client, message *soap.SoapMessage) (string, error) { - defer func() { count += 1 }() - switch count { - case 0: - return executeCommandResponse, nil - case 1: - return doneCommandResponse, nil - default: - c.Log("Mimicking some observed Windows behavior where only the first 'done' response has the actual exit code and 0 afterwards") - return doneCommandExitCode0Response, nil - } - } - - command, _ := shell.Execute("ipconfig /all") - - command.Wait() - <-time.After(time.Second) // to make the test fail if fetchOutput races to re-set the exit code - - c.Assert(command.ExitCode(), Equals, 123) -} - -func (s *WinRMSuite) TestCloseCommandStopsFetch(c *C) { - client, err := NewClient(&Endpoint{Host: "localhost", Port: 5985}, "Administrator", "v3r1S3cre7") - c.Assert(err, IsNil) - - shell := &Shell{client: client, ShellId: "67A74734-DD32-4F10-89DE-49A060483810"} - - http := make(chan string) - client.http = func(client *Client, message *soap.SoapMessage) (string, error) { - switch { - case strings.Contains(message.String(), "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Receive"): - c.Log("Request for command output received by server") - r := <-http - c.Log("Returning command output") - return r, nil - case strings.Contains(message.String(), "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Command"): - return executeCommandResponse, nil - case strings.Contains(message.String(), "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Signal"): - c.Log("Signal message received by server") - return "", nil // response is not used - default: - c.Logf("Unexpected message: %s", message) - return "", nil - } - } - - command, _ := shell.Execute("ipconfig /all") - // need to be reading Stdout/Stderr, otherwise, the writes to these are blocking... - go ioutil.ReadAll(command.Stdout) - go ioutil.ReadAll(command.Stderr) - - http <- outputResponse // wait for command to enter fetch/slurp - - command.Close() - - select { - case http <- outputResponse: // return to fetch from slurp - c.Log("Fetch loop 'drained' one last reponse before realizing that the command is now closed") - case <-time.After(1 * time.Second): - c.Log("no poll within one second, fetch may have stopped") - } - - select { - case http <- outputResponse: - c.Log("Fetch loop is still polling after command.Close()") - c.FailNow() - case <-time.After(1 * time.Second): - c.Log("no poll within one second, assuming fetch has stopped") - } -} diff --git a/vendor/github.com/masterzen/winrm/winrm/endpoint_test.go b/vendor/github.com/masterzen/winrm/winrm/endpoint_test.go deleted file mode 100644 index 4b5aa8bcc2..0000000000 --- a/vendor/github.com/masterzen/winrm/winrm/endpoint_test.go +++ /dev/null @@ -1,15 +0,0 @@ -package winrm - -import ( - . "gopkg.in/check.v1" -) - -func (s *WinRMSuite) TestEndpointUrlHttp(c *C) { - endpoint := &Endpoint{Host: "abc", Port: 123} - c.Assert(endpoint.url(), Equals, "http://abc:123/wsman") -} - -func (s *WinRMSuite) TestEndpointUrlHttps(c *C) { - endpoint := &Endpoint{Host: "abc", Port: 123, HTTPS: true} - c.Assert(endpoint.url(), Equals, "https://abc:123/wsman") -} diff --git a/vendor/github.com/masterzen/winrm/winrm/fixture_test.go b/vendor/github.com/masterzen/winrm/winrm/fixture_test.go deleted file mode 100644 index 95b18e4dd5..0000000000 --- a/vendor/github.com/masterzen/winrm/winrm/fixture_test.go +++ /dev/null @@ -1,87 +0,0 @@ -package winrm - -import ( - "fmt" - . "gopkg.in/check.v1" - "strings" -) - -var ( - createShellResponse = ` - - http://schemas.xmlsoap.org/ws/2004/09/transfer/CreateResponse - uuid:195078CF-804B-41F7-A246-9CB3C1A41A9A - http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous - uuid:D00059E8-57D6-4035-AD8D-3EDC495DA163 - - - - http://107.20.128.235:5985/wsman - - http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd - - 67A74734-DD32-4F10-89DE-49A060483810 - - - - - 67A74734-DD32-4F10-89DE-49A060483810 - http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd - Administrator - 213.41.177.193 - PT7200.000S - stdin - stdout - stderr - P0DT0H0M1S - P0DT0H0M1S - - - ` - - executeCommandResponse = `http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandResponseuuid:D9E108AA-E32B-45E3-8601-E9C70999D3BAhttp://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousuuid:F530804C-6D02-4FA9-AE78-1997750594BA1A6DEE6B-EC68-4DD6-87E9-030C0048ECC4` - - outputResponse = `http://schemas.microsoft.com/wbem/wsman/1/windows/shell/ReceiveResponseuuid:AAD46BD4-6315-4C3C-93D4-94A55773287Dhttp://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousuuid:18A52A06-9027-41DC-8850-3F244595AF62VGhhdCdzIGFsbCBmb2xrcyEhIQ==VGhpcyBpcyBzdGRlcnIsIEknbSBwcmV0dHkgc3VyZSE=` - - singleOutputResponse = `http://schemas.microsoft.com/wbem/wsman/1/windows/shell/ReceiveResponseuuid:AAD46BD4-6315-4C3C-93D4-94A55773287Dhttp://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousuuid:18A52A06-9027-41DC-8850-3F244595AF62VGhhdCdzIGFsbCBmb2xrcyEhIQ==` - - doneCommandResponse = `http://schemas.microsoft.com/wbem/wsman/1/windows/shell/ReceiveResponseuuid:206F8145-683D-4987-949B-E099F999F088http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousuuid:6c68191c-8385-4816-506a-0769cb9f3f4e123 - ` - doneCommandExitCode0Response = `http://schemas.microsoft.com/wbem/wsman/1/windows/shell/ReceiveResponseuuid:206F8145-683D-4987-949B-E099F999F088http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousuuid:6c68191c-8385-4816-506a-0769cb9f3f4e0` -) - -type containsChecker struct { - *CheckerInfo -} - -// The Contains checker verifies that the obtained value contains -// the expected value, according to usual Go semantics for strings.Contains. -// -// For example: -// -// c.Assert(haystack, Contains, "needle") -// -var Contains Checker = &containsChecker{ - &CheckerInfo{Name: "contains", Params: []string{"obtained", "expected"}}, -} - -func (checker *containsChecker) Check(params []interface{}, names []string) (result bool, error string) { - return matches(params[0], params[1]) -} - -func matches(haystack, needle interface{}) (result bool, error string) { - neStr, ok := needle.(string) - if !ok { - return false, "Expected value must be a string" - } - valueStr, valueIsStr := haystack.(string) - if !valueIsStr { - if valueWithStr, valueHasStr := haystack.(fmt.Stringer); valueHasStr { - valueStr, valueIsStr = valueWithStr.String(), true - } - } - if valueIsStr { - return strings.Contains(valueStr, neStr), "" - } - return false, "Obtained value is not a string and has no .String()" -} diff --git a/vendor/github.com/masterzen/winrm/winrm/http_test.go b/vendor/github.com/masterzen/winrm/winrm/http_test.go deleted file mode 100644 index 6636051b44..0000000000 --- a/vendor/github.com/masterzen/winrm/winrm/http_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package winrm - -import ( - "net" - "net/http" - "net/http/httptest" - - . "gopkg.in/check.v1" -) - -var response = ` - - http://schemas.xmlsoap.org/ws/2004/09/transfer/CreateResponse - uuid:195078CF-804B-41F7-A246-9CB3C1A41A9A - http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous - uuid:D00059E8-57D6-4035-AD8D-3EDC495DA163 - - - - http://107.20.128.235:15985/wsman - - http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd - - 67A74734-DD32-4F10-89DE-49A060483810 - - - - - 67A74734-DD32-4F10-89DE-49A060483810 - http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd - Administrator - 213.41.177.193 - PT7200.000S - stdin - stdout -stderr - P0DT0H0M1S - P0DT0H0M1S - - -` - -func (s *WinRMSuite) TestHttpRequest(c *C) { - ts := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/soap+xml") - w.Write([]byte(response)) - })) - l, err := net.Listen("tcp", "127.0.0.1:15985") - if err != nil { - c.Fatalf("Can't listen %s", err) - } - ts.Listener = l - ts.Start() - defer ts.Close() - - client, err := NewClient(&Endpoint{Host: "localhost", Port: 15985}, "test", "test") - c.Assert(err, IsNil) - shell, err := client.CreateShell() - if err != nil { - c.Fatalf("Can't create shell %s", err) - } - c.Assert(shell.ShellId, Equals, "67A74734-DD32-4F10-89DE-49A060483810") -} diff --git a/vendor/github.com/masterzen/winrm/winrm/parameters_test.go b/vendor/github.com/masterzen/winrm/winrm/parameters_test.go deleted file mode 100644 index 9b42c4eb2b..0000000000 --- a/vendor/github.com/masterzen/winrm/winrm/parameters_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package winrm - -import ( - . "gopkg.in/check.v1" -) - -func (s *WinRMSuite) TestDefaultParameters(c *C) { - params := DefaultParameters() - c.Assert(params.Locale, Equals, "en-US") - c.Assert(params.Timeout, Equals, "PT60S") - c.Assert(params.EnvelopeSize, Equals, 153600) -} - -func (s *WinRMSuite) TestParameters(c *C) { - params := NewParameters("PT120S", "fr-FR", 128) - c.Assert(params.Locale, Equals, "fr-FR") - c.Assert(params.Timeout, Equals, "PT120S") - c.Assert(params.EnvelopeSize, Equals, 128) -} diff --git a/vendor/github.com/masterzen/winrm/winrm/powershell_test.go b/vendor/github.com/masterzen/winrm/winrm/powershell_test.go deleted file mode 100644 index cb98b93fc2..0000000000 --- a/vendor/github.com/masterzen/winrm/winrm/powershell_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package winrm - -import ( - . "gopkg.in/check.v1" -) - -func (s *WinRMSuite) TestPowershell(c *C) { - psCmd := Powershell("dir") - c.Assert(psCmd, Equals, "powershell.exe -EncodedCommand ZABpAHIA") -} diff --git a/vendor/github.com/masterzen/winrm/winrm/request_test.go b/vendor/github.com/masterzen/winrm/winrm/request_test.go deleted file mode 100644 index 545ff253ec..0000000000 --- a/vendor/github.com/masterzen/winrm/winrm/request_test.go +++ /dev/null @@ -1,143 +0,0 @@ -package winrm - -import ( - "strings" - "testing" - - "github.com/masterzen/simplexml/dom" - "github.com/masterzen/winrm/soap" - "github.com/masterzen/xmlpath" - . "gopkg.in/check.v1" -) - -// Hook up gocheck into the "go test" runner. -func Test(t *testing.T) { TestingT(t) } - -type WinRMSuite struct{} - -var _ = Suite(&WinRMSuite{}) - -func (s *WinRMSuite) TestOpenShellRequest(c *C) { - openShell := NewOpenShellRequest("http://localhost", nil) - defer openShell.Free() - - assertXPath(c, openShell.Doc(), "//a:Action", "http://schemas.xmlsoap.org/ws/2004/09/transfer/Create") - assertXPath(c, openShell.Doc(), "//a:To", "http://localhost") - assertXPath(c, openShell.Doc(), "//env:Body/rsp:Shell/rsp:InputStreams", "stdin") - assertXPath(c, openShell.Doc(), "//env:Body/rsp:Shell/rsp:OutputStreams", "stdout stderr") -} - -func (s *WinRMSuite) TestDeleteShellRequest(c *C) { - request := NewDeleteShellRequest("http://localhost", "SHELLID", nil) - defer request.Free() - - assertXPath(c, request.Doc(), "//a:Action", "http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete") - assertXPath(c, request.Doc(), "//a:To", "http://localhost") - assertXPath(c, request.Doc(), "//w:Selector[@Name=\"ShellId\"]", "SHELLID") -} - -func (s *WinRMSuite) TestExecuteCommandRequest(c *C) { - request := NewExecuteCommandRequest("http://localhost", "SHELLID", "ipconfig /all", []string{}, nil) - defer request.Free() - - assertXPath(c, request.Doc(), "//a:Action", "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Command") - assertXPath(c, request.Doc(), "//a:To", "http://localhost") - assertXPath(c, request.Doc(), "//w:Selector[@Name=\"ShellId\"]", "SHELLID") - assertXPath(c, request.Doc(), "//w:Option[@Name=\"WINRS_CONSOLEMODE_STDIN\"]", "TRUE") - assertXPath(c, request.Doc(), "//rsp:CommandLine/rsp:Command", "ipconfig /all") - assertXPathNil(c, request.Doc(), "//rsp:CommandLine/rsp:Arguments") -} - -func (s *WinRMSuite) TestExecuteCommandWithArgumentsRequest(c *C) { - args := []string{"/p", "C:\\test.txt"} - request := NewExecuteCommandRequest("http://localhost", "SHELLID", "del", args, nil) - defer request.Free() - - assertXPath(c, request.Doc(), "//a:Action", "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Command") - assertXPath(c, request.Doc(), "//a:To", "http://localhost") - assertXPath(c, request.Doc(), "//w:Selector[@Name=\"ShellId\"]", "SHELLID") - assertXPath(c, request.Doc(), "//w:Option[@Name=\"WINRS_CONSOLEMODE_STDIN\"]", "TRUE") - assertXPath(c, request.Doc(), "//rsp:CommandLine/rsp:Command", "del") - assertXPath(c, request.Doc(), "//rsp:CommandLine/rsp:Arguments", "/p") - assertXPath(c, request.Doc(), "//rsp:CommandLine/rsp:Arguments", "C:\\test.txt") -} - -func (s *WinRMSuite) TestGetOutputRequest(c *C) { - request := NewGetOutputRequest("http://localhost", "SHELLID", "COMMANDID", "stdout stderr", nil) - defer request.Free() - - assertXPath(c, request.Doc(), "//a:Action", "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Receive") - assertXPath(c, request.Doc(), "//a:To", "http://localhost") - assertXPath(c, request.Doc(), "//w:Selector[@Name=\"ShellId\"]", "SHELLID") - assertXPath(c, request.Doc(), "//rsp:Receive/rsp:DesiredStream[@CommandId=\"COMMANDID\"]", "stdout stderr") -} - -func (s *WinRMSuite) TestSendInputRequest(c *C) { - request := NewSendInputRequest("http://localhost", "SHELLID", "COMMANDID", []byte{31, 32}, nil) - defer request.Free() - - assertXPath(c, request.Doc(), "//a:Action", "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Send") - assertXPath(c, request.Doc(), "//a:To", "http://localhost") - assertXPath(c, request.Doc(), "//w:Selector[@Name=\"ShellId\"]", "SHELLID") - assertXPath(c, request.Doc(), "//rsp:Send/rsp:Stream[@CommandId=\"COMMANDID\"]", "HyA=") -} - -func (s *WinRMSuite) TestSignalRequest(c *C) { - request := NewSignalRequest("http://localhost", "SHELLID", "COMMANDID", nil) - defer request.Free() - - assertXPath(c, request.Doc(), "//a:Action", "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Signal") - assertXPath(c, request.Doc(), "//a:To", "http://localhost") - assertXPath(c, request.Doc(), "//w:Selector[@Name=\"ShellId\"]", "SHELLID") - assertXPath(c, request.Doc(), "//rsp:Signal[@CommandId=\"COMMANDID\"]/rsp:Code", "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/signal/terminate") -} - -func assertXPath(c *C, doc *dom.Document, request string, expected string) { - root, path, err := parseXPath(doc, request) - - if err != nil { - c.Fatalf("Xpath %s gives error %s", request, err) - } - - ok := path.Exists(root) - c.Assert(ok, Equals, true) - - var foundValue string - iter := path.Iter(root) - for iter.Next() { - foundValue = iter.Node().String() - if foundValue == expected { - break - } - } - - if foundValue != expected { - c.Errorf("Should have found '%s', but found '%s' instead", expected, foundValue) - } -} - -func assertXPathNil(c *C, doc *dom.Document, request string) { - root, path, err := parseXPath(doc, request) - - if err != nil { - c.Fatalf("Xpath %s gives error %s", request, err) - } - - ok := path.Exists(root) - c.Assert(ok, Equals, false) -} - -func parseXPath(doc *dom.Document, request string) (*xmlpath.Node, *xmlpath.Path, error) { - content := strings.NewReader(doc.String()) - node, err := xmlpath.Parse(content) - if err != nil { - return nil, nil, err - } - - path, err := xmlpath.CompileWithNamespace(request, soap.GetAllNamespaces()) - if err != nil { - return nil, nil, err - } - - return node, path, nil -} diff --git a/vendor/github.com/masterzen/winrm/winrm/response_test.go b/vendor/github.com/masterzen/winrm/winrm/response_test.go deleted file mode 100644 index e80cb06b51..0000000000 --- a/vendor/github.com/masterzen/winrm/winrm/response_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package winrm - -import ( - "bytes" - . "gopkg.in/check.v1" -) - -func (s *WinRMSuite) TestOpenShellResponse(c *C) { - response := createShellResponse - shellId, err := ParseOpenShellResponse(response) - if err != nil { - c.Fatalf("response didn't parse: %s", err) - } - - c.Assert("67A74734-DD32-4F10-89DE-49A060483810", Equals, shellId) -} - -func (s *WinRMSuite) TestExecuteCommandResponse(c *C) { - response := executeCommandResponse - - commandId, err := ParseExecuteCommandResponse(response) - if err != nil { - c.Fatalf("response didn't parse: %s", err) - } - - c.Assert("1A6DEE6B-EC68-4DD6-87E9-030C0048ECC4", Equals, commandId) - -} - -func (s *WinRMSuite) TestSlurpOutputResponse(c *C) { - response := outputResponse - - var stdout, stderr bytes.Buffer - finished, _, err := ParseSlurpOutputErrResponse(response, &stdout, &stderr) - if err != nil { - c.Fatalf("response didn't parse: %s", err) - } - - c.Assert(finished, Equals, false) - c.Assert("That's all folks!!!", Equals, stdout.String()) - c.Assert("This is stderr, I'm pretty sure!", Equals, stderr.String()) -} - -func (s *WinRMSuite) TestSlurpOutputSingleResponse(c *C) { - response := singleOutputResponse - - var stream bytes.Buffer - finished, _, err := ParseSlurpOutputResponse(response, &stream, "stdout") - if err != nil { - c.Fatalf("response didn't parse: %s", err) - } - - c.Assert(finished, Equals, false) - c.Assert("That's all folks!!!", Equals, stream.String()) -} - -func (s *WinRMSuite) TestDoneSlurpOutputResponse(c *C) { - response := doneCommandResponse - - var stdout, stderr bytes.Buffer - finished, code, err := ParseSlurpOutputErrResponse(response, &stdout, &stderr) - if err != nil { - c.Fatalf("response didn't parse: %s", err) - } - - c.Assert(finished, Equals, true) - c.Assert(code, Equals, 123) - c.Assert("", Equals, stdout.String()) - c.Assert("", Equals, stderr.String()) -} diff --git a/vendor/github.com/masterzen/winrm/winrm/shell_test.go b/vendor/github.com/masterzen/winrm/winrm/shell_test.go deleted file mode 100644 index cbe85cc968..0000000000 --- a/vendor/github.com/masterzen/winrm/winrm/shell_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package winrm - -import ( - "github.com/masterzen/winrm/soap" - . "gopkg.in/check.v1" -) - -func (s *WinRMSuite) TestShellExecuteResponse(c *C) { - client, err := NewClient(&Endpoint{Host: "localhost", Port: 5985}, "Administrator", "v3r1S3cre7") - c.Assert(err, IsNil) - - shell := &Shell{client: client, ShellId: "67A74734-DD32-4F10-89DE-49A060483810"} - first := true - client.http = func(client *Client, message *soap.SoapMessage) (string, error) { - if first { - c.Assert(message.String(), Contains, "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Command") - first = false - return executeCommandResponse, nil - } else { - c.Assert(message.String(), Contains, "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Receive") - return outputResponse, nil - } - } - - command, _ := shell.Execute("ipconfig /all") - c.Assert(command.commandId, Equals, "1A6DEE6B-EC68-4DD6-87E9-030C0048ECC4") -} - -func (s *WinRMSuite) TestShellCloseResponse(c *C) { - client, err := NewClient(&Endpoint{Host: "localhost", Port: 5985}, "Administrator", "v3r1S3cre7") - c.Assert(err, IsNil) - - shell := &Shell{client: client, ShellId: "67A74734-DD32-4F10-89DE-49A060483810"} - client.http = func(client *Client, message *soap.SoapMessage) (string, error) { - c.Assert(message.String(), Contains, "http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete") - return "", nil - } - - shell.Close() -} diff --git a/vendor/github.com/masterzen/xmlpath/all_test.go b/vendor/github.com/masterzen/xmlpath/all_test.go deleted file mode 100644 index a487d8a1a4..0000000000 --- a/vendor/github.com/masterzen/xmlpath/all_test.go +++ /dev/null @@ -1,536 +0,0 @@ -package xmlpath_test - -import ( - "bytes" - "encoding/xml" - . "launchpad.net/gocheck" - "launchpad.net/xmlpath" - "testing" -) - -func Test(t *testing.T) { - TestingT(t) -} - -var _ = Suite(&BasicSuite{}) - -type BasicSuite struct{} - -var trivialXml = []byte(`abcdefg`) - -func (s *BasicSuite) TestRootText(c *C) { - node, err := xmlpath.Parse(bytes.NewBuffer(trivialXml)) - c.Assert(err, IsNil) - path := xmlpath.MustCompile("/") - result, ok := path.String(node) - c.Assert(ok, Equals, true) - c.Assert(result, Equals, "abcdefg") -} - -var trivialHtml = []byte(`<a>`) - -func (s *BasicSuite) TestHTML(c *C) { - node, err := xmlpath.ParseHTML(bytes.NewBuffer(trivialHtml)) - c.Assert(err, IsNil) - path := xmlpath.MustCompile("/root/foo") - result, ok := path.String(node) - c.Assert(ok, Equals, true) - c.Assert(result, Equals, "") -} - -func (s *BasicSuite) TestLibraryTable(c *C) { - node, err := xmlpath.Parse(bytes.NewBuffer(libraryXml)) - c.Assert(err, IsNil) - for _, test := range libraryTable { - cmt := Commentf("xml path: %s", test.path) - path, err := xmlpath.Compile(test.path) - if want, ok := test.result.(cerror); ok { - c.Assert(err, ErrorMatches, string(want), cmt) - c.Assert(path, IsNil, cmt) - continue - } - c.Assert(err, IsNil) - switch want := test.result.(type) { - case string: - got, ok := path.String(node) - c.Assert(ok, Equals, true, cmt) - c.Assert(got, Equals, want, cmt) - c.Assert(path.Exists(node), Equals, true, cmt) - iter := path.Iter(node) - iter.Next() - node := iter.Node() - c.Assert(node.String(), Equals, want, cmt) - c.Assert(string(node.Bytes()), Equals, want, cmt) - case []string: - var alls []string - var allb []string - iter := path.Iter(node) - for iter.Next() { - alls = append(alls, iter.Node().String()) - allb = append(allb, string(iter.Node().Bytes())) - } - c.Assert(alls, DeepEquals, want, cmt) - c.Assert(allb, DeepEquals, want, cmt) - s, sok := path.String(node) - b, bok := path.Bytes(node) - if len(want) == 0 { - c.Assert(sok, Equals, false, cmt) - c.Assert(bok, Equals, false, cmt) - c.Assert(s, Equals, "") - c.Assert(b, IsNil) - } else { - c.Assert(sok, Equals, true, cmt) - c.Assert(bok, Equals, true, cmt) - c.Assert(s, Equals, alls[0], cmt) - c.Assert(string(b), Equals, alls[0], cmt) - c.Assert(path.Exists(node), Equals, true, cmt) - } - case exists: - wantb := bool(want) - ok := path.Exists(node) - c.Assert(ok, Equals, wantb, cmt) - _, ok = path.String(node) - c.Assert(ok, Equals, wantb, cmt) - } - } -} - -type cerror string -type exists bool - -var libraryTable = []struct{ path string; result interface{} }{ - // These are the examples in the package documentation: - {"/library/book/isbn", "0836217462"}, - {"library/*/isbn", "0836217462"}, - {"/library/book/../book/./isbn", "0836217462"}, - {"/library/book/character[2]/name", "Snoopy"}, - {"/library/book/character[born='1950-10-04']/name", "Snoopy"}, - {"/library/book//node()[@id='PP']/name", "Peppermint Patty"}, - {"//book[author/@id='CMS']/title", "Being a Dog Is a Full-Time Job"}, - {"/library/book/preceding::comment()", " Great book. "}, - - // A few simple - {"/library/book/isbn", exists(true)}, - {"/library/isbn", exists(false)}, - {"/library/book/isbn/bad", exists(false)}, - {"/library/book/bad", exists(false)}, - {"/library/bad/isbn", exists(false)}, - {"/bad/book/isbn", exists(false)}, - - // Simple paths. - {"/library/book/isbn", "0836217462"}, - {"/library/book/author/name", "Charles M Schulz"}, - {"/library/book/author/born", "1922-11-26"}, - {"/library/book/character/name", "Peppermint Patty"}, - {"/library/book/character/qualification", "bold, brash and tomboyish"}, - - // Unrooted path with root node as context. - {"library/book/isbn", "0836217462"}, - - // Multiple entries from simple paths. - {"/library/book/isbn", []string{"0836217462", "0883556316"}}, - {"/library/book/character/name", []string{"Peppermint Patty", "Snoopy", "Schroeder", "Lucy", "Barney Google", "Spark Plug", "Snuffy Smith"}}, - - // Handling of wildcards. - {"/library/book/author/*", []string{"Charles M Schulz", "1922-11-26", "2000-02-12", "Charles M Schulz", "1922-11-26", "2000-02-12"}}, - - // Unsupported axis and note test. - {"/foo()", cerror(`compiling xml path "/foo\(\)":5: unsupported expression: foo\(\)`)}, - {"/foo::node()", cerror(`compiling xml path "/foo::node\(\)":6: unsupported axis: "foo"`)}, - - // The attribute axis. - {"/library/book/title/attribute::lang", "en"}, - {"/library/book/title/@lang", "en"}, - {"/library/book/@available/parent::node()/@id", "b0836217462"}, - {"/library/book/attribute::*", []string{"b0836217462", "true", "b0883556316", "true"}}, - {"/library/book/attribute::text()", cerror(`.*: text\(\) cannot succeed on axis "attribute"`)}, - - // The self axis. - {"/library/book/isbn/./self::node()", "0836217462"}, - - // The descendant axis. - {"/library/book/isbn/descendant::isbn", exists(false)}, - {"/library/descendant::isbn", []string{"0836217462", "0883556316"}}, - {"/descendant::*/isbn", []string{"0836217462", "0883556316"}}, - {"/descendant::isbn", []string{"0836217462", "0883556316"}}, - - // The descendant-or-self axis. - {"/library/book/isbn/descendant-or-self::isbn", "0836217462"}, - {"/library//isbn", []string{"0836217462", "0883556316"}}, - {"//isbn", []string{"0836217462", "0883556316"}}, - {"/descendant-or-self::node()/child::book/child::*", "0836217462"}, - - // The parent axis. - {"/library/book/isbn/../isbn/parent::node()//title", "Being a Dog Is a Full-Time Job"}, - - // The ancestor axis. - {"/library/book/isbn/ancestor::book/title", "Being a Dog Is a Full-Time Job"}, - {"/library/book/ancestor::book/title", exists(false)}, - - // The ancestor-or-self axis. - {"/library/book/isbn/ancestor-or-self::book/title", "Being a Dog Is a Full-Time Job"}, - {"/library/book/ancestor-or-self::book/title", "Being a Dog Is a Full-Time Job"}, - - // The following axis. - // The first author name must not be included, as it's within the context - // node (author) rather than following it. These queries exercise de-duping - // of nodes, since the following axis runs to the end multiple times. - {"/library/book/author/following::name", []string{"Peppermint Patty", "Snoopy", "Schroeder", "Lucy", "Charles M Schulz", "Barney Google", "Spark Plug", "Snuffy Smith"}}, - {"//following::book/author/name", []string{"Charles M Schulz", "Charles M Schulz"}}, - - // The following-sibling axis. - {"/library/book/quote/following-sibling::node()/name", []string{"Charles M Schulz", "Peppermint Patty", "Snoopy", "Schroeder", "Lucy"}}, - - // The preceding axis. - {"/library/book/author/born/preceding::name", []string{"Charles M Schulz", "Charles M Schulz", "Lucy", "Schroeder", "Snoopy", "Peppermint Patty"}}, - {"/library/book/author/born/preceding::author/name", []string{"Charles M Schulz"}}, - {"/library/book/author/born/preceding::library", exists(false)}, - - // The preceding-sibling axis. - {"/library/book/author/born/preceding-sibling::name", []string{"Charles M Schulz", "Charles M Schulz"}}, - {"/library/book/author/born/preceding::author/name", []string{"Charles M Schulz"}}, - - // Comments. - {"/library/comment()", []string{" Great book. ", " Another great book. "}}, - {"//self::comment()", []string{" Great book. ", " Another great book. "}}, - {`comment("")`, cerror(`.*: comment\(\) has no arguments`)}, - - - // Processing instructions. - {`/library/book/author/processing-instruction()`, `"go rocks"`}, - {`/library/book/author/processing-instruction("echo")`, `"go rocks"`}, - {`/library//processing-instruction("echo")`, `"go rocks"`}, - {`/library/book/author/processing-instruction("foo")`, exists(false)}, - {`/library/book/author/processing-instruction(")`, cerror(`.*: missing '"'`)}, - - // Predicates. - {"library/book[@id='b0883556316']/isbn", []string{"0883556316"}}, - {"library/book[isbn='0836217462']/character[born='1950-10-04']/name", []string{"Snoopy"}}, - {"library/book[quote]/@id", []string{"b0836217462"}}, - {"library/book[./character/born='1922-07-17']/@id", []string{"b0883556316"}}, - {"library/book[2]/isbn", []string{"0883556316"}}, - {"library/book[0]/isbn", cerror(".*: positions start at 1")}, - {"library/book[-1]/isbn", cerror(".*: positions must be positive")}, - - // Bogus expressions. - {"/foo)", cerror(`compiling xml path "/foo\)":4: unexpected '\)'`)}, -} - -var libraryXml = []byte( -` - - - - 0836217462 - Being a Dog Is a Full-Time Job - I'd dog paddle the deepest ocean. - - - Charles M Schulz - 1922-11-26 - 2000-02-12 - - - Peppermint Patty - 1966-08-22 - bold, brash and tomboyish - - - Snoopy - 1950-10-04 - extroverted beagle - - - Schroeder - 1951-05-30 - brought classical music to the Peanuts strip - - - Lucy - 1952-03-03 - bossy, crabby and selfish - - - - - 0883556316 - Barney Google and Snuffy Smith - - Charles M Schulz - 1922-11-26 - 2000-02-12 - - - Barney Google - 1919-01-01 - goggle-eyed, moustached, gloved and top-hatted, bulbous-nosed, cigar-chomping shrimp - - - Spark Plug - 1922-07-17 - brown-eyed, bow-legged nag, seldom races, patched blanket - - - Snuffy Smith - 1934-01-01 - volatile and diminutive moonshiner, ornery little cuss, sawed-off and shiftless - - - -`) - -func (s *BasicSuite) TestNamespace(c *C) { - node, err := xmlpath.Parse(bytes.NewBuffer(namespaceXml)) - c.Assert(err, IsNil) - for _, test := range namespaceTable { - cmt := Commentf("xml path: %s", test.path) - path, err := xmlpath.CompileWithNamespace(test.path, namespaces) - if want, ok := test.result.(cerror); ok { - c.Assert(err, ErrorMatches, string(want), cmt) - c.Assert(path, IsNil, cmt) - continue - } - c.Assert(err, IsNil) - switch want := test.result.(type) { - case string: - got, ok := path.String(node) - c.Assert(ok, Equals, true, cmt) - c.Assert(got, Equals, want, cmt) - c.Assert(path.Exists(node), Equals, true, cmt) - iter := path.Iter(node) - iter.Next() - node := iter.Node() - c.Assert(node.String(), Equals, want, cmt) - c.Assert(string(node.Bytes()), Equals, want, cmt) - case []string: - var alls []string - var allb []string - iter := path.Iter(node) - for iter.Next() { - alls = append(alls, iter.Node().String()) - allb = append(allb, string(iter.Node().Bytes())) - } - c.Assert(alls, DeepEquals, want, cmt) - c.Assert(allb, DeepEquals, want, cmt) - s, sok := path.String(node) - b, bok := path.Bytes(node) - if len(want) == 0 { - c.Assert(sok, Equals, false, cmt) - c.Assert(bok, Equals, false, cmt) - c.Assert(s, Equals, "") - c.Assert(b, IsNil) - } else { - c.Assert(sok, Equals, true, cmt) - c.Assert(bok, Equals, true, cmt) - c.Assert(s, Equals, alls[0], cmt) - c.Assert(string(b), Equals, alls[0], cmt) - c.Assert(path.Exists(node), Equals, true, cmt) - } - case exists: - wantb := bool(want) - ok := path.Exists(node) - c.Assert(ok, Equals, wantb, cmt) - _, ok = path.String(node) - c.Assert(ok, Equals, wantb, cmt) - } - } -} - -var namespaceXml = []byte(`http://schemas.microsoft.com/wbem/wsman/1/windows/shell/ReceiveResponseuuid:AAD46BD4-6315-4C3C-93D4-94A55773287Dhttp://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousuuid:18A52A06-9027-41DC-8850-3F244595AF62VGhhdCdzIGFsbCBmb2xrcyEhIQ==VGhpcyBpcyBzdGRlcnIsIEknbSBwcmV0dHkgc3VyZSE=`) - -var namespaces = []xmlpath.Namespace { - { "a", "http://schemas.xmlsoap.org/ws/2004/08/addressing" }, - { "rsp", "http://schemas.microsoft.com/wbem/wsman/1/windows/shell" }, -} - -var namespaceTable = []struct{ path string; result interface{} }{ - { "//a:To", "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous" }, - { "//rsp:Stream[@Name='stdout']", "VGhhdCdzIGFsbCBmb2xrcyEhIQ==" }, - { "//rsp:CommandState/@CommandId", "1A6DEE6B-EC68-4DD6-87E9-030C0048ECC4" }, - { "//*[@State='http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandState/Done']", exists(false) }, - { "//rsp:Stream", []string{ "VGhhdCdzIGFsbCBmb2xrcyEhIQ==", "VGhpcyBpcyBzdGRlcnIsIEknbSBwcmV0dHkgc3VyZSE=" }}, - { "//s:Header", cerror(`.*: unknown namespace prefix: s`) }, -} - -func (s *BasicSuite) BenchmarkParse(c *C) { - for i := 0; i < c.N; i++ { - _, err := xmlpath.Parse(bytes.NewBuffer(instancesXml)) - c.Assert(err, IsNil) - } -} - -func (s *BasicSuite) BenchmarkSimplePathCompile(c *C) { - var err error - c.ResetTimer() - for i := 0; i < c.N; i++ { - _, err = xmlpath.Compile("/DescribeInstancesResponse/reservationSet/item/groupSet/item/groupId") - } - c.StopTimer() - c.Assert(err, IsNil) -} - -func (s *BasicSuite) BenchmarkSimplePathString(c *C) { - node, err := xmlpath.Parse(bytes.NewBuffer(instancesXml)) - c.Assert(err, IsNil) - path := xmlpath.MustCompile("/DescribeInstancesResponse/reservationSet/item/instancesSet/item/instanceType") - var str string - c.ResetTimer() - for i := 0; i < c.N; i++ { - str, _ = path.String(node) - } - c.StopTimer() - c.Assert(str, Equals, "m1.small") -} - -func (s *BasicSuite) BenchmarkSimplePathStringUnmarshal(c *C) { - // For a vague comparison. - var result struct{ Str string `xml:"reservationSet>item>instancesSet>item>instanceType"` } - for i := 0; i < c.N; i++ { - xml.Unmarshal(instancesXml, &result) - } - c.StopTimer() - c.Assert(result.Str, Equals, "m1.large") -} - -func (s *BasicSuite) BenchmarkSimplePathExists(c *C) { - node, err := xmlpath.Parse(bytes.NewBuffer(instancesXml)) - c.Assert(err, IsNil) - path := xmlpath.MustCompile("/DescribeInstancesResponse/reservationSet/item/instancesSet/item/instanceType") - var exists bool - c.ResetTimer() - for i := 0; i < c.N; i++ { - exists = path.Exists(node) - } - c.StopTimer() - c.Assert(exists, Equals, true) -} - - - -var instancesXml = []byte( -` - 98e3c9a4-848c-4d6d-8e8a-b1bdEXAMPLE - - - r-b27e30d9 - 999988887777 - - - sg-67ad940e - default - - - - - i-c5cd56af - ami-1a2b3c4d - - 16 - running - - domU-12-31-39-10-56-34.compute-1.internal - ec2-174-129-165-232.compute-1.amazonaws.com - - GSG_Keypair - 0 - - m1.small - 2010-08-17T01:15:18.000Z - - us-east-1b - - - aki-94c527fd - ari-96c527ff - - disabled - - 10.198.85.190 - 174.129.165.232 - i386 - ebs - /dev/sda1 - - - /dev/sda1 - - vol-a082c1c9 - attached - 2010-08-17T01:15:21.000Z - false - - - - spot - sir-7a688402 - paravirtual - - - xen - - - 854251627541 - - - r-b67e30dd - 999988887777 - - - sg-67ad940e - default - - - - - i-d9cd56b3 - ami-1a2b3c4d - - 16 - running - - domU-12-31-39-10-54-E5.compute-1.internal - ec2-184-73-58-78.compute-1.amazonaws.com - - GSG_Keypair - 0 - - m1.large - 2010-08-17T01:15:19.000Z - - us-east-1b - - - aki-94c527fd - ari-96c527ff - - disabled - - 10.198.87.19 - 184.73.58.78 - i386 - ebs - /dev/sda1 - - - /dev/sda1 - - vol-a282c1cb - attached - 2010-08-17T01:15:23.000Z - false - - - - spot - sir-55a3aa02 - paravirtual - - - xen - - - 854251627541 - - - -`) diff --git a/vendor/github.com/mitchellh/cli/cli_test.go b/vendor/github.com/mitchellh/cli/cli_test.go deleted file mode 100644 index 8007fca179..0000000000 --- a/vendor/github.com/mitchellh/cli/cli_test.go +++ /dev/null @@ -1,443 +0,0 @@ -package cli - -import ( - "bytes" - "reflect" - "strings" - "testing" -) - -func TestCLIIsHelp(t *testing.T) { - testCases := []struct { - args []string - isHelp bool - }{ - {[]string{"-h"}, true}, - {[]string{"-help"}, true}, - {[]string{"--help"}, true}, - {[]string{"-h", "foo"}, true}, - {[]string{"foo", "bar"}, false}, - {[]string{"-v", "bar"}, false}, - {[]string{"foo", "-h"}, false}, - {[]string{"foo", "-help"}, false}, - {[]string{"foo", "--help"}, false}, - } - - for _, testCase := range testCases { - cli := &CLI{Args: testCase.args} - result := cli.IsHelp() - - if result != testCase.isHelp { - t.Errorf("Expected '%#v'. Args: %#v", testCase.isHelp, testCase.args) - } - } -} - -func TestCLIIsVersion(t *testing.T) { - testCases := []struct { - args []string - isVersion bool - }{ - {[]string{"-v"}, true}, - {[]string{"-version"}, true}, - {[]string{"--version"}, true}, - {[]string{"-v", "foo"}, true}, - {[]string{"foo", "bar"}, false}, - {[]string{"-h", "bar"}, false}, - {[]string{"foo", "-v"}, false}, - {[]string{"foo", "-version"}, false}, - {[]string{"foo", "--version"}, false}, - } - - for _, testCase := range testCases { - cli := &CLI{Args: testCase.args} - result := cli.IsVersion() - - if result != testCase.isVersion { - t.Errorf("Expected '%#v'. Args: %#v", testCase.isVersion, testCase.args) - } - } -} - -func TestCLIRun(t *testing.T) { - command := new(MockCommand) - cli := &CLI{ - Args: []string{"foo", "-bar", "-baz"}, - Commands: map[string]CommandFactory{ - "foo": func() (Command, error) { - return command, nil - }, - }, - } - - exitCode, err := cli.Run() - if err != nil { - t.Fatalf("err: %s", err) - } - - if exitCode != command.RunResult { - t.Fatalf("bad: %d", exitCode) - } - - if !command.RunCalled { - t.Fatalf("run should be called") - } - - if !reflect.DeepEqual(command.RunArgs, []string{"-bar", "-baz"}) { - t.Fatalf("bad args: %#v", command.RunArgs) - } -} - -func TestCLIRun_blank(t *testing.T) { - command := new(MockCommand) - cli := &CLI{ - Args: []string{"", "foo", "-bar", "-baz"}, - Commands: map[string]CommandFactory{ - "foo": func() (Command, error) { - return command, nil - }, - }, - } - - exitCode, err := cli.Run() - if err != nil { - t.Fatalf("err: %s", err) - } - - if exitCode != command.RunResult { - t.Fatalf("bad: %d", exitCode) - } - - if !command.RunCalled { - t.Fatalf("run should be called") - } - - if !reflect.DeepEqual(command.RunArgs, []string{"-bar", "-baz"}) { - t.Fatalf("bad args: %#v", command.RunArgs) - } -} - -func TestCLIRun_default(t *testing.T) { - commandBar := new(MockCommand) - commandBar.RunResult = 42 - - cli := &CLI{ - Args: []string{"-bar", "-baz"}, - Commands: map[string]CommandFactory{ - "": func() (Command, error) { - return commandBar, nil - }, - "foo": func() (Command, error) { - return new(MockCommand), nil - }, - }, - } - - exitCode, err := cli.Run() - if err != nil { - t.Fatalf("err: %s", err) - } - - if exitCode != commandBar.RunResult { - t.Fatalf("bad: %d", exitCode) - } - - if !commandBar.RunCalled { - t.Fatalf("run should be called") - } - - if !reflect.DeepEqual(commandBar.RunArgs, []string{"-bar", "-baz"}) { - t.Fatalf("bad args: %#v", commandBar.RunArgs) - } -} - -func TestCLIRun_nested(t *testing.T) { - command := new(MockCommand) - cli := &CLI{ - Args: []string{"foo", "bar", "-bar", "-baz"}, - Commands: map[string]CommandFactory{ - "foo": func() (Command, error) { - return new(MockCommand), nil - }, - "foo bar": func() (Command, error) { - return command, nil - }, - }, - } - - exitCode, err := cli.Run() - if err != nil { - t.Fatalf("err: %s", err) - } - - if exitCode != command.RunResult { - t.Fatalf("bad: %d", exitCode) - } - - if !command.RunCalled { - t.Fatalf("run should be called") - } - - if !reflect.DeepEqual(command.RunArgs, []string{"-bar", "-baz"}) { - t.Fatalf("bad args: %#v", command.RunArgs) - } -} - -func TestCLIRun_nestedMissingParent(t *testing.T) { - buf := new(bytes.Buffer) - cli := &CLI{ - Args: []string{"foo"}, - Commands: map[string]CommandFactory{ - "foo bar": func() (Command, error) { - return &MockCommand{SynopsisText: "hi!"}, nil - }, - }, - HelpWriter: buf, - } - - exitCode, err := cli.Run() - if err != nil { - t.Fatalf("err: %s", err) - } - - if exitCode != 1 { - t.Fatalf("bad exit code: %d", exitCode) - } - - if buf.String() != testCommandNestedMissingParent { - t.Fatalf("bad: %#v", buf.String()) - } -} - -func TestCLIRun_printHelp(t *testing.T) { - testCases := [][]string{ - {}, - {"-h"}, - {"i-dont-exist"}, - {"-bad-flag", "foo"}, - } - - for _, testCase := range testCases { - buf := new(bytes.Buffer) - helpText := "foo" - - cli := &CLI{ - Args: testCase, - Commands: map[string]CommandFactory{ - "foo": func() (Command, error) { - return new(MockCommand), nil - }, - }, - HelpFunc: func(map[string]CommandFactory) string { - return helpText - }, - HelpWriter: buf, - } - - code, err := cli.Run() - if err != nil { - t.Errorf("Args: %#v. Error: %s", testCase, err) - continue - } - - if code != 1 { - t.Errorf("Args: %#v. Code: %d", testCase, code) - continue - } - - if !strings.Contains(buf.String(), helpText) { - t.Errorf("Args: %#v. Text: %v", testCase, buf.String()) - } - } -} - -func TestCLIRun_printCommandHelp(t *testing.T) { - testCases := [][]string{ - {"--help", "foo"}, - {"-h", "foo"}, - } - - for _, args := range testCases { - command := &MockCommand{ - HelpText: "donuts", - } - - buf := new(bytes.Buffer) - cli := &CLI{ - Args: args, - Commands: map[string]CommandFactory{ - "foo": func() (Command, error) { - return command, nil - }, - }, - HelpWriter: buf, - } - - exitCode, err := cli.Run() - if err != nil { - t.Fatalf("err: %s", err) - } - - if exitCode != 1 { - t.Fatalf("bad exit code: %d", exitCode) - } - - if buf.String() != (command.HelpText + "\n") { - t.Fatalf("bad: %#v", buf.String()) - } - } -} - -func TestCLIRun_printCommandHelpSubcommands(t *testing.T) { - testCases := [][]string{ - {"--help", "foo"}, - {"-h", "foo"}, - } - - for _, args := range testCases { - command := &MockCommand{ - HelpText: "donuts", - } - - buf := new(bytes.Buffer) - cli := &CLI{ - Args: args, - Commands: map[string]CommandFactory{ - "foo": func() (Command, error) { - return command, nil - }, - "foo bar": func() (Command, error) { - return &MockCommand{SynopsisText: "hi!"}, nil - }, - "foo longer": func() (Command, error) { - return &MockCommand{SynopsisText: "hi!"}, nil - }, - }, - HelpWriter: buf, - } - - exitCode, err := cli.Run() - if err != nil { - t.Fatalf("err: %s", err) - } - - if exitCode != 1 { - t.Fatalf("bad exit code: %d", exitCode) - } - - if buf.String() != testCommandHelpSubcommandsOutput { - t.Fatalf("bad: %#v", buf.String()) - } - } -} - -func TestCLIRun_printCommandHelpTemplate(t *testing.T) { - testCases := [][]string{ - {"--help", "foo"}, - {"-h", "foo"}, - } - - for _, args := range testCases { - command := &MockCommandHelpTemplate{ - MockCommand: MockCommand{ - HelpText: "donuts", - }, - - HelpTemplateText: "hello {{.Help}}", - } - - buf := new(bytes.Buffer) - cli := &CLI{ - Args: args, - Commands: map[string]CommandFactory{ - "foo": func() (Command, error) { - return command, nil - }, - }, - HelpWriter: buf, - } - - exitCode, err := cli.Run() - if err != nil { - t.Fatalf("err: %s", err) - } - - if exitCode != 1 { - t.Fatalf("bad exit code: %d", exitCode) - } - - if buf.String() != "hello "+command.HelpText+"\n" { - t.Fatalf("bad: %#v", buf.String()) - } - } -} - -func TestCLISubcommand(t *testing.T) { - testCases := []struct { - args []string - subcommand string - }{ - {[]string{"bar"}, "bar"}, - {[]string{"foo", "-h"}, "foo"}, - {[]string{"-h", "bar"}, "bar"}, - {[]string{"foo", "bar", "-h"}, "foo"}, - } - - for _, testCase := range testCases { - cli := &CLI{Args: testCase.args} - result := cli.Subcommand() - - if result != testCase.subcommand { - t.Errorf("Expected %#v, got %#v. Args: %#v", - testCase.subcommand, result, testCase.args) - } - } -} - -func TestCLISubcommand_nested(t *testing.T) { - testCases := []struct { - args []string - subcommand string - }{ - {[]string{"bar"}, "bar"}, - {[]string{"foo", "-h"}, "foo"}, - {[]string{"-h", "bar"}, "bar"}, - {[]string{"foo", "bar", "-h"}, "foo bar"}, - {[]string{"foo", "bar", "baz", "-h"}, "foo bar"}, - {[]string{"foo", "bar", "-h", "baz"}, "foo bar"}, - } - - for _, testCase := range testCases { - cli := &CLI{ - Args: testCase.args, - Commands: map[string]CommandFactory{ - "foo bar": func() (Command, error) { - return new(MockCommand), nil - }, - }, - } - result := cli.Subcommand() - - if result != testCase.subcommand { - t.Errorf("Expected %#v, got %#v. Args: %#v", - testCase.subcommand, result, testCase.args) - } - } -} - -const testCommandNestedMissingParent = `This command is accessed by using one of the subcommands below. - -Subcommands: - - bar hi! - -` - -const testCommandHelpSubcommandsOutput = `donuts - -Subcommands: - - bar hi! - longer hi! - -` diff --git a/vendor/github.com/mitchellh/cli/command_mock_test.go b/vendor/github.com/mitchellh/cli/command_mock_test.go deleted file mode 100644 index 241f33939a..0000000000 --- a/vendor/github.com/mitchellh/cli/command_mock_test.go +++ /dev/null @@ -1,9 +0,0 @@ -package cli - -import ( - "testing" -) - -func TestMockCommand_implements(t *testing.T) { - var _ Command = new(MockCommand) -} diff --git a/vendor/github.com/mitchellh/cli/ui_colored_test.go b/vendor/github.com/mitchellh/cli/ui_colored_test.go deleted file mode 100644 index 35bbbf589a..0000000000 --- a/vendor/github.com/mitchellh/cli/ui_colored_test.go +++ /dev/null @@ -1,74 +0,0 @@ -package cli - -import ( - "testing" -) - -func TestColoredUi_impl(t *testing.T) { - var _ Ui = new(ColoredUi) -} - -func TestColoredUi_noColor(t *testing.T) { - mock := new(MockUi) - ui := &ColoredUi{ - ErrorColor: UiColorNone, - Ui: mock, - } - ui.Error("foo") - - if mock.ErrorWriter.String() != "foo\n" { - t.Fatalf("bad: %#v", mock.ErrorWriter.String()) - } -} - -func TestColoredUi_Error(t *testing.T) { - mock := new(MockUi) - ui := &ColoredUi{ - ErrorColor: UiColor{Code: 33}, - Ui: mock, - } - ui.Error("foo") - - if mock.ErrorWriter.String() != "\033[0;33mfoo\033[0m\n" { - t.Fatalf("bad: %#v", mock.ErrorWriter.String()) - } -} - -func TestColoredUi_Info(t *testing.T) { - mock := new(MockUi) - ui := &ColoredUi{ - InfoColor: UiColor{Code: 33}, - Ui: mock, - } - ui.Info("foo") - - if mock.OutputWriter.String() != "\033[0;33mfoo\033[0m\n" { - t.Fatalf("bad: %#v %#v", mock.OutputWriter.String()) - } -} - -func TestColoredUi_Output(t *testing.T) { - mock := new(MockUi) - ui := &ColoredUi{ - OutputColor: UiColor{Code: 33}, - Ui: mock, - } - ui.Output("foo") - - if mock.OutputWriter.String() != "\033[0;33mfoo\033[0m\n" { - t.Fatalf("bad: %#v %#v", mock.OutputWriter.String()) - } -} - -func TestColoredUi_Warn(t *testing.T) { - mock := new(MockUi) - ui := &ColoredUi{ - WarnColor: UiColor{Code: 33}, - Ui: mock, - } - ui.Warn("foo") - - if mock.ErrorWriter.String() != "\033[0;33mfoo\033[0m\n" { - t.Fatalf("bad: %#v %#v", mock.ErrorWriter.String()) - } -} diff --git a/vendor/github.com/mitchellh/cli/ui_concurrent_test.go b/vendor/github.com/mitchellh/cli/ui_concurrent_test.go deleted file mode 100644 index d03e498091..0000000000 --- a/vendor/github.com/mitchellh/cli/ui_concurrent_test.go +++ /dev/null @@ -1,9 +0,0 @@ -package cli - -import ( - "testing" -) - -func TestConcurrentUi_impl(t *testing.T) { - var _ Ui = new(ConcurrentUi) -} diff --git a/vendor/github.com/mitchellh/cli/ui_mock_test.go b/vendor/github.com/mitchellh/cli/ui_mock_test.go deleted file mode 100644 index 4cce0bef4a..0000000000 --- a/vendor/github.com/mitchellh/cli/ui_mock_test.go +++ /dev/null @@ -1,9 +0,0 @@ -package cli - -import ( - "testing" -) - -func TestMockUi_implements(t *testing.T) { - var _ Ui = new(MockUi) -} diff --git a/vendor/github.com/mitchellh/cli/ui_test.go b/vendor/github.com/mitchellh/cli/ui_test.go deleted file mode 100644 index ac795ba847..0000000000 --- a/vendor/github.com/mitchellh/cli/ui_test.go +++ /dev/null @@ -1,162 +0,0 @@ -package cli - -import ( - "bytes" - "io" - "testing" -) - -func TestBasicUi_implements(t *testing.T) { - var _ Ui = new(BasicUi) -} - -func TestBasicUi_Ask(t *testing.T) { - in_r, in_w := io.Pipe() - defer in_r.Close() - defer in_w.Close() - - writer := new(bytes.Buffer) - ui := &BasicUi{ - Reader: in_r, - Writer: writer, - } - - go in_w.Write([]byte("foo bar\nbaz\n")) - - result, err := ui.Ask("Name?") - if err != nil { - t.Fatalf("err: %s", err) - } - - if writer.String() != "Name? " { - t.Fatalf("bad: %#v", writer.String()) - } - - if result != "foo bar" { - t.Fatalf("bad: %#v", result) - } -} - -func TestBasicUi_AskSecret(t *testing.T) { - in_r, in_w := io.Pipe() - defer in_r.Close() - defer in_w.Close() - - writer := new(bytes.Buffer) - ui := &BasicUi{ - Reader: in_r, - Writer: writer, - } - - go in_w.Write([]byte("foo bar\nbaz\n")) - - result, err := ui.AskSecret("Name?") - if err != nil { - t.Fatalf("err: %s", err) - } - - if writer.String() != "Name? " { - t.Fatalf("bad: %#v", writer.String()) - } - - if result != "foo bar" { - t.Fatalf("bad: %#v", result) - } -} - -func TestBasicUi_Error(t *testing.T) { - writer := new(bytes.Buffer) - ui := &BasicUi{Writer: writer} - ui.Error("HELLO") - - if writer.String() != "HELLO\n" { - t.Fatalf("bad: %s", writer.String()) - } -} - -func TestBasicUi_Error_ErrorWriter(t *testing.T) { - writer := new(bytes.Buffer) - ewriter := new(bytes.Buffer) - ui := &BasicUi{Writer: writer, ErrorWriter: ewriter} - ui.Error("HELLO") - - if ewriter.String() != "HELLO\n" { - t.Fatalf("bad: %s", ewriter.String()) - } -} - -func TestBasicUi_Output(t *testing.T) { - writer := new(bytes.Buffer) - ui := &BasicUi{Writer: writer} - ui.Output("HELLO") - - if writer.String() != "HELLO\n" { - t.Fatalf("bad: %s", writer.String()) - } -} - -func TestBasicUi_Warn(t *testing.T) { - writer := new(bytes.Buffer) - ui := &BasicUi{Writer: writer} - ui.Warn("HELLO") - - if writer.String() != "HELLO\n" { - t.Fatalf("bad: %s", writer.String()) - } -} - -func TestPrefixedUi_implements(t *testing.T) { - var _ Ui = new(PrefixedUi) -} - -func TestPrefixedUiError(t *testing.T) { - ui := new(MockUi) - p := &PrefixedUi{ - ErrorPrefix: "foo", - Ui: ui, - } - - p.Error("bar") - if ui.ErrorWriter.String() != "foobar\n" { - t.Fatalf("bad: %s", ui.ErrorWriter.String()) - } -} - -func TestPrefixedUiInfo(t *testing.T) { - ui := new(MockUi) - p := &PrefixedUi{ - InfoPrefix: "foo", - Ui: ui, - } - - p.Info("bar") - if ui.OutputWriter.String() != "foobar\n" { - t.Fatalf("bad: %s", ui.OutputWriter.String()) - } -} - -func TestPrefixedUiOutput(t *testing.T) { - ui := new(MockUi) - p := &PrefixedUi{ - OutputPrefix: "foo", - Ui: ui, - } - - p.Output("bar") - if ui.OutputWriter.String() != "foobar\n" { - t.Fatalf("bad: %s", ui.OutputWriter.String()) - } -} - -func TestPrefixedUiWarn(t *testing.T) { - ui := new(MockUi) - p := &PrefixedUi{ - WarnPrefix: "foo", - Ui: ui, - } - - p.Warn("bar") - if ui.ErrorWriter.String() != "foobar\n" { - t.Fatalf("bad: %s", ui.ErrorWriter.String()) - } -} diff --git a/vendor/github.com/mitchellh/cli/ui_writer_test.go b/vendor/github.com/mitchellh/cli/ui_writer_test.go deleted file mode 100644 index b742e93148..0000000000 --- a/vendor/github.com/mitchellh/cli/ui_writer_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package cli - -import ( - "io" - "testing" -) - -func TestUiWriter_impl(t *testing.T) { - var _ io.Writer = new(UiWriter) -} - -func TestUiWriter(t *testing.T) { - ui := new(MockUi) - w := &UiWriter{ - Ui: ui, - } - - w.Write([]byte("foo\n")) - w.Write([]byte("bar\n")) - - if ui.OutputWriter.String() != "foo\nbar\n" { - t.Fatalf("bad: %s", ui.OutputWriter.String()) - } -} - -func TestUiWriter_empty(t *testing.T) { - ui := new(MockUi) - w := &UiWriter{ - Ui: ui, - } - - w.Write([]byte("")) - - if ui.OutputWriter.String() != "\n" { - t.Fatalf("bad: %s", ui.OutputWriter.String()) - } -} diff --git a/vendor/github.com/mitchellh/colorstring/colorstring_test.go b/vendor/github.com/mitchellh/colorstring/colorstring_test.go deleted file mode 100644 index 3e76abef62..0000000000 --- a/vendor/github.com/mitchellh/colorstring/colorstring_test.go +++ /dev/null @@ -1,185 +0,0 @@ -package colorstring - -import ( - "os" - "testing" -) - -func TestColor(t *testing.T) { - cases := []struct { - Input, Output string - }{ - { - Input: "foo", - Output: "foo", - }, - - { - Input: "[blue]foo", - Output: "\033[34mfoo\033[0m", - }, - - { - Input: "foo[blue]foo", - Output: "foo\033[34mfoo\033[0m", - }, - - { - Input: "foo[what]foo", - Output: "foo[what]foo", - }, - { - Input: "foo[_blue_]foo", - Output: "foo\033[44mfoo\033[0m", - }, - { - Input: "foo[bold]foo", - Output: "foo\033[1mfoo\033[0m", - }, - { - Input: "[blue]foo[bold]bar", - Output: "\033[34mfoo\033[1mbar\033[0m", - }, - { - Input: "[underline]foo[reset]bar", - Output: "\033[4mfoo\033[0mbar\033[0m", - }, - } - - for _, tc := range cases { - actual := Color(tc.Input) - if actual != tc.Output { - t.Errorf( - "Input: %#v\n\nOutput: %#v\n\nExpected: %#v", - tc.Input, - actual, - tc.Output) - } - } -} - -func TestColorPrefix(t *testing.T) { - cases := []struct { - Input, Output string - }{ - { - Input: "foo", - Output: "", - }, - - { - Input: "[blue]foo", - Output: "[blue]", - }, - - { - Input: "[bold][blue]foo", - Output: "[bold][blue]", - }, - - { - Input: " [bold][blue]foo", - Output: "[bold][blue]", - }, - } - - for _, tc := range cases { - actual := ColorPrefix(tc.Input) - if actual != tc.Output { - t.Errorf( - "Input: %#v\n\nOutput: %#v\n\nExpected: %#v", - tc.Input, - actual, - tc.Output) - } - } -} - -func TestColorizeColor_disable(t *testing.T) { - c := def - c.Disable = true - - cases := []struct { - Input, Output string - }{ - { - "[blue]foo", - "foo", - }, - - { - "[foo]bar", - "[foo]bar", - }, - } - - for _, tc := range cases { - actual := c.Color(tc.Input) - if actual != tc.Output { - t.Errorf( - "Input: %#v\n\nOutput: %#v\n\nExpected: %#v", - tc.Input, - actual, - tc.Output) - } - } -} - -func TestColorizeColor_noReset(t *testing.T) { - c := def - c.Reset = false - - input := "[blue]foo" - output := "\033[34mfoo" - actual := c.Color(input) - if actual != output { - t.Errorf( - "Input: %#v\n\nOutput: %#v\n\nExpected: %#v", - input, - actual, - output) - } -} - -func TestConvenienceWrappers(t *testing.T) { - var length int - printInput := "[bold]Print:\t\t[default][red]R[green]G[blue]B[cyan]C[magenta]M[yellow]Y\n" - printlnInput := "[bold]Println:\t[default][red]R[green]G[blue]B[cyan]C[magenta]M[yellow]Y" - printfInput := "[bold]Printf:\t\t[default][red]R[green]G[blue]B[cyan]C[magenta]M[yellow]Y\n" - fprintInput := "[bold]Fprint:\t\t[default][red]R[green]G[blue]B[cyan]C[magenta]M[yellow]Y\n" - fprintlnInput := "[bold]Fprintln:\t[default][red]R[green]G[blue]B[cyan]C[magenta]M[yellow]Y" - fprintfInput := "[bold]Fprintf:\t[default][red]R[green]G[blue]B[cyan]C[magenta]M[yellow]Y\n" - - // colorstring.Print - length, _ = Print(printInput) - assertOutputLength(t, printInput, 58, length) - - // colorstring.Println - length, _ = Println(printlnInput) - assertOutputLength(t, printlnInput, 59, length) - - // colorstring.Printf - length, _ = Printf(printfInput) - assertOutputLength(t, printfInput, 59, length) - - // colorstring.Fprint - length, _ = Fprint(os.Stdout, fprintInput) - assertOutputLength(t, fprintInput, 59, length) - - // colorstring.Fprintln - length, _ = Fprintln(os.Stdout, fprintlnInput) - assertOutputLength(t, fprintlnInput, 60, length) - - // colorstring.Fprintf - length, _ = Fprintf(os.Stdout, fprintfInput) - assertOutputLength(t, fprintfInput, 59, length) -} - -func assertOutputLength(t *testing.T, input string, expectedLength int, actualLength int) { - if actualLength != expectedLength { - t.Errorf("Input: %#v\n\n Output length: %d\n\n Expected: %d", - input, - actualLength, - expectedLength) - } -} diff --git a/vendor/github.com/mitchellh/copystructure/copier_time_test.go b/vendor/github.com/mitchellh/copystructure/copier_time_test.go deleted file mode 100644 index 5506a0ff13..0000000000 --- a/vendor/github.com/mitchellh/copystructure/copier_time_test.go +++ /dev/null @@ -1,17 +0,0 @@ -package copystructure - -import ( - "testing" - "time" -) - -func TestTimeCopier(t *testing.T) { - v := time.Now().UTC() - result, err := timeCopier(v) - if err != nil { - t.Fatalf("err: %s", err) - } - if result.(time.Time) != v { - t.Fatalf("bad: %#v\n\n%#v", v, result) - } -} diff --git a/vendor/github.com/mitchellh/copystructure/copystructure_examples_test.go b/vendor/github.com/mitchellh/copystructure/copystructure_examples_test.go deleted file mode 100644 index e094b86263..0000000000 --- a/vendor/github.com/mitchellh/copystructure/copystructure_examples_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package copystructure - -import ( - "fmt" -) - -func ExampleCopy() { - input := map[string]interface{}{ - "bob": map[string]interface{}{ - "emails": []string{"a", "b"}, - }, - } - - dup, err := Copy(input) - if err != nil { - panic(err) - } - - fmt.Printf("%#v", dup) - // Output: - // map[string]interface {}{"bob":map[string]interface {}{"emails":[]string{"a", "b"}}} -} diff --git a/vendor/github.com/mitchellh/copystructure/copystructure_test.go b/vendor/github.com/mitchellh/copystructure/copystructure_test.go deleted file mode 100644 index c2c39e8363..0000000000 --- a/vendor/github.com/mitchellh/copystructure/copystructure_test.go +++ /dev/null @@ -1,194 +0,0 @@ -package copystructure - -import ( - "reflect" - "testing" - "time" -) - -func TestCopy_complex(t *testing.T) { - v := map[string]interface{}{ - "foo": []string{"a", "b"}, - "bar": "baz", - } - - result, err := Copy(v) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(result, v) { - t.Fatalf("bad: %#v", result) - } -} - -func TestCopy_primitive(t *testing.T) { - cases := []interface{}{ - 42, - "foo", - 1.2, - } - - for _, tc := range cases { - result, err := Copy(tc) - if err != nil { - t.Fatalf("err: %s", err) - } - if result != tc { - t.Fatalf("bad: %#v", result) - } - } -} - -func TestCopy_primitivePtr(t *testing.T) { - cases := []interface{}{ - 42, - "foo", - 1.2, - } - - for _, tc := range cases { - result, err := Copy(&tc) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(result, &tc) { - t.Fatalf("bad: %#v", result) - } - } -} - -func TestCopy_map(t *testing.T) { - v := map[string]interface{}{ - "bar": "baz", - } - - result, err := Copy(v) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(result, v) { - t.Fatalf("bad: %#v", result) - } -} - -func TestCopy_slice(t *testing.T) { - v := []string{"bar", "baz"} - - result, err := Copy(v) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(result, v) { - t.Fatalf("bad: %#v", result) - } -} - -func TestCopy_struct(t *testing.T) { - type test struct { - Value string - } - - v := test{Value: "foo"} - - result, err := Copy(v) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(result, v) { - t.Fatalf("bad: %#v", result) - } -} - -func TestCopy_structPtr(t *testing.T) { - type test struct { - Value string - } - - v := &test{Value: "foo"} - - result, err := Copy(v) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(result, v) { - t.Fatalf("bad: %#v", result) - } -} - -func TestCopy_structNil(t *testing.T) { - type test struct { - Value string - } - - var v *test - result, err := Copy(v) - if err != nil { - t.Fatalf("err: %s", err) - } - if v, ok := result.(*test); !ok { - t.Fatalf("bad: %#v", result) - } else if v != nil { - t.Fatalf("bad: %#v", v) - } -} - -func TestCopy_structNested(t *testing.T) { - type TestInner struct{} - - type Test struct { - Test *TestInner - } - - v := Test{} - - result, err := Copy(v) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(result, v) { - t.Fatalf("bad: %#v", result) - } -} - -func TestCopy_structUnexported(t *testing.T) { - type test struct { - Value string - - private string - } - - v := test{Value: "foo"} - - result, err := Copy(v) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(result, v) { - t.Fatalf("bad: %#v", result) - } -} - -func TestCopy_time(t *testing.T) { - type test struct { - Value time.Time - } - - v := test{Value: time.Now().UTC()} - - result, err := Copy(v) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(result, v) { - t.Fatalf("bad: %#v", result) - } -} diff --git a/vendor/github.com/mitchellh/go-homedir/homedir_test.go b/vendor/github.com/mitchellh/go-homedir/homedir_test.go deleted file mode 100644 index c34dbc7f2c..0000000000 --- a/vendor/github.com/mitchellh/go-homedir/homedir_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package homedir - -import ( - "fmt" - "os" - "os/user" - "testing" -) - -func patchEnv(key, value string) func() { - bck := os.Getenv(key) - deferFunc := func() { - os.Setenv(key, bck) - } - - os.Setenv(key, value) - return deferFunc -} - -func BenchmarkDir(b *testing.B) { - // We do this for any "warmups" - for i := 0; i < 10; i++ { - Dir() - } - - b.ResetTimer() - for i := 0; i < b.N; i++ { - Dir() - } -} - -func TestDir(t *testing.T) { - u, err := user.Current() - if err != nil { - t.Fatalf("err: %s", err) - } - - dir, err := Dir() - if err != nil { - t.Fatalf("err: %s", err) - } - - if u.HomeDir != dir { - t.Fatalf("%#v != %#v", u.HomeDir, dir) - } -} - -func TestExpand(t *testing.T) { - u, err := user.Current() - if err != nil { - t.Fatalf("err: %s", err) - } - - cases := []struct { - Input string - Output string - Err bool - }{ - { - "/foo", - "/foo", - false, - }, - - { - "~/foo", - fmt.Sprintf("%s/foo", u.HomeDir), - false, - }, - - { - "", - "", - false, - }, - - { - "~", - u.HomeDir, - false, - }, - - { - "~foo/foo", - "", - true, - }, - } - - for _, tc := range cases { - actual, err := Expand(tc.Input) - if (err != nil) != tc.Err { - t.Fatalf("Input: %#v\n\nErr: %s", tc.Input, err) - } - - if actual != tc.Output { - t.Fatalf("Input: %#v\n\nOutput: %#v", tc.Input, actual) - } - } - - DisableCache = true - defer func() { DisableCache = false }() - defer patchEnv("HOME", "/custom/path/")() - expected := "/custom/path/foo/bar" - actual, err := Expand("~/foo/bar") - - if err != nil { - t.Errorf("No error is expected, got: %v", err) - } else if actual != "/custom/path/foo/bar" { - t.Errorf("Expected: %v; actual: %v", expected, actual) - } -} diff --git a/vendor/github.com/mitchellh/go-linereader/linereader_test.go b/vendor/github.com/mitchellh/go-linereader/linereader_test.go deleted file mode 100644 index 9c4fcd1a50..0000000000 --- a/vendor/github.com/mitchellh/go-linereader/linereader_test.go +++ /dev/null @@ -1,48 +0,0 @@ -package linereader - -import ( - "bytes" - "io" - "time" - "reflect" - "testing" -) - -func TestReader(t *testing.T) { - var buf bytes.Buffer - buf.WriteString("foo\nbar\n") - - var result []string - r := New(&buf) - for line := range r.Ch { - result = append(result, line) - } - - expected := []string{"foo", "bar"} - if !reflect.DeepEqual(result, expected) { - t.Fatalf("bad: %#v", result) - } -} - -func TestReader_pause(t *testing.T) { - pr, pw := io.Pipe() - - go func() { - defer pw.Close() - pw.Write([]byte("foo\n")) - pw.Write([]byte("bar")) - time.Sleep(200 * time.Millisecond) - pw.Write([]byte("baz\n")) - }() - - var result []string - r := New(pr) - for line := range r.Ch { - result = append(result, line) - } - - expected := []string{"foo", "bar", "baz"} - if !reflect.DeepEqual(result, expected) { - t.Fatalf("bad: %#v", result) - } -} diff --git a/vendor/github.com/mitchellh/mapstructure/decode_hooks_test.go b/vendor/github.com/mitchellh/mapstructure/decode_hooks_test.go deleted file mode 100644 index 53289afcfb..0000000000 --- a/vendor/github.com/mitchellh/mapstructure/decode_hooks_test.go +++ /dev/null @@ -1,229 +0,0 @@ -package mapstructure - -import ( - "errors" - "reflect" - "testing" - "time" -) - -func TestComposeDecodeHookFunc(t *testing.T) { - f1 := func( - f reflect.Kind, - t reflect.Kind, - data interface{}) (interface{}, error) { - return data.(string) + "foo", nil - } - - f2 := func( - f reflect.Kind, - t reflect.Kind, - data interface{}) (interface{}, error) { - return data.(string) + "bar", nil - } - - f := ComposeDecodeHookFunc(f1, f2) - - result, err := DecodeHookExec( - f, reflect.TypeOf(""), reflect.TypeOf([]byte("")), "") - if err != nil { - t.Fatalf("bad: %s", err) - } - if result.(string) != "foobar" { - t.Fatalf("bad: %#v", result) - } -} - -func TestComposeDecodeHookFunc_err(t *testing.T) { - f1 := func(reflect.Kind, reflect.Kind, interface{}) (interface{}, error) { - return nil, errors.New("foo") - } - - f2 := func(reflect.Kind, reflect.Kind, interface{}) (interface{}, error) { - panic("NOPE") - } - - f := ComposeDecodeHookFunc(f1, f2) - - _, err := DecodeHookExec( - f, reflect.TypeOf(""), reflect.TypeOf([]byte("")), 42) - if err.Error() != "foo" { - t.Fatalf("bad: %s", err) - } -} - -func TestComposeDecodeHookFunc_kinds(t *testing.T) { - var f2From reflect.Kind - - f1 := func( - f reflect.Kind, - t reflect.Kind, - data interface{}) (interface{}, error) { - return int(42), nil - } - - f2 := func( - f reflect.Kind, - t reflect.Kind, - data interface{}) (interface{}, error) { - f2From = f - return data, nil - } - - f := ComposeDecodeHookFunc(f1, f2) - - _, err := DecodeHookExec( - f, reflect.TypeOf(""), reflect.TypeOf([]byte("")), "") - if err != nil { - t.Fatalf("bad: %s", err) - } - if f2From != reflect.Int { - t.Fatalf("bad: %#v", f2From) - } -} - -func TestStringToSliceHookFunc(t *testing.T) { - f := StringToSliceHookFunc(",") - - strType := reflect.TypeOf("") - sliceType := reflect.TypeOf([]byte("")) - cases := []struct { - f, t reflect.Type - data interface{} - result interface{} - err bool - }{ - {sliceType, sliceType, 42, 42, false}, - {strType, strType, 42, 42, false}, - { - strType, - sliceType, - "foo,bar,baz", - []string{"foo", "bar", "baz"}, - false, - }, - { - strType, - sliceType, - "", - []string{}, - false, - }, - } - - for i, tc := range cases { - actual, err := DecodeHookExec(f, tc.f, tc.t, tc.data) - if tc.err != (err != nil) { - t.Fatalf("case %d: expected err %#v", i, tc.err) - } - if !reflect.DeepEqual(actual, tc.result) { - t.Fatalf( - "case %d: expected %#v, got %#v", - i, tc.result, actual) - } - } -} - -func TestStringToTimeDurationHookFunc(t *testing.T) { - f := StringToTimeDurationHookFunc() - - strType := reflect.TypeOf("") - timeType := reflect.TypeOf(time.Duration(5)) - cases := []struct { - f, t reflect.Type - data interface{} - result interface{} - err bool - }{ - {strType, timeType, "5s", 5 * time.Second, false}, - {strType, timeType, "5", time.Duration(0), true}, - {strType, strType, "5", "5", false}, - } - - for i, tc := range cases { - actual, err := DecodeHookExec(f, tc.f, tc.t, tc.data) - if tc.err != (err != nil) { - t.Fatalf("case %d: expected err %#v", i, tc.err) - } - if !reflect.DeepEqual(actual, tc.result) { - t.Fatalf( - "case %d: expected %#v, got %#v", - i, tc.result, actual) - } - } -} - -func TestWeaklyTypedHook(t *testing.T) { - var f DecodeHookFunc = WeaklyTypedHook - - boolType := reflect.TypeOf(true) - strType := reflect.TypeOf("") - sliceType := reflect.TypeOf([]byte("")) - cases := []struct { - f, t reflect.Type - data interface{} - result interface{} - err bool - }{ - // TO STRING - { - boolType, - strType, - false, - "0", - false, - }, - - { - boolType, - strType, - true, - "1", - false, - }, - - { - reflect.TypeOf(float32(1)), - strType, - float32(7), - "7", - false, - }, - - { - reflect.TypeOf(int(1)), - strType, - int(7), - "7", - false, - }, - - { - sliceType, - strType, - []uint8("foo"), - "foo", - false, - }, - - { - reflect.TypeOf(uint(1)), - strType, - uint(7), - "7", - false, - }, - } - - for i, tc := range cases { - actual, err := DecodeHookExec(f, tc.f, tc.t, tc.data) - if tc.err != (err != nil) { - t.Fatalf("case %d: expected err %#v", i, tc.err) - } - if !reflect.DeepEqual(actual, tc.result) { - t.Fatalf( - "case %d: expected %#v, got %#v", - i, tc.result, actual) - } - } -} diff --git a/vendor/github.com/mitchellh/mapstructure/mapstructure_benchmark_test.go b/vendor/github.com/mitchellh/mapstructure/mapstructure_benchmark_test.go deleted file mode 100644 index 41d2a41f75..0000000000 --- a/vendor/github.com/mitchellh/mapstructure/mapstructure_benchmark_test.go +++ /dev/null @@ -1,279 +0,0 @@ -package mapstructure - -import ( - "encoding/json" - "testing" -) - -func Benchmark_Decode(b *testing.B) { - type Person struct { - Name string - Age int - Emails []string - Extra map[string]string - } - - input := map[string]interface{}{ - "name": "Mitchell", - "age": 91, - "emails": []string{"one", "two", "three"}, - "extra": map[string]string{ - "twitter": "mitchellh", - }, - } - - var result Person - for i := 0; i < b.N; i++ { - Decode(input, &result) - } -} - -// decodeViaJSON takes the map data and passes it through encoding/json to convert it into the -// given Go native structure pointed to by v. v must be a pointer to a struct. -func decodeViaJSON(data interface{}, v interface{}) error { - // Perform the task by simply marshalling the input into JSON, - // then unmarshalling it into target native Go struct. - b, err := json.Marshal(data) - if err != nil { - return err - } - return json.Unmarshal(b, v) -} - -func Benchmark_DecodeViaJSON(b *testing.B) { - type Person struct { - Name string - Age int - Emails []string - Extra map[string]string - } - - input := map[string]interface{}{ - "name": "Mitchell", - "age": 91, - "emails": []string{"one", "two", "three"}, - "extra": map[string]string{ - "twitter": "mitchellh", - }, - } - - var result Person - for i := 0; i < b.N; i++ { - decodeViaJSON(input, &result) - } -} - -func Benchmark_DecodeBasic(b *testing.B) { - input := map[string]interface{}{ - "vstring": "foo", - "vint": 42, - "Vuint": 42, - "vbool": true, - "Vfloat": 42.42, - "vsilent": true, - "vdata": 42, - } - - var result Basic - for i := 0; i < b.N; i++ { - Decode(input, &result) - } -} - -func Benchmark_DecodeEmbedded(b *testing.B) { - input := map[string]interface{}{ - "vstring": "foo", - "Basic": map[string]interface{}{ - "vstring": "innerfoo", - }, - "vunique": "bar", - } - - var result Embedded - for i := 0; i < b.N; i++ { - Decode(input, &result) - } -} - -func Benchmark_DecodeTypeConversion(b *testing.B) { - input := map[string]interface{}{ - "IntToFloat": 42, - "IntToUint": 42, - "IntToBool": 1, - "IntToString": 42, - "UintToInt": 42, - "UintToFloat": 42, - "UintToBool": 42, - "UintToString": 42, - "BoolToInt": true, - "BoolToUint": true, - "BoolToFloat": true, - "BoolToString": true, - "FloatToInt": 42.42, - "FloatToUint": 42.42, - "FloatToBool": 42.42, - "FloatToString": 42.42, - "StringToInt": "42", - "StringToUint": "42", - "StringToBool": "1", - "StringToFloat": "42.42", - "SliceToMap": []interface{}{}, - "MapToSlice": map[string]interface{}{}, - } - - var resultStrict TypeConversionResult - for i := 0; i < b.N; i++ { - Decode(input, &resultStrict) - } -} - -func Benchmark_DecodeMap(b *testing.B) { - input := map[string]interface{}{ - "vfoo": "foo", - "vother": map[interface{}]interface{}{ - "foo": "foo", - "bar": "bar", - }, - } - - var result Map - for i := 0; i < b.N; i++ { - Decode(input, &result) - } -} - -func Benchmark_DecodeMapOfStruct(b *testing.B) { - input := map[string]interface{}{ - "value": map[string]interface{}{ - "foo": map[string]string{"vstring": "one"}, - "bar": map[string]string{"vstring": "two"}, - }, - } - - var result MapOfStruct - for i := 0; i < b.N; i++ { - Decode(input, &result) - } -} - -func Benchmark_DecodeSlice(b *testing.B) { - input := map[string]interface{}{ - "vfoo": "foo", - "vbar": []string{"foo", "bar", "baz"}, - } - - var result Slice - for i := 0; i < b.N; i++ { - Decode(input, &result) - } -} - -func Benchmark_DecodeSliceOfStruct(b *testing.B) { - input := map[string]interface{}{ - "value": []map[string]interface{}{ - {"vstring": "one"}, - {"vstring": "two"}, - }, - } - - var result SliceOfStruct - for i := 0; i < b.N; i++ { - Decode(input, &result) - } -} - -func Benchmark_DecodeWeaklyTypedInput(b *testing.B) { - type Person struct { - Name string - Age int - Emails []string - } - - // This input can come from anywhere, but typically comes from - // something like decoding JSON, generated by a weakly typed language - // such as PHP. - input := map[string]interface{}{ - "name": 123, // number => string - "age": "42", // string => number - "emails": map[string]interface{}{}, // empty map => empty array - } - - var result Person - config := &DecoderConfig{ - WeaklyTypedInput: true, - Result: &result, - } - - decoder, err := NewDecoder(config) - if err != nil { - panic(err) - } - - for i := 0; i < b.N; i++ { - decoder.Decode(input) - } -} - -func Benchmark_DecodeMetadata(b *testing.B) { - type Person struct { - Name string - Age int - } - - input := map[string]interface{}{ - "name": "Mitchell", - "age": 91, - "email": "foo@bar.com", - } - - var md Metadata - var result Person - config := &DecoderConfig{ - Metadata: &md, - Result: &result, - } - - decoder, err := NewDecoder(config) - if err != nil { - panic(err) - } - - for i := 0; i < b.N; i++ { - decoder.Decode(input) - } -} - -func Benchmark_DecodeMetadataEmbedded(b *testing.B) { - input := map[string]interface{}{ - "vstring": "foo", - "vunique": "bar", - } - - var md Metadata - var result EmbeddedSquash - config := &DecoderConfig{ - Metadata: &md, - Result: &result, - } - - decoder, err := NewDecoder(config) - if err != nil { - b.Fatalf("err: %s", err) - } - - for i := 0; i < b.N; i++ { - decoder.Decode(input) - } -} - -func Benchmark_DecodeTagged(b *testing.B) { - input := map[string]interface{}{ - "foo": "bar", - "bar": "value", - } - - var result Tagged - for i := 0; i < b.N; i++ { - Decode(input, &result) - } -} diff --git a/vendor/github.com/mitchellh/mapstructure/mapstructure_bugs_test.go b/vendor/github.com/mitchellh/mapstructure/mapstructure_bugs_test.go deleted file mode 100644 index 7054f1ac9a..0000000000 --- a/vendor/github.com/mitchellh/mapstructure/mapstructure_bugs_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package mapstructure - -import "testing" - -// GH-1 -func TestDecode_NilValue(t *testing.T) { - input := map[string]interface{}{ - "vfoo": nil, - "vother": nil, - } - - var result Map - err := Decode(input, &result) - if err != nil { - t.Fatalf("should not error: %s", err) - } - - if result.Vfoo != "" { - t.Fatalf("value should be default: %s", result.Vfoo) - } - - if result.Vother != nil { - t.Fatalf("Vother should be nil: %s", result.Vother) - } -} - -// GH-10 -func TestDecode_mapInterfaceInterface(t *testing.T) { - input := map[interface{}]interface{}{ - "vfoo": nil, - "vother": nil, - } - - var result Map - err := Decode(input, &result) - if err != nil { - t.Fatalf("should not error: %s", err) - } - - if result.Vfoo != "" { - t.Fatalf("value should be default: %s", result.Vfoo) - } - - if result.Vother != nil { - t.Fatalf("Vother should be nil: %s", result.Vother) - } -} diff --git a/vendor/github.com/mitchellh/mapstructure/mapstructure_examples_test.go b/vendor/github.com/mitchellh/mapstructure/mapstructure_examples_test.go deleted file mode 100644 index f17c214a8a..0000000000 --- a/vendor/github.com/mitchellh/mapstructure/mapstructure_examples_test.go +++ /dev/null @@ -1,203 +0,0 @@ -package mapstructure - -import ( - "fmt" -) - -func ExampleDecode() { - type Person struct { - Name string - Age int - Emails []string - Extra map[string]string - } - - // This input can come from anywhere, but typically comes from - // something like decoding JSON where we're not quite sure of the - // struct initially. - input := map[string]interface{}{ - "name": "Mitchell", - "age": 91, - "emails": []string{"one", "two", "three"}, - "extra": map[string]string{ - "twitter": "mitchellh", - }, - } - - var result Person - err := Decode(input, &result) - if err != nil { - panic(err) - } - - fmt.Printf("%#v", result) - // Output: - // mapstructure.Person{Name:"Mitchell", Age:91, Emails:[]string{"one", "two", "three"}, Extra:map[string]string{"twitter":"mitchellh"}} -} - -func ExampleDecode_errors() { - type Person struct { - Name string - Age int - Emails []string - Extra map[string]string - } - - // This input can come from anywhere, but typically comes from - // something like decoding JSON where we're not quite sure of the - // struct initially. - input := map[string]interface{}{ - "name": 123, - "age": "bad value", - "emails": []int{1, 2, 3}, - } - - var result Person - err := Decode(input, &result) - if err == nil { - panic("should have an error") - } - - fmt.Println(err.Error()) - // Output: - // 5 error(s) decoding: - // - // * 'Age' expected type 'int', got unconvertible type 'string' - // * 'Emails[0]' expected type 'string', got unconvertible type 'int' - // * 'Emails[1]' expected type 'string', got unconvertible type 'int' - // * 'Emails[2]' expected type 'string', got unconvertible type 'int' - // * 'Name' expected type 'string', got unconvertible type 'int' -} - -func ExampleDecode_metadata() { - type Person struct { - Name string - Age int - } - - // This input can come from anywhere, but typically comes from - // something like decoding JSON where we're not quite sure of the - // struct initially. - input := map[string]interface{}{ - "name": "Mitchell", - "age": 91, - "email": "foo@bar.com", - } - - // For metadata, we make a more advanced DecoderConfig so we can - // more finely configure the decoder that is used. In this case, we - // just tell the decoder we want to track metadata. - var md Metadata - var result Person - config := &DecoderConfig{ - Metadata: &md, - Result: &result, - } - - decoder, err := NewDecoder(config) - if err != nil { - panic(err) - } - - if err := decoder.Decode(input); err != nil { - panic(err) - } - - fmt.Printf("Unused keys: %#v", md.Unused) - // Output: - // Unused keys: []string{"email"} -} - -func ExampleDecode_weaklyTypedInput() { - type Person struct { - Name string - Age int - Emails []string - } - - // This input can come from anywhere, but typically comes from - // something like decoding JSON, generated by a weakly typed language - // such as PHP. - input := map[string]interface{}{ - "name": 123, // number => string - "age": "42", // string => number - "emails": map[string]interface{}{}, // empty map => empty array - } - - var result Person - config := &DecoderConfig{ - WeaklyTypedInput: true, - Result: &result, - } - - decoder, err := NewDecoder(config) - if err != nil { - panic(err) - } - - err = decoder.Decode(input) - if err != nil { - panic(err) - } - - fmt.Printf("%#v", result) - // Output: mapstructure.Person{Name:"123", Age:42, Emails:[]string{}} -} - -func ExampleDecode_tags() { - // Note that the mapstructure tags defined in the struct type - // can indicate which fields the values are mapped to. - type Person struct { - Name string `mapstructure:"person_name"` - Age int `mapstructure:"person_age"` - } - - input := map[string]interface{}{ - "person_name": "Mitchell", - "person_age": 91, - } - - var result Person - err := Decode(input, &result) - if err != nil { - panic(err) - } - - fmt.Printf("%#v", result) - // Output: - // mapstructure.Person{Name:"Mitchell", Age:91} -} - -func ExampleDecode_embeddedStruct() { - // Squashing multiple embedded structs is allowed using the squash tag. - // This is demonstrated by creating a composite struct of multiple types - // and decoding into it. In this case, a person can carry with it both - // a Family and a Location, as well as their own FirstName. - type Family struct { - LastName string - } - type Location struct { - City string - } - type Person struct { - Family `mapstructure:",squash"` - Location `mapstructure:",squash"` - FirstName string - } - - input := map[string]interface{}{ - "FirstName": "Mitchell", - "LastName": "Hashimoto", - "City": "San Francisco", - } - - var result Person - err := Decode(input, &result) - if err != nil { - panic(err) - } - - fmt.Printf("%s %s, %s", result.FirstName, result.LastName, result.City) - // Output: - // Mitchell Hashimoto, San Francisco -} diff --git a/vendor/github.com/mitchellh/mapstructure/mapstructure_test.go b/vendor/github.com/mitchellh/mapstructure/mapstructure_test.go deleted file mode 100644 index 8a27647b58..0000000000 --- a/vendor/github.com/mitchellh/mapstructure/mapstructure_test.go +++ /dev/null @@ -1,999 +0,0 @@ -package mapstructure - -import ( - "reflect" - "sort" - "testing" -) - -type Basic struct { - Vstring string - Vint int - Vuint uint - Vbool bool - Vfloat float64 - Vextra string - vsilent bool - Vdata interface{} -} - -type BasicSquash struct { - Test Basic `mapstructure:",squash"` -} - -type Embedded struct { - Basic - Vunique string -} - -type EmbeddedPointer struct { - *Basic - Vunique string -} - -type EmbeddedSquash struct { - Basic `mapstructure:",squash"` - Vunique string -} - -type Map struct { - Vfoo string - Vother map[string]string -} - -type MapOfStruct struct { - Value map[string]Basic -} - -type Nested struct { - Vfoo string - Vbar Basic -} - -type NestedPointer struct { - Vfoo string - Vbar *Basic -} - -type Slice struct { - Vfoo string - Vbar []string -} - -type SliceOfStruct struct { - Value []Basic -} - -type Tagged struct { - Extra string `mapstructure:"bar,what,what"` - Value string `mapstructure:"foo"` -} - -type TypeConversionResult struct { - IntToFloat float32 - IntToUint uint - IntToBool bool - IntToString string - UintToInt int - UintToFloat float32 - UintToBool bool - UintToString string - BoolToInt int - BoolToUint uint - BoolToFloat float32 - BoolToString string - FloatToInt int - FloatToUint uint - FloatToBool bool - FloatToString string - SliceUint8ToString string - StringToInt int - StringToUint uint - StringToBool bool - StringToFloat float32 - SliceToMap map[string]interface{} - MapToSlice []interface{} -} - -func TestBasicTypes(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vstring": "foo", - "vint": 42, - "Vuint": 42, - "vbool": true, - "Vfloat": 42.42, - "vsilent": true, - "vdata": 42, - } - - var result Basic - err := Decode(input, &result) - if err != nil { - t.Errorf("got an err: %s", err.Error()) - t.FailNow() - } - - if result.Vstring != "foo" { - t.Errorf("vstring value should be 'foo': %#v", result.Vstring) - } - - if result.Vint != 42 { - t.Errorf("vint value should be 42: %#v", result.Vint) - } - - if result.Vuint != 42 { - t.Errorf("vuint value should be 42: %#v", result.Vuint) - } - - if result.Vbool != true { - t.Errorf("vbool value should be true: %#v", result.Vbool) - } - - if result.Vfloat != 42.42 { - t.Errorf("vfloat value should be 42.42: %#v", result.Vfloat) - } - - if result.Vextra != "" { - t.Errorf("vextra value should be empty: %#v", result.Vextra) - } - - if result.vsilent != false { - t.Error("vsilent should not be set, it is unexported") - } - - if result.Vdata != 42 { - t.Error("vdata should be valid") - } -} - -func TestBasic_IntWithFloat(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vint": float64(42), - } - - var result Basic - err := Decode(input, &result) - if err != nil { - t.Fatalf("got an err: %s", err) - } -} - -func TestBasic_Merge(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vint": 42, - } - - var result Basic - result.Vuint = 100 - err := Decode(input, &result) - if err != nil { - t.Fatalf("got an err: %s", err) - } - - expected := Basic{ - Vint: 42, - Vuint: 100, - } - if !reflect.DeepEqual(result, expected) { - t.Fatalf("bad: %#v", result) - } -} - -func TestDecode_BasicSquash(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vstring": "foo", - } - - var result BasicSquash - err := Decode(input, &result) - if err != nil { - t.Fatalf("got an err: %s", err.Error()) - } - - if result.Test.Vstring != "foo" { - t.Errorf("vstring value should be 'foo': %#v", result.Test.Vstring) - } -} - -func TestDecode_Embedded(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vstring": "foo", - "Basic": map[string]interface{}{ - "vstring": "innerfoo", - }, - "vunique": "bar", - } - - var result Embedded - err := Decode(input, &result) - if err != nil { - t.Fatalf("got an err: %s", err.Error()) - } - - if result.Vstring != "innerfoo" { - t.Errorf("vstring value should be 'innerfoo': %#v", result.Vstring) - } - - if result.Vunique != "bar" { - t.Errorf("vunique value should be 'bar': %#v", result.Vunique) - } -} - -func TestDecode_EmbeddedPointer(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vstring": "foo", - "Basic": map[string]interface{}{ - "vstring": "innerfoo", - }, - "vunique": "bar", - } - - var result EmbeddedPointer - err := Decode(input, &result) - if err == nil { - t.Fatal("should get error") - } -} - -func TestDecode_EmbeddedSquash(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vstring": "foo", - "vunique": "bar", - } - - var result EmbeddedSquash - err := Decode(input, &result) - if err != nil { - t.Fatalf("got an err: %s", err.Error()) - } - - if result.Vstring != "foo" { - t.Errorf("vstring value should be 'foo': %#v", result.Vstring) - } - - if result.Vunique != "bar" { - t.Errorf("vunique value should be 'bar': %#v", result.Vunique) - } -} - -func TestDecode_DecodeHook(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vint": "WHAT", - } - - decodeHook := func(from reflect.Kind, to reflect.Kind, v interface{}) (interface{}, error) { - if from == reflect.String && to != reflect.String { - return 5, nil - } - - return v, nil - } - - var result Basic - config := &DecoderConfig{ - DecodeHook: decodeHook, - Result: &result, - } - - decoder, err := NewDecoder(config) - if err != nil { - t.Fatalf("err: %s", err) - } - - err = decoder.Decode(input) - if err != nil { - t.Fatalf("got an err: %s", err) - } - - if result.Vint != 5 { - t.Errorf("vint should be 5: %#v", result.Vint) - } -} - -func TestDecode_DecodeHookType(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vint": "WHAT", - } - - decodeHook := func(from reflect.Type, to reflect.Type, v interface{}) (interface{}, error) { - if from.Kind() == reflect.String && - to.Kind() != reflect.String { - return 5, nil - } - - return v, nil - } - - var result Basic - config := &DecoderConfig{ - DecodeHook: decodeHook, - Result: &result, - } - - decoder, err := NewDecoder(config) - if err != nil { - t.Fatalf("err: %s", err) - } - - err = decoder.Decode(input) - if err != nil { - t.Fatalf("got an err: %s", err) - } - - if result.Vint != 5 { - t.Errorf("vint should be 5: %#v", result.Vint) - } -} - -func TestDecode_Nil(t *testing.T) { - t.Parallel() - - var input interface{} = nil - result := Basic{ - Vstring: "foo", - } - - err := Decode(input, &result) - if err != nil { - t.Fatalf("err: %s", err) - } - - if result.Vstring != "foo" { - t.Fatalf("bad: %#v", result.Vstring) - } -} - -func TestDecode_NonStruct(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "foo": "bar", - "bar": "baz", - } - - var result map[string]string - err := Decode(input, &result) - if err != nil { - t.Fatalf("err: %s", err) - } - - if result["foo"] != "bar" { - t.Fatal("foo is not bar") - } -} - -func TestDecode_StructMatch(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vbar": Basic{ - Vstring: "foo", - }, - } - - var result Nested - err := Decode(input, &result) - if err != nil { - t.Fatalf("got an err: %s", err.Error()) - } - - if result.Vbar.Vstring != "foo" { - t.Errorf("bad: %#v", result) - } -} - -func TestDecode_TypeConversion(t *testing.T) { - input := map[string]interface{}{ - "IntToFloat": 42, - "IntToUint": 42, - "IntToBool": 1, - "IntToString": 42, - "UintToInt": 42, - "UintToFloat": 42, - "UintToBool": 42, - "UintToString": 42, - "BoolToInt": true, - "BoolToUint": true, - "BoolToFloat": true, - "BoolToString": true, - "FloatToInt": 42.42, - "FloatToUint": 42.42, - "FloatToBool": 42.42, - "FloatToString": 42.42, - "SliceUint8ToString": []uint8("foo"), - "StringToInt": "42", - "StringToUint": "42", - "StringToBool": "1", - "StringToFloat": "42.42", - "SliceToMap": []interface{}{}, - "MapToSlice": map[string]interface{}{}, - } - - expectedResultStrict := TypeConversionResult{ - IntToFloat: 42.0, - IntToUint: 42, - UintToInt: 42, - UintToFloat: 42, - BoolToInt: 0, - BoolToUint: 0, - BoolToFloat: 0, - FloatToInt: 42, - FloatToUint: 42, - } - - expectedResultWeak := TypeConversionResult{ - IntToFloat: 42.0, - IntToUint: 42, - IntToBool: true, - IntToString: "42", - UintToInt: 42, - UintToFloat: 42, - UintToBool: true, - UintToString: "42", - BoolToInt: 1, - BoolToUint: 1, - BoolToFloat: 1, - BoolToString: "1", - FloatToInt: 42, - FloatToUint: 42, - FloatToBool: true, - FloatToString: "42.42", - SliceUint8ToString: "foo", - StringToInt: 42, - StringToUint: 42, - StringToBool: true, - StringToFloat: 42.42, - SliceToMap: map[string]interface{}{}, - MapToSlice: []interface{}{}, - } - - // Test strict type conversion - var resultStrict TypeConversionResult - err := Decode(input, &resultStrict) - if err == nil { - t.Errorf("should return an error") - } - if !reflect.DeepEqual(resultStrict, expectedResultStrict) { - t.Errorf("expected %v, got: %v", expectedResultStrict, resultStrict) - } - - // Test weak type conversion - var decoder *Decoder - var resultWeak TypeConversionResult - - config := &DecoderConfig{ - WeaklyTypedInput: true, - Result: &resultWeak, - } - - decoder, err = NewDecoder(config) - if err != nil { - t.Fatalf("err: %s", err) - } - - err = decoder.Decode(input) - if err != nil { - t.Fatalf("got an err: %s", err) - } - - if !reflect.DeepEqual(resultWeak, expectedResultWeak) { - t.Errorf("expected \n%#v, got: \n%#v", expectedResultWeak, resultWeak) - } -} - -func TestDecoder_ErrorUnused(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vstring": "hello", - "foo": "bar", - } - - var result Basic - config := &DecoderConfig{ - ErrorUnused: true, - Result: &result, - } - - decoder, err := NewDecoder(config) - if err != nil { - t.Fatalf("err: %s", err) - } - - err = decoder.Decode(input) - if err == nil { - t.Fatal("expected error") - } -} - -func TestMap(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vfoo": "foo", - "vother": map[interface{}]interface{}{ - "foo": "foo", - "bar": "bar", - }, - } - - var result Map - err := Decode(input, &result) - if err != nil { - t.Fatalf("got an error: %s", err) - } - - if result.Vfoo != "foo" { - t.Errorf("vfoo value should be 'foo': %#v", result.Vfoo) - } - - if result.Vother == nil { - t.Fatal("vother should not be nil") - } - - if len(result.Vother) != 2 { - t.Error("vother should have two items") - } - - if result.Vother["foo"] != "foo" { - t.Errorf("'foo' key should be foo, got: %#v", result.Vother["foo"]) - } - - if result.Vother["bar"] != "bar" { - t.Errorf("'bar' key should be bar, got: %#v", result.Vother["bar"]) - } -} - -func TestMapMerge(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vfoo": "foo", - "vother": map[interface{}]interface{}{ - "foo": "foo", - "bar": "bar", - }, - } - - var result Map - result.Vother = map[string]string{"hello": "world"} - err := Decode(input, &result) - if err != nil { - t.Fatalf("got an error: %s", err) - } - - if result.Vfoo != "foo" { - t.Errorf("vfoo value should be 'foo': %#v", result.Vfoo) - } - - expected := map[string]string{ - "foo": "foo", - "bar": "bar", - "hello": "world", - } - if !reflect.DeepEqual(result.Vother, expected) { - t.Errorf("bad: %#v", result.Vother) - } -} - -func TestMapOfStruct(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "value": map[string]interface{}{ - "foo": map[string]string{"vstring": "one"}, - "bar": map[string]string{"vstring": "two"}, - }, - } - - var result MapOfStruct - err := Decode(input, &result) - if err != nil { - t.Fatalf("got an err: %s", err) - } - - if result.Value == nil { - t.Fatal("value should not be nil") - } - - if len(result.Value) != 2 { - t.Error("value should have two items") - } - - if result.Value["foo"].Vstring != "one" { - t.Errorf("foo value should be 'one', got: %s", result.Value["foo"].Vstring) - } - - if result.Value["bar"].Vstring != "two" { - t.Errorf("bar value should be 'two', got: %s", result.Value["bar"].Vstring) - } -} - -func TestNestedType(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vfoo": "foo", - "vbar": map[string]interface{}{ - "vstring": "foo", - "vint": 42, - "vbool": true, - }, - } - - var result Nested - err := Decode(input, &result) - if err != nil { - t.Fatalf("got an err: %s", err.Error()) - } - - if result.Vfoo != "foo" { - t.Errorf("vfoo value should be 'foo': %#v", result.Vfoo) - } - - if result.Vbar.Vstring != "foo" { - t.Errorf("vstring value should be 'foo': %#v", result.Vbar.Vstring) - } - - if result.Vbar.Vint != 42 { - t.Errorf("vint value should be 42: %#v", result.Vbar.Vint) - } - - if result.Vbar.Vbool != true { - t.Errorf("vbool value should be true: %#v", result.Vbar.Vbool) - } - - if result.Vbar.Vextra != "" { - t.Errorf("vextra value should be empty: %#v", result.Vbar.Vextra) - } -} - -func TestNestedTypePointer(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vfoo": "foo", - "vbar": &map[string]interface{}{ - "vstring": "foo", - "vint": 42, - "vbool": true, - }, - } - - var result NestedPointer - err := Decode(input, &result) - if err != nil { - t.Fatalf("got an err: %s", err.Error()) - } - - if result.Vfoo != "foo" { - t.Errorf("vfoo value should be 'foo': %#v", result.Vfoo) - } - - if result.Vbar.Vstring != "foo" { - t.Errorf("vstring value should be 'foo': %#v", result.Vbar.Vstring) - } - - if result.Vbar.Vint != 42 { - t.Errorf("vint value should be 42: %#v", result.Vbar.Vint) - } - - if result.Vbar.Vbool != true { - t.Errorf("vbool value should be true: %#v", result.Vbar.Vbool) - } - - if result.Vbar.Vextra != "" { - t.Errorf("vextra value should be empty: %#v", result.Vbar.Vextra) - } -} - -func TestSlice(t *testing.T) { - t.Parallel() - - inputStringSlice := map[string]interface{}{ - "vfoo": "foo", - "vbar": []string{"foo", "bar", "baz"}, - } - - inputStringSlicePointer := map[string]interface{}{ - "vfoo": "foo", - "vbar": &[]string{"foo", "bar", "baz"}, - } - - outputStringSlice := &Slice{ - "foo", - []string{"foo", "bar", "baz"}, - } - - testSliceInput(t, inputStringSlice, outputStringSlice) - testSliceInput(t, inputStringSlicePointer, outputStringSlice) -} - -func TestInvalidSlice(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vfoo": "foo", - "vbar": 42, - } - - result := Slice{} - err := Decode(input, &result) - if err == nil { - t.Errorf("expected failure") - } -} - -func TestSliceOfStruct(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "value": []map[string]interface{}{ - {"vstring": "one"}, - {"vstring": "two"}, - }, - } - - var result SliceOfStruct - err := Decode(input, &result) - if err != nil { - t.Fatalf("got unexpected error: %s", err) - } - - if len(result.Value) != 2 { - t.Fatalf("expected two values, got %d", len(result.Value)) - } - - if result.Value[0].Vstring != "one" { - t.Errorf("first value should be 'one', got: %s", result.Value[0].Vstring) - } - - if result.Value[1].Vstring != "two" { - t.Errorf("second value should be 'two', got: %s", result.Value[1].Vstring) - } -} - -func TestInvalidType(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vstring": 42, - } - - var result Basic - err := Decode(input, &result) - if err == nil { - t.Fatal("error should exist") - } - - derr, ok := err.(*Error) - if !ok { - t.Fatalf("error should be kind of Error, instead: %#v", err) - } - - if derr.Errors[0] != "'Vstring' expected type 'string', got unconvertible type 'int'" { - t.Errorf("got unexpected error: %s", err) - } - - inputNegIntUint := map[string]interface{}{ - "vuint": -42, - } - - err = Decode(inputNegIntUint, &result) - if err == nil { - t.Fatal("error should exist") - } - - derr, ok = err.(*Error) - if !ok { - t.Fatalf("error should be kind of Error, instead: %#v", err) - } - - if derr.Errors[0] != "cannot parse 'Vuint', -42 overflows uint" { - t.Errorf("got unexpected error: %s", err) - } - - inputNegFloatUint := map[string]interface{}{ - "vuint": -42.0, - } - - err = Decode(inputNegFloatUint, &result) - if err == nil { - t.Fatal("error should exist") - } - - derr, ok = err.(*Error) - if !ok { - t.Fatalf("error should be kind of Error, instead: %#v", err) - } - - if derr.Errors[0] != "cannot parse 'Vuint', -42.000000 overflows uint" { - t.Errorf("got unexpected error: %s", err) - } -} - -func TestMetadata(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vfoo": "foo", - "vbar": map[string]interface{}{ - "vstring": "foo", - "Vuint": 42, - "foo": "bar", - }, - "bar": "nil", - } - - var md Metadata - var result Nested - config := &DecoderConfig{ - Metadata: &md, - Result: &result, - } - - decoder, err := NewDecoder(config) - if err != nil { - t.Fatalf("err: %s", err) - } - - err = decoder.Decode(input) - if err != nil { - t.Fatalf("err: %s", err.Error()) - } - - expectedKeys := []string{"Vbar", "Vbar.Vstring", "Vbar.Vuint", "Vfoo"} - sort.Strings(md.Keys) - if !reflect.DeepEqual(md.Keys, expectedKeys) { - t.Fatalf("bad keys: %#v", md.Keys) - } - - expectedUnused := []string{"Vbar.foo", "bar"} - if !reflect.DeepEqual(md.Unused, expectedUnused) { - t.Fatalf("bad unused: %#v", md.Unused) - } -} - -func TestMetadata_Embedded(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "vstring": "foo", - "vunique": "bar", - } - - var md Metadata - var result EmbeddedSquash - config := &DecoderConfig{ - Metadata: &md, - Result: &result, - } - - decoder, err := NewDecoder(config) - if err != nil { - t.Fatalf("err: %s", err) - } - - err = decoder.Decode(input) - if err != nil { - t.Fatalf("err: %s", err.Error()) - } - - expectedKeys := []string{"Vstring", "Vunique"} - - sort.Strings(md.Keys) - if !reflect.DeepEqual(md.Keys, expectedKeys) { - t.Fatalf("bad keys: %#v", md.Keys) - } - - expectedUnused := []string{} - if !reflect.DeepEqual(md.Unused, expectedUnused) { - t.Fatalf("bad unused: %#v", md.Unused) - } -} - -func TestNonPtrValue(t *testing.T) { - t.Parallel() - - err := Decode(map[string]interface{}{}, Basic{}) - if err == nil { - t.Fatal("error should exist") - } - - if err.Error() != "result must be a pointer" { - t.Errorf("got unexpected error: %s", err) - } -} - -func TestTagged(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "foo": "bar", - "bar": "value", - } - - var result Tagged - err := Decode(input, &result) - if err != nil { - t.Fatalf("unexpected error: %s", err) - } - - if result.Value != "bar" { - t.Errorf("value should be 'bar', got: %#v", result.Value) - } - - if result.Extra != "value" { - t.Errorf("extra should be 'value', got: %#v", result.Extra) - } -} - -func TestWeakDecode(t *testing.T) { - t.Parallel() - - input := map[string]interface{}{ - "foo": "4", - "bar": "value", - } - - var result struct { - Foo int - Bar string - } - - if err := WeakDecode(input, &result); err != nil { - t.Fatalf("err: %s", err) - } - if result.Foo != 4 { - t.Fatalf("bad: %#v", result) - } - if result.Bar != "value" { - t.Fatalf("bad: %#v", result) - } -} - -func testSliceInput(t *testing.T, input map[string]interface{}, expected *Slice) { - var result Slice - err := Decode(input, &result) - if err != nil { - t.Fatalf("got error: %s", err) - } - - if result.Vfoo != expected.Vfoo { - t.Errorf("Vfoo expected '%s', got '%s'", expected.Vfoo, result.Vfoo) - } - - if result.Vbar == nil { - t.Fatalf("Vbar a slice, got '%#v'", result.Vbar) - } - - if len(result.Vbar) != len(expected.Vbar) { - t.Errorf("Vbar length should be %d, got %d", len(expected.Vbar), len(result.Vbar)) - } - - for i, v := range result.Vbar { - if v != expected.Vbar[i] { - t.Errorf( - "Vbar[%d] should be '%#v', got '%#v'", - i, expected.Vbar[i], v) - } - } -} diff --git a/vendor/github.com/mitchellh/packer/LICENSE b/vendor/github.com/mitchellh/packer/LICENSE new file mode 100644 index 0000000000..a612ad9813 --- /dev/null +++ b/vendor/github.com/mitchellh/packer/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/mitchellh/packer/common/uuid/uuid_test.go b/vendor/github.com/mitchellh/packer/common/uuid/uuid_test.go deleted file mode 100644 index 8a853f1be3..0000000000 --- a/vendor/github.com/mitchellh/packer/common/uuid/uuid_test.go +++ /dev/null @@ -1,12 +0,0 @@ -package uuid - -import ( - "testing" -) - -func TestTimeOrderedUuid(t *testing.T) { - uuid := TimeOrderedUUID() - if len(uuid) != 36 { - t.Fatalf("bad: %s", uuid) - } -} diff --git a/vendor/github.com/mitchellh/packer/post-processor/compress/LICENSE b/vendor/github.com/mitchellh/packer/post-processor/compress/LICENSE new file mode 100644 index 0000000000..38bbf26f3c --- /dev/null +++ b/vendor/github.com/mitchellh/packer/post-processor/compress/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Vasiliy Tolstov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/mitchellh/panicwrap/panicwrap_test.go b/vendor/github.com/mitchellh/panicwrap/panicwrap_test.go deleted file mode 100644 index d8804b3e90..0000000000 --- a/vendor/github.com/mitchellh/panicwrap/panicwrap_test.go +++ /dev/null @@ -1,325 +0,0 @@ -package panicwrap - -import ( - "bytes" - "fmt" - "os" - "os/exec" - "regexp" - "strings" - "testing" - "time" -) - -var wrapRe = regexp.MustCompile(`wrapped: \d{3,4}`) - -func helperProcess(s ...string) *exec.Cmd { - cs := []string{"-test.run=TestHelperProcess", "--"} - cs = append(cs, s...) - env := []string{ - "GO_WANT_HELPER_PROCESS=1", - } - - cmd := exec.Command(os.Args[0], cs...) - cmd.Env = append(env, os.Environ()...) - cmd.Stdin = os.Stdin - cmd.Stderr = os.Stderr - cmd.Stdout = os.Stdout - return cmd -} - -// This is executed by `helperProcess` in a separate process in order to -// provider a proper sub-process environment to test some of our functionality. -func TestHelperProcess(*testing.T) { - if os.Getenv("GO_WANT_HELPER_PROCESS") != "1" { - return - } - - // Find the arguments to our helper, which are the arguments past - // the "--" in the command line. - args := os.Args - for len(args) > 0 { - if args[0] == "--" { - args = args[1:] - break - } - - args = args[1:] - } - - if len(args) == 0 { - fmt.Fprintf(os.Stderr, "No command\n") - os.Exit(2) - } - - panicHandler := func(s string) { - fmt.Fprintf(os.Stdout, "wrapped: %d", len(s)) - os.Exit(0) - } - - cmd, args := args[0], args[1:] - switch cmd { - case "no-panic-ordered-output": - exitStatus, err := BasicWrap(panicHandler) - if err != nil { - fmt.Fprintf(os.Stderr, "wrap error: %s", err) - os.Exit(1) - } - - if exitStatus < 0 { - for i := 0; i < 1000; i++ { - os.Stdout.Write([]byte("a")) - os.Stderr.Write([]byte("b")) - } - os.Exit(0) - } - - os.Exit(exitStatus) - case "no-panic-output": - fmt.Fprint(os.Stdout, "i am output") - fmt.Fprint(os.Stderr, "stderr out") - os.Exit(0) - case "panic-boundary": - exitStatus, err := BasicWrap(panicHandler) - - if err != nil { - fmt.Fprintf(os.Stderr, "wrap error: %s", err) - os.Exit(1) - } - - if exitStatus < 0 { - // Simulate a panic but on two boundaries... - fmt.Fprint(os.Stderr, "pan") - os.Stderr.Sync() - time.Sleep(100 * time.Millisecond) - fmt.Fprint(os.Stderr, "ic: oh crap") - os.Exit(2) - } - - os.Exit(exitStatus) - case "panic-long": - exitStatus, err := BasicWrap(panicHandler) - - if err != nil { - fmt.Fprintf(os.Stderr, "wrap error: %s", err) - os.Exit(1) - } - - if exitStatus < 0 { - // Make a fake panic by faking the header and adding a - // bunch of garbage. - fmt.Fprint(os.Stderr, "panic: foo\n\n") - for i := 0; i < 1024; i++ { - fmt.Fprint(os.Stderr, "foobarbaz") - } - - // Sleep so that it dumps the previous data - //time.Sleep(1 * time.Millisecond) - time.Sleep(500 * time.Millisecond) - - // Make a real panic - panic("I AM REAL!") - } - - os.Exit(exitStatus) - case "panic": - hidePanic := false - if args[0] == "hide" { - hidePanic = true - } - - config := &WrapConfig{ - Handler: panicHandler, - HidePanic: hidePanic, - } - - exitStatus, err := Wrap(config) - - if err != nil { - fmt.Fprintf(os.Stderr, "wrap error: %s", err) - os.Exit(1) - } - - if exitStatus < 0 { - panic("uh oh") - } - - os.Exit(exitStatus) - case "wrapped": - child := false - if len(args) > 0 && args[0] == "child" { - child = true - } - config := &WrapConfig{ - Handler: panicHandler, - } - - exitStatus, err := Wrap(config) - if err != nil { - fmt.Fprintf(os.Stderr, "wrap error: %s", err) - os.Exit(1) - } - - if exitStatus < 0 { - if child { - fmt.Printf("%v", Wrapped(config)) - } - os.Exit(0) - } - - if !child { - fmt.Printf("%v", Wrapped(config)) - } - os.Exit(exitStatus) - default: - fmt.Fprintf(os.Stderr, "Unknown command: %q\n", cmd) - os.Exit(2) - } -} - -func TestPanicWrap_Output(t *testing.T) { - stderr := new(bytes.Buffer) - stdout := new(bytes.Buffer) - - p := helperProcess("no-panic-output") - p.Stdout = stdout - p.Stderr = stderr - if err := p.Run(); err != nil { - t.Fatalf("err: %s", err) - } - - if !strings.Contains(stdout.String(), "i am output") { - t.Fatalf("didn't forward: %#v", stdout.String()) - } - - if !strings.Contains(stderr.String(), "stderr out") { - t.Fatalf("didn't forward: %#v", stderr.String()) - } -} - -/* -TODO(mitchellh): This property would be nice to gain. -func TestPanicWrap_Output_Order(t *testing.T) { - output := new(bytes.Buffer) - - p := helperProcess("no-panic-ordered-output") - p.Stdout = output - p.Stderr = output - if err := p.Run(); err != nil { - t.Fatalf("err: %s", err) - } - - expectedBuf := new(bytes.Buffer) - for i := 0; i < 1000; i++ { - expectedBuf.WriteString("ab") - } - - actual := strings.TrimSpace(output.String()) - expected := strings.TrimSpace(expectedBuf.String()) - - if actual != expected { - t.Fatalf("bad: %#v", actual) - } -} -*/ - -func TestPanicWrap_panicHide(t *testing.T) { - stdout := new(bytes.Buffer) - stderr := new(bytes.Buffer) - - p := helperProcess("panic", "hide") - p.Stdout = stdout - p.Stderr = stderr - if err := p.Run(); err != nil { - t.Fatalf("err: %s", err) - } - - if wrapRe.FindString(stdout.String()) == "" { - t.Fatalf("didn't wrap: %#v", stdout.String()) - } - - if strings.Contains(stderr.String(), "panic:") { - t.Fatalf("shouldn't have panic: %#v", stderr.String()) - } -} - -func TestPanicWrap_panicShow(t *testing.T) { - stdout := new(bytes.Buffer) - stderr := new(bytes.Buffer) - - p := helperProcess("panic", "show") - p.Stdout = stdout - p.Stderr = stderr - if err := p.Run(); err != nil { - t.Fatalf("err: %s", err) - } - - if wrapRe.FindString(stdout.String()) == "" { - t.Fatalf("didn't wrap: %#v", stdout.String()) - } - - if !strings.Contains(stderr.String(), "panic:") { - t.Fatalf("should have panic: %#v", stderr.String()) - } -} - -func TestPanicWrap_panicLong(t *testing.T) { - stdout := new(bytes.Buffer) - - p := helperProcess("panic-long") - p.Stdout = stdout - p.Stderr = new(bytes.Buffer) - if err := p.Run(); err != nil { - t.Fatalf("err: %s", err) - } - - if wrapRe.FindString(stdout.String()) == "" { - t.Fatalf("didn't wrap: %#v", stdout.String()) - } -} - -func TestPanicWrap_panicBoundary(t *testing.T) { - // TODO(mitchellh): panics are currently lost on boundaries - t.SkipNow() - - stdout := new(bytes.Buffer) - - p := helperProcess("panic-boundary") - p.Stdout = stdout - //p.Stderr = new(bytes.Buffer) - if err := p.Run(); err != nil { - t.Fatalf("err: %s", err) - } - - if wrapRe.FindString(stdout.String()) == "" { - t.Fatalf("didn't wrap: %#v", stdout.String()) - } -} - -func TestWrapped(t *testing.T) { - stdout := new(bytes.Buffer) - - p := helperProcess("wrapped", "child") - p.Stdout = stdout - if err := p.Run(); err != nil { - t.Fatalf("err: %s", err) - } - - if !strings.Contains(stdout.String(), "true") { - t.Fatalf("bad: %#v", stdout.String()) - } -} - -func TestWrapped_parent(t *testing.T) { - stdout := new(bytes.Buffer) - - p := helperProcess("wrapped") - p.Stdout = stdout - if err := p.Run(); err != nil { - t.Fatalf("err: %s", err) - } - - if !strings.Contains(stdout.String(), "false") { - t.Fatalf("bad: %#v", stdout.String()) - } -} diff --git a/vendor/github.com/mitchellh/prefixedio/reader_test.go b/vendor/github.com/mitchellh/prefixedio/reader_test.go deleted file mode 100644 index 1489d5a77e..0000000000 --- a/vendor/github.com/mitchellh/prefixedio/reader_test.go +++ /dev/null @@ -1,96 +0,0 @@ -package prefixedio - -import ( - "bytes" - "io" - "strings" - "testing" -) - -func TestReader(t *testing.T) { - var fooBuf, barBuf, defBuf bytes.Buffer - - original := bytes.NewReader([]byte(strings.TrimSpace(testInput))) - r, err := NewReader(original) - if err != nil { - t.Fatalf("err: %s", err) - } - - pFoo, err := r.Prefix("foo: ") - if err != nil { - t.Fatalf("err: %s", err) - } - _, err = r.Prefix("foo: ") - if err == nil { - t.Fatalf("expected prefix already registered error") - } - pBar, err := r.Prefix("bar: ") - if err != nil { - t.Fatalf("err: %s", err) - } - pDefault, err := r.Prefix("") - if err != nil { - t.Fatalf("err: %s", err) - } - - doneCh := make(chan struct{}, 3) - go func() { - if _, err := io.Copy(&fooBuf, pFoo); err != nil { - t.Fatalf("err: %s", err) - } - doneCh <- struct{}{} - }() - go func() { - if _, err := io.Copy(&barBuf, pBar); err != nil { - t.Fatalf("err: %s", err) - } - doneCh <- struct{}{} - }() - go func() { - if _, err := io.Copy(&defBuf, pDefault); err != nil { - t.Fatalf("err: %s", err) - } - doneCh <- struct{}{} - }() - - // Wait for all the reads to be done - <-doneCh - <-doneCh - <-doneCh - - if fooBuf.String() != testInputFoo { - t.Fatalf("bad: %s", fooBuf.String()) - } - if barBuf.String() != testInputBar { - t.Fatalf("bad: %s", barBuf.String()) - } - if defBuf.String() != testInputDef { - t.Fatalf("bad: %s", defBuf.String()) - } -} - -const testInput = ` -what -hello -foo: 1 -bar: 2 -bar: 3 -42 -foo: 4 -foo: 5 -bar: 6 -` - -const testInputFoo = `1 -4 -5 -` - -const testInputBar = `2 -3 -42 -6` - -const testInputDef = `what -hello -` diff --git a/vendor/github.com/mitchellh/reflectwalk/reflectwalk_test.go b/vendor/github.com/mitchellh/reflectwalk/reflectwalk_test.go deleted file mode 100644 index 4ec1066e7a..0000000000 --- a/vendor/github.com/mitchellh/reflectwalk/reflectwalk_test.go +++ /dev/null @@ -1,377 +0,0 @@ -package reflectwalk - -import ( - "reflect" - "testing" -) - -type TestEnterExitWalker struct { - Locs []Location -} - -func (t *TestEnterExitWalker) Enter(l Location) error { - if t.Locs == nil { - t.Locs = make([]Location, 0, 5) - } - - t.Locs = append(t.Locs, l) - return nil -} - -func (t *TestEnterExitWalker) Exit(l Location) error { - t.Locs = append(t.Locs, l) - return nil -} - -type TestPointerWalker struct { - Ps []bool -} - -func (t *TestPointerWalker) PointerEnter(v bool) error { - t.Ps = append(t.Ps, v) - return nil -} - -func (t *TestPointerWalker) PointerExit(v bool) error { - return nil -} - -type TestPrimitiveWalker struct { - Value reflect.Value -} - -func (t *TestPrimitiveWalker) Primitive(v reflect.Value) error { - t.Value = v - return nil -} - -type TestPrimitiveCountWalker struct { - Count int -} - -func (t *TestPrimitiveCountWalker) Primitive(v reflect.Value) error { - t.Count += 1 - return nil -} - -type TestPrimitiveReplaceWalker struct { - Value reflect.Value -} - -func (t *TestPrimitiveReplaceWalker) Primitive(v reflect.Value) error { - v.Set(reflect.ValueOf("bar")) - return nil -} - -type TestMapWalker struct { - MapVal reflect.Value - Keys []string - Values []string -} - -func (t *TestMapWalker) Map(m reflect.Value) error { - t.MapVal = m - return nil -} - -func (t *TestMapWalker) MapElem(m, k, v reflect.Value) error { - if t.Keys == nil { - t.Keys = make([]string, 0, 1) - t.Values = make([]string, 0, 1) - } - - t.Keys = append(t.Keys, k.Interface().(string)) - t.Values = append(t.Values, v.Interface().(string)) - return nil -} - -type TestSliceWalker struct { - Count int - SliceVal reflect.Value -} - -func (t *TestSliceWalker) Slice(v reflect.Value) error { - t.SliceVal = v - return nil -} - -func (t *TestSliceWalker) SliceElem(int, reflect.Value) error { - t.Count++ - return nil -} - -type TestStructWalker struct { - Fields []string -} - -func (t *TestStructWalker) Struct(v reflect.Value) error { - return nil -} - -func (t *TestStructWalker) StructField(sf reflect.StructField, v reflect.Value) error { - if t.Fields == nil { - t.Fields = make([]string, 0, 1) - } - - t.Fields = append(t.Fields, sf.Name) - return nil -} - -func TestTestStructs(t *testing.T) { - var raw interface{} - raw = new(TestEnterExitWalker) - if _, ok := raw.(EnterExitWalker); !ok { - t.Fatal("EnterExitWalker is bad") - } - - raw = new(TestPrimitiveWalker) - if _, ok := raw.(PrimitiveWalker); !ok { - t.Fatal("PrimitiveWalker is bad") - } - - raw = new(TestMapWalker) - if _, ok := raw.(MapWalker); !ok { - t.Fatal("MapWalker is bad") - } - - raw = new(TestSliceWalker) - if _, ok := raw.(SliceWalker); !ok { - t.Fatal("SliceWalker is bad") - } - - raw = new(TestStructWalker) - if _, ok := raw.(StructWalker); !ok { - t.Fatal("StructWalker is bad") - } -} - -func TestWalk_Basic(t *testing.T) { - w := new(TestPrimitiveWalker) - - type S struct { - Foo string - } - - data := &S{ - Foo: "foo", - } - - err := Walk(data, w) - if err != nil { - t.Fatalf("err: %s", err) - } - - if w.Value.Kind() != reflect.String { - t.Fatalf("bad: %#v", w.Value) - } -} - -func TestWalk_Basic_Replace(t *testing.T) { - w := new(TestPrimitiveReplaceWalker) - - type S struct { - Foo string - Bar []interface{} - } - - data := &S{ - Foo: "foo", - Bar: []interface{}{[]string{"what"}}, - } - - err := Walk(data, w) - if err != nil { - t.Fatalf("err: %s", err) - } - - if data.Foo != "bar" { - t.Fatalf("bad: %#v", data.Foo) - } - if data.Bar[0].([]string)[0] != "bar" { - t.Fatalf("bad: %#v", data.Bar) - } -} - -func TestWalk_EnterExit(t *testing.T) { - w := new(TestEnterExitWalker) - - type S struct { - A string - M map[string]string - } - - data := &S{ - A: "foo", - M: map[string]string{ - "a": "b", - }, - } - - err := Walk(data, w) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []Location{ - WalkLoc, - Struct, - StructField, - StructField, - StructField, - Map, - MapKey, - MapKey, - MapValue, - MapValue, - Map, - StructField, - Struct, - WalkLoc, - } - if !reflect.DeepEqual(w.Locs, expected) { - t.Fatalf("Bad: %#v", w.Locs) - } -} - -func TestWalk_Interface(t *testing.T) { - w := new(TestPrimitiveCountWalker) - - type S struct { - Foo string - Bar []interface{} - } - - var data interface{} = &S{ - Foo: "foo", - Bar: []interface{}{[]string{"bar", "what"}, "baz"}, - } - - err := Walk(data, w) - if err != nil { - t.Fatalf("err: %s", err) - } - - if w.Count != 4 { - t.Fatalf("bad: %#v", w.Count) - } -} - -func TestWalk_Interface_nil(t *testing.T) { - w := new(TestPrimitiveCountWalker) - - type S struct { - Bar interface{} - } - - var data interface{} = &S{} - - err := Walk(data, w) - if err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestWalk_Map(t *testing.T) { - w := new(TestMapWalker) - - type S struct { - Foo map[string]string - } - - data := &S{ - Foo: map[string]string{ - "foo": "foov", - "bar": "barv", - }, - } - - err := Walk(data, w) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(w.MapVal.Interface(), data.Foo) { - t.Fatalf("Bad: %#v", w.MapVal.Interface()) - } - - expectedK := []string{"foo", "bar"} - if !reflect.DeepEqual(w.Keys, expectedK) { - t.Fatalf("Bad keys: %#v", w.Keys) - } - - expectedV := []string{"foov", "barv"} - if !reflect.DeepEqual(w.Values, expectedV) { - t.Fatalf("Bad values: %#v", w.Values) - } -} - -func TestWalk_Pointer(t *testing.T) { - w := new(TestPointerWalker) - - type S struct { - Foo string - } - - data := &S{ - Foo: "foo", - } - - err := Walk(data, w) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []bool{true, false} - if !reflect.DeepEqual(w.Ps, expected) { - t.Fatalf("bad: %#v", w.Ps) - } -} - -func TestWalk_Slice(t *testing.T) { - w := new(TestSliceWalker) - - type S struct { - Foo []string - } - - data := &S{ - Foo: []string{"a", "b", "c"}, - } - - err := Walk(data, w) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(w.SliceVal.Interface(), data.Foo) { - t.Fatalf("bad: %#v", w.SliceVal.Interface()) - } - - if w.Count != 3 { - t.Fatalf("Bad count: %d", w.Count) - } -} - -func TestWalk_Struct(t *testing.T) { - w := new(TestStructWalker) - - type S struct { - Foo string - Bar string - } - - data := &S{ - Foo: "foo", - Bar: "bar", - } - - err := Walk(data, w) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := []string{"Foo", "Bar"} - if !reflect.DeepEqual(w.Fields, expected) { - t.Fatalf("bad: %#v", w.Fields) - } -} diff --git a/vendor/github.com/nesv/go-dynect/LICENSE.md b/vendor/github.com/nesv/go-dynect/LICENSE.md new file mode 100644 index 0000000000..9f66f66053 --- /dev/null +++ b/vendor/github.com/nesv/go-dynect/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013 Nick Saika + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/nesv/go-dynect/dynect/client_test.go b/vendor/github.com/nesv/go-dynect/dynect/client_test.go deleted file mode 100644 index 8916d9981f..0000000000 --- a/vendor/github.com/nesv/go-dynect/dynect/client_test.go +++ /dev/null @@ -1,114 +0,0 @@ -package dynect - -import ( - "os" - "testing" - "strings" -) - -var ( - DynCustomerName string - DynUsername string - DynPassword string - testZone string -) - -func init() { - DynCustomerName = os.Getenv("DYNECT_CUSTOMER_NAME") - DynUsername = os.Getenv("DYNECT_USER_NAME") - DynPassword = os.Getenv("DYNECT_PASSWORD") - testZone = os.Getenv("DYNECT_TEST_ZONE") -} - -func TestSetup(t *testing.T) { - if len(DynCustomerName) == 0 { - t.Fatal("DYNECT_CUSTOMER_NAME not set") - } - - if len(DynUsername) == 0 { - t.Fatal("DYNECT_USER_NAME not set") - } - - if len(DynPassword) == 0 { - t.Fatal("DYNECT_PASSWORD not set") - } - - if len(testZone) == 0 { - t.Fatal("DYNECT_TEST_ZONE not specified") - } -} - -func TestLoginLogout(t *testing.T) { - client := NewClient(DynCustomerName) - client.Verbose(true) - err := client.Login(DynUsername, DynPassword) - if err != nil { - t.Error(err) - } - - err = client.Logout() - if err != nil { - t.Error(err) - } -} - -func TestZonesRequest(t *testing.T) { - client := NewClient(DynCustomerName) - client.Verbose(true) - err := client.Login(DynUsername, DynPassword) - if err != nil { - t.Error(err) - } - defer func() { - err = client.Logout() - if err != nil { - t.Error(err) - } - }() - - var resp ZonesResponse - err = client.Do("GET", "Zone", nil, &resp) - if err != nil { - t.Error(err) - } - - nresults := len(resp.Data) - for i, zone := range resp.Data { - parts := strings.Split(zone, "/") - t.Logf("(%d/%d) %q", i+1, nresults, parts[len(parts)-2]) - } -} - -func TestFetchingAllZoneRecords(t *testing.T) { - client := NewClient(DynCustomerName) - client.Verbose(true) - err := client.Login(DynUsername, DynPassword) - if err != nil { - t.Error(err) - } - defer func() { - err = client.Logout() - if err != nil { - t.Error(err) - } - }() - - var resp AllRecordsResponse - err = client.Do("GET", "AllRecord/" + testZone, nil, &resp) - if err != nil { - t.Error(err) - } - for _, zr := range resp.Data { - parts := strings.Split(zr, "/") - uri := strings.Join(parts[2:], "/") - t.Log(uri) - - var record RecordResponse - err := client.Do("GET", uri, nil, &record) - if err != nil { - t.Fatal(err) - } - - t.Log("OK") - } -} diff --git a/vendor/github.com/nu7hatch/gouuid/example_test.go b/vendor/github.com/nu7hatch/gouuid/example_test.go deleted file mode 100644 index 9e86fdc3db..0000000000 --- a/vendor/github.com/nu7hatch/gouuid/example_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package uuid_test - -import ( - "fmt" - "github.com/nu7hatch/gouuid" -) - -func ExampleNewV4() { - u4, err := uuid.NewV4() - if err != nil { - fmt.Println("error:", err) - return - } - fmt.Println(u4) -} - -func ExampleNewV5() { - u5, err := uuid.NewV5(uuid.NamespaceURL, []byte("nu7hat.ch")) - if err != nil { - fmt.Println("error:", err) - return - } - fmt.Println(u5) -} - -func ExampleParseHex() { - u, err := uuid.ParseHex("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - if err != nil { - fmt.Println("error:", err) - return - } - fmt.Println(u) -} diff --git a/vendor/github.com/nu7hatch/gouuid/uuid_test.go b/vendor/github.com/nu7hatch/gouuid/uuid_test.go deleted file mode 100644 index 70ed346f08..0000000000 --- a/vendor/github.com/nu7hatch/gouuid/uuid_test.go +++ /dev/null @@ -1,135 +0,0 @@ -// This package provides immutable UUID structs and the functions -// NewV3, NewV4, NewV5 and Parse() for generating versions 3, 4 -// and 5 UUIDs as specified in RFC 4122. -// -// Copyright (C) 2011 by Krzysztof Kowalik -package uuid - -import ( - "regexp" - "testing" -) - -const format = "^[a-z0-9]{8}-[a-z0-9]{4}-[1-5][a-z0-9]{3}-[a-z0-9]{4}-[a-z0-9]{12}$" - -func TestParse(t *testing.T) { - _, err := Parse([]byte{1, 2, 3, 4, 5}) - if err == nil { - t.Errorf("Expected error due to invalid UUID sequence") - } - base, _ := NewV4() - u, err := Parse(base[:]) - if err != nil { - t.Errorf("Expected to parse UUID sequence without problems") - return - } - if u.String() != base.String() { - t.Errorf("Expected parsed UUID to be the same as base, %s != %s", u.String(), base.String()) - } -} - -func TestParseString(t *testing.T) { - _, err := ParseHex("foo") - if err == nil { - t.Errorf("Expected error due to invalid UUID string") - } - base, _ := NewV4() - u, err := ParseHex(base.String()) - if err != nil { - t.Errorf("Expected to parse UUID sequence without problems") - return - } - if u.String() != base.String() { - t.Errorf("Expected parsed UUID to be the same as base, %s != %s", u.String(), base.String()) - } -} - -func TestNewV3(t *testing.T) { - u, err := NewV3(NamespaceURL, []byte("golang.org")) - if err != nil { - t.Errorf("Expected to generate UUID without problems, error thrown: %d", err.Error()) - return - } - if u.Version() != 3 { - t.Errorf("Expected to generate UUIDv3, given %d", u.Version()) - } - if u.Variant() != ReservedRFC4122 { - t.Errorf("Expected to generate UUIDv3 RFC4122 variant, given %x", u.Variant()) - } - re := regexp.MustCompile(format) - if !re.MatchString(u.String()) { - t.Errorf("Expected string representation to be valid, given %s", u.String()) - } - u2, _ := NewV3(NamespaceURL, []byte("golang.org")) - if u2.String() != u.String() { - t.Errorf("Expected UUIDs generated of the same namespace and name to be the same") - } - u3, _ := NewV3(NamespaceDNS, []byte("golang.org")) - if u3.String() == u.String() { - t.Errorf("Expected UUIDs generated of different namespace and the same name to be different") - } - u4, _ := NewV3(NamespaceURL, []byte("code.google.com")) - if u4.String() == u.String() { - t.Errorf("Expected UUIDs generated of the same namespace and different names to be different") - } -} - -func TestNewV4(t *testing.T) { - u, err := NewV4() - if err != nil { - t.Errorf("Expected to generate UUID without problems, error thrown: %s", err.Error()) - return - } - if u.Version() != 4 { - t.Errorf("Expected to generate UUIDv4, given %d", u.Version()) - } - if u.Variant() != ReservedRFC4122 { - t.Errorf("Expected to generate UUIDv4 RFC4122 variant, given %x", u.Variant()) - } - re := regexp.MustCompile(format) - if !re.MatchString(u.String()) { - t.Errorf("Expected string representation to be valid, given %s", u.String()) - } -} - -func TestNewV5(t *testing.T) { - u, err := NewV5(NamespaceURL, []byte("golang.org")) - if err != nil { - t.Errorf("Expected to generate UUID without problems, error thrown: %d", err.Error()) - return - } - if u.Version() != 5 { - t.Errorf("Expected to generate UUIDv5, given %d", u.Version()) - } - if u.Variant() != ReservedRFC4122 { - t.Errorf("Expected to generate UUIDv5 RFC4122 variant, given %x", u.Variant()) - } - re := regexp.MustCompile(format) - if !re.MatchString(u.String()) { - t.Errorf("Expected string representation to be valid, given %s", u.String()) - } - u2, _ := NewV5(NamespaceURL, []byte("golang.org")) - if u2.String() != u.String() { - t.Errorf("Expected UUIDs generated of the same namespace and name to be the same") - } - u3, _ := NewV5(NamespaceDNS, []byte("golang.org")) - if u3.String() == u.String() { - t.Errorf("Expected UUIDs generated of different namespace and the same name to be different") - } - u4, _ := NewV5(NamespaceURL, []byte("code.google.com")) - if u4.String() == u.String() { - t.Errorf("Expected UUIDs generated of the same namespace and different names to be different") - } -} - -func BenchmarkParseHex(b *testing.B) { - s := "f3593cff-ee92-40df-4086-87825b523f13" - for i := 0; i < b.N; i++ { - _, err := ParseHex(s) - if err != nil { - b.Fatal(err) - } - } - b.StopTimer() - b.ReportAllocs() -} diff --git a/vendor/github.com/packer-community/winrmcp/LICENSE b/vendor/github.com/packer-community/winrmcp/LICENSE new file mode 100644 index 0000000000..22a81f8c9d --- /dev/null +++ b/vendor/github.com/packer-community/winrmcp/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2015 Dylan Meissner + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/packer-community/winrmcp/winrmcp/endpoint_test.go b/vendor/github.com/packer-community/winrmcp/winrmcp/endpoint_test.go deleted file mode 100644 index b9143cf27d..0000000000 --- a/vendor/github.com/packer-community/winrmcp/winrmcp/endpoint_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package winrmcp - -import "testing" - -func Test_parsing_an_addr_to_a_winrm_endpoint(t *testing.T) { - endpoint, err := parseEndpoint("1.2.3.4:1234", false, false, nil) - - if err != nil { - t.Fatalf("Should not have been an error: %v", err) - } - if endpoint == nil { - t.Error("Endpoint should not be nil") - } - if endpoint.Host != "1.2.3.4" { - t.Error("Host should be 1.2.3.4") - } - if endpoint.Port != 1234 { - t.Error("Port should be 1234") - } - if endpoint.Insecure { - t.Error("Endpoint should be insecure") - } - if endpoint.HTTPS { - t.Error("Endpoint should be HTTP not HTTPS") - } -} - -func Test_parsing_an_addr_without_a_port_to_a_winrm_endpoint(t *testing.T) { - certBytes := []byte{1, 2, 3, 4, 5, 6} - endpoint, err := parseEndpoint("1.2.3.4", true, true, certBytes) - - if err != nil { - t.Fatalf("Should not have been an error: %v", err) - } - if endpoint == nil { - t.Error("Endpoint should not be nil") - } - if endpoint.Host != "1.2.3.4" { - t.Error("Host should be 1.2.3.4") - } - if endpoint.Port != 5985 { - t.Error("Port should be 5985") - } - if endpoint.Insecure != true { - t.Error("Endpoint should be insecure") - } - if endpoint.HTTPS != true { - t.Error("Endpoint should be HTTPS") - } - - if len(*endpoint.CACert) != len(certBytes) { - t.Error("Length of CACert is wrong") - } - for i := 0; i < len(certBytes); i++ { - if (*endpoint.CACert)[i] != certBytes[i] { - t.Error("CACert is not set correctly") - } - } -} - -func Test_parsing_an_empty_addr_to_a_winrm_endpoint(t *testing.T) { - endpoint, err := parseEndpoint("", false, false, nil) - - if endpoint != nil { - t.Error("Endpoint should be nil") - } - if err == nil { - t.Error("Expected an error") - } -} - -func Test_parsing_an_addr_with_a_bad_port(t *testing.T) { - endpoint, err := parseEndpoint("1.2.3.4:ABCD", false, false, nil) - - if endpoint != nil { - t.Error("Endpoint should be nil") - } - if err == nil { - t.Error("Expected an error") - } -} diff --git a/vendor/github.com/pborman/uuid/json_test.go b/vendor/github.com/pborman/uuid/json_test.go deleted file mode 100644 index b5eae09247..0000000000 --- a/vendor/github.com/pborman/uuid/json_test.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "encoding/json" - "reflect" - "testing" -) - -var testUUID = Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479") - -func TestJSON(t *testing.T) { - type S struct { - ID1 UUID - ID2 UUID - } - s1 := S{ID1: testUUID} - data, err := json.Marshal(&s1) - if err != nil { - t.Fatal(err) - } - var s2 S - if err := json.Unmarshal(data, &s2); err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(&s1, &s2) { - t.Errorf("got %#v, want %#v", s2, s1) - } -} diff --git a/vendor/github.com/pborman/uuid/seq_test.go b/vendor/github.com/pborman/uuid/seq_test.go deleted file mode 100644 index 3b3d1430d5..0000000000 --- a/vendor/github.com/pborman/uuid/seq_test.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2014 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "flag" - "runtime" - "testing" - "time" -) - -// This test is only run when --regressions is passed on the go test line. -var regressions = flag.Bool("regressions", false, "run uuid regression tests") - -// TestClockSeqRace tests for a particular race condition of returning two -// identical Version1 UUIDs. The duration of 1 minute was chosen as the race -// condition, before being fixed, nearly always occured in under 30 seconds. -func TestClockSeqRace(t *testing.T) { - if !*regressions { - t.Skip("skipping regression tests") - } - duration := time.Minute - - done := make(chan struct{}) - defer close(done) - - ch := make(chan UUID, 10000) - ncpu := runtime.NumCPU() - switch ncpu { - case 0, 1: - // We can't run the test effectively. - t.Skip("skipping race test, only one CPU detected") - return - default: - runtime.GOMAXPROCS(ncpu) - } - for i := 0; i < ncpu; i++ { - go func() { - for { - select { - case <-done: - return - case ch <- NewUUID(): - } - } - }() - } - - uuids := make(map[string]bool) - cnt := 0 - start := time.Now() - for u := range ch { - s := u.String() - if uuids[s] { - t.Errorf("duplicate uuid after %d in %v: %s", cnt, time.Since(start), s) - return - } - uuids[s] = true - if time.Since(start) > duration { - return - } - cnt++ - } -} diff --git a/vendor/github.com/pborman/uuid/sql_test.go b/vendor/github.com/pborman/uuid/sql_test.go deleted file mode 100644 index 83bac8cac0..0000000000 --- a/vendor/github.com/pborman/uuid/sql_test.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2015 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "strings" - "testing" -) - -func TestScan(t *testing.T) { - var stringTest string = "f47ac10b-58cc-0372-8567-0e02b2c3d479" - var byteTest []byte = Parse(stringTest) - var badTypeTest int = 6 - var invalidTest string = "f47ac10b-58cc-0372-8567-0e02b2c3d4" - var invalidByteTest []byte = Parse(invalidTest) - - var uuid UUID - err := (&uuid).Scan(stringTest) - if err != nil { - t.Fatal(err) - } - - err = (&uuid).Scan([]byte(stringTest)) - if err != nil { - t.Fatal(err) - } - - err = (&uuid).Scan(byteTest) - if err != nil { - t.Fatal(err) - } - - err = (&uuid).Scan(badTypeTest) - if err == nil { - t.Error("int correctly parsed and shouldn't have") - } - if !strings.Contains(err.Error(), "unable to scan type") { - t.Error("attempting to parse an int returned an incorrect error message") - } - - err = (&uuid).Scan(invalidTest) - if err == nil { - t.Error("invalid uuid was parsed without error") - } - if !strings.Contains(err.Error(), "invalid UUID") { - t.Error("attempting to parse an invalid UUID returned an incorrect error message") - } - - err = (&uuid).Scan(invalidByteTest) - if err == nil { - t.Error("invalid byte uuid was parsed without error") - } - if !strings.Contains(err.Error(), "invalid UUID") { - t.Error("attempting to parse an invalid byte UUID returned an incorrect error message") - } -} diff --git a/vendor/github.com/pborman/uuid/uuid_test.go b/vendor/github.com/pborman/uuid/uuid_test.go deleted file mode 100644 index 417ebeb26a..0000000000 --- a/vendor/github.com/pborman/uuid/uuid_test.go +++ /dev/null @@ -1,390 +0,0 @@ -// Copyright 2011 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "bytes" - "fmt" - "os" - "strings" - "testing" - "time" -) - -type test struct { - in string - version Version - variant Variant - isuuid bool -} - -var tests = []test{ - {"f47ac10b-58cc-0372-8567-0e02b2c3d479", 0, RFC4122, true}, - {"f47ac10b-58cc-1372-8567-0e02b2c3d479", 1, RFC4122, true}, - {"f47ac10b-58cc-2372-8567-0e02b2c3d479", 2, RFC4122, true}, - {"f47ac10b-58cc-3372-8567-0e02b2c3d479", 3, RFC4122, true}, - {"f47ac10b-58cc-4372-8567-0e02b2c3d479", 4, RFC4122, true}, - {"f47ac10b-58cc-5372-8567-0e02b2c3d479", 5, RFC4122, true}, - {"f47ac10b-58cc-6372-8567-0e02b2c3d479", 6, RFC4122, true}, - {"f47ac10b-58cc-7372-8567-0e02b2c3d479", 7, RFC4122, true}, - {"f47ac10b-58cc-8372-8567-0e02b2c3d479", 8, RFC4122, true}, - {"f47ac10b-58cc-9372-8567-0e02b2c3d479", 9, RFC4122, true}, - {"f47ac10b-58cc-a372-8567-0e02b2c3d479", 10, RFC4122, true}, - {"f47ac10b-58cc-b372-8567-0e02b2c3d479", 11, RFC4122, true}, - {"f47ac10b-58cc-c372-8567-0e02b2c3d479", 12, RFC4122, true}, - {"f47ac10b-58cc-d372-8567-0e02b2c3d479", 13, RFC4122, true}, - {"f47ac10b-58cc-e372-8567-0e02b2c3d479", 14, RFC4122, true}, - {"f47ac10b-58cc-f372-8567-0e02b2c3d479", 15, RFC4122, true}, - - {"urn:uuid:f47ac10b-58cc-4372-0567-0e02b2c3d479", 4, Reserved, true}, - {"URN:UUID:f47ac10b-58cc-4372-0567-0e02b2c3d479", 4, Reserved, true}, - {"f47ac10b-58cc-4372-0567-0e02b2c3d479", 4, Reserved, true}, - {"f47ac10b-58cc-4372-1567-0e02b2c3d479", 4, Reserved, true}, - {"f47ac10b-58cc-4372-2567-0e02b2c3d479", 4, Reserved, true}, - {"f47ac10b-58cc-4372-3567-0e02b2c3d479", 4, Reserved, true}, - {"f47ac10b-58cc-4372-4567-0e02b2c3d479", 4, Reserved, true}, - {"f47ac10b-58cc-4372-5567-0e02b2c3d479", 4, Reserved, true}, - {"f47ac10b-58cc-4372-6567-0e02b2c3d479", 4, Reserved, true}, - {"f47ac10b-58cc-4372-7567-0e02b2c3d479", 4, Reserved, true}, - {"f47ac10b-58cc-4372-8567-0e02b2c3d479", 4, RFC4122, true}, - {"f47ac10b-58cc-4372-9567-0e02b2c3d479", 4, RFC4122, true}, - {"f47ac10b-58cc-4372-a567-0e02b2c3d479", 4, RFC4122, true}, - {"f47ac10b-58cc-4372-b567-0e02b2c3d479", 4, RFC4122, true}, - {"f47ac10b-58cc-4372-c567-0e02b2c3d479", 4, Microsoft, true}, - {"f47ac10b-58cc-4372-d567-0e02b2c3d479", 4, Microsoft, true}, - {"f47ac10b-58cc-4372-e567-0e02b2c3d479", 4, Future, true}, - {"f47ac10b-58cc-4372-f567-0e02b2c3d479", 4, Future, true}, - - {"f47ac10b158cc-5372-a567-0e02b2c3d479", 0, Invalid, false}, - {"f47ac10b-58cc25372-a567-0e02b2c3d479", 0, Invalid, false}, - {"f47ac10b-58cc-53723a567-0e02b2c3d479", 0, Invalid, false}, - {"f47ac10b-58cc-5372-a56740e02b2c3d479", 0, Invalid, false}, - {"f47ac10b-58cc-5372-a567-0e02-2c3d479", 0, Invalid, false}, - {"g47ac10b-58cc-4372-a567-0e02b2c3d479", 0, Invalid, false}, -} - -var constants = []struct { - c interface{} - name string -}{ - {Person, "Person"}, - {Group, "Group"}, - {Org, "Org"}, - {Invalid, "Invalid"}, - {RFC4122, "RFC4122"}, - {Reserved, "Reserved"}, - {Microsoft, "Microsoft"}, - {Future, "Future"}, - {Domain(17), "Domain17"}, - {Variant(42), "BadVariant42"}, -} - -func testTest(t *testing.T, in string, tt test) { - uuid := Parse(in) - if ok := (uuid != nil); ok != tt.isuuid { - t.Errorf("Parse(%s) got %v expected %v\b", in, ok, tt.isuuid) - } - if uuid == nil { - return - } - - if v := uuid.Variant(); v != tt.variant { - t.Errorf("Variant(%s) got %d expected %d\b", in, v, tt.variant) - } - if v, _ := uuid.Version(); v != tt.version { - t.Errorf("Version(%s) got %d expected %d\b", in, v, tt.version) - } -} - -func TestUUID(t *testing.T) { - for _, tt := range tests { - testTest(t, tt.in, tt) - testTest(t, strings.ToUpper(tt.in), tt) - } -} - -func TestConstants(t *testing.T) { - for x, tt := range constants { - v, ok := tt.c.(fmt.Stringer) - if !ok { - t.Errorf("%x: %v: not a stringer", x, v) - } else if s := v.String(); s != tt.name { - v, _ := tt.c.(int) - t.Errorf("%x: Constant %T:%d gives %q, expected %q\n", x, tt.c, v, s, tt.name) - } - } -} - -func TestRandomUUID(t *testing.T) { - m := make(map[string]bool) - for x := 1; x < 32; x++ { - uuid := NewRandom() - s := uuid.String() - if m[s] { - t.Errorf("NewRandom returned duplicated UUID %s\n", s) - } - m[s] = true - if v, _ := uuid.Version(); v != 4 { - t.Errorf("Random UUID of version %s\n", v) - } - if uuid.Variant() != RFC4122 { - t.Errorf("Random UUID is variant %d\n", uuid.Variant()) - } - } -} - -func TestNew(t *testing.T) { - m := make(map[string]bool) - for x := 1; x < 32; x++ { - s := New() - if m[s] { - t.Errorf("New returned duplicated UUID %s\n", s) - } - m[s] = true - uuid := Parse(s) - if uuid == nil { - t.Errorf("New returned %q which does not decode\n", s) - continue - } - if v, _ := uuid.Version(); v != 4 { - t.Errorf("Random UUID of version %s\n", v) - } - if uuid.Variant() != RFC4122 { - t.Errorf("Random UUID is variant %d\n", uuid.Variant()) - } - } -} - -func clockSeq(t *testing.T, uuid UUID) int { - seq, ok := uuid.ClockSequence() - if !ok { - t.Fatalf("%s: invalid clock sequence\n", uuid) - } - return seq -} - -func TestClockSeq(t *testing.T) { - // Fake time.Now for this test to return a monotonically advancing time; restore it at end. - defer func(orig func() time.Time) { timeNow = orig }(timeNow) - monTime := time.Now() - timeNow = func() time.Time { - monTime = monTime.Add(1 * time.Second) - return monTime - } - - SetClockSequence(-1) - uuid1 := NewUUID() - uuid2 := NewUUID() - - if clockSeq(t, uuid1) != clockSeq(t, uuid2) { - t.Errorf("clock sequence %d != %d\n", clockSeq(t, uuid1), clockSeq(t, uuid2)) - } - - SetClockSequence(-1) - uuid2 = NewUUID() - - // Just on the very off chance we generated the same sequence - // two times we try again. - if clockSeq(t, uuid1) == clockSeq(t, uuid2) { - SetClockSequence(-1) - uuid2 = NewUUID() - } - if clockSeq(t, uuid1) == clockSeq(t, uuid2) { - t.Errorf("Duplicate clock sequence %d\n", clockSeq(t, uuid1)) - } - - SetClockSequence(0x1234) - uuid1 = NewUUID() - if seq := clockSeq(t, uuid1); seq != 0x1234 { - t.Errorf("%s: expected seq 0x1234 got 0x%04x\n", uuid1, seq) - } -} - -func TestCoding(t *testing.T) { - text := "7d444840-9dc0-11d1-b245-5ffdce74fad2" - urn := "urn:uuid:7d444840-9dc0-11d1-b245-5ffdce74fad2" - data := UUID{ - 0x7d, 0x44, 0x48, 0x40, - 0x9d, 0xc0, - 0x11, 0xd1, - 0xb2, 0x45, - 0x5f, 0xfd, 0xce, 0x74, 0xfa, 0xd2, - } - if v := data.String(); v != text { - t.Errorf("%x: encoded to %s, expected %s\n", data, v, text) - } - if v := data.URN(); v != urn { - t.Errorf("%x: urn is %s, expected %s\n", data, v, urn) - } - - uuid := Parse(text) - if !Equal(uuid, data) { - t.Errorf("%s: decoded to %s, expected %s\n", text, uuid, data) - } -} - -func TestVersion1(t *testing.T) { - uuid1 := NewUUID() - uuid2 := NewUUID() - - if Equal(uuid1, uuid2) { - t.Errorf("%s:duplicate uuid\n", uuid1) - } - if v, _ := uuid1.Version(); v != 1 { - t.Errorf("%s: version %s expected 1\n", uuid1, v) - } - if v, _ := uuid2.Version(); v != 1 { - t.Errorf("%s: version %s expected 1\n", uuid2, v) - } - n1 := uuid1.NodeID() - n2 := uuid2.NodeID() - if !bytes.Equal(n1, n2) { - t.Errorf("Different nodes %x != %x\n", n1, n2) - } - t1, ok := uuid1.Time() - if !ok { - t.Errorf("%s: invalid time\n", uuid1) - } - t2, ok := uuid2.Time() - if !ok { - t.Errorf("%s: invalid time\n", uuid2) - } - q1, ok := uuid1.ClockSequence() - if !ok { - t.Errorf("%s: invalid clock sequence\n", uuid1) - } - q2, ok := uuid2.ClockSequence() - if !ok { - t.Errorf("%s: invalid clock sequence", uuid2) - } - - switch { - case t1 == t2 && q1 == q2: - t.Errorf("time stopped\n") - case t1 > t2 && q1 == q2: - t.Errorf("time reversed\n") - case t1 < t2 && q1 != q2: - t.Errorf("clock sequence chaned unexpectedly\n") - } -} - -func TestNodeAndTime(t *testing.T) { - // Time is February 5, 1998 12:30:23.136364800 AM GMT - - uuid := Parse("7d444840-9dc0-11d1-b245-5ffdce74fad2") - node := []byte{0x5f, 0xfd, 0xce, 0x74, 0xfa, 0xd2} - - ts, ok := uuid.Time() - if ok { - c := time.Unix(ts.UnixTime()) - want := time.Date(1998, 2, 5, 0, 30, 23, 136364800, time.UTC) - if !c.Equal(want) { - t.Errorf("Got time %v, want %v", c, want) - } - } else { - t.Errorf("%s: bad time\n", uuid) - } - if !bytes.Equal(node, uuid.NodeID()) { - t.Errorf("Expected node %v got %v\n", node, uuid.NodeID()) - } -} - -func TestMD5(t *testing.T) { - uuid := NewMD5(NameSpace_DNS, []byte("python.org")).String() - want := "6fa459ea-ee8a-3ca4-894e-db77e160355e" - if uuid != want { - t.Errorf("MD5: got %q expected %q\n", uuid, want) - } -} - -func TestSHA1(t *testing.T) { - uuid := NewSHA1(NameSpace_DNS, []byte("python.org")).String() - want := "886313e1-3b8a-5372-9b90-0c9aee199e5d" - if uuid != want { - t.Errorf("SHA1: got %q expected %q\n", uuid, want) - } -} - -func TestNodeID(t *testing.T) { - nid := []byte{1, 2, 3, 4, 5, 6} - SetNodeInterface("") - s := NodeInterface() - if s == "" || s == "user" { - t.Errorf("NodeInterface %q after SetInteface\n", s) - } - node1 := NodeID() - if node1 == nil { - t.Errorf("NodeID nil after SetNodeInterface\n", s) - } - SetNodeID(nid) - s = NodeInterface() - if s != "user" { - t.Errorf("Expected NodeInterface %q got %q\n", "user", s) - } - node2 := NodeID() - if node2 == nil { - t.Errorf("NodeID nil after SetNodeID\n", s) - } - if bytes.Equal(node1, node2) { - t.Errorf("NodeID not changed after SetNodeID\n", s) - } else if !bytes.Equal(nid, node2) { - t.Errorf("NodeID is %x, expected %x\n", node2, nid) - } -} - -func testDCE(t *testing.T, name string, uuid UUID, domain Domain, id uint32) { - if uuid == nil { - t.Errorf("%s failed\n", name) - return - } - if v, _ := uuid.Version(); v != 2 { - t.Errorf("%s: %s: expected version 2, got %s\n", name, uuid, v) - return - } - if v, ok := uuid.Domain(); !ok || v != domain { - if !ok { - t.Errorf("%s: %d: Domain failed\n", name, uuid) - } else { - t.Errorf("%s: %s: expected domain %d, got %d\n", name, uuid, domain, v) - } - } - if v, ok := uuid.Id(); !ok || v != id { - if !ok { - t.Errorf("%s: %d: Id failed\n", name, uuid) - } else { - t.Errorf("%s: %s: expected id %d, got %d\n", name, uuid, id, v) - } - } -} - -func TestDCE(t *testing.T) { - testDCE(t, "NewDCESecurity", NewDCESecurity(42, 12345678), 42, 12345678) - testDCE(t, "NewDCEPerson", NewDCEPerson(), Person, uint32(os.Getuid())) - testDCE(t, "NewDCEGroup", NewDCEGroup(), Group, uint32(os.Getgid())) -} - -type badRand struct{} - -func (r badRand) Read(buf []byte) (int, error) { - for i, _ := range buf { - buf[i] = byte(i) - } - return len(buf), nil -} - -func TestBadRand(t *testing.T) { - SetRand(badRand{}) - uuid1 := New() - uuid2 := New() - if uuid1 != uuid2 { - t.Errorf("execpted duplicates, got %q and %q\n", uuid1, uuid2) - } - SetRand(nil) - uuid1 = New() - uuid2 = New() - if uuid1 == uuid2 { - t.Errorf("unexecpted duplicates, got %q\n", uuid1) - } -} diff --git a/vendor/github.com/pearkes/cloudflare/api_test.go b/vendor/github.com/pearkes/cloudflare/api_test.go deleted file mode 100644 index 3cd6387dd5..0000000000 --- a/vendor/github.com/pearkes/cloudflare/api_test.go +++ /dev/null @@ -1,101 +0,0 @@ -package cloudflare - -import ( - "os" - "testing" - - . "github.com/motain/gocheck" - "github.com/pearkes/cloudflare/testutil" -) - -type S struct { - client *Client -} - -var _ = Suite(&S{}) - -var testServer = testutil.NewHTTPServer() - -func (s *S) SetUpSuite(c *C) { - testServer.Start() - var err error - s.client, err = NewClient("foobar", "foobar") - s.client.URL = "http://localhost:4444" - if err != nil { - panic(err) - } -} - -func (s *S) TearDownTest(c *C) { - testServer.Flush() -} - -func makeClient(t *testing.T) *Client { - client, err := NewClient("foobaremail", "foobartoken") - - if err != nil { - t.Fatalf("err: %v", err) - } - - if client.Token != "foobartoken" { - t.Fatalf("token not set on client: %s", client.Token) - } - - if client.Email != "foobaremail" { - t.Fatalf("email not set on client: %s", client.Token) - } - - return client -} - -func Test_NewClient_env(t *testing.T) { - os.Setenv("CLOUDFLARE_TOKEN", "bar") - os.Setenv("CLOUDFLARE_EMAIL", "bar") - client, err := NewClient("", "") - - if err != nil { - t.Fatalf("err: %v", err) - } - - if client.Token != "bar" { - t.Fatalf("token not set on client: %s", client.Token) - } - - if client.Email != "bar" { - t.Fatalf("email not set on client: %s", client.Email) - } -} - -func TestClient_NewRequest(t *testing.T) { - c := makeClient(t) - - params := map[string]string{ - "foo": "bar", - "baz": "bar", - } - req, err := c.NewRequest(params, "POST", "bar") - if err != nil { - t.Fatalf("bad: %v", err) - } - - encoded := req.URL.Query() - if encoded.Get("foo") != "bar" { - t.Fatalf("bad: %v", encoded) - } - - if encoded.Get("baz") != "bar" { - t.Fatalf("bad: %v", encoded) - } - - if encoded.Get("a") != "bar" { - t.Fatalf("bad: %v", encoded) - } - expected := "https://www.cloudflare.com/api_json.html?a=bar&baz=bar&email=foobaremail&foo=bar&tkn=foobartoken" - if req.URL.String() != expected { - t.Fatalf("bad base url: %v\n\nexpected: %v", req.URL.String(), expected) - } - - if req.Method != "POST" { - t.Fatalf("bad method: %v", req.Method) - } -} diff --git a/vendor/github.com/pearkes/cloudflare/record_test.go b/vendor/github.com/pearkes/cloudflare/record_test.go deleted file mode 100644 index e134b5ef26..0000000000 --- a/vendor/github.com/pearkes/cloudflare/record_test.go +++ /dev/null @@ -1,409 +0,0 @@ -package cloudflare - -import ( - "testing" - - . "github.com/motain/gocheck" -) - -func TestRecord(t *testing.T) { - TestingT(t) -} - -func (s *S) Test_CreateRecord(c *C) { - testServer.Response(200, nil, recordExample) - - opts := CreateRecord{ - Type: "A", - Name: "foobar", - Content: "10.0.0.1", - } - - record, err := s.client.CreateRecord("example.com", &opts) - - req := testServer.WaitRequest() - - c.Assert(req.Form["type"], DeepEquals, []string{"A"}) - c.Assert(req.Form["name"], DeepEquals, []string{"foobar"}) - c.Assert(req.Form["content"], DeepEquals, []string{"10.0.0.1"}) - c.Assert(req.Form["ttl"], DeepEquals, []string{"1"}) - c.Assert(err, IsNil) - c.Assert(record.Id, Equals, "23734516") -} - -func (s *S) Test_CreateRecordWithTTL(c *C) { - testServer.Response(200, nil, recordExample) - - opts := CreateRecord{ - Type: "A", - Name: "foobar", - Content: "10.0.0.1", - Ttl: "600", - } - - record, err := s.client.CreateRecord("example.com", &opts) - - req := testServer.WaitRequest() - - c.Assert(req.Form["type"], DeepEquals, []string{"A"}) - c.Assert(req.Form["name"], DeepEquals, []string{"foobar"}) - c.Assert(req.Form["content"], DeepEquals, []string{"10.0.0.1"}) - c.Assert(req.Form["ttl"], DeepEquals, []string{"600"}) - c.Assert(err, IsNil) - c.Assert(record.Id, Equals, "23734516") -} - -func (s *S) Test_RetrieveRecord(c *C) { - testServer.Response(200, nil, recordsExample) - - record, err := s.client.RetrieveRecord("example.com", "16606009") - - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(record.Name, Equals, "direct") - c.Assert(record.Id, Equals, "16606009") - c.Assert(record.Priority, Equals, "") -} - -func (s *S) Test_RetrieveRecord_Bad(c *C) { - testServer.Response(200, nil, recordsErrorExample) - - record, err := s.client.RetrieveRecord("example.com", "16606009") - - _ = testServer.WaitRequest() - - c.Assert(err.Error(), Equals, "API Error: Invalid zone.") - c.Assert(record, IsNil) -} - -func (s *S) Test_DestroyRecord(c *C) { - testServer.Response(200, nil, recordDeleteExample) - - err := s.client.DestroyRecord("example.com", "25") - - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) -} - -func (s *S) Test_UpdateRecord_Bad(c *C) { - testServer.Response(200, nil, recordErrorExample) - - opts := UpdateRecord{ - Name: "foobar", - Type: "CNAME", - } - - err := s.client.UpdateRecord("example.com", "16606009", &opts) - - req := testServer.WaitRequest() - - c.Assert(req.Form["type"], DeepEquals, []string{"CNAME"}) - c.Assert(req.Form["name"], DeepEquals, []string{"foobar"}) - c.Assert(err.Error(), Equals, "API Error: Invalid record id.") -} - -func (s *S) Test_UpdateRecord(c *C) { - testServer.Response(200, nil, recordExample) - - opts := UpdateRecord{ - Name: "foobar", - Type: "CNAME", - } - - err := s.client.UpdateRecord("example.com", "25", &opts) - - req := testServer.WaitRequest() - - c.Assert(req.Form["type"], DeepEquals, []string{"CNAME"}) - c.Assert(req.Form["name"], DeepEquals, []string{"foobar"}) - c.Assert(err, IsNil) -} - -var recordErrorExample = `{ - "request": { - "act": "rec_edit" - }, - "result": "error", - "msg": "Invalid record id." -}` - -var recordsErrorExample = `{ - "request": { - "act": "rec_load_all" - }, - "result": "error", - "msg": "Invalid zone." -}` - -var recordDeleteExample = `{ - "request": { - "act": "rec_delete", - "a": "rec_delete", - "tkn": "1296c62233d48a6cf0585b0c1dddc3512e4b2", - "id": "23735515", - "email": "sample@example.com", - "z": "example.com" - }, - "result": "success", - "msg": null -}` - -var recordsExample = `{ - "request": { - "act": "rec_load_all", - "a": "rec_load_all", - "email": "sample@example.com", - "tkn": "8afbe6dea02407989af4dd4c97bb6e25", - "z": "example.com" - }, - "response": { - "recs": { - "has_more": false, - "count": 7, - "objs": [ - { - "rec_id": "16606009", - "rec_tag": "7f8e77bac02ba65d34e20c4b994a202c", - "zone_name": "example.com", - "name": "direct.example.com", - "display_name": "direct", - "type": "A", - "prio": null, - "content": "[server IP]", - "display_content": "[server IP]", - "ttl": "1", - "ttl_ceil": 86400, - "ssl_id": null, - "ssl_status": null, - "ssl_expires_on": null, - "auto_ttl": 1, - "service_mode": "0", - "props": { - "proxiable": 1, - "cloud_on": 0, - "cf_open": 1, - "ssl": 0, - "expired_ssl": 0, - "expiring_ssl": 0, - "pending_ssl": 0 - } - }, - { - "rec_id": "16606003", - "rec_tag": "d5315634e9f5660d3670e62fa176e5de", - "zone_name": "example.com", - "name": "home.example.com", - "display_name": "home", - "type": "A", - "prio": null, - "content": "[server IP]", - "display_content": "[server IP]", - "ttl": "1", - "ttl_ceil": 86400, - "ssl_id": null, - "ssl_status": null, - "ssl_expires_on": null, - "auto_ttl": 1, - "service_mode": "0", - "props": { - "proxiable": 1, - "cloud_on": 0, - "cf_open": 1, - "ssl": 0, - "expired_ssl": 0, - "expiring_ssl": 0, - "pending_ssl": 0 - } - }, - { - "rec_id": "16606000", - "rec_tag": "23b26c051884e94e18711742942760b1", - "zone_name": "example.com", - "name": "example.com", - "display_name": "example.com", - "type": "A", - "prio": null, - "content": "[server IP]", - "display_content": "[server IP]", - "ttl": "1", - "ttl_ceil": 86400, - "ssl_id": null, - "ssl_status": null, - "ssl_expires_on": null, - "auto_ttl": 1, - "service_mode": "1", - "props": { - "proxiable": 1, - "cloud_on": 1, - "cf_open": 1, - "ssl": 0, - "expired_ssl": 0, - "expiring_ssl": 0, - "pending_ssl": 0 - } - }, - { - "rec_id": "18136402", - "rec_tag": "3bcef45cdf5b7638b13cfb89f1b6e716", - "zone_name": "example.com", - "name": "test.example.com", - "display_name": "test", - "type": "A", - "prio": null, - "content": "[server IP]", - "display_content": "[server IP]", - "ttl": "1", - "ttl_ceil": 86400, - "ssl_id": null, - "ssl_status": null, - "ssl_expires_on": null, - "auto_ttl": 1, - "service_mode": "0", - "props": { - "proxiable": 1, - "cloud_on": 0, - "cf_open": 1, - "ssl": 0, - "expired_ssl": 0, - "expiring_ssl": 0, - "pending_ssl": 0 - } - }, - { - "rec_id": "16606018", - "rec_tag": "c0b453b2d94213a7930d342114cbda86", - "zone_name": "example.com", - "name": "www.example.com", - "display_name": "www", - "type": "CNAME", - "prio": null, - "content": "example.com", - "display_content": "example.com", - "ttl": "1", - "ttl_ceil": 86400, - "ssl_id": null, - "ssl_status": null, - "ssl_expires_on": null, - "auto_ttl": 1, - "service_mode": "0", - "props": { - "proxiable": 1, - "cloud_on": 0, - "cf_open": 1, - "ssl": 0, - "expired_ssl": 0, - "expiring_ssl": 0, - "pending_ssl": 0 - } - }, - { - "rec_id": "17119732", - "rec_tag": "1faa40f85c78bccb69ee8116e84f3b40", - "zone_name": "example.com", - "name": "xn--vii.example.com", - "display_name": "⟵", - "type": "CNAME", - "prio": null, - "content": "example.com", - "display_content": "example.com", - "ttl": "1", - "ttl_ceil": 86400, - "ssl_id": null, - "ssl_status": null, - "ssl_expires_on": null, - "auto_ttl": 1, - "service_mode": "1", - "props": { - "proxiable": 1, - "cloud_on": 1, - "cf_open": 1, - "ssl": 0, - "expired_ssl": 0, - "expiring_ssl": 0, - "pending_ssl": 0 - } - }, - { - "rec_id": "16606030", - "rec_tag": "2012b3a2e49978ef18ee13dd98e6b6f7", - "zone_name": "example.com", - "name": "yay.example.com", - "display_name": "yay", - "type": "CNAME", - "prio": null, - "content": "domains.tumblr.com", - "display_content": "domains.tumblr.com", - "ttl": "1", - "ttl_ceil": 86400, - "ssl_id": null, - "ssl_status": null, - "ssl_expires_on": null, - "auto_ttl": 1, - "service_mode": "0", - "props": { - "proxiable": 1, - "cloud_on": 0, - "cf_open": 1, - "ssl": 0, - "expired_ssl": 0, - "expiring_ssl": 0, - "pending_ssl": 0 - } - } - ] - } - }, - "result": "success", - "msg": null -}` - -var recordExample = `{ - "request": { - "act": "rec_new", - "a": "rec_new", - "tkn": "8afbe6dea02407989af4dd4c97bb6e25", - "email": "sample@example.com", - "type": "A", - "z": "example.com", - "name": "test", - "content": "96.126.126.36", - "ttl": "1", - "service_mode": "1" - }, - "response": { - "rec": { - "obj": { - "rec_id": "23734516", - "rec_tag": "b3db8b8ad50389eb4abae7522b22852f", - "zone_name": "example.com", - "name": "test.example.com", - "display_name": "test", - "type": "A", - "prio": null, - "content": "96.126.126.36", - "display_content": "96.126.126.36", - "ttl": "1", - "ttl_ceil": 86400, - "ssl_id": "12805", - "ssl_status": "V", - "ssl_expires_on": null, - "auto_ttl": 1, - "service_mode": "0", - "props": { - "proxiable": 1, - "cloud_on": 0, - "cf_open": 1, - "ssl": 1, - "expired_ssl": 0, - "expiring_ssl": 0, - "pending_ssl": 0, - "vanity_lock": 0 - } - } - } - }, - "result": "success", - "msg": null -}` diff --git a/vendor/github.com/pearkes/dnsimple/api_test.go b/vendor/github.com/pearkes/dnsimple/api_test.go deleted file mode 100644 index 0e2ce248c8..0000000000 --- a/vendor/github.com/pearkes/dnsimple/api_test.go +++ /dev/null @@ -1,83 +0,0 @@ -package dnsimple - -import ( - "testing" -) - -func makeClient(t *testing.T) *Client { - client, err := NewClient("foobaremail", "foobartoken") - - if err != nil { - t.Fatalf("err: %v", err) - } - - if client.Token != "foobartoken" { - t.Fatalf("token not set on client: %s", client.Token) - } - - return client -} - -func makeClientWithDomainToken(t *testing.T) *Client { - client, err := NewClientWithDomainToken("foobardomaintoken") - - if err != nil { - t.Fatalf("err: %v", err) - } - - if client.DomainToken != "foobardomaintoken" { - t.Fatalf("domian token not set on client: %s", client.DomainToken) - } - - return client -} - -func TestClient_NewRequest(t *testing.T) { - c := makeClient(t) - - body := map[string]interface{}{ - "foo": "bar", - "baz": "bar", - } - req, err := c.NewRequest(body, "POST", "/bar") - if err != nil { - t.Fatalf("bad: %v", err) - } - - if req.URL.String() != "https://api.dnsimple.com/v1/bar" { - t.Fatalf("bad base url: %v", req.URL.String()) - } - - if req.Header.Get("X-DNSimple-Token") != "foobaremail:foobartoken" { - t.Fatalf("bad auth header: %v", req.Header) - } - - if req.Method != "POST" { - t.Fatalf("bad method: %v", req.Method) - } -} - -func TestClientDomainToken_NewRequest(t *testing.T) { - c := makeClientWithDomainToken(t) - - body := map[string]interface{}{ - "foo": "bar", - "baz": "bar", - } - req, err := c.NewRequest(body, "POST", "/bar") - if err != nil { - t.Fatalf("bad: %v", err) - } - - if req.URL.String() != "https://api.dnsimple.com/v1/bar" { - t.Fatalf("bad base url: %v", req.URL.String()) - } - - if req.Header.Get("X-DNSimple-Domain-Token") != "foobardomaintoken" { - t.Fatalf("bad auth header: %v", req.Header) - } - - if req.Method != "POST" { - t.Fatalf("bad method: %v", req.Method) - } -} diff --git a/vendor/github.com/pearkes/dnsimple/domain_test.go b/vendor/github.com/pearkes/dnsimple/domain_test.go deleted file mode 100644 index d1ce11919e..0000000000 --- a/vendor/github.com/pearkes/dnsimple/domain_test.go +++ /dev/null @@ -1,102 +0,0 @@ -package dnsimple - -import ( - "time" - - . "github.com/motain/gocheck" -) - -func (s *S) Test_GetDomains(c *C) { - testServer.Response(202, nil, domainsExample) - - domains, err := s.client.GetDomains() - - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(domains, DeepEquals, []Domain{ - Domain{ - 228, - 19, - 0, - "example.it", - "example.it", - "domain-token", - "hosted", - "", - true, - false, - false, - 5, - 0, - "", - Jan15_3, - Jan15_3, - }, - Domain{ - 227, - 19, - 28, - "example.com", - "example.com", - "domain-token", - "registered", - "", - true, - true, - false, - 7, - 0, - "2015-01-16", - Jan15_1, - Jan16, - }, - }) -} - -var domainsExample = `[ - { - "domain": { - "id": 228, - "user_id": 19, - "registrant_id": null, - "name": "example.it", - "unicode_name": "example.it", - "token": "domain-token", - "state": "hosted", - "language": null, - "lockable": true, - "auto_renew": false, - "whois_protected": false, - "record_count": 5, - "service_count": 0, - "expires_on": null, - "created_at": "2014-01-15T22:03:49Z", - "updated_at": "2014-01-15T22:03:49Z" - } - }, - { - "domain": { - "id": 227, - "user_id": 19, - "registrant_id": 28, - "name": "example.com", - "unicode_name": "example.com", - "token": "domain-token", - "state": "registered", - "language": null, - "lockable": true, - "auto_renew": true, - "whois_protected": false, - "record_count": 7, - "service_count": 0, - "expires_on": "2015-01-16", - "created_at": "2014-01-15T22:01:55Z", - "updated_at": "2014-01-16T22:56:22Z" - } - } -]` - -var Jan15_3, _ = time.Parse("2006-01-02T15:04:05Z", "2014-01-15T22:03:49Z") -var Jan15_1, _ = time.Parse("2006-01-02T15:04:05Z", "2014-01-15T22:01:55Z") -var Jan16, _ = time.Parse("2006-01-02T15:04:05Z", "2014-01-16T22:56:22Z") diff --git a/vendor/github.com/pearkes/dnsimple/record_test.go b/vendor/github.com/pearkes/dnsimple/record_test.go deleted file mode 100644 index ab24e0a6ec..0000000000 --- a/vendor/github.com/pearkes/dnsimple/record_test.go +++ /dev/null @@ -1,116 +0,0 @@ -package dnsimple - -import ( - "github.com/pearkes/dnsimple/testutil" - "strings" - "testing" - - . "github.com/motain/gocheck" -) - -func Test(t *testing.T) { - TestingT(t) -} - -type S struct { - client *Client -} - -var _ = Suite(&S{}) - -var testServer = testutil.NewHTTPServer() - -func (s *S) SetUpSuite(c *C) { - testServer.Start() - var err error - s.client, err = NewClient("email", "foobar") - s.client.URL = "http://localhost:4444" - if err != nil { - panic(err) - } -} - -func (s *S) TearDownTest(c *C) { - testServer.Flush() -} - -func (s *S) Test_CreateRecord(c *C) { - testServer.Response(202, nil, recordExample) - - opts := ChangeRecord{ - Name: "foobar", - } - - id, err := s.client.CreateRecord("example.com", &opts) - - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(id, Equals, "25") -} - -func (s *S) Test_UpdateRecord(c *C) { - testServer.Response(200, nil, recordExample) - - opts := ChangeRecord{ - Name: "foobar", - } - - id, err := s.client.UpdateRecord("example.com", "25", &opts) - - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(id, Equals, "25") -} - -func (s *S) Test_CreateRecord_fail(c *C) { - testServer.Response(400, nil, recordExampleError) - - opts := ChangeRecord{ - Name: "foobar", - } - - _, err := s.client.CreateRecord("example.com", &opts) - - _ = testServer.WaitRequest() - - c.Assert(strings.Contains(err.Error(), "unsupported"), Equals, true) -} - -func (s *S) Test_RetrieveRecord(c *C) { - testServer.Response(200, nil, recordExample) - - record, err := s.client.RetrieveRecord("example.com", "25") - - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(record.StringId(), Equals, "25") - c.Assert(record.StringDomainId(), Equals, "28") - c.Assert(record.StringTtl(), Equals, "3600") - c.Assert(record.Name, Equals, "foobar") - c.Assert(record.Content, Equals, "mail.example.com") - c.Assert(record.RecordType, Equals, "MX") -} - -var recordExampleError = `{ - "errors": { - "content": ["can't be blank"], - "record_type": ["can't be blank","unsupported"] - } -}` - -var recordExample = `{ - "record": { - "content": "mail.example.com", - "created_at": "2013-01-29T14:25:38Z", - "domain_id": 28, - "id": 25, - "name": "foobar", - "prio": 10, - "record_type": "MX", - "ttl": 3600, - "updated_at": "2013-01-29T14:25:38Z" - } -}` diff --git a/vendor/github.com/pearkes/mailgun/api_test.go b/vendor/github.com/pearkes/mailgun/api_test.go deleted file mode 100644 index c606faf214..0000000000 --- a/vendor/github.com/pearkes/mailgun/api_test.go +++ /dev/null @@ -1,92 +0,0 @@ -package mailgun - -import ( - "os" - "testing" - - . "github.com/motain/gocheck" - "github.com/pearkes/mailgun/testutil" -) - -type S struct { - client *Client -} - -var _ = Suite(&S{}) - -var testServer = testutil.NewHTTPServer() - -func (s *S) SetUpSuite(c *C) { - testServer.Start() - var err error - s.client, err = NewClient("foobar") - s.client.URL = "http://localhost:4444" - if err != nil { - panic(err) - } -} - -func (s *S) TearDownTest(c *C) { - testServer.Flush() -} - -func makeClient(t *testing.T) *Client { - client, err := NewClient("foobarkey") - - if err != nil { - t.Fatalf("err: %v", err) - } - - if client.ApiKey != "foobarkey" { - t.Fatalf("key not set on client: %s", client.ApiKey) - } - - return client -} - -func Test_NewClient_env(t *testing.T) { - os.Setenv("MAILGUN_API_KEY", "bar") - client, err := NewClient("") - - if err != nil { - t.Fatalf("err: %v", err) - } - - if client.ApiKey != "bar" { - t.Fatalf("key not set on client: %s", client.ApiKey) - } -} - -func TestClient_NewRequest(t *testing.T) { - c := makeClient(t) - - params := map[string]string{ - "foo": "bar", - "baz": "bar", - } - req, err := c.NewRequest(params, "POST", "/bar") - if err != nil { - t.Fatalf("bad: %v", err) - } - - encoded := req.URL.Query() - if encoded.Get("foo") != "bar" { - t.Fatalf("bad: %v", encoded) - } - - if encoded.Get("baz") != "bar" { - t.Fatalf("bad: %v", encoded) - } - - if req.URL.String() != "https://api.mailgun.net/v2/bar?baz=bar&foo=bar" { - t.Fatalf("bad base url: %v", req.URL.String()) - } - - if req.Header.Get("Authorization") != "Basic YXBpOmZvb2JhcmtleQ==" { - t.Fatalf("bad auth header: %v", req.Header) - } - - if req.Method != "POST" { - t.Fatalf("bad method: %v", req.Method) - } -} diff --git a/vendor/github.com/pearkes/mailgun/domain_test.go b/vendor/github.com/pearkes/mailgun/domain_test.go deleted file mode 100644 index 3517d081df..0000000000 --- a/vendor/github.com/pearkes/mailgun/domain_test.go +++ /dev/null @@ -1,109 +0,0 @@ -package mailgun - -import ( - "testing" - - . "github.com/motain/gocheck" -) - -func TestDomain(t *testing.T) { - TestingT(t) -} - -func (s *S) Test_CreateDomain(c *C) { - testServer.Response(202, nil, domainExample) - - opts := CreateDomain{ - Name: "example.com", - SpamAction: "disabled", - Wildcard: true, - SmtpPassword: "foobar", - } - - id, err := s.client.CreateDomain(&opts) - - req := testServer.WaitRequest() - - c.Assert(req.Form["name"], DeepEquals, []string{"example.com"}) - c.Assert(req.Form["spam_action"], DeepEquals, []string{"disabled"}) - c.Assert(req.Form["wildcard"], DeepEquals, []string{"true"}) - c.Assert(req.Form["smtp_password"], DeepEquals, []string{"foobar"}) - c.Assert(err, IsNil) - c.Assert(id, Equals, "domain.com") -} - -func (s *S) Test_RetrieveDomain(c *C) { - testServer.Response(200, nil, domainExample) - - resp, err := s.client.RetrieveDomain("example.com") - - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) - c.Assert(resp.Domain.Name, Equals, "domain.com") - c.Assert(resp.Domain.SmtpPassword, Equals, "4rtqo4p6rrx9") - c.Assert(resp.Domain.StringWildcard(), Equals, "false") - c.Assert(resp.ReceivingRecords[0].Priority, Equals, "10") - c.Assert(resp.SendingRecords[0].Value, Equals, "v=spf1 include:mailgun.org ~all") -} - -func (s *S) Test_DestroyDomain(c *C) { - testServer.Response(204, nil, "") - - err := s.client.DestroyDomain("example.com") - - _ = testServer.WaitRequest() - - c.Assert(err, IsNil) -} - -var domainErrorExample = `{ - "message": "Domain name format is bad" -}` - -var domainExample = ` -{ - "domain": { - "created_at": "Wed, 10 Jul 2013 19:26:52 GMT", - "smtp_login": "postmaster@domain.com", - "name": "domain.com", - "smtp_password": "4rtqo4p6rrx9", - "wildcard": false, - "spam_action": "tag" - }, - "receiving_dns_records": [ - { - "priority": "10", - "record_type": "MX", - "valid": "valid", - "value": "mxa.mailgun.org" - }, - { - "priority": "10", - "record_type": "MX", - "valid": "valid", - "value": "mxb.mailgun.org" - } - ], - "sending_dns_records": [ - { - "record_type": "TXT", - "valid": "valid", - "name": "domain.com", - "value": "v=spf1 include:mailgun.org ~all" - }, - { - "record_type": "TXT", - "valid": "valid", - "name": "domain.com", - "value": "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUA...." - }, - { - "record_type": "CNAME", - "valid": "valid", - "name": "email.domain.com", - "value": "mailgun.org" - } - ] -} -` diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/blockstorage/v1/snapshots_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/blockstorage/v1/snapshots_test.go deleted file mode 100644 index 7741aa9841..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/blockstorage/v1/snapshots_test.go +++ /dev/null @@ -1,70 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/openstack/blockstorage/v1/snapshots" - "github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestSnapshots(t *testing.T) { - - client, err := newClient(t) - th.AssertNoErr(t, err) - - v, err := volumes.Create(client, &volumes.CreateOpts{ - Name: "gophercloud-test-volume", - Size: 1, - }).Extract() - th.AssertNoErr(t, err) - - err = volumes.WaitForStatus(client, v.ID, "available", 120) - th.AssertNoErr(t, err) - - t.Logf("Created volume: %v\n", v) - - ss, err := snapshots.Create(client, &snapshots.CreateOpts{ - Name: "gophercloud-test-snapshot", - VolumeID: v.ID, - }).Extract() - th.AssertNoErr(t, err) - - err = snapshots.WaitForStatus(client, ss.ID, "available", 120) - th.AssertNoErr(t, err) - - t.Logf("Created snapshot: %+v\n", ss) - - err = snapshots.Delete(client, ss.ID).ExtractErr() - th.AssertNoErr(t, err) - - err = gophercloud.WaitFor(120, func() (bool, error) { - _, err := snapshots.Get(client, ss.ID).Extract() - if err != nil { - return true, nil - } - - return false, nil - }) - th.AssertNoErr(t, err) - - t.Log("Deleted snapshot\n") - - err = volumes.Delete(client, v.ID).ExtractErr() - th.AssertNoErr(t, err) - - err = gophercloud.WaitFor(120, func() (bool, error) { - _, err := volumes.Get(client, v.ID).Extract() - if err != nil { - return true, nil - } - - return false, nil - }) - th.AssertNoErr(t, err) - - t.Log("Deleted volume\n") -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/blockstorage/v1/volumes_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/blockstorage/v1/volumes_test.go deleted file mode 100644 index 7760427f08..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/blockstorage/v1/volumes_test.go +++ /dev/null @@ -1,63 +0,0 @@ -// +build acceptance blockstorage - -package v1 - -import ( - "os" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/openstack" - "github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func newClient(t *testing.T) (*gophercloud.ServiceClient, error) { - ao, err := openstack.AuthOptionsFromEnv() - th.AssertNoErr(t, err) - - client, err := openstack.AuthenticatedClient(ao) - th.AssertNoErr(t, err) - - return openstack.NewBlockStorageV1(client, gophercloud.EndpointOpts{ - Region: os.Getenv("OS_REGION_NAME"), - }) -} - -func TestVolumes(t *testing.T) { - client, err := newClient(t) - th.AssertNoErr(t, err) - - cv, err := volumes.Create(client, &volumes.CreateOpts{ - Size: 1, - Name: "gophercloud-test-volume", - }).Extract() - th.AssertNoErr(t, err) - defer func() { - err = volumes.WaitForStatus(client, cv.ID, "available", 60) - th.AssertNoErr(t, err) - err = volumes.Delete(client, cv.ID).ExtractErr() - th.AssertNoErr(t, err) - }() - - _, err = volumes.Update(client, cv.ID, &volumes.UpdateOpts{ - Name: "gophercloud-updated-volume", - }).Extract() - th.AssertNoErr(t, err) - - v, err := volumes.Get(client, cv.ID).Extract() - th.AssertNoErr(t, err) - t.Logf("Got volume: %+v\n", v) - - if v.Name != "gophercloud-updated-volume" { - t.Errorf("Unable to update volume: Expected name: gophercloud-updated-volume\nActual name: %s", v.Name) - } - - err = volumes.List(client, &volumes.ListOpts{Name: "gophercloud-updated-volume"}).EachPage(func(page pagination.Page) (bool, error) { - vols, err := volumes.ExtractVolumes(page) - th.CheckEquals(t, 1, len(vols)) - return true, err - }) - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/blockstorage/v1/volumetypes_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/blockstorage/v1/volumetypes_test.go deleted file mode 100644 index 000bc01d57..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/blockstorage/v1/volumetypes_test.go +++ /dev/null @@ -1,49 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "testing" - "time" - - "github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumetypes" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestVolumeTypes(t *testing.T) { - client, err := newClient(t) - th.AssertNoErr(t, err) - - vt, err := volumetypes.Create(client, &volumetypes.CreateOpts{ - ExtraSpecs: map[string]interface{}{ - "capabilities": "gpu", - "priority": 3, - }, - Name: "gophercloud-test-volumeType", - }).Extract() - th.AssertNoErr(t, err) - defer func() { - time.Sleep(10000 * time.Millisecond) - err = volumetypes.Delete(client, vt.ID).ExtractErr() - if err != nil { - t.Error(err) - return - } - }() - t.Logf("Created volume type: %+v\n", vt) - - vt, err = volumetypes.Get(client, vt.ID).Extract() - th.AssertNoErr(t, err) - t.Logf("Got volume type: %+v\n", vt) - - err = volumetypes.List(client).EachPage(func(page pagination.Page) (bool, error) { - volTypes, err := volumetypes.ExtractVolumeTypes(page) - if len(volTypes) != 1 { - t.Errorf("Expected 1 volume type, got %d", len(volTypes)) - } - t.Logf("Listing volume types: %+v\n", volTypes) - return true, err - }) - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/client_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/client_test.go deleted file mode 100644 index 6e88819d80..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/client_test.go +++ /dev/null @@ -1,40 +0,0 @@ -// +build acceptance - -package openstack - -import ( - "os" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/openstack" -) - -func TestAuthenticatedClient(t *testing.T) { - // Obtain credentials from the environment. - ao, err := openstack.AuthOptionsFromEnv() - if err != nil { - t.Fatalf("Unable to acquire credentials: %v", err) - } - - client, err := openstack.AuthenticatedClient(ao) - if err != nil { - t.Fatalf("Unable to authenticate: %v", err) - } - - if client.TokenID == "" { - t.Errorf("No token ID assigned to the client") - } - - t.Logf("Client successfully acquired a token: %v", client.TokenID) - - // Find the storage service in the service catalog. - storage, err := openstack.NewObjectStorageV1(client, gophercloud.EndpointOpts{ - Region: os.Getenv("OS_REGION_NAME"), - }) - if err != nil { - t.Errorf("Unable to locate a storage service: %v", err) - } else { - t.Logf("Located a storage service at endpoint: [%s]", storage.Endpoint) - } -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/bootfromvolume_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/bootfromvolume_test.go deleted file mode 100644 index add0e5fc11..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/bootfromvolume_test.go +++ /dev/null @@ -1,55 +0,0 @@ -// +build acceptance - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume" - "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestBootFromVolume(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - if testing.Short() { - t.Skip("Skipping test that requires server creation in short mode.") - } - - choices, err := ComputeChoicesFromEnv() - if err != nil { - t.Fatal(err) - } - - name := tools.RandomString("Gophercloud-", 8) - t.Logf("Creating server [%s].", name) - - bd := []bootfromvolume.BlockDevice{ - bootfromvolume.BlockDevice{ - UUID: choices.ImageID, - SourceType: bootfromvolume.Image, - VolumeSize: 10, - }, - } - - serverCreateOpts := servers.CreateOpts{ - Name: name, - FlavorRef: choices.FlavorID, - ImageRef: choices.ImageID, - } - server, err := bootfromvolume.Create(client, bootfromvolume.CreateOptsExt{ - serverCreateOpts, - bd, - }).Extract() - th.AssertNoErr(t, err) - if err = waitForStatus(client, server, "ACTIVE"); err != nil { - t.Fatal(err) - } - - t.Logf("Created server: %+v\n", server) - defer servers.Delete(client, server.ID) - t.Logf("Deleting server [%s]...", name) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/compute_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/compute_test.go deleted file mode 100644 index c1bbf7961f..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/compute_test.go +++ /dev/null @@ -1,104 +0,0 @@ -// +build acceptance common - -package v2 - -import ( - "fmt" - "os" - "strings" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/openstack" - "github.com/rackspace/gophercloud/openstack/compute/v2/servers" -) - -func newClient() (*gophercloud.ServiceClient, error) { - ao, err := openstack.AuthOptionsFromEnv() - if err != nil { - return nil, err - } - - client, err := openstack.AuthenticatedClient(ao) - if err != nil { - return nil, err - } - - return openstack.NewComputeV2(client, gophercloud.EndpointOpts{ - Region: os.Getenv("OS_REGION_NAME"), - }) -} - -func waitForStatus(client *gophercloud.ServiceClient, server *servers.Server, status string) error { - return tools.WaitFor(func() (bool, error) { - latest, err := servers.Get(client, server.ID).Extract() - if err != nil { - return false, err - } - - if latest.Status == status { - // Success! - return true, nil - } - - return false, nil - }) -} - -// ComputeChoices contains image and flavor selections for use by the acceptance tests. -type ComputeChoices struct { - // ImageID contains the ID of a valid image. - ImageID string - - // FlavorID contains the ID of a valid flavor. - FlavorID string - - // FlavorIDResize contains the ID of a different flavor available on the same OpenStack installation, that is distinct - // from FlavorID. - FlavorIDResize string - - // NetworkName is the name of a network to launch the instance on. - NetworkName string -} - -// ComputeChoicesFromEnv populates a ComputeChoices struct from environment variables. -// If any required state is missing, an `error` will be returned that enumerates the missing properties. -func ComputeChoicesFromEnv() (*ComputeChoices, error) { - imageID := os.Getenv("OS_IMAGE_ID") - flavorID := os.Getenv("OS_FLAVOR_ID") - flavorIDResize := os.Getenv("OS_FLAVOR_ID_RESIZE") - networkName := os.Getenv("OS_NETWORK_NAME") - - missing := make([]string, 0, 3) - if imageID == "" { - missing = append(missing, "OS_IMAGE_ID") - } - if flavorID == "" { - missing = append(missing, "OS_FLAVOR_ID") - } - if flavorIDResize == "" { - missing = append(missing, "OS_FLAVOR_ID_RESIZE") - } - if networkName == "" { - networkName = "public" - } - - notDistinct := "" - if flavorID == flavorIDResize { - notDistinct = "OS_FLAVOR_ID and OS_FLAVOR_ID_RESIZE must be distinct." - } - - if len(missing) > 0 || notDistinct != "" { - text := "You're missing some important setup:\n" - if len(missing) > 0 { - text += " * These environment variables must be provided: " + strings.Join(missing, ", ") + "\n" - } - if notDistinct != "" { - text += " * " + notDistinct + "\n" - } - - return nil, fmt.Errorf(text) - } - - return &ComputeChoices{ImageID: imageID, FlavorID: flavorID, FlavorIDResize: flavorIDResize, NetworkName: networkName}, nil -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/extension_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/extension_test.go deleted file mode 100644 index 1356ffa899..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/extension_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// +build acceptance compute extensionss - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/compute/v2/extensions" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestListExtensions(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - err = extensions.List(client).EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page ---") - - exts, err := extensions.ExtractExtensions(page) - th.AssertNoErr(t, err) - - for i, ext := range exts { - t.Logf("[%02d] name=[%s]\n", i, ext.Name) - t.Logf(" alias=[%s]\n", ext.Alias) - t.Logf(" description=[%s]\n", ext.Description) - } - - return true, nil - }) - th.AssertNoErr(t, err) -} - -func TestGetExtension(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - ext, err := extensions.Get(client, "os-admin-actions").Extract() - th.AssertNoErr(t, err) - - t.Logf("Extension details:") - t.Logf(" name=[%s]\n", ext.Name) - t.Logf(" namespace=[%s]\n", ext.Namespace) - t.Logf(" alias=[%s]\n", ext.Alias) - t.Logf(" description=[%s]\n", ext.Description) - t.Logf(" updated=[%s]\n", ext.Updated) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/flavors_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/flavors_test.go deleted file mode 100644 index 9f51b12280..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/flavors_test.go +++ /dev/null @@ -1,57 +0,0 @@ -// +build acceptance compute flavors - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/compute/v2/flavors" - "github.com/rackspace/gophercloud/pagination" -) - -func TestListFlavors(t *testing.T) { - client, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - t.Logf("ID\tRegion\tName\tStatus\tCreated") - - pager := flavors.ListDetail(client, nil) - count, pages := 0, 0 - pager.EachPage(func(page pagination.Page) (bool, error) { - t.Logf("---") - pages++ - flavors, err := flavors.ExtractFlavors(page) - if err != nil { - return false, err - } - - for _, f := range flavors { - t.Logf("%s\t%s\t%d\t%d\t%d", f.ID, f.Name, f.RAM, f.Disk, f.VCPUs) - } - - return true, nil - }) - - t.Logf("--------\n%d flavors listed on %d pages.", count, pages) -} - -func TestGetFlavor(t *testing.T) { - client, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - choices, err := ComputeChoicesFromEnv() - if err != nil { - t.Fatal(err) - } - - flavor, err := flavors.Get(client, choices.FlavorID).Extract() - if err != nil { - t.Fatalf("Unable to get flavor information: %v", err) - } - - t.Logf("Flavor: %#v", flavor) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/floatingip_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/floatingip_test.go deleted file mode 100644 index de6efc91b5..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/floatingip_test.go +++ /dev/null @@ -1,168 +0,0 @@ -// +build acceptance compute servers - -package v2 - -import ( - "os" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/floatingip" - "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - th "github.com/rackspace/gophercloud/testhelper" -) - -func createFIPServer(t *testing.T, client *gophercloud.ServiceClient, choices *ComputeChoices) (*servers.Server, error) { - if testing.Short() { - t.Skip("Skipping test that requires server creation in short mode.") - } - - name := tools.RandomString("ACPTTEST", 16) - t.Logf("Attempting to create server: %s\n", name) - - pwd := tools.MakeNewPassword("") - - server, err := servers.Create(client, servers.CreateOpts{ - Name: name, - FlavorRef: choices.FlavorID, - ImageRef: choices.ImageID, - AdminPass: pwd, - }).Extract() - if err != nil { - t.Fatalf("Unable to create server: %v", err) - } - - th.AssertEquals(t, pwd, server.AdminPass) - - return server, err -} - -func createFloatingIP(t *testing.T, client *gophercloud.ServiceClient) (*floatingip.FloatingIP, error) { - pool := os.Getenv("OS_POOL_NAME") - fip, err := floatingip.Create(client, &floatingip.CreateOpts{ - Pool: pool, - }).Extract() - th.AssertNoErr(t, err) - t.Logf("Obtained Floating IP: %v", fip.IP) - - return fip, err -} - -func associateFloatingIPDeprecated(t *testing.T, client *gophercloud.ServiceClient, serverId string, fip *floatingip.FloatingIP) { - // This form works, but is considered deprecated. - // See associateFloatingIP or associateFloatingIPFixed - err := floatingip.Associate(client, serverId, fip.IP).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Associated floating IP %v from instance %v", fip.IP, serverId) - defer func() { - err = floatingip.Disassociate(client, serverId, fip.IP).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Disassociated floating IP %v from instance %v", fip.IP, serverId) - }() - floatingIp, err := floatingip.Get(client, fip.ID).Extract() - th.AssertNoErr(t, err) - t.Logf("Floating IP %v is associated with Fixed IP %v", fip.IP, floatingIp.FixedIP) -} - -func associateFloatingIP(t *testing.T, client *gophercloud.ServiceClient, serverId string, fip *floatingip.FloatingIP) { - associateOpts := floatingip.AssociateOpts{ - ServerID: serverId, - FloatingIP: fip.IP, - } - - err := floatingip.AssociateInstance(client, associateOpts).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Associated floating IP %v from instance %v", fip.IP, serverId) - defer func() { - err = floatingip.DisassociateInstance(client, associateOpts).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Disassociated floating IP %v from instance %v", fip.IP, serverId) - }() - floatingIp, err := floatingip.Get(client, fip.ID).Extract() - th.AssertNoErr(t, err) - t.Logf("Floating IP %v is associated with Fixed IP %v", fip.IP, floatingIp.FixedIP) -} - -func associateFloatingIPFixed(t *testing.T, client *gophercloud.ServiceClient, serverId string, fip *floatingip.FloatingIP) { - - network := os.Getenv("OS_NETWORK_NAME") - server, err := servers.Get(client, serverId).Extract() - if err != nil { - t.Fatalf("%s", err) - } - - var fixedIP string - for _, networkAddresses := range server.Addresses[network].([]interface{}) { - address := networkAddresses.(map[string]interface{}) - if address["OS-EXT-IPS:type"] == "fixed" { - if address["version"].(float64) == 4 { - fixedIP = address["addr"].(string) - } - } - } - - associateOpts := floatingip.AssociateOpts{ - ServerID: serverId, - FloatingIP: fip.IP, - FixedIP: fixedIP, - } - - err = floatingip.AssociateInstance(client, associateOpts).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Associated floating IP %v from instance %v with Fixed IP %v", fip.IP, serverId, fixedIP) - defer func() { - err = floatingip.DisassociateInstance(client, associateOpts).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Disassociated floating IP %v from instance %v with Fixed IP %v", fip.IP, serverId, fixedIP) - }() - floatingIp, err := floatingip.Get(client, fip.ID).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, floatingIp.FixedIP, fixedIP) - t.Logf("Floating IP %v is associated with Fixed IP %v", fip.IP, floatingIp.FixedIP) -} - -func TestFloatingIP(t *testing.T) { - pool := os.Getenv("OS_POOL_NAME") - if pool == "" { - t.Fatalf("OS_POOL_NAME must be set") - } - - choices, err := ComputeChoicesFromEnv() - if err != nil { - t.Fatal(err) - } - - client, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - server, err := createFIPServer(t, client, choices) - if err != nil { - t.Fatalf("Unable to create server: %v", err) - } - defer func() { - servers.Delete(client, server.ID) - t.Logf("Server deleted.") - }() - - if err = waitForStatus(client, server, "ACTIVE"); err != nil { - t.Fatalf("Unable to wait for server: %v", err) - } - - fip, err := createFloatingIP(t, client) - if err != nil { - t.Fatalf("Unable to create floating IP: %v", err) - } - defer func() { - err = floatingip.Delete(client, fip.ID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Floating IP deleted.") - }() - - associateFloatingIPDeprecated(t, client, server.ID, fip) - associateFloatingIP(t, client, server.ID, fip) - associateFloatingIPFixed(t, client, server.ID, fip) - -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/images_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/images_test.go deleted file mode 100644 index ceab22fa76..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/images_test.go +++ /dev/null @@ -1,37 +0,0 @@ -// +build acceptance compute images - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/compute/v2/images" - "github.com/rackspace/gophercloud/pagination" -) - -func TestListImages(t *testing.T) { - client, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute: client: %v", err) - } - - t.Logf("ID\tRegion\tName\tStatus\tCreated") - - pager := images.ListDetail(client, nil) - count, pages := 0, 0 - pager.EachPage(func(page pagination.Page) (bool, error) { - pages++ - images, err := images.ExtractImages(page) - if err != nil { - return false, err - } - - for _, i := range images { - t.Logf("%s\t%s\t%s\t%s", i.ID, i.Name, i.Status, i.Created) - } - - return true, nil - }) - - t.Logf("--------\n%d images listed on %d pages.", count, pages) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/keypairs_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/keypairs_test.go deleted file mode 100644 index a4fe8db2d0..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/keypairs_test.go +++ /dev/null @@ -1,74 +0,0 @@ -// +build acceptance - -package v2 - -import ( - "crypto/rand" - "crypto/rsa" - "testing" - - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/keypairs" - "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - th "github.com/rackspace/gophercloud/testhelper" - - "golang.org/x/crypto/ssh" -) - -const keyName = "gophercloud_test_key_pair" - -func TestCreateServerWithKeyPair(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - if testing.Short() { - t.Skip("Skipping test that requires server creation in short mode.") - } - - privateKey, err := rsa.GenerateKey(rand.Reader, 2048) - publicKey := privateKey.PublicKey - pub, err := ssh.NewPublicKey(&publicKey) - th.AssertNoErr(t, err) - pubBytes := ssh.MarshalAuthorizedKey(pub) - pk := string(pubBytes) - - kp, err := keypairs.Create(client, keypairs.CreateOpts{ - Name: keyName, - PublicKey: pk, - }).Extract() - th.AssertNoErr(t, err) - t.Logf("Created key pair: %s\n", kp) - - choices, err := ComputeChoicesFromEnv() - th.AssertNoErr(t, err) - - name := tools.RandomString("Gophercloud-", 8) - t.Logf("Creating server [%s] with key pair.", name) - - serverCreateOpts := servers.CreateOpts{ - Name: name, - FlavorRef: choices.FlavorID, - ImageRef: choices.ImageID, - } - - server, err := servers.Create(client, keypairs.CreateOptsExt{ - serverCreateOpts, - keyName, - }).Extract() - th.AssertNoErr(t, err) - defer servers.Delete(client, server.ID) - if err = waitForStatus(client, server, "ACTIVE"); err != nil { - t.Fatalf("Unable to wait for server: %v", err) - } - - server, err = servers.Get(client, server.ID).Extract() - t.Logf("Created server: %+v\n", server) - th.AssertNoErr(t, err) - th.AssertEquals(t, server.KeyName, keyName) - - t.Logf("Deleting key pair [%s]...", kp.Name) - err = keypairs.Delete(client, keyName).ExtractErr() - th.AssertNoErr(t, err) - - t.Logf("Deleting server [%s]...", name) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/network_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/network_test.go deleted file mode 100644 index 7ebe7ec7bb..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/network_test.go +++ /dev/null @@ -1,78 +0,0 @@ -// +build acceptance compute servers - -package v2 - -import ( - "os" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/networks" - "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - th "github.com/rackspace/gophercloud/testhelper" -) - -func getNetworkIDFromNetworkExtension(t *testing.T, client *gophercloud.ServiceClient, networkName string) (string, error) { - allPages, err := networks.List(client).AllPages() - if err != nil { - t.Fatalf("Unable to list networks: %v", err) - } - - networkList, err := networks.ExtractNetworks(allPages) - if err != nil { - t.Fatalf("Unable to list networks: %v", err) - } - - networkID := "" - for _, network := range networkList { - t.Logf("Network: %v", network) - if network.Label == networkName { - networkID = network.ID - } - } - - t.Logf("Found network ID for %s: %s\n", networkName, networkID) - - return networkID, nil -} - -func TestNetworks(t *testing.T) { - networkName := os.Getenv("OS_NETWORK_NAME") - if networkName == "" { - t.Fatalf("OS_NETWORK_NAME must be set") - } - - choices, err := ComputeChoicesFromEnv() - if err != nil { - t.Fatal(err) - } - - client, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - networkID, err := getNetworkIDFromNetworkExtension(t, client, networkName) - if err != nil { - t.Fatalf("Unable to get network ID: %v", err) - } - - // createNetworkServer is defined in tenantnetworks_test.go - server, err := createNetworkServer(t, client, choices, networkID) - if err != nil { - t.Fatalf("Unable to create server: %v", err) - } - defer func() { - servers.Delete(client, server.ID) - t.Logf("Server deleted.") - }() - - if err = waitForStatus(client, server, "ACTIVE"); err != nil { - t.Fatalf("Unable to wait for server: %v", err) - } - - allPages, err := networks.List(client).AllPages() - allNetworks, err := networks.ExtractNetworks(allPages) - th.AssertNoErr(t, err) - t.Logf("Retrieved all %d networks: %+v", len(allNetworks), allNetworks) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/secdefrules_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/secdefrules_test.go deleted file mode 100644 index 78b07986bd..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/secdefrules_test.go +++ /dev/null @@ -1,72 +0,0 @@ -// +build acceptance compute defsecrules - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - dsr "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/defsecrules" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestSecDefRules(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - id := createDefRule(t, client) - - listDefRules(t, client) - - getDefRule(t, client, id) - - deleteDefRule(t, client, id) -} - -func createDefRule(t *testing.T, client *gophercloud.ServiceClient) string { - opts := dsr.CreateOpts{ - FromPort: tools.RandomInt(80, 89), - ToPort: tools.RandomInt(90, 99), - IPProtocol: "TCP", - CIDR: "0.0.0.0/0", - } - - rule, err := dsr.Create(client, opts).Extract() - th.AssertNoErr(t, err) - - t.Logf("Created default rule %s", rule.ID) - - return rule.ID -} - -func listDefRules(t *testing.T, client *gophercloud.ServiceClient) { - err := dsr.List(client).EachPage(func(page pagination.Page) (bool, error) { - drList, err := dsr.ExtractDefaultRules(page) - th.AssertNoErr(t, err) - - for _, dr := range drList { - t.Logf("Listing default rule %s: Name [%s] From Port [%s] To Port [%s] Protocol [%s]", - dr.ID, dr.FromPort, dr.ToPort, dr.IPProtocol) - } - - return true, nil - }) - - th.AssertNoErr(t, err) -} - -func getDefRule(t *testing.T, client *gophercloud.ServiceClient, id string) { - rule, err := dsr.Get(client, id).Extract() - th.AssertNoErr(t, err) - - t.Logf("Getting rule %s: %#v", id, rule) -} - -func deleteDefRule(t *testing.T, client *gophercloud.ServiceClient, id string) { - err := dsr.Delete(client, id).ExtractErr() - th.AssertNoErr(t, err) - - t.Logf("Deleted rule %s", id) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/secgroup_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/secgroup_test.go deleted file mode 100644 index 4f50739109..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/secgroup_test.go +++ /dev/null @@ -1,177 +0,0 @@ -// +build acceptance compute secgroups - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/secgroups" - "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestSecGroups(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - serverID, needsDeletion := findServer(t, client) - - groupID := createSecGroup(t, client) - - listSecGroups(t, client) - - newName := tools.RandomString("secgroup_", 5) - updateSecGroup(t, client, groupID, newName) - - getSecGroup(t, client, groupID) - - addRemoveRules(t, client, groupID) - - addServerToSecGroup(t, client, serverID, newName) - - removeServerFromSecGroup(t, client, serverID, newName) - - if needsDeletion { - servers.Delete(client, serverID) - } - - deleteSecGroup(t, client, groupID) -} - -func createSecGroup(t *testing.T, client *gophercloud.ServiceClient) string { - opts := secgroups.CreateOpts{ - Name: tools.RandomString("secgroup_", 5), - Description: "something", - } - - group, err := secgroups.Create(client, opts).Extract() - th.AssertNoErr(t, err) - - t.Logf("Created secgroup %s %s", group.ID, group.Name) - - return group.ID -} - -func listSecGroups(t *testing.T, client *gophercloud.ServiceClient) { - err := secgroups.List(client).EachPage(func(page pagination.Page) (bool, error) { - secGrpList, err := secgroups.ExtractSecurityGroups(page) - th.AssertNoErr(t, err) - - for _, sg := range secGrpList { - t.Logf("Listing secgroup %s: Name [%s] Desc [%s] TenantID [%s]", sg.ID, - sg.Name, sg.Description, sg.TenantID) - } - - return true, nil - }) - - th.AssertNoErr(t, err) -} - -func updateSecGroup(t *testing.T, client *gophercloud.ServiceClient, id, newName string) { - opts := secgroups.UpdateOpts{ - Name: newName, - Description: tools.RandomString("dec_", 10), - } - group, err := secgroups.Update(client, id, opts).Extract() - th.AssertNoErr(t, err) - - t.Logf("Updated %s's name to %s", group.ID, group.Name) -} - -func getSecGroup(t *testing.T, client *gophercloud.ServiceClient, id string) { - group, err := secgroups.Get(client, id).Extract() - th.AssertNoErr(t, err) - - t.Logf("Getting %s: %#v", id, group) -} - -func addRemoveRules(t *testing.T, client *gophercloud.ServiceClient, id string) { - opts := secgroups.CreateRuleOpts{ - ParentGroupID: id, - FromPort: 22, - ToPort: 22, - IPProtocol: "TCP", - CIDR: "0.0.0.0/0", - } - - rule, err := secgroups.CreateRule(client, opts).Extract() - th.AssertNoErr(t, err) - - t.Logf("Adding rule %s to group %s", rule.ID, id) - - err = secgroups.DeleteRule(client, rule.ID).ExtractErr() - th.AssertNoErr(t, err) - - t.Logf("Deleted rule %s from group %s", rule.ID, id) -} - -func findServer(t *testing.T, client *gophercloud.ServiceClient) (string, bool) { - var serverID string - var needsDeletion bool - - err := servers.List(client, nil).EachPage(func(page pagination.Page) (bool, error) { - sList, err := servers.ExtractServers(page) - th.AssertNoErr(t, err) - - for _, s := range sList { - serverID = s.ID - needsDeletion = false - - t.Logf("Found an existing server: ID [%s]", serverID) - break - } - - return true, nil - }) - th.AssertNoErr(t, err) - - if serverID == "" { - t.Log("No server found, creating one") - - choices, err := ComputeChoicesFromEnv() - th.AssertNoErr(t, err) - - opts := &servers.CreateOpts{ - Name: tools.RandomString("secgroup_test_", 5), - ImageRef: choices.ImageID, - FlavorRef: choices.FlavorID, - } - - s, err := servers.Create(client, opts).Extract() - th.AssertNoErr(t, err) - serverID = s.ID - - t.Logf("Created server %s, waiting for it to build", s.ID) - err = servers.WaitForStatus(client, serverID, "ACTIVE", 300) - th.AssertNoErr(t, err) - - needsDeletion = true - } - - return serverID, needsDeletion -} - -func addServerToSecGroup(t *testing.T, client *gophercloud.ServiceClient, serverID, groupName string) { - err := secgroups.AddServerToGroup(client, serverID, groupName).ExtractErr() - th.AssertNoErr(t, err) - - t.Logf("Adding group %s to server %s", groupName, serverID) -} - -func removeServerFromSecGroup(t *testing.T, client *gophercloud.ServiceClient, serverID, groupName string) { - err := secgroups.RemoveServerFromGroup(client, serverID, groupName).ExtractErr() - th.AssertNoErr(t, err) - - t.Logf("Removing group %s from server %s", groupName, serverID) -} - -func deleteSecGroup(t *testing.T, client *gophercloud.ServiceClient, id string) { - err := secgroups.Delete(client, id).ExtractErr() - th.AssertNoErr(t, err) - - t.Logf("Deleted group %s", id) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/servergroup_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/servergroup_test.go deleted file mode 100644 index 945854e3b2..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/servergroup_test.go +++ /dev/null @@ -1,143 +0,0 @@ -// +build acceptance compute servers - -package v2 - -import ( - "fmt" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/schedulerhints" - "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/servergroups" - "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - th "github.com/rackspace/gophercloud/testhelper" -) - -func createServerGroup(t *testing.T, computeClient *gophercloud.ServiceClient) (*servergroups.ServerGroup, error) { - sg, err := servergroups.Create(computeClient, &servergroups.CreateOpts{ - Name: "test", - Policies: []string{"affinity"}, - }).Extract() - - if err != nil { - t.Fatalf("Unable to create server group: %v", err) - } - - t.Logf("Created server group: %v", sg.ID) - t.Logf("It has policies: %v", sg.Policies) - - return sg, nil -} - -func getServerGroup(t *testing.T, computeClient *gophercloud.ServiceClient, sgID string) error { - sg, err := servergroups.Get(computeClient, sgID).Extract() - if err != nil { - t.Fatalf("Unable to get server group: %v", err) - } - - t.Logf("Got server group: %v", sg.Name) - - return nil -} - -func createServerInGroup(t *testing.T, computeClient *gophercloud.ServiceClient, choices *ComputeChoices, serverGroup *servergroups.ServerGroup) (*servers.Server, error) { - if testing.Short() { - t.Skip("Skipping test that requires server creation in short mode.") - } - - name := tools.RandomString("ACPTTEST", 16) - t.Logf("Attempting to create server: %s\n", name) - - pwd := tools.MakeNewPassword("") - - serverCreateOpts := servers.CreateOpts{ - Name: name, - FlavorRef: choices.FlavorID, - ImageRef: choices.ImageID, - AdminPass: pwd, - } - server, err := servers.Create(computeClient, schedulerhints.CreateOptsExt{ - serverCreateOpts, - schedulerhints.SchedulerHints{ - Group: serverGroup.ID, - }, - }).Extract() - if err != nil { - t.Fatalf("Unable to create server: %v", err) - } - - th.AssertEquals(t, pwd, server.AdminPass) - - return server, err -} - -func verifySchedulerWorked(t *testing.T, firstServer, secondServer *servers.Server) error { - t.Logf("First server hostID: %v", firstServer.HostID) - t.Logf("Second server hostID: %v", secondServer.HostID) - if firstServer.HostID == secondServer.HostID { - return nil - } - - return fmt.Errorf("%s and %s were not scheduled on the same host.", firstServer.ID, secondServer.ID) -} - -func TestServerGroups(t *testing.T) { - choices, err := ComputeChoicesFromEnv() - if err != nil { - t.Fatal(err) - } - - computeClient, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - sg, err := createServerGroup(t, computeClient) - if err != nil { - t.Fatalf("Unable to create server group: %v", err) - } - defer func() { - servergroups.Delete(computeClient, sg.ID) - t.Logf("Server Group deleted.") - }() - - err = getServerGroup(t, computeClient, sg.ID) - if err != nil { - t.Fatalf("Unable to get server group: %v", err) - } - - firstServer, err := createServerInGroup(t, computeClient, choices, sg) - if err != nil { - t.Fatalf("Unable to create server: %v", err) - } - defer func() { - servers.Delete(computeClient, firstServer.ID) - t.Logf("Server deleted.") - }() - - if err = waitForStatus(computeClient, firstServer, "ACTIVE"); err != nil { - t.Fatalf("Unable to wait for server: %v", err) - } - - firstServer, err = servers.Get(computeClient, firstServer.ID).Extract() - - secondServer, err := createServerInGroup(t, computeClient, choices, sg) - if err != nil { - t.Fatalf("Unable to create server: %v", err) - } - defer func() { - servers.Delete(computeClient, secondServer.ID) - t.Logf("Server deleted.") - }() - - if err = waitForStatus(computeClient, secondServer, "ACTIVE"); err != nil { - t.Fatalf("Unable to wait for server: %v", err) - } - - secondServer, err = servers.Get(computeClient, secondServer.ID).Extract() - - if err = verifySchedulerWorked(t, firstServer, secondServer); err != nil { - t.Fatalf("Scheduling did not work: %v", err) - } -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/servers_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/servers_test.go deleted file mode 100644 index f6c7c05245..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/servers_test.go +++ /dev/null @@ -1,484 +0,0 @@ -// +build acceptance compute servers - -package v2 - -import ( - "os" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/openstack" - "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - "github.com/rackspace/gophercloud/openstack/networking/v2/networks" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestListServers(t *testing.T) { - client, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - t.Logf("ID\tRegion\tName\tStatus\tIPv4\tIPv6") - - pager := servers.List(client, servers.ListOpts{}) - count, pages := 0, 0 - pager.EachPage(func(page pagination.Page) (bool, error) { - pages++ - t.Logf("---") - - servers, err := servers.ExtractServers(page) - if err != nil { - return false, err - } - - for _, s := range servers { - t.Logf("%s\t%s\t%s\t%s\t%s\t\n", s.ID, s.Name, s.Status, s.AccessIPv4, s.AccessIPv6) - count++ - } - - return true, nil - }) - - t.Logf("--------\n%d servers listed on %d pages.\n", count, pages) -} - -func networkingClient() (*gophercloud.ServiceClient, error) { - opts, err := openstack.AuthOptionsFromEnv() - if err != nil { - return nil, err - } - - provider, err := openstack.AuthenticatedClient(opts) - if err != nil { - return nil, err - } - - return openstack.NewNetworkV2(provider, gophercloud.EndpointOpts{ - Region: os.Getenv("OS_REGION_NAME"), - }) -} - -func createServer(t *testing.T, client *gophercloud.ServiceClient, choices *ComputeChoices) (*servers.Server, error) { - if testing.Short() { - t.Skip("Skipping test that requires server creation in short mode.") - } - - var network networks.Network - - networkingClient, err := networkingClient() - if err != nil { - t.Fatalf("Unable to create a networking client: %v", err) - } - - pager := networks.List(networkingClient, networks.ListOpts{ - Name: choices.NetworkName, - Limit: 1, - }) - pager.EachPage(func(page pagination.Page) (bool, error) { - networks, err := networks.ExtractNetworks(page) - if err != nil { - t.Errorf("Failed to extract networks: %v", err) - return false, err - } - - if len(networks) == 0 { - t.Fatalf("No networks to attach to server") - return false, err - } - - network = networks[0] - - return false, nil - }) - - name := tools.RandomString("ACPTTEST", 16) - t.Logf("Attempting to create server: %s\n", name) - - pwd := tools.MakeNewPassword("") - - server, err := servers.Create(client, servers.CreateOpts{ - Name: name, - FlavorRef: choices.FlavorID, - ImageRef: choices.ImageID, - Networks: []servers.Network{ - servers.Network{UUID: network.ID}, - }, - AdminPass: pwd, - Personality: servers.Personality{ - &servers.File{ - Path: "/etc/test", - Contents: []byte("hello world"), - }, - }, - }).Extract() - if err != nil { - t.Fatalf("Unable to create server: %v", err) - } - - th.AssertEquals(t, pwd, server.AdminPass) - - return server, err -} - -func TestCreateDestroyServer(t *testing.T) { - choices, err := ComputeChoicesFromEnv() - if err != nil { - t.Fatal(err) - } - - client, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - server, err := createServer(t, client, choices) - if err != nil { - t.Fatalf("Unable to create server: %v", err) - } - defer func() { - servers.Delete(client, server.ID) - t.Logf("Server deleted.") - }() - - if err = waitForStatus(client, server, "ACTIVE"); err != nil { - t.Fatalf("Unable to wait for server: %v", err) - } - - pager := servers.ListAddresses(client, server.ID) - pager.EachPage(func(page pagination.Page) (bool, error) { - networks, err := servers.ExtractAddresses(page) - if err != nil { - return false, err - } - - for n, a := range networks { - t.Logf("%s: %+v\n", n, a) - } - return true, nil - }) - - pager = servers.ListAddressesByNetwork(client, server.ID, choices.NetworkName) - pager.EachPage(func(page pagination.Page) (bool, error) { - addresses, err := servers.ExtractNetworkAddresses(page) - if err != nil { - return false, err - } - - for _, a := range addresses { - t.Logf("%+v\n", a) - } - return true, nil - }) -} - -func TestUpdateServer(t *testing.T) { - client, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - choices, err := ComputeChoicesFromEnv() - if err != nil { - t.Fatal(err) - } - - server, err := createServer(t, client, choices) - if err != nil { - t.Fatal(err) - } - defer servers.Delete(client, server.ID) - - if err = waitForStatus(client, server, "ACTIVE"); err != nil { - t.Fatal(err) - } - - alternateName := tools.RandomString("ACPTTEST", 16) - for alternateName == server.Name { - alternateName = tools.RandomString("ACPTTEST", 16) - } - - t.Logf("Attempting to rename the server to %s.", alternateName) - - updated, err := servers.Update(client, server.ID, servers.UpdateOpts{Name: alternateName}).Extract() - if err != nil { - t.Fatalf("Unable to rename server: %v", err) - } - - if updated.ID != server.ID { - t.Errorf("Updated server ID [%s] didn't match original server ID [%s]!", updated.ID, server.ID) - } - - err = tools.WaitFor(func() (bool, error) { - latest, err := servers.Get(client, updated.ID).Extract() - if err != nil { - return false, err - } - - return latest.Name == alternateName, nil - }) -} - -func TestActionChangeAdminPassword(t *testing.T) { - t.Parallel() - - client, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - choices, err := ComputeChoicesFromEnv() - if err != nil { - t.Fatal(err) - } - - server, err := createServer(t, client, choices) - if err != nil { - t.Fatal(err) - } - defer servers.Delete(client, server.ID) - - if err = waitForStatus(client, server, "ACTIVE"); err != nil { - t.Fatal(err) - } - - randomPassword := tools.MakeNewPassword(server.AdminPass) - res := servers.ChangeAdminPassword(client, server.ID, randomPassword) - if res.Err != nil { - t.Fatal(err) - } - - if err = waitForStatus(client, server, "PASSWORD"); err != nil { - t.Fatal(err) - } - - if err = waitForStatus(client, server, "ACTIVE"); err != nil { - t.Fatal(err) - } -} - -func TestActionReboot(t *testing.T) { - t.Parallel() - - client, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - choices, err := ComputeChoicesFromEnv() - if err != nil { - t.Fatal(err) - } - - server, err := createServer(t, client, choices) - if err != nil { - t.Fatal(err) - } - defer servers.Delete(client, server.ID) - - if err = waitForStatus(client, server, "ACTIVE"); err != nil { - t.Fatal(err) - } - - res := servers.Reboot(client, server.ID, "aldhjflaskhjf") - if res.Err == nil { - t.Fatal("Expected the SDK to provide an ArgumentError here") - } - - t.Logf("Attempting reboot of server %s", server.ID) - res = servers.Reboot(client, server.ID, servers.OSReboot) - if res.Err != nil { - t.Fatalf("Unable to reboot server: %v", err) - } - - if err = waitForStatus(client, server, "REBOOT"); err != nil { - t.Fatal(err) - } - - if err = waitForStatus(client, server, "ACTIVE"); err != nil { - t.Fatal(err) - } -} - -func TestActionRebuild(t *testing.T) { - t.Parallel() - - client, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - choices, err := ComputeChoicesFromEnv() - if err != nil { - t.Fatal(err) - } - - server, err := createServer(t, client, choices) - if err != nil { - t.Fatal(err) - } - defer servers.Delete(client, server.ID) - - if err = waitForStatus(client, server, "ACTIVE"); err != nil { - t.Fatal(err) - } - - t.Logf("Attempting to rebuild server %s", server.ID) - - rebuildOpts := servers.RebuildOpts{ - Name: tools.RandomString("ACPTTEST", 16), - AdminPass: tools.MakeNewPassword(server.AdminPass), - ImageID: choices.ImageID, - } - - rebuilt, err := servers.Rebuild(client, server.ID, rebuildOpts).Extract() - if err != nil { - t.Fatal(err) - } - - if rebuilt.ID != server.ID { - t.Errorf("Expected rebuilt server ID of [%s]; got [%s]", server.ID, rebuilt.ID) - } - - if err = waitForStatus(client, rebuilt, "REBUILD"); err != nil { - t.Fatal(err) - } - - if err = waitForStatus(client, rebuilt, "ACTIVE"); err != nil { - t.Fatal(err) - } -} - -func resizeServer(t *testing.T, client *gophercloud.ServiceClient, server *servers.Server, choices *ComputeChoices) { - if err := waitForStatus(client, server, "ACTIVE"); err != nil { - t.Fatal(err) - } - - t.Logf("Attempting to resize server [%s]", server.ID) - - opts := &servers.ResizeOpts{ - FlavorRef: choices.FlavorIDResize, - } - if res := servers.Resize(client, server.ID, opts); res.Err != nil { - t.Fatal(res.Err) - } - - if err := waitForStatus(client, server, "VERIFY_RESIZE"); err != nil { - t.Fatal(err) - } -} - -func TestActionResizeConfirm(t *testing.T) { - t.Parallel() - - choices, err := ComputeChoicesFromEnv() - if err != nil { - t.Fatal(err) - } - - client, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - server, err := createServer(t, client, choices) - if err != nil { - t.Fatal(err) - } - defer servers.Delete(client, server.ID) - resizeServer(t, client, server, choices) - - t.Logf("Attempting to confirm resize for server %s", server.ID) - - if res := servers.ConfirmResize(client, server.ID); res.Err != nil { - t.Fatal(err) - } - - if err = waitForStatus(client, server, "ACTIVE"); err != nil { - t.Fatal(err) - } -} - -func TestActionResizeRevert(t *testing.T) { - t.Parallel() - - choices, err := ComputeChoicesFromEnv() - if err != nil { - t.Fatal(err) - } - - client, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - server, err := createServer(t, client, choices) - if err != nil { - t.Fatal(err) - } - defer servers.Delete(client, server.ID) - resizeServer(t, client, server, choices) - - t.Logf("Attempting to revert resize for server %s", server.ID) - - if res := servers.RevertResize(client, server.ID); res.Err != nil { - t.Fatal(err) - } - - if err = waitForStatus(client, server, "ACTIVE"); err != nil { - t.Fatal(err) - } -} - -func TestServerMetadata(t *testing.T) { - t.Parallel() - - choices, err := ComputeChoicesFromEnv() - th.AssertNoErr(t, err) - - client, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - server, err := createServer(t, client, choices) - if err != nil { - t.Fatal(err) - } - defer servers.Delete(client, server.ID) - if err = waitForStatus(client, server, "ACTIVE"); err != nil { - t.Fatal(err) - } - - metadata, err := servers.UpdateMetadata(client, server.ID, servers.MetadataOpts{ - "foo": "bar", - "this": "that", - }).Extract() - th.AssertNoErr(t, err) - t.Logf("UpdateMetadata result: %+v\n", metadata) - - err = servers.DeleteMetadatum(client, server.ID, "foo").ExtractErr() - th.AssertNoErr(t, err) - - metadata, err = servers.CreateMetadatum(client, server.ID, servers.MetadatumOpts{ - "foo": "baz", - }).Extract() - th.AssertNoErr(t, err) - t.Logf("CreateMetadatum result: %+v\n", metadata) - - metadata, err = servers.Metadatum(client, server.ID, "foo").Extract() - th.AssertNoErr(t, err) - t.Logf("Metadatum result: %+v\n", metadata) - th.AssertEquals(t, "baz", metadata["foo"]) - - metadata, err = servers.Metadata(client, server.ID).Extract() - th.AssertNoErr(t, err) - t.Logf("Metadata result: %+v\n", metadata) - - metadata, err = servers.ResetMetadata(client, server.ID, servers.MetadataOpts{}).Extract() - th.AssertNoErr(t, err) - t.Logf("ResetMetadata result: %+v\n", metadata) - th.AssertDeepEquals(t, map[string]string{}, metadata) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/tenantnetworks_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/tenantnetworks_test.go deleted file mode 100644 index a92e8bf531..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/tenantnetworks_test.go +++ /dev/null @@ -1,109 +0,0 @@ -// +build acceptance compute servers - -package v2 - -import ( - "os" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/tenantnetworks" - "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - th "github.com/rackspace/gophercloud/testhelper" -) - -func getNetworkID(t *testing.T, client *gophercloud.ServiceClient, networkName string) (string, error) { - allPages, err := tenantnetworks.List(client).AllPages() - if err != nil { - t.Fatalf("Unable to list networks: %v", err) - } - - networkList, err := tenantnetworks.ExtractNetworks(allPages) - if err != nil { - t.Fatalf("Unable to list networks: %v", err) - } - - networkID := "" - for _, network := range networkList { - t.Logf("Network: %v", network) - if network.Name == networkName { - networkID = network.ID - } - } - - t.Logf("Found network ID for %s: %s\n", networkName, networkID) - - return networkID, nil -} - -func createNetworkServer(t *testing.T, client *gophercloud.ServiceClient, choices *ComputeChoices, networkID string) (*servers.Server, error) { - if testing.Short() { - t.Skip("Skipping test that requires server creation in short mode.") - } - - name := tools.RandomString("ACPTTEST", 16) - t.Logf("Attempting to create server: %s\n", name) - - pwd := tools.MakeNewPassword("") - - networks := make([]servers.Network, 1) - networks[0] = servers.Network{ - UUID: networkID, - } - - server, err := servers.Create(client, servers.CreateOpts{ - Name: name, - FlavorRef: choices.FlavorID, - ImageRef: choices.ImageID, - AdminPass: pwd, - Networks: networks, - }).Extract() - if err != nil { - t.Fatalf("Unable to create server: %v", err) - } - - th.AssertEquals(t, pwd, server.AdminPass) - - return server, err -} - -func TestTenantNetworks(t *testing.T) { - networkName := os.Getenv("OS_NETWORK_NAME") - if networkName == "" { - t.Fatalf("OS_NETWORK_NAME must be set") - } - - choices, err := ComputeChoicesFromEnv() - if err != nil { - t.Fatal(err) - } - - client, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - networkID, err := getNetworkID(t, client, networkName) - if err != nil { - t.Fatalf("Unable to get network ID: %v", err) - } - - server, err := createNetworkServer(t, client, choices, networkID) - if err != nil { - t.Fatalf("Unable to create server: %v", err) - } - defer func() { - servers.Delete(client, server.ID) - t.Logf("Server deleted.") - }() - - if err = waitForStatus(client, server, "ACTIVE"); err != nil { - t.Fatalf("Unable to wait for server: %v", err) - } - - allPages, err := tenantnetworks.List(client).AllPages() - allNetworks, err := tenantnetworks.ExtractNetworks(allPages) - th.AssertNoErr(t, err) - t.Logf("Retrieved all %d networks: %+v", len(allNetworks), allNetworks) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/volumeattach_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/volumeattach_test.go deleted file mode 100644 index 34634c9d2f..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/compute/v2/volumeattach_test.go +++ /dev/null @@ -1,125 +0,0 @@ -// +build acceptance compute servers - -package v2 - -import ( - "os" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/openstack" - "github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes" - "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/volumeattach" - "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - th "github.com/rackspace/gophercloud/testhelper" -) - -func newBlockClient(t *testing.T) (*gophercloud.ServiceClient, error) { - ao, err := openstack.AuthOptionsFromEnv() - th.AssertNoErr(t, err) - - client, err := openstack.AuthenticatedClient(ao) - th.AssertNoErr(t, err) - - return openstack.NewBlockStorageV1(client, gophercloud.EndpointOpts{ - Region: os.Getenv("OS_REGION_NAME"), - }) -} - -func createVAServer(t *testing.T, computeClient *gophercloud.ServiceClient, choices *ComputeChoices) (*servers.Server, error) { - if testing.Short() { - t.Skip("Skipping test that requires server creation in short mode.") - } - - name := tools.RandomString("ACPTTEST", 16) - t.Logf("Attempting to create server: %s\n", name) - - pwd := tools.MakeNewPassword("") - - server, err := servers.Create(computeClient, servers.CreateOpts{ - Name: name, - FlavorRef: choices.FlavorID, - ImageRef: choices.ImageID, - AdminPass: pwd, - }).Extract() - if err != nil { - t.Fatalf("Unable to create server: %v", err) - } - - th.AssertEquals(t, pwd, server.AdminPass) - - return server, err -} - -func createVAVolume(t *testing.T, blockClient *gophercloud.ServiceClient) (*volumes.Volume, error) { - volume, err := volumes.Create(blockClient, &volumes.CreateOpts{ - Size: 1, - Name: "gophercloud-test-volume", - }).Extract() - th.AssertNoErr(t, err) - defer func() { - err = volumes.WaitForStatus(blockClient, volume.ID, "available", 60) - th.AssertNoErr(t, err) - }() - - return volume, err -} - -func createVolumeAttachment(t *testing.T, computeClient *gophercloud.ServiceClient, blockClient *gophercloud.ServiceClient, serverId string, volumeId string) { - va, err := volumeattach.Create(computeClient, serverId, &volumeattach.CreateOpts{ - VolumeID: volumeId, - }).Extract() - th.AssertNoErr(t, err) - defer func() { - err = volumes.WaitForStatus(blockClient, volumeId, "in-use", 60) - th.AssertNoErr(t, err) - err = volumeattach.Delete(computeClient, serverId, va.ID).ExtractErr() - th.AssertNoErr(t, err) - err = volumes.WaitForStatus(blockClient, volumeId, "available", 60) - th.AssertNoErr(t, err) - }() -} - -func TestAttachVolume(t *testing.T) { - choices, err := ComputeChoicesFromEnv() - if err != nil { - t.Fatal(err) - } - - computeClient, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - blockClient, err := newBlockClient(t) - if err != nil { - t.Fatalf("Unable to create a blockstorage client: %v", err) - } - - server, err := createVAServer(t, computeClient, choices) - if err != nil { - t.Fatalf("Unable to create server: %v", err) - } - defer func() { - servers.Delete(computeClient, server.ID) - t.Logf("Server deleted.") - }() - - if err = waitForStatus(computeClient, server, "ACTIVE"); err != nil { - t.Fatalf("Unable to wait for server: %v", err) - } - - volume, err := createVAVolume(t, blockClient) - if err != nil { - t.Fatalf("Unable to create volume: %v", err) - } - defer func() { - err = volumes.Delete(blockClient, volume.ID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Volume deleted.") - }() - - createVolumeAttachment(t, computeClient, blockClient, server.ID, volume.ID) - -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/db/v1/database_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/db/v1/database_test.go deleted file mode 100644 index 2fd31753b6..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/db/v1/database_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// +build acceptance db - -package v1 - -import ( - db "github.com/rackspace/gophercloud/openstack/db/v1/databases" - "github.com/rackspace/gophercloud/pagination" -) - -func (c context) createDBs() { - opts := db.BatchCreateOpts{ - db.CreateOpts{Name: "db1"}, - db.CreateOpts{Name: "db2"}, - db.CreateOpts{Name: "db3"}, - } - - err := db.Create(c.client, c.instanceID, opts).ExtractErr() - c.AssertNoErr(err) - c.Logf("Created three databases on instance %s: db1, db2, db3", c.instanceID) -} - -func (c context) listDBs() { - c.Logf("Listing databases on instance %s", c.instanceID) - - err := db.List(c.client, c.instanceID).EachPage(func(page pagination.Page) (bool, error) { - dbList, err := db.ExtractDBs(page) - c.AssertNoErr(err) - - for _, db := range dbList { - c.Logf("DB: %#v", db) - } - - return true, nil - }) - - c.AssertNoErr(err) -} - -func (c context) deleteDBs() { - for _, id := range []string{"db1", "db2", "db3"} { - err := db.Delete(c.client, c.instanceID, id).ExtractErr() - c.AssertNoErr(err) - c.Logf("Deleted DB %s", id) - } -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/db/v1/flavor_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/db/v1/flavor_test.go deleted file mode 100644 index 46f986cc84..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/db/v1/flavor_test.go +++ /dev/null @@ -1,31 +0,0 @@ -// +build acceptance db - -package v1 - -import ( - "github.com/rackspace/gophercloud/openstack/db/v1/flavors" - "github.com/rackspace/gophercloud/pagination" -) - -func (c context) listFlavors() { - c.Logf("Listing flavors") - - err := flavors.List(c.client).EachPage(func(page pagination.Page) (bool, error) { - flavorList, err := flavors.ExtractFlavors(page) - c.AssertNoErr(err) - - for _, f := range flavorList { - c.Logf("Flavor: ID [%s] Name [%s] RAM [%d]", f.ID, f.Name, f.RAM) - } - - return true, nil - }) - - c.AssertNoErr(err) -} - -func (c context) getFlavor() { - flavor, err := flavors.Get(c.client, "1").Extract() - c.Logf("Getting flavor %s", flavor.ID) - c.AssertNoErr(err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/db/v1/instance_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/db/v1/instance_test.go deleted file mode 100644 index dfded21754..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/db/v1/instance_test.go +++ /dev/null @@ -1,138 +0,0 @@ -// +build acceptance db - -package v1 - -import ( - "os" - "testing" - - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/openstack/db/v1/instances" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -const envDSType = "DATASTORE_TYPE_ID" - -func TestRunner(t *testing.T) { - c := newContext(t) - - // FLAVOR tests - c.listFlavors() - c.getFlavor() - - // INSTANCE tests - c.createInstance() - c.listInstances() - c.getInstance() - c.isRootEnabled() - c.enableRootUser() - c.isRootEnabled() - c.restartInstance() - //c.resizeInstance() - //c.resizeVol() - - // DATABASE tests - c.createDBs() - c.listDBs() - - // USER tests - c.createUsers() - c.listUsers() - - // TEARDOWN - c.deleteUsers() - c.deleteDBs() - c.deleteInstance() -} - -func (c context) createInstance() { - if os.Getenv(envDSType) == "" { - c.test.Fatalf("%s must be set as an environment var", envDSType) - } - - opts := instances.CreateOpts{ - FlavorRef: "2", - Size: 5, - Name: tools.RandomString("gopher_db", 5), - Datastore: &instances.DatastoreOpts{Type: os.Getenv(envDSType)}, - } - - instance, err := instances.Create(c.client, opts).Extract() - th.AssertNoErr(c.test, err) - - c.Logf("Restarting %s. Waiting...", instance.ID) - c.WaitUntilActive(instance.ID) - c.Logf("Created Instance %s", instance.ID) - - c.instanceID = instance.ID -} - -func (c context) listInstances() { - c.Logf("Listing instances") - - err := instances.List(c.client).EachPage(func(page pagination.Page) (bool, error) { - instanceList, err := instances.ExtractInstances(page) - c.AssertNoErr(err) - - for _, i := range instanceList { - c.Logf("Instance: ID [%s] Name [%s] Status [%s] VolSize [%d] Datastore Type [%s]", - i.ID, i.Name, i.Status, i.Volume.Size, i.Datastore.Type) - } - - return true, nil - }) - - c.AssertNoErr(err) -} - -func (c context) getInstance() { - instance, err := instances.Get(c.client, c.instanceID).Extract() - c.AssertNoErr(err) - c.Logf("Getting instance: %s", instance.ID) -} - -func (c context) deleteInstance() { - err := instances.Delete(c.client, c.instanceID).ExtractErr() - c.AssertNoErr(err) - c.Logf("Deleted instance %s", c.instanceID) -} - -func (c context) enableRootUser() { - _, err := instances.EnableRootUser(c.client, c.instanceID).Extract() - c.AssertNoErr(err) - c.Logf("Enabled root user on %s", c.instanceID) -} - -func (c context) isRootEnabled() { - enabled, err := instances.IsRootEnabled(c.client, c.instanceID) - c.AssertNoErr(err) - c.Logf("Is root enabled? %d", enabled) -} - -func (c context) restartInstance() { - id := c.instanceID - err := instances.Restart(c.client, id).ExtractErr() - c.AssertNoErr(err) - c.Logf("Restarting %s. Waiting...", id) - c.WaitUntilActive(id) - c.Logf("Restarted %s", id) -} - -func (c context) resizeInstance() { - id := c.instanceID - err := instances.Resize(c.client, id, "3").ExtractErr() - c.AssertNoErr(err) - c.Logf("Resizing %s. Waiting...", id) - c.WaitUntilActive(id) - c.Logf("Resized %s with flavorRef %s", id, "2") -} - -func (c context) resizeVol() { - id := c.instanceID - err := instances.ResizeVolume(c.client, id, 4).ExtractErr() - c.AssertNoErr(err) - c.Logf("Resizing volume of %s. Waiting...", id) - c.WaitUntilActive(id) - c.Logf("Resized the volume of %s to %d GB", id, 2) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/db/v1/user_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/db/v1/user_test.go deleted file mode 100644 index 25a47943c9..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/db/v1/user_test.go +++ /dev/null @@ -1,70 +0,0 @@ -// +build acceptance db - -package v1 - -import ( - "github.com/rackspace/gophercloud/acceptance/tools" - db "github.com/rackspace/gophercloud/openstack/db/v1/databases" - u "github.com/rackspace/gophercloud/openstack/db/v1/users" - "github.com/rackspace/gophercloud/pagination" -) - -func (c context) createUsers() { - users := []string{ - tools.RandomString("user_", 5), - tools.RandomString("user_", 5), - tools.RandomString("user_", 5), - } - - db1 := db.CreateOpts{Name: "db1"} - db2 := db.CreateOpts{Name: "db2"} - db3 := db.CreateOpts{Name: "db3"} - - opts := u.BatchCreateOpts{ - u.CreateOpts{ - Name: users[0], - Password: tools.RandomString("", 5), - Databases: db.BatchCreateOpts{db1, db2, db3}, - }, - u.CreateOpts{ - Name: users[1], - Password: tools.RandomString("", 5), - Databases: db.BatchCreateOpts{db1, db2}, - }, - u.CreateOpts{ - Name: users[2], - Password: tools.RandomString("", 5), - Databases: db.BatchCreateOpts{db3}, - }, - } - - err := u.Create(c.client, c.instanceID, opts).ExtractErr() - c.AssertNoErr(err) - c.Logf("Created three users on instance %s: %s, %s, %s", c.instanceID, users[0], users[1], users[2]) - c.users = users -} - -func (c context) listUsers() { - c.Logf("Listing databases on instance %s", c.instanceID) - - err := db.List(c.client, c.instanceID).EachPage(func(page pagination.Page) (bool, error) { - dbList, err := db.ExtractDBs(page) - c.AssertNoErr(err) - - for _, db := range dbList { - c.Logf("DB: %#v", db) - } - - return true, nil - }) - - c.AssertNoErr(err) -} - -func (c context) deleteUsers() { - for _, id := range c.DBIDs { - err := db.Delete(c.client, c.instanceID, id).ExtractErr() - c.AssertNoErr(err) - c.Logf("Deleted DB %s", id) - } -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/extension_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/extension_test.go deleted file mode 100644 index d1fa1e3dce..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/extension_test.go +++ /dev/null @@ -1,46 +0,0 @@ -// +build acceptance identity - -package v2 - -import ( - "testing" - - extensions2 "github.com/rackspace/gophercloud/openstack/identity/v2/extensions" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestEnumerateExtensions(t *testing.T) { - service := authenticatedClient(t) - - t.Logf("Extensions available on this identity endpoint:") - count := 0 - err := extensions2.List(service).EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page %02d ---", count) - - extensions, err := extensions2.ExtractExtensions(page) - th.AssertNoErr(t, err) - - for i, ext := range extensions { - t.Logf("[%02d] name=[%s] namespace=[%s]", i, ext.Name, ext.Namespace) - t.Logf(" alias=[%s] updated=[%s]", ext.Alias, ext.Updated) - t.Logf(" description=[%s]", ext.Description) - } - - count++ - return true, nil - }) - th.AssertNoErr(t, err) -} - -func TestGetExtension(t *testing.T) { - service := authenticatedClient(t) - - ext, err := extensions2.Get(service, "OS-KSCRUD").Extract() - th.AssertNoErr(t, err) - - th.CheckEquals(t, "OpenStack Keystone User CRUD", ext.Name) - th.CheckEquals(t, "http://docs.openstack.org/identity/api/ext/OS-KSCRUD/v1.0", ext.Namespace) - th.CheckEquals(t, "OS-KSCRUD", ext.Alias) - th.CheckEquals(t, "OpenStack extensions to Keystone v2.0 API enabling User Operations.", ext.Description) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/identity_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/identity_test.go deleted file mode 100644 index 96bf1fdade..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/identity_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// +build acceptance identity - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/openstack" - th "github.com/rackspace/gophercloud/testhelper" -) - -func v2AuthOptions(t *testing.T) gophercloud.AuthOptions { - // Obtain credentials from the environment. - ao, err := openstack.AuthOptionsFromEnv() - th.AssertNoErr(t, err) - - // Trim out unused fields. Prefer authentication by API key to password. - ao.UserID, ao.DomainID, ao.DomainName = "", "", "" - if ao.APIKey != "" { - ao.Password = "" - } - - return ao -} - -func createClient(t *testing.T, auth bool) *gophercloud.ServiceClient { - ao := v2AuthOptions(t) - - provider, err := openstack.NewClient(ao.IdentityEndpoint) - th.AssertNoErr(t, err) - - if auth { - err = openstack.AuthenticateV2(provider, ao) - th.AssertNoErr(t, err) - } - - return openstack.NewIdentityV2(provider) -} - -func unauthenticatedClient(t *testing.T) *gophercloud.ServiceClient { - return createClient(t, false) -} - -func authenticatedClient(t *testing.T) *gophercloud.ServiceClient { - return createClient(t, true) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/role_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/role_test.go deleted file mode 100644 index ba243fe02b..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/role_test.go +++ /dev/null @@ -1,58 +0,0 @@ -// +build acceptance identity roles - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/openstack/identity/v2/extensions/admin/roles" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestRoles(t *testing.T) { - client := authenticatedClient(t) - - tenantID := findTenant(t, client) - userID := createUser(t, client, tenantID) - roleID := listRoles(t, client) - - addUserRole(t, client, tenantID, userID, roleID) - - deleteUserRole(t, client, tenantID, userID, roleID) - - deleteUser(t, client, userID) -} - -func listRoles(t *testing.T, client *gophercloud.ServiceClient) string { - var roleID string - - err := roles.List(client).EachPage(func(page pagination.Page) (bool, error) { - roleList, err := roles.ExtractRoles(page) - th.AssertNoErr(t, err) - - for _, role := range roleList { - t.Logf("Listing role: ID [%s] Name [%s]", role.ID, role.Name) - roleID = role.ID - } - - return true, nil - }) - - th.AssertNoErr(t, err) - - return roleID -} - -func addUserRole(t *testing.T, client *gophercloud.ServiceClient, tenantID, userID, roleID string) { - err := roles.AddUserRole(client, tenantID, userID, roleID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Added role %s to user %s", roleID, userID) -} - -func deleteUserRole(t *testing.T, client *gophercloud.ServiceClient, tenantID, userID, roleID string) { - err := roles.DeleteUserRole(client, tenantID, userID, roleID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Removed role %s from user %s", roleID, userID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/tenant_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/tenant_test.go deleted file mode 100644 index 578fc483b8..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/tenant_test.go +++ /dev/null @@ -1,32 +0,0 @@ -// +build acceptance identity - -package v2 - -import ( - "testing" - - tenants2 "github.com/rackspace/gophercloud/openstack/identity/v2/tenants" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestEnumerateTenants(t *testing.T) { - service := authenticatedClient(t) - - t.Logf("Tenants to which your current token grants access:") - count := 0 - err := tenants2.List(service, nil).EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page %02d ---", count) - - tenants, err := tenants2.ExtractTenants(page) - th.AssertNoErr(t, err) - for i, tenant := range tenants { - t.Logf("[%02d] name=[%s] id=[%s] description=[%s] enabled=[%v]", - i, tenant.Name, tenant.ID, tenant.Description, tenant.Enabled) - } - - count++ - return true, nil - }) - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/token_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/token_test.go deleted file mode 100644 index e01b3b3dd4..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/token_test.go +++ /dev/null @@ -1,54 +0,0 @@ -// +build acceptance identity - -package v2 - -import ( - "testing" - - tokens2 "github.com/rackspace/gophercloud/openstack/identity/v2/tokens" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestAuthenticateAndValidate(t *testing.T) { - // 1. TestAuthenticate - ao := v2AuthOptions(t) - service := unauthenticatedClient(t) - - // Authenticated! - result := tokens2.Create(service, tokens2.WrapOptions(ao)) - - // Extract and print the token. - token, err := result.ExtractToken() - th.AssertNoErr(t, err) - - t.Logf("Acquired token: [%s]", token.ID) - t.Logf("The token will expire at: [%s]", token.ExpiresAt.String()) - t.Logf("The token is valid for tenant: [%#v]", token.Tenant) - - // Extract and print the service catalog. - catalog, err := result.ExtractServiceCatalog() - th.AssertNoErr(t, err) - - t.Logf("Acquired service catalog listing [%d] services", len(catalog.Entries)) - for i, entry := range catalog.Entries { - t.Logf("[%02d]: name=[%s], type=[%s]", i, entry.Name, entry.Type) - for _, endpoint := range entry.Endpoints { - t.Logf(" - region=[%s] publicURL=[%s]", endpoint.Region, endpoint.PublicURL) - } - } - - // 2. TestValidate - client := authenticatedClient(t) - - // Validate Token! - getResult := tokens2.Get(client, token.ID) - - // Extract and print the user. - user, err := getResult.ExtractUser() - th.AssertNoErr(t, err) - - t.Logf("Acquired User: [%s]", user.Name) - t.Logf("The User id: [%s]", user.ID) - t.Logf("The User username: [%s]", user.UserName) - t.Logf("The User roles: [%#v]", user.Roles) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/user_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/user_test.go deleted file mode 100644 index fe73d19898..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v2/user_test.go +++ /dev/null @@ -1,127 +0,0 @@ -// +build acceptance identity - -package v2 - -import ( - "strconv" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/openstack/identity/v2/tenants" - "github.com/rackspace/gophercloud/openstack/identity/v2/users" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestUsers(t *testing.T) { - client := authenticatedClient(t) - - tenantID := findTenant(t, client) - - userID := createUser(t, client, tenantID) - - listUsers(t, client) - - getUser(t, client, userID) - - updateUser(t, client, userID) - - listUserRoles(t, client, tenantID, userID) - - deleteUser(t, client, userID) -} - -func findTenant(t *testing.T, client *gophercloud.ServiceClient) string { - var tenantID string - err := tenants.List(client, nil).EachPage(func(page pagination.Page) (bool, error) { - tenantList, err := tenants.ExtractTenants(page) - th.AssertNoErr(t, err) - - for _, t := range tenantList { - tenantID = t.ID - break - } - - return true, nil - }) - th.AssertNoErr(t, err) - - return tenantID -} - -func createUser(t *testing.T, client *gophercloud.ServiceClient, tenantID string) string { - t.Log("Creating user") - - opts := users.CreateOpts{ - Name: tools.RandomString("user_", 5), - Enabled: users.Disabled, - TenantID: tenantID, - Email: "new_user@foo.com", - } - - user, err := users.Create(client, opts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created user %s on tenant %s", user.ID, tenantID) - - return user.ID -} - -func listUsers(t *testing.T, client *gophercloud.ServiceClient) { - err := users.List(client).EachPage(func(page pagination.Page) (bool, error) { - userList, err := users.ExtractUsers(page) - th.AssertNoErr(t, err) - - for _, user := range userList { - t.Logf("Listing user: ID [%s] Name [%s] Email [%s] Enabled? [%s]", - user.ID, user.Name, user.Email, strconv.FormatBool(user.Enabled)) - } - - return true, nil - }) - - th.AssertNoErr(t, err) -} - -func getUser(t *testing.T, client *gophercloud.ServiceClient, userID string) { - _, err := users.Get(client, userID).Extract() - th.AssertNoErr(t, err) - t.Logf("Getting user %s", userID) -} - -func updateUser(t *testing.T, client *gophercloud.ServiceClient, userID string) { - opts := users.UpdateOpts{Name: tools.RandomString("new_name", 5), Email: "new@foo.com"} - user, err := users.Update(client, userID, opts).Extract() - th.AssertNoErr(t, err) - t.Logf("Updated user %s: Name [%s] Email [%s]", userID, user.Name, user.Email) -} - -func listUserRoles(t *testing.T, client *gophercloud.ServiceClient, tenantID, userID string) { - count := 0 - err := users.ListRoles(client, tenantID, userID).EachPage(func(page pagination.Page) (bool, error) { - count++ - - roleList, err := users.ExtractRoles(page) - th.AssertNoErr(t, err) - - t.Logf("Listing roles for user %s", userID) - - for _, r := range roleList { - t.Logf("- %s (%s)", r.Name, r.ID) - } - - return true, nil - }) - - if count == 0 { - t.Logf("No roles for user %s", userID) - } - - th.AssertNoErr(t, err) -} - -func deleteUser(t *testing.T, client *gophercloud.ServiceClient, userID string) { - res := users.Delete(client, userID) - th.AssertNoErr(t, res.Err) - t.Logf("Deleted user %s", userID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v3/endpoint_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v3/endpoint_test.go deleted file mode 100644 index ea893c2dea..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v3/endpoint_test.go +++ /dev/null @@ -1,111 +0,0 @@ -// +build acceptance - -package v3 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - endpoints3 "github.com/rackspace/gophercloud/openstack/identity/v3/endpoints" - services3 "github.com/rackspace/gophercloud/openstack/identity/v3/services" - "github.com/rackspace/gophercloud/pagination" -) - -func TestListEndpoints(t *testing.T) { - // Create a service client. - serviceClient := createAuthenticatedClient(t) - if serviceClient == nil { - return - } - - // Use the service to list all available endpoints. - pager := endpoints3.List(serviceClient, endpoints3.ListOpts{}) - err := pager.EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page ---") - - endpoints, err := endpoints3.ExtractEndpoints(page) - if err != nil { - t.Fatalf("Error extracting endpoings: %v", err) - } - - for _, endpoint := range endpoints { - t.Logf("Endpoint: %8s %10s %9s %s", - endpoint.ID, - endpoint.Availability, - endpoint.Name, - endpoint.URL) - } - - return true, nil - }) - if err != nil { - t.Errorf("Unexpected error while iterating endpoint pages: %v", err) - } -} - -func TestNavigateCatalog(t *testing.T) { - // Create a service client. - client := createAuthenticatedClient(t) - if client == nil { - return - } - - var compute *services3.Service - var endpoint *endpoints3.Endpoint - - // Discover the service we're interested in. - servicePager := services3.List(client, services3.ListOpts{ServiceType: "compute"}) - err := servicePager.EachPage(func(page pagination.Page) (bool, error) { - part, err := services3.ExtractServices(page) - if err != nil { - return false, err - } - if compute != nil { - t.Fatalf("Expected one service, got more than one page") - return false, nil - } - if len(part) != 1 { - t.Fatalf("Expected one service, got %d", len(part)) - return false, nil - } - - compute = &part[0] - return true, nil - }) - if err != nil { - t.Fatalf("Unexpected error iterating pages: %v", err) - } - - if compute == nil { - t.Fatalf("No compute service found.") - } - - // Enumerate the endpoints available for this service. - computePager := endpoints3.List(client, endpoints3.ListOpts{ - Availability: gophercloud.AvailabilityPublic, - ServiceID: compute.ID, - }) - err = computePager.EachPage(func(page pagination.Page) (bool, error) { - part, err := endpoints3.ExtractEndpoints(page) - if err != nil { - return false, err - } - if endpoint != nil { - t.Fatalf("Expected one endpoint, got more than one page") - return false, nil - } - if len(part) != 1 { - t.Fatalf("Expected one endpoint, got %d", len(part)) - return false, nil - } - - endpoint = &part[0] - return true, nil - }) - - if endpoint == nil { - t.Fatalf("No endpoint found.") - } - - t.Logf("Success. The compute endpoint is at %s.", endpoint.URL) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v3/identity_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v3/identity_test.go deleted file mode 100644 index ce64345886..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v3/identity_test.go +++ /dev/null @@ -1,39 +0,0 @@ -// +build acceptance - -package v3 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/openstack" - th "github.com/rackspace/gophercloud/testhelper" -) - -func createAuthenticatedClient(t *testing.T) *gophercloud.ServiceClient { - // Obtain credentials from the environment. - ao, err := openstack.AuthOptionsFromEnv() - th.AssertNoErr(t, err) - - // Trim out unused fields. - ao.Username, ao.TenantID, ao.TenantName = "", "", "" - - if ao.UserID == "" { - t.Logf("Skipping identity v3 tests because no OS_USERID is present.") - return nil - } - - // Create a client and manually authenticate against v3. - providerClient, err := openstack.NewClient(ao.IdentityEndpoint) - if err != nil { - t.Fatalf("Unable to instantiate client: %v", err) - } - - err = openstack.AuthenticateV3(providerClient, ao) - if err != nil { - t.Fatalf("Unable to authenticate against identity v3: %v", err) - } - - // Create a service client. - return openstack.NewIdentityV3(providerClient) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v3/service_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v3/service_test.go deleted file mode 100644 index 082bd11e74..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v3/service_test.go +++ /dev/null @@ -1,36 +0,0 @@ -// +build acceptance - -package v3 - -import ( - "testing" - - services3 "github.com/rackspace/gophercloud/openstack/identity/v3/services" - "github.com/rackspace/gophercloud/pagination" -) - -func TestListServices(t *testing.T) { - // Create a service client. - serviceClient := createAuthenticatedClient(t) - if serviceClient == nil { - return - } - - // Use the client to list all available services. - pager := services3.List(serviceClient, services3.ListOpts{}) - err := pager.EachPage(func(page pagination.Page) (bool, error) { - parts, err := services3.ExtractServices(page) - if err != nil { - return false, err - } - - t.Logf("--- Page ---") - for _, service := range parts { - t.Logf("Service: %32s %15s %10s %s", service.ID, service.Type, service.Name, *service.Description) - } - return true, nil - }) - if err != nil { - t.Errorf("Unexpected error traversing pages: %v", err) - } -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v3/token_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v3/token_test.go deleted file mode 100644 index 4342ade03c..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/identity/v3/token_test.go +++ /dev/null @@ -1,42 +0,0 @@ -// +build acceptance - -package v3 - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack" - tokens3 "github.com/rackspace/gophercloud/openstack/identity/v3/tokens" -) - -func TestGetToken(t *testing.T) { - // Obtain credentials from the environment. - ao, err := openstack.AuthOptionsFromEnv() - if err != nil { - t.Fatalf("Unable to acquire credentials: %v", err) - } - - // Trim out unused fields. Skip if we don't have a UserID. - ao.Username, ao.TenantID, ao.TenantName = "", "", "" - if ao.UserID == "" { - t.Logf("Skipping identity v3 tests because no OS_USERID is present.") - return - } - - // Create an unauthenticated client. - provider, err := openstack.NewClient(ao.IdentityEndpoint) - if err != nil { - t.Fatalf("Unable to instantiate client: %v", err) - } - - // Create a service client. - service := openstack.NewIdentityV3(provider) - - // Use the service to create a token. - token, err := tokens3.Create(service, ao, nil).Extract() - if err != nil { - t.Fatalf("Unable to get token: %v", err) - } - - t.Logf("Acquired token: %s", token.ID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/apiversion_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/apiversion_test.go deleted file mode 100644 index 99e1d01187..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/apiversion_test.go +++ /dev/null @@ -1,51 +0,0 @@ -// +build acceptance networking - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/networking/v2/apiversions" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestListAPIVersions(t *testing.T) { - Setup(t) - defer Teardown() - - pager := apiversions.ListVersions(Client) - err := pager.EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page ---") - - versions, err := apiversions.ExtractAPIVersions(page) - th.AssertNoErr(t, err) - - for _, v := range versions { - t.Logf("API Version: ID [%s] Status [%s]", v.ID, v.Status) - } - - return true, nil - }) - th.CheckNoErr(t, err) -} - -func TestListAPIResources(t *testing.T) { - Setup(t) - defer Teardown() - - pager := apiversions.ListVersionResources(Client, "v2.0") - err := pager.EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page ---") - - vrs, err := apiversions.ExtractVersionResources(page) - th.AssertNoErr(t, err) - - for _, vr := range vrs { - t.Logf("Network: Name [%s] Collection [%s]", vr.Name, vr.Collection) - } - - return true, nil - }) - th.CheckNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extension_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extension_test.go deleted file mode 100644 index edcbba4fd1..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extension_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// +build acceptance networking - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/networking/v2/extensions" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestListExts(t *testing.T) { - Setup(t) - defer Teardown() - - pager := extensions.List(Client) - err := pager.EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page ---") - - exts, err := extensions.ExtractExtensions(page) - th.AssertNoErr(t, err) - - for _, ext := range exts { - t.Logf("Extension: Name [%s] Description [%s]", ext.Name, ext.Description) - } - - return true, nil - }) - th.CheckNoErr(t, err) -} - -func TestGetExt(t *testing.T) { - Setup(t) - defer Teardown() - - ext, err := extensions.Get(Client, "service-type").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, ext.Updated, "2013-01-20T00:00:00-00:00") - th.AssertEquals(t, ext.Name, "Neutron Service Type Management") - th.AssertEquals(t, ext.Namespace, "http://docs.openstack.org/ext/neutron/service-type/api/v1.0") - th.AssertEquals(t, ext.Alias, "service-type") - th.AssertEquals(t, ext.Description, "API for retrieving service providers for Neutron advanced services") -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/fwaas/firewall_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/fwaas/firewall_test.go deleted file mode 100644 index 80246b6481..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/fwaas/firewall_test.go +++ /dev/null @@ -1,116 +0,0 @@ -// +build acceptance networking fwaas - -package fwaas - -import ( - "testing" - "time" - - "github.com/rackspace/gophercloud" - base "github.com/rackspace/gophercloud/acceptance/openstack/networking/v2" - "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/firewalls" - "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/policies" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func firewallSetup(t *testing.T) string { - base.Setup(t) - return createPolicy(t, &policies.CreateOpts{}) -} - -func firewallTeardown(t *testing.T, policyID string) { - defer base.Teardown() - deletePolicy(t, policyID) -} - -func TestFirewall(t *testing.T) { - policyID := firewallSetup(t) - defer firewallTeardown(t, policyID) - - firewallID := createFirewall(t, &firewalls.CreateOpts{ - Name: "gophercloud test", - Description: "acceptance test", - PolicyID: policyID, - }) - - waitForFirewallToBeActive(t, firewallID) - - listFirewalls(t) - - updateFirewall(t, firewallID, &firewalls.UpdateOpts{ - Description: "acceptance test updated", - }) - - waitForFirewallToBeActive(t, firewallID) - - deleteFirewall(t, firewallID) - - waitForFirewallToBeDeleted(t, firewallID) -} - -func createFirewall(t *testing.T, opts *firewalls.CreateOpts) string { - f, err := firewalls.Create(base.Client, *opts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created firewall: %#v", opts) - return f.ID -} - -func listFirewalls(t *testing.T) { - err := firewalls.List(base.Client, firewalls.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - firewallList, err := firewalls.ExtractFirewalls(page) - if err != nil { - t.Errorf("Failed to extract firewalls: %v", err) - return false, err - } - - for _, r := range firewallList { - t.Logf("Listing firewalls: ID [%s]", r.ID) - } - - return true, nil - }) - th.AssertNoErr(t, err) -} - -func updateFirewall(t *testing.T, firewallID string, opts *firewalls.UpdateOpts) { - f, err := firewalls.Update(base.Client, firewallID, *opts).Extract() - th.AssertNoErr(t, err) - t.Logf("Updated firewall ID [%s]", f.ID) -} - -func getFirewall(t *testing.T, firewallID string) *firewalls.Firewall { - f, err := firewalls.Get(base.Client, firewallID).Extract() - th.AssertNoErr(t, err) - t.Logf("Getting firewall ID [%s]", f.ID) - return f -} - -func deleteFirewall(t *testing.T, firewallID string) { - res := firewalls.Delete(base.Client, firewallID) - th.AssertNoErr(t, res.Err) - t.Logf("Deleted firewall %s", firewallID) -} - -func waitForFirewallToBeActive(t *testing.T, firewallID string) { - for i := 0; i < 10; i++ { - fw := getFirewall(t, firewallID) - if fw.Status == "ACTIVE" { - break - } - time.Sleep(time.Second) - } -} - -func waitForFirewallToBeDeleted(t *testing.T, firewallID string) { - for i := 0; i < 10; i++ { - err := firewalls.Get(base.Client, firewallID).Err - if err != nil { - httpStatus := err.(*gophercloud.UnexpectedResponseCodeError) - if httpStatus.Actual == 404 { - return - } - } - time.Sleep(time.Second) - } -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/fwaas/policy_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/fwaas/policy_test.go deleted file mode 100644 index fdca22e3fb..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/fwaas/policy_test.go +++ /dev/null @@ -1,107 +0,0 @@ -// +build acceptance networking fwaas - -package fwaas - -import ( - "testing" - - base "github.com/rackspace/gophercloud/acceptance/openstack/networking/v2" - "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/policies" - "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/rules" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func firewallPolicySetup(t *testing.T) string { - base.Setup(t) - return createRule(t, &rules.CreateOpts{ - Protocol: "tcp", - Action: "allow", - }) -} - -func firewallPolicyTeardown(t *testing.T, ruleID string) { - defer base.Teardown() - deleteRule(t, ruleID) -} - -func TestFirewallPolicy(t *testing.T) { - ruleID := firewallPolicySetup(t) - defer firewallPolicyTeardown(t, ruleID) - - policyID := createPolicy(t, &policies.CreateOpts{ - Name: "gophercloud test", - Description: "acceptance test", - Rules: []string{ - ruleID, - }, - }) - - listPolicies(t) - - updatePolicy(t, policyID, &policies.UpdateOpts{ - Description: "acceptance test updated", - }) - - getPolicy(t, policyID) - - removeRuleFromPolicy(t, policyID, ruleID) - - addRuleToPolicy(t, policyID, ruleID) - - deletePolicy(t, policyID) -} - -func createPolicy(t *testing.T, opts *policies.CreateOpts) string { - p, err := policies.Create(base.Client, *opts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created policy: %#v", opts) - return p.ID -} - -func listPolicies(t *testing.T) { - err := policies.List(base.Client, policies.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - policyList, err := policies.ExtractPolicies(page) - if err != nil { - t.Errorf("Failed to extract policies: %v", err) - return false, err - } - - for _, p := range policyList { - t.Logf("Listing policies: ID [%s]", p.ID) - } - - return true, nil - }) - th.AssertNoErr(t, err) -} - -func updatePolicy(t *testing.T, policyID string, opts *policies.UpdateOpts) { - p, err := policies.Update(base.Client, policyID, *opts).Extract() - th.AssertNoErr(t, err) - t.Logf("Updated policy ID [%s]", p.ID) -} - -func removeRuleFromPolicy(t *testing.T, policyID string, ruleID string) { - err := policies.RemoveRule(base.Client, policyID, ruleID) - th.AssertNoErr(t, err) - t.Logf("Removed rule [%s] from policy ID [%s]", ruleID, policyID) -} - -func addRuleToPolicy(t *testing.T, policyID string, ruleID string) { - err := policies.InsertRule(base.Client, policyID, ruleID, "", "") - th.AssertNoErr(t, err) - t.Logf("Inserted rule [%s] into policy ID [%s]", ruleID, policyID) -} - -func getPolicy(t *testing.T, policyID string) { - p, err := policies.Get(base.Client, policyID).Extract() - th.AssertNoErr(t, err) - t.Logf("Getting policy ID [%s]", p.ID) -} - -func deletePolicy(t *testing.T, policyID string) { - res := policies.Delete(base.Client, policyID) - th.AssertNoErr(t, res.Err) - t.Logf("Deleted policy %s", policyID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/fwaas/rule_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/fwaas/rule_test.go deleted file mode 100644 index 144aa0998f..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/fwaas/rule_test.go +++ /dev/null @@ -1,84 +0,0 @@ -// +build acceptance networking fwaas - -package fwaas - -import ( - "testing" - - base "github.com/rackspace/gophercloud/acceptance/openstack/networking/v2" - "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/rules" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestFirewallRules(t *testing.T) { - base.Setup(t) - defer base.Teardown() - - ruleID := createRule(t, &rules.CreateOpts{ - Name: "gophercloud_test", - Description: "acceptance test", - Protocol: "tcp", - Action: "allow", - DestinationIPAddress: "192.168.0.0/24", - DestinationPort: "22", - }) - - listRules(t) - - destinationIPAddress := "192.168.1.0/24" - destinationPort := "" - sourcePort := "1234" - - updateRule(t, ruleID, &rules.UpdateOpts{ - DestinationIPAddress: &destinationIPAddress, - DestinationPort: &destinationPort, - SourcePort: &sourcePort, - }) - - getRule(t, ruleID) - - deleteRule(t, ruleID) -} - -func createRule(t *testing.T, opts *rules.CreateOpts) string { - r, err := rules.Create(base.Client, *opts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created rule: %#v", opts) - return r.ID -} - -func listRules(t *testing.T) { - err := rules.List(base.Client, rules.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - ruleList, err := rules.ExtractRules(page) - if err != nil { - t.Errorf("Failed to extract rules: %v", err) - return false, err - } - - for _, r := range ruleList { - t.Logf("Listing rules: ID [%s]", r.ID) - } - - return true, nil - }) - th.AssertNoErr(t, err) -} - -func updateRule(t *testing.T, ruleID string, opts *rules.UpdateOpts) { - r, err := rules.Update(base.Client, ruleID, *opts).Extract() - th.AssertNoErr(t, err) - t.Logf("Updated rule ID [%s]", r.ID) -} - -func getRule(t *testing.T, ruleID string) { - r, err := rules.Get(base.Client, ruleID).Extract() - th.AssertNoErr(t, err) - t.Logf("Getting rule ID [%s]", r.ID) -} - -func deleteRule(t *testing.T, ruleID string) { - res := rules.Delete(base.Client, ruleID) - th.AssertNoErr(t, res.Err) - t.Logf("Deleted rule %s", ruleID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/layer3_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/layer3_test.go deleted file mode 100644 index 63e0be39d7..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/layer3_test.go +++ /dev/null @@ -1,300 +0,0 @@ -// +build acceptance networking layer3ext - -package extensions - -import ( - "testing" - - base "github.com/rackspace/gophercloud/acceptance/openstack/networking/v2" - "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/external" - "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/floatingips" - "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/routers" - "github.com/rackspace/gophercloud/openstack/networking/v2/networks" - "github.com/rackspace/gophercloud/openstack/networking/v2/ports" - "github.com/rackspace/gophercloud/openstack/networking/v2/subnets" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -const ( - cidr1 = "10.0.0.1/24" - cidr2 = "20.0.0.1/24" -) - -func TestAll(t *testing.T) { - base.Setup(t) - defer base.Teardown() - - testRouter(t) - testFloatingIP(t) -} - -func testRouter(t *testing.T) { - // Setup: Create network - networkID := createNetwork(t) - - // Create router - routerID := createRouter(t, networkID) - - // Lists routers - listRouters(t) - - // Update router - updateRouter(t, routerID) - - // Get router - getRouter(t, routerID) - - // Create new subnet. Note: this subnet will be deleted when networkID is deleted - subnetID := createSubnet(t, networkID, cidr2) - - // Add interface - addInterface(t, routerID, subnetID) - - // Remove interface - removeInterface(t, routerID, subnetID) - - // Delete router - deleteRouter(t, routerID) - - // Cleanup - deleteNetwork(t, networkID) -} - -func testFloatingIP(t *testing.T) { - // Setup external network - extNetworkID := createNetwork(t) - - // Setup internal network, subnet and port - intNetworkID, subnetID, portID := createInternalTopology(t) - - // Now the important part: we need to allow the external network to talk to - // the internal subnet. For this we need a router that has an interface to - // the internal subnet. - routerID := bridgeIntSubnetWithExtNetwork(t, extNetworkID, subnetID) - - // Create floating IP - ipID := createFloatingIP(t, extNetworkID, portID) - - // Get floating IP - getFloatingIP(t, ipID) - - // Update floating IP - updateFloatingIP(t, ipID, portID) - - // Delete floating IP - deleteFloatingIP(t, ipID) - - // Remove the internal subnet interface - removeInterface(t, routerID, subnetID) - - // Delete router and external network - deleteRouter(t, routerID) - deleteNetwork(t, extNetworkID) - - // Delete internal port and network - deletePort(t, portID) - deleteNetwork(t, intNetworkID) -} - -func createNetwork(t *testing.T) string { - t.Logf("Creating a network") - - asu := true - opts := external.CreateOpts{ - Parent: networks.CreateOpts{Name: "sample_network", AdminStateUp: &asu}, - External: true, - } - n, err := networks.Create(base.Client, opts).Extract() - - th.AssertNoErr(t, err) - - if n.ID == "" { - t.Fatalf("No ID returned when creating a network") - } - - createSubnet(t, n.ID, cidr1) - - t.Logf("Network created: ID [%s]", n.ID) - - return n.ID -} - -func deleteNetwork(t *testing.T, networkID string) { - t.Logf("Deleting network %s", networkID) - networks.Delete(base.Client, networkID) -} - -func deletePort(t *testing.T, portID string) { - t.Logf("Deleting port %s", portID) - ports.Delete(base.Client, portID) -} - -func createInternalTopology(t *testing.T) (string, string, string) { - t.Logf("Creating an internal network (for port)") - opts := networks.CreateOpts{Name: "internal_network"} - n, err := networks.Create(base.Client, opts).Extract() - th.AssertNoErr(t, err) - - // A subnet is also needed - subnetID := createSubnet(t, n.ID, cidr2) - - t.Logf("Creating an internal port on network %s", n.ID) - p, err := ports.Create(base.Client, ports.CreateOpts{ - NetworkID: n.ID, - Name: "fixed_internal_port", - }).Extract() - th.AssertNoErr(t, err) - - return n.ID, subnetID, p.ID -} - -func bridgeIntSubnetWithExtNetwork(t *testing.T, networkID, subnetID string) string { - // Create router with external gateway info - routerID := createRouter(t, networkID) - - // Add interface for internal subnet - addInterface(t, routerID, subnetID) - - return routerID -} - -func createSubnet(t *testing.T, networkID, cidr string) string { - t.Logf("Creating a subnet for network %s", networkID) - - iFalse := false - s, err := subnets.Create(base.Client, subnets.CreateOpts{ - NetworkID: networkID, - CIDR: cidr, - IPVersion: subnets.IPv4, - Name: "my_subnet", - EnableDHCP: &iFalse, - }).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Subnet created: ID [%s]", s.ID) - - return s.ID -} - -func createRouter(t *testing.T, networkID string) string { - t.Logf("Creating a router for network %s", networkID) - - asu := false - gwi := routers.GatewayInfo{NetworkID: networkID} - r, err := routers.Create(base.Client, routers.CreateOpts{ - Name: "foo_router", - AdminStateUp: &asu, - GatewayInfo: &gwi, - }).Extract() - - th.AssertNoErr(t, err) - - if r.ID == "" { - t.Fatalf("No ID returned when creating a router") - } - - t.Logf("Router created: ID [%s]", r.ID) - - return r.ID -} - -func listRouters(t *testing.T) { - pager := routers.List(base.Client, routers.ListOpts{}) - - err := pager.EachPage(func(page pagination.Page) (bool, error) { - routerList, err := routers.ExtractRouters(page) - th.AssertNoErr(t, err) - - for _, r := range routerList { - t.Logf("Listing router: ID [%s] Name [%s] Status [%s] GatewayInfo [%#v]", - r.ID, r.Name, r.Status, r.GatewayInfo) - } - - return true, nil - }) - - th.AssertNoErr(t, err) -} - -func updateRouter(t *testing.T, routerID string) { - _, err := routers.Update(base.Client, routerID, routers.UpdateOpts{ - Name: "another_name", - }).Extract() - - th.AssertNoErr(t, err) -} - -func getRouter(t *testing.T, routerID string) { - r, err := routers.Get(base.Client, routerID).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Getting router: ID [%s] Name [%s] Status [%s]", r.ID, r.Name, r.Status) -} - -func addInterface(t *testing.T, routerID, subnetID string) { - ir, err := routers.AddInterface(base.Client, routerID, routers.InterfaceOpts{SubnetID: subnetID}).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Interface added to router %s: SubnetID [%s] PortID [%s]", routerID, ir.SubnetID, ir.PortID) -} - -func removeInterface(t *testing.T, routerID, subnetID string) { - ir, err := routers.RemoveInterface(base.Client, routerID, routers.InterfaceOpts{SubnetID: subnetID}).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Interface %s removed from %s", ir.ID, routerID) -} - -func deleteRouter(t *testing.T, routerID string) { - t.Logf("Deleting router %s", routerID) - - res := routers.Delete(base.Client, routerID) - - th.AssertNoErr(t, res.Err) -} - -func createFloatingIP(t *testing.T, networkID, portID string) string { - t.Logf("Creating floating IP on network [%s] with port [%s]", networkID, portID) - - opts := floatingips.CreateOpts{ - FloatingNetworkID: networkID, - PortID: portID, - } - - ip, err := floatingips.Create(base.Client, opts).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Floating IP created: ID [%s] Status [%s] Fixed (internal) IP: [%s] Floating (external) IP: [%s]", - ip.ID, ip.Status, ip.FixedIP, ip.FloatingIP) - - return ip.ID -} - -func getFloatingIP(t *testing.T, ipID string) { - ip, err := floatingips.Get(base.Client, ipID).Extract() - th.AssertNoErr(t, err) - - t.Logf("Getting floating IP: ID [%s] Status [%s]", ip.ID, ip.Status) -} - -func updateFloatingIP(t *testing.T, ipID, portID string) { - t.Logf("Disassociate all ports from IP %s", ipID) - _, err := floatingips.Update(base.Client, ipID, floatingips.UpdateOpts{PortID: ""}).Extract() - th.AssertNoErr(t, err) - - t.Logf("Re-associate the port %s", portID) - _, err = floatingips.Update(base.Client, ipID, floatingips.UpdateOpts{PortID: portID}).Extract() - th.AssertNoErr(t, err) -} - -func deleteFloatingIP(t *testing.T, ipID string) { - t.Logf("Deleting IP %s", ipID) - res := floatingips.Delete(base.Client, ipID) - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/lbaas/member_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/lbaas/member_test.go deleted file mode 100644 index 9b60582d14..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/lbaas/member_test.go +++ /dev/null @@ -1,95 +0,0 @@ -// +build acceptance networking lbaas lbaasmember - -package lbaas - -import ( - "testing" - - base "github.com/rackspace/gophercloud/acceptance/openstack/networking/v2" - "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/members" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestMembers(t *testing.T) { - base.Setup(t) - defer base.Teardown() - - // setup - networkID, subnetID := SetupTopology(t) - poolID := CreatePool(t, subnetID) - - // create member - memberID := createMember(t, poolID) - - // list members - listMembers(t) - - // update member - updateMember(t, memberID) - - // get member - getMember(t, memberID) - - // delete member - deleteMember(t, memberID) - - // teardown - DeletePool(t, poolID) - DeleteTopology(t, networkID) -} - -func createMember(t *testing.T, poolID string) string { - m, err := members.Create(base.Client, members.CreateOpts{ - Address: "192.168.199.1", - ProtocolPort: 8080, - PoolID: poolID, - }).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Created member: ID [%s] Status [%s] Weight [%d] Address [%s] Port [%d]", - m.ID, m.Status, m.Weight, m.Address, m.ProtocolPort) - - return m.ID -} - -func listMembers(t *testing.T) { - err := members.List(base.Client, members.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - memberList, err := members.ExtractMembers(page) - if err != nil { - t.Errorf("Failed to extract members: %v", err) - return false, err - } - - for _, m := range memberList { - t.Logf("Listing member: ID [%s] Status [%s]", m.ID, m.Status) - } - - return true, nil - }) - - th.AssertNoErr(t, err) -} - -func updateMember(t *testing.T, memberID string) { - m, err := members.Update(base.Client, memberID, members.UpdateOpts{AdminStateUp: true}).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Updated member ID [%s]", m.ID) -} - -func getMember(t *testing.T, memberID string) { - m, err := members.Get(base.Client, memberID).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Getting member ID [%s]", m.ID) -} - -func deleteMember(t *testing.T, memberID string) { - res := members.Delete(base.Client, memberID) - th.AssertNoErr(t, res.Err) - t.Logf("Deleted member %s", memberID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/lbaas/monitor_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/lbaas/monitor_test.go deleted file mode 100644 index 9056fff671..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/lbaas/monitor_test.go +++ /dev/null @@ -1,77 +0,0 @@ -// +build acceptance networking lbaas lbaasmonitor - -package lbaas - -import ( - "testing" - - base "github.com/rackspace/gophercloud/acceptance/openstack/networking/v2" - "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/monitors" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestMonitors(t *testing.T) { - base.Setup(t) - defer base.Teardown() - - // create monitor - monitorID := CreateMonitor(t) - - // list monitors - listMonitors(t) - - // update monitor - updateMonitor(t, monitorID) - - // get monitor - getMonitor(t, monitorID) - - // delete monitor - deleteMonitor(t, monitorID) -} - -func listMonitors(t *testing.T) { - err := monitors.List(base.Client, monitors.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - monitorList, err := monitors.ExtractMonitors(page) - if err != nil { - t.Errorf("Failed to extract monitors: %v", err) - return false, err - } - - for _, m := range monitorList { - t.Logf("Listing monitor: ID [%s] Type [%s] Delay [%ds] Timeout [%d] Retries [%d] Status [%s]", - m.ID, m.Type, m.Delay, m.Timeout, m.MaxRetries, m.Status) - } - - return true, nil - }) - - th.AssertNoErr(t, err) -} - -func updateMonitor(t *testing.T, monitorID string) { - opts := monitors.UpdateOpts{Delay: 10, Timeout: 10, MaxRetries: 3} - m, err := monitors.Update(base.Client, monitorID, opts).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Updated monitor ID [%s]", m.ID) -} - -func getMonitor(t *testing.T, monitorID string) { - m, err := monitors.Get(base.Client, monitorID).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Getting monitor ID [%s]: URL path [%s] HTTP Method [%s] Accepted codes [%s]", - m.ID, m.URLPath, m.HTTPMethod, m.ExpectedCodes) -} - -func deleteMonitor(t *testing.T, monitorID string) { - res := monitors.Delete(base.Client, monitorID) - - th.AssertNoErr(t, res.Err) - - t.Logf("Deleted monitor %s", monitorID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/lbaas/pool_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/lbaas/pool_test.go deleted file mode 100644 index 81940649c5..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/lbaas/pool_test.go +++ /dev/null @@ -1,98 +0,0 @@ -// +build acceptance networking lbaas lbaaspool - -package lbaas - -import ( - "testing" - - base "github.com/rackspace/gophercloud/acceptance/openstack/networking/v2" - "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/pools" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestPools(t *testing.T) { - base.Setup(t) - defer base.Teardown() - - // setup - networkID, subnetID := SetupTopology(t) - - // create pool - poolID := CreatePool(t, subnetID) - - // list pools - listPools(t) - - // update pool - updatePool(t, poolID) - - // get pool - getPool(t, poolID) - - // create monitor - monitorID := CreateMonitor(t) - - // associate health monitor - associateMonitor(t, poolID, monitorID) - - // disassociate health monitor - disassociateMonitor(t, poolID, monitorID) - - // delete pool - DeletePool(t, poolID) - - // teardown - DeleteTopology(t, networkID) -} - -func listPools(t *testing.T) { - err := pools.List(base.Client, pools.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - poolList, err := pools.ExtractPools(page) - if err != nil { - t.Errorf("Failed to extract pools: %v", err) - return false, err - } - - for _, p := range poolList { - t.Logf("Listing pool: ID [%s] Name [%s] Status [%s] LB algorithm [%s]", p.ID, p.Name, p.Status, p.LBMethod) - } - - return true, nil - }) - - th.AssertNoErr(t, err) -} - -func updatePool(t *testing.T, poolID string) { - opts := pools.UpdateOpts{Name: "SuperPool", LBMethod: pools.LBMethodLeastConnections} - p, err := pools.Update(base.Client, poolID, opts).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Updated pool ID [%s]", p.ID) -} - -func getPool(t *testing.T, poolID string) { - p, err := pools.Get(base.Client, poolID).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Getting pool ID [%s]", p.ID) -} - -func associateMonitor(t *testing.T, poolID, monitorID string) { - res := pools.AssociateMonitor(base.Client, poolID, monitorID) - - th.AssertNoErr(t, res.Err) - - t.Logf("Associated pool %s with monitor %s", poolID, monitorID) -} - -func disassociateMonitor(t *testing.T, poolID, monitorID string) { - res := pools.DisassociateMonitor(base.Client, poolID, monitorID) - - th.AssertNoErr(t, res.Err) - - t.Logf("Disassociated pool %s with monitor %s", poolID, monitorID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/lbaas/vip_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/lbaas/vip_test.go deleted file mode 100644 index c8dff2d93f..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/lbaas/vip_test.go +++ /dev/null @@ -1,101 +0,0 @@ -// +build acceptance networking lbaas lbaasvip - -package lbaas - -import ( - "testing" - - base "github.com/rackspace/gophercloud/acceptance/openstack/networking/v2" - "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/vips" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestVIPs(t *testing.T) { - base.Setup(t) - defer base.Teardown() - - // setup - networkID, subnetID := SetupTopology(t) - poolID := CreatePool(t, subnetID) - - // create VIP - VIPID := createVIP(t, subnetID, poolID) - - // list VIPs - listVIPs(t) - - // update VIP - updateVIP(t, VIPID) - - // get VIP - getVIP(t, VIPID) - - // delete VIP - deleteVIP(t, VIPID) - - // teardown - DeletePool(t, poolID) - DeleteTopology(t, networkID) -} - -func createVIP(t *testing.T, subnetID, poolID string) string { - p, err := vips.Create(base.Client, vips.CreateOpts{ - Protocol: "HTTP", - Name: "New_VIP", - AdminStateUp: vips.Up, - SubnetID: subnetID, - PoolID: poolID, - ProtocolPort: 80, - }).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Created pool %s", p.ID) - - return p.ID -} - -func listVIPs(t *testing.T) { - err := vips.List(base.Client, vips.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - vipList, err := vips.ExtractVIPs(page) - if err != nil { - t.Errorf("Failed to extract VIPs: %v", err) - return false, err - } - - for _, vip := range vipList { - t.Logf("Listing VIP: ID [%s] Name [%s] Address [%s] Port [%s] Connection Limit [%d]", - vip.ID, vip.Name, vip.Address, vip.ProtocolPort, vip.ConnLimit) - } - - return true, nil - }) - - th.AssertNoErr(t, err) -} - -func updateVIP(t *testing.T, VIPID string) { - i1000 := 1000 - _, err := vips.Update(base.Client, VIPID, vips.UpdateOpts{ConnLimit: &i1000}).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Updated VIP ID [%s]", VIPID) -} - -func getVIP(t *testing.T, VIPID string) { - vip, err := vips.Get(base.Client, VIPID).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Getting VIP ID [%s]: Status [%s]", vip.ID, vip.Status) -} - -func deleteVIP(t *testing.T, VIPID string) { - res := vips.Delete(base.Client, VIPID) - - th.AssertNoErr(t, res.Err) - - t.Logf("Deleted VIP %s", VIPID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/provider_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/provider_test.go deleted file mode 100644 index f10c9d9bd1..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/provider_test.go +++ /dev/null @@ -1,68 +0,0 @@ -// +build acceptance networking - -package extensions - -import ( - "strconv" - "testing" - - base "github.com/rackspace/gophercloud/acceptance/openstack/networking/v2" - "github.com/rackspace/gophercloud/openstack/networking/v2/networks" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestNetworkCRUDOperations(t *testing.T) { - base.Setup(t) - defer base.Teardown() - - // Create a network - n, err := networks.Create(base.Client, networks.CreateOpts{Name: "sample_network", AdminStateUp: networks.Up}).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, n.Name, "sample_network") - th.AssertEquals(t, n.AdminStateUp, true) - networkID := n.ID - - // List networks - pager := networks.List(base.Client, networks.ListOpts{Limit: 2}) - err = pager.EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page ---") - - networkList, err := networks.ExtractNetworks(page) - th.AssertNoErr(t, err) - - for _, n := range networkList { - t.Logf("Network: ID [%s] Name [%s] Status [%s] Is shared? [%s]", - n.ID, n.Name, n.Status, strconv.FormatBool(n.Shared)) - } - - return true, nil - }) - th.CheckNoErr(t, err) - - // Get a network - if networkID == "" { - t.Fatalf("In order to retrieve a network, the NetworkID must be set") - } - n, err = networks.Get(base.Client, networkID).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, n.Status, "ACTIVE") - th.AssertDeepEquals(t, n.Subnets, []string{}) - th.AssertEquals(t, n.Name, "sample_network") - th.AssertEquals(t, n.AdminStateUp, true) - th.AssertEquals(t, n.Shared, false) - th.AssertEquals(t, n.ID, networkID) - - // Update network - n, err = networks.Update(base.Client, networkID, networks.UpdateOpts{Name: "new_network_name"}).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, n.Name, "new_network_name") - - // Delete network - res := networks.Delete(base.Client, networkID) - th.AssertNoErr(t, res.Err) -} - -func TestCreateMultipleNetworks(t *testing.T) { - //networks.CreateMany() -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/security_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/security_test.go deleted file mode 100644 index 7d75292f0d..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/extensions/security_test.go +++ /dev/null @@ -1,171 +0,0 @@ -// +build acceptance networking security - -package extensions - -import ( - "testing" - - base "github.com/rackspace/gophercloud/acceptance/openstack/networking/v2" - "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/groups" - "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/rules" - "github.com/rackspace/gophercloud/openstack/networking/v2/networks" - "github.com/rackspace/gophercloud/openstack/networking/v2/ports" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestSecurityGroups(t *testing.T) { - base.Setup(t) - defer base.Teardown() - - // create security group - groupID := createSecGroup(t) - - // delete security group - defer deleteSecGroup(t, groupID) - - // list security group - listSecGroups(t) - - // get security group - getSecGroup(t, groupID) - - // create port with security group - networkID, portID := createPort(t, groupID) - - // teardown - defer deleteNetwork(t, networkID) - - // delete port - defer deletePort(t, portID) -} - -func TestSecurityGroupRules(t *testing.T) { - base.Setup(t) - defer base.Teardown() - - // create security group - groupID := createSecGroup(t) - - defer deleteSecGroup(t, groupID) - - // create security group rule - ruleID := createSecRule(t, groupID) - - // delete security group rule - defer deleteSecRule(t, ruleID) - - // list security group rule - listSecRules(t) - - // get security group rule - getSecRule(t, ruleID) -} - -func createSecGroup(t *testing.T) string { - sg, err := groups.Create(base.Client, groups.CreateOpts{ - Name: "new-webservers", - Description: "security group for webservers", - }).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Created security group %s", sg.ID) - - return sg.ID -} - -func listSecGroups(t *testing.T) { - err := groups.List(base.Client, groups.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - list, err := groups.ExtractGroups(page) - if err != nil { - t.Errorf("Failed to extract secgroups: %v", err) - return false, err - } - - for _, sg := range list { - t.Logf("Listing security group: ID [%s] Name [%s]", sg.ID, sg.Name) - } - - return true, nil - }) - - th.AssertNoErr(t, err) -} - -func getSecGroup(t *testing.T, id string) { - sg, err := groups.Get(base.Client, id).Extract() - th.AssertNoErr(t, err) - t.Logf("Getting security group: ID [%s] Name [%s] Description [%s]", sg.ID, sg.Name, sg.Description) -} - -func createPort(t *testing.T, groupID string) (string, string) { - n, err := networks.Create(base.Client, networks.CreateOpts{Name: "tmp_network"}).Extract() - th.AssertNoErr(t, err) - t.Logf("Created network %s", n.ID) - - opts := ports.CreateOpts{ - NetworkID: n.ID, - Name: "my_port", - SecurityGroups: []string{groupID}, - } - p, err := ports.Create(base.Client, opts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created port %s with security group %s", p.ID, groupID) - - return n.ID, p.ID -} - -func deleteSecGroup(t *testing.T, groupID string) { - res := groups.Delete(base.Client, groupID) - th.AssertNoErr(t, res.Err) - t.Logf("Deleted security group %s", groupID) -} - -func createSecRule(t *testing.T, groupID string) string { - r, err := rules.Create(base.Client, rules.CreateOpts{ - Direction: "ingress", - PortRangeMin: 80, - EtherType: "IPv4", - PortRangeMax: 80, - Protocol: "tcp", - SecGroupID: groupID, - }).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Created security group rule %s", r.ID) - - return r.ID -} - -func listSecRules(t *testing.T) { - err := rules.List(base.Client, rules.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - list, err := rules.ExtractRules(page) - if err != nil { - t.Errorf("Failed to extract sec rules: %v", err) - return false, err - } - - for _, r := range list { - t.Logf("Listing security rule: ID [%s]", r.ID) - } - - return true, nil - }) - - th.AssertNoErr(t, err) -} - -func getSecRule(t *testing.T, id string) { - r, err := rules.Get(base.Client, id).Extract() - th.AssertNoErr(t, err) - t.Logf("Getting security rule: ID [%s] Direction [%s] EtherType [%s] Protocol [%s]", - r.ID, r.Direction, r.EtherType, r.Protocol) -} - -func deleteSecRule(t *testing.T, id string) { - res := rules.Delete(base.Client, id) - th.AssertNoErr(t, res.Err) - t.Logf("Deleted security rule %s", id) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/network_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/network_test.go deleted file mode 100644 index be8a3a195a..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/network_test.go +++ /dev/null @@ -1,68 +0,0 @@ -// +build acceptance networking - -package v2 - -import ( - "strconv" - "testing" - - "github.com/rackspace/gophercloud/openstack/networking/v2/networks" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestNetworkCRUDOperations(t *testing.T) { - Setup(t) - defer Teardown() - - // Create a network - n, err := networks.Create(Client, networks.CreateOpts{Name: "sample_network", AdminStateUp: networks.Up}).Extract() - th.AssertNoErr(t, err) - defer networks.Delete(Client, n.ID) - th.AssertEquals(t, n.Name, "sample_network") - th.AssertEquals(t, n.AdminStateUp, true) - networkID := n.ID - - // List networks - pager := networks.List(Client, networks.ListOpts{Limit: 2}) - err = pager.EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page ---") - - networkList, err := networks.ExtractNetworks(page) - th.AssertNoErr(t, err) - - for _, n := range networkList { - t.Logf("Network: ID [%s] Name [%s] Status [%s] Is shared? [%s]", - n.ID, n.Name, n.Status, strconv.FormatBool(n.Shared)) - } - - return true, nil - }) - th.CheckNoErr(t, err) - - // Get a network - if networkID == "" { - t.Fatalf("In order to retrieve a network, the NetworkID must be set") - } - n, err = networks.Get(Client, networkID).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, n.Status, "ACTIVE") - th.AssertDeepEquals(t, n.Subnets, []string{}) - th.AssertEquals(t, n.Name, "sample_network") - th.AssertEquals(t, n.AdminStateUp, true) - th.AssertEquals(t, n.Shared, false) - th.AssertEquals(t, n.ID, networkID) - - // Update network - n, err = networks.Update(Client, networkID, networks.UpdateOpts{Name: "new_network_name"}).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, n.Name, "new_network_name") - - // Delete network - res := networks.Delete(Client, networkID) - th.AssertNoErr(t, res.Err) -} - -func TestCreateMultipleNetworks(t *testing.T) { - //networks.CreateMany() -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/port_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/port_test.go deleted file mode 100644 index 03e8e27842..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/port_test.go +++ /dev/null @@ -1,117 +0,0 @@ -// +build acceptance networking - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/networking/v2/networks" - "github.com/rackspace/gophercloud/openstack/networking/v2/ports" - "github.com/rackspace/gophercloud/openstack/networking/v2/subnets" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestPortCRUD(t *testing.T) { - Setup(t) - defer Teardown() - - // Setup network - t.Log("Setting up network") - networkID, err := createNetwork() - th.AssertNoErr(t, err) - defer networks.Delete(Client, networkID) - - // Setup subnet - t.Logf("Setting up subnet on network %s", networkID) - subnetID, err := createSubnet(networkID) - th.AssertNoErr(t, err) - defer subnets.Delete(Client, subnetID) - - // Create port - t.Logf("Create port based on subnet %s", subnetID) - portID := createPort(t, networkID, subnetID) - - // List ports - t.Logf("Listing all ports") - listPorts(t) - - // Get port - if portID == "" { - t.Fatalf("In order to retrieve a port, the portID must be set") - } - p, err := ports.Get(Client, portID).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, p.ID, portID) - - // Update port - p, err = ports.Update(Client, portID, ports.UpdateOpts{Name: "new_port_name"}).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, p.Name, "new_port_name") - - // Delete port - res := ports.Delete(Client, portID) - th.AssertNoErr(t, res.Err) -} - -func createPort(t *testing.T, networkID, subnetID string) string { - enable := false - opts := ports.CreateOpts{ - NetworkID: networkID, - Name: "my_port", - AdminStateUp: &enable, - FixedIPs: []ports.IP{ports.IP{SubnetID: subnetID}}, - } - p, err := ports.Create(Client, opts).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, p.NetworkID, networkID) - th.AssertEquals(t, p.Name, "my_port") - th.AssertEquals(t, p.AdminStateUp, false) - - return p.ID -} - -func listPorts(t *testing.T) { - count := 0 - pager := ports.List(Client, ports.ListOpts{}) - err := pager.EachPage(func(page pagination.Page) (bool, error) { - count++ - t.Logf("--- Page ---") - - portList, err := ports.ExtractPorts(page) - th.AssertNoErr(t, err) - - for _, p := range portList { - t.Logf("Port: ID [%s] Name [%s] Status [%s] MAC addr [%s] Fixed IPs [%#v] Security groups [%#v]", - p.ID, p.Name, p.Status, p.MACAddress, p.FixedIPs, p.SecurityGroups) - } - - return true, nil - }) - - th.CheckNoErr(t, err) - - if count == 0 { - t.Logf("No pages were iterated over when listing ports") - } -} - -func createNetwork() (string, error) { - res, err := networks.Create(Client, networks.CreateOpts{Name: "tmp_network", AdminStateUp: networks.Up}).Extract() - return res.ID, err -} - -func createSubnet(networkID string) (string, error) { - s, err := subnets.Create(Client, subnets.CreateOpts{ - NetworkID: networkID, - CIDR: "192.168.199.0/24", - IPVersion: subnets.IPv4, - Name: "my_subnet", - EnableDHCP: subnets.Down, - }).Extract() - return s.ID, err -} - -func TestPortBatchCreate(t *testing.T) { - // todo -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/subnet_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/subnet_test.go deleted file mode 100644 index 097a303ede..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/networking/v2/subnet_test.go +++ /dev/null @@ -1,86 +0,0 @@ -// +build acceptance networking - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/networking/v2/networks" - "github.com/rackspace/gophercloud/openstack/networking/v2/subnets" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestList(t *testing.T) { - Setup(t) - defer Teardown() - - pager := subnets.List(Client, subnets.ListOpts{Limit: 2}) - err := pager.EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page ---") - - subnetList, err := subnets.ExtractSubnets(page) - th.AssertNoErr(t, err) - - for _, s := range subnetList { - t.Logf("Subnet: ID [%s] Name [%s] IP Version [%d] CIDR [%s] GatewayIP [%s]", - s.ID, s.Name, s.IPVersion, s.CIDR, s.GatewayIP) - } - - return true, nil - }) - th.CheckNoErr(t, err) -} - -func TestCRUD(t *testing.T) { - Setup(t) - defer Teardown() - - // Setup network - t.Log("Setting up network") - n, err := networks.Create(Client, networks.CreateOpts{Name: "tmp_network", AdminStateUp: networks.Up}).Extract() - th.AssertNoErr(t, err) - networkID := n.ID - defer networks.Delete(Client, networkID) - - // Create subnet - t.Log("Create subnet") - enable := false - opts := subnets.CreateOpts{ - NetworkID: networkID, - CIDR: "192.168.199.0/24", - IPVersion: subnets.IPv4, - Name: "my_subnet", - EnableDHCP: &enable, - } - s, err := subnets.Create(Client, opts).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, s.NetworkID, networkID) - th.AssertEquals(t, s.CIDR, "192.168.199.0/24") - th.AssertEquals(t, s.IPVersion, 4) - th.AssertEquals(t, s.Name, "my_subnet") - th.AssertEquals(t, s.EnableDHCP, false) - subnetID := s.ID - - // Get subnet - t.Log("Getting subnet") - s, err = subnets.Get(Client, subnetID).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, s.ID, subnetID) - - // Update subnet - t.Log("Update subnet") - s, err = subnets.Update(Client, subnetID, subnets.UpdateOpts{Name: "new_subnet_name"}).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, s.Name, "new_subnet_name") - - // Delete subnet - t.Log("Delete subnet") - res := subnets.Delete(Client, subnetID) - th.AssertNoErr(t, res.Err) -} - -func TestBatchCreate(t *testing.T) { - // todo -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/objectstorage/v1/accounts_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/objectstorage/v1/accounts_test.go deleted file mode 100644 index 24cc62b4aa..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/objectstorage/v1/accounts_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "strings" - "testing" - - "github.com/rackspace/gophercloud/openstack/objectstorage/v1/accounts" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestAccounts(t *testing.T) { - // Create a provider client for making the HTTP requests. - // See common.go in this directory for more information. - client := newClient(t) - - // Update an account's metadata. - updateres := accounts.Update(client, accounts.UpdateOpts{Metadata: metadata}) - t.Logf("Update Account Response: %+v\n", updateres) - updateHeaders, err := updateres.Extract() - th.AssertNoErr(t, err) - t.Logf("Update Account Response Headers: %+v\n", updateHeaders) - - // Defer the deletion of the metadata set above. - defer func() { - tempMap := make(map[string]string) - for k := range metadata { - tempMap[k] = "" - } - updateres = accounts.Update(client, accounts.UpdateOpts{Metadata: tempMap}) - th.AssertNoErr(t, updateres.Err) - }() - - // Extract the custom metadata from the 'Get' response. - res := accounts.Get(client, nil) - - h, err := res.Extract() - th.AssertNoErr(t, err) - t.Logf("Get Account Response Headers: %+v\n", h) - - am, err := res.ExtractMetadata() - th.AssertNoErr(t, err) - for k := range metadata { - if am[k] != metadata[strings.Title(k)] { - t.Errorf("Expected custom metadata with key: %s", k) - return - } - } -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/objectstorage/v1/containers_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/objectstorage/v1/containers_test.go deleted file mode 100644 index 8328a4fa6f..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/objectstorage/v1/containers_test.go +++ /dev/null @@ -1,137 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "strings" - "testing" - - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -// numContainers is the number of containers to create for testing. -var numContainers = 2 - -func TestContainers(t *testing.T) { - // Create a new client to execute the HTTP requests. See common.go for newClient body. - client := newClient(t) - - // Create a slice of random container names. - cNames := make([]string, numContainers) - for i := 0; i < numContainers; i++ { - cNames[i] = tools.RandomString("gophercloud-test-container-", 8) - } - - // Create numContainers containers. - for i := 0; i < len(cNames); i++ { - res := containers.Create(client, cNames[i], nil) - th.AssertNoErr(t, res.Err) - } - // Delete the numContainers containers after function completion. - defer func() { - for i := 0; i < len(cNames); i++ { - res := containers.Delete(client, cNames[i]) - th.AssertNoErr(t, res.Err) - } - }() - - // List the numContainer names that were just created. To just list those, - // the 'prefix' parameter is used. - err := containers.List(client, &containers.ListOpts{Full: true, Prefix: "gophercloud-test-container-"}).EachPage(func(page pagination.Page) (bool, error) { - containerList, err := containers.ExtractInfo(page) - th.AssertNoErr(t, err) - - for _, n := range containerList { - t.Logf("Container: Name [%s] Count [%d] Bytes [%d]", - n.Name, n.Count, n.Bytes) - } - - return true, nil - }) - th.AssertNoErr(t, err) - - // List the info for the numContainer containers that were created. - err = containers.List(client, &containers.ListOpts{Full: false, Prefix: "gophercloud-test-container-"}).EachPage(func(page pagination.Page) (bool, error) { - containerList, err := containers.ExtractNames(page) - th.AssertNoErr(t, err) - for _, n := range containerList { - t.Logf("Container: Name [%s]", n) - } - - return true, nil - }) - th.AssertNoErr(t, err) - - // Update one of the numContainer container metadata. - updateres := containers.Update(client, cNames[0], &containers.UpdateOpts{Metadata: metadata}) - th.AssertNoErr(t, updateres.Err) - // After the tests are done, delete the metadata that was set. - defer func() { - tempMap := make(map[string]string) - for k := range metadata { - tempMap[k] = "" - } - res := containers.Update(client, cNames[0], &containers.UpdateOpts{Metadata: tempMap}) - th.AssertNoErr(t, res.Err) - }() - - // Retrieve a container's metadata. - cm, err := containers.Get(client, cNames[0]).ExtractMetadata() - th.AssertNoErr(t, err) - for k := range metadata { - if cm[k] != metadata[strings.Title(k)] { - t.Errorf("Expected custom metadata with key: %s", k) - } - } -} - -func TestListAllContainers(t *testing.T) { - // Create a new client to execute the HTTP requests. See common.go for newClient body. - client := newClient(t) - - numContainers := 20 - - // Create a slice of random container names. - cNames := make([]string, numContainers) - for i := 0; i < numContainers; i++ { - cNames[i] = tools.RandomString("gophercloud-test-container-", 8) - } - - // Create numContainers containers. - for i := 0; i < len(cNames); i++ { - res := containers.Create(client, cNames[i], nil) - th.AssertNoErr(t, res.Err) - } - // Delete the numContainers containers after function completion. - defer func() { - for i := 0; i < len(cNames); i++ { - res := containers.Delete(client, cNames[i]) - th.AssertNoErr(t, res.Err) - } - }() - - // List all the numContainer names that were just created. To just list those, - // the 'prefix' parameter is used. - allPages, err := containers.List(client, &containers.ListOpts{Full: true, Limit: 5, Prefix: "gophercloud-test-container-"}).AllPages() - th.AssertNoErr(t, err) - containerInfoList, err := containers.ExtractInfo(allPages) - th.AssertNoErr(t, err) - for _, n := range containerInfoList { - t.Logf("Container: Name [%s] Count [%d] Bytes [%d]", - n.Name, n.Count, n.Bytes) - } - th.AssertEquals(t, numContainers, len(containerInfoList)) - - // List the info for all the numContainer containers that were created. - allPages, err = containers.List(client, &containers.ListOpts{Full: false, Limit: 2, Prefix: "gophercloud-test-container-"}).AllPages() - th.AssertNoErr(t, err) - containerNamesList, err := containers.ExtractNames(allPages) - th.AssertNoErr(t, err) - for _, n := range containerNamesList { - t.Logf("Container: Name [%s]", n) - } - th.AssertEquals(t, numContainers, len(containerNamesList)) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/objectstorage/v1/objects_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/objectstorage/v1/objects_test.go deleted file mode 100644 index a8de338c3d..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/objectstorage/v1/objects_test.go +++ /dev/null @@ -1,119 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "bytes" - "strings" - "testing" - - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers" - "github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -// numObjects is the number of objects to create for testing. -var numObjects = 2 - -func TestObjects(t *testing.T) { - // Create a provider client for executing the HTTP request. - // See common.go for more information. - client := newClient(t) - - // Make a slice of length numObjects to hold the random object names. - oNames := make([]string, numObjects) - for i := 0; i < len(oNames); i++ { - oNames[i] = tools.RandomString("test-object-", 8) - } - - // Create a container to hold the test objects. - cName := tools.RandomString("test-container-", 8) - header, err := containers.Create(client, cName, nil).ExtractHeader() - th.AssertNoErr(t, err) - t.Logf("Create object headers: %+v\n", header) - - // Defer deletion of the container until after testing. - defer func() { - res := containers.Delete(client, cName) - th.AssertNoErr(t, res.Err) - }() - - // Create a slice of buffers to hold the test object content. - oContents := make([]*bytes.Buffer, numObjects) - for i := 0; i < numObjects; i++ { - oContents[i] = bytes.NewBuffer([]byte(tools.RandomString("", 10))) - res := objects.Create(client, cName, oNames[i], oContents[i], nil) - th.AssertNoErr(t, res.Err) - } - // Delete the objects after testing. - defer func() { - for i := 0; i < numObjects; i++ { - res := objects.Delete(client, cName, oNames[i], nil) - th.AssertNoErr(t, res.Err) - } - }() - - ons := make([]string, 0, len(oNames)) - err = objects.List(client, cName, &objects.ListOpts{Full: false, Prefix: "test-object-"}).EachPage(func(page pagination.Page) (bool, error) { - names, err := objects.ExtractNames(page) - th.AssertNoErr(t, err) - ons = append(ons, names...) - - return true, nil - }) - th.AssertNoErr(t, err) - th.AssertEquals(t, len(ons), len(oNames)) - - ois := make([]objects.Object, 0, len(oNames)) - err = objects.List(client, cName, &objects.ListOpts{Full: true, Prefix: "test-object-"}).EachPage(func(page pagination.Page) (bool, error) { - info, err := objects.ExtractInfo(page) - th.AssertNoErr(t, err) - - ois = append(ois, info...) - - return true, nil - }) - th.AssertNoErr(t, err) - th.AssertEquals(t, len(ois), len(oNames)) - - // Copy the contents of one object to another. - copyres := objects.Copy(client, cName, oNames[0], &objects.CopyOpts{Destination: cName + "/" + oNames[1]}) - th.AssertNoErr(t, copyres.Err) - - // Download one of the objects that was created above. - o1Content, err := objects.Download(client, cName, oNames[0], nil).ExtractContent() - th.AssertNoErr(t, err) - - // Download the another object that was create above. - o2Content, err := objects.Download(client, cName, oNames[1], nil).ExtractContent() - th.AssertNoErr(t, err) - - // Compare the two object's contents to test that the copy worked. - th.AssertEquals(t, string(o2Content), string(o1Content)) - - // Update an object's metadata. - updateres := objects.Update(client, cName, oNames[0], &objects.UpdateOpts{Metadata: metadata}) - th.AssertNoErr(t, updateres.Err) - - // Delete the object's metadata after testing. - defer func() { - tempMap := make(map[string]string) - for k := range metadata { - tempMap[k] = "" - } - res := objects.Update(client, cName, oNames[0], &objects.UpdateOpts{Metadata: tempMap}) - th.AssertNoErr(t, res.Err) - }() - - // Retrieve an object's metadata. - om, err := objects.Get(client, cName, oNames[0], nil).ExtractMetadata() - th.AssertNoErr(t, err) - for k := range metadata { - if om[k] != metadata[strings.Title(k)] { - t.Errorf("Expected custom metadata with key: %s", k) - return - } - } -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/buildinfo_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/buildinfo_test.go deleted file mode 100644 index 05a5e1d67e..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/buildinfo_test.go +++ /dev/null @@ -1,20 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/orchestration/v1/buildinfo" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestBuildInfo(t *testing.T) { - // Create a provider client for making the HTTP requests. - // See common.go in this directory for more information. - client := newClient(t) - - bi, err := buildinfo.Get(client).Extract() - th.AssertNoErr(t, err) - t.Logf("retrieved build info: %+v\n", bi) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/stackevents_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/stackevents_test.go deleted file mode 100644 index e356c86aa9..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/stackevents_test.go +++ /dev/null @@ -1,68 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/openstack/orchestration/v1/stackevents" - "github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestStackEvents(t *testing.T) { - // Create a provider client for making the HTTP requests. - // See common.go in this directory for more information. - client := newClient(t) - - stackName := "postman_stack_2" - resourceName := "hello_world" - var eventID string - - createOpts := stacks.CreateOpts{ - Name: stackName, - Template: template, - Timeout: 5, - } - stack, err := stacks.Create(client, createOpts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created stack: %+v\n", stack) - defer func() { - err := stacks.Delete(client, stackName, stack.ID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Deleted stack (%s)", stackName) - }() - err = gophercloud.WaitFor(60, func() (bool, error) { - getStack, err := stacks.Get(client, stackName, stack.ID).Extract() - if err != nil { - return false, err - } - if getStack.Status == "CREATE_COMPLETE" { - return true, nil - } - return false, nil - }) - - err = stackevents.List(client, stackName, stack.ID, nil).EachPage(func(page pagination.Page) (bool, error) { - events, err := stackevents.ExtractEvents(page) - th.AssertNoErr(t, err) - t.Logf("listed events: %+v\n", events) - eventID = events[0].ID - return false, nil - }) - th.AssertNoErr(t, err) - - err = stackevents.ListResourceEvents(client, stackName, stack.ID, resourceName, nil).EachPage(func(page pagination.Page) (bool, error) { - resourceEvents, err := stackevents.ExtractEvents(page) - th.AssertNoErr(t, err) - t.Logf("listed resource events: %+v\n", resourceEvents) - return false, nil - }) - th.AssertNoErr(t, err) - - event, err := stackevents.Get(client, stackName, stack.ID, resourceName, eventID).Extract() - th.AssertNoErr(t, err) - t.Logf("retrieved event: %+v\n", event) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/stackresources_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/stackresources_test.go deleted file mode 100644 index b614f1cef5..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/stackresources_test.go +++ /dev/null @@ -1,62 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/openstack/orchestration/v1/stackresources" - "github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestStackResources(t *testing.T) { - // Create a provider client for making the HTTP requests. - // See common.go in this directory for more information. - client := newClient(t) - - stackName := "postman_stack_2" - - createOpts := stacks.CreateOpts{ - Name: stackName, - Template: template, - Timeout: 5, - } - stack, err := stacks.Create(client, createOpts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created stack: %+v\n", stack) - defer func() { - err := stacks.Delete(client, stackName, stack.ID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Deleted stack (%s)", stackName) - }() - err = gophercloud.WaitFor(60, func() (bool, error) { - getStack, err := stacks.Get(client, stackName, stack.ID).Extract() - if err != nil { - return false, err - } - if getStack.Status == "CREATE_COMPLETE" { - return true, nil - } - return false, nil - }) - - resourceName := "hello_world" - resource, err := stackresources.Get(client, stackName, stack.ID, resourceName).Extract() - th.AssertNoErr(t, err) - t.Logf("Got stack resource: %+v\n", resource) - - metadata, err := stackresources.Metadata(client, stackName, stack.ID, resourceName).Extract() - th.AssertNoErr(t, err) - t.Logf("Got stack resource metadata: %+v\n", metadata) - - err = stackresources.List(client, stackName, stack.ID, stackresources.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - resources, err := stackresources.ExtractResources(page) - th.AssertNoErr(t, err) - t.Logf("resources: %+v\n", resources) - return false, nil - }) - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/stacks_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/stacks_test.go deleted file mode 100644 index db31cd40ba..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/stacks_test.go +++ /dev/null @@ -1,153 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestStacks(t *testing.T) { - // Create a provider client for making the HTTP requests. - // See common.go in this directory for more information. - client := newClient(t) - - stackName1 := "gophercloud-test-stack-2" - createOpts := stacks.CreateOpts{ - Name: stackName1, - Template: template, - Timeout: 5, - } - stack, err := stacks.Create(client, createOpts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created stack: %+v\n", stack) - defer func() { - err := stacks.Delete(client, stackName1, stack.ID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Deleted stack (%s)", stackName1) - }() - err = gophercloud.WaitFor(60, func() (bool, error) { - getStack, err := stacks.Get(client, stackName1, stack.ID).Extract() - if err != nil { - return false, err - } - if getStack.Status == "CREATE_COMPLETE" { - return true, nil - } - return false, nil - }) - - updateOpts := stacks.UpdateOpts{ - Template: template, - Timeout: 20, - } - err = stacks.Update(client, stackName1, stack.ID, updateOpts).ExtractErr() - th.AssertNoErr(t, err) - err = gophercloud.WaitFor(60, func() (bool, error) { - getStack, err := stacks.Get(client, stackName1, stack.ID).Extract() - if err != nil { - return false, err - } - if getStack.Status == "UPDATE_COMPLETE" { - return true, nil - } - return false, nil - }) - - t.Logf("Updated stack") - - err = stacks.List(client, nil).EachPage(func(page pagination.Page) (bool, error) { - stackList, err := stacks.ExtractStacks(page) - th.AssertNoErr(t, err) - - t.Logf("Got stack list: %+v\n", stackList) - - return true, nil - }) - th.AssertNoErr(t, err) - - getStack, err := stacks.Get(client, stackName1, stack.ID).Extract() - th.AssertNoErr(t, err) - t.Logf("Got stack: %+v\n", getStack) - - abandonedStack, err := stacks.Abandon(client, stackName1, stack.ID).Extract() - th.AssertNoErr(t, err) - t.Logf("Abandonded stack %+v\n", abandonedStack) - th.AssertNoErr(t, err) -} - -// Test using the updated interface -func TestStacksNewTemplateFormat(t *testing.T) { - // Create a provider client for making the HTTP requests. - // See common.go in this directory for more information. - client := newClient(t) - - stackName1 := "gophercloud-test-stack-2" - templateOpts := new(osStacks.Template) - templateOpts.Bin = []byte(template) - createOpts := osStacks.CreateOpts{ - Name: stackName1, - TemplateOpts: templateOpts, - Timeout: 5, - } - stack, err := stacks.Create(client, createOpts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created stack: %+v\n", stack) - defer func() { - err := stacks.Delete(client, stackName1, stack.ID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Deleted stack (%s)", stackName1) - }() - err = gophercloud.WaitFor(60, func() (bool, error) { - getStack, err := stacks.Get(client, stackName1, stack.ID).Extract() - if err != nil { - return false, err - } - if getStack.Status == "CREATE_COMPLETE" { - return true, nil - } - return false, nil - }) - - updateOpts := osStacks.UpdateOpts{ - TemplateOpts: templateOpts, - Timeout: 20, - } - err = stacks.Update(client, stackName1, stack.ID, updateOpts).ExtractErr() - th.AssertNoErr(t, err) - err = gophercloud.WaitFor(60, func() (bool, error) { - getStack, err := stacks.Get(client, stackName1, stack.ID).Extract() - if err != nil { - return false, err - } - if getStack.Status == "UPDATE_COMPLETE" { - return true, nil - } - return false, nil - }) - - t.Logf("Updated stack") - - err = stacks.List(client, nil).EachPage(func(page pagination.Page) (bool, error) { - stackList, err := osStacks.ExtractStacks(page) - th.AssertNoErr(t, err) - - t.Logf("Got stack list: %+v\n", stackList) - - return true, nil - }) - th.AssertNoErr(t, err) - - getStack, err := stacks.Get(client, stackName1, stack.ID).Extract() - th.AssertNoErr(t, err) - t.Logf("Got stack: %+v\n", getStack) - - abandonedStack, err := stacks.Abandon(client, stackName1, stack.ID).Extract() - th.AssertNoErr(t, err) - t.Logf("Abandonded stack %+v\n", abandonedStack) - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/stacktemplates_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/stacktemplates_test.go deleted file mode 100644 index 22d5e8835f..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/openstack/orchestration/v1/stacktemplates_test.go +++ /dev/null @@ -1,75 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks" - "github.com/rackspace/gophercloud/openstack/orchestration/v1/stacktemplates" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestStackTemplates(t *testing.T) { - // Create a provider client for making the HTTP requests. - // See common.go in this directory for more information. - client := newClient(t) - - stackName := "postman_stack_2" - - createOpts := stacks.CreateOpts{ - Name: stackName, - Template: template, - Timeout: 5, - } - stack, err := stacks.Create(client, createOpts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created stack: %+v\n", stack) - defer func() { - err := stacks.Delete(client, stackName, stack.ID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Deleted stack (%s)", stackName) - }() - err = gophercloud.WaitFor(60, func() (bool, error) { - getStack, err := stacks.Get(client, stackName, stack.ID).Extract() - if err != nil { - return false, err - } - if getStack.Status == "CREATE_COMPLETE" { - return true, nil - } - return false, nil - }) - - tmpl, err := stacktemplates.Get(client, stackName, stack.ID).Extract() - th.AssertNoErr(t, err) - t.Logf("retrieved template: %+v\n", tmpl) - - validateOpts := osStacktemplates.ValidateOpts{ - Template: `{"heat_template_version": "2013-05-23", - "description": "Simple template to test heat commands", - "parameters": { - "flavor": { - "default": "m1.tiny", - "type": "string", - }, - }, - "resources": { - "hello_world": { - "type": "OS::Nova::Server", - "properties": { - "key_name": "heat_key", - "flavor": { - "get_param": "flavor", - }, - "image": "ad091b52-742f-469e-8f3c-fd81cadf0743", - "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n", - }, - }, - }, - }`} - validatedTemplate, err := stacktemplates.Validate(client, validateOpts).Extract() - th.AssertNoErr(t, err) - t.Logf("validated template: %+v\n", validatedTemplate) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/blockstorage/v1/snapshot_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/blockstorage/v1/snapshot_test.go deleted file mode 100644 index 25b2cfeeeb..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/blockstorage/v1/snapshot_test.go +++ /dev/null @@ -1,82 +0,0 @@ -// +build acceptance blockstorage snapshots - -package v1 - -import ( - "testing" - "time" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/blockstorage/v1/snapshots" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestSnapshots(t *testing.T) { - client := setup(t) - volID := testVolumeCreate(t, client) - - t.Log("Creating snapshots") - s := testSnapshotCreate(t, client, volID) - id := s.ID - - t.Log("Listing snapshots") - testSnapshotList(t, client) - - t.Logf("Getting snapshot %s", id) - testSnapshotGet(t, client, id) - - t.Logf("Updating snapshot %s", id) - testSnapshotUpdate(t, client, id) - - t.Logf("Deleting snapshot %s", id) - testSnapshotDelete(t, client, id) - s.WaitUntilDeleted(client, -1) - - t.Logf("Deleting volume %s", volID) - testVolumeDelete(t, client, volID) -} - -func testSnapshotCreate(t *testing.T, client *gophercloud.ServiceClient, volID string) *snapshots.Snapshot { - opts := snapshots.CreateOpts{VolumeID: volID, Name: "snapshot-001"} - s, err := snapshots.Create(client, opts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created snapshot %s", s.ID) - - t.Logf("Waiting for new snapshot to become available...") - start := time.Now().Second() - s.WaitUntilComplete(client, -1) - t.Logf("Snapshot completed after %ds", time.Now().Second()-start) - - return s -} - -func testSnapshotList(t *testing.T, client *gophercloud.ServiceClient) { - snapshots.List(client).EachPage(func(page pagination.Page) (bool, error) { - sList, err := snapshots.ExtractSnapshots(page) - th.AssertNoErr(t, err) - - for _, s := range sList { - t.Logf("Snapshot: ID [%s] Name [%s] Volume ID [%s] Progress [%s] Created [%s]", - s.ID, s.Name, s.VolumeID, s.Progress, s.CreatedAt) - } - - return true, nil - }) -} - -func testSnapshotGet(t *testing.T, client *gophercloud.ServiceClient, id string) { - _, err := snapshots.Get(client, id).Extract() - th.AssertNoErr(t, err) -} - -func testSnapshotUpdate(t *testing.T, client *gophercloud.ServiceClient, id string) { - _, err := snapshots.Update(client, id, snapshots.UpdateOpts{Name: "new_name"}).Extract() - th.AssertNoErr(t, err) -} - -func testSnapshotDelete(t *testing.T, client *gophercloud.ServiceClient, id string) { - res := snapshots.Delete(client, id) - th.AssertNoErr(t, res.Err) - t.Logf("Deleted snapshot %s", id) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/blockstorage/v1/volume_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/blockstorage/v1/volume_test.go deleted file mode 100644 index f86f9adedd..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/blockstorage/v1/volume_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// +build acceptance blockstorage volumes - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - os "github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/blockstorage/v1/volumes" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestVolumes(t *testing.T) { - client := setup(t) - - t.Logf("Listing volumes") - testVolumeList(t, client) - - t.Logf("Creating volume") - volumeID := testVolumeCreate(t, client) - - t.Logf("Getting volume %s", volumeID) - testVolumeGet(t, client, volumeID) - - t.Logf("Updating volume %s", volumeID) - testVolumeUpdate(t, client, volumeID) - - t.Logf("Deleting volume %s", volumeID) - testVolumeDelete(t, client, volumeID) -} - -func testVolumeList(t *testing.T, client *gophercloud.ServiceClient) { - volumes.List(client).EachPage(func(page pagination.Page) (bool, error) { - vList, err := volumes.ExtractVolumes(page) - th.AssertNoErr(t, err) - - for _, v := range vList { - t.Logf("Volume: ID [%s] Name [%s] Type [%s] Created [%s]", v.ID, v.Name, - v.VolumeType, v.CreatedAt) - } - - return true, nil - }) -} - -func testVolumeCreate(t *testing.T, client *gophercloud.ServiceClient) string { - vol, err := volumes.Create(client, os.CreateOpts{Size: 75}).Extract() - th.AssertNoErr(t, err) - t.Logf("Created volume: ID [%s] Size [%s]", vol.ID, vol.Size) - return vol.ID -} - -func testVolumeGet(t *testing.T, client *gophercloud.ServiceClient, id string) { - vol, err := volumes.Get(client, id).Extract() - th.AssertNoErr(t, err) - t.Logf("Created volume: ID [%s] Size [%s]", vol.ID, vol.Size) -} - -func testVolumeUpdate(t *testing.T, client *gophercloud.ServiceClient, id string) { - vol, err := volumes.Update(client, id, volumes.UpdateOpts{Name: "new_name"}).Extract() - th.AssertNoErr(t, err) - t.Logf("Created volume: ID [%s] Name [%s]", vol.ID, vol.Name) -} - -func testVolumeDelete(t *testing.T, client *gophercloud.ServiceClient, id string) { - res := volumes.Delete(client, id) - th.AssertNoErr(t, res.Err) - t.Logf("Deleted volume %s", id) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/blockstorage/v1/volume_type_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/blockstorage/v1/volume_type_test.go deleted file mode 100644 index 716f2b9fd5..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/blockstorage/v1/volume_type_test.go +++ /dev/null @@ -1,46 +0,0 @@ -// +build acceptance blockstorage volumetypes - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/blockstorage/v1/volumetypes" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestAll(t *testing.T) { - client := setup(t) - - t.Logf("Listing volume types") - id := testList(t, client) - - t.Logf("Getting volume type %s", id) - testGet(t, client, id) -} - -func testList(t *testing.T, client *gophercloud.ServiceClient) string { - var lastID string - - volumetypes.List(client).EachPage(func(page pagination.Page) (bool, error) { - typeList, err := volumetypes.ExtractVolumeTypes(page) - th.AssertNoErr(t, err) - - for _, vt := range typeList { - t.Logf("Volume type: ID [%s] Name [%s]", vt.ID, vt.Name) - lastID = vt.ID - } - - return true, nil - }) - - return lastID -} - -func testGet(t *testing.T, client *gophercloud.ServiceClient, id string) { - vt, err := volumetypes.Get(client, id).Extract() - th.AssertNoErr(t, err) - t.Logf("Volume: ID [%s] Name [%s]", vt.ID, vt.Name) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/cdn/v1/base_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/cdn/v1/base_test.go deleted file mode 100644 index 135f5b330a..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/cdn/v1/base_test.go +++ /dev/null @@ -1,32 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/rackspace/cdn/v1/base" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestBaseOps(t *testing.T) { - client := newClient(t) - t.Log("Retrieving Home Document") - testHomeDocumentGet(t, client) - - t.Log("Pinging root URL") - testPing(t, client) -} - -func testHomeDocumentGet(t *testing.T, client *gophercloud.ServiceClient) { - hd, err := base.Get(client).Extract() - th.AssertNoErr(t, err) - t.Logf("Retrieved home document: %+v", *hd) -} - -func testPing(t *testing.T, client *gophercloud.ServiceClient) { - err := base.Ping(client).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Successfully pinged root URL") -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/cdn/v1/flavor_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/cdn/v1/flavor_test.go deleted file mode 100644 index f26cff0140..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/cdn/v1/flavor_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - os "github.com/rackspace/gophercloud/openstack/cdn/v1/flavors" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/cdn/v1/flavors" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestFlavor(t *testing.T) { - client := newClient(t) - - t.Log("Listing Flavors") - id := testFlavorsList(t, client) - - t.Log("Retrieving Flavor") - testFlavorGet(t, client, id) -} - -func testFlavorsList(t *testing.T, client *gophercloud.ServiceClient) string { - var id string - err := flavors.List(client).EachPage(func(page pagination.Page) (bool, error) { - flavorList, err := os.ExtractFlavors(page) - th.AssertNoErr(t, err) - - for _, flavor := range flavorList { - t.Logf("Listing flavor: ID [%s] Providers [%+v]", flavor.ID, flavor.Providers) - id = flavor.ID - } - - return true, nil - }) - - th.AssertNoErr(t, err) - return id -} - -func testFlavorGet(t *testing.T, client *gophercloud.ServiceClient, id string) { - flavor, err := flavors.Get(client, id).Extract() - th.AssertNoErr(t, err) - t.Logf("Retrieved Flavor: %+v", *flavor) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/cdn/v1/service_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/cdn/v1/service_test.go deleted file mode 100644 index c19c241c36..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/cdn/v1/service_test.go +++ /dev/null @@ -1,93 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - os "github.com/rackspace/gophercloud/openstack/cdn/v1/services" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/cdn/v1/services" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestService(t *testing.T) { - client := newClient(t) - - t.Log("Creating Service") - loc := testServiceCreate(t, client, "test-site-1") - t.Logf("Created service at location: %s", loc) - - defer testServiceDelete(t, client, loc) - - t.Log("Updating Service") - testServiceUpdate(t, client, loc) - - t.Log("Retrieving Service") - testServiceGet(t, client, loc) - - t.Log("Listing Services") - testServiceList(t, client) -} - -func testServiceCreate(t *testing.T, client *gophercloud.ServiceClient, name string) string { - createOpts := os.CreateOpts{ - Name: name, - Domains: []os.Domain{ - os.Domain{ - Domain: "www." + name + ".com", - }, - }, - Origins: []os.Origin{ - os.Origin{ - Origin: name + ".com", - Port: 80, - SSL: false, - }, - }, - FlavorID: "cdn", - } - l, err := services.Create(client, createOpts).Extract() - th.AssertNoErr(t, err) - return l -} - -func testServiceGet(t *testing.T, client *gophercloud.ServiceClient, id string) { - s, err := services.Get(client, id).Extract() - th.AssertNoErr(t, err) - t.Logf("Retrieved service: %+v", *s) -} - -func testServiceUpdate(t *testing.T, client *gophercloud.ServiceClient, id string) { - opts := os.UpdateOpts{ - os.Append{ - Value: os.Domain{Domain: "newDomain.com", Protocol: "http"}, - }, - } - - loc, err := services.Update(client, id, opts).Extract() - th.AssertNoErr(t, err) - t.Logf("Successfully updated service at location: %s", loc) -} - -func testServiceList(t *testing.T, client *gophercloud.ServiceClient) { - err := services.List(client, nil).EachPage(func(page pagination.Page) (bool, error) { - serviceList, err := os.ExtractServices(page) - th.AssertNoErr(t, err) - - for _, service := range serviceList { - t.Logf("Listing service: %+v", service) - } - - return true, nil - }) - - th.AssertNoErr(t, err) -} - -func testServiceDelete(t *testing.T, client *gophercloud.ServiceClient, id string) { - err := services.Delete(client, id).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Successfully deleted service (%s)", id) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/cdn/v1/serviceasset_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/cdn/v1/serviceasset_test.go deleted file mode 100644 index c32bf253da..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/cdn/v1/serviceasset_test.go +++ /dev/null @@ -1,32 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - osServiceAssets "github.com/rackspace/gophercloud/openstack/cdn/v1/serviceassets" - "github.com/rackspace/gophercloud/rackspace/cdn/v1/serviceassets" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestServiceAsset(t *testing.T) { - client := newClient(t) - - t.Log("Creating Service") - loc := testServiceCreate(t, client, "test-site-2") - t.Logf("Created service at location: %s", loc) - - t.Log("Deleting Service Assets") - testServiceAssetDelete(t, client, loc) -} - -func testServiceAssetDelete(t *testing.T, client *gophercloud.ServiceClient, url string) { - deleteOpts := osServiceAssets.DeleteOpts{ - All: true, - } - err := serviceassets.Delete(client, url, deleteOpts).ExtractErr() - th.AssertNoErr(t, err) - t.Log("Successfully deleted all Service Assets") -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/client_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/client_test.go deleted file mode 100644 index 61214c047a..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/client_test.go +++ /dev/null @@ -1,28 +0,0 @@ -// +build acceptance - -package rackspace - -import ( - "testing" - - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/rackspace" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestAuthenticatedClient(t *testing.T) { - // Obtain credentials from the environment. - ao, err := rackspace.AuthOptionsFromEnv() - th.AssertNoErr(t, err) - - client, err := rackspace.AuthenticatedClient(tools.OnlyRS(ao)) - if err != nil { - t.Fatalf("Unable to authenticate: %v", err) - } - - if client.TokenID == "" { - t.Errorf("No token ID assigned to the client") - } - - t.Logf("Client successfully acquired a token: %v", client.TokenID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/bootfromvolume_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/bootfromvolume_test.go deleted file mode 100644 index d7e6aa712c..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/bootfromvolume_test.go +++ /dev/null @@ -1,49 +0,0 @@ -// +build acceptance - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud/acceptance/tools" - osBFV "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume" - "github.com/rackspace/gophercloud/rackspace/compute/v2/bootfromvolume" - "github.com/rackspace/gophercloud/rackspace/compute/v2/servers" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestBootFromVolume(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - if testing.Short() { - t.Skip("Skipping test that requires server creation in short mode.") - } - - options, err := optionsFromEnv() - th.AssertNoErr(t, err) - - name := tools.RandomString("Gophercloud-", 8) - t.Logf("Creating server [%s].", name) - - bd := []osBFV.BlockDevice{ - osBFV.BlockDevice{ - UUID: options.imageID, - SourceType: osBFV.Image, - VolumeSize: 10, - }, - } - - server, err := bootfromvolume.Create(client, servers.CreateOpts{ - Name: name, - FlavorRef: "performance1-1", - BlockDevice: bd, - }).Extract() - th.AssertNoErr(t, err) - t.Logf("Created server: %+v\n", server) - defer deleteServer(t, client, server) - - getServer(t, client, server) - - listServers(t, client) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/compute_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/compute_test.go deleted file mode 100644 index 3ca6dc9b6c..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/compute_test.go +++ /dev/null @@ -1,60 +0,0 @@ -// +build acceptance - -package v2 - -import ( - "errors" - "os" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/rackspace" -) - -func newClient() (*gophercloud.ServiceClient, error) { - // Obtain credentials from the environment. - options, err := rackspace.AuthOptionsFromEnv() - if err != nil { - return nil, err - } - options = tools.OnlyRS(options) - region := os.Getenv("RS_REGION") - - if options.Username == "" { - return nil, errors.New("Please provide a Rackspace username as RS_USERNAME.") - } - if options.APIKey == "" { - return nil, errors.New("Please provide a Rackspace API key as RS_API_KEY.") - } - if region == "" { - return nil, errors.New("Please provide a Rackspace region as RS_REGION.") - } - - client, err := rackspace.AuthenticatedClient(options) - if err != nil { - return nil, err - } - - return rackspace.NewComputeV2(client, gophercloud.EndpointOpts{ - Region: region, - }) -} - -type serverOpts struct { - imageID string - flavorID string -} - -func optionsFromEnv() (*serverOpts, error) { - options := &serverOpts{ - imageID: os.Getenv("RS_IMAGE_ID"), - flavorID: os.Getenv("RS_FLAVOR_ID"), - } - if options.imageID == "" { - return nil, errors.New("Please provide a valid Rackspace image ID as RS_IMAGE_ID") - } - if options.flavorID == "" { - return nil, errors.New("Please provide a valid Rackspace flavor ID as RS_FLAVOR_ID") - } - return options, nil -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/flavors_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/flavors_test.go deleted file mode 100644 index 4618ecc8a9..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/flavors_test.go +++ /dev/null @@ -1,61 +0,0 @@ -// +build acceptance - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/compute/v2/flavors" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestListFlavors(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - count := 0 - err = flavors.ListDetail(client, nil).EachPage(func(page pagination.Page) (bool, error) { - count++ - t.Logf("-- Page %0d --", count) - - fs, err := flavors.ExtractFlavors(page) - th.AssertNoErr(t, err) - - for i, flavor := range fs { - t.Logf("[%02d] id=[%s]", i, flavor.ID) - t.Logf(" name=[%s]", flavor.Name) - t.Logf(" disk=[%d]", flavor.Disk) - t.Logf(" RAM=[%d]", flavor.RAM) - t.Logf(" rxtx_factor=[%f]", flavor.RxTxFactor) - t.Logf(" swap=[%d]", flavor.Swap) - t.Logf(" VCPUs=[%d]", flavor.VCPUs) - } - - return true, nil - }) - th.AssertNoErr(t, err) - if count == 0 { - t.Errorf("No flavors listed!") - } -} - -func TestGetFlavor(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - options, err := optionsFromEnv() - th.AssertNoErr(t, err) - - flavor, err := flavors.Get(client, options.flavorID).Extract() - th.AssertNoErr(t, err) - - t.Logf("Requested flavor:") - t.Logf(" id=[%s]", flavor.ID) - t.Logf(" name=[%s]", flavor.Name) - t.Logf(" disk=[%d]", flavor.Disk) - t.Logf(" RAM=[%d]", flavor.RAM) - t.Logf(" rxtx_factor=[%f]", flavor.RxTxFactor) - t.Logf(" swap=[%d]", flavor.Swap) - t.Logf(" VCPUs=[%d]", flavor.VCPUs) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/images_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/images_test.go deleted file mode 100644 index 5e36c2e454..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/images_test.go +++ /dev/null @@ -1,63 +0,0 @@ -// +build acceptance - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/compute/v2/images" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestListImages(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - count := 0 - err = images.ListDetail(client, nil).EachPage(func(page pagination.Page) (bool, error) { - count++ - t.Logf("-- Page %02d --", count) - - is, err := images.ExtractImages(page) - th.AssertNoErr(t, err) - - for i, image := range is { - t.Logf("[%02d] id=[%s]", i, image.ID) - t.Logf(" name=[%s]", image.Name) - t.Logf(" created=[%s]", image.Created) - t.Logf(" updated=[%s]", image.Updated) - t.Logf(" min disk=[%d]", image.MinDisk) - t.Logf(" min RAM=[%d]", image.MinRAM) - t.Logf(" progress=[%d]", image.Progress) - t.Logf(" status=[%s]", image.Status) - } - - return true, nil - }) - th.AssertNoErr(t, err) - if count < 1 { - t.Errorf("Expected at least one page of images.") - } -} - -func TestGetImage(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - options, err := optionsFromEnv() - th.AssertNoErr(t, err) - - image, err := images.Get(client, options.imageID).Extract() - th.AssertNoErr(t, err) - - t.Logf("Requested image:") - t.Logf(" id=[%s]", image.ID) - t.Logf(" name=[%s]", image.Name) - t.Logf(" created=[%s]", image.Created) - t.Logf(" updated=[%s]", image.Updated) - t.Logf(" min disk=[%d]", image.MinDisk) - t.Logf(" min RAM=[%d]", image.MinRAM) - t.Logf(" progress=[%d]", image.Progress) - t.Logf(" status=[%s]", image.Status) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/keypairs_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/keypairs_test.go deleted file mode 100644 index 9bd6eb4284..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/keypairs_test.go +++ /dev/null @@ -1,87 +0,0 @@ -// +build acceptance rackspace - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - os "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/keypairs" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/compute/v2/keypairs" - th "github.com/rackspace/gophercloud/testhelper" -) - -func deleteKeyPair(t *testing.T, client *gophercloud.ServiceClient, name string) { - err := keypairs.Delete(client, name).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Successfully deleted key [%s].", name) -} - -func TestCreateKeyPair(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - name := tools.RandomString("createdkey-", 8) - k, err := keypairs.Create(client, os.CreateOpts{Name: name}).Extract() - th.AssertNoErr(t, err) - defer deleteKeyPair(t, client, name) - - t.Logf("Created a new keypair:") - t.Logf(" name=[%s]", k.Name) - t.Logf(" fingerprint=[%s]", k.Fingerprint) - t.Logf(" publickey=[%s]", tools.Elide(k.PublicKey)) - t.Logf(" privatekey=[%s]", tools.Elide(k.PrivateKey)) - t.Logf(" userid=[%s]", k.UserID) -} - -func TestImportKeyPair(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - name := tools.RandomString("importedkey-", 8) - pubkey := "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDlIQ3r+zd97kb9Hzmujd3V6pbO53eb3Go4q2E8iqVGWQfZTrFdL9KACJnqJIm9HmncfRkUTxE37hqeGCCv8uD+ZPmPiZG2E60OX1mGDjbbzAyReRwYWXgXHopggZTLak5k4mwZYaxwaufbVBDRn847e01lZnaXaszEToLM37NLw+uz29sl3TwYy2R0RGHPwPc160aWmdLjSyd1Nd4c9pvvOP/EoEuBjIC6NJJwg2Rvg9sjjx9jYj0QUgc8CqKLN25oMZ69kNJzlFylKRUoeeVr89txlR59yehJWk6Uw6lYFTdJmcmQOFVAJ12RMmS1hLWCM8UzAgtw+EDa0eqBxBDl smash@winter" - - k, err := keypairs.Create(client, os.CreateOpts{ - Name: name, - PublicKey: pubkey, - }).Extract() - th.AssertNoErr(t, err) - defer deleteKeyPair(t, client, name) - - th.CheckEquals(t, pubkey, k.PublicKey) - th.CheckEquals(t, "", k.PrivateKey) - - t.Logf("Imported an existing keypair:") - t.Logf(" name=[%s]", k.Name) - t.Logf(" fingerprint=[%s]", k.Fingerprint) - t.Logf(" publickey=[%s]", tools.Elide(k.PublicKey)) - t.Logf(" privatekey=[%s]", tools.Elide(k.PrivateKey)) - t.Logf(" userid=[%s]", k.UserID) -} - -func TestListKeyPairs(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - count := 0 - err = keypairs.List(client).EachPage(func(page pagination.Page) (bool, error) { - count++ - t.Logf("--- %02d ---", count) - - ks, err := keypairs.ExtractKeyPairs(page) - th.AssertNoErr(t, err) - - for i, keypair := range ks { - t.Logf("[%02d] name=[%s]", i, keypair.Name) - t.Logf(" fingerprint=[%s]", keypair.Fingerprint) - t.Logf(" publickey=[%s]", tools.Elide(keypair.PublicKey)) - t.Logf(" privatekey=[%s]", tools.Elide(keypair.PrivateKey)) - t.Logf(" userid=[%s]", keypair.UserID) - } - - return true, nil - }) - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/networks_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/networks_test.go deleted file mode 100644 index e8fc4d37df..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/networks_test.go +++ /dev/null @@ -1,53 +0,0 @@ -// +build acceptance rackspace - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/compute/v2/networks" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestNetworks(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - // Create a network - n, err := networks.Create(client, networks.CreateOpts{Label: "sample_network", CIDR: "172.20.0.0/24"}).Extract() - th.AssertNoErr(t, err) - t.Logf("Created network: %+v\n", n) - defer networks.Delete(client, n.ID) - th.AssertEquals(t, n.Label, "sample_network") - th.AssertEquals(t, n.CIDR, "172.20.0.0/24") - networkID := n.ID - - // List networks - pager := networks.List(client) - err = pager.EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page ---") - - networkList, err := networks.ExtractNetworks(page) - th.AssertNoErr(t, err) - - for _, n := range networkList { - t.Logf("Network: ID [%s] Label [%s] CIDR [%s]", - n.ID, n.Label, n.CIDR) - } - - return true, nil - }) - th.CheckNoErr(t, err) - - // Get a network - if networkID == "" { - t.Fatalf("In order to retrieve a network, the NetworkID must be set") - } - n, err = networks.Get(client, networkID).Extract() - t.Logf("Retrieved Network: %+v\n", n) - th.AssertNoErr(t, err) - th.AssertEquals(t, n.CIDR, "172.20.0.0/24") - th.AssertEquals(t, n.Label, "sample_network") - th.AssertEquals(t, n.ID, networkID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/servers_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/servers_test.go deleted file mode 100644 index a8b5937b6e..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/servers_test.go +++ /dev/null @@ -1,217 +0,0 @@ -// +build acceptance - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/diskconfig" - oskey "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/keypairs" - os "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/compute/v2/keypairs" - "github.com/rackspace/gophercloud/rackspace/compute/v2/servers" - th "github.com/rackspace/gophercloud/testhelper" -) - -func createServerKeyPair(t *testing.T, client *gophercloud.ServiceClient) *oskey.KeyPair { - name := tools.RandomString("importedkey-", 8) - pubkey := "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDlIQ3r+zd97kb9Hzmujd3V6pbO53eb3Go4q2E8iqVGWQfZTrFdL9KACJnqJIm9HmncfRkUTxE37hqeGCCv8uD+ZPmPiZG2E60OX1mGDjbbzAyReRwYWXgXHopggZTLak5k4mwZYaxwaufbVBDRn847e01lZnaXaszEToLM37NLw+uz29sl3TwYy2R0RGHPwPc160aWmdLjSyd1Nd4c9pvvOP/EoEuBjIC6NJJwg2Rvg9sjjx9jYj0QUgc8CqKLN25oMZ69kNJzlFylKRUoeeVr89txlR59yehJWk6Uw6lYFTdJmcmQOFVAJ12RMmS1hLWCM8UzAgtw+EDa0eqBxBDl smash@winter" - - k, err := keypairs.Create(client, oskey.CreateOpts{ - Name: name, - PublicKey: pubkey, - }).Extract() - th.AssertNoErr(t, err) - - return k -} - -func createServer(t *testing.T, client *gophercloud.ServiceClient, keyName string) *os.Server { - if testing.Short() { - t.Skip("Skipping test that requires server creation in short mode.") - } - - options, err := optionsFromEnv() - th.AssertNoErr(t, err) - - name := tools.RandomString("Gophercloud-", 8) - - pwd := tools.MakeNewPassword("") - - opts := &servers.CreateOpts{ - Name: name, - ImageRef: options.imageID, - FlavorRef: options.flavorID, - DiskConfig: diskconfig.Manual, - AdminPass: pwd, - } - - if keyName != "" { - opts.KeyPair = keyName - } - - t.Logf("Creating server [%s].", name) - s, err := servers.Create(client, opts).Extract() - th.AssertNoErr(t, err) - t.Logf("Creating server.") - - err = servers.WaitForStatus(client, s.ID, "ACTIVE", 300) - th.AssertNoErr(t, err) - t.Logf("Server created successfully.") - - th.CheckEquals(t, pwd, s.AdminPass) - - return s -} - -func logServer(t *testing.T, server *os.Server, index int) { - if index == -1 { - t.Logf(" id=[%s]", server.ID) - } else { - t.Logf("[%02d] id=[%s]", index, server.ID) - } - t.Logf(" name=[%s]", server.Name) - t.Logf(" tenant ID=[%s]", server.TenantID) - t.Logf(" user ID=[%s]", server.UserID) - t.Logf(" updated=[%s]", server.Updated) - t.Logf(" created=[%s]", server.Created) - t.Logf(" host ID=[%s]", server.HostID) - t.Logf(" access IPv4=[%s]", server.AccessIPv4) - t.Logf(" access IPv6=[%s]", server.AccessIPv6) - t.Logf(" image=[%v]", server.Image) - t.Logf(" flavor=[%v]", server.Flavor) - t.Logf(" addresses=[%v]", server.Addresses) - t.Logf(" metadata=[%v]", server.Metadata) - t.Logf(" links=[%v]", server.Links) - t.Logf(" keyname=[%s]", server.KeyName) - t.Logf(" admin password=[%s]", server.AdminPass) - t.Logf(" status=[%s]", server.Status) - t.Logf(" progress=[%d]", server.Progress) -} - -func getServer(t *testing.T, client *gophercloud.ServiceClient, server *os.Server) { - t.Logf("> servers.Get") - - details, err := servers.Get(client, server.ID).Extract() - th.AssertNoErr(t, err) - logServer(t, details, -1) -} - -func updateServer(t *testing.T, client *gophercloud.ServiceClient, server *os.Server) { - t.Logf("> servers.Get") - - opts := os.UpdateOpts{ - Name: "updated-server", - } - updatedServer, err := servers.Update(client, server.ID, opts).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, "updated-server", updatedServer.Name) - logServer(t, updatedServer, -1) -} - -func listServers(t *testing.T, client *gophercloud.ServiceClient) { - t.Logf("> servers.List") - - count := 0 - err := servers.List(client, nil).EachPage(func(page pagination.Page) (bool, error) { - count++ - t.Logf("--- Page %02d ---", count) - - s, err := servers.ExtractServers(page) - th.AssertNoErr(t, err) - for index, server := range s { - logServer(t, &server, index) - } - - return true, nil - }) - th.AssertNoErr(t, err) -} - -func changeAdminPassword(t *testing.T, client *gophercloud.ServiceClient, server *os.Server) { - t.Logf("> servers.ChangeAdminPassword") - - original := server.AdminPass - - t.Logf("Changing server password.") - err := servers.ChangeAdminPassword(client, server.ID, tools.MakeNewPassword(original)).ExtractErr() - th.AssertNoErr(t, err) - - err = servers.WaitForStatus(client, server.ID, "ACTIVE", 300) - th.AssertNoErr(t, err) - t.Logf("Password changed successfully.") -} - -func rebootServer(t *testing.T, client *gophercloud.ServiceClient, server *os.Server) { - t.Logf("> servers.Reboot") - - err := servers.Reboot(client, server.ID, os.HardReboot).ExtractErr() - th.AssertNoErr(t, err) - - err = servers.WaitForStatus(client, server.ID, "ACTIVE", 300) - th.AssertNoErr(t, err) - - t.Logf("Server successfully rebooted.") -} - -func rebuildServer(t *testing.T, client *gophercloud.ServiceClient, server *os.Server) { - t.Logf("> servers.Rebuild") - - options, err := optionsFromEnv() - th.AssertNoErr(t, err) - - opts := servers.RebuildOpts{ - Name: tools.RandomString("RenamedGopher", 16), - AdminPass: tools.MakeNewPassword(server.AdminPass), - ImageID: options.imageID, - DiskConfig: diskconfig.Manual, - } - after, err := servers.Rebuild(client, server.ID, opts).Extract() - th.AssertNoErr(t, err) - th.CheckEquals(t, after.ID, server.ID) - - err = servers.WaitForStatus(client, after.ID, "ACTIVE", 300) - th.AssertNoErr(t, err) - - t.Logf("Server successfully rebuilt.") - logServer(t, after, -1) -} - -func deleteServer(t *testing.T, client *gophercloud.ServiceClient, server *os.Server) { - t.Logf("> servers.Delete") - - res := servers.Delete(client, server.ID) - th.AssertNoErr(t, res.Err) - - t.Logf("Server deleted successfully.") -} - -func deleteServerKeyPair(t *testing.T, client *gophercloud.ServiceClient, k *oskey.KeyPair) { - t.Logf("> keypairs.Delete") - - err := keypairs.Delete(client, k.Name).ExtractErr() - th.AssertNoErr(t, err) - - t.Logf("Keypair deleted successfully.") -} - -func TestServerOperations(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - kp := createServerKeyPair(t, client) - defer deleteServerKeyPair(t, client, kp) - - server := createServer(t, client, kp.Name) - defer deleteServer(t, client, server) - - getServer(t, client, server) - updateServer(t, client, server) - listServers(t, client) - changeAdminPassword(t, client, server) - rebootServer(t, client, server) - rebuildServer(t, client, server) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/virtualinterfaces_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/virtualinterfaces_test.go deleted file mode 100644 index 39475e176e..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/virtualinterfaces_test.go +++ /dev/null @@ -1,53 +0,0 @@ -// +build acceptance rackspace - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/compute/v2/networks" - "github.com/rackspace/gophercloud/rackspace/compute/v2/virtualinterfaces" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestVirtualInterfaces(t *testing.T) { - client, err := newClient() - th.AssertNoErr(t, err) - - // Create a server - server := createServer(t, client, "") - t.Logf("Created Server: %v\n", server) - defer deleteServer(t, client, server) - serverID := server.ID - - // Create a network - n, err := networks.Create(client, networks.CreateOpts{Label: "sample_network", CIDR: "172.20.0.0/24"}).Extract() - th.AssertNoErr(t, err) - t.Logf("Created Network: %v\n", n) - defer networks.Delete(client, n.ID) - networkID := n.ID - - // Create a virtual interface - vi, err := virtualinterfaces.Create(client, serverID, networkID).Extract() - th.AssertNoErr(t, err) - t.Logf("Created virtual interface: %+v\n", vi) - defer virtualinterfaces.Delete(client, serverID, vi.ID) - - // List virtual interfaces - pager := virtualinterfaces.List(client, serverID) - err = pager.EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page ---") - - virtualinterfacesList, err := virtualinterfaces.ExtractVirtualInterfaces(page) - th.AssertNoErr(t, err) - - for _, vi := range virtualinterfacesList { - t.Logf("Virtual Interface: ID [%s] MAC Address [%s] IP Addresses [%v]", - vi.ID, vi.MACAddress, vi.IPAddresses) - } - - return true, nil - }) - th.CheckNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/volumeattach_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/volumeattach_test.go deleted file mode 100644 index 9848e2eba5..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/volumeattach_test.go +++ /dev/null @@ -1,130 +0,0 @@ -// +build acceptance compute servers - -package v2 - -import ( - "os" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/openstack" - osVolumes "github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes" - osVolumeAttach "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/volumeattach" - osServers "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - "github.com/rackspace/gophercloud/rackspace" - "github.com/rackspace/gophercloud/rackspace/blockstorage/v1/volumes" - "github.com/rackspace/gophercloud/rackspace/compute/v2/servers" - "github.com/rackspace/gophercloud/rackspace/compute/v2/volumeattach" - th "github.com/rackspace/gophercloud/testhelper" -) - -func newBlockClient(t *testing.T) (*gophercloud.ServiceClient, error) { - ao, err := rackspace.AuthOptionsFromEnv() - th.AssertNoErr(t, err) - - client, err := rackspace.AuthenticatedClient(ao) - th.AssertNoErr(t, err) - - return openstack.NewBlockStorageV1(client, gophercloud.EndpointOpts{ - Region: os.Getenv("RS_REGION_NAME"), - }) -} - -func createVAServer(t *testing.T, computeClient *gophercloud.ServiceClient, choices *serverOpts) (*osServers.Server, error) { - if testing.Short() { - t.Skip("Skipping test that requires server creation in short mode.") - } - - name := tools.RandomString("ACPTTEST", 16) - t.Logf("Attempting to create server: %s\n", name) - - pwd := tools.MakeNewPassword("") - - server, err := servers.Create(computeClient, osServers.CreateOpts{ - Name: name, - FlavorRef: choices.flavorID, - ImageRef: choices.imageID, - AdminPass: pwd, - }).Extract() - if err != nil { - t.Fatalf("Unable to create server: %v", err) - } - - th.AssertEquals(t, pwd, server.AdminPass) - - return server, err -} - -func createVAVolume(t *testing.T, blockClient *gophercloud.ServiceClient) (*volumes.Volume, error) { - volume, err := volumes.Create(blockClient, &osVolumes.CreateOpts{ - Size: 80, - Name: "gophercloud-test-volume", - }).Extract() - th.AssertNoErr(t, err) - defer func() { - err = osVolumes.WaitForStatus(blockClient, volume.ID, "available", 60) - th.AssertNoErr(t, err) - }() - - return volume, err -} - -func createVolumeAttachment(t *testing.T, computeClient *gophercloud.ServiceClient, blockClient *gophercloud.ServiceClient, serverID string, volumeID string) { - va, err := volumeattach.Create(computeClient, serverID, &osVolumeAttach.CreateOpts{ - VolumeID: volumeID, - }).Extract() - th.AssertNoErr(t, err) - defer func() { - err = osVolumes.WaitForStatus(blockClient, volumeID, "in-use", 60) - th.AssertNoErr(t, err) - err = volumeattach.Delete(computeClient, serverID, va.ID).ExtractErr() - th.AssertNoErr(t, err) - err = osVolumes.WaitForStatus(blockClient, volumeID, "available", 60) - th.AssertNoErr(t, err) - }() - t.Logf("Attached volume to server: %+v", va) -} - -func TestAttachVolume(t *testing.T) { - choices, err := optionsFromEnv() - if err != nil { - t.Fatal(err) - } - - computeClient, err := newClient() - if err != nil { - t.Fatalf("Unable to create a compute client: %v", err) - } - - blockClient, err := newBlockClient(t) - if err != nil { - t.Fatalf("Unable to create a blockstorage client: %v", err) - } - - server, err := createVAServer(t, computeClient, choices) - if err != nil { - t.Fatalf("Unable to create server: %v", err) - } - defer func() { - servers.Delete(computeClient, server.ID) - t.Logf("Server deleted.") - }() - - if err = osServers.WaitForStatus(computeClient, server.ID, "ACTIVE", 300); err != nil { - t.Fatalf("Unable to wait for server: %v", err) - } - - volume, err := createVAVolume(t, blockClient) - if err != nil { - t.Fatalf("Unable to create volume: %v", err) - } - defer func() { - err = volumes.Delete(blockClient, volume.ID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Volume deleted.") - }() - - createVolumeAttachment(t, computeClient, blockClient, server.ID, volume.ID) - -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/backup_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/backup_test.go deleted file mode 100644 index 522aaceb13..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/backup_test.go +++ /dev/null @@ -1,84 +0,0 @@ -// +build acceptance db rackspace - -package v1 - -import ( - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/pagination" - - "github.com/rackspace/gophercloud/rackspace/db/v1/backups" - "github.com/rackspace/gophercloud/rackspace/db/v1/instances" -) - -func (c *context) createBackup() { - opts := backups.CreateOpts{ - Name: tools.RandomString("backup_", 5), - InstanceID: c.instanceID, - } - - backup, err := backups.Create(c.client, opts).Extract() - - c.Logf("Created backup %#v", backup) - c.AssertNoErr(err) - - err = gophercloud.WaitFor(60, func() (bool, error) { - b, err := backups.Get(c.client, backup.ID).Extract() - if err != nil { - return false, err - } - if b.Status == "COMPLETED" { - return true, nil - } - return false, nil - }) - c.AssertNoErr(err) - - c.backupID = backup.ID -} - -func (c *context) getBackup() { - backup, err := backups.Get(c.client, c.backupID).Extract() - c.AssertNoErr(err) - c.Logf("Getting backup %s", backup.ID) -} - -func (c *context) listAllBackups() { - c.Logf("Listing backups") - - err := backups.List(c.client, nil).EachPage(func(page pagination.Page) (bool, error) { - backupList, err := backups.ExtractBackups(page) - c.AssertNoErr(err) - - for _, b := range backupList { - c.Logf("Backup: %#v", b) - } - - return true, nil - }) - - c.AssertNoErr(err) -} - -func (c *context) listInstanceBackups() { - c.Logf("Listing backups for instance %s", c.instanceID) - - err := instances.ListBackups(c.client, c.instanceID).EachPage(func(page pagination.Page) (bool, error) { - backupList, err := backups.ExtractBackups(page) - c.AssertNoErr(err) - - for _, b := range backupList { - c.Logf("Backup: %#v", b) - } - - return true, nil - }) - - c.AssertNoErr(err) -} - -func (c *context) deleteBackup() { - err := backups.Delete(c.client, c.backupID).ExtractErr() - c.AssertNoErr(err) - c.Logf("Deleted backup %s", c.backupID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/config_group_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/config_group_test.go deleted file mode 100644 index 81bd40abcf..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/config_group_test.go +++ /dev/null @@ -1,93 +0,0 @@ -// +build acceptance db rackspace - -package v1 - -import ( - "github.com/rackspace/gophercloud/acceptance/tools" - os "github.com/rackspace/gophercloud/openstack/db/v1/configurations" - "github.com/rackspace/gophercloud/pagination" - config "github.com/rackspace/gophercloud/rackspace/db/v1/configurations" - "github.com/rackspace/gophercloud/rackspace/db/v1/instances" -) - -func (c *context) createConfigGrp() { - opts := os.CreateOpts{ - Name: tools.RandomString("config_", 5), - Values: map[string]interface{}{ - "connect_timeout": 300, - "join_buffer_size": 900000, - }, - } - - cg, err := config.Create(c.client, opts).Extract() - - c.AssertNoErr(err) - c.Logf("Created config group %#v", cg) - - c.configGroupID = cg.ID -} - -func (c *context) getConfigGrp() { - cg, err := config.Get(c.client, c.configGroupID).Extract() - c.Logf("Getting config group: %#v", cg) - c.AssertNoErr(err) -} - -func (c *context) updateConfigGrp() { - opts := os.UpdateOpts{ - Name: tools.RandomString("new_name_", 5), - Values: map[string]interface{}{ - "connect_timeout": 250, - }, - } - err := config.Update(c.client, c.configGroupID, opts).ExtractErr() - c.Logf("Updated config group %s", c.configGroupID) - c.AssertNoErr(err) -} - -func (c *context) replaceConfigGrp() { - opts := os.UpdateOpts{ - Values: map[string]interface{}{ - "big_tables": 1, - }, - } - - err := config.Replace(c.client, c.configGroupID, opts).ExtractErr() - c.Logf("Replaced values for config group %s", c.configGroupID) - c.AssertNoErr(err) -} - -func (c *context) associateInstanceWithConfigGrp() { - err := instances.AssociateWithConfigGroup(c.client, c.instanceID, c.configGroupID).ExtractErr() - c.Logf("Associated instance %s with config group %s", c.instanceID, c.configGroupID) - c.AssertNoErr(err) -} - -func (c *context) listConfigGrpInstances() { - c.Logf("Listing all instances associated with config group %s", c.configGroupID) - - err := config.ListInstances(c.client, c.configGroupID).EachPage(func(page pagination.Page) (bool, error) { - instanceList, err := instances.ExtractInstances(page) - c.AssertNoErr(err) - - for _, instance := range instanceList { - c.Logf("Instance: %#v", instance) - } - - return true, nil - }) - - c.AssertNoErr(err) -} - -func (c *context) deleteConfigGrp() { - err := config.Delete(c.client, c.configGroupID).ExtractErr() - c.Logf("Deleted config group %s", c.configGroupID) - c.AssertNoErr(err) -} - -func (c *context) detachInstanceFromGrp() { - err := instances.DetachFromConfigGroup(c.client, c.instanceID).ExtractErr() - c.Logf("Detached instance %s from config groups", c.instanceID) - c.AssertNoErr(err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/database_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/database_test.go deleted file mode 100644 index d5c448f6e9..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/database_test.go +++ /dev/null @@ -1,54 +0,0 @@ -// +build acceptance db rackspace - -package v1 - -import ( - "github.com/rackspace/gophercloud/acceptance/tools" - db "github.com/rackspace/gophercloud/openstack/db/v1/databases" - "github.com/rackspace/gophercloud/pagination" -) - -func (c *context) createDBs() { - dbs := []string{ - tools.RandomString("db_", 5), - tools.RandomString("db_", 5), - tools.RandomString("db_", 5), - } - - opts := db.BatchCreateOpts{ - db.CreateOpts{Name: dbs[0]}, - db.CreateOpts{Name: dbs[1]}, - db.CreateOpts{Name: dbs[2]}, - } - - err := db.Create(c.client, c.instanceID, opts).ExtractErr() - c.Logf("Created three databases on instance %s: %s, %s, %s", c.instanceID, dbs[0], dbs[1], dbs[2]) - c.AssertNoErr(err) - - c.DBIDs = dbs -} - -func (c *context) listDBs() { - c.Logf("Listing databases on instance %s", c.instanceID) - - err := db.List(c.client, c.instanceID).EachPage(func(page pagination.Page) (bool, error) { - dbList, err := db.ExtractDBs(page) - c.AssertNoErr(err) - - for _, db := range dbList { - c.Logf("DB: %#v", db) - } - - return true, nil - }) - - c.AssertNoErr(err) -} - -func (c *context) deleteDBs() { - for _, id := range c.DBIDs { - err := db.Delete(c.client, c.instanceID, id).ExtractErr() - c.AssertNoErr(err) - c.Logf("Deleted DB %s", id) - } -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/flavor_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/flavor_test.go deleted file mode 100644 index 0d6e6df617..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/flavor_test.go +++ /dev/null @@ -1,32 +0,0 @@ -// +build acceptance db rackspace - -package v1 - -import ( - os "github.com/rackspace/gophercloud/openstack/db/v1/flavors" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/db/v1/flavors" -) - -func (c context) listFlavors() { - c.Logf("Listing flavors") - - err := flavors.List(c.client).EachPage(func(page pagination.Page) (bool, error) { - flavorList, err := os.ExtractFlavors(page) - c.AssertNoErr(err) - - for _, f := range flavorList { - c.Logf("Flavor: ID [%s] Name [%s] RAM [%d]", f.ID, f.Name, f.RAM) - } - - return true, nil - }) - - c.AssertNoErr(err) -} - -func (c context) getFlavor() { - flavor, err := flavors.Get(c.client, "1").Extract() - c.Logf("Getting flavor %s", flavor.ID) - c.AssertNoErr(err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/instance_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/instance_test.go deleted file mode 100644 index b5540e3bb0..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/instance_test.go +++ /dev/null @@ -1,169 +0,0 @@ -// +build acceptance db rackspace - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/db/v1/instances" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestRunner(t *testing.T) { - c := newContext(t) - - // FLAVOR tests - c.listFlavors() - c.getFlavor() - - // INSTANCE tests - c.createInstance() - c.listInstances() - c.getInstance() - c.isRootEnabled() - c.enableRootUser() - c.isRootEnabled() - c.restartInstance() - c.resizeInstance() - c.resizeVol() - c.getDefaultConfig() - - // REPLICA tests - c.createReplica() - c.detachReplica() - - // BACKUP tests - c.createBackup() - c.getBackup() - c.listAllBackups() - c.listInstanceBackups() - c.deleteBackup() - - // CONFIG GROUP tests - c.createConfigGrp() - c.getConfigGrp() - c.updateConfigGrp() - c.replaceConfigGrp() - c.associateInstanceWithConfigGrp() - c.listConfigGrpInstances() - c.detachInstanceFromGrp() - c.deleteConfigGrp() - - // DATABASE tests - c.createDBs() - c.listDBs() - - // USER tests - c.createUsers() - c.listUsers() - c.changeUserPwd() - c.getUser() - c.updateUser() - c.listUserAccess() - c.revokeUserAccess() - c.grantUserAccess() - - // TEARDOWN - c.deleteUsers() - c.deleteDBs() - - c.restartInstance() - c.WaitUntilActive(c.instanceID) - - c.deleteInstance(c.replicaID) - c.deleteInstance(c.instanceID) -} - -func (c *context) createInstance() { - opts := instances.CreateOpts{ - FlavorRef: "1", - Size: 1, - Name: tools.RandomString("gopher_db", 5), - } - - instance, err := instances.Create(c.client, opts).Extract() - th.AssertNoErr(c.test, err) - - c.Logf("Creating %s. Waiting...", instance.ID) - c.WaitUntilActive(instance.ID) - c.Logf("Created instance %s", instance.ID) - - c.instanceID = instance.ID -} - -func (c *context) listInstances() { - c.Logf("Listing instances") - - err := instances.List(c.client, nil).EachPage(func(page pagination.Page) (bool, error) { - instanceList, err := instances.ExtractInstances(page) - c.AssertNoErr(err) - - for _, i := range instanceList { - c.Logf("Instance: ID [%s] Name [%s] Status [%s] VolSize [%d] Datastore Type [%s]", - i.ID, i.Name, i.Status, i.Volume.Size, i.Datastore.Type) - } - - return true, nil - }) - - c.AssertNoErr(err) -} - -func (c *context) getInstance() { - instance, err := instances.Get(c.client, c.instanceID).Extract() - c.AssertNoErr(err) - c.Logf("Getting instance: %#v", instance) -} - -func (c *context) deleteInstance(id string) { - err := instances.Delete(c.client, id).ExtractErr() - c.AssertNoErr(err) - c.Logf("Deleted instance %s", id) -} - -func (c *context) enableRootUser() { - _, err := instances.EnableRootUser(c.client, c.instanceID).Extract() - c.AssertNoErr(err) - c.Logf("Enabled root user on %s", c.instanceID) -} - -func (c *context) isRootEnabled() { - enabled, err := instances.IsRootEnabled(c.client, c.instanceID) - c.AssertNoErr(err) - c.Logf("Is root enabled? %s", enabled) -} - -func (c *context) restartInstance() { - id := c.instanceID - err := instances.Restart(c.client, id).ExtractErr() - c.AssertNoErr(err) - c.Logf("Restarting %s. Waiting...", id) - c.WaitUntilActive(id) - c.Logf("Restarted %s", id) -} - -func (c *context) resizeInstance() { - id := c.instanceID - err := instances.Resize(c.client, id, "2").ExtractErr() - c.AssertNoErr(err) - c.Logf("Resizing %s. Waiting...", id) - c.WaitUntilActive(id) - c.Logf("Resized %s with flavorRef %s", id, "2") -} - -func (c *context) resizeVol() { - id := c.instanceID - err := instances.ResizeVolume(c.client, id, 2).ExtractErr() - c.AssertNoErr(err) - c.Logf("Resizing volume of %s. Waiting...", id) - c.WaitUntilActive(id) - c.Logf("Resized the volume of %s to %d GB", id, 2) -} - -func (c *context) getDefaultConfig() { - config, err := instances.GetDefaultConfig(c.client, c.instanceID).Extract() - c.Logf("Default config group for instance %s: %#v", c.instanceID, config) - c.AssertNoErr(err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/replica_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/replica_test.go deleted file mode 100644 index 89edf9d141..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/replica_test.go +++ /dev/null @@ -1,33 +0,0 @@ -// +build acceptance db rackspace - -package v1 - -import ( - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/rackspace/db/v1/instances" - th "github.com/rackspace/gophercloud/testhelper" -) - -func (c *context) createReplica() { - opts := instances.CreateOpts{ - FlavorRef: "2", - Size: 1, - Name: tools.RandomString("gopher_db", 5), - ReplicaOf: c.instanceID, - } - - repl, err := instances.Create(c.client, opts).Extract() - th.AssertNoErr(c.test, err) - - c.Logf("Creating replica of %s. Waiting...", c.instanceID) - c.WaitUntilActive(repl.ID) - c.Logf("Created replica %#v", repl) - - c.replicaID = repl.ID -} - -func (c *context) detachReplica() { - err := instances.DetachReplica(c.client, c.replicaID).ExtractErr() - c.Logf("Detached replica %s", c.replicaID) - c.AssertNoErr(err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/user_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/user_test.go deleted file mode 100644 index 0488f5dd1c..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/db/v1/user_test.go +++ /dev/null @@ -1,125 +0,0 @@ -// +build acceptance db rackspace - -package v1 - -import ( - "github.com/rackspace/gophercloud/acceptance/tools" - db "github.com/rackspace/gophercloud/openstack/db/v1/databases" - os "github.com/rackspace/gophercloud/openstack/db/v1/users" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/db/v1/users" -) - -func (c *context) createUsers() { - c.users = []string{ - tools.RandomString("user_", 5), - tools.RandomString("user_", 5), - tools.RandomString("user_", 5), - } - - db1 := db.CreateOpts{Name: c.DBIDs[0]} - db2 := db.CreateOpts{Name: c.DBIDs[1]} - db3 := db.CreateOpts{Name: c.DBIDs[2]} - - opts := os.BatchCreateOpts{ - os.CreateOpts{ - Name: c.users[0], - Password: tools.RandomString("db_", 5), - Databases: db.BatchCreateOpts{db1, db2, db3}, - }, - os.CreateOpts{ - Name: c.users[1], - Password: tools.RandomString("db_", 5), - Databases: db.BatchCreateOpts{db1, db2}, - }, - os.CreateOpts{ - Name: c.users[2], - Password: tools.RandomString("db_", 5), - Databases: db.BatchCreateOpts{db3}, - }, - } - - err := users.Create(c.client, c.instanceID, opts).ExtractErr() - c.Logf("Created three users on instance %s: %s, %s, %s", c.instanceID, c.users[0], c.users[1], c.users[2]) - c.AssertNoErr(err) -} - -func (c *context) listUsers() { - c.Logf("Listing users on instance %s", c.instanceID) - - err := os.List(c.client, c.instanceID).EachPage(func(page pagination.Page) (bool, error) { - uList, err := os.ExtractUsers(page) - c.AssertNoErr(err) - - for _, u := range uList { - c.Logf("User: %#v", u) - } - - return true, nil - }) - - c.AssertNoErr(err) -} - -func (c *context) deleteUsers() { - for _, id := range c.users { - err := users.Delete(c.client, c.instanceID, id).ExtractErr() - c.AssertNoErr(err) - c.Logf("Deleted user %s", id) - } -} - -func (c *context) changeUserPwd() { - opts := os.BatchCreateOpts{} - - for _, name := range c.users[:1] { - opts = append(opts, os.CreateOpts{Name: name, Password: tools.RandomString("", 5)}) - } - - err := users.ChangePassword(c.client, c.instanceID, opts).ExtractErr() - c.Logf("Updated 2 users' passwords") - c.AssertNoErr(err) -} - -func (c *context) getUser() { - user, err := users.Get(c.client, c.instanceID, c.users[0]).Extract() - c.Logf("Getting user %s", user) - c.AssertNoErr(err) -} - -func (c *context) updateUser() { - opts := users.UpdateOpts{Name: tools.RandomString("new_name_", 5)} - err := users.Update(c.client, c.instanceID, c.users[0], opts).ExtractErr() - c.Logf("Updated user %s", c.users[0]) - c.AssertNoErr(err) - c.users[0] = opts.Name -} - -func (c *context) listUserAccess() { - err := users.ListAccess(c.client, c.instanceID, c.users[0]).EachPage(func(page pagination.Page) (bool, error) { - dbList, err := users.ExtractDBs(page) - c.AssertNoErr(err) - - for _, db := range dbList { - c.Logf("User %s has access to DB: %#v", db) - } - - return true, nil - }) - - c.AssertNoErr(err) -} - -func (c *context) grantUserAccess() { - opts := db.BatchCreateOpts{db.CreateOpts{Name: c.DBIDs[0]}} - err := users.GrantAccess(c.client, c.instanceID, c.users[0], opts).ExtractErr() - c.Logf("Granted access for user %s to DB %s", c.users[0], c.DBIDs[0]) - c.AssertNoErr(err) -} - -func (c *context) revokeUserAccess() { - dbName, userName := c.DBIDs[0], c.users[0] - err := users.RevokeAccess(c.client, c.instanceID, userName, dbName).ExtractErr() - c.Logf("Revoked access for user %s to DB %s", userName, dbName) - c.AssertNoErr(err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/extension_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/extension_test.go deleted file mode 100644 index a50e015522..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/extension_test.go +++ /dev/null @@ -1,54 +0,0 @@ -// +build acceptance - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - extensions2 "github.com/rackspace/gophercloud/rackspace/identity/v2/extensions" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestExtensions(t *testing.T) { - service := authenticatedClient(t) - - t.Logf("Extensions available on this identity endpoint:") - count := 0 - var chosen string - err := extensions2.List(service).EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page %02d ---", count) - - extensions, err := extensions2.ExtractExtensions(page) - th.AssertNoErr(t, err) - - for i, ext := range extensions { - if chosen == "" { - chosen = ext.Alias - } - - t.Logf("[%02d] name=[%s] namespace=[%s]", i, ext.Name, ext.Namespace) - t.Logf(" alias=[%s] updated=[%s]", ext.Alias, ext.Updated) - t.Logf(" description=[%s]", ext.Description) - } - - count++ - return true, nil - }) - th.AssertNoErr(t, err) - - if chosen == "" { - t.Logf("No extensions found.") - return - } - - ext, err := extensions2.Get(service, chosen).Extract() - th.AssertNoErr(t, err) - - t.Logf("Detail for extension [%s]:", chosen) - t.Logf(" name=[%s]", ext.Name) - t.Logf(" namespace=[%s]", ext.Namespace) - t.Logf(" alias=[%s]", ext.Alias) - t.Logf(" updated=[%s]", ext.Updated) - t.Logf(" description=[%s]", ext.Description) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/identity_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/identity_test.go deleted file mode 100644 index 1182982f44..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/identity_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// +build acceptance - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/rackspace" - th "github.com/rackspace/gophercloud/testhelper" -) - -func rackspaceAuthOptions(t *testing.T) gophercloud.AuthOptions { - // Obtain credentials from the environment. - options, err := rackspace.AuthOptionsFromEnv() - th.AssertNoErr(t, err) - options = tools.OnlyRS(options) - - if options.Username == "" { - t.Fatal("Please provide a Rackspace username as RS_USERNAME.") - } - if options.APIKey == "" { - t.Fatal("Please provide a Rackspace API key as RS_API_KEY.") - } - - return options -} - -func createClient(t *testing.T, auth bool) *gophercloud.ServiceClient { - ao := rackspaceAuthOptions(t) - - provider, err := rackspace.NewClient(ao.IdentityEndpoint) - th.AssertNoErr(t, err) - - if auth { - err = rackspace.Authenticate(provider, ao) - th.AssertNoErr(t, err) - } - - return rackspace.NewIdentityV2(provider) -} - -func unauthenticatedClient(t *testing.T) *gophercloud.ServiceClient { - return createClient(t, false) -} - -func authenticatedClient(t *testing.T) *gophercloud.ServiceClient { - return createClient(t, true) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/role_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/role_test.go deleted file mode 100644 index efaeb75cde..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/role_test.go +++ /dev/null @@ -1,59 +0,0 @@ -// +build acceptance identity roles - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - os "github.com/rackspace/gophercloud/openstack/identity/v2/extensions/admin/roles" - - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/identity/v2/roles" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestRoles(t *testing.T) { - client := authenticatedClient(t) - - userID := createUser(t, client) - roleID := listRoles(t, client) - - addUserRole(t, client, userID, roleID) - - deleteUserRole(t, client, userID, roleID) - - deleteUser(t, client, userID) -} - -func listRoles(t *testing.T, client *gophercloud.ServiceClient) string { - var roleID string - - err := roles.List(client).EachPage(func(page pagination.Page) (bool, error) { - roleList, err := os.ExtractRoles(page) - th.AssertNoErr(t, err) - - for _, role := range roleList { - t.Logf("Listing role: ID [%s] Name [%s]", role.ID, role.Name) - roleID = role.ID - } - - return true, nil - }) - - th.AssertNoErr(t, err) - - return roleID -} - -func addUserRole(t *testing.T, client *gophercloud.ServiceClient, userID, roleID string) { - err := roles.AddUserRole(client, userID, roleID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Added role %s to user %s", roleID, userID) -} - -func deleteUserRole(t *testing.T, client *gophercloud.ServiceClient, userID, roleID string) { - err := roles.DeleteUserRole(client, userID, roleID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Removed role %s from user %s", roleID, userID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/tenant_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/tenant_test.go deleted file mode 100644 index 6081a498e3..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/tenant_test.go +++ /dev/null @@ -1,37 +0,0 @@ -// +build acceptance - -package v2 - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - rstenants "github.com/rackspace/gophercloud/rackspace/identity/v2/tenants" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestTenants(t *testing.T) { - service := authenticatedClient(t) - - t.Logf("Tenants available to the currently issued token:") - count := 0 - err := rstenants.List(service, nil).EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page %02d ---", count) - - tenants, err := rstenants.ExtractTenants(page) - th.AssertNoErr(t, err) - - for i, tenant := range tenants { - t.Logf("[%02d] id=[%s]", i, tenant.ID) - t.Logf(" name=[%s] enabled=[%v]", i, tenant.Name, tenant.Enabled) - t.Logf(" description=[%s]", tenant.Description) - } - - count++ - return true, nil - }) - th.AssertNoErr(t, err) - if count == 0 { - t.Errorf("No tenants listed for your current token.") - } -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/tokens_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/tokens_test.go deleted file mode 100644 index 95ee7e660c..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/tokens_test.go +++ /dev/null @@ -1,61 +0,0 @@ -// +build acceptance - -package v2 - -import ( - "os" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/rackspace" - "github.com/rackspace/gophercloud/rackspace/identity/v2/tokens" - th "github.com/rackspace/gophercloud/testhelper" -) - -func rackspaceAuthOptions(t *testing.T) gophercloud.AuthOptions { - // Obtain credentials from the environment. - options, err := rackspace.AuthOptionsFromEnv() - th.AssertNoErr(t, err) - options = tools.OnlyRS(options) - - if options.Username == "" { - t.Fatal("Please provide a Rackspace username as RS_USERNAME.") - } - if options.APIKey == "" { - t.Fatal("Please provide a Rackspace API key as RS_API_KEY.") - } - - return options -} - -func createClient(t *testing.T, auth bool) *gophercloud.ServiceClient { - ao := rackspaceAuthOptions(t) - - provider, err := rackspace.NewClient(ao.IdentityEndpoint) - th.AssertNoErr(t, err) - - if auth { - err = rackspace.Authenticate(provider, ao) - th.AssertNoErr(t, err) - } - - return rackspace.NewIdentityV2(provider) -} - -func TestTokenAuth(t *testing.T) { - authedClient := createClient(t, true) - token := authedClient.TokenID - - tenantID := os.Getenv("RS_TENANT_ID") - if tenantID == "" { - t.Skip("You must set RS_TENANT_ID environment variable to run this test") - } - - authOpts := tokens.AuthOptions{} - authOpts.TenantID = tenantID - authOpts.Token = token - - _, err := tokens.Create(authedClient, authOpts).ExtractToken() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/user_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/user_test.go deleted file mode 100644 index 28c0c832be..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/identity/v2/user_test.go +++ /dev/null @@ -1,93 +0,0 @@ -// +build acceptance identity - -package v2 - -import ( - "strconv" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - os "github.com/rackspace/gophercloud/openstack/identity/v2/users" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/identity/v2/users" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestUsers(t *testing.T) { - client := authenticatedClient(t) - - userID := createUser(t, client) - - listUsers(t, client) - - getUser(t, client, userID) - - updateUser(t, client, userID) - - resetApiKey(t, client, userID) - - deleteUser(t, client, userID) -} - -func createUser(t *testing.T, client *gophercloud.ServiceClient) string { - t.Log("Creating user") - - opts := users.CreateOpts{ - Username: tools.RandomString("user_", 5), - Enabled: os.Disabled, - Email: "new_user@foo.com", - } - - user, err := users.Create(client, opts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created user %s", user.ID) - - return user.ID -} - -func listUsers(t *testing.T, client *gophercloud.ServiceClient) { - err := users.List(client).EachPage(func(page pagination.Page) (bool, error) { - userList, err := os.ExtractUsers(page) - th.AssertNoErr(t, err) - - for _, user := range userList { - t.Logf("Listing user: ID [%s] Username [%s] Email [%s] Enabled? [%s]", - user.ID, user.Username, user.Email, strconv.FormatBool(user.Enabled)) - } - - return true, nil - }) - - th.AssertNoErr(t, err) -} - -func getUser(t *testing.T, client *gophercloud.ServiceClient, userID string) { - _, err := users.Get(client, userID).Extract() - th.AssertNoErr(t, err) - t.Logf("Getting user %s", userID) -} - -func updateUser(t *testing.T, client *gophercloud.ServiceClient, userID string) { - opts := users.UpdateOpts{Username: tools.RandomString("new_name", 5), Email: "new@foo.com"} - user, err := users.Update(client, userID, opts).Extract() - th.AssertNoErr(t, err) - t.Logf("Updated user %s: Username [%s] Email [%s]", userID, user.Username, user.Email) -} - -func deleteUser(t *testing.T, client *gophercloud.ServiceClient, userID string) { - res := users.Delete(client, userID) - th.AssertNoErr(t, res.Err) - t.Logf("Deleted user %s", userID) -} - -func resetApiKey(t *testing.T, client *gophercloud.ServiceClient, userID string) { - key, err := users.ResetAPIKey(client, userID).Extract() - th.AssertNoErr(t, err) - - if key.APIKey == "" { - t.Fatal("failed to reset API key for user") - } - - t.Logf("Reset API key for user %s to %s", key.Username, key.APIKey) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/acl_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/acl_test.go deleted file mode 100644 index 7a380273c6..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/acl_test.go +++ /dev/null @@ -1,94 +0,0 @@ -// +build acceptance lbs - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/lb/v1/acl" - "github.com/rackspace/gophercloud/rackspace/lb/v1/lbs" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestACL(t *testing.T) { - client := setup(t) - - ids := createLB(t, client, 1) - lbID := ids[0] - - createACL(t, client, lbID) - - waitForLB(client, lbID, lbs.ACTIVE) - - networkIDs := showACL(t, client, lbID) - - deleteNetworkItem(t, client, lbID, networkIDs[0]) - waitForLB(client, lbID, lbs.ACTIVE) - - bulkDeleteACL(t, client, lbID, networkIDs[1:2]) - waitForLB(client, lbID, lbs.ACTIVE) - - deleteACL(t, client, lbID) - waitForLB(client, lbID, lbs.ACTIVE) - - deleteLB(t, client, lbID) -} - -func createACL(t *testing.T, client *gophercloud.ServiceClient, lbID int) { - opts := acl.CreateOpts{ - acl.CreateOpt{Address: "206.160.163.21", Type: acl.DENY}, - acl.CreateOpt{Address: "206.160.165.11", Type: acl.DENY}, - acl.CreateOpt{Address: "206.160.165.12", Type: acl.DENY}, - acl.CreateOpt{Address: "206.160.165.13", Type: acl.ALLOW}, - } - - err := acl.Create(client, lbID, opts).ExtractErr() - th.AssertNoErr(t, err) - - t.Logf("Created ACL items for LB %d", lbID) -} - -func showACL(t *testing.T, client *gophercloud.ServiceClient, lbID int) []int { - ids := []int{} - - err := acl.List(client, lbID).EachPage(func(page pagination.Page) (bool, error) { - accessList, err := acl.ExtractAccessList(page) - th.AssertNoErr(t, err) - - for _, i := range accessList { - t.Logf("Listing network item: ID [%s] Address [%s] Type [%s]", i.ID, i.Address, i.Type) - ids = append(ids, i.ID) - } - - return true, nil - }) - th.AssertNoErr(t, err) - - return ids -} - -func deleteNetworkItem(t *testing.T, client *gophercloud.ServiceClient, lbID, itemID int) { - err := acl.Delete(client, lbID, itemID).ExtractErr() - - th.AssertNoErr(t, err) - - t.Logf("Deleted network item %d", itemID) -} - -func bulkDeleteACL(t *testing.T, client *gophercloud.ServiceClient, lbID int, items []int) { - err := acl.BulkDelete(client, lbID, items).ExtractErr() - - th.AssertNoErr(t, err) - - t.Logf("Deleted network items %s", intsToStr(items)) -} - -func deleteACL(t *testing.T, client *gophercloud.ServiceClient, lbID int) { - err := acl.DeleteAll(client, lbID).ExtractErr() - - th.AssertNoErr(t, err) - - t.Logf("Deleted ACL from LB %d", lbID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/lb_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/lb_test.go deleted file mode 100644 index c67ddecad9..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/lb_test.go +++ /dev/null @@ -1,214 +0,0 @@ -// +build acceptance lbs - -package v1 - -import ( - "strconv" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/lb/v1/lbs" - "github.com/rackspace/gophercloud/rackspace/lb/v1/vips" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestLBs(t *testing.T) { - client := setup(t) - - ids := createLB(t, client, 3) - id := ids[0] - - listLBProtocols(t, client) - - listLBAlgorithms(t, client) - - listLBs(t, client) - - getLB(t, client, id) - - checkLBLogging(t, client, id) - - checkErrorPage(t, client, id) - - getStats(t, client, id) - - updateLB(t, client, id) - - deleteLB(t, client, id) - - batchDeleteLBs(t, client, ids[1:]) -} - -func createLB(t *testing.T, client *gophercloud.ServiceClient, count int) []int { - ids := []int{} - - for i := 0; i < count; i++ { - opts := lbs.CreateOpts{ - Name: tools.RandomString("test_", 5), - Port: 80, - Protocol: "HTTP", - VIPs: []vips.VIP{ - vips.VIP{Type: vips.PUBLIC}, - }, - } - - lb, err := lbs.Create(client, opts).Extract() - th.AssertNoErr(t, err) - - t.Logf("Created LB %d - waiting for it to build...", lb.ID) - waitForLB(client, lb.ID, lbs.ACTIVE) - t.Logf("LB %d has reached ACTIVE state", lb.ID) - - ids = append(ids, lb.ID) - } - - return ids -} - -func waitForLB(client *gophercloud.ServiceClient, id int, state lbs.Status) { - gophercloud.WaitFor(60, func() (bool, error) { - lb, err := lbs.Get(client, id).Extract() - if err != nil { - return false, err - } - if lb.Status != state { - return false, nil - } - return true, nil - }) -} - -func listLBProtocols(t *testing.T, client *gophercloud.ServiceClient) { - err := lbs.ListProtocols(client).EachPage(func(page pagination.Page) (bool, error) { - pList, err := lbs.ExtractProtocols(page) - th.AssertNoErr(t, err) - - for _, p := range pList { - t.Logf("Listing protocol: Name [%s]", p.Name) - } - - return true, nil - }) - th.AssertNoErr(t, err) -} - -func listLBAlgorithms(t *testing.T, client *gophercloud.ServiceClient) { - err := lbs.ListAlgorithms(client).EachPage(func(page pagination.Page) (bool, error) { - aList, err := lbs.ExtractAlgorithms(page) - th.AssertNoErr(t, err) - - for _, a := range aList { - t.Logf("Listing algorithm: Name [%s]", a.Name) - } - - return true, nil - }) - th.AssertNoErr(t, err) -} - -func listLBs(t *testing.T, client *gophercloud.ServiceClient) { - err := lbs.List(client, lbs.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - lbList, err := lbs.ExtractLBs(page) - th.AssertNoErr(t, err) - - for _, lb := range lbList { - t.Logf("Listing LB: ID [%d] Name [%s] Protocol [%s] Status [%s] Node count [%d] Port [%d]", - lb.ID, lb.Name, lb.Protocol, lb.Status, lb.NodeCount, lb.Port) - } - - return true, nil - }) - - th.AssertNoErr(t, err) -} - -func getLB(t *testing.T, client *gophercloud.ServiceClient, id int) { - lb, err := lbs.Get(client, id).Extract() - th.AssertNoErr(t, err) - t.Logf("Getting LB %d: Created [%s] VIPs [%#v] Logging [%#v] Persistence [%#v] SourceAddrs [%#v]", - lb.ID, lb.Created, lb.VIPs, lb.ConnectionLogging, lb.SessionPersistence, lb.SourceAddrs) -} - -func updateLB(t *testing.T, client *gophercloud.ServiceClient, id int) { - opts := lbs.UpdateOpts{ - Name: tools.RandomString("new_", 5), - Protocol: "TCP", - HalfClosed: gophercloud.Enabled, - Algorithm: "RANDOM", - Port: 8080, - Timeout: 100, - HTTPSRedirect: gophercloud.Disabled, - } - - err := lbs.Update(client, id, opts).ExtractErr() - th.AssertNoErr(t, err) - - t.Logf("Updating LB %d - waiting for it to finish", id) - waitForLB(client, id, lbs.ACTIVE) - t.Logf("LB %d has reached ACTIVE state", id) -} - -func deleteLB(t *testing.T, client *gophercloud.ServiceClient, id int) { - err := lbs.Delete(client, id).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Deleted LB %d", id) -} - -func batchDeleteLBs(t *testing.T, client *gophercloud.ServiceClient, ids []int) { - err := lbs.BulkDelete(client, ids).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Deleted LB %s", intsToStr(ids)) -} - -func checkLBLogging(t *testing.T, client *gophercloud.ServiceClient, id int) { - err := lbs.EnableLogging(client, id).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Enabled logging for LB %d", id) - - res, err := lbs.IsLoggingEnabled(client, id) - th.AssertNoErr(t, err) - t.Logf("LB %d log enabled? %s", id, strconv.FormatBool(res)) - - waitForLB(client, id, lbs.ACTIVE) - - err = lbs.DisableLogging(client, id).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Disabled logging for LB %d", id) -} - -func checkErrorPage(t *testing.T, client *gophercloud.ServiceClient, id int) { - content, err := lbs.SetErrorPage(client, id, "New content!").Extract() - t.Logf("Set error page for LB %d", id) - - content, err = lbs.GetErrorPage(client, id).Extract() - th.AssertNoErr(t, err) - t.Logf("Error page for LB %d: %s", id, content) - - err = lbs.DeleteErrorPage(client, id).ExtractErr() - t.Logf("Deleted error page for LB %d", id) -} - -func getStats(t *testing.T, client *gophercloud.ServiceClient, id int) { - waitForLB(client, id, lbs.ACTIVE) - - stats, err := lbs.GetStats(client, id).Extract() - th.AssertNoErr(t, err) - - t.Logf("Stats for LB %d: %#v", id, stats) -} - -func checkCaching(t *testing.T, client *gophercloud.ServiceClient, id int) { - err := lbs.EnableCaching(client, id).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Enabled caching for LB %d", id) - - res, err := lbs.IsContentCached(client, id) - th.AssertNoErr(t, err) - t.Logf("Is caching enabled for LB? %s", strconv.FormatBool(res)) - - err = lbs.DisableCaching(client, id).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Disabled caching for LB %d", id) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/monitor_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/monitor_test.go deleted file mode 100644 index c1a8e24dd9..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/monitor_test.go +++ /dev/null @@ -1,60 +0,0 @@ -// +build acceptance lbs - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/rackspace/lb/v1/lbs" - "github.com/rackspace/gophercloud/rackspace/lb/v1/monitors" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestMonitors(t *testing.T) { - client := setup(t) - - ids := createLB(t, client, 1) - lbID := ids[0] - - getMonitor(t, client, lbID) - - updateMonitor(t, client, lbID) - - deleteMonitor(t, client, lbID) - - deleteLB(t, client, lbID) -} - -func getMonitor(t *testing.T, client *gophercloud.ServiceClient, lbID int) { - hm, err := monitors.Get(client, lbID).Extract() - th.AssertNoErr(t, err) - t.Logf("Health monitor for LB %d: Type [%s] Delay [%d] Timeout [%d] AttemptLimit [%d]", - lbID, hm.Type, hm.Delay, hm.Timeout, hm.AttemptLimit) -} - -func updateMonitor(t *testing.T, client *gophercloud.ServiceClient, lbID int) { - opts := monitors.UpdateHTTPMonitorOpts{ - AttemptLimit: 3, - Delay: 10, - Timeout: 10, - BodyRegex: "hello is it me you're looking for", - Path: "/foo", - StatusRegex: "200", - Type: monitors.HTTP, - } - - err := monitors.Update(client, lbID, opts).ExtractErr() - th.AssertNoErr(t, err) - - waitForLB(client, lbID, lbs.ACTIVE) - t.Logf("Updated monitor for LB %d", lbID) -} - -func deleteMonitor(t *testing.T, client *gophercloud.ServiceClient, lbID int) { - err := monitors.Delete(client, lbID).ExtractErr() - th.AssertNoErr(t, err) - - waitForLB(client, lbID, lbs.ACTIVE) - t.Logf("Deleted monitor for LB %d", lbID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/node_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/node_test.go deleted file mode 100644 index 18b9fe71ce..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/node_test.go +++ /dev/null @@ -1,175 +0,0 @@ -// +build acceptance lbs - -package v1 - -import ( - "os" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/acceptance/tools" - "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/diskconfig" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/compute/v2/servers" - "github.com/rackspace/gophercloud/rackspace/lb/v1/lbs" - "github.com/rackspace/gophercloud/rackspace/lb/v1/nodes" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestNodes(t *testing.T) { - client := setup(t) - - serverIP := findServer(t) - ids := createLB(t, client, 1) - lbID := ids[0] - - nodeID := addNodes(t, client, lbID, serverIP) - - listNodes(t, client, lbID) - - getNode(t, client, lbID, nodeID) - - updateNode(t, client, lbID, nodeID) - - listEvents(t, client, lbID) - - deleteNode(t, client, lbID, nodeID) - - waitForLB(client, lbID, lbs.ACTIVE) - deleteLB(t, client, lbID) -} - -func findServer(t *testing.T) string { - var serverIP string - - client, err := newComputeClient() - th.AssertNoErr(t, err) - - err = servers.List(client, nil).EachPage(func(page pagination.Page) (bool, error) { - sList, err := servers.ExtractServers(page) - th.AssertNoErr(t, err) - - for _, s := range sList { - serverIP = s.AccessIPv4 - t.Logf("Found an existing server: ID [%s] Public IP [%s]", s.ID, serverIP) - break - } - - return true, nil - }) - th.AssertNoErr(t, err) - - if serverIP == "" { - t.Log("No server found, creating one") - - imageRef := os.Getenv("RS_IMAGE_ID") - if imageRef == "" { - t.Fatalf("OS var RS_IMAGE_ID undefined") - } - flavorRef := os.Getenv("RS_FLAVOR_ID") - if flavorRef == "" { - t.Fatalf("OS var RS_FLAVOR_ID undefined") - } - - opts := &servers.CreateOpts{ - Name: tools.RandomString("lb_test_", 5), - ImageRef: imageRef, - FlavorRef: flavorRef, - DiskConfig: diskconfig.Manual, - } - - s, err := servers.Create(client, opts).Extract() - th.AssertNoErr(t, err) - serverIP = s.AccessIPv4 - - t.Logf("Created server %s, waiting for it to build", s.ID) - err = servers.WaitForStatus(client, s.ID, "ACTIVE", 300) - th.AssertNoErr(t, err) - t.Logf("Server created successfully.") - } - - return serverIP -} - -func addNodes(t *testing.T, client *gophercloud.ServiceClient, lbID int, serverIP string) int { - opts := nodes.CreateOpts{ - nodes.CreateOpt{ - Address: serverIP, - Port: 80, - Condition: nodes.ENABLED, - Type: nodes.PRIMARY, - }, - } - - page := nodes.Create(client, lbID, opts) - - nodeList, err := page.ExtractNodes() - th.AssertNoErr(t, err) - - var nodeID int - for _, n := range nodeList { - nodeID = n.ID - } - if nodeID == 0 { - t.Fatalf("nodeID could not be extracted from create response") - } - - t.Logf("Added node %d to LB %d", nodeID, lbID) - waitForLB(client, lbID, lbs.ACTIVE) - - return nodeID -} - -func listNodes(t *testing.T, client *gophercloud.ServiceClient, lbID int) { - err := nodes.List(client, lbID, nil).EachPage(func(page pagination.Page) (bool, error) { - nodeList, err := nodes.ExtractNodes(page) - th.AssertNoErr(t, err) - - for _, n := range nodeList { - t.Logf("Listing node: ID [%d] Address [%s:%d] Status [%s]", n.ID, n.Address, n.Port, n.Status) - } - - return true, nil - }) - th.AssertNoErr(t, err) -} - -func getNode(t *testing.T, client *gophercloud.ServiceClient, lbID int, nodeID int) { - node, err := nodes.Get(client, lbID, nodeID).Extract() - th.AssertNoErr(t, err) - t.Logf("Getting node %d: Type [%s] Weight [%d]", nodeID, node.Type, node.Weight) -} - -func updateNode(t *testing.T, client *gophercloud.ServiceClient, lbID int, nodeID int) { - opts := nodes.UpdateOpts{ - Weight: gophercloud.IntToPointer(10), - Condition: nodes.DRAINING, - Type: nodes.SECONDARY, - } - err := nodes.Update(client, lbID, nodeID, opts).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Updated node %d", nodeID) - waitForLB(client, lbID, lbs.ACTIVE) -} - -func listEvents(t *testing.T, client *gophercloud.ServiceClient, lbID int) { - pager := nodes.ListEvents(client, lbID, nodes.ListEventsOpts{}) - err := pager.EachPage(func(page pagination.Page) (bool, error) { - eventList, err := nodes.ExtractNodeEvents(page) - th.AssertNoErr(t, err) - - for _, e := range eventList { - t.Logf("Listing events for node %d: Type [%s] Msg [%s] Severity [%s] Date [%s]", - e.NodeID, e.Type, e.DetailedMessage, e.Severity, e.Created) - } - - return true, nil - }) - th.AssertNoErr(t, err) -} - -func deleteNode(t *testing.T, client *gophercloud.ServiceClient, lbID int, nodeID int) { - err := nodes.Delete(client, lbID, nodeID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Deleted node %d", nodeID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/session_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/session_test.go deleted file mode 100644 index 8d85655f6b..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/session_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// +build acceptance lbs - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/rackspace/lb/v1/sessions" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestSession(t *testing.T) { - client := setup(t) - - ids := createLB(t, client, 1) - lbID := ids[0] - - getSession(t, client, lbID) - - enableSession(t, client, lbID) - waitForLB(client, lbID, "ACTIVE") - - disableSession(t, client, lbID) - waitForLB(client, lbID, "ACTIVE") - - deleteLB(t, client, lbID) -} - -func getSession(t *testing.T, client *gophercloud.ServiceClient, lbID int) { - sp, err := sessions.Get(client, lbID).Extract() - th.AssertNoErr(t, err) - t.Logf("Session config: Type [%s]", sp.Type) -} - -func enableSession(t *testing.T, client *gophercloud.ServiceClient, lbID int) { - opts := sessions.CreateOpts{Type: sessions.HTTPCOOKIE} - err := sessions.Enable(client, lbID, opts).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Enable %s sessions for %d", opts.Type, lbID) -} - -func disableSession(t *testing.T, client *gophercloud.ServiceClient, lbID int) { - err := sessions.Disable(client, lbID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Disable sessions for %d", lbID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/throttle_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/throttle_test.go deleted file mode 100644 index 1cc12356ca..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/throttle_test.go +++ /dev/null @@ -1,53 +0,0 @@ -// +build acceptance lbs - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/rackspace/lb/v1/throttle" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestThrottle(t *testing.T) { - client := setup(t) - - ids := createLB(t, client, 1) - lbID := ids[0] - - getThrottleConfig(t, client, lbID) - - createThrottleConfig(t, client, lbID) - waitForLB(client, lbID, "ACTIVE") - - deleteThrottleConfig(t, client, lbID) - waitForLB(client, lbID, "ACTIVE") - - deleteLB(t, client, lbID) -} - -func getThrottleConfig(t *testing.T, client *gophercloud.ServiceClient, lbID int) { - sp, err := throttle.Get(client, lbID).Extract() - th.AssertNoErr(t, err) - t.Logf("Throttle config: MaxConns [%s]", sp.MaxConnections) -} - -func createThrottleConfig(t *testing.T, client *gophercloud.ServiceClient, lbID int) { - opts := throttle.CreateOpts{ - MaxConnections: 200, - MaxConnectionRate: 100, - MinConnections: 0, - RateInterval: 10, - } - - err := throttle.Create(client, lbID, opts).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Enable throttling for %d", lbID) -} - -func deleteThrottleConfig(t *testing.T, client *gophercloud.ServiceClient, lbID int) { - err := throttle.Delete(client, lbID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Disable throttling for %d", lbID) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/vip_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/vip_test.go deleted file mode 100644 index bc0c2a89f2..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/lb/v1/vip_test.go +++ /dev/null @@ -1,83 +0,0 @@ -// +build acceptance lbs - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/lb/v1/lbs" - "github.com/rackspace/gophercloud/rackspace/lb/v1/vips" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestVIPs(t *testing.T) { - client := setup(t) - - ids := createLB(t, client, 1) - lbID := ids[0] - - listVIPs(t, client, lbID) - - vipIDs := addVIPs(t, client, lbID, 3) - - deleteVIP(t, client, lbID, vipIDs[0]) - - bulkDeleteVIPs(t, client, lbID, vipIDs[1:]) - - waitForLB(client, lbID, lbs.ACTIVE) - deleteLB(t, client, lbID) -} - -func listVIPs(t *testing.T, client *gophercloud.ServiceClient, lbID int) { - err := vips.List(client, lbID).EachPage(func(page pagination.Page) (bool, error) { - vipList, err := vips.ExtractVIPs(page) - th.AssertNoErr(t, err) - - for _, vip := range vipList { - t.Logf("Listing VIP: ID [%s] Address [%s] Type [%s] Version [%s]", - vip.ID, vip.Address, vip.Type, vip.Version) - } - - return true, nil - }) - th.AssertNoErr(t, err) -} - -func addVIPs(t *testing.T, client *gophercloud.ServiceClient, lbID, count int) []int { - ids := []int{} - - for i := 0; i < count; i++ { - opts := vips.CreateOpts{ - Type: vips.PUBLIC, - Version: vips.IPV6, - } - - vip, err := vips.Create(client, lbID, opts).Extract() - th.AssertNoErr(t, err) - - t.Logf("Created VIP %d", vip.ID) - - waitForLB(client, lbID, lbs.ACTIVE) - - ids = append(ids, vip.ID) - } - - return ids -} - -func deleteVIP(t *testing.T, client *gophercloud.ServiceClient, lbID, vipID int) { - err := vips.Delete(client, lbID, vipID).ExtractErr() - th.AssertNoErr(t, err) - - t.Logf("Deleted VIP %d", vipID) - - waitForLB(client, lbID, lbs.ACTIVE) -} - -func bulkDeleteVIPs(t *testing.T, client *gophercloud.ServiceClient, lbID int, ids []int) { - err := vips.BulkDelete(client, lbID, ids).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Deleted VIPs %s", intsToStr(ids)) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/networking/v2/network_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/networking/v2/network_test.go deleted file mode 100644 index 3862123bfd..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/networking/v2/network_test.go +++ /dev/null @@ -1,65 +0,0 @@ -// +build acceptance networking - -package v2 - -import ( - "strconv" - "testing" - - os "github.com/rackspace/gophercloud/openstack/networking/v2/networks" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/networking/v2/networks" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestNetworkCRUDOperations(t *testing.T) { - Setup(t) - defer Teardown() - - // Create a network - n, err := networks.Create(Client, os.CreateOpts{Name: "sample_network", AdminStateUp: os.Up}).Extract() - th.AssertNoErr(t, err) - defer networks.Delete(Client, n.ID) - th.AssertEquals(t, "sample_network", n.Name) - th.AssertEquals(t, true, n.AdminStateUp) - networkID := n.ID - - // List networks - pager := networks.List(Client, os.ListOpts{Limit: 2}) - err = pager.EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page ---") - - networkList, err := os.ExtractNetworks(page) - th.AssertNoErr(t, err) - - for _, n := range networkList { - t.Logf("Network: ID [%s] Name [%s] Status [%s] Is shared? [%s]", - n.ID, n.Name, n.Status, strconv.FormatBool(n.Shared)) - } - - return true, nil - }) - th.CheckNoErr(t, err) - - // Get a network - if networkID == "" { - t.Fatalf("In order to retrieve a network, the NetworkID must be set") - } - n, err = networks.Get(Client, networkID).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, "ACTIVE", n.Status) - th.AssertDeepEquals(t, []string{}, n.Subnets) - th.AssertEquals(t, "sample_network", n.Name) - th.AssertEquals(t, true, n.AdminStateUp) - th.AssertEquals(t, false, n.Shared) - th.AssertEquals(t, networkID, n.ID) - - // Update network - n, err = networks.Update(Client, networkID, os.UpdateOpts{Name: "new_network_name"}).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, "new_network_name", n.Name) - - // Delete network - res := networks.Delete(Client, networkID) - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/networking/v2/port_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/networking/v2/port_test.go deleted file mode 100644 index 3c42bb20cd..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/networking/v2/port_test.go +++ /dev/null @@ -1,116 +0,0 @@ -// +build acceptance networking - -package v2 - -import ( - "testing" - - osNetworks "github.com/rackspace/gophercloud/openstack/networking/v2/networks" - osPorts "github.com/rackspace/gophercloud/openstack/networking/v2/ports" - osSubnets "github.com/rackspace/gophercloud/openstack/networking/v2/subnets" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/networking/v2/networks" - "github.com/rackspace/gophercloud/rackspace/networking/v2/ports" - "github.com/rackspace/gophercloud/rackspace/networking/v2/subnets" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestPortCRUD(t *testing.T) { - Setup(t) - defer Teardown() - - // Setup network - t.Log("Setting up network") - networkID, err := createNetwork() - th.AssertNoErr(t, err) - defer networks.Delete(Client, networkID) - - // Setup subnet - t.Logf("Setting up subnet on network %s", networkID) - subnetID, err := createSubnet(networkID) - th.AssertNoErr(t, err) - defer subnets.Delete(Client, subnetID) - - // Create port - t.Logf("Create port based on subnet %s", subnetID) - portID := createPort(t, networkID, subnetID) - - // List ports - t.Logf("Listing all ports") - listPorts(t) - - // Get port - if portID == "" { - t.Fatalf("In order to retrieve a port, the portID must be set") - } - p, err := ports.Get(Client, portID).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, portID, p.ID) - - // Update port - p, err = ports.Update(Client, portID, osPorts.UpdateOpts{Name: "new_port_name"}).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, "new_port_name", p.Name) - - // Delete port - res := ports.Delete(Client, portID) - th.AssertNoErr(t, res.Err) -} - -func createPort(t *testing.T, networkID, subnetID string) string { - enable := true - opts := osPorts.CreateOpts{ - NetworkID: networkID, - Name: "my_port", - AdminStateUp: &enable, - FixedIPs: []osPorts.IP{osPorts.IP{SubnetID: subnetID}}, - } - p, err := ports.Create(Client, opts).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, networkID, p.NetworkID) - th.AssertEquals(t, "my_port", p.Name) - th.AssertEquals(t, true, p.AdminStateUp) - - return p.ID -} - -func listPorts(t *testing.T) { - count := 0 - pager := ports.List(Client, osPorts.ListOpts{}) - err := pager.EachPage(func(page pagination.Page) (bool, error) { - count++ - t.Logf("--- Page ---") - - portList, err := osPorts.ExtractPorts(page) - th.AssertNoErr(t, err) - - for _, p := range portList { - t.Logf("Port: ID [%s] Name [%s] Status [%s] MAC addr [%s] Fixed IPs [%#v] Security groups [%#v]", - p.ID, p.Name, p.Status, p.MACAddress, p.FixedIPs, p.SecurityGroups) - } - - return true, nil - }) - - th.CheckNoErr(t, err) - - if count == 0 { - t.Logf("No pages were iterated over when listing ports") - } -} - -func createNetwork() (string, error) { - res, err := networks.Create(Client, osNetworks.CreateOpts{Name: "tmp_network", AdminStateUp: osNetworks.Up}).Extract() - return res.ID, err -} - -func createSubnet(networkID string) (string, error) { - s, err := subnets.Create(Client, osSubnets.CreateOpts{ - NetworkID: networkID, - CIDR: "192.168.199.0/24", - IPVersion: osSubnets.IPv4, - Name: "my_subnet", - EnableDHCP: osSubnets.Down, - }).Extract() - return s.ID, err -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/networking/v2/security_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/networking/v2/security_test.go deleted file mode 100644 index ec029913e3..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/networking/v2/security_test.go +++ /dev/null @@ -1,165 +0,0 @@ -// +build acceptance networking security - -package v2 - -import ( - "testing" - - osGroups "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/groups" - osRules "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/rules" - osNetworks "github.com/rackspace/gophercloud/openstack/networking/v2/networks" - osPorts "github.com/rackspace/gophercloud/openstack/networking/v2/ports" - "github.com/rackspace/gophercloud/pagination" - rsNetworks "github.com/rackspace/gophercloud/rackspace/networking/v2/networks" - rsPorts "github.com/rackspace/gophercloud/rackspace/networking/v2/ports" - rsGroups "github.com/rackspace/gophercloud/rackspace/networking/v2/security/groups" - rsRules "github.com/rackspace/gophercloud/rackspace/networking/v2/security/rules" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestSecurityGroups(t *testing.T) { - Setup(t) - defer Teardown() - - // create security group - groupID := createSecGroup(t) - - // delete security group - defer deleteSecGroup(t, groupID) - - // list security group - listSecGroups(t) - - // get security group - getSecGroup(t, groupID) -} - -func TestSecurityGroupRules(t *testing.T) { - Setup(t) - defer Teardown() - - // create security group - groupID := createSecGroup(t) - - defer deleteSecGroup(t, groupID) - - // create security group rule - ruleID := createSecRule(t, groupID) - - // delete security group rule - defer deleteSecRule(t, ruleID) - - // list security group rule - listSecRules(t) - - // get security group rule - getSecRule(t, ruleID) -} - -func createSecGroup(t *testing.T) string { - sg, err := rsGroups.Create(Client, osGroups.CreateOpts{ - Name: "new-webservers", - Description: "security group for webservers", - }).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Created security group %s", sg.ID) - - return sg.ID -} - -func listSecGroups(t *testing.T) { - err := rsGroups.List(Client, osGroups.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - list, err := osGroups.ExtractGroups(page) - if err != nil { - t.Errorf("Failed to extract secgroups: %v", err) - return false, err - } - - for _, sg := range list { - t.Logf("Listing security group: ID [%s] Name [%s]", sg.ID, sg.Name) - } - - return true, nil - }) - - th.AssertNoErr(t, err) -} - -func getSecGroup(t *testing.T, id string) { - sg, err := rsGroups.Get(Client, id).Extract() - th.AssertNoErr(t, err) - t.Logf("Getting security group: ID [%s] Name [%s] Description [%s]", sg.ID, sg.Name, sg.Description) -} - -func createSecGroupPort(t *testing.T, groupID string) (string, string) { - n, err := rsNetworks.Create(Client, osNetworks.CreateOpts{Name: "tmp_network"}).Extract() - th.AssertNoErr(t, err) - t.Logf("Created network %s", n.ID) - - opts := osPorts.CreateOpts{ - NetworkID: n.ID, - Name: "my_port", - SecurityGroups: []string{groupID}, - } - p, err := rsPorts.Create(Client, opts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created port %s with security group %s", p.ID, groupID) - - return n.ID, p.ID -} - -func deleteSecGroup(t *testing.T, groupID string) { - res := rsGroups.Delete(Client, groupID) - th.AssertNoErr(t, res.Err) - t.Logf("Deleted security group %s", groupID) -} - -func createSecRule(t *testing.T, groupID string) string { - r, err := rsRules.Create(Client, osRules.CreateOpts{ - Direction: "ingress", - PortRangeMin: 80, - EtherType: "IPv4", - PortRangeMax: 80, - Protocol: "tcp", - SecGroupID: groupID, - }).Extract() - - th.AssertNoErr(t, err) - - t.Logf("Created security group rule %s", r.ID) - - return r.ID -} - -func listSecRules(t *testing.T) { - err := rsRules.List(Client, osRules.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - list, err := osRules.ExtractRules(page) - if err != nil { - t.Errorf("Failed to extract sec rules: %v", err) - return false, err - } - - for _, r := range list { - t.Logf("Listing security rule: ID [%s]", r.ID) - } - - return true, nil - }) - - th.AssertNoErr(t, err) -} - -func getSecRule(t *testing.T, id string) { - r, err := rsRules.Get(Client, id).Extract() - th.AssertNoErr(t, err) - t.Logf("Getting security rule: ID [%s] Direction [%s] EtherType [%s] Protocol [%s]", - r.ID, r.Direction, r.EtherType, r.Protocol) -} - -func deleteSecRule(t *testing.T, id string) { - res := rsRules.Delete(Client, id) - th.AssertNoErr(t, res.Err) - t.Logf("Deleted security rule %s", id) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/networking/v2/subnet_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/networking/v2/subnet_test.go deleted file mode 100644 index c4014320a4..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/networking/v2/subnet_test.go +++ /dev/null @@ -1,84 +0,0 @@ -// +build acceptance networking - -package v2 - -import ( - "testing" - - osNetworks "github.com/rackspace/gophercloud/openstack/networking/v2/networks" - osSubnets "github.com/rackspace/gophercloud/openstack/networking/v2/subnets" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/networking/v2/networks" - "github.com/rackspace/gophercloud/rackspace/networking/v2/subnets" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestListSubnets(t *testing.T) { - Setup(t) - defer Teardown() - - pager := subnets.List(Client, osSubnets.ListOpts{Limit: 2}) - err := pager.EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page ---") - - subnetList, err := osSubnets.ExtractSubnets(page) - th.AssertNoErr(t, err) - - for _, s := range subnetList { - t.Logf("Subnet: ID [%s] Name [%s] IP Version [%d] CIDR [%s] GatewayIP [%s]", - s.ID, s.Name, s.IPVersion, s.CIDR, s.GatewayIP) - } - - return true, nil - }) - th.CheckNoErr(t, err) -} - -func TestSubnetCRUD(t *testing.T) { - Setup(t) - defer Teardown() - - // Setup network - t.Log("Setting up network") - n, err := networks.Create(Client, osNetworks.CreateOpts{Name: "tmp_network", AdminStateUp: osNetworks.Up}).Extract() - th.AssertNoErr(t, err) - networkID := n.ID - defer networks.Delete(Client, networkID) - - // Create subnet - t.Log("Create subnet") - enable := false - opts := osSubnets.CreateOpts{ - NetworkID: networkID, - CIDR: "192.168.199.0/24", - IPVersion: osSubnets.IPv4, - Name: "my_subnet", - EnableDHCP: &enable, - } - s, err := subnets.Create(Client, opts).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, networkID, s.NetworkID) - th.AssertEquals(t, "192.168.199.0/24", s.CIDR) - th.AssertEquals(t, 4, s.IPVersion) - th.AssertEquals(t, "my_subnet", s.Name) - th.AssertEquals(t, false, s.EnableDHCP) - subnetID := s.ID - - // Get subnet - t.Log("Getting subnet") - s, err = subnets.Get(Client, subnetID).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, subnetID, s.ID) - - // Update subnet - t.Log("Update subnet") - s, err = subnets.Update(Client, subnetID, osSubnets.UpdateOpts{Name: "new_subnet_name"}).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, "new_subnet_name", s.Name) - - // Delete subnet - t.Log("Delete subnet") - res := subnets.Delete(Client, subnetID) - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/accounts_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/accounts_test.go deleted file mode 100644 index 8b3cde45e4..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/accounts_test.go +++ /dev/null @@ -1,38 +0,0 @@ -// +build acceptance rackspace - -package v1 - -import ( - "testing" - - raxAccounts "github.com/rackspace/gophercloud/rackspace/objectstorage/v1/accounts" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestAccounts(t *testing.T) { - c, err := createClient(t, false) - th.AssertNoErr(t, err) - - updateHeaders, err := raxAccounts.Update(c, raxAccounts.UpdateOpts{Metadata: map[string]string{"white": "mountains"}}).Extract() - th.AssertNoErr(t, err) - t.Logf("Update Account Response Headers: %+v\n", updateHeaders) - defer func() { - updateres := raxAccounts.Update(c, raxAccounts.UpdateOpts{Metadata: map[string]string{"white": ""}}) - th.AssertNoErr(t, updateres.Err) - metadata, err := raxAccounts.Get(c).ExtractMetadata() - th.AssertNoErr(t, err) - t.Logf("Metadata from Get Account request (after update reverted): %+v\n", metadata) - th.CheckEquals(t, metadata["White"], "") - }() - - getResp := raxAccounts.Get(c) - th.AssertNoErr(t, getResp.Err) - - getHeaders, _ := getResp.Extract() - t.Logf("Get Account Response Headers: %+v\n", getHeaders) - - metadata, _ := getResp.ExtractMetadata() - t.Logf("Metadata from Get Account request (after update): %+v\n", metadata) - - th.CheckEquals(t, metadata["White"], "mountains") -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/bulk_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/bulk_test.go deleted file mode 100644 index 79013a564a..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/bulk_test.go +++ /dev/null @@ -1,23 +0,0 @@ -// +build acceptance rackspace objectstorage v1 - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud/rackspace/objectstorage/v1/bulk" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestBulk(t *testing.T) { - c, err := createClient(t, false) - th.AssertNoErr(t, err) - - var options bulk.DeleteOpts - options = append(options, "container/object1") - res := bulk.Delete(c, options) - th.AssertNoErr(t, res.Err) - body, err := res.ExtractBody() - th.AssertNoErr(t, err) - t.Logf("Response body from Bulk Delete Request: %+v\n", body) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/cdncontainers_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/cdncontainers_test.go deleted file mode 100644 index 0f56f4978a..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/cdncontainers_test.go +++ /dev/null @@ -1,66 +0,0 @@ -// +build acceptance rackspace objectstorage v1 - -package v1 - -import ( - "testing" - - osContainers "github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers" - "github.com/rackspace/gophercloud/pagination" - raxCDNContainers "github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdncontainers" - raxContainers "github.com/rackspace/gophercloud/rackspace/objectstorage/v1/containers" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestCDNContainers(t *testing.T) { - raxClient, err := createClient(t, false) - th.AssertNoErr(t, err) - - createres := raxContainers.Create(raxClient, "gophercloud-test", nil) - th.AssertNoErr(t, createres.Err) - t.Logf("Headers from Create Container request: %+v\n", createres.Header) - defer func() { - res := raxContainers.Delete(raxClient, "gophercloud-test") - th.AssertNoErr(t, res.Err) - }() - - raxCDNClient, err := createClient(t, true) - th.AssertNoErr(t, err) - enableRes := raxCDNContainers.Enable(raxCDNClient, "gophercloud-test", raxCDNContainers.EnableOpts{CDNEnabled: true, TTL: 900}) - t.Logf("Header map from Enable CDN Container request: %+v\n", enableRes.Header) - enableHeader, err := enableRes.Extract() - th.AssertNoErr(t, err) - t.Logf("Headers from Enable CDN Container request: %+v\n", enableHeader) - - t.Logf("Container Names available to the currently issued token:") - count := 0 - err = raxCDNContainers.List(raxCDNClient, &osContainers.ListOpts{Full: false}).EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page %02d ---", count) - - names, err := raxCDNContainers.ExtractNames(page) - th.AssertNoErr(t, err) - - for i, name := range names { - t.Logf("[%02d] %s", i, name) - } - - count++ - return true, nil - }) - th.AssertNoErr(t, err) - if count == 0 { - t.Errorf("No CDN containers listed for your current token.") - } - - updateOpts := raxCDNContainers.UpdateOpts{XCDNEnabled: raxCDNContainers.Disabled, XLogRetention: raxCDNContainers.Enabled} - updateHeader, err := raxCDNContainers.Update(raxCDNClient, "gophercloud-test", updateOpts).Extract() - th.AssertNoErr(t, err) - t.Logf("Headers from Update CDN Container request: %+v\n", updateHeader) - - getRes := raxCDNContainers.Get(raxCDNClient, "gophercloud-test") - getHeader, err := getRes.Extract() - th.AssertNoErr(t, err) - t.Logf("Headers from Get CDN Container request (after update): %+v\n", getHeader) - metadata, err := getRes.ExtractMetadata() - t.Logf("Metadata from Get CDN Container request (after update): %+v\n", metadata) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/cdnobjects_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/cdnobjects_test.go deleted file mode 100644 index 0c0ab8a1ed..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/cdnobjects_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// +build acceptance rackspace objectstorage v1 - -package v1 - -import ( - "bytes" - "testing" - - raxCDNContainers "github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdncontainers" - raxCDNObjects "github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdnobjects" - raxContainers "github.com/rackspace/gophercloud/rackspace/objectstorage/v1/containers" - raxObjects "github.com/rackspace/gophercloud/rackspace/objectstorage/v1/objects" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestCDNObjects(t *testing.T) { - raxClient, err := createClient(t, false) - th.AssertNoErr(t, err) - - createContResult := raxContainers.Create(raxClient, "gophercloud-test", nil) - th.AssertNoErr(t, createContResult.Err) - t.Logf("Headers from Create Container request: %+v\n", createContResult.Header) - defer func() { - deleteResult := raxContainers.Delete(raxClient, "gophercloud-test") - th.AssertNoErr(t, deleteResult.Err) - }() - - header, err := raxObjects.Create(raxClient, "gophercloud-test", "test-object", bytes.NewBufferString("gophercloud cdn test"), nil).ExtractHeader() - th.AssertNoErr(t, err) - t.Logf("Headers from Create Object request: %+v\n", header) - defer func() { - deleteResult := raxObjects.Delete(raxClient, "gophercloud-test", "test-object", nil) - th.AssertNoErr(t, deleteResult.Err) - }() - - raxCDNClient, err := createClient(t, true) - th.AssertNoErr(t, err) - - enableHeader, err := raxCDNContainers.Enable(raxCDNClient, "gophercloud-test", raxCDNContainers.EnableOpts{CDNEnabled: true, TTL: 900}).Extract() - th.AssertNoErr(t, err) - t.Logf("Headers from Enable CDN Container request: %+v\n", enableHeader) - - objCDNURL, err := raxCDNObjects.CDNURL(raxCDNClient, "gophercloud-test", "test-object") - th.AssertNoErr(t, err) - t.Logf("%s CDN URL: %s\n", "test_object", objCDNURL) - - deleteHeader, err := raxCDNObjects.Delete(raxCDNClient, "gophercloud-test", "test-object", nil).Extract() - th.AssertNoErr(t, err) - t.Logf("Headers from Delete CDN Object request: %+v\n", deleteHeader) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/containers_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/containers_test.go deleted file mode 100644 index c89551373f..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/containers_test.go +++ /dev/null @@ -1,90 +0,0 @@ -// +build acceptance rackspace objectstorage v1 - -package v1 - -import ( - "testing" - - osContainers "github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers" - "github.com/rackspace/gophercloud/pagination" - raxContainers "github.com/rackspace/gophercloud/rackspace/objectstorage/v1/containers" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestContainers(t *testing.T) { - c, err := createClient(t, false) - th.AssertNoErr(t, err) - - t.Logf("Containers Info available to the currently issued token:") - count := 0 - err = raxContainers.List(c, &osContainers.ListOpts{Full: true}).EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page %02d ---", count) - - containers, err := raxContainers.ExtractInfo(page) - th.AssertNoErr(t, err) - - for i, container := range containers { - t.Logf("[%02d] name=[%s]", i, container.Name) - t.Logf(" count=[%d]", container.Count) - t.Logf(" bytes=[%d]", container.Bytes) - } - - count++ - return true, nil - }) - th.AssertNoErr(t, err) - if count == 0 { - t.Errorf("No containers listed for your current token.") - } - - t.Logf("Container Names available to the currently issued token:") - count = 0 - err = raxContainers.List(c, &osContainers.ListOpts{Full: false}).EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page %02d ---", count) - - names, err := raxContainers.ExtractNames(page) - th.AssertNoErr(t, err) - - for i, name := range names { - t.Logf("[%02d] %s", i, name) - } - - count++ - return true, nil - }) - th.AssertNoErr(t, err) - if count == 0 { - t.Errorf("No containers listed for your current token.") - } - - createHeader, err := raxContainers.Create(c, "gophercloud-test", nil).Extract() - th.AssertNoErr(t, err) - t.Logf("Headers from Create Container request: %+v\n", createHeader) - defer func() { - deleteres := raxContainers.Delete(c, "gophercloud-test") - deleteHeader, err := deleteres.Extract() - th.AssertNoErr(t, err) - t.Logf("Headers from Delete Container request: %+v\n", deleteres.Header) - t.Logf("Headers from Delete Container request: %+v\n", deleteHeader) - }() - - updateHeader, err := raxContainers.Update(c, "gophercloud-test", raxContainers.UpdateOpts{Metadata: map[string]string{"white": "mountains"}}).Extract() - th.AssertNoErr(t, err) - t.Logf("Headers from Update Container request: %+v\n", updateHeader) - defer func() { - res := raxContainers.Update(c, "gophercloud-test", raxContainers.UpdateOpts{Metadata: map[string]string{"white": ""}}) - th.AssertNoErr(t, res.Err) - metadata, err := raxContainers.Get(c, "gophercloud-test").ExtractMetadata() - th.AssertNoErr(t, err) - t.Logf("Metadata from Get Container request (after update reverted): %+v\n", metadata) - th.CheckEquals(t, metadata["White"], "") - }() - - getres := raxContainers.Get(c, "gophercloud-test") - getHeader, err := getres.Extract() - th.AssertNoErr(t, err) - t.Logf("Headers from Get Container request (after update): %+v\n", getHeader) - metadata, err := getres.ExtractMetadata() - t.Logf("Metadata from Get Container request (after update): %+v\n", metadata) - th.CheckEquals(t, metadata["White"], "mountains") -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/objects_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/objects_test.go deleted file mode 100644 index 585dea7696..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/objectstorage/v1/objects_test.go +++ /dev/null @@ -1,124 +0,0 @@ -// +build acceptance rackspace objectstorage v1 - -package v1 - -import ( - "bytes" - "testing" - - osObjects "github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects" - "github.com/rackspace/gophercloud/pagination" - raxContainers "github.com/rackspace/gophercloud/rackspace/objectstorage/v1/containers" - raxObjects "github.com/rackspace/gophercloud/rackspace/objectstorage/v1/objects" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestObjects(t *testing.T) { - c, err := createClient(t, false) - th.AssertNoErr(t, err) - - res := raxContainers.Create(c, "gophercloud-test", nil) - th.AssertNoErr(t, res.Err) - - defer func() { - t.Logf("Deleting container...") - res := raxContainers.Delete(c, "gophercloud-test") - th.AssertNoErr(t, res.Err) - }() - - content := bytes.NewBufferString("Lewis Carroll") - options := &osObjects.CreateOpts{ContentType: "text/plain"} - createres := raxObjects.Create(c, "gophercloud-test", "o1", content, options) - th.AssertNoErr(t, createres.Err) - - defer func() { - t.Logf("Deleting object o1...") - res := raxObjects.Delete(c, "gophercloud-test", "o1", nil) - th.AssertNoErr(t, res.Err) - }() - - t.Logf("Objects Info available to the currently issued token:") - count := 0 - err = raxObjects.List(c, "gophercloud-test", &osObjects.ListOpts{Full: true}).EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page %02d ---", count) - - objects, err := raxObjects.ExtractInfo(page) - th.AssertNoErr(t, err) - - for i, object := range objects { - t.Logf("[%02d] name=[%s]", i, object.Name) - t.Logf(" content-type=[%s]", object.ContentType) - t.Logf(" bytes=[%d]", object.Bytes) - t.Logf(" last-modified=[%s]", object.LastModified) - t.Logf(" hash=[%s]", object.Hash) - } - - count++ - return true, nil - }) - th.AssertNoErr(t, err) - if count == 0 { - t.Errorf("No objects listed for your current token.") - } - t.Logf("Container Names available to the currently issued token:") - count = 0 - err = raxObjects.List(c, "gophercloud-test", &osObjects.ListOpts{Full: false}).EachPage(func(page pagination.Page) (bool, error) { - t.Logf("--- Page %02d ---", count) - - names, err := raxObjects.ExtractNames(page) - th.AssertNoErr(t, err) - - for i, name := range names { - t.Logf("[%02d] %s", i, name) - } - - count++ - return true, nil - }) - th.AssertNoErr(t, err) - if count == 0 { - t.Errorf("No objects listed for your current token.") - } - - copyres := raxObjects.Copy(c, "gophercloud-test", "o1", &raxObjects.CopyOpts{Destination: "gophercloud-test/o2"}) - th.AssertNoErr(t, copyres.Err) - defer func() { - t.Logf("Deleting object o2...") - res := raxObjects.Delete(c, "gophercloud-test", "o2", nil) - th.AssertNoErr(t, res.Err) - }() - - o1Content, err := raxObjects.Download(c, "gophercloud-test", "o1", nil).ExtractContent() - th.AssertNoErr(t, err) - o2Content, err := raxObjects.Download(c, "gophercloud-test", "o2", nil).ExtractContent() - th.AssertNoErr(t, err) - th.AssertEquals(t, string(o2Content), string(o1Content)) - - updateres := raxObjects.Update(c, "gophercloud-test", "o2", osObjects.UpdateOpts{Metadata: map[string]string{"white": "mountains"}}) - th.AssertNoErr(t, updateres.Err) - t.Logf("Headers from Update Account request: %+v\n", updateres.Header) - defer func() { - res := raxObjects.Update(c, "gophercloud-test", "o2", osObjects.UpdateOpts{Metadata: map[string]string{"white": ""}}) - th.AssertNoErr(t, res.Err) - metadata, err := raxObjects.Get(c, "gophercloud-test", "o2", nil).ExtractMetadata() - th.AssertNoErr(t, err) - t.Logf("Metadata from Get Account request (after update reverted): %+v\n", metadata) - th.CheckEquals(t, "", metadata["White"]) - }() - - getres := raxObjects.Get(c, "gophercloud-test", "o2", nil) - th.AssertNoErr(t, getres.Err) - t.Logf("Headers from Get Account request (after update): %+v\n", getres.Header) - metadata, err := getres.ExtractMetadata() - th.AssertNoErr(t, err) - t.Logf("Metadata from Get Account request (after update): %+v\n", metadata) - th.CheckEquals(t, "mountains", metadata["White"]) - - createTempURLOpts := osObjects.CreateTempURLOpts{ - Method: osObjects.GET, - TTL: 600, - } - tempURL, err := raxObjects.CreateTempURL(c, "gophercloud-test", "o1", createTempURLOpts) - th.AssertNoErr(t, err) - t.Logf("TempURL for object (%s): %s", "o1", tempURL) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/buildinfo_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/buildinfo_test.go deleted file mode 100644 index 42cc048e3b..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/buildinfo_test.go +++ /dev/null @@ -1,20 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud/rackspace/orchestration/v1/buildinfo" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestBuildInfo(t *testing.T) { - // Create a provider client for making the HTTP requests. - // See common.go in this directory for more information. - client := newClient(t) - - bi, err := buildinfo.Get(client).Extract() - th.AssertNoErr(t, err) - t.Logf("retrieved build info: %+v\n", bi) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/stackevents_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/stackevents_test.go deleted file mode 100644 index 9e3fc084ad..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/stackevents_test.go +++ /dev/null @@ -1,70 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - osStackEvents "github.com/rackspace/gophercloud/openstack/orchestration/v1/stackevents" - osStacks "github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/orchestration/v1/stackevents" - "github.com/rackspace/gophercloud/rackspace/orchestration/v1/stacks" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestStackEvents(t *testing.T) { - // Create a provider client for making the HTTP requests. - // See common.go in this directory for more information. - client := newClient(t) - - stackName := "postman_stack_2" - resourceName := "hello_world" - var eventID string - - createOpts := osStacks.CreateOpts{ - Name: stackName, - Template: template, - Timeout: 5, - } - stack, err := stacks.Create(client, createOpts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created stack: %+v\n", stack) - defer func() { - err := stacks.Delete(client, stackName, stack.ID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Deleted stack (%s)", stackName) - }() - err = gophercloud.WaitFor(60, func() (bool, error) { - getStack, err := stacks.Get(client, stackName, stack.ID).Extract() - if err != nil { - return false, err - } - if getStack.Status == "CREATE_COMPLETE" { - return true, nil - } - return false, nil - }) - - err = stackevents.List(client, stackName, stack.ID, nil).EachPage(func(page pagination.Page) (bool, error) { - events, err := osStackEvents.ExtractEvents(page) - th.AssertNoErr(t, err) - t.Logf("listed events: %+v\n", events) - eventID = events[0].ID - return false, nil - }) - th.AssertNoErr(t, err) - - err = stackevents.ListResourceEvents(client, stackName, stack.ID, resourceName, nil).EachPage(func(page pagination.Page) (bool, error) { - resourceEvents, err := osStackEvents.ExtractResourceEvents(page) - th.AssertNoErr(t, err) - t.Logf("listed resource events: %+v\n", resourceEvents) - return false, nil - }) - th.AssertNoErr(t, err) - - event, err := stackevents.Get(client, stackName, stack.ID, resourceName, eventID).Extract() - th.AssertNoErr(t, err) - t.Logf("retrieved event: %+v\n", event) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/stackresources_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/stackresources_test.go deleted file mode 100644 index 65926e78dc..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/stackresources_test.go +++ /dev/null @@ -1,64 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - osStackResources "github.com/rackspace/gophercloud/openstack/orchestration/v1/stackresources" - osStacks "github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/orchestration/v1/stackresources" - "github.com/rackspace/gophercloud/rackspace/orchestration/v1/stacks" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestStackResources(t *testing.T) { - // Create a provider client for making the HTTP requests. - // See common.go in this directory for more information. - client := newClient(t) - - stackName := "postman_stack_2" - - createOpts := osStacks.CreateOpts{ - Name: stackName, - Template: template, - Timeout: 5, - } - stack, err := stacks.Create(client, createOpts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created stack: %+v\n", stack) - defer func() { - err := stacks.Delete(client, stackName, stack.ID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Deleted stack (%s)", stackName) - }() - err = gophercloud.WaitFor(60, func() (bool, error) { - getStack, err := stacks.Get(client, stackName, stack.ID).Extract() - if err != nil { - return false, err - } - if getStack.Status == "CREATE_COMPLETE" { - return true, nil - } - return false, nil - }) - - resourceName := "hello_world" - resource, err := stackresources.Get(client, stackName, stack.ID, resourceName).Extract() - th.AssertNoErr(t, err) - t.Logf("Got stack resource: %+v\n", resource) - - metadata, err := stackresources.Metadata(client, stackName, stack.ID, resourceName).Extract() - th.AssertNoErr(t, err) - t.Logf("Got stack resource metadata: %+v\n", metadata) - - err = stackresources.List(client, stackName, stack.ID, nil).EachPage(func(page pagination.Page) (bool, error) { - resources, err := osStackResources.ExtractResources(page) - th.AssertNoErr(t, err) - t.Logf("resources: %+v\n", resources) - return false, nil - }) - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/stacks_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/stacks_test.go deleted file mode 100644 index 61969b52c5..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/stacks_test.go +++ /dev/null @@ -1,154 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - osStacks "github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/orchestration/v1/stacks" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestStacks(t *testing.T) { - // Create a provider client for making the HTTP requests. - // See common.go in this directory for more information. - client := newClient(t) - - stackName1 := "gophercloud-test-stack-2" - createOpts := osStacks.CreateOpts{ - Name: stackName1, - Template: template, - Timeout: 5, - } - stack, err := stacks.Create(client, createOpts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created stack: %+v\n", stack) - defer func() { - err := stacks.Delete(client, stackName1, stack.ID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Deleted stack (%s)", stackName1) - }() - err = gophercloud.WaitFor(60, func() (bool, error) { - getStack, err := stacks.Get(client, stackName1, stack.ID).Extract() - if err != nil { - return false, err - } - if getStack.Status == "CREATE_COMPLETE" { - return true, nil - } - return false, nil - }) - - updateOpts := osStacks.UpdateOpts{ - Template: template, - Timeout: 20, - } - err = stacks.Update(client, stackName1, stack.ID, updateOpts).ExtractErr() - th.AssertNoErr(t, err) - err = gophercloud.WaitFor(60, func() (bool, error) { - getStack, err := stacks.Get(client, stackName1, stack.ID).Extract() - if err != nil { - return false, err - } - if getStack.Status == "UPDATE_COMPLETE" { - return true, nil - } - return false, nil - }) - - t.Logf("Updated stack") - - err = stacks.List(client, nil).EachPage(func(page pagination.Page) (bool, error) { - stackList, err := osStacks.ExtractStacks(page) - th.AssertNoErr(t, err) - - t.Logf("Got stack list: %+v\n", stackList) - - return true, nil - }) - th.AssertNoErr(t, err) - - getStack, err := stacks.Get(client, stackName1, stack.ID).Extract() - th.AssertNoErr(t, err) - t.Logf("Got stack: %+v\n", getStack) - - abandonedStack, err := stacks.Abandon(client, stackName1, stack.ID).Extract() - th.AssertNoErr(t, err) - t.Logf("Abandonded stack %+v\n", abandonedStack) - th.AssertNoErr(t, err) -} - -// Test using the updated interface -func TestStacksNewTemplateFormat(t *testing.T) { - // Create a provider client for making the HTTP requests. - // See common.go in this directory for more information. - client := newClient(t) - - stackName1 := "gophercloud-test-stack-2" - templateOpts := new(osStacks.Template) - templateOpts.Bin = []byte(template) - createOpts := osStacks.CreateOpts{ - Name: stackName1, - TemplateOpts: templateOpts, - Timeout: 5, - } - stack, err := stacks.Create(client, createOpts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created stack: %+v\n", stack) - defer func() { - err := stacks.Delete(client, stackName1, stack.ID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Deleted stack (%s)", stackName1) - }() - err = gophercloud.WaitFor(60, func() (bool, error) { - getStack, err := stacks.Get(client, stackName1, stack.ID).Extract() - if err != nil { - return false, err - } - if getStack.Status == "CREATE_COMPLETE" { - return true, nil - } - return false, nil - }) - - updateOpts := osStacks.UpdateOpts{ - TemplateOpts: templateOpts, - Timeout: 20, - } - err = stacks.Update(client, stackName1, stack.ID, updateOpts).ExtractErr() - th.AssertNoErr(t, err) - err = gophercloud.WaitFor(60, func() (bool, error) { - getStack, err := stacks.Get(client, stackName1, stack.ID).Extract() - if err != nil { - return false, err - } - if getStack.Status == "UPDATE_COMPLETE" { - return true, nil - } - return false, nil - }) - - t.Logf("Updated stack") - - err = stacks.List(client, nil).EachPage(func(page pagination.Page) (bool, error) { - stackList, err := osStacks.ExtractStacks(page) - th.AssertNoErr(t, err) - - t.Logf("Got stack list: %+v\n", stackList) - - return true, nil - }) - th.AssertNoErr(t, err) - - getStack, err := stacks.Get(client, stackName1, stack.ID).Extract() - th.AssertNoErr(t, err) - t.Logf("Got stack: %+v\n", getStack) - - abandonedStack, err := stacks.Abandon(client, stackName1, stack.ID).Extract() - th.AssertNoErr(t, err) - t.Logf("Abandonded stack %+v\n", abandonedStack) - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/stacktemplates_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/stacktemplates_test.go deleted file mode 100644 index e4ccd9e6b1..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/orchestration/v1/stacktemplates_test.go +++ /dev/null @@ -1,77 +0,0 @@ -// +build acceptance - -package v1 - -import ( - "testing" - - "github.com/rackspace/gophercloud" - osStacks "github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks" - osStacktemplates "github.com/rackspace/gophercloud/openstack/orchestration/v1/stacktemplates" - "github.com/rackspace/gophercloud/rackspace/orchestration/v1/stacks" - "github.com/rackspace/gophercloud/rackspace/orchestration/v1/stacktemplates" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestStackTemplates(t *testing.T) { - // Create a provider client for making the HTTP requests. - // See common.go in this directory for more information. - client := newClient(t) - - stackName := "postman_stack_2" - - createOpts := osStacks.CreateOpts{ - Name: stackName, - Template: template, - Timeout: 5, - } - stack, err := stacks.Create(client, createOpts).Extract() - th.AssertNoErr(t, err) - t.Logf("Created stack: %+v\n", stack) - defer func() { - err := stacks.Delete(client, stackName, stack.ID).ExtractErr() - th.AssertNoErr(t, err) - t.Logf("Deleted stack (%s)", stackName) - }() - err = gophercloud.WaitFor(60, func() (bool, error) { - getStack, err := stacks.Get(client, stackName, stack.ID).Extract() - if err != nil { - return false, err - } - if getStack.Status == "CREATE_COMPLETE" { - return true, nil - } - return false, nil - }) - - tmpl, err := stacktemplates.Get(client, stackName, stack.ID).Extract() - th.AssertNoErr(t, err) - t.Logf("retrieved template: %+v\n", tmpl) - - validateOpts := osStacktemplates.ValidateOpts{ - Template: `{"heat_template_version": "2013-05-23", - "description": "Simple template to test heat commands", - "parameters": { - "flavor": { - "default": "m1.tiny", - "type": "string", - }, - }, - "resources": { - "hello_world": { - "type": "OS::Nova::Server", - "properties": { - "key_name": "heat_key", - "flavor": { - "get_param": "flavor", - }, - "image": "ad091b52-742f-469e-8f3c-fd81cadf0743", - "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n", - }, - }, - }, - }`} - validatedTemplate, err := stacktemplates.Validate(client, validateOpts).Extract() - th.AssertNoErr(t, err) - t.Logf("validated template: %+v\n", validatedTemplate) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/rackconnect/v3/cloudnetworks_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/rackconnect/v3/cloudnetworks_test.go deleted file mode 100644 index 2c6287e9f7..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/rackconnect/v3/cloudnetworks_test.go +++ /dev/null @@ -1,36 +0,0 @@ -// +build acceptance - -package v3 - -import ( - "fmt" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/rackspace/rackconnect/v3/cloudnetworks" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestCloudNetworks(t *testing.T) { - c := newClient(t) - cnID := testListNetworks(t, c) - testGetNetworks(t, c, cnID) -} - -func testListNetworks(t *testing.T, c *gophercloud.ServiceClient) string { - allPages, err := cloudnetworks.List(c).AllPages() - th.AssertNoErr(t, err) - allcn, err := cloudnetworks.ExtractCloudNetworks(allPages) - fmt.Printf("Listing all cloud networks: %+v\n\n", allcn) - var cnID string - if len(allcn) > 0 { - cnID = allcn[0].ID - } - return cnID -} - -func testGetNetworks(t *testing.T, c *gophercloud.ServiceClient, id string) { - cn, err := cloudnetworks.Get(c, id).Extract() - th.AssertNoErr(t, err) - fmt.Printf("Retrieved cloud network: %+v\n\n", cn) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/rackconnect/v3/lbpools_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/rackconnect/v3/lbpools_test.go deleted file mode 100644 index 85ac931b9c..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/rackconnect/v3/lbpools_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// +build acceptance - -package v3 - -import ( - "fmt" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/rackspace/rackconnect/v3/lbpools" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestLBPools(t *testing.T) { - c := newClient(t) - pID := testListPools(t, c) - testGetPools(t, c, pID) - nID := testListNodes(t, c, pID) - testListNodeDetails(t, c, pID) - testGetNode(t, c, pID, nID) - testGetNodeDetails(t, c, pID, nID) -} - -func testListPools(t *testing.T, c *gophercloud.ServiceClient) string { - allPages, err := lbpools.List(c).AllPages() - th.AssertNoErr(t, err) - allp, err := lbpools.ExtractPools(allPages) - fmt.Printf("Listing all LB pools: %+v\n\n", allp) - var pID string - if len(allp) > 0 { - pID = allp[0].ID - } - return pID -} - -func testGetPools(t *testing.T, c *gophercloud.ServiceClient, pID string) { - p, err := lbpools.Get(c, pID).Extract() - th.AssertNoErr(t, err) - fmt.Printf("Retrieved LB pool: %+v\n\n", p) -} - -func testListNodes(t *testing.T, c *gophercloud.ServiceClient, pID string) string { - allPages, err := lbpools.ListNodes(c, pID).AllPages() - th.AssertNoErr(t, err) - alln, err := lbpools.ExtractNodes(allPages) - fmt.Printf("Listing all LB pool nodes for pool (%s): %+v\n\n", pID, alln) - var nID string - if len(alln) > 0 { - nID = alln[0].ID - } - return nID -} - -func testListNodeDetails(t *testing.T, c *gophercloud.ServiceClient, pID string) { - allPages, err := lbpools.ListNodesDetails(c, pID).AllPages() - th.AssertNoErr(t, err) - alln, err := lbpools.ExtractNodesDetails(allPages) - fmt.Printf("Listing all LB pool nodes details for pool (%s): %+v\n\n", pID, alln) -} - -func testGetNode(t *testing.T, c *gophercloud.ServiceClient, pID, nID string) { - n, err := lbpools.GetNode(c, pID, nID).Extract() - th.AssertNoErr(t, err) - fmt.Printf("Retrieved LB node: %+v\n\n", n) -} - -func testGetNodeDetails(t *testing.T, c *gophercloud.ServiceClient, pID, nID string) { - n, err := lbpools.GetNodeDetails(c, pID, nID).Extract() - th.AssertNoErr(t, err) - fmt.Printf("Retrieved LB node details: %+v\n\n", n) -} diff --git a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/rackconnect/v3/publicips_test.go b/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/rackconnect/v3/publicips_test.go deleted file mode 100644 index 8dc62703ba..0000000000 --- a/vendor/github.com/rackspace/gophercloud/acceptance/rackspace/rackconnect/v3/publicips_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// +build acceptance - -package v3 - -import ( - "fmt" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/rackspace/rackconnect/v3/publicips" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestPublicIPs(t *testing.T) { - c := newClient(t) - ipID := testListIPs(t, c) - sID := testGetIP(t, c, ipID) - testListIPsForServer(t, c, sID) -} - -func testListIPs(t *testing.T, c *gophercloud.ServiceClient) string { - allPages, err := publicips.List(c).AllPages() - th.AssertNoErr(t, err) - allip, err := publicips.ExtractPublicIPs(allPages) - fmt.Printf("Listing all public IPs: %+v\n\n", allip) - var ipID string - if len(allip) > 0 { - ipID = allip[0].ID - } - return ipID -} - -func testGetIP(t *testing.T, c *gophercloud.ServiceClient, ipID string) string { - ip, err := publicips.Get(c, ipID).Extract() - th.AssertNoErr(t, err) - fmt.Printf("Retrieved public IP (%s): %+v\n\n", ipID, ip) - return ip.CloudServer.ID -} - -func testListIPsForServer(t *testing.T, c *gophercloud.ServiceClient, sID string) { - allPages, err := publicips.ListForServer(c, sID).AllPages() - th.AssertNoErr(t, err) - allip, err := publicips.ExtractPublicIPs(allPages) - fmt.Printf("Listing all public IPs for server (%s): %+v\n\n", sID, allip) -} diff --git a/vendor/github.com/rackspace/gophercloud/endpoint_search_test.go b/vendor/github.com/rackspace/gophercloud/endpoint_search_test.go deleted file mode 100644 index 3457453427..0000000000 --- a/vendor/github.com/rackspace/gophercloud/endpoint_search_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package gophercloud - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestApplyDefaultsToEndpointOpts(t *testing.T) { - eo := EndpointOpts{Availability: AvailabilityPublic} - eo.ApplyDefaults("compute") - expected := EndpointOpts{Availability: AvailabilityPublic, Type: "compute"} - th.CheckDeepEquals(t, expected, eo) - - eo = EndpointOpts{Type: "compute"} - eo.ApplyDefaults("object-store") - expected = EndpointOpts{Availability: AvailabilityPublic, Type: "compute"} - th.CheckDeepEquals(t, expected, eo) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/apiversions/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/apiversions/requests_test.go deleted file mode 100644 index 56b5e4fc72..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/apiversions/requests_test.go +++ /dev/null @@ -1,145 +0,0 @@ -package apiversions - -import ( - "fmt" - "net/http" - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListVersions(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", client.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, `{ - "versions": [ - { - "status": "CURRENT", - "updated": "2012-01-04T11:33:21Z", - "id": "v1.0", - "links": [ - { - "href": "http://23.253.228.211:8776/v1/", - "rel": "self" - } - ] - }, - { - "status": "CURRENT", - "updated": "2012-11-21T11:33:21Z", - "id": "v2.0", - "links": [ - { - "href": "http://23.253.228.211:8776/v2/", - "rel": "self" - } - ] - } - ] - }`) - }) - - count := 0 - - List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractAPIVersions(page) - if err != nil { - t.Errorf("Failed to extract API versions: %v", err) - return false, err - } - - expected := []APIVersion{ - APIVersion{ - ID: "v1.0", - Status: "CURRENT", - Updated: "2012-01-04T11:33:21Z", - }, - APIVersion{ - ID: "v2.0", - Status: "CURRENT", - Updated: "2012-11-21T11:33:21Z", - }, - } - - th.AssertDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestAPIInfo(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v1/", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", client.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, `{ - "version": { - "status": "CURRENT", - "updated": "2012-01-04T11:33:21Z", - "media-types": [ - { - "base": "application/xml", - "type": "application/vnd.openstack.volume+xml;version=1" - }, - { - "base": "application/json", - "type": "application/vnd.openstack.volume+json;version=1" - } - ], - "id": "v1.0", - "links": [ - { - "href": "http://23.253.228.211:8776/v1/", - "rel": "self" - }, - { - "href": "http://jorgew.github.com/block-storage-api/content/os-block-storage-1.0.pdf", - "type": "application/pdf", - "rel": "describedby" - }, - { - "href": "http://docs.rackspacecloud.com/servers/api/v1.1/application.wadl", - "type": "application/vnd.sun.wadl+xml", - "rel": "describedby" - } - ] - } - }`) - }) - - actual, err := Get(client.ServiceClient(), "v1").Extract() - if err != nil { - t.Errorf("Failed to extract version: %v", err) - } - - expected := APIVersion{ - ID: "v1.0", - Status: "CURRENT", - Updated: "2012-01-04T11:33:21Z", - } - - th.AssertEquals(t, actual.ID, expected.ID) - th.AssertEquals(t, actual.Status, expected.Status) - th.AssertEquals(t, actual.Updated, expected.Updated) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/apiversions/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/apiversions/urls_test.go deleted file mode 100644 index 37e91425b5..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/apiversions/urls_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package apiversions - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909/" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestGetURL(t *testing.T) { - actual := getURL(endpointClient(), "v1") - expected := endpoint + "v1/" - th.AssertEquals(t, expected, actual) -} - -func TestListURL(t *testing.T) { - actual := listURL(endpointClient()) - expected := endpoint - th.AssertEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/snapshots/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/snapshots/requests_test.go deleted file mode 100644 index d0f9e887e8..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/snapshots/requests_test.go +++ /dev/null @@ -1,104 +0,0 @@ -package snapshots - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - MockListResponse(t) - - count := 0 - - List(client.ServiceClient(), &ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractSnapshots(page) - if err != nil { - t.Errorf("Failed to extract snapshots: %v", err) - return false, err - } - - expected := []Snapshot{ - Snapshot{ - ID: "289da7f8-6440-407c-9fb4-7db01ec49164", - Name: "snapshot-001", - }, - Snapshot{ - ID: "96c3bda7-c82a-4f50-be73-ca7621794835", - Name: "snapshot-002", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - MockGetResponse(t) - - v, err := Get(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, v.Name, "snapshot-001") - th.AssertEquals(t, v.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - MockCreateResponse(t) - - options := CreateOpts{VolumeID: "1234", Name: "snapshot-001"} - n, err := Create(client.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.VolumeID, "1234") - th.AssertEquals(t, n.Name, "snapshot-001") - th.AssertEquals(t, n.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") -} - -func TestUpdateMetadata(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - MockUpdateMetadataResponse(t) - - expected := map[string]interface{}{"key": "v1"} - - options := &UpdateMetadataOpts{ - Metadata: map[string]interface{}{ - "key": "v1", - }, - } - - actual, err := UpdateMetadata(client.ServiceClient(), "123", options).ExtractMetadata() - - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, actual, expected) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - MockDeleteResponse(t) - - res := Delete(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/snapshots/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/snapshots/urls_test.go deleted file mode 100644 index feacf7f69b..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/snapshots/urls_test.go +++ /dev/null @@ -1,50 +0,0 @@ -package snapshots - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestCreateURL(t *testing.T) { - actual := createURL(endpointClient()) - expected := endpoint + "snapshots" - th.AssertEquals(t, expected, actual) -} - -func TestDeleteURL(t *testing.T) { - actual := deleteURL(endpointClient(), "foo") - expected := endpoint + "snapshots/foo" - th.AssertEquals(t, expected, actual) -} - -func TestGetURL(t *testing.T) { - actual := getURL(endpointClient(), "foo") - expected := endpoint + "snapshots/foo" - th.AssertEquals(t, expected, actual) -} - -func TestListURL(t *testing.T) { - actual := listURL(endpointClient()) - expected := endpoint + "snapshots" - th.AssertEquals(t, expected, actual) -} - -func TestMetadataURL(t *testing.T) { - actual := metadataURL(endpointClient(), "foo") - expected := endpoint + "snapshots/foo/metadata" - th.AssertEquals(t, expected, actual) -} - -func TestUpdateMetadataURL(t *testing.T) { - actual := updateMetadataURL(endpointClient(), "foo") - expected := endpoint + "snapshots/foo/metadata" - th.AssertEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes/requests_test.go deleted file mode 100644 index 75c2bbc596..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes/requests_test.go +++ /dev/null @@ -1,123 +0,0 @@ -package volumes - -import ( - "testing" - - fixtures "github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes/testing" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - fixtures.MockListResponse(t) - - count := 0 - - List(client.ServiceClient(), &ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractVolumes(page) - if err != nil { - t.Errorf("Failed to extract volumes: %v", err) - return false, err - } - - expected := []Volume{ - Volume{ - ID: "289da7f8-6440-407c-9fb4-7db01ec49164", - Name: "vol-001", - }, - Volume{ - ID: "96c3bda7-c82a-4f50-be73-ca7621794835", - Name: "vol-002", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestListAll(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - fixtures.MockListResponse(t) - - allPages, err := List(client.ServiceClient(), &ListOpts{}).AllPages() - th.AssertNoErr(t, err) - actual, err := ExtractVolumes(allPages) - th.AssertNoErr(t, err) - - expected := []Volume{ - Volume{ - ID: "289da7f8-6440-407c-9fb4-7db01ec49164", - Name: "vol-001", - }, - Volume{ - ID: "96c3bda7-c82a-4f50-be73-ca7621794835", - Name: "vol-002", - }, - } - - th.CheckDeepEquals(t, expected, actual) - -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - fixtures.MockGetResponse(t) - - v, err := Get(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, v.Name, "vol-001") - th.AssertEquals(t, v.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") - th.AssertEquals(t, v.Attachments[0]["device"], "/dev/vde") -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - fixtures.MockCreateResponse(t) - - options := &CreateOpts{Size: 75} - n, err := Create(client.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.Size, 4) - th.AssertEquals(t, n.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - fixtures.MockDeleteResponse(t) - - res := Delete(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22") - th.AssertNoErr(t, res.Err) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - fixtures.MockUpdateResponse(t) - - options := UpdateOpts{Name: "vol-002"} - v, err := Update(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22", options).Extract() - th.AssertNoErr(t, err) - th.CheckEquals(t, "vol-002", v.Name) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes/urls_test.go deleted file mode 100644 index a95270e14c..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes/urls_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package volumes - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestCreateURL(t *testing.T) { - actual := createURL(endpointClient()) - expected := endpoint + "volumes" - th.AssertEquals(t, expected, actual) -} - -func TestListURL(t *testing.T) { - actual := listURL(endpointClient()) - expected := endpoint + "volumes" - th.AssertEquals(t, expected, actual) -} - -func TestDeleteURL(t *testing.T) { - actual := deleteURL(endpointClient(), "foo") - expected := endpoint + "volumes/foo" - th.AssertEquals(t, expected, actual) -} - -func TestGetURL(t *testing.T) { - actual := getURL(endpointClient(), "foo") - expected := endpoint + "volumes/foo" - th.AssertEquals(t, expected, actual) -} - -func TestUpdateURL(t *testing.T) { - actual := updateURL(endpointClient(), "foo") - expected := endpoint + "volumes/foo" - th.AssertEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumetypes/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumetypes/requests_test.go deleted file mode 100644 index 8d40bfe1d4..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumetypes/requests_test.go +++ /dev/null @@ -1,118 +0,0 @@ -package volumetypes - -import ( - "fmt" - "net/http" - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - MockListResponse(t) - - count := 0 - - List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractVolumeTypes(page) - if err != nil { - t.Errorf("Failed to extract volume types: %v", err) - return false, err - } - - expected := []VolumeType{ - VolumeType{ - ID: "289da7f8-6440-407c-9fb4-7db01ec49164", - Name: "vol-type-001", - ExtraSpecs: map[string]interface{}{ - "capabilities": "gpu", - }, - }, - VolumeType{ - ID: "96c3bda7-c82a-4f50-be73-ca7621794835", - Name: "vol-type-002", - ExtraSpecs: map[string]interface{}{}, - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - MockGetResponse(t) - - vt, err := Get(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22").Extract() - th.AssertNoErr(t, err) - - th.AssertDeepEquals(t, vt.ExtraSpecs, map[string]interface{}{"serverNumber": "2"}) - th.AssertEquals(t, vt.Name, "vol-type-001") - th.AssertEquals(t, vt.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/types", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", client.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "volume_type": { - "name": "vol-type-001" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "volume_type": { - "name": "vol-type-001", - "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22" - } -} - `) - }) - - options := &CreateOpts{Name: "vol-type-001"} - n, err := Create(client.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.Name, "vol-type-001") - th.AssertEquals(t, n.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/types/d32019d3-bc6e-4319-9c1d-6722fc136a22", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", client.TokenID) - w.WriteHeader(http.StatusAccepted) - }) - - err := Delete(client.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22").ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumetypes/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumetypes/urls_test.go deleted file mode 100644 index 44016e2954..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumetypes/urls_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package volumetypes - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestListURL(t *testing.T) { - actual := listURL(endpointClient()) - expected := endpoint + "types" - th.AssertEquals(t, expected, actual) -} - -func TestCreateURL(t *testing.T) { - actual := createURL(endpointClient()) - expected := endpoint + "types" - th.AssertEquals(t, expected, actual) -} - -func TestGetURL(t *testing.T) { - actual := getURL(endpointClient(), "foo") - expected := endpoint + "types/foo" - th.AssertEquals(t, expected, actual) -} - -func TestDeleteURL(t *testing.T) { - actual := deleteURL(endpointClient(), "foo") - expected := endpoint + "types/foo" - th.AssertEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/cdn/v1/base/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/cdn/v1/base/requests_test.go deleted file mode 100644 index 2c20a71103..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/cdn/v1/base/requests_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package base - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestGetHomeDocument(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetSuccessfully(t) - - actual, err := Get(fake.ServiceClient()).Extract() - th.CheckNoErr(t, err) - - expected := HomeDocument{ - "rel/cdn": map[string]interface{}{ - "href-template": "services{?marker,limit}", - "href-vars": map[string]interface{}{ - "marker": "param/marker", - "limit": "param/limit", - }, - "hints": map[string]interface{}{ - "allow": []string{"GET"}, - "formats": map[string]interface{}{ - "application/json": map[string]interface{}{}, - }, - }, - }, - } - th.CheckDeepEquals(t, expected, *actual) -} - -func TestPing(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandlePingSuccessfully(t) - - err := Ping(fake.ServiceClient()).ExtractErr() - th.CheckNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/cdn/v1/flavors/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/cdn/v1/flavors/requests_test.go deleted file mode 100644 index f731738279..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/cdn/v1/flavors/requests_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package flavors - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - HandleListCDNFlavorsSuccessfully(t) - - count := 0 - - err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractFlavors(page) - if err != nil { - t.Errorf("Failed to extract flavors: %v", err) - return false, err - } - - expected := []Flavor{ - Flavor{ - ID: "europe", - Providers: []Provider{ - Provider{ - Provider: "Fastly", - Links: []gophercloud.Link{ - gophercloud.Link{ - Href: "http://www.fastly.com", - Rel: "provider_url", - }, - }, - }, - }, - Links: []gophercloud.Link{ - gophercloud.Link{ - Href: "https://www.poppycdn.io/v1.0/flavors/europe", - Rel: "self", - }, - }, - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - HandleGetCDNFlavorSuccessfully(t) - - expected := &Flavor{ - ID: "asia", - Providers: []Provider{ - Provider{ - Provider: "ChinaCache", - Links: []gophercloud.Link{ - gophercloud.Link{ - Href: "http://www.chinacache.com", - Rel: "provider_url", - }, - }, - }, - }, - Links: []gophercloud.Link{ - gophercloud.Link{ - Href: "https://www.poppycdn.io/v1.0/flavors/asia", - Rel: "self", - }, - }, - } - - actual, err := Get(fake.ServiceClient(), "asia").Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/cdn/v1/serviceassets/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/cdn/v1/serviceassets/requests_test.go deleted file mode 100644 index dde7bc171d..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/cdn/v1/serviceassets/requests_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package serviceassets - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - HandleDeleteCDNAssetSuccessfully(t) - - err := Delete(fake.ServiceClient(), "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0", nil).ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/cdn/v1/services/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/cdn/v1/services/requests_test.go deleted file mode 100644 index 59e826f048..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/cdn/v1/services/requests_test.go +++ /dev/null @@ -1,358 +0,0 @@ -package services - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - HandleListCDNServiceSuccessfully(t) - - count := 0 - - err := List(fake.ServiceClient(), &ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractServices(page) - if err != nil { - t.Errorf("Failed to extract services: %v", err) - return false, err - } - - expected := []Service{ - Service{ - ID: "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0", - Name: "mywebsite.com", - Domains: []Domain{ - Domain{ - Domain: "www.mywebsite.com", - }, - }, - Origins: []Origin{ - Origin{ - Origin: "mywebsite.com", - Port: 80, - SSL: false, - }, - }, - Caching: []CacheRule{ - CacheRule{ - Name: "default", - TTL: 3600, - }, - CacheRule{ - Name: "home", - TTL: 17200, - Rules: []TTLRule{ - TTLRule{ - Name: "index", - RequestURL: "/index.htm", - }, - }, - }, - CacheRule{ - Name: "images", - TTL: 12800, - Rules: []TTLRule{ - TTLRule{ - Name: "images", - RequestURL: "*.png", - }, - }, - }, - }, - Restrictions: []Restriction{ - Restriction{ - Name: "website only", - Rules: []RestrictionRule{ - RestrictionRule{ - Name: "mywebsite.com", - Referrer: "www.mywebsite.com", - }, - }, - }, - }, - FlavorID: "asia", - Status: "deployed", - Errors: []Error{}, - Links: []gophercloud.Link{ - gophercloud.Link{ - Href: "https://www.poppycdn.io/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0", - Rel: "self", - }, - gophercloud.Link{ - Href: "mywebsite.com.cdn123.poppycdn.net", - Rel: "access_url", - }, - gophercloud.Link{ - Href: "https://www.poppycdn.io/v1.0/flavors/asia", - Rel: "flavor", - }, - }, - }, - Service{ - ID: "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f1", - Name: "myothersite.com", - Domains: []Domain{ - Domain{ - Domain: "www.myothersite.com", - }, - }, - Origins: []Origin{ - Origin{ - Origin: "44.33.22.11", - Port: 80, - SSL: false, - }, - Origin{ - Origin: "77.66.55.44", - Port: 80, - SSL: false, - Rules: []OriginRule{ - OriginRule{ - Name: "videos", - RequestURL: "^/videos/*.m3u", - }, - }, - }, - }, - Caching: []CacheRule{ - CacheRule{ - Name: "default", - TTL: 3600, - }, - }, - Restrictions: []Restriction{}, - FlavorID: "europe", - Status: "deployed", - Links: []gophercloud.Link{ - gophercloud.Link{ - Href: "https://www.poppycdn.io/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f1", - Rel: "self", - }, - gophercloud.Link{ - Href: "myothersite.com.poppycdn.net", - Rel: "access_url", - }, - gophercloud.Link{ - Href: "https://www.poppycdn.io/v1.0/flavors/europe", - Rel: "flavor", - }, - }, - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - HandleCreateCDNServiceSuccessfully(t) - - createOpts := CreateOpts{ - Name: "mywebsite.com", - Domains: []Domain{ - Domain{ - Domain: "www.mywebsite.com", - }, - Domain{ - Domain: "blog.mywebsite.com", - }, - }, - Origins: []Origin{ - Origin{ - Origin: "mywebsite.com", - Port: 80, - SSL: false, - }, - }, - Restrictions: []Restriction{ - Restriction{ - Name: "website only", - Rules: []RestrictionRule{ - RestrictionRule{ - Name: "mywebsite.com", - Referrer: "www.mywebsite.com", - }, - }, - }, - }, - Caching: []CacheRule{ - CacheRule{ - Name: "default", - TTL: 3600, - }, - }, - FlavorID: "cdn", - } - - expected := "https://global.cdn.api.rackspacecloud.com/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0" - actual, err := Create(fake.ServiceClient(), createOpts).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, expected, actual) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - HandleGetCDNServiceSuccessfully(t) - - expected := &Service{ - ID: "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0", - Name: "mywebsite.com", - Domains: []Domain{ - Domain{ - Domain: "www.mywebsite.com", - Protocol: "http", - }, - }, - Origins: []Origin{ - Origin{ - Origin: "mywebsite.com", - Port: 80, - SSL: false, - }, - }, - Caching: []CacheRule{ - CacheRule{ - Name: "default", - TTL: 3600, - }, - CacheRule{ - Name: "home", - TTL: 17200, - Rules: []TTLRule{ - TTLRule{ - Name: "index", - RequestURL: "/index.htm", - }, - }, - }, - CacheRule{ - Name: "images", - TTL: 12800, - Rules: []TTLRule{ - TTLRule{ - Name: "images", - RequestURL: "*.png", - }, - }, - }, - }, - Restrictions: []Restriction{ - Restriction{ - Name: "website only", - Rules: []RestrictionRule{ - RestrictionRule{ - Name: "mywebsite.com", - Referrer: "www.mywebsite.com", - }, - }, - }, - }, - FlavorID: "cdn", - Status: "deployed", - Errors: []Error{}, - Links: []gophercloud.Link{ - gophercloud.Link{ - Href: "https://global.cdn.api.rackspacecloud.com/v1.0/110011/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0", - Rel: "self", - }, - gophercloud.Link{ - Href: "blog.mywebsite.com.cdn1.raxcdn.com", - Rel: "access_url", - }, - gophercloud.Link{ - Href: "https://global.cdn.api.rackspacecloud.com/v1.0/110011/flavors/cdn", - Rel: "flavor", - }, - }, - } - - actual, err := Get(fake.ServiceClient(), "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0").Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expected, actual) -} - -func TestSuccessfulUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - HandleUpdateCDNServiceSuccessfully(t) - - expected := "https://www.poppycdn.io/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0" - ops := UpdateOpts{ - // Append a single Domain - Append{Value: Domain{Domain: "appended.mocksite4.com"}}, - // Insert a single Domain - Insertion{ - Index: 4, - Value: Domain{Domain: "inserted.mocksite4.com"}, - }, - // Bulk addition - Append{ - Value: DomainList{ - Domain{Domain: "bulkadded1.mocksite4.com"}, - Domain{Domain: "bulkadded2.mocksite4.com"}, - }, - }, - // Replace a single Origin - Replacement{ - Index: 2, - Value: Origin{Origin: "44.33.22.11", Port: 80, SSL: false}, - }, - // Bulk replace Origins - Replacement{ - Index: 0, // Ignored - Value: OriginList{ - Origin{Origin: "44.33.22.11", Port: 80, SSL: false}, - Origin{Origin: "55.44.33.22", Port: 443, SSL: true}, - }, - }, - // Remove a single CacheRule - Removal{ - Index: 8, - Path: PathCaching, - }, - // Bulk removal - Removal{ - All: true, - Path: PathCaching, - }, - // Service name replacement - NameReplacement{ - NewName: "differentServiceName", - }, - } - - actual, err := Update(fake.ServiceClient(), "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0", ops).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, expected, actual) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - HandleDeleteCDNServiceSuccessfully(t) - - err := Delete(fake.ServiceClient(), "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0").ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/client_test.go b/vendor/github.com/rackspace/gophercloud/openstack/client_test.go deleted file mode 100644 index 257260c4e1..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/client_test.go +++ /dev/null @@ -1,161 +0,0 @@ -package openstack - -import ( - "fmt" - "net/http" - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestAuthenticatedClientV3(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - const ID = "0123456789" - - th.Mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, ` - { - "versions": { - "values": [ - { - "status": "stable", - "id": "v3.0", - "links": [ - { "href": "%s", "rel": "self" } - ] - }, - { - "status": "stable", - "id": "v2.0", - "links": [ - { "href": "%s", "rel": "self" } - ] - } - ] - } - } - `, th.Endpoint()+"v3/", th.Endpoint()+"v2.0/") - }) - - th.Mux.HandleFunc("/v3/auth/tokens", func(w http.ResponseWriter, r *http.Request) { - w.Header().Add("X-Subject-Token", ID) - - w.WriteHeader(http.StatusCreated) - fmt.Fprintf(w, `{ "token": { "expires_at": "2013-02-02T18:30:59.000000Z" } }`) - }) - - options := gophercloud.AuthOptions{ - UserID: "me", - Password: "secret", - IdentityEndpoint: th.Endpoint(), - } - client, err := AuthenticatedClient(options) - th.AssertNoErr(t, err) - th.CheckEquals(t, ID, client.TokenID) -} - -func TestAuthenticatedClientV2(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, ` - { - "versions": { - "values": [ - { - "status": "experimental", - "id": "v3.0", - "links": [ - { "href": "%s", "rel": "self" } - ] - }, - { - "status": "stable", - "id": "v2.0", - "links": [ - { "href": "%s", "rel": "self" } - ] - } - ] - } - } - `, th.Endpoint()+"v3/", th.Endpoint()+"v2.0/") - }) - - th.Mux.HandleFunc("/v2.0/tokens", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, ` - { - "access": { - "token": { - "id": "01234567890", - "expires": "2014-10-01T10:00:00.000000Z" - }, - "serviceCatalog": [ - { - "name": "Cloud Servers", - "type": "compute", - "endpoints": [ - { - "tenantId": "t1000", - "publicURL": "https://compute.north.host.com/v1/t1000", - "internalURL": "https://compute.north.internal/v1/t1000", - "region": "North", - "versionId": "1", - "versionInfo": "https://compute.north.host.com/v1/", - "versionList": "https://compute.north.host.com/" - }, - { - "tenantId": "t1000", - "publicURL": "https://compute.north.host.com/v1.1/t1000", - "internalURL": "https://compute.north.internal/v1.1/t1000", - "region": "North", - "versionId": "1.1", - "versionInfo": "https://compute.north.host.com/v1.1/", - "versionList": "https://compute.north.host.com/" - } - ], - "endpoints_links": [] - }, - { - "name": "Cloud Files", - "type": "object-store", - "endpoints": [ - { - "tenantId": "t1000", - "publicURL": "https://storage.north.host.com/v1/t1000", - "internalURL": "https://storage.north.internal/v1/t1000", - "region": "North", - "versionId": "1", - "versionInfo": "https://storage.north.host.com/v1/", - "versionList": "https://storage.north.host.com/" - }, - { - "tenantId": "t1000", - "publicURL": "https://storage.south.host.com/v1/t1000", - "internalURL": "https://storage.south.internal/v1/t1000", - "region": "South", - "versionId": "1", - "versionInfo": "https://storage.south.host.com/v1/", - "versionList": "https://storage.south.host.com/" - } - ] - } - ] - } - } - `) - }) - - options := gophercloud.AuthOptions{ - Username: "me", - Password: "secret", - IdentityEndpoint: th.Endpoint(), - } - client, err := AuthenticatedClient(options) - th.AssertNoErr(t, err) - th.CheckEquals(t, "01234567890", client.TokenID) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/common/extensions/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/common/extensions/requests_test.go deleted file mode 100644 index 6550283df7..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/common/extensions/requests_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package extensions - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListExtensionsSuccessfully(t) - - count := 0 - - List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractExtensions(page) - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, ExpectedExtensions, actual) - - return true, nil - }) - - th.CheckEquals(t, 1, count) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetExtensionSuccessfully(t) - - actual, err := Get(client.ServiceClient(), "agent").Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, SingleExtension, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/common/extensions/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/common/extensions/urls_test.go deleted file mode 100644 index 3223b1ca8b..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/common/extensions/urls_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package extensions - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909/" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestExtensionURL(t *testing.T) { - actual := ExtensionURL(endpointClient(), "agent") - expected := endpoint + "extensions/agent" - th.AssertEquals(t, expected, actual) -} - -func TestListExtensionURL(t *testing.T) { - actual := ListExtensionURL(endpointClient()) - expected := endpoint + "extensions" - th.AssertEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume/requests_test.go deleted file mode 100644 index 8a7fa74675..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume/requests_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package bootfromvolume - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestCreateOpts(t *testing.T) { - base := servers.CreateOpts{ - Name: "createdserver", - ImageRef: "asdfasdfasdf", - FlavorRef: "performance1-1", - } - - ext := CreateOptsExt{ - CreateOptsBuilder: base, - BlockDevice: []BlockDevice{ - BlockDevice{ - UUID: "123456", - SourceType: Image, - DestinationType: "volume", - VolumeSize: 10, - }, - }, - } - - expected := ` - { - "server": { - "name": "createdserver", - "imageRef": "asdfasdfasdf", - "flavorRef": "performance1-1", - "flavorName": "", - "imageName": "", - "block_device_mapping_v2":[ - { - "uuid":"123456", - "source_type":"image", - "destination_type":"volume", - "boot_index": "0", - "delete_on_termination": "false", - "volume_size": "10" - } - ] - } - } - ` - actual, err := ext.ToServerCreateMap() - th.AssertNoErr(t, err) - th.CheckJSONEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume/urls_test.go deleted file mode 100644 index 6ee647732d..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume/urls_test.go +++ /dev/null @@ -1,16 +0,0 @@ -package bootfromvolume - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestCreateURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - - th.CheckEquals(t, c.Endpoint+"os-volumes_boot", createURL(c)) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/defsecrules/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/defsecrules/requests_test.go deleted file mode 100644 index d4ebe87c56..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/defsecrules/requests_test.go +++ /dev/null @@ -1,100 +0,0 @@ -package defsecrules - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/secgroups" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -const ruleID = "{ruleID}" - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockListRulesResponse(t) - - count := 0 - - err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractDefaultRules(page) - th.AssertNoErr(t, err) - - expected := []DefaultRule{ - DefaultRule{ - FromPort: 80, - ID: ruleID, - IPProtocol: "TCP", - IPRange: secgroups.IPRange{CIDR: "10.10.10.0/24"}, - ToPort: 80, - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, count) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockCreateRuleResponse(t) - - opts := CreateOpts{ - IPProtocol: "TCP", - FromPort: 80, - ToPort: 80, - CIDR: "10.10.12.0/24", - } - - group, err := Create(client.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) - - expected := &DefaultRule{ - ID: ruleID, - FromPort: 80, - ToPort: 80, - IPProtocol: "TCP", - IPRange: secgroups.IPRange{CIDR: "10.10.12.0/24"}, - } - th.AssertDeepEquals(t, expected, group) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockGetRuleResponse(t, ruleID) - - group, err := Get(client.ServiceClient(), ruleID).Extract() - th.AssertNoErr(t, err) - - expected := &DefaultRule{ - ID: ruleID, - FromPort: 80, - ToPort: 80, - IPProtocol: "TCP", - IPRange: secgroups.IPRange{CIDR: "10.10.12.0/24"}, - } - - th.AssertDeepEquals(t, expected, group) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDeleteRuleResponse(t, ruleID) - - err := Delete(client.ServiceClient(), ruleID).ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/delegate_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/delegate_test.go deleted file mode 100644 index c3c525fa20..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/delegate_test.go +++ /dev/null @@ -1,96 +0,0 @@ -package extensions - -import ( - "fmt" - "net/http" - "testing" - - common "github.com/rackspace/gophercloud/openstack/common/extensions" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/extensions", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", client.TokenID) - - w.Header().Add("Content-Type", "application/json") - - fmt.Fprintf(w, ` -{ - "extensions": [ - { - "updated": "2013-01-20T00:00:00-00:00", - "name": "Neutron Service Type Management", - "links": [], - "namespace": "http://docs.openstack.org/ext/neutron/service-type/api/v1.0", - "alias": "service-type", - "description": "API for retrieving service providers for Neutron advanced services" - } - ] -} - `) - }) - - count := 0 - List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractExtensions(page) - th.AssertNoErr(t, err) - - expected := []common.Extension{ - common.Extension{ - Updated: "2013-01-20T00:00:00-00:00", - Name: "Neutron Service Type Management", - Links: []interface{}{}, - Namespace: "http://docs.openstack.org/ext/neutron/service-type/api/v1.0", - Alias: "service-type", - Description: "API for retrieving service providers for Neutron advanced services", - }, - } - th.AssertDeepEquals(t, expected, actual) - - return true, nil - }) - th.CheckEquals(t, 1, count) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/extensions/agent", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", client.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "extension": { - "updated": "2013-02-03T10:00:00-00:00", - "name": "agent", - "links": [], - "namespace": "http://docs.openstack.org/ext/agent/api/v2.0", - "alias": "agent", - "description": "The agent management extension." - } -} - `) - }) - - ext, err := Get(client.ServiceClient(), "agent").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, ext.Updated, "2013-02-03T10:00:00-00:00") - th.AssertEquals(t, ext.Name, "agent") - th.AssertEquals(t, ext.Namespace, "http://docs.openstack.org/ext/agent/api/v2.0") - th.AssertEquals(t, ext.Alias, "agent") - th.AssertEquals(t, ext.Description, "The agent management extension.") -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/diskconfig/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/diskconfig/requests_test.go deleted file mode 100644 index 17418a3ce3..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/diskconfig/requests_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package diskconfig - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestCreateOpts(t *testing.T) { - base := servers.CreateOpts{ - Name: "createdserver", - ImageRef: "asdfasdfasdf", - FlavorRef: "performance1-1", - } - - ext := CreateOptsExt{ - CreateOptsBuilder: base, - DiskConfig: Manual, - } - - expected := ` - { - "server": { - "name": "createdserver", - "imageRef": "asdfasdfasdf", - "flavorRef": "performance1-1", - "flavorName": "", - "imageName": "", - "OS-DCF:diskConfig": "MANUAL" - } - } - ` - actual, err := ext.ToServerCreateMap() - th.AssertNoErr(t, err) - th.CheckJSONEquals(t, expected, actual) -} - -func TestRebuildOpts(t *testing.T) { - base := servers.RebuildOpts{ - Name: "rebuiltserver", - AdminPass: "swordfish", - ImageID: "asdfasdfasdf", - } - - ext := RebuildOptsExt{ - RebuildOptsBuilder: base, - DiskConfig: Auto, - } - - actual, err := ext.ToServerRebuildMap() - th.AssertNoErr(t, err) - - expected := ` - { - "rebuild": { - "name": "rebuiltserver", - "imageRef": "asdfasdfasdf", - "adminPass": "swordfish", - "OS-DCF:diskConfig": "AUTO" - } - } - ` - th.CheckJSONEquals(t, expected, actual) -} - -func TestResizeOpts(t *testing.T) { - base := servers.ResizeOpts{ - FlavorRef: "performance1-8", - } - - ext := ResizeOptsExt{ - ResizeOptsBuilder: base, - DiskConfig: Auto, - } - - actual, err := ext.ToServerResizeMap() - th.AssertNoErr(t, err) - - expected := ` - { - "resize": { - "flavorRef": "performance1-8", - "OS-DCF:diskConfig": "AUTO" - } - } - ` - th.CheckJSONEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/diskconfig/results_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/diskconfig/results_test.go deleted file mode 100644 index dd8d2b7dfa..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/diskconfig/results_test.go +++ /dev/null @@ -1,68 +0,0 @@ -package diskconfig - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestExtractGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - servers.HandleServerGetSuccessfully(t) - - config, err := ExtractGet(servers.Get(client.ServiceClient(), "1234asdf")) - th.AssertNoErr(t, err) - th.CheckEquals(t, Manual, *config) -} - -func TestExtractUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - servers.HandleServerUpdateSuccessfully(t) - - r := servers.Update(client.ServiceClient(), "1234asdf", servers.UpdateOpts{ - Name: "new-name", - }) - config, err := ExtractUpdate(r) - th.AssertNoErr(t, err) - th.CheckEquals(t, Manual, *config) -} - -func TestExtractRebuild(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - servers.HandleRebuildSuccessfully(t, servers.SingleServerBody) - - r := servers.Rebuild(client.ServiceClient(), "1234asdf", servers.RebuildOpts{ - Name: "new-name", - AdminPass: "swordfish", - ImageID: "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/images/f90f6034-2570-4974-8351-6b49732ef2eb", - AccessIPv4: "1.2.3.4", - }) - config, err := ExtractRebuild(r) - th.AssertNoErr(t, err) - th.CheckEquals(t, Manual, *config) -} - -func TestExtractList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - servers.HandleServerListSuccessfully(t) - - pages := 0 - err := servers.List(client.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - config, err := ExtractDiskConfig(page, 0) - th.AssertNoErr(t, err) - th.CheckEquals(t, Manual, *config) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, pages, 1) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/floatingip/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/floatingip/requests_test.go deleted file mode 100644 index 4d86fe2463..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/floatingip/requests_test.go +++ /dev/null @@ -1,123 +0,0 @@ -package floatingip - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListSuccessfully(t) - - count := 0 - err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractFloatingIPs(page) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, ExpectedFloatingIPsSlice, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleCreateSuccessfully(t) - - actual, err := Create(client.ServiceClient(), CreateOpts{ - Pool: "nova", - }).Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &CreatedFloatingIP, actual) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetSuccessfully(t) - - actual, err := Get(client.ServiceClient(), "2").Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &SecondFloatingIP, actual) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleDeleteSuccessfully(t) - - err := Delete(client.ServiceClient(), "1").ExtractErr() - th.AssertNoErr(t, err) -} - -func TestAssociateDeprecated(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleAssociateSuccessfully(t) - serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0" - fip := "10.10.10.2" - - err := Associate(client.ServiceClient(), serverId, fip).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestAssociate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleAssociateSuccessfully(t) - - associateOpts := AssociateOpts{ - ServerID: "4d8c3732-a248-40ed-bebc-539a6ffd25c0", - FloatingIP: "10.10.10.2", - } - - err := AssociateInstance(client.ServiceClient(), associateOpts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestAssociateFixed(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleAssociateFixedSuccessfully(t) - - associateOpts := AssociateOpts{ - ServerID: "4d8c3732-a248-40ed-bebc-539a6ffd25c0", - FloatingIP: "10.10.10.2", - FixedIP: "166.78.185.201", - } - - err := AssociateInstance(client.ServiceClient(), associateOpts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestDisassociateDeprecated(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleDisassociateSuccessfully(t) - serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0" - fip := "10.10.10.2" - - err := Disassociate(client.ServiceClient(), serverId, fip).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestDisassociateInstance(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleDisassociateSuccessfully(t) - - associateOpts := AssociateOpts{ - ServerID: "4d8c3732-a248-40ed-bebc-539a6ffd25c0", - FloatingIP: "10.10.10.2", - } - - err := DisassociateInstance(client.ServiceClient(), associateOpts).ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/floatingip/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/floatingip/urls_test.go deleted file mode 100644 index f73d6fb0f9..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/floatingip/urls_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package floatingip - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - - th.CheckEquals(t, c.Endpoint+"os-floating-ips", listURL(c)) -} - -func TestCreateURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - - th.CheckEquals(t, c.Endpoint+"os-floating-ips", createURL(c)) -} - -func TestGetURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - id := "1" - - th.CheckEquals(t, c.Endpoint+"os-floating-ips/"+id, getURL(c, id)) -} - -func TestDeleteURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - id := "1" - - th.CheckEquals(t, c.Endpoint+"os-floating-ips/"+id, deleteURL(c, id)) -} - -func TestAssociateURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0" - - th.CheckEquals(t, c.Endpoint+"servers/"+serverId+"/action", associateURL(c, serverId)) -} - -func TestDisassociateURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0" - - th.CheckEquals(t, c.Endpoint+"servers/"+serverId+"/action", disassociateURL(c, serverId)) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/keypairs/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/keypairs/requests_test.go deleted file mode 100644 index 67d1833f57..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/keypairs/requests_test.go +++ /dev/null @@ -1,71 +0,0 @@ -package keypairs - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListSuccessfully(t) - - count := 0 - err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractKeyPairs(page) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, ExpectedKeyPairSlice, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleCreateSuccessfully(t) - - actual, err := Create(client.ServiceClient(), CreateOpts{ - Name: "createdkey", - }).Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &CreatedKeyPair, actual) -} - -func TestImport(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleImportSuccessfully(t) - - actual, err := Create(client.ServiceClient(), CreateOpts{ - Name: "importedkey", - PublicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDx8nkQv/zgGgB4rMYmIf+6A4l6Rr+o/6lHBQdW5aYd44bd8JttDCE/F/pNRr0lRE+PiqSPO8nDPHw0010JeMH9gYgnnFlyY3/OcJ02RhIPyyxYpv9FhY+2YiUkpwFOcLImyrxEsYXpD/0d3ac30bNH6Sw9JD9UZHYcpSxsIbECHw== Generated by Nova", - }).Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &ImportedKeyPair, actual) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetSuccessfully(t) - - actual, err := Get(client.ServiceClient(), "firstkey").Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &FirstKeyPair, actual) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleDeleteSuccessfully(t) - - err := Delete(client.ServiceClient(), "deletedkey").ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/keypairs/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/keypairs/urls_test.go deleted file mode 100644 index 60efd2a5d3..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/keypairs/urls_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package keypairs - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - - th.CheckEquals(t, c.Endpoint+"os-keypairs", listURL(c)) -} - -func TestCreateURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - - th.CheckEquals(t, c.Endpoint+"os-keypairs", createURL(c)) -} - -func TestGetURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - - th.CheckEquals(t, c.Endpoint+"os-keypairs/wat", getURL(c, "wat")) -} - -func TestDeleteURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - - th.CheckEquals(t, c.Endpoint+"os-keypairs/wat", deleteURL(c, "wat")) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/networks/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/networks/requests_test.go deleted file mode 100644 index 722b3f0bd0..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/networks/requests_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package networks - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListSuccessfully(t) - - count := 0 - err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractNetworks(page) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, ExpectedNetworkSlice, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetSuccessfully(t) - - actual, err := Get(client.ServiceClient(), "20c8acc0-f747-4d71-a389-46d078ebf000").Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &SecondNetwork, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/networks/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/networks/urls_test.go deleted file mode 100644 index be54c90a56..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/networks/urls_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package networks - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - - th.CheckEquals(t, c.Endpoint+"os-networks", listURL(c)) -} - -func TestGetURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - id := "1" - - th.CheckEquals(t, c.Endpoint+"os-networks/"+id, getURL(c, id)) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/schedulerhints/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/schedulerhints/requests_test.go deleted file mode 100644 index 9b38b35d9c..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/schedulerhints/requests_test.go +++ /dev/null @@ -1,130 +0,0 @@ -package schedulerhints - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestCreateOpts(t *testing.T) { - base := servers.CreateOpts{ - Name: "createdserver", - ImageRef: "asdfasdfasdf", - FlavorRef: "performance1-1", - } - - schedulerHints := SchedulerHints{ - Group: "101aed42-22d9-4a3e-9ba1-21103b0d1aba", - DifferentHost: []string{ - "a0cf03a5-d921-4877-bb5c-86d26cf818e1", - "8c19174f-4220-44f0-824a-cd1eeef10287", - }, - SameHost: []string{ - "a0cf03a5-d921-4877-bb5c-86d26cf818e1", - "8c19174f-4220-44f0-824a-cd1eeef10287", - }, - Query: []interface{}{">=", "$free_ram_mb", "1024"}, - TargetCell: "foobar", - BuildNearHostIP: "192.168.1.1/24", - } - - ext := CreateOptsExt{ - CreateOptsBuilder: base, - SchedulerHints: schedulerHints, - } - - expected := ` - { - "server": { - "name": "createdserver", - "imageRef": "asdfasdfasdf", - "flavorRef": "performance1-1", - "flavorName": "", - "imageName": "" - }, - "os:scheduler_hints": { - "group": "101aed42-22d9-4a3e-9ba1-21103b0d1aba", - "different_host": [ - "a0cf03a5-d921-4877-bb5c-86d26cf818e1", - "8c19174f-4220-44f0-824a-cd1eeef10287" - ], - "same_host": [ - "a0cf03a5-d921-4877-bb5c-86d26cf818e1", - "8c19174f-4220-44f0-824a-cd1eeef10287" - ], - "query": [ - ">=", "$free_ram_mb", "1024" - ], - "target_cell": "foobar", - "build_near_host_ip": "192.168.1.1", - "cidr": "/24" - } - } - ` - actual, err := ext.ToServerCreateMap() - th.AssertNoErr(t, err) - th.CheckJSONEquals(t, expected, actual) -} - -func TestCreateOptsWithComplexQuery(t *testing.T) { - base := servers.CreateOpts{ - Name: "createdserver", - ImageRef: "asdfasdfasdf", - FlavorRef: "performance1-1", - } - - schedulerHints := SchedulerHints{ - Group: "101aed42-22d9-4a3e-9ba1-21103b0d1aba", - DifferentHost: []string{ - "a0cf03a5-d921-4877-bb5c-86d26cf818e1", - "8c19174f-4220-44f0-824a-cd1eeef10287", - }, - SameHost: []string{ - "a0cf03a5-d921-4877-bb5c-86d26cf818e1", - "8c19174f-4220-44f0-824a-cd1eeef10287", - }, - Query: []interface{}{"and", []string{">=", "$free_ram_mb", "1024"}, []string{">=", "$free_disk_mb", "204800"}}, - TargetCell: "foobar", - BuildNearHostIP: "192.168.1.1/24", - } - - ext := CreateOptsExt{ - CreateOptsBuilder: base, - SchedulerHints: schedulerHints, - } - - expected := ` - { - "server": { - "name": "createdserver", - "imageRef": "asdfasdfasdf", - "flavorRef": "performance1-1", - "flavorName": "", - "imageName": "" - }, - "os:scheduler_hints": { - "group": "101aed42-22d9-4a3e-9ba1-21103b0d1aba", - "different_host": [ - "a0cf03a5-d921-4877-bb5c-86d26cf818e1", - "8c19174f-4220-44f0-824a-cd1eeef10287" - ], - "same_host": [ - "a0cf03a5-d921-4877-bb5c-86d26cf818e1", - "8c19174f-4220-44f0-824a-cd1eeef10287" - ], - "query": [ - "and", - [">=", "$free_ram_mb", "1024"], - [">=", "$free_disk_mb", "204800"] - ], - "target_cell": "foobar", - "build_near_host_ip": "192.168.1.1", - "cidr": "/24" - } - } - ` - actual, err := ext.ToServerCreateMap() - th.AssertNoErr(t, err) - th.CheckJSONEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/secgroups/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/secgroups/requests_test.go deleted file mode 100644 index 4e21d5deaa..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/secgroups/requests_test.go +++ /dev/null @@ -1,248 +0,0 @@ -package secgroups - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -const ( - serverID = "{serverID}" - groupID = "{groupID}" - ruleID = "{ruleID}" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockListGroupsResponse(t) - - count := 0 - - err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractSecurityGroups(page) - if err != nil { - t.Errorf("Failed to extract users: %v", err) - return false, err - } - - expected := []SecurityGroup{ - SecurityGroup{ - ID: groupID, - Description: "default", - Name: "default", - Rules: []Rule{}, - TenantID: "openstack", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, count) -} - -func TestListByServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockListGroupsByServerResponse(t, serverID) - - count := 0 - - err := ListByServer(client.ServiceClient(), serverID).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractSecurityGroups(page) - if err != nil { - t.Errorf("Failed to extract users: %v", err) - return false, err - } - - expected := []SecurityGroup{ - SecurityGroup{ - ID: groupID, - Description: "default", - Name: "default", - Rules: []Rule{}, - TenantID: "openstack", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, count) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockCreateGroupResponse(t) - - opts := CreateOpts{ - Name: "test", - Description: "something", - } - - group, err := Create(client.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) - - expected := &SecurityGroup{ - ID: groupID, - Name: "test", - Description: "something", - TenantID: "openstack", - Rules: []Rule{}, - } - th.AssertDeepEquals(t, expected, group) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockUpdateGroupResponse(t, groupID) - - opts := UpdateOpts{ - Name: "new_name", - Description: "new_desc", - } - - group, err := Update(client.ServiceClient(), groupID, opts).Extract() - th.AssertNoErr(t, err) - - expected := &SecurityGroup{ - ID: groupID, - Name: "new_name", - Description: "something", - TenantID: "openstack", - Rules: []Rule{}, - } - th.AssertDeepEquals(t, expected, group) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockGetGroupsResponse(t, groupID) - - group, err := Get(client.ServiceClient(), groupID).Extract() - th.AssertNoErr(t, err) - - expected := &SecurityGroup{ - ID: groupID, - Description: "default", - Name: "default", - TenantID: "openstack", - Rules: []Rule{ - Rule{ - FromPort: 80, - ToPort: 85, - IPProtocol: "TCP", - IPRange: IPRange{CIDR: "0.0.0.0"}, - Group: Group{TenantID: "openstack", Name: "default"}, - ParentGroupID: groupID, - ID: ruleID, - }, - }, - } - - th.AssertDeepEquals(t, expected, group) -} - -func TestGetNumericID(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - numericGroupID := 12345 - - mockGetNumericIDGroupResponse(t, numericGroupID) - - group, err := Get(client.ServiceClient(), "12345").Extract() - th.AssertNoErr(t, err) - - expected := &SecurityGroup{ID: "12345"} - th.AssertDeepEquals(t, expected, group) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDeleteGroupResponse(t, groupID) - - err := Delete(client.ServiceClient(), groupID).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestAddRule(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockAddRuleResponse(t) - - opts := CreateRuleOpts{ - ParentGroupID: groupID, - FromPort: 22, - ToPort: 22, - IPProtocol: "TCP", - CIDR: "0.0.0.0/0", - } - - rule, err := CreateRule(client.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) - - expected := &Rule{ - FromPort: 22, - ToPort: 22, - Group: Group{}, - IPProtocol: "TCP", - ParentGroupID: groupID, - IPRange: IPRange{CIDR: "0.0.0.0/0"}, - ID: ruleID, - } - - th.AssertDeepEquals(t, expected, rule) -} - -func TestDeleteRule(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDeleteRuleResponse(t, ruleID) - - err := DeleteRule(client.ServiceClient(), ruleID).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestAddServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockAddServerToGroupResponse(t, serverID) - - err := AddServerToGroup(client.ServiceClient(), serverID, "test").ExtractErr() - th.AssertNoErr(t, err) -} - -func TestRemoveServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockRemoveServerFromGroupResponse(t, serverID) - - err := RemoveServerFromGroup(client.ServiceClient(), serverID, "test").ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/servergroups/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/servergroups/requests_test.go deleted file mode 100644 index 07fec51b1b..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/servergroups/requests_test.go +++ /dev/null @@ -1,59 +0,0 @@ -package servergroups - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListSuccessfully(t) - - count := 0 - err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractServerGroups(page) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, ExpectedServerGroupSlice, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleCreateSuccessfully(t) - - actual, err := Create(client.ServiceClient(), CreateOpts{ - Name: "test", - Policies: []string{"anti-affinity"}, - }).Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &CreatedServerGroup, actual) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetSuccessfully(t) - - actual, err := Get(client.ServiceClient(), "4d8c3732-a248-40ed-bebc-539a6ffd25c0").Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &FirstServerGroup, actual) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleDeleteSuccessfully(t) - - err := Delete(client.ServiceClient(), "616fb98f-46ca-475e-917e-2563e5a8cd19").ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/servergroups/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/servergroups/urls_test.go deleted file mode 100644 index bff4dfc720..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/servergroups/urls_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package servergroups - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - - th.CheckEquals(t, c.Endpoint+"os-server-groups", listURL(c)) -} - -func TestCreateURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - - th.CheckEquals(t, c.Endpoint+"os-server-groups", createURL(c)) -} - -func TestGetURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - id := "1" - - th.CheckEquals(t, c.Endpoint+"os-server-groups/"+id, getURL(c, id)) -} - -func TestDeleteURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - id := "1" - - th.CheckEquals(t, c.Endpoint+"os-server-groups/"+id, deleteURL(c, id)) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/startstop/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/startstop/requests_test.go deleted file mode 100644 index 97a121b19a..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/startstop/requests_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package startstop - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -const serverID = "{serverId}" - -func TestStart(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockStartServerResponse(t, serverID) - - err := Start(client.ServiceClient(), serverID).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestStop(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockStopServerResponse(t, serverID) - - err := Stop(client.ServiceClient(), serverID).ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/tenantnetworks/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/tenantnetworks/requests_test.go deleted file mode 100644 index fc4ee4f4ba..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/tenantnetworks/requests_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package tenantnetworks - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListSuccessfully(t) - - count := 0 - err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractNetworks(page) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, ExpectedNetworkSlice, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetSuccessfully(t) - - actual, err := Get(client.ServiceClient(), "20c8acc0-f747-4d71-a389-46d078ebf000").Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &SecondNetwork, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/tenantnetworks/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/tenantnetworks/urls_test.go deleted file mode 100644 index 39c464e9fb..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/tenantnetworks/urls_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package tenantnetworks - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - - th.CheckEquals(t, c.Endpoint+"os-tenant-networks", listURL(c)) -} - -func TestGetURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - id := "1" - - th.CheckEquals(t, c.Endpoint+"os-tenant-networks/"+id, getURL(c, id)) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/volumeattach/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/volumeattach/requests_test.go deleted file mode 100644 index b0a765befa..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/volumeattach/requests_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package volumeattach - -import ( - "testing" - - fixtures "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/volumeattach/testing" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -// FirstVolumeAttachment is the first result in ListOutput. -var FirstVolumeAttachment = VolumeAttachment{ - Device: "/dev/vdd", - ID: "a26887c6-c47b-4654-abb5-dfadf7d3f803", - ServerID: "4d8c3732-a248-40ed-bebc-539a6ffd25c0", - VolumeID: "a26887c6-c47b-4654-abb5-dfadf7d3f803", -} - -// SecondVolumeAttachment is the first result in ListOutput. -var SecondVolumeAttachment = VolumeAttachment{ - Device: "/dev/vdc", - ID: "a26887c6-c47b-4654-abb5-dfadf7d3f804", - ServerID: "4d8c3732-a248-40ed-bebc-539a6ffd25c0", - VolumeID: "a26887c6-c47b-4654-abb5-dfadf7d3f804", -} - -// ExpectedVolumeAttachmentSlide is the slice of results that should be parsed -// from ListOutput, in the expected order. -var ExpectedVolumeAttachmentSlice = []VolumeAttachment{FirstVolumeAttachment, SecondVolumeAttachment} - -//CreatedVolumeAttachment is the parsed result from CreatedOutput. -var CreatedVolumeAttachment = VolumeAttachment{ - Device: "/dev/vdc", - ID: "a26887c6-c47b-4654-abb5-dfadf7d3f804", - ServerID: "4d8c3732-a248-40ed-bebc-539a6ffd25c0", - VolumeID: "a26887c6-c47b-4654-abb5-dfadf7d3f804", -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixtures.HandleListSuccessfully(t) - serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0" - - count := 0 - err := List(client.ServiceClient(), serverId).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractVolumeAttachments(page) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, ExpectedVolumeAttachmentSlice, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixtures.HandleCreateSuccessfully(t) - serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0" - - actual, err := Create(client.ServiceClient(), serverId, CreateOpts{ - Device: "/dev/vdc", - VolumeID: "a26887c6-c47b-4654-abb5-dfadf7d3f804", - }).Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &CreatedVolumeAttachment, actual) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixtures.HandleGetSuccessfully(t) - aId := "a26887c6-c47b-4654-abb5-dfadf7d3f804" - serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0" - - actual, err := Get(client.ServiceClient(), serverId, aId).Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &SecondVolumeAttachment, actual) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixtures.HandleDeleteSuccessfully(t) - aId := "a26887c6-c47b-4654-abb5-dfadf7d3f804" - serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0" - - err := Delete(client.ServiceClient(), serverId, aId).ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/volumeattach/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/volumeattach/urls_test.go deleted file mode 100644 index 8ee0e42d45..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/volumeattach/urls_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package volumeattach - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0" - - th.CheckEquals(t, c.Endpoint+"servers/"+serverId+"/os-volume_attachments", listURL(c, serverId)) -} - -func TestCreateURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0" - - th.CheckEquals(t, c.Endpoint+"servers/"+serverId+"/os-volume_attachments", createURL(c, serverId)) -} - -func TestGetURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0" - aId := "a26887c6-c47b-4654-abb5-dfadf7d3f804" - - th.CheckEquals(t, c.Endpoint+"servers/"+serverId+"/os-volume_attachments/"+aId, getURL(c, serverId, aId)) -} - -func TestDeleteURL(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - c := client.ServiceClient() - serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0" - aId := "a26887c6-c47b-4654-abb5-dfadf7d3f804" - - th.CheckEquals(t, c.Endpoint+"servers/"+serverId+"/os-volume_attachments/"+aId, deleteURL(c, serverId, aId)) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/flavors/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/flavors/requests_test.go deleted file mode 100644 index fbd7c33140..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/flavors/requests_test.go +++ /dev/null @@ -1,129 +0,0 @@ -package flavors - -import ( - "fmt" - "net/http" - "reflect" - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -const tokenID = "blerb" - -func TestListFlavors(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/flavors/detail", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - r.ParseForm() - marker := r.Form.Get("marker") - switch marker { - case "": - fmt.Fprintf(w, ` - { - "flavors": [ - { - "id": "1", - "name": "m1.tiny", - "disk": 1, - "ram": 512, - "vcpus": 1 - }, - { - "id": "2", - "name": "m2.small", - "disk": 10, - "ram": 1024, - "vcpus": 2 - } - ], - "flavors_links": [ - { - "href": "%s/flavors/detail?marker=2", - "rel": "next" - } - ] - } - `, th.Server.URL) - case "2": - fmt.Fprintf(w, `{ "flavors": [] }`) - default: - t.Fatalf("Unexpected marker: [%s]", marker) - } - }) - - pages := 0 - err := ListDetail(fake.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractFlavors(page) - if err != nil { - return false, err - } - - expected := []Flavor{ - Flavor{ID: "1", Name: "m1.tiny", Disk: 1, RAM: 512, VCPUs: 1}, - Flavor{ID: "2", Name: "m2.small", Disk: 10, RAM: 1024, VCPUs: 2}, - } - - if !reflect.DeepEqual(expected, actual) { - t.Errorf("Expected %#v, but was %#v", expected, actual) - } - - return true, nil - }) - if err != nil { - t.Fatal(err) - } - if pages != 1 { - t.Errorf("Expected one page, got %d", pages) - } -} - -func TestGetFlavor(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/flavors/12345", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - fmt.Fprintf(w, ` - { - "flavor": { - "id": "1", - "name": "m1.tiny", - "disk": 1, - "ram": 512, - "vcpus": 1, - "rxtx_factor": 1 - } - } - `) - }) - - actual, err := Get(fake.ServiceClient(), "12345").Extract() - if err != nil { - t.Fatalf("Unable to get flavor: %v", err) - } - - expected := &Flavor{ - ID: "1", - Name: "m1.tiny", - Disk: 1, - RAM: 512, - VCPUs: 1, - RxTxFactor: 1, - } - if !reflect.DeepEqual(expected, actual) { - t.Errorf("Expected %#v, but was %#v", expected, actual) - } -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/flavors/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/flavors/urls_test.go deleted file mode 100644 index 069da2496e..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/flavors/urls_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package flavors - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909/" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestGetURL(t *testing.T) { - actual := getURL(endpointClient(), "foo") - expected := endpoint + "flavors/foo" - th.CheckEquals(t, expected, actual) -} - -func TestListURL(t *testing.T) { - actual := listURL(endpointClient()) - expected := endpoint + "flavors/detail" - th.CheckEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/images/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/images/requests_test.go deleted file mode 100644 index 93a97bdc65..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/images/requests_test.go +++ /dev/null @@ -1,191 +0,0 @@ -package images - -import ( - "encoding/json" - "fmt" - "net/http" - "reflect" - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListImages(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/images/detail", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - r.ParseForm() - marker := r.Form.Get("marker") - switch marker { - case "": - fmt.Fprintf(w, ` - { - "images": [ - { - "status": "ACTIVE", - "updated": "2014-09-23T12:54:56Z", - "id": "f3e4a95d-1f4f-4989-97ce-f3a1fb8c04d7", - "OS-EXT-IMG-SIZE:size": 476704768, - "name": "F17-x86_64-cfntools", - "created": "2014-09-23T12:54:52Z", - "minDisk": 0, - "progress": 100, - "minRam": 0, - "metadata": {} - }, - { - "status": "ACTIVE", - "updated": "2014-09-23T12:51:43Z", - "id": "f90f6034-2570-4974-8351-6b49732ef2eb", - "OS-EXT-IMG-SIZE:size": 13167616, - "name": "cirros-0.3.2-x86_64-disk", - "created": "2014-09-23T12:51:42Z", - "minDisk": 0, - "progress": 100, - "minRam": 0, - "metadata": {} - } - ] - } - `) - case "2": - fmt.Fprintf(w, `{ "images": [] }`) - default: - t.Fatalf("Unexpected marker: [%s]", marker) - } - }) - - pages := 0 - options := &ListOpts{Limit: 2} - err := ListDetail(fake.ServiceClient(), options).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractImages(page) - if err != nil { - return false, err - } - - expected := []Image{ - Image{ - ID: "f3e4a95d-1f4f-4989-97ce-f3a1fb8c04d7", - Name: "F17-x86_64-cfntools", - Created: "2014-09-23T12:54:52Z", - Updated: "2014-09-23T12:54:56Z", - MinDisk: 0, - MinRAM: 0, - Progress: 100, - Status: "ACTIVE", - }, - Image{ - ID: "f90f6034-2570-4974-8351-6b49732ef2eb", - Name: "cirros-0.3.2-x86_64-disk", - Created: "2014-09-23T12:51:42Z", - Updated: "2014-09-23T12:51:43Z", - MinDisk: 0, - MinRAM: 0, - Progress: 100, - Status: "ACTIVE", - }, - } - - if !reflect.DeepEqual(expected, actual) { - t.Errorf("Unexpected page contents: expected %#v, got %#v", expected, actual) - } - - return false, nil - }) - - if err != nil { - t.Fatalf("EachPage error: %v", err) - } - if pages != 1 { - t.Errorf("Expected one page, got %d", pages) - } -} - -func TestGetImage(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/images/12345678", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - fmt.Fprintf(w, ` - { - "image": { - "status": "ACTIVE", - "updated": "2014-09-23T12:54:56Z", - "id": "f3e4a95d-1f4f-4989-97ce-f3a1fb8c04d7", - "OS-EXT-IMG-SIZE:size": 476704768, - "name": "F17-x86_64-cfntools", - "created": "2014-09-23T12:54:52Z", - "minDisk": 0, - "progress": 100, - "minRam": 0, - "metadata": {} - } - } - `) - }) - - actual, err := Get(fake.ServiceClient(), "12345678").Extract() - if err != nil { - t.Fatalf("Unexpected error from Get: %v", err) - } - - expected := &Image{ - Status: "ACTIVE", - Updated: "2014-09-23T12:54:56Z", - ID: "f3e4a95d-1f4f-4989-97ce-f3a1fb8c04d7", - Name: "F17-x86_64-cfntools", - Created: "2014-09-23T12:54:52Z", - MinDisk: 0, - Progress: 100, - MinRAM: 0, - } - - if !reflect.DeepEqual(expected, actual) { - t.Errorf("Expected %#v, but got %#v", expected, actual) - } -} - -func TestNextPageURL(t *testing.T) { - var page ImagePage - var body map[string]interface{} - bodyString := []byte(`{"images":{"links":[{"href":"http://192.154.23.87/12345/images/image3","rel":"bookmark"}]}, "images_links":[{"href":"http://192.154.23.87/12345/images/image4","rel":"next"}]}`) - err := json.Unmarshal(bodyString, &body) - if err != nil { - t.Fatalf("Error unmarshaling data into page body: %v", err) - } - page.Body = body - - expected := "http://192.154.23.87/12345/images/image4" - actual, err := page.NextPageURL() - th.AssertNoErr(t, err) - th.CheckEquals(t, expected, actual) -} - -// Test Image delete -func TestDeleteImage(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/images/12345678", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "12345678") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/images/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/images/urls_test.go deleted file mode 100644 index b1ab3d6790..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/images/urls_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package images - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909/" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestGetURL(t *testing.T) { - actual := getURL(endpointClient(), "foo") - expected := endpoint + "images/foo" - th.CheckEquals(t, expected, actual) -} - -func TestListDetailURL(t *testing.T) { - actual := listDetailURL(endpointClient()) - expected := endpoint + "images/detail" - th.CheckEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/servers/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/servers/requests_test.go deleted file mode 100644 index 88cb54dd7b..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/servers/requests_test.go +++ /dev/null @@ -1,373 +0,0 @@ -package servers - -import ( - "encoding/base64" - "encoding/json" - "net/http" - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListServers(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleServerListSuccessfully(t) - - pages := 0 - err := List(client.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractServers(page) - if err != nil { - return false, err - } - - if len(actual) != 2 { - t.Fatalf("Expected 2 servers, got %d", len(actual)) - } - th.CheckDeepEquals(t, ServerHerp, actual[0]) - th.CheckDeepEquals(t, ServerDerp, actual[1]) - - return true, nil - }) - - th.AssertNoErr(t, err) - - if pages != 1 { - t.Errorf("Expected 1 page, saw %d", pages) - } -} - -func TestListAllServers(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleServerListSuccessfully(t) - - allPages, err := List(client.ServiceClient(), ListOpts{}).AllPages() - th.AssertNoErr(t, err) - actual, err := ExtractServers(allPages) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, ServerHerp, actual[0]) - th.CheckDeepEquals(t, ServerDerp, actual[1]) -} - -func TestCreateServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleServerCreationSuccessfully(t, SingleServerBody) - - actual, err := Create(client.ServiceClient(), CreateOpts{ - Name: "derp", - ImageRef: "f90f6034-2570-4974-8351-6b49732ef2eb", - FlavorRef: "1", - }).Extract() - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, ServerDerp, *actual) -} - -func TestDeleteServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleServerDeletionSuccessfully(t) - - res := Delete(client.ServiceClient(), "asdfasdfasdf") - th.AssertNoErr(t, res.Err) -} - -func TestGetServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleServerGetSuccessfully(t) - - client := client.ServiceClient() - actual, err := Get(client, "1234asdf").Extract() - if err != nil { - t.Fatalf("Unexpected Get error: %v", err) - } - - th.CheckDeepEquals(t, ServerDerp, *actual) -} - -func TestUpdateServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleServerUpdateSuccessfully(t) - - client := client.ServiceClient() - actual, err := Update(client, "1234asdf", UpdateOpts{Name: "new-name"}).Extract() - if err != nil { - t.Fatalf("Unexpected Update error: %v", err) - } - - th.CheckDeepEquals(t, ServerDerp, *actual) -} - -func TestChangeServerAdminPassword(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleAdminPasswordChangeSuccessfully(t) - - res := ChangeAdminPassword(client.ServiceClient(), "1234asdf", "new-password") - th.AssertNoErr(t, res.Err) -} - -func TestRebootServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleRebootSuccessfully(t) - - res := Reboot(client.ServiceClient(), "1234asdf", SoftReboot) - th.AssertNoErr(t, res.Err) -} - -func TestRebuildServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleRebuildSuccessfully(t, SingleServerBody) - - opts := RebuildOpts{ - Name: "new-name", - AdminPass: "swordfish", - ImageID: "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/images/f90f6034-2570-4974-8351-6b49732ef2eb", - AccessIPv4: "1.2.3.4", - } - - actual, err := Rebuild(client.ServiceClient(), "1234asdf", opts).Extract() - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, ServerDerp, *actual) -} - -func TestResizeServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/servers/1234asdf/action", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", client.TokenID) - th.TestJSONRequest(t, r, `{ "resize": { "flavorRef": "2" } }`) - - w.WriteHeader(http.StatusAccepted) - }) - - res := Resize(client.ServiceClient(), "1234asdf", ResizeOpts{FlavorRef: "2"}) - th.AssertNoErr(t, res.Err) -} - -func TestConfirmResize(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/servers/1234asdf/action", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", client.TokenID) - th.TestJSONRequest(t, r, `{ "confirmResize": null }`) - - w.WriteHeader(http.StatusNoContent) - }) - - res := ConfirmResize(client.ServiceClient(), "1234asdf") - th.AssertNoErr(t, res.Err) -} - -func TestRevertResize(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/servers/1234asdf/action", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", client.TokenID) - th.TestJSONRequest(t, r, `{ "revertResize": null }`) - - w.WriteHeader(http.StatusAccepted) - }) - - res := RevertResize(client.ServiceClient(), "1234asdf") - th.AssertNoErr(t, res.Err) -} - -func TestRescue(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - HandleServerRescueSuccessfully(t) - - res := Rescue(client.ServiceClient(), "1234asdf", RescueOpts{ - AdminPass: "1234567890", - }) - th.AssertNoErr(t, res.Err) - adminPass, _ := res.Extract() - th.AssertEquals(t, "1234567890", adminPass) -} - -func TestGetMetadatum(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - HandleMetadatumGetSuccessfully(t) - - expected := map[string]string{"foo": "bar"} - actual, err := Metadatum(client.ServiceClient(), "1234asdf", "foo").Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expected, actual) -} - -func TestCreateMetadatum(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - HandleMetadatumCreateSuccessfully(t) - - expected := map[string]string{"foo": "bar"} - actual, err := CreateMetadatum(client.ServiceClient(), "1234asdf", MetadatumOpts{"foo": "bar"}).Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expected, actual) -} - -func TestDeleteMetadatum(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - HandleMetadatumDeleteSuccessfully(t) - - err := DeleteMetadatum(client.ServiceClient(), "1234asdf", "foo").ExtractErr() - th.AssertNoErr(t, err) -} - -func TestGetMetadata(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - HandleMetadataGetSuccessfully(t) - - expected := map[string]string{"foo": "bar", "this": "that"} - actual, err := Metadata(client.ServiceClient(), "1234asdf").Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expected, actual) -} - -func TestResetMetadata(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - HandleMetadataResetSuccessfully(t) - - expected := map[string]string{"foo": "bar", "this": "that"} - actual, err := ResetMetadata(client.ServiceClient(), "1234asdf", MetadataOpts{ - "foo": "bar", - "this": "that", - }).Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expected, actual) -} - -func TestUpdateMetadata(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - HandleMetadataUpdateSuccessfully(t) - - expected := map[string]string{"foo": "baz", "this": "those"} - actual, err := UpdateMetadata(client.ServiceClient(), "1234asdf", MetadataOpts{ - "foo": "baz", - "this": "those", - }).Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expected, actual) -} - -func TestListAddresses(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleAddressListSuccessfully(t) - - expected := ListAddressesExpected - pages := 0 - err := ListAddresses(client.ServiceClient(), "asdfasdfasdf").EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractAddresses(page) - th.AssertNoErr(t, err) - - if len(actual) != 2 { - t.Fatalf("Expected 2 networks, got %d", len(actual)) - } - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, pages) -} - -func TestListAddressesByNetwork(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleNetworkAddressListSuccessfully(t) - - expected := ListNetworkAddressesExpected - pages := 0 - err := ListAddressesByNetwork(client.ServiceClient(), "asdfasdfasdf", "public").EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractNetworkAddresses(page) - th.AssertNoErr(t, err) - - if len(actual) != 2 { - t.Fatalf("Expected 2 addresses, got %d", len(actual)) - } - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, pages) -} - -func TestCreateServerImage(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleCreateServerImageSuccessfully(t) - - _, err := CreateImage(client.ServiceClient(), "serverimage", CreateImageOpts{Name: "test"}).ExtractImageID() - th.AssertNoErr(t, err) -} - -func TestMarshalPersonality(t *testing.T) { - name := "/etc/test" - contents := []byte("asdfasdf") - - personality := Personality{ - &File{ - Path: name, - Contents: contents, - }, - } - - data, err := json.Marshal(personality) - if err != nil { - t.Fatal(err) - } - - var actual []map[string]string - err = json.Unmarshal(data, &actual) - if err != nil { - t.Fatal(err) - } - - if len(actual) != 1 { - t.Fatal("expected personality length 1") - } - - if actual[0]["path"] != name { - t.Fatal("file path incorrect") - } - - if actual[0]["contents"] != base64.StdEncoding.EncodeToString(contents) { - t.Fatal("file contents incorrect") - } -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/servers/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/servers/urls_test.go deleted file mode 100644 index 17a1d287f2..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/compute/v2/servers/urls_test.go +++ /dev/null @@ -1,68 +0,0 @@ -package servers - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestCreateURL(t *testing.T) { - actual := createURL(endpointClient()) - expected := endpoint + "servers" - th.CheckEquals(t, expected, actual) -} - -func TestListURL(t *testing.T) { - actual := listURL(endpointClient()) - expected := endpoint + "servers" - th.CheckEquals(t, expected, actual) -} - -func TestListDetailURL(t *testing.T) { - actual := listDetailURL(endpointClient()) - expected := endpoint + "servers/detail" - th.CheckEquals(t, expected, actual) -} - -func TestDeleteURL(t *testing.T) { - actual := deleteURL(endpointClient(), "foo") - expected := endpoint + "servers/foo" - th.CheckEquals(t, expected, actual) -} - -func TestGetURL(t *testing.T) { - actual := getURL(endpointClient(), "foo") - expected := endpoint + "servers/foo" - th.CheckEquals(t, expected, actual) -} - -func TestUpdateURL(t *testing.T) { - actual := updateURL(endpointClient(), "foo") - expected := endpoint + "servers/foo" - th.CheckEquals(t, expected, actual) -} - -func TestActionURL(t *testing.T) { - actual := actionURL(endpointClient(), "foo") - expected := endpoint + "servers/foo/action" - th.CheckEquals(t, expected, actual) -} - -func TestMetadatumURL(t *testing.T) { - actual := metadatumURL(endpointClient(), "foo", "bar") - expected := endpoint + "servers/foo/metadata/bar" - th.CheckEquals(t, expected, actual) -} - -func TestMetadataURL(t *testing.T) { - actual := metadataURL(endpointClient(), "foo") - expected := endpoint + "servers/foo/metadata" - th.CheckEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/db/v1/configurations/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/db/v1/configurations/requests_test.go deleted file mode 100644 index db66f29f87..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/db/v1/configurations/requests_test.go +++ /dev/null @@ -1,236 +0,0 @@ -package configurations - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/db/v1/instances" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" - "github.com/rackspace/gophercloud/testhelper/fixture" -) - -var ( - configID = "{configID}" - _baseURL = "/configurations" - resURL = _baseURL + "/" + configID - - dsID = "{datastoreID}" - versionID = "{versionID}" - paramID = "{paramID}" - dsParamListURL = "/datastores/" + dsID + "/versions/" + versionID + "/parameters" - dsParamGetURL = "/datastores/" + dsID + "/versions/" + versionID + "/parameters/" + paramID - globalParamListURL = "/datastores/versions/" + versionID + "/parameters" - globalParamGetURL = "/datastores/versions/" + versionID + "/parameters/" + paramID -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, _baseURL, "GET", "", ListConfigsJSON, 200) - - count := 0 - err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractConfigs(page) - th.AssertNoErr(t, err) - - expected := []Config{ExampleConfig} - th.AssertDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertEquals(t, 1, count) - th.AssertNoErr(t, err) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL, "GET", "", GetConfigJSON, 200) - - config, err := Get(fake.ServiceClient(), configID).Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, &ExampleConfig, config) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, _baseURL, "POST", CreateReq, CreateConfigJSON, 200) - - opts := CreateOpts{ - Datastore: &DatastoreOpts{ - Type: "a00000a0-00a0-0a00-00a0-000a000000aa", - Version: "b00000b0-00b0-0b00-00b0-000b000000bb", - }, - Description: "example description", - Name: "example-configuration-name", - Values: map[string]interface{}{ - "collation_server": "latin1_swedish_ci", - "connect_timeout": 120, - }, - } - - config, err := Create(fake.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, &ExampleConfigWithValues, config) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL, "PATCH", UpdateReq, "", 200) - - opts := UpdateOpts{ - Values: map[string]interface{}{ - "connect_timeout": 300, - }, - } - - err := Update(fake.ServiceClient(), configID, opts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestReplace(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL, "PUT", UpdateReq, "", 202) - - opts := UpdateOpts{ - Values: map[string]interface{}{ - "connect_timeout": 300, - }, - } - - err := Replace(fake.ServiceClient(), configID, opts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL, "DELETE", "", "", 202) - - err := Delete(fake.ServiceClient(), configID).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestListInstances(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL+"/instances", "GET", "", ListInstancesJSON, 200) - - expectedInstance := instances.Instance{ - ID: "d4603f69-ec7e-4e9b-803f-600b9205576f", - Name: "json_rack_instance", - } - - pages := 0 - err := ListInstances(fake.ServiceClient(), configID).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := instances.ExtractInstances(page) - if err != nil { - return false, err - } - - th.AssertDeepEquals(t, actual, []instances.Instance{expectedInstance}) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestListDSParams(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, dsParamListURL, "GET", "", ListParamsJSON, 200) - - pages := 0 - err := ListDatastoreParams(fake.ServiceClient(), dsID, versionID).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractParams(page) - if err != nil { - return false, err - } - - expected := []Param{ - Param{Max: 1, Min: 0, Name: "innodb_file_per_table", RestartRequired: true, Type: "integer"}, - Param{Max: 4294967296, Min: 0, Name: "key_buffer_size", RestartRequired: false, Type: "integer"}, - Param{Max: 65535, Min: 2, Name: "connect_timeout", RestartRequired: false, Type: "integer"}, - Param{Max: 4294967296, Min: 0, Name: "join_buffer_size", RestartRequired: false, Type: "integer"}, - } - - th.AssertDeepEquals(t, actual, expected) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestGetDSParam(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, dsParamGetURL, "GET", "", GetParamJSON, 200) - - param, err := GetDatastoreParam(fake.ServiceClient(), dsID, versionID, paramID).Extract() - th.AssertNoErr(t, err) - - expected := &Param{ - Max: 1, Min: 0, Name: "innodb_file_per_table", RestartRequired: true, Type: "integer", - } - - th.AssertDeepEquals(t, expected, param) -} - -func TestListGlobalParams(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, globalParamListURL, "GET", "", ListParamsJSON, 200) - - pages := 0 - err := ListGlobalParams(fake.ServiceClient(), versionID).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractParams(page) - if err != nil { - return false, err - } - - expected := []Param{ - Param{Max: 1, Min: 0, Name: "innodb_file_per_table", RestartRequired: true, Type: "integer"}, - Param{Max: 4294967296, Min: 0, Name: "key_buffer_size", RestartRequired: false, Type: "integer"}, - Param{Max: 65535, Min: 2, Name: "connect_timeout", RestartRequired: false, Type: "integer"}, - Param{Max: 4294967296, Min: 0, Name: "join_buffer_size", RestartRequired: false, Type: "integer"}, - } - - th.AssertDeepEquals(t, actual, expected) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestGetGlobalParam(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, globalParamGetURL, "GET", "", GetParamJSON, 200) - - param, err := GetGlobalParam(fake.ServiceClient(), versionID, paramID).Extract() - th.AssertNoErr(t, err) - - expected := &Param{ - Max: 1, Min: 0, Name: "innodb_file_per_table", RestartRequired: true, Type: "integer", - } - - th.AssertDeepEquals(t, expected, param) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/db/v1/databases/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/db/v1/databases/requests_test.go deleted file mode 100644 index 8a1b297f22..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/db/v1/databases/requests_test.go +++ /dev/null @@ -1,66 +0,0 @@ -package databases - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleCreate(t) - - opts := BatchCreateOpts{ - CreateOpts{Name: "testingdb", CharSet: "utf8", Collate: "utf8_general_ci"}, - CreateOpts{Name: "sampledb"}, - } - - res := Create(fake.ServiceClient(), instanceID, opts) - th.AssertNoErr(t, res.Err) -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleList(t) - - expectedDBs := []Database{ - Database{Name: "anotherexampledb"}, - Database{Name: "exampledb"}, - Database{Name: "nextround"}, - Database{Name: "sampledb"}, - Database{Name: "testingdb"}, - } - - pages := 0 - err := List(fake.ServiceClient(), instanceID).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractDBs(page) - if err != nil { - return false, err - } - - th.CheckDeepEquals(t, expectedDBs, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - - if pages != 1 { - t.Errorf("Expected 1 page, saw %d", pages) - } -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleDelete(t) - - err := Delete(fake.ServiceClient(), instanceID, "{dbName}").ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/db/v1/datastores/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/db/v1/datastores/requests_test.go deleted file mode 100644 index b4ce871c4a..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/db/v1/datastores/requests_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package datastores - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" - "github.com/rackspace/gophercloud/testhelper/fixture" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, "/datastores", "GET", "", ListDSResp, 200) - - pages := 0 - - err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractDatastores(page) - if err != nil { - return false, err - } - - th.CheckDeepEquals(t, []Datastore{ExampleDatastore}, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, "/datastores/{dsID}", "GET", "", GetDSResp, 200) - - ds, err := Get(fake.ServiceClient(), "{dsID}").Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, &ExampleDatastore, ds) -} - -func TestListVersions(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, "/datastores/{dsID}/versions", "GET", "", ListVersionsResp, 200) - - pages := 0 - - err := ListVersions(fake.ServiceClient(), "{dsID}").EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractVersions(page) - if err != nil { - return false, err - } - - th.CheckDeepEquals(t, ExampleVersions, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestGetVersion(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, "/datastores/{dsID}/versions/{versionID}", "GET", "", GetVersionResp, 200) - - ds, err := GetVersion(fake.ServiceClient(), "{dsID}", "{versionID}").Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, &ExampleVersion1, ds) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/db/v1/flavors/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/db/v1/flavors/requests_test.go deleted file mode 100644 index 88b5871a1a..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/db/v1/flavors/requests_test.go +++ /dev/null @@ -1,91 +0,0 @@ -package flavors - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListFlavors(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleList(t) - - pages := 0 - err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractFlavors(page) - if err != nil { - return false, err - } - - expected := []Flavor{ - Flavor{ - ID: "1", - Name: "m1.tiny", - RAM: 512, - Links: []gophercloud.Link{ - gophercloud.Link{Href: "https://openstack.example.com/v1.0/1234/flavors/1", Rel: "self"}, - gophercloud.Link{Href: "https://openstack.example.com/flavors/1", Rel: "bookmark"}, - }, - }, - Flavor{ - ID: "2", - Name: "m1.small", - RAM: 1024, - Links: []gophercloud.Link{ - gophercloud.Link{Href: "https://openstack.example.com/v1.0/1234/flavors/2", Rel: "self"}, - gophercloud.Link{Href: "https://openstack.example.com/flavors/2", Rel: "bookmark"}, - }, - }, - Flavor{ - ID: "3", - Name: "m1.medium", - RAM: 2048, - Links: []gophercloud.Link{ - gophercloud.Link{Href: "https://openstack.example.com/v1.0/1234/flavors/3", Rel: "self"}, - gophercloud.Link{Href: "https://openstack.example.com/flavors/3", Rel: "bookmark"}, - }, - }, - Flavor{ - ID: "4", - Name: "m1.large", - RAM: 4096, - Links: []gophercloud.Link{ - gophercloud.Link{Href: "https://openstack.example.com/v1.0/1234/flavors/4", Rel: "self"}, - gophercloud.Link{Href: "https://openstack.example.com/flavors/4", Rel: "bookmark"}, - }, - }, - } - - th.AssertDeepEquals(t, expected, actual) - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestGetFlavor(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGet(t) - - actual, err := Get(fake.ServiceClient(), flavorID).Extract() - th.AssertNoErr(t, err) - - expected := &Flavor{ - ID: "1", - Name: "m1.tiny", - RAM: 512, - Links: []gophercloud.Link{ - gophercloud.Link{Href: "https://openstack.example.com/v1.0/1234/flavors/1", Rel: "self"}, - }, - } - - th.AssertDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/db/v1/instances/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/db/v1/instances/requests_test.go deleted file mode 100644 index 3cc2b701f9..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/db/v1/instances/requests_test.go +++ /dev/null @@ -1,133 +0,0 @@ -package instances - -import ( - "testing" - - db "github.com/rackspace/gophercloud/openstack/db/v1/databases" - "github.com/rackspace/gophercloud/openstack/db/v1/users" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleCreate(t) - - opts := CreateOpts{ - Name: "json_rack_instance", - FlavorRef: "1", - Databases: db.BatchCreateOpts{ - db.CreateOpts{CharSet: "utf8", Collate: "utf8_general_ci", Name: "sampledb"}, - db.CreateOpts{Name: "nextround"}, - }, - Users: users.BatchCreateOpts{ - users.CreateOpts{ - Name: "demouser", - Password: "demopassword", - Databases: db.BatchCreateOpts{ - db.CreateOpts{Name: "sampledb"}, - }, - }, - }, - Size: 2, - } - - instance, err := Create(fake.ServiceClient(), opts).Extract() - - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, &expectedInstance, instance) -} - -func TestInstanceList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleList(t) - - pages := 0 - err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractInstances(page) - if err != nil { - return false, err - } - - th.CheckDeepEquals(t, []Instance{expectedInstance}, actual) - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestGetInstance(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGet(t) - - instance, err := Get(fake.ServiceClient(), instanceID).Extract() - - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, &expectedInstance, instance) -} - -func TestDeleteInstance(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleDelete(t) - - res := Delete(fake.ServiceClient(), instanceID) - th.AssertNoErr(t, res.Err) -} - -func TestEnableRootUser(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleEnableRoot(t) - - expected := &users.User{Name: "root", Password: "secretsecret"} - user, err := EnableRootUser(fake.ServiceClient(), instanceID).Extract() - - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expected, user) -} - -func TestIsRootEnabled(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleIsRootEnabled(t) - - isEnabled, err := IsRootEnabled(fake.ServiceClient(), instanceID) - - th.AssertNoErr(t, err) - th.AssertEquals(t, true, isEnabled) -} - -func TestRestart(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleRestart(t) - - res := Restart(fake.ServiceClient(), instanceID) - th.AssertNoErr(t, res.Err) -} - -func TestResize(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleResize(t) - - res := Resize(fake.ServiceClient(), instanceID, "2") - th.AssertNoErr(t, res.Err) -} - -func TestResizeVolume(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleResizeVol(t) - - res := ResizeVolume(fake.ServiceClient(), instanceID, 4) - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/db/v1/users/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/db/v1/users/requests_test.go deleted file mode 100644 index 5711f6334a..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/db/v1/users/requests_test.go +++ /dev/null @@ -1,84 +0,0 @@ -package users - -import ( - "testing" - - db "github.com/rackspace/gophercloud/openstack/db/v1/databases" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleCreate(t) - - opts := BatchCreateOpts{ - CreateOpts{ - Databases: db.BatchCreateOpts{ - db.CreateOpts{Name: "databaseA"}, - }, - Name: "dbuser3", - Password: "secretsecret", - }, - CreateOpts{ - Databases: db.BatchCreateOpts{ - db.CreateOpts{Name: "databaseB"}, - db.CreateOpts{Name: "databaseC"}, - }, - Name: "dbuser4", - Password: "secretsecret", - }, - } - - res := Create(fake.ServiceClient(), instanceID, opts) - th.AssertNoErr(t, res.Err) -} - -func TestUserList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleList(t) - - expectedUsers := []User{ - User{ - Databases: []db.Database{ - db.Database{Name: "databaseA"}, - }, - Name: "dbuser3", - }, - User{ - Databases: []db.Database{ - db.Database{Name: "databaseB"}, - db.Database{Name: "databaseC"}, - }, - Name: "dbuser4", - }, - } - - pages := 0 - err := List(fake.ServiceClient(), instanceID).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractUsers(page) - if err != nil { - return false, err - } - - th.CheckDeepEquals(t, expectedUsers, actual) - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleDelete(t) - - res := Delete(fake.ServiceClient(), instanceID, "{userName}") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/endpoint_location_test.go b/vendor/github.com/rackspace/gophercloud/openstack/endpoint_location_test.go deleted file mode 100644 index 8e65918abf..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/endpoint_location_test.go +++ /dev/null @@ -1,228 +0,0 @@ -package openstack - -import ( - "strings" - "testing" - - "github.com/rackspace/gophercloud" - tokens2 "github.com/rackspace/gophercloud/openstack/identity/v2/tokens" - tokens3 "github.com/rackspace/gophercloud/openstack/identity/v3/tokens" - th "github.com/rackspace/gophercloud/testhelper" -) - -// Service catalog fixtures take too much vertical space! -var catalog2 = tokens2.ServiceCatalog{ - Entries: []tokens2.CatalogEntry{ - tokens2.CatalogEntry{ - Type: "same", - Name: "same", - Endpoints: []tokens2.Endpoint{ - tokens2.Endpoint{ - Region: "same", - PublicURL: "https://public.correct.com/", - InternalURL: "https://internal.correct.com/", - AdminURL: "https://admin.correct.com/", - }, - tokens2.Endpoint{ - Region: "different", - PublicURL: "https://badregion.com/", - }, - }, - }, - tokens2.CatalogEntry{ - Type: "same", - Name: "different", - Endpoints: []tokens2.Endpoint{ - tokens2.Endpoint{ - Region: "same", - PublicURL: "https://badname.com/", - }, - tokens2.Endpoint{ - Region: "different", - PublicURL: "https://badname.com/+badregion", - }, - }, - }, - tokens2.CatalogEntry{ - Type: "different", - Name: "different", - Endpoints: []tokens2.Endpoint{ - tokens2.Endpoint{ - Region: "same", - PublicURL: "https://badtype.com/+badname", - }, - tokens2.Endpoint{ - Region: "different", - PublicURL: "https://badtype.com/+badregion+badname", - }, - }, - }, - }, -} - -func TestV2EndpointExact(t *testing.T) { - expectedURLs := map[gophercloud.Availability]string{ - gophercloud.AvailabilityPublic: "https://public.correct.com/", - gophercloud.AvailabilityAdmin: "https://admin.correct.com/", - gophercloud.AvailabilityInternal: "https://internal.correct.com/", - } - - for availability, expected := range expectedURLs { - actual, err := V2EndpointURL(&catalog2, gophercloud.EndpointOpts{ - Type: "same", - Name: "same", - Region: "same", - Availability: availability, - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, expected, actual) - } -} - -func TestV2EndpointNone(t *testing.T) { - _, err := V2EndpointURL(&catalog2, gophercloud.EndpointOpts{ - Type: "nope", - Availability: gophercloud.AvailabilityPublic, - }) - th.CheckEquals(t, gophercloud.ErrEndpointNotFound, err) -} - -func TestV2EndpointMultiple(t *testing.T) { - _, err := V2EndpointURL(&catalog2, gophercloud.EndpointOpts{ - Type: "same", - Region: "same", - Availability: gophercloud.AvailabilityPublic, - }) - if !strings.HasPrefix(err.Error(), "Discovered 2 matching endpoints:") { - t.Errorf("Received unexpected error: %v", err) - } -} - -func TestV2EndpointBadAvailability(t *testing.T) { - _, err := V2EndpointURL(&catalog2, gophercloud.EndpointOpts{ - Type: "same", - Name: "same", - Region: "same", - Availability: "wat", - }) - th.CheckEquals(t, "Unexpected availability in endpoint query: wat", err.Error()) -} - -var catalog3 = tokens3.ServiceCatalog{ - Entries: []tokens3.CatalogEntry{ - tokens3.CatalogEntry{ - Type: "same", - Name: "same", - Endpoints: []tokens3.Endpoint{ - tokens3.Endpoint{ - ID: "1", - Region: "same", - Interface: "public", - URL: "https://public.correct.com/", - }, - tokens3.Endpoint{ - ID: "2", - Region: "same", - Interface: "admin", - URL: "https://admin.correct.com/", - }, - tokens3.Endpoint{ - ID: "3", - Region: "same", - Interface: "internal", - URL: "https://internal.correct.com/", - }, - tokens3.Endpoint{ - ID: "4", - Region: "different", - Interface: "public", - URL: "https://badregion.com/", - }, - }, - }, - tokens3.CatalogEntry{ - Type: "same", - Name: "different", - Endpoints: []tokens3.Endpoint{ - tokens3.Endpoint{ - ID: "5", - Region: "same", - Interface: "public", - URL: "https://badname.com/", - }, - tokens3.Endpoint{ - ID: "6", - Region: "different", - Interface: "public", - URL: "https://badname.com/+badregion", - }, - }, - }, - tokens3.CatalogEntry{ - Type: "different", - Name: "different", - Endpoints: []tokens3.Endpoint{ - tokens3.Endpoint{ - ID: "7", - Region: "same", - Interface: "public", - URL: "https://badtype.com/+badname", - }, - tokens3.Endpoint{ - ID: "8", - Region: "different", - Interface: "public", - URL: "https://badtype.com/+badregion+badname", - }, - }, - }, - }, -} - -func TestV3EndpointExact(t *testing.T) { - expectedURLs := map[gophercloud.Availability]string{ - gophercloud.AvailabilityPublic: "https://public.correct.com/", - gophercloud.AvailabilityAdmin: "https://admin.correct.com/", - gophercloud.AvailabilityInternal: "https://internal.correct.com/", - } - - for availability, expected := range expectedURLs { - actual, err := V3EndpointURL(&catalog3, gophercloud.EndpointOpts{ - Type: "same", - Name: "same", - Region: "same", - Availability: availability, - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, expected, actual) - } -} - -func TestV3EndpointNone(t *testing.T) { - _, err := V3EndpointURL(&catalog3, gophercloud.EndpointOpts{ - Type: "nope", - Availability: gophercloud.AvailabilityPublic, - }) - th.CheckEquals(t, gophercloud.ErrEndpointNotFound, err) -} - -func TestV3EndpointMultiple(t *testing.T) { - _, err := V3EndpointURL(&catalog3, gophercloud.EndpointOpts{ - Type: "same", - Region: "same", - Availability: gophercloud.AvailabilityPublic, - }) - if !strings.HasPrefix(err.Error(), "Discovered 2 matching endpoints:") { - t.Errorf("Received unexpected error: %v", err) - } -} - -func TestV3EndpointBadAvailability(t *testing.T) { - _, err := V3EndpointURL(&catalog3, gophercloud.EndpointOpts{ - Type: "same", - Name: "same", - Region: "same", - Availability: "wat", - }) - th.CheckEquals(t, "Unexpected availability in endpoint query: wat", err.Error()) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/identity/v2/extensions/admin/roles/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/identity/v2/extensions/admin/roles/requests_test.go deleted file mode 100644 index 7bfeea44a8..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/identity/v2/extensions/admin/roles/requests_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package roles - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestRole(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - MockListRoleResponse(t) - - count := 0 - - err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractRoles(page) - if err != nil { - t.Errorf("Failed to extract users: %v", err) - return false, err - } - - expected := []Role{ - Role{ - ID: "123", - Name: "compute:admin", - Description: "Nova Administrator", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, count) -} - -func TestAddUserRole(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - MockAddUserRoleResponse(t) - - err := AddUserRole(client.ServiceClient(), "{tenant_id}", "{user_id}", "{role_id}").ExtractErr() - - th.AssertNoErr(t, err) -} - -func TestDeleteUserRole(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - MockDeleteUserRoleResponse(t) - - err := DeleteUserRole(client.ServiceClient(), "{tenant_id}", "{user_id}", "{role_id}").ExtractErr() - - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/identity/v2/extensions/delegate_test.go b/vendor/github.com/rackspace/gophercloud/openstack/identity/v2/extensions/delegate_test.go deleted file mode 100644 index 504118a825..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/identity/v2/extensions/delegate_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package extensions - -import ( - "testing" - - common "github.com/rackspace/gophercloud/openstack/common/extensions" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListExtensionsSuccessfully(t) - - count := 0 - err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractExtensions(page) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, common.ExpectedExtensions, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - common.HandleGetExtensionSuccessfully(t) - - actual, err := Get(client.ServiceClient(), "agent").Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, common.SingleExtension, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/identity/v2/tenants/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/identity/v2/tenants/requests_test.go deleted file mode 100644 index e8f172dd18..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/identity/v2/tenants/requests_test.go +++ /dev/null @@ -1,29 +0,0 @@ -package tenants - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListTenants(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListTenantsSuccessfully(t) - - count := 0 - err := List(client.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) { - count++ - - actual, err := ExtractTenants(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, ExpectedTenantSlice, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/identity/v2/tokens/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/identity/v2/tokens/requests_test.go deleted file mode 100644 index f1ec3396ed..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/identity/v2/tokens/requests_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package tokens - -import ( - "fmt" - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func tokenPost(t *testing.T, options gophercloud.AuthOptions, requestJSON string) CreateResult { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleTokenPost(t, requestJSON) - - return Create(client.ServiceClient(), AuthOptions{options}) -} - -func tokenPostErr(t *testing.T, options gophercloud.AuthOptions, expectedErr error) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleTokenPost(t, "") - - actualErr := Create(client.ServiceClient(), AuthOptions{options}).Err - th.CheckDeepEquals(t, expectedErr, actualErr) -} - -func TestCreateWithPassword(t *testing.T) { - options := gophercloud.AuthOptions{ - Username: "me", - Password: "swordfish", - } - - IsSuccessful(t, tokenPost(t, options, ` - { - "auth": { - "passwordCredentials": { - "username": "me", - "password": "swordfish" - } - } - } - `)) -} - -func TestCreateTokenWithTenantID(t *testing.T) { - options := gophercloud.AuthOptions{ - Username: "me", - Password: "opensesame", - TenantID: "fc394f2ab2df4114bde39905f800dc57", - } - - IsSuccessful(t, tokenPost(t, options, ` - { - "auth": { - "tenantId": "fc394f2ab2df4114bde39905f800dc57", - "passwordCredentials": { - "username": "me", - "password": "opensesame" - } - } - } - `)) -} - -func TestCreateTokenWithTenantName(t *testing.T) { - options := gophercloud.AuthOptions{ - Username: "me", - Password: "opensesame", - TenantName: "demo", - } - - IsSuccessful(t, tokenPost(t, options, ` - { - "auth": { - "tenantName": "demo", - "passwordCredentials": { - "username": "me", - "password": "opensesame" - } - } - } - `)) -} - -func TestProhibitUserID(t *testing.T) { - options := gophercloud.AuthOptions{ - Username: "me", - UserID: "1234", - Password: "thing", - } - - tokenPostErr(t, options, ErrUserIDProvided) -} - -func TestProhibitAPIKey(t *testing.T) { - options := gophercloud.AuthOptions{ - Username: "me", - Password: "thing", - APIKey: "123412341234", - } - - tokenPostErr(t, options, ErrAPIKeyProvided) -} - -func TestProhibitDomainID(t *testing.T) { - options := gophercloud.AuthOptions{ - Username: "me", - Password: "thing", - DomainID: "1234", - } - - tokenPostErr(t, options, ErrDomainIDProvided) -} - -func TestProhibitDomainName(t *testing.T) { - options := gophercloud.AuthOptions{ - Username: "me", - Password: "thing", - DomainName: "wat", - } - - tokenPostErr(t, options, ErrDomainNameProvided) -} - -func TestRequireUsername(t *testing.T) { - options := gophercloud.AuthOptions{ - Password: "thing", - } - - tokenPostErr(t, options, fmt.Errorf("You must provide either username/password or tenantID/token values.")) -} - -func TestRequirePassword(t *testing.T) { - options := gophercloud.AuthOptions{ - Username: "me", - } - - tokenPostErr(t, options, ErrPasswordRequired) -} - -func tokenGet(t *testing.T, tokenId string) GetResult { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleTokenGet(t, tokenId) - return Get(client.ServiceClient(), tokenId) -} - -func TestGetWithToken(t *testing.T) { - GetIsSuccessful(t, tokenGet(t, "db22caf43c934e6c829087c41ff8d8d6")) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/identity/v2/users/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/identity/v2/users/requests_test.go deleted file mode 100644 index 04f837163a..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/identity/v2/users/requests_test.go +++ /dev/null @@ -1,165 +0,0 @@ -package users - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - MockListUserResponse(t) - - count := 0 - - err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractUsers(page) - if err != nil { - t.Errorf("Failed to extract users: %v", err) - return false, err - } - - expected := []User{ - User{ - ID: "u1000", - Name: "John Smith", - Username: "jqsmith", - Email: "john.smith@example.org", - Enabled: true, - TenantID: "12345", - }, - User{ - ID: "u1001", - Name: "Jane Smith", - Username: "jqsmith", - Email: "jane.smith@example.org", - Enabled: true, - TenantID: "12345", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, count) -} - -func TestCreateUser(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockCreateUserResponse(t) - - opts := CreateOpts{ - Name: "new_user", - TenantID: "12345", - Enabled: Disabled, - Email: "new_user@foo.com", - } - - user, err := Create(client.ServiceClient(), opts).Extract() - - th.AssertNoErr(t, err) - - expected := &User{ - Name: "new_user", - ID: "c39e3de9be2d4c779f1dfd6abacc176d", - Email: "new_user@foo.com", - Enabled: false, - TenantID: "12345", - } - - th.AssertDeepEquals(t, expected, user) -} - -func TestGetUser(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockGetUserResponse(t) - - user, err := Get(client.ServiceClient(), "new_user").Extract() - th.AssertNoErr(t, err) - - expected := &User{ - Name: "new_user", - ID: "c39e3de9be2d4c779f1dfd6abacc176d", - Email: "new_user@foo.com", - Enabled: false, - TenantID: "12345", - } - - th.AssertDeepEquals(t, expected, user) -} - -func TestUpdateUser(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockUpdateUserResponse(t) - - id := "c39e3de9be2d4c779f1dfd6abacc176d" - opts := UpdateOpts{ - Name: "new_name", - Enabled: Enabled, - Email: "new_email@foo.com", - } - - user, err := Update(client.ServiceClient(), id, opts).Extract() - - th.AssertNoErr(t, err) - - expected := &User{ - Name: "new_name", - ID: id, - Email: "new_email@foo.com", - Enabled: true, - TenantID: "12345", - } - - th.AssertDeepEquals(t, expected, user) -} - -func TestDeleteUser(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDeleteUserResponse(t) - - res := Delete(client.ServiceClient(), "c39e3de9be2d4c779f1dfd6abacc176d") - th.AssertNoErr(t, res.Err) -} - -func TestListingUserRoles(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockListRolesResponse(t) - - tenantID := "1d8b6120dcc640fda4fc9194ffc80273" - userID := "c39e3de9be2d4c779f1dfd6abacc176d" - - err := ListRoles(client.ServiceClient(), tenantID, userID).EachPage(func(page pagination.Page) (bool, error) { - actual, err := ExtractRoles(page) - th.AssertNoErr(t, err) - - expected := []Role{ - Role{ID: "9fe2ff9ee4384b1894a90878d3e92bab", Name: "foo_role"}, - Role{ID: "1ea3d56793574b668e85960fbf651e13", Name: "admin"}, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/endpoints/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/endpoints/requests_test.go deleted file mode 100644 index 80687c4cb7..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/endpoints/requests_test.go +++ /dev/null @@ -1,226 +0,0 @@ -package endpoints - -import ( - "fmt" - "net/http" - "reflect" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestCreateSuccessful(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - - testhelper.Mux.HandleFunc("/endpoints", func(w http.ResponseWriter, r *http.Request) { - testhelper.TestMethod(t, r, "POST") - testhelper.TestHeader(t, r, "X-Auth-Token", client.TokenID) - testhelper.TestJSONRequest(t, r, ` - { - "endpoint": { - "interface": "public", - "name": "the-endiest-of-points", - "region": "underground", - "url": "https://1.2.3.4:9000/", - "service_id": "asdfasdfasdfasdf" - } - } - `) - - w.WriteHeader(http.StatusCreated) - fmt.Fprintf(w, ` - { - "endpoint": { - "id": "12", - "interface": "public", - "links": { - "self": "https://localhost:5000/v3/endpoints/12" - }, - "name": "the-endiest-of-points", - "region": "underground", - "service_id": "asdfasdfasdfasdf", - "url": "https://1.2.3.4:9000/" - } - } - `) - }) - - actual, err := Create(client.ServiceClient(), EndpointOpts{ - Availability: gophercloud.AvailabilityPublic, - Name: "the-endiest-of-points", - Region: "underground", - URL: "https://1.2.3.4:9000/", - ServiceID: "asdfasdfasdfasdf", - }).Extract() - if err != nil { - t.Fatalf("Unable to create an endpoint: %v", err) - } - - expected := &Endpoint{ - ID: "12", - Availability: gophercloud.AvailabilityPublic, - Name: "the-endiest-of-points", - Region: "underground", - ServiceID: "asdfasdfasdfasdf", - URL: "https://1.2.3.4:9000/", - } - - if !reflect.DeepEqual(actual, expected) { - t.Errorf("Expected %#v, was %#v", expected, actual) - } -} - -func TestListEndpoints(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - - testhelper.Mux.HandleFunc("/endpoints", func(w http.ResponseWriter, r *http.Request) { - testhelper.TestMethod(t, r, "GET") - testhelper.TestHeader(t, r, "X-Auth-Token", client.TokenID) - - w.Header().Add("Content-Type", "application/json") - fmt.Fprintf(w, ` - { - "endpoints": [ - { - "id": "12", - "interface": "public", - "links": { - "self": "https://localhost:5000/v3/endpoints/12" - }, - "name": "the-endiest-of-points", - "region": "underground", - "service_id": "asdfasdfasdfasdf", - "url": "https://1.2.3.4:9000/" - }, - { - "id": "13", - "interface": "internal", - "links": { - "self": "https://localhost:5000/v3/endpoints/13" - }, - "name": "shhhh", - "region": "underground", - "service_id": "asdfasdfasdfasdf", - "url": "https://1.2.3.4:9001/" - } - ], - "links": { - "next": null, - "previous": null - } - } - `) - }) - - count := 0 - List(client.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractEndpoints(page) - if err != nil { - t.Errorf("Failed to extract endpoints: %v", err) - return false, err - } - - expected := []Endpoint{ - Endpoint{ - ID: "12", - Availability: gophercloud.AvailabilityPublic, - Name: "the-endiest-of-points", - Region: "underground", - ServiceID: "asdfasdfasdfasdf", - URL: "https://1.2.3.4:9000/", - }, - Endpoint{ - ID: "13", - Availability: gophercloud.AvailabilityInternal, - Name: "shhhh", - Region: "underground", - ServiceID: "asdfasdfasdfasdf", - URL: "https://1.2.3.4:9001/", - }, - } - - if !reflect.DeepEqual(expected, actual) { - t.Errorf("Expected %#v, got %#v", expected, actual) - } - - return true, nil - }) - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestUpdateEndpoint(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - - testhelper.Mux.HandleFunc("/endpoints/12", func(w http.ResponseWriter, r *http.Request) { - testhelper.TestMethod(t, r, "PATCH") - testhelper.TestHeader(t, r, "X-Auth-Token", client.TokenID) - testhelper.TestJSONRequest(t, r, ` - { - "endpoint": { - "name": "renamed", - "region": "somewhere-else" - } - } - `) - - fmt.Fprintf(w, ` - { - "endpoint": { - "id": "12", - "interface": "public", - "links": { - "self": "https://localhost:5000/v3/endpoints/12" - }, - "name": "renamed", - "region": "somewhere-else", - "service_id": "asdfasdfasdfasdf", - "url": "https://1.2.3.4:9000/" - } - } - `) - }) - - actual, err := Update(client.ServiceClient(), "12", EndpointOpts{ - Name: "renamed", - Region: "somewhere-else", - }).Extract() - if err != nil { - t.Fatalf("Unexpected error from Update: %v", err) - } - - expected := &Endpoint{ - ID: "12", - Availability: gophercloud.AvailabilityPublic, - Name: "renamed", - Region: "somewhere-else", - ServiceID: "asdfasdfasdfasdf", - URL: "https://1.2.3.4:9000/", - } - if !reflect.DeepEqual(expected, actual) { - t.Errorf("Expected %#v, was %#v", expected, actual) - } -} - -func TestDeleteEndpoint(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - - testhelper.Mux.HandleFunc("/endpoints/34", func(w http.ResponseWriter, r *http.Request) { - testhelper.TestMethod(t, r, "DELETE") - testhelper.TestHeader(t, r, "X-Auth-Token", client.TokenID) - - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(client.ServiceClient(), "34") - testhelper.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/endpoints/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/endpoints/urls_test.go deleted file mode 100644 index 0b183b7434..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/endpoints/urls_test.go +++ /dev/null @@ -1,23 +0,0 @@ -package endpoints - -import ( - "testing" - - "github.com/rackspace/gophercloud" -) - -func TestGetListURL(t *testing.T) { - client := gophercloud.ServiceClient{Endpoint: "http://localhost:5000/v3/"} - url := listURL(&client) - if url != "http://localhost:5000/v3/endpoints" { - t.Errorf("Unexpected list URL generated: [%s]", url) - } -} - -func TestGetEndpointURL(t *testing.T) { - client := gophercloud.ServiceClient{Endpoint: "http://localhost:5000/v3/"} - url := endpointURL(&client, "1234") - if url != "http://localhost:5000/v3/endpoints/1234" { - t.Errorf("Unexpected service URL generated: [%s]", url) - } -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/roles/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/roles/requests_test.go deleted file mode 100644 index d62dbff9a2..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/roles/requests_test.go +++ /dev/null @@ -1,104 +0,0 @@ -package roles - -import ( - "fmt" - "net/http" - "reflect" - "testing" - - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListSinglePage(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - - testhelper.Mux.HandleFunc("/role_assignments", func(w http.ResponseWriter, r *http.Request) { - testhelper.TestMethod(t, r, "GET") - testhelper.TestHeader(t, r, "X-Auth-Token", client.TokenID) - - w.Header().Add("Content-Type", "application/json") - fmt.Fprintf(w, ` - { - "role_assignments": [ - { - "links": { - "assignment": "http://identity:35357/v3/domains/161718/users/313233/roles/123456" - }, - "role": { - "id": "123456" - }, - "scope": { - "domain": { - "id": "161718" - } - }, - "user": { - "id": "313233" - } - }, - { - "links": { - "assignment": "http://identity:35357/v3/projects/456789/groups/101112/roles/123456", - "membership": "http://identity:35357/v3/groups/101112/users/313233" - }, - "role": { - "id": "123456" - }, - "scope": { - "project": { - "id": "456789" - } - }, - "user": { - "id": "313233" - } - } - ], - "links": { - "self": "http://identity:35357/v3/role_assignments?effective", - "previous": null, - "next": null - } - } - `) - }) - - count := 0 - err := ListAssignments(client.ServiceClient(), ListAssignmentsOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractRoleAssignments(page) - if err != nil { - return false, err - } - - expected := []RoleAssignment{ - RoleAssignment{ - Role: Role{ID: "123456"}, - Scope: Scope{Domain: Domain{ID: "161718"}}, - User: User{ID: "313233"}, - Group: Group{}, - }, - RoleAssignment{ - Role: Role{ID: "123456"}, - Scope: Scope{Project: Project{ID: "456789"}}, - User: User{ID: "313233"}, - Group: Group{}, - }, - } - - if !reflect.DeepEqual(expected, actual) { - t.Errorf("Expected %#v, got %#v", expected, actual) - } - - return true, nil - }) - if err != nil { - t.Errorf("Unexpected error while paging: %v", err) - } - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/roles/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/roles/urls_test.go deleted file mode 100644 index 04679dae40..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/roles/urls_test.go +++ /dev/null @@ -1,15 +0,0 @@ -package roles - -import ( - "testing" - - "github.com/rackspace/gophercloud" -) - -func TestListAssignmentsURL(t *testing.T) { - client := gophercloud.ServiceClient{Endpoint: "http://localhost:5000/v3/"} - url := listAssignmentsURL(&client) - if url != "http://localhost:5000/v3/role_assignments" { - t.Errorf("Unexpected list URL generated: [%s]", url) - } -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/services/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/services/requests_test.go deleted file mode 100644 index 42f05d365a..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/services/requests_test.go +++ /dev/null @@ -1,209 +0,0 @@ -package services - -import ( - "fmt" - "net/http" - "reflect" - "testing" - - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestCreateSuccessful(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - - testhelper.Mux.HandleFunc("/services", func(w http.ResponseWriter, r *http.Request) { - testhelper.TestMethod(t, r, "POST") - testhelper.TestHeader(t, r, "X-Auth-Token", client.TokenID) - testhelper.TestJSONRequest(t, r, `{ "type": "compute" }`) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - fmt.Fprintf(w, `{ - "service": { - "description": "Here's your service", - "id": "1234", - "name": "InscrutableOpenStackProjectName", - "type": "compute" - } - }`) - }) - - result, err := Create(client.ServiceClient(), "compute").Extract() - if err != nil { - t.Fatalf("Unexpected error from Create: %v", err) - } - - if result.Description == nil || *result.Description != "Here's your service" { - t.Errorf("Service description was unexpected [%s]", *result.Description) - } - if result.ID != "1234" { - t.Errorf("Service ID was unexpected [%s]", result.ID) - } - if result.Name != "InscrutableOpenStackProjectName" { - t.Errorf("Service name was unexpected [%s]", result.Name) - } - if result.Type != "compute" { - t.Errorf("Service type was unexpected [%s]", result.Type) - } -} - -func TestListSinglePage(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - - testhelper.Mux.HandleFunc("/services", func(w http.ResponseWriter, r *http.Request) { - testhelper.TestMethod(t, r, "GET") - testhelper.TestHeader(t, r, "X-Auth-Token", client.TokenID) - - w.Header().Add("Content-Type", "application/json") - fmt.Fprintf(w, ` - { - "links": { - "next": null, - "previous": null - }, - "services": [ - { - "description": "Service One", - "id": "1234", - "name": "service-one", - "type": "identity" - }, - { - "description": "Service Two", - "id": "9876", - "name": "service-two", - "type": "compute" - } - ] - } - `) - }) - - count := 0 - err := List(client.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractServices(page) - if err != nil { - return false, err - } - - desc0 := "Service One" - desc1 := "Service Two" - expected := []Service{ - Service{ - Description: &desc0, - ID: "1234", - Name: "service-one", - Type: "identity", - }, - Service{ - Description: &desc1, - ID: "9876", - Name: "service-two", - Type: "compute", - }, - } - - if !reflect.DeepEqual(expected, actual) { - t.Errorf("Expected %#v, got %#v", expected, actual) - } - - return true, nil - }) - if err != nil { - t.Errorf("Unexpected error while paging: %v", err) - } - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestGetSuccessful(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - - testhelper.Mux.HandleFunc("/services/12345", func(w http.ResponseWriter, r *http.Request) { - testhelper.TestMethod(t, r, "GET") - testhelper.TestHeader(t, r, "X-Auth-Token", client.TokenID) - - w.Header().Add("Content-Type", "application/json") - fmt.Fprintf(w, ` - { - "service": { - "description": "Service One", - "id": "12345", - "name": "service-one", - "type": "identity" - } - } - `) - }) - - result, err := Get(client.ServiceClient(), "12345").Extract() - if err != nil { - t.Fatalf("Error fetching service information: %v", err) - } - - if result.ID != "12345" { - t.Errorf("Unexpected service ID: %s", result.ID) - } - if *result.Description != "Service One" { - t.Errorf("Unexpected service description: [%s]", *result.Description) - } - if result.Name != "service-one" { - t.Errorf("Unexpected service name: [%s]", result.Name) - } - if result.Type != "identity" { - t.Errorf("Unexpected service type: [%s]", result.Type) - } -} - -func TestUpdateSuccessful(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - - testhelper.Mux.HandleFunc("/services/12345", func(w http.ResponseWriter, r *http.Request) { - testhelper.TestMethod(t, r, "PATCH") - testhelper.TestHeader(t, r, "X-Auth-Token", client.TokenID) - testhelper.TestJSONRequest(t, r, `{ "type": "lasermagic" }`) - - w.Header().Add("Content-Type", "application/json") - fmt.Fprintf(w, ` - { - "service": { - "id": "12345", - "type": "lasermagic" - } - } - `) - }) - - result, err := Update(client.ServiceClient(), "12345", "lasermagic").Extract() - if err != nil { - t.Fatalf("Unable to update service: %v", err) - } - - if result.ID != "12345" { - t.Fatalf("Expected ID 12345, was %s", result.ID) - } -} - -func TestDeleteSuccessful(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - - testhelper.Mux.HandleFunc("/services/12345", func(w http.ResponseWriter, r *http.Request) { - testhelper.TestMethod(t, r, "DELETE") - testhelper.TestHeader(t, r, "X-Auth-Token", client.TokenID) - - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(client.ServiceClient(), "12345") - testhelper.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/services/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/services/urls_test.go deleted file mode 100644 index 5a31b32316..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/services/urls_test.go +++ /dev/null @@ -1,23 +0,0 @@ -package services - -import ( - "testing" - - "github.com/rackspace/gophercloud" -) - -func TestListURL(t *testing.T) { - client := gophercloud.ServiceClient{Endpoint: "http://localhost:5000/v3/"} - url := listURL(&client) - if url != "http://localhost:5000/v3/services" { - t.Errorf("Unexpected list URL generated: [%s]", url) - } -} - -func TestServiceURL(t *testing.T) { - client := gophercloud.ServiceClient{Endpoint: "http://localhost:5000/v3/"} - url := serviceURL(&client, "1234") - if url != "http://localhost:5000/v3/services/1234" { - t.Errorf("Unexpected service URL generated: [%s]", url) - } -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/requests_test.go deleted file mode 100644 index 2b26e4ad36..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/requests_test.go +++ /dev/null @@ -1,514 +0,0 @@ -package tokens - -import ( - "fmt" - "net/http" - "testing" - "time" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/testhelper" -) - -// authTokenPost verifies that providing certain AuthOptions and Scope results in an expected JSON structure. -func authTokenPost(t *testing.T, options gophercloud.AuthOptions, scope *Scope, requestJSON string) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - - client := gophercloud.ServiceClient{ - ProviderClient: &gophercloud.ProviderClient{ - TokenID: "12345abcdef", - }, - Endpoint: testhelper.Endpoint(), - } - - testhelper.Mux.HandleFunc("/auth/tokens", func(w http.ResponseWriter, r *http.Request) { - testhelper.TestMethod(t, r, "POST") - testhelper.TestHeader(t, r, "Content-Type", "application/json") - testhelper.TestHeader(t, r, "Accept", "application/json") - testhelper.TestJSONRequest(t, r, requestJSON) - - w.WriteHeader(http.StatusCreated) - fmt.Fprintf(w, `{ - "token": { - "expires_at": "2014-10-02T13:45:00.000000Z" - } - }`) - }) - - _, err := Create(&client, options, scope).Extract() - if err != nil { - t.Errorf("Create returned an error: %v", err) - } -} - -func authTokenPostErr(t *testing.T, options gophercloud.AuthOptions, scope *Scope, includeToken bool, expectedErr error) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - - client := gophercloud.ServiceClient{ - ProviderClient: &gophercloud.ProviderClient{}, - Endpoint: testhelper.Endpoint(), - } - if includeToken { - client.TokenID = "abcdef123456" - } - - _, err := Create(&client, options, scope).Extract() - if err == nil { - t.Errorf("Create did NOT return an error") - } - if err != expectedErr { - t.Errorf("Create returned an unexpected error: wanted %v, got %v", expectedErr, err) - } -} - -func TestCreateUserIDAndPassword(t *testing.T) { - authTokenPost(t, gophercloud.AuthOptions{UserID: "me", Password: "squirrel!"}, nil, ` - { - "auth": { - "identity": { - "methods": ["password"], - "password": { - "user": { "id": "me", "password": "squirrel!" } - } - } - } - } - `) -} - -func TestCreateUsernameDomainIDPassword(t *testing.T) { - authTokenPost(t, gophercloud.AuthOptions{Username: "fakey", Password: "notpassword", DomainID: "abc123"}, nil, ` - { - "auth": { - "identity": { - "methods": ["password"], - "password": { - "user": { - "domain": { - "id": "abc123" - }, - "name": "fakey", - "password": "notpassword" - } - } - } - } - } - `) -} - -func TestCreateUsernameDomainNamePassword(t *testing.T) { - authTokenPost(t, gophercloud.AuthOptions{Username: "frank", Password: "swordfish", DomainName: "spork.net"}, nil, ` - { - "auth": { - "identity": { - "methods": ["password"], - "password": { - "user": { - "domain": { - "name": "spork.net" - }, - "name": "frank", - "password": "swordfish" - } - } - } - } - } - `) -} - -func TestCreateTokenID(t *testing.T) { - authTokenPost(t, gophercloud.AuthOptions{}, nil, ` - { - "auth": { - "identity": { - "methods": ["token"], - "token": { - "id": "12345abcdef" - } - } - } - } - `) -} - -func TestCreateProjectIDScope(t *testing.T) { - options := gophercloud.AuthOptions{UserID: "fenris", Password: "g0t0h311"} - scope := &Scope{ProjectID: "123456"} - authTokenPost(t, options, scope, ` - { - "auth": { - "identity": { - "methods": ["password"], - "password": { - "user": { - "id": "fenris", - "password": "g0t0h311" - } - } - }, - "scope": { - "project": { - "id": "123456" - } - } - } - } - `) -} - -func TestCreateDomainIDScope(t *testing.T) { - options := gophercloud.AuthOptions{UserID: "fenris", Password: "g0t0h311"} - scope := &Scope{DomainID: "1000"} - authTokenPost(t, options, scope, ` - { - "auth": { - "identity": { - "methods": ["password"], - "password": { - "user": { - "id": "fenris", - "password": "g0t0h311" - } - } - }, - "scope": { - "domain": { - "id": "1000" - } - } - } - } - `) -} - -func TestCreateProjectNameAndDomainIDScope(t *testing.T) { - options := gophercloud.AuthOptions{UserID: "fenris", Password: "g0t0h311"} - scope := &Scope{ProjectName: "world-domination", DomainID: "1000"} - authTokenPost(t, options, scope, ` - { - "auth": { - "identity": { - "methods": ["password"], - "password": { - "user": { - "id": "fenris", - "password": "g0t0h311" - } - } - }, - "scope": { - "project": { - "domain": { - "id": "1000" - }, - "name": "world-domination" - } - } - } - } - `) -} - -func TestCreateProjectNameAndDomainNameScope(t *testing.T) { - options := gophercloud.AuthOptions{UserID: "fenris", Password: "g0t0h311"} - scope := &Scope{ProjectName: "world-domination", DomainName: "evil-plans"} - authTokenPost(t, options, scope, ` - { - "auth": { - "identity": { - "methods": ["password"], - "password": { - "user": { - "id": "fenris", - "password": "g0t0h311" - } - } - }, - "scope": { - "project": { - "domain": { - "name": "evil-plans" - }, - "name": "world-domination" - } - } - } - } - `) -} - -func TestCreateExtractsTokenFromResponse(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - - client := gophercloud.ServiceClient{ - ProviderClient: &gophercloud.ProviderClient{}, - Endpoint: testhelper.Endpoint(), - } - - testhelper.Mux.HandleFunc("/auth/tokens", func(w http.ResponseWriter, r *http.Request) { - w.Header().Add("X-Subject-Token", "aaa111") - - w.WriteHeader(http.StatusCreated) - fmt.Fprintf(w, `{ - "token": { - "expires_at": "2014-10-02T13:45:00.000000Z" - } - }`) - }) - - options := gophercloud.AuthOptions{UserID: "me", Password: "shhh"} - token, err := Create(&client, options, nil).Extract() - if err != nil { - t.Fatalf("Create returned an error: %v", err) - } - - if token.ID != "aaa111" { - t.Errorf("Expected token to be aaa111, but was %s", token.ID) - } -} - -func TestCreateFailureEmptyAuth(t *testing.T) { - authTokenPostErr(t, gophercloud.AuthOptions{}, nil, false, ErrMissingPassword) -} - -func TestCreateFailureAPIKey(t *testing.T) { - authTokenPostErr(t, gophercloud.AuthOptions{APIKey: "something"}, nil, false, ErrAPIKeyProvided) -} - -func TestCreateFailureTenantID(t *testing.T) { - authTokenPostErr(t, gophercloud.AuthOptions{TenantID: "something"}, nil, false, ErrTenantIDProvided) -} - -func TestCreateFailureTenantName(t *testing.T) { - authTokenPostErr(t, gophercloud.AuthOptions{TenantName: "something"}, nil, false, ErrTenantNameProvided) -} - -func TestCreateFailureTokenIDUsername(t *testing.T) { - authTokenPostErr(t, gophercloud.AuthOptions{Username: "something"}, nil, true, ErrUsernameWithToken) -} - -func TestCreateFailureTokenIDUserID(t *testing.T) { - authTokenPostErr(t, gophercloud.AuthOptions{UserID: "something"}, nil, true, ErrUserIDWithToken) -} - -func TestCreateFailureTokenIDDomainID(t *testing.T) { - authTokenPostErr(t, gophercloud.AuthOptions{DomainID: "something"}, nil, true, ErrDomainIDWithToken) -} - -func TestCreateFailureTokenIDDomainName(t *testing.T) { - authTokenPostErr(t, gophercloud.AuthOptions{DomainName: "something"}, nil, true, ErrDomainNameWithToken) -} - -func TestCreateFailureMissingUser(t *testing.T) { - options := gophercloud.AuthOptions{Password: "supersecure"} - authTokenPostErr(t, options, nil, false, ErrUsernameOrUserID) -} - -func TestCreateFailureBothUser(t *testing.T) { - options := gophercloud.AuthOptions{ - Password: "supersecure", - Username: "oops", - UserID: "redundancy", - } - authTokenPostErr(t, options, nil, false, ErrUsernameOrUserID) -} - -func TestCreateFailureMissingDomain(t *testing.T) { - options := gophercloud.AuthOptions{ - Password: "supersecure", - Username: "notuniqueenough", - } - authTokenPostErr(t, options, nil, false, ErrDomainIDOrDomainName) -} - -func TestCreateFailureBothDomain(t *testing.T) { - options := gophercloud.AuthOptions{ - Password: "supersecure", - Username: "someone", - DomainID: "hurf", - DomainName: "durf", - } - authTokenPostErr(t, options, nil, false, ErrDomainIDOrDomainName) -} - -func TestCreateFailureUserIDDomainID(t *testing.T) { - options := gophercloud.AuthOptions{ - UserID: "100", - Password: "stuff", - DomainID: "oops", - } - authTokenPostErr(t, options, nil, false, ErrDomainIDWithUserID) -} - -func TestCreateFailureUserIDDomainName(t *testing.T) { - options := gophercloud.AuthOptions{ - UserID: "100", - Password: "sssh", - DomainName: "oops", - } - authTokenPostErr(t, options, nil, false, ErrDomainNameWithUserID) -} - -func TestCreateFailureScopeProjectNameAlone(t *testing.T) { - options := gophercloud.AuthOptions{UserID: "myself", Password: "swordfish"} - scope := &Scope{ProjectName: "notenough"} - authTokenPostErr(t, options, scope, false, ErrScopeDomainIDOrDomainName) -} - -func TestCreateFailureScopeProjectNameAndID(t *testing.T) { - options := gophercloud.AuthOptions{UserID: "myself", Password: "swordfish"} - scope := &Scope{ProjectName: "whoops", ProjectID: "toomuch", DomainID: "1234"} - authTokenPostErr(t, options, scope, false, ErrScopeProjectIDOrProjectName) -} - -func TestCreateFailureScopeProjectIDAndDomainID(t *testing.T) { - options := gophercloud.AuthOptions{UserID: "myself", Password: "swordfish"} - scope := &Scope{ProjectID: "toomuch", DomainID: "notneeded"} - authTokenPostErr(t, options, scope, false, ErrScopeProjectIDAlone) -} - -func TestCreateFailureScopeProjectIDAndDomainNAme(t *testing.T) { - options := gophercloud.AuthOptions{UserID: "myself", Password: "swordfish"} - scope := &Scope{ProjectID: "toomuch", DomainName: "notneeded"} - authTokenPostErr(t, options, scope, false, ErrScopeProjectIDAlone) -} - -func TestCreateFailureScopeDomainIDAndDomainName(t *testing.T) { - options := gophercloud.AuthOptions{UserID: "myself", Password: "swordfish"} - scope := &Scope{DomainID: "toomuch", DomainName: "notneeded"} - authTokenPostErr(t, options, scope, false, ErrScopeDomainIDOrDomainName) -} - -func TestCreateFailureScopeDomainNameAlone(t *testing.T) { - options := gophercloud.AuthOptions{UserID: "myself", Password: "swordfish"} - scope := &Scope{DomainName: "notenough"} - authTokenPostErr(t, options, scope, false, ErrScopeDomainName) -} - -func TestCreateFailureEmptyScope(t *testing.T) { - options := gophercloud.AuthOptions{UserID: "myself", Password: "swordfish"} - scope := &Scope{} - authTokenPostErr(t, options, scope, false, ErrScopeEmpty) -} - -func TestGetRequest(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - - client := gophercloud.ServiceClient{ - ProviderClient: &gophercloud.ProviderClient{ - TokenID: "12345abcdef", - }, - Endpoint: testhelper.Endpoint(), - } - - testhelper.Mux.HandleFunc("/auth/tokens", func(w http.ResponseWriter, r *http.Request) { - testhelper.TestMethod(t, r, "GET") - testhelper.TestHeader(t, r, "Content-Type", "") - testhelper.TestHeader(t, r, "Accept", "application/json") - testhelper.TestHeader(t, r, "X-Auth-Token", "12345abcdef") - testhelper.TestHeader(t, r, "X-Subject-Token", "abcdef12345") - - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, ` - { "token": { "expires_at": "2014-08-29T13:10:01.000000Z" } } - `) - }) - - token, err := Get(&client, "abcdef12345").Extract() - if err != nil { - t.Errorf("Info returned an error: %v", err) - } - - expected, _ := time.Parse(time.UnixDate, "Fri Aug 29 13:10:01 UTC 2014") - if token.ExpiresAt != expected { - t.Errorf("Expected expiration time %s, but was %s", expected.Format(time.UnixDate), token.ExpiresAt.Format(time.UnixDate)) - } -} - -func prepareAuthTokenHandler(t *testing.T, expectedMethod string, status int) gophercloud.ServiceClient { - client := gophercloud.ServiceClient{ - ProviderClient: &gophercloud.ProviderClient{ - TokenID: "12345abcdef", - }, - Endpoint: testhelper.Endpoint(), - } - - testhelper.Mux.HandleFunc("/auth/tokens", func(w http.ResponseWriter, r *http.Request) { - testhelper.TestMethod(t, r, expectedMethod) - testhelper.TestHeader(t, r, "Content-Type", "") - testhelper.TestHeader(t, r, "Accept", "application/json") - testhelper.TestHeader(t, r, "X-Auth-Token", "12345abcdef") - testhelper.TestHeader(t, r, "X-Subject-Token", "abcdef12345") - - w.WriteHeader(status) - }) - - return client -} - -func TestValidateRequestSuccessful(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - client := prepareAuthTokenHandler(t, "HEAD", http.StatusNoContent) - - ok, err := Validate(&client, "abcdef12345") - if err != nil { - t.Errorf("Unexpected error from Validate: %v", err) - } - - if !ok { - t.Errorf("Validate returned false for a valid token") - } -} - -func TestValidateRequestFailure(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - client := prepareAuthTokenHandler(t, "HEAD", http.StatusNotFound) - - ok, err := Validate(&client, "abcdef12345") - if err != nil { - t.Errorf("Unexpected error from Validate: %v", err) - } - - if ok { - t.Errorf("Validate returned true for an invalid token") - } -} - -func TestValidateRequestError(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - client := prepareAuthTokenHandler(t, "HEAD", http.StatusUnauthorized) - - _, err := Validate(&client, "abcdef12345") - if err == nil { - t.Errorf("Missing expected error from Validate") - } -} - -func TestRevokeRequestSuccessful(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - client := prepareAuthTokenHandler(t, "DELETE", http.StatusNoContent) - - res := Revoke(&client, "abcdef12345") - testhelper.AssertNoErr(t, res.Err) -} - -func TestRevokeRequestError(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - client := prepareAuthTokenHandler(t, "DELETE", http.StatusNotFound) - - res := Revoke(&client, "abcdef12345") - if res.Err == nil { - t.Errorf("Missing expected error from Revoke") - } -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/urls_test.go deleted file mode 100644 index 549c398620..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/identity/v3/tokens/urls_test.go +++ /dev/null @@ -1,21 +0,0 @@ -package tokens - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/testhelper" -) - -func TestTokenURL(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - - client := gophercloud.ServiceClient{Endpoint: testhelper.Endpoint()} - - expected := testhelper.Endpoint() + "auth/tokens" - actual := tokenURL(&client) - if actual != expected { - t.Errorf("Expected URL %s, but was %s", expected, actual) - } -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/apiversions/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/apiversions/requests_test.go deleted file mode 100644 index d35af9f0c6..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/apiversions/requests_test.go +++ /dev/null @@ -1,182 +0,0 @@ -package apiversions - -import ( - "fmt" - "net/http" - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListVersions(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "versions": [ - { - "status": "CURRENT", - "id": "v2.0", - "links": [ - { - "href": "http://23.253.228.211:9696/v2.0", - "rel": "self" - } - ] - } - ] -}`) - }) - - count := 0 - - ListVersions(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractAPIVersions(page) - if err != nil { - t.Errorf("Failed to extract API versions: %v", err) - return false, err - } - - expected := []APIVersion{ - APIVersion{ - Status: "CURRENT", - ID: "v2.0", - }, - } - - th.AssertDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestNonJSONCannotBeExtractedIntoAPIVersions(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - }) - - ListVersions(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - if _, err := ExtractAPIVersions(page); err == nil { - t.Fatalf("Expected error, got nil") - } - return true, nil - }) -} - -func TestAPIInfo(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "resources": [ - { - "links": [ - { - "href": "http://23.253.228.211:9696/v2.0/subnets", - "rel": "self" - } - ], - "name": "subnet", - "collection": "subnets" - }, - { - "links": [ - { - "href": "http://23.253.228.211:9696/v2.0/networks", - "rel": "self" - } - ], - "name": "network", - "collection": "networks" - }, - { - "links": [ - { - "href": "http://23.253.228.211:9696/v2.0/ports", - "rel": "self" - } - ], - "name": "port", - "collection": "ports" - } - ] -} - `) - }) - - count := 0 - - ListVersionResources(fake.ServiceClient(), "v2.0").EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractVersionResources(page) - if err != nil { - t.Errorf("Failed to extract version resources: %v", err) - return false, err - } - - expected := []APIVersionResource{ - APIVersionResource{ - Name: "subnet", - Collection: "subnets", - }, - APIVersionResource{ - Name: "network", - Collection: "networks", - }, - APIVersionResource{ - Name: "port", - Collection: "ports", - }, - } - - th.AssertDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestNonJSONCannotBeExtractedIntoAPIVersionResources(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - }) - - ListVersionResources(fake.ServiceClient(), "v2.0").EachPage(func(page pagination.Page) (bool, error) { - if _, err := ExtractVersionResources(page); err == nil { - t.Fatalf("Expected error, got nil") - } - return true, nil - }) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/apiversions/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/apiversions/urls_test.go deleted file mode 100644 index 7dd069c94f..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/apiversions/urls_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package apiversions - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909/" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestAPIVersionsURL(t *testing.T) { - actual := apiVersionsURL(endpointClient()) - expected := endpoint - th.AssertEquals(t, expected, actual) -} - -func TestAPIInfoURL(t *testing.T) { - actual := apiInfoURL(endpointClient(), "v2.0") - expected := endpoint + "v2.0/" - th.AssertEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/delegate_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/delegate_test.go deleted file mode 100644 index 3d2ac78d48..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/delegate_test.go +++ /dev/null @@ -1,105 +0,0 @@ -package extensions - -import ( - "fmt" - "net/http" - "testing" - - common "github.com/rackspace/gophercloud/openstack/common/extensions" - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/extensions", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - - fmt.Fprintf(w, ` -{ - "extensions": [ - { - "updated": "2013-01-20T00:00:00-00:00", - "name": "Neutron Service Type Management", - "links": [], - "namespace": "http://docs.openstack.org/ext/neutron/service-type/api/v1.0", - "alias": "service-type", - "description": "API for retrieving service providers for Neutron advanced services" - } - ] -} - `) - }) - - count := 0 - - List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractExtensions(page) - if err != nil { - t.Errorf("Failed to extract extensions: %v", err) - } - - expected := []Extension{ - Extension{ - common.Extension{ - Updated: "2013-01-20T00:00:00-00:00", - Name: "Neutron Service Type Management", - Links: []interface{}{}, - Namespace: "http://docs.openstack.org/ext/neutron/service-type/api/v1.0", - Alias: "service-type", - Description: "API for retrieving service providers for Neutron advanced services", - }, - }, - } - - th.AssertDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/extensions/agent", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "extension": { - "updated": "2013-02-03T10:00:00-00:00", - "name": "agent", - "links": [], - "namespace": "http://docs.openstack.org/ext/agent/api/v2.0", - "alias": "agent", - "description": "The agent management extension." - } -} - `) - }) - - ext, err := Get(fake.ServiceClient(), "agent").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, ext.Updated, "2013-02-03T10:00:00-00:00") - th.AssertEquals(t, ext.Name, "agent") - th.AssertEquals(t, ext.Namespace, "http://docs.openstack.org/ext/agent/api/v2.0") - th.AssertEquals(t, ext.Alias, "agent") - th.AssertEquals(t, ext.Description, "The agent management extension.") -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/external/results_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/external/results_test.go deleted file mode 100644 index 916cd2cfd0..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/external/results_test.go +++ /dev/null @@ -1,254 +0,0 @@ -package external - -import ( - "errors" - "fmt" - "net/http" - "testing" - - "github.com/rackspace/gophercloud/openstack/networking/v2/networks" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/networks", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "networks": [ - { - "admin_state_up": true, - "id": "0f38d5ad-10a6-428f-a5fc-825cfe0f1970", - "name": "net1", - "router:external": false, - "shared": false, - "status": "ACTIVE", - "subnets": [ - "25778974-48a8-46e7-8998-9dc8c70d2f06" - ], - "tenant_id": "b575417a6c444a6eb5cc3a58eb4f714a" - }, - { - "admin_state_up": true, - "id": "8d05a1b1-297a-46ca-8974-17debf51ca3c", - "name": "ext_net", - "router:external": true, - "shared": false, - "status": "ACTIVE", - "subnets": [ - "2f1fb918-9b0e-4bf9-9a50-6cebbb4db2c5" - ], - "tenant_id": "5eb8995cf717462c9df8d1edfa498010" - } - ] -} - `) - }) - - count := 0 - - networks.List(fake.ServiceClient(), networks.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractList(page) - if err != nil { - t.Errorf("Failed to extract networks: %v", err) - return false, err - } - - expected := []NetworkExternal{ - NetworkExternal{ - Status: "ACTIVE", - Subnets: []string{"25778974-48a8-46e7-8998-9dc8c70d2f06"}, - Name: "net1", - AdminStateUp: true, - TenantID: "b575417a6c444a6eb5cc3a58eb4f714a", - Shared: false, - ID: "0f38d5ad-10a6-428f-a5fc-825cfe0f1970", - External: false, - }, - NetworkExternal{ - Status: "ACTIVE", - Subnets: []string{"2f1fb918-9b0e-4bf9-9a50-6cebbb4db2c5"}, - Name: "ext_net", - AdminStateUp: true, - TenantID: "5eb8995cf717462c9df8d1edfa498010", - Shared: false, - ID: "8d05a1b1-297a-46ca-8974-17debf51ca3c", - External: true, - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/networks/d32019d3-bc6e-4319-9c1d-6722fc136a22", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "network": { - "admin_state_up": true, - "id": "8d05a1b1-297a-46ca-8974-17debf51ca3c", - "name": "ext_net", - "router:external": true, - "shared": false, - "status": "ACTIVE", - "subnets": [ - "2f1fb918-9b0e-4bf9-9a50-6cebbb4db2c5" - ], - "tenant_id": "5eb8995cf717462c9df8d1edfa498010" - } -} - `) - }) - - res := networks.Get(fake.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22") - n, err := ExtractGet(res) - - th.AssertNoErr(t, err) - th.AssertEquals(t, true, n.External) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/networks", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "network": { - "admin_state_up": true, - "name": "ext_net", - "router:external": true - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "network": { - "admin_state_up": true, - "id": "8d05a1b1-297a-46ca-8974-17debf51ca3c", - "name": "ext_net", - "router:external": true, - "shared": false, - "status": "ACTIVE", - "subnets": [ - "2f1fb918-9b0e-4bf9-9a50-6cebbb4db2c5" - ], - "tenant_id": "5eb8995cf717462c9df8d1edfa498010" - } -} - `) - }) - - options := CreateOpts{networks.CreateOpts{Name: "ext_net", AdminStateUp: Up}, true} - res := networks.Create(fake.ServiceClient(), options) - - n, err := ExtractCreate(res) - - th.AssertNoErr(t, err) - th.AssertEquals(t, true, n.External) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/networks/4e8e5957-649f-477b-9e5b-f1f75b21c03c", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "network": { - "router:external": true, - "name": "new_name" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "network": { - "admin_state_up": true, - "id": "8d05a1b1-297a-46ca-8974-17debf51ca3c", - "name": "new_name", - "router:external": true, - "shared": false, - "status": "ACTIVE", - "subnets": [ - "2f1fb918-9b0e-4bf9-9a50-6cebbb4db2c5" - ], - "tenant_id": "5eb8995cf717462c9df8d1edfa498010" - } -} - `) - }) - - options := UpdateOpts{networks.UpdateOpts{Name: "new_name"}, true} - res := networks.Update(fake.ServiceClient(), "4e8e5957-649f-477b-9e5b-f1f75b21c03c", options) - n, err := ExtractUpdate(res) - - th.AssertNoErr(t, err) - th.AssertEquals(t, true, n.External) -} - -func TestExtractFnsReturnsErrWhenResultContainsErr(t *testing.T) { - gr := networks.GetResult{} - gr.Err = errors.New("") - - if _, err := ExtractGet(gr); err == nil { - t.Fatalf("Expected error, got one") - } - - ur := networks.UpdateResult{} - ur.Err = errors.New("") - - if _, err := ExtractUpdate(ur); err == nil { - t.Fatalf("Expected error, got one") - } - - cr := networks.CreateResult{} - cr.Err = errors.New("") - - if _, err := ExtractCreate(cr); err == nil { - t.Fatalf("Expected error, got one") - } -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/firewalls/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/firewalls/requests_test.go deleted file mode 100644 index 19d32c5ac3..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/firewalls/requests_test.go +++ /dev/null @@ -1,246 +0,0 @@ -package firewalls - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestURLs(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.AssertEquals(t, th.Endpoint()+"v2.0/fw/firewalls", rootURL(fake.ServiceClient())) -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/fw/firewalls", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "firewalls":[ - { - "status": "ACTIVE", - "name": "fw1", - "admin_state_up": false, - "tenant_id": "b4eedccc6fb74fa8a7ad6b08382b852b", - "firewall_policy_id": "34be8c83-4d42-4dca-a74e-b77fffb8e28a", - "id": "fb5b5315-64f6-4ea3-8e58-981cc37c6f61", - "description": "OpenStack firewall 1" - }, - { - "status": "PENDING_UPDATE", - "name": "fw2", - "admin_state_up": true, - "tenant_id": "b4eedccc6fb74fa8a7ad6b08382b852b", - "firewall_policy_id": "34be8c83-4d42-4dca-a74e-b77fffb8e299", - "id": "fb5b5315-64f6-4ea3-8e58-981cc37c6f99", - "description": "OpenStack firewall 2" - } - ] -} - `) - }) - - count := 0 - - List(fake.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractFirewalls(page) - if err != nil { - t.Errorf("Failed to extract members: %v", err) - return false, err - } - - expected := []Firewall{ - Firewall{ - Status: "ACTIVE", - Name: "fw1", - AdminStateUp: false, - TenantID: "b4eedccc6fb74fa8a7ad6b08382b852b", - PolicyID: "34be8c83-4d42-4dca-a74e-b77fffb8e28a", - ID: "fb5b5315-64f6-4ea3-8e58-981cc37c6f61", - Description: "OpenStack firewall 1", - }, - Firewall{ - Status: "PENDING_UPDATE", - Name: "fw2", - AdminStateUp: true, - TenantID: "b4eedccc6fb74fa8a7ad6b08382b852b", - PolicyID: "34be8c83-4d42-4dca-a74e-b77fffb8e299", - ID: "fb5b5315-64f6-4ea3-8e58-981cc37c6f99", - Description: "OpenStack firewall 2", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/fw/firewalls", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "firewall":{ - "name": "fw", - "description": "OpenStack firewall", - "admin_state_up": true, - "firewall_policy_id": "19ab8c87-4a32-4e6a-a74e-b77fffb89a0c", - "tenant_id": "b4eedccc6fb74fa8a7ad6b08382b852b" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "firewall":{ - "status": "PENDING_CREATE", - "name": "fw", - "description": "OpenStack firewall", - "admin_state_up": true, - "tenant_id": "b4eedccc6fb74fa8a7ad6b08382b852b", - "firewall_policy_id": "19ab8c87-4a32-4e6a-a74e-b77fffb89a0c" - } -} - `) - }) - - options := CreateOpts{ - TenantID: "b4eedccc6fb74fa8a7ad6b08382b852b", - Name: "fw", - Description: "OpenStack firewall", - AdminStateUp: Up, - PolicyID: "19ab8c87-4a32-4e6a-a74e-b77fffb89a0c", - } - _, err := Create(fake.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/fw/firewalls/fb5b5315-64f6-4ea3-8e58-981cc37c6f61", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "firewall": { - "status": "ACTIVE", - "name": "fw", - "admin_state_up": true, - "tenant_id": "b4eedccc6fb74fa8a7ad6b08382b852b", - "firewall_policy_id": "34be8c83-4d42-4dca-a74e-b77fffb8e28a", - "id": "fb5b5315-64f6-4ea3-8e58-981cc37c6f61", - "description": "OpenStack firewall" - } -} - `) - }) - - fw, err := Get(fake.ServiceClient(), "fb5b5315-64f6-4ea3-8e58-981cc37c6f61").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "ACTIVE", fw.Status) - th.AssertEquals(t, "fw", fw.Name) - th.AssertEquals(t, "OpenStack firewall", fw.Description) - th.AssertEquals(t, true, fw.AdminStateUp) - th.AssertEquals(t, "34be8c83-4d42-4dca-a74e-b77fffb8e28a", fw.PolicyID) - th.AssertEquals(t, "fb5b5315-64f6-4ea3-8e58-981cc37c6f61", fw.ID) - th.AssertEquals(t, "b4eedccc6fb74fa8a7ad6b08382b852b", fw.TenantID) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/fw/firewalls/ea5b5315-64f6-4ea3-8e58-981cc37c6576", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "firewall":{ - "name": "fw", - "description": "updated fw", - "admin_state_up":false, - "firewall_policy_id": "19ab8c87-4a32-4e6a-a74e-b77fffb89a0c" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "firewall": { - "status": "ACTIVE", - "name": "fw", - "admin_state_up": false, - "tenant_id": "b4eedccc6fb74fa8a7ad6b08382b852b", - "firewall_policy_id": "19ab8c87-4a32-4e6a-a74e-b77fffb89a0c", - "id": "ea5b5315-64f6-4ea3-8e58-981cc37c6576", - "description": "OpenStack firewall" - } -} - `) - }) - - options := UpdateOpts{ - Name: "fw", - Description: "updated fw", - AdminStateUp: Down, - PolicyID: "19ab8c87-4a32-4e6a-a74e-b77fffb89a0c", - } - - _, err := Update(fake.ServiceClient(), "ea5b5315-64f6-4ea3-8e58-981cc37c6576", options).Extract() - th.AssertNoErr(t, err) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/fw/firewalls/4ec89087-d057-4e2c-911f-60a3b47ee304", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "4ec89087-d057-4e2c-911f-60a3b47ee304") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/policies/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/policies/requests_test.go deleted file mode 100644 index b9d78652c3..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/policies/requests_test.go +++ /dev/null @@ -1,279 +0,0 @@ -package policies - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestURLs(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.AssertEquals(t, th.Endpoint()+"v2.0/fw/firewall_policies", rootURL(fake.ServiceClient())) -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/fw/firewall_policies", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "firewall_policies": [ - { - "name": "policy1", - "firewall_rules": [ - "75452b36-268e-4e75-aaf4-f0e7ed50bc97", - "c9e77ca0-1bc8-497d-904d-948107873dc6" - ], - "tenant_id": "9145d91459d248b1b02fdaca97c6a75d", - "audited": true, - "shared": false, - "id": "f2b08c1e-aa81-4668-8ae1-1401bcb0576c", - "description": "Firewall policy 1" - }, - { - "name": "policy2", - "firewall_rules": [ - "03d2a6ad-633f-431a-8463-4370d06a22c8" - ], - "tenant_id": "9145d91459d248b1b02fdaca97c6a75d", - "audited": false, - "shared": true, - "id": "c854fab5-bdaf-4a86-9359-78de93e5df01", - "description": "Firewall policy 2" - } - ] -} - `) - }) - - count := 0 - - List(fake.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractPolicies(page) - if err != nil { - t.Errorf("Failed to extract members: %v", err) - return false, err - } - - expected := []Policy{ - Policy{ - Name: "policy1", - Rules: []string{ - "75452b36-268e-4e75-aaf4-f0e7ed50bc97", - "c9e77ca0-1bc8-497d-904d-948107873dc6", - }, - TenantID: "9145d91459d248b1b02fdaca97c6a75d", - Audited: true, - Shared: false, - ID: "f2b08c1e-aa81-4668-8ae1-1401bcb0576c", - Description: "Firewall policy 1", - }, - Policy{ - Name: "policy2", - Rules: []string{ - "03d2a6ad-633f-431a-8463-4370d06a22c8", - }, - TenantID: "9145d91459d248b1b02fdaca97c6a75d", - Audited: false, - Shared: true, - ID: "c854fab5-bdaf-4a86-9359-78de93e5df01", - Description: "Firewall policy 2", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/fw/firewall_policies", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "firewall_policy":{ - "name": "policy", - "firewall_rules": [ - "98a58c87-76be-ae7c-a74e-b77fffb88d95", - "11a58c87-76be-ae7c-a74e-b77fffb88a32" - ], - "description": "Firewall policy", - "tenant_id": "9145d91459d248b1b02fdaca97c6a75d", - "audited": true, - "shared": false - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "firewall_policy":{ - "name": "policy", - "firewall_rules": [ - "98a58c87-76be-ae7c-a74e-b77fffb88d95", - "11a58c87-76be-ae7c-a74e-b77fffb88a32" - ], - "tenant_id": "9145d91459d248b1b02fdaca97c6a75d", - "audited": false, - "id": "f2b08c1e-aa81-4668-8ae1-1401bcb0576c", - "description": "Firewall policy" - } -} - `) - }) - - options := CreateOpts{ - TenantID: "9145d91459d248b1b02fdaca97c6a75d", - Name: "policy", - Description: "Firewall policy", - Shared: No, - Audited: Yes, - Rules: []string{ - "98a58c87-76be-ae7c-a74e-b77fffb88d95", - "11a58c87-76be-ae7c-a74e-b77fffb88a32", - }, - } - - _, err := Create(fake.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/fw/firewall_policies/bcab5315-64f6-4ea3-8e58-981cc37c6f61", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "firewall_policy":{ - "name": "www", - "firewall_rules": [ - "75452b36-268e-4e75-aaf4-f0e7ed50bc97", - "c9e77ca0-1bc8-497d-904d-948107873dc6", - "03d2a6ad-633f-431a-8463-4370d06a22c8" - ], - "tenant_id": "9145d91459d248b1b02fdaca97c6a75d", - "audited": false, - "id": "f2b08c1e-aa81-4668-8ae1-1401bcb0576c", - "description": "Firewall policy web" - } -} - `) - }) - - policy, err := Get(fake.ServiceClient(), "bcab5315-64f6-4ea3-8e58-981cc37c6f61").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "www", policy.Name) - th.AssertEquals(t, "f2b08c1e-aa81-4668-8ae1-1401bcb0576c", policy.ID) - th.AssertEquals(t, "Firewall policy web", policy.Description) - th.AssertEquals(t, 3, len(policy.Rules)) - th.AssertEquals(t, "75452b36-268e-4e75-aaf4-f0e7ed50bc97", policy.Rules[0]) - th.AssertEquals(t, "c9e77ca0-1bc8-497d-904d-948107873dc6", policy.Rules[1]) - th.AssertEquals(t, "03d2a6ad-633f-431a-8463-4370d06a22c8", policy.Rules[2]) - th.AssertEquals(t, "9145d91459d248b1b02fdaca97c6a75d", policy.TenantID) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/fw/firewall_policies/f2b08c1e-aa81-4668-8ae1-1401bcb0576c", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "firewall_policy":{ - "name": "policy", - "firewall_rules": [ - "98a58c87-76be-ae7c-a74e-b77fffb88d95", - "11a58c87-76be-ae7c-a74e-b77fffb88a32" - ], - "description": "Firewall policy" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "firewall_policy":{ - "name": "policy", - "firewall_rules": [ - "75452b36-268e-4e75-aaf4-f0e7ed50bc97", - "c9e77ca0-1bc8-497d-904d-948107873dc6", - "03d2a6ad-633f-431a-8463-4370d06a22c8" - ], - "tenant_id": "9145d91459d248b1b02fdaca97c6a75d", - "audited": false, - "id": "f2b08c1e-aa81-4668-8ae1-1401bcb0576c", - "description": "Firewall policy" - } -} - `) - }) - - options := UpdateOpts{ - Name: "policy", - Description: "Firewall policy", - Rules: []string{ - "98a58c87-76be-ae7c-a74e-b77fffb88d95", - "11a58c87-76be-ae7c-a74e-b77fffb88a32", - }, - } - - _, err := Update(fake.ServiceClient(), "f2b08c1e-aa81-4668-8ae1-1401bcb0576c", options).Extract() - th.AssertNoErr(t, err) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/fw/firewall_policies/4ec89077-d057-4a2b-911f-60a3b47ee304", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "4ec89077-d057-4a2b-911f-60a3b47ee304") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/rules/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/rules/requests_test.go deleted file mode 100644 index 36f89fa5c4..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/rules/requests_test.go +++ /dev/null @@ -1,328 +0,0 @@ -package rules - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestURLs(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.AssertEquals(t, th.Endpoint()+"v2.0/fw/firewall_rules", rootURL(fake.ServiceClient())) -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/fw/firewall_rules", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "firewall_rules": [ - { - "protocol": "tcp", - "description": "ssh rule", - "source_port": null, - "source_ip_address": null, - "destination_ip_address": "192.168.1.0/24", - "firewall_policy_id": "e2a5fb51-698c-4898-87e8-f1eee6b50919", - "position": 2, - "destination_port": "22", - "id": "f03bd950-6c56-4f5e-a307-45967078f507", - "name": "ssh_form_any", - "tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61", - "enabled": true, - "action": "allow", - "ip_version": 4, - "shared": false - }, - { - "protocol": "udp", - "description": "udp rule", - "source_port": null, - "source_ip_address": null, - "destination_ip_address": null, - "firewall_policy_id": "98d7fb51-698c-4123-87e8-f1eee6b5ab7e", - "position": 1, - "destination_port": null, - "id": "ab7bd950-6c56-4f5e-a307-45967078f890", - "name": "deny_all_udp", - "tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61", - "enabled": true, - "action": "deny", - "ip_version": 4, - "shared": false - } - ] -} - `) - }) - - count := 0 - - List(fake.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractRules(page) - if err != nil { - t.Errorf("Failed to extract members: %v", err) - return false, err - } - - expected := []Rule{ - Rule{ - Protocol: "tcp", - Description: "ssh rule", - SourcePort: "", - SourceIPAddress: "", - DestinationIPAddress: "192.168.1.0/24", - PolicyID: "e2a5fb51-698c-4898-87e8-f1eee6b50919", - Position: 2, - DestinationPort: "22", - ID: "f03bd950-6c56-4f5e-a307-45967078f507", - Name: "ssh_form_any", - TenantID: "80cf934d6ffb4ef5b244f1c512ad1e61", - Enabled: true, - Action: "allow", - IPVersion: 4, - Shared: false, - }, - Rule{ - Protocol: "udp", - Description: "udp rule", - SourcePort: "", - SourceIPAddress: "", - DestinationIPAddress: "", - PolicyID: "98d7fb51-698c-4123-87e8-f1eee6b5ab7e", - Position: 1, - DestinationPort: "", - ID: "ab7bd950-6c56-4f5e-a307-45967078f890", - Name: "deny_all_udp", - TenantID: "80cf934d6ffb4ef5b244f1c512ad1e61", - Enabled: true, - Action: "deny", - IPVersion: 4, - Shared: false, - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/fw/firewall_rules", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "firewall_rule": { - "protocol": "tcp", - "description": "ssh rule", - "destination_ip_address": "192.168.1.0/24", - "destination_port": "22", - "name": "ssh_form_any", - "action": "allow", - "tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "firewall_rule":{ - "protocol": "tcp", - "description": "ssh rule", - "source_port": null, - "source_ip_address": null, - "destination_ip_address": "192.168.1.0/24", - "firewall_policy_id": "e2a5fb51-698c-4898-87e8-f1eee6b50919", - "position": 2, - "destination_port": "22", - "id": "f03bd950-6c56-4f5e-a307-45967078f507", - "name": "ssh_form_any", - "tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61", - "enabled": true, - "action": "allow", - "ip_version": 4, - "shared": false - } -} - `) - }) - - options := CreateOpts{ - TenantID: "80cf934d6ffb4ef5b244f1c512ad1e61", - Protocol: "tcp", - Description: "ssh rule", - DestinationIPAddress: "192.168.1.0/24", - DestinationPort: "22", - Name: "ssh_form_any", - Action: "allow", - } - - _, err := Create(fake.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/fw/firewall_rules/f03bd950-6c56-4f5e-a307-45967078f507", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "firewall_rule":{ - "protocol": "tcp", - "description": "ssh rule", - "source_port": null, - "source_ip_address": null, - "destination_ip_address": "192.168.1.0/24", - "firewall_policy_id": "e2a5fb51-698c-4898-87e8-f1eee6b50919", - "position": 2, - "destination_port": "22", - "id": "f03bd950-6c56-4f5e-a307-45967078f507", - "name": "ssh_form_any", - "tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61", - "enabled": true, - "action": "allow", - "ip_version": 4, - "shared": false - } -} - `) - }) - - rule, err := Get(fake.ServiceClient(), "f03bd950-6c56-4f5e-a307-45967078f507").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "tcp", rule.Protocol) - th.AssertEquals(t, "ssh rule", rule.Description) - th.AssertEquals(t, "192.168.1.0/24", rule.DestinationIPAddress) - th.AssertEquals(t, "e2a5fb51-698c-4898-87e8-f1eee6b50919", rule.PolicyID) - th.AssertEquals(t, 2, rule.Position) - th.AssertEquals(t, "22", rule.DestinationPort) - th.AssertEquals(t, "f03bd950-6c56-4f5e-a307-45967078f507", rule.ID) - th.AssertEquals(t, "ssh_form_any", rule.Name) - th.AssertEquals(t, "80cf934d6ffb4ef5b244f1c512ad1e61", rule.TenantID) - th.AssertEquals(t, true, rule.Enabled) - th.AssertEquals(t, "allow", rule.Action) - th.AssertEquals(t, 4, rule.IPVersion) - th.AssertEquals(t, false, rule.Shared) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/fw/firewall_rules/f03bd950-6c56-4f5e-a307-45967078f507", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "firewall_rule":{ - "protocol": "tcp", - "description": "ssh rule", - "destination_ip_address": "192.168.1.0/24", - "destination_port": "22", - "source_ip_address": null, - "source_port": null, - "name": "ssh_form_any", - "action": "allow", - "enabled": false - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "firewall_rule":{ - "protocol": "tcp", - "description": "ssh rule", - "source_port": null, - "source_ip_address": null, - "destination_ip_address": "192.168.1.0/24", - "firewall_policy_id": "e2a5fb51-698c-4898-87e8-f1eee6b50919", - "position": 2, - "destination_port": "22", - "id": "f03bd950-6c56-4f5e-a307-45967078f507", - "name": "ssh_form_any", - "tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61", - "enabled": false, - "action": "allow", - "ip_version": 4, - "shared": false - } -} - `) - }) - - destinationIPAddress := "192.168.1.0/24" - destinationPort := "22" - empty := "" - - options := UpdateOpts{ - Protocol: "tcp", - Description: "ssh rule", - DestinationIPAddress: &destinationIPAddress, - DestinationPort: &destinationPort, - Name: "ssh_form_any", - SourceIPAddress: &empty, - SourcePort: &empty, - Action: "allow", - Enabled: No, - } - - _, err := Update(fake.ServiceClient(), "f03bd950-6c56-4f5e-a307-45967078f507", options).Extract() - th.AssertNoErr(t, err) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/fw/firewall_rules/4ec89077-d057-4a2b-911f-60a3b47ee304", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "4ec89077-d057-4a2b-911f-60a3b47ee304") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/floatingips/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/floatingips/requests_test.go deleted file mode 100644 index d914a799bf..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/floatingips/requests_test.go +++ /dev/null @@ -1,355 +0,0 @@ -package floatingips - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/floatingips", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "floatingips": [ - { - "floating_network_id": "6d67c30a-ddb4-49a1-bec3-a65b286b4170", - "router_id": null, - "fixed_ip_address": null, - "floating_ip_address": "192.0.0.4", - "tenant_id": "017d8de156df4177889f31a9bd6edc00", - "status": "DOWN", - "port_id": null, - "id": "2f95fd2b-9f6a-4e8e-9e9a-2cbe286cbf9e" - }, - { - "floating_network_id": "90f742b1-6d17-487b-ba95-71881dbc0b64", - "router_id": "0a24cb83-faf5-4d7f-b723-3144ed8a2167", - "fixed_ip_address": "192.0.0.2", - "floating_ip_address": "10.0.0.3", - "tenant_id": "017d8de156df4177889f31a9bd6edc00", - "status": "DOWN", - "port_id": "74a342ce-8e07-4e91-880c-9f834b68fa25", - "id": "ada25a95-f321-4f59-b0e0-f3a970dd3d63" - } - ] -} - `) - }) - - count := 0 - - List(fake.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractFloatingIPs(page) - if err != nil { - t.Errorf("Failed to extract floating IPs: %v", err) - return false, err - } - - expected := []FloatingIP{ - FloatingIP{ - FloatingNetworkID: "6d67c30a-ddb4-49a1-bec3-a65b286b4170", - FixedIP: "", - FloatingIP: "192.0.0.4", - TenantID: "017d8de156df4177889f31a9bd6edc00", - Status: "DOWN", - PortID: "", - ID: "2f95fd2b-9f6a-4e8e-9e9a-2cbe286cbf9e", - }, - FloatingIP{ - FloatingNetworkID: "90f742b1-6d17-487b-ba95-71881dbc0b64", - FixedIP: "192.0.0.2", - FloatingIP: "10.0.0.3", - TenantID: "017d8de156df4177889f31a9bd6edc00", - Status: "DOWN", - PortID: "74a342ce-8e07-4e91-880c-9f834b68fa25", - ID: "ada25a95-f321-4f59-b0e0-f3a970dd3d63", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestInvalidNextPageURLs(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/floatingips", func(w http.ResponseWriter, r *http.Request) { - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, `{"floatingips": [{}], "floatingips_links": {}}`) - }) - - List(fake.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - ExtractFloatingIPs(page) - return true, nil - }) -} - -func TestRequiredFieldsForCreate(t *testing.T) { - res1 := Create(fake.ServiceClient(), CreateOpts{FloatingNetworkID: ""}) - if res1.Err == nil { - t.Fatalf("Expected error, got none") - } - - res2 := Create(fake.ServiceClient(), CreateOpts{FloatingNetworkID: "foo", PortID: ""}) - if res2.Err == nil { - t.Fatalf("Expected error, got none") - } -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/floatingips", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "floatingip": { - "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", - "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "floatingip": { - "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f", - "tenant_id": "4969c491a3c74ee4af974e6d800c62de", - "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", - "fixed_ip_address": "10.0.0.3", - "floating_ip_address": "", - "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab", - "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7" - } -} - `) - }) - - options := CreateOpts{ - FloatingNetworkID: "376da547-b977-4cfe-9cba-275c80debf57", - PortID: "ce705c24-c1ef-408a-bda3-7bbd946164ab", - } - - ip, err := Create(fake.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "2f245a7b-796b-4f26-9cf9-9e82d248fda7", ip.ID) - th.AssertEquals(t, "4969c491a3c74ee4af974e6d800c62de", ip.TenantID) - th.AssertEquals(t, "376da547-b977-4cfe-9cba-275c80debf57", ip.FloatingNetworkID) - th.AssertEquals(t, "", ip.FloatingIP) - th.AssertEquals(t, "ce705c24-c1ef-408a-bda3-7bbd946164ab", ip.PortID) - th.AssertEquals(t, "10.0.0.3", ip.FixedIP) -} - -func TestCreateEmptyPort(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/floatingips", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` - { - "floatingip": { - "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57" - } - } - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` - { - "floatingip": { - "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f", - "tenant_id": "4969c491a3c74ee4af974e6d800c62de", - "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", - "fixed_ip_address": "10.0.0.3", - "floating_ip_address": "", - "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7" - } - } - `) - }) - - options := CreateOpts{ - FloatingNetworkID: "376da547-b977-4cfe-9cba-275c80debf57", - } - - ip, err := Create(fake.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "2f245a7b-796b-4f26-9cf9-9e82d248fda7", ip.ID) - th.AssertEquals(t, "4969c491a3c74ee4af974e6d800c62de", ip.TenantID) - th.AssertEquals(t, "376da547-b977-4cfe-9cba-275c80debf57", ip.FloatingNetworkID) - th.AssertEquals(t, "", ip.FloatingIP) - th.AssertEquals(t, "", ip.PortID) - th.AssertEquals(t, "10.0.0.3", ip.FixedIP) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/floatingips/2f245a7b-796b-4f26-9cf9-9e82d248fda7", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "floatingip": { - "floating_network_id": "90f742b1-6d17-487b-ba95-71881dbc0b64", - "fixed_ip_address": "192.0.0.2", - "floating_ip_address": "10.0.0.3", - "tenant_id": "017d8de156df4177889f31a9bd6edc00", - "status": "DOWN", - "port_id": "74a342ce-8e07-4e91-880c-9f834b68fa25", - "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7" - } -} - `) - }) - - ip, err := Get(fake.ServiceClient(), "2f245a7b-796b-4f26-9cf9-9e82d248fda7").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "90f742b1-6d17-487b-ba95-71881dbc0b64", ip.FloatingNetworkID) - th.AssertEquals(t, "10.0.0.3", ip.FloatingIP) - th.AssertEquals(t, "74a342ce-8e07-4e91-880c-9f834b68fa25", ip.PortID) - th.AssertEquals(t, "192.0.0.2", ip.FixedIP) - th.AssertEquals(t, "017d8de156df4177889f31a9bd6edc00", ip.TenantID) - th.AssertEquals(t, "DOWN", ip.Status) - th.AssertEquals(t, "2f245a7b-796b-4f26-9cf9-9e82d248fda7", ip.ID) -} - -func TestAssociate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/floatingips/2f245a7b-796b-4f26-9cf9-9e82d248fda7", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "floatingip": { - "port_id": "423abc8d-2991-4a55-ba98-2aaea84cc72e" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "floatingip": { - "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f", - "tenant_id": "4969c491a3c74ee4af974e6d800c62de", - "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", - "fixed_ip_address": null, - "floating_ip_address": "172.24.4.228", - "port_id": "423abc8d-2991-4a55-ba98-2aaea84cc72e", - "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7" - } -} - `) - }) - - ip, err := Update(fake.ServiceClient(), "2f245a7b-796b-4f26-9cf9-9e82d248fda7", UpdateOpts{PortID: "423abc8d-2991-4a55-ba98-2aaea84cc72e"}).Extract() - th.AssertNoErr(t, err) - - th.AssertDeepEquals(t, "423abc8d-2991-4a55-ba98-2aaea84cc72e", ip.PortID) -} - -func TestDisassociate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/floatingips/2f245a7b-796b-4f26-9cf9-9e82d248fda7", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "floatingip": { - "port_id": null - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "floatingip": { - "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f", - "tenant_id": "4969c491a3c74ee4af974e6d800c62de", - "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", - "fixed_ip_address": null, - "floating_ip_address": "172.24.4.228", - "port_id": null, - "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7" - } -} - `) - }) - - ip, err := Update(fake.ServiceClient(), "2f245a7b-796b-4f26-9cf9-9e82d248fda7", UpdateOpts{}).Extract() - th.AssertNoErr(t, err) - - th.AssertDeepEquals(t, "", ip.FixedIP) - th.AssertDeepEquals(t, "", ip.PortID) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/floatingips/2f245a7b-796b-4f26-9cf9-9e82d248fda7", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "2f245a7b-796b-4f26-9cf9-9e82d248fda7") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/routers/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/routers/requests_test.go deleted file mode 100644 index 198173359f..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/routers/requests_test.go +++ /dev/null @@ -1,405 +0,0 @@ -package routers - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestURLs(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.AssertEquals(t, th.Endpoint()+"v2.0/routers", rootURL(fake.ServiceClient())) -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/routers", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "routers": [ - { - "status": "ACTIVE", - "external_gateway_info": null, - "name": "second_routers", - "admin_state_up": true, - "tenant_id": "6b96ff0cb17a4b859e1e575d221683d3", - "id": "7177abc4-5ae9-4bb7-b0d4-89e94a4abf3b" - }, - { - "status": "ACTIVE", - "external_gateway_info": { - "network_id": "3c5bcddd-6af9-4e6b-9c3e-c153e521cab8" - }, - "name": "router1", - "admin_state_up": true, - "tenant_id": "33a40233088643acb66ff6eb0ebea679", - "id": "a9254bdb-2613-4a13-ac4c-adc581fba50d" - } - ] -} - `) - }) - - count := 0 - - List(fake.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractRouters(page) - if err != nil { - t.Errorf("Failed to extract routers: %v", err) - return false, err - } - - expected := []Router{ - Router{ - Status: "ACTIVE", - GatewayInfo: GatewayInfo{NetworkID: ""}, - AdminStateUp: true, - Name: "second_routers", - ID: "7177abc4-5ae9-4bb7-b0d4-89e94a4abf3b", - TenantID: "6b96ff0cb17a4b859e1e575d221683d3", - }, - Router{ - Status: "ACTIVE", - GatewayInfo: GatewayInfo{NetworkID: "3c5bcddd-6af9-4e6b-9c3e-c153e521cab8"}, - AdminStateUp: true, - Name: "router1", - ID: "a9254bdb-2613-4a13-ac4c-adc581fba50d", - TenantID: "33a40233088643acb66ff6eb0ebea679", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/routers", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "router":{ - "name": "foo_router", - "admin_state_up": false, - "external_gateway_info":{ - "network_id":"8ca37218-28ff-41cb-9b10-039601ea7e6b" - } - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "router": { - "status": "ACTIVE", - "external_gateway_info": { - "network_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b" - }, - "name": "foo_router", - "admin_state_up": false, - "tenant_id": "6b96ff0cb17a4b859e1e575d221683d3", - "id": "8604a0de-7f6b-409a-a47c-a1cc7bc77b2e" - } -} - `) - }) - - asu := false - gwi := GatewayInfo{NetworkID: "8ca37218-28ff-41cb-9b10-039601ea7e6b"} - - options := CreateOpts{ - Name: "foo_router", - AdminStateUp: &asu, - GatewayInfo: &gwi, - } - r, err := Create(fake.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "foo_router", r.Name) - th.AssertEquals(t, false, r.AdminStateUp) - th.AssertDeepEquals(t, GatewayInfo{NetworkID: "8ca37218-28ff-41cb-9b10-039601ea7e6b"}, r.GatewayInfo) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/routers/a07eea83-7710-4860-931b-5fe220fae533", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "router": { - "status": "ACTIVE", - "external_gateway_info": { - "network_id": "85d76829-6415-48ff-9c63-5c5ca8c61ac6" - }, - "routes": [ - { - "nexthop": "10.1.0.10", - "destination": "40.0.1.0/24" - } - ], - "name": "router1", - "admin_state_up": true, - "tenant_id": "d6554fe62e2f41efbb6e026fad5c1542", - "id": "a07eea83-7710-4860-931b-5fe220fae533" - } -} - `) - }) - - n, err := Get(fake.ServiceClient(), "a07eea83-7710-4860-931b-5fe220fae533").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.Status, "ACTIVE") - th.AssertDeepEquals(t, n.GatewayInfo, GatewayInfo{NetworkID: "85d76829-6415-48ff-9c63-5c5ca8c61ac6"}) - th.AssertEquals(t, n.Name, "router1") - th.AssertEquals(t, n.AdminStateUp, true) - th.AssertEquals(t, n.TenantID, "d6554fe62e2f41efbb6e026fad5c1542") - th.AssertEquals(t, n.ID, "a07eea83-7710-4860-931b-5fe220fae533") - th.AssertDeepEquals(t, n.Routes, []Route{Route{DestinationCIDR: "40.0.1.0/24", NextHop: "10.1.0.10"}}) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/routers/4e8e5957-649f-477b-9e5b-f1f75b21c03c", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "router": { - "name": "new_name", - "external_gateway_info": { - "network_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b" - }, - "routes": [ - { - "nexthop": "10.1.0.10", - "destination": "40.0.1.0/24" - } - ] - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "router": { - "status": "ACTIVE", - "external_gateway_info": { - "network_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b" - }, - "name": "new_name", - "admin_state_up": true, - "tenant_id": "6b96ff0cb17a4b859e1e575d221683d3", - "id": "8604a0de-7f6b-409a-a47c-a1cc7bc77b2e", - "routes": [ - { - "nexthop": "10.1.0.10", - "destination": "40.0.1.0/24" - } - ] - } -} - `) - }) - - gwi := GatewayInfo{NetworkID: "8ca37218-28ff-41cb-9b10-039601ea7e6b"} - r := []Route{Route{DestinationCIDR: "40.0.1.0/24", NextHop: "10.1.0.10"}} - options := UpdateOpts{Name: "new_name", GatewayInfo: &gwi, Routes: r} - - n, err := Update(fake.ServiceClient(), "4e8e5957-649f-477b-9e5b-f1f75b21c03c", options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.Name, "new_name") - th.AssertDeepEquals(t, n.GatewayInfo, GatewayInfo{NetworkID: "8ca37218-28ff-41cb-9b10-039601ea7e6b"}) - th.AssertDeepEquals(t, n.Routes, []Route{Route{DestinationCIDR: "40.0.1.0/24", NextHop: "10.1.0.10"}}) -} - -func TestAllRoutesRemoved(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/routers/4e8e5957-649f-477b-9e5b-f1f75b21c03c", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "router": { - "routes": [] - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "router": { - "status": "ACTIVE", - "external_gateway_info": { - "network_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b" - }, - "name": "name", - "admin_state_up": true, - "tenant_id": "6b96ff0cb17a4b859e1e575d221683d3", - "id": "8604a0de-7f6b-409a-a47c-a1cc7bc77b2e", - "routes": [] - } -} - `) - }) - - r := []Route{} - options := UpdateOpts{Routes: r} - - n, err := Update(fake.ServiceClient(), "4e8e5957-649f-477b-9e5b-f1f75b21c03c", options).Extract() - th.AssertNoErr(t, err) - - th.AssertDeepEquals(t, n.Routes, []Route{}) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/routers/4e8e5957-649f-477b-9e5b-f1f75b21c03c", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "4e8e5957-649f-477b-9e5b-f1f75b21c03c") - th.AssertNoErr(t, res.Err) -} - -func TestAddInterface(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/routers/4e8e5957-649f-477b-9e5b-f1f75b21c03c/add_router_interface", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "subnet_id": "a2f1f29d-571b-4533-907f-5803ab96ead1" -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "subnet_id": "0d32a837-8069-4ec3-84c4-3eef3e10b188", - "tenant_id": "017d8de156df4177889f31a9bd6edc00", - "port_id": "3f990102-4485-4df1-97a0-2c35bdb85b31", - "id": "9a83fa11-8da5-436e-9afe-3d3ac5ce7770" -} -`) - }) - - opts := InterfaceOpts{SubnetID: "a2f1f29d-571b-4533-907f-5803ab96ead1"} - res, err := AddInterface(fake.ServiceClient(), "4e8e5957-649f-477b-9e5b-f1f75b21c03c", opts).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "0d32a837-8069-4ec3-84c4-3eef3e10b188", res.SubnetID) - th.AssertEquals(t, "017d8de156df4177889f31a9bd6edc00", res.TenantID) - th.AssertEquals(t, "3f990102-4485-4df1-97a0-2c35bdb85b31", res.PortID) - th.AssertEquals(t, "9a83fa11-8da5-436e-9afe-3d3ac5ce7770", res.ID) -} - -func TestAddInterfaceRequiredOpts(t *testing.T) { - _, err := AddInterface(fake.ServiceClient(), "foo", InterfaceOpts{}).Extract() - if err == nil { - t.Fatalf("Expected error, got none") - } - _, err = AddInterface(fake.ServiceClient(), "foo", InterfaceOpts{SubnetID: "bar", PortID: "baz"}).Extract() - if err == nil { - t.Fatalf("Expected error, got none") - } -} - -func TestRemoveInterface(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/routers/4e8e5957-649f-477b-9e5b-f1f75b21c03c/remove_router_interface", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "subnet_id": "a2f1f29d-571b-4533-907f-5803ab96ead1" -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "subnet_id": "0d32a837-8069-4ec3-84c4-3eef3e10b188", - "tenant_id": "017d8de156df4177889f31a9bd6edc00", - "port_id": "3f990102-4485-4df1-97a0-2c35bdb85b31", - "id": "9a83fa11-8da5-436e-9afe-3d3ac5ce7770" -} -`) - }) - - opts := InterfaceOpts{SubnetID: "a2f1f29d-571b-4533-907f-5803ab96ead1"} - res, err := RemoveInterface(fake.ServiceClient(), "4e8e5957-649f-477b-9e5b-f1f75b21c03c", opts).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "0d32a837-8069-4ec3-84c4-3eef3e10b188", res.SubnetID) - th.AssertEquals(t, "017d8de156df4177889f31a9bd6edc00", res.TenantID) - th.AssertEquals(t, "3f990102-4485-4df1-97a0-2c35bdb85b31", res.PortID) - th.AssertEquals(t, "9a83fa11-8da5-436e-9afe-3d3ac5ce7770", res.ID) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/members/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/members/requests_test.go deleted file mode 100644 index dc1ece321f..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/members/requests_test.go +++ /dev/null @@ -1,243 +0,0 @@ -package members - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestURLs(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.AssertEquals(t, th.Endpoint()+"v2.0/lb/members", rootURL(fake.ServiceClient())) -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/members", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "members":[ - { - "status":"ACTIVE", - "weight":1, - "admin_state_up":true, - "tenant_id":"83657cfcdfe44cd5920adaf26c48ceea", - "pool_id":"72741b06-df4d-4715-b142-276b6bce75ab", - "address":"10.0.0.4", - "protocol_port":80, - "id":"701b531b-111a-4f21-ad85-4795b7b12af6" - }, - { - "status":"ACTIVE", - "weight":1, - "admin_state_up":true, - "tenant_id":"83657cfcdfe44cd5920adaf26c48ceea", - "pool_id":"72741b06-df4d-4715-b142-276b6bce75ab", - "address":"10.0.0.3", - "protocol_port":80, - "id":"beb53b4d-230b-4abd-8118-575b8fa006ef" - } - ] -} - `) - }) - - count := 0 - - List(fake.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractMembers(page) - if err != nil { - t.Errorf("Failed to extract members: %v", err) - return false, err - } - - expected := []Member{ - Member{ - Status: "ACTIVE", - Weight: 1, - AdminStateUp: true, - TenantID: "83657cfcdfe44cd5920adaf26c48ceea", - PoolID: "72741b06-df4d-4715-b142-276b6bce75ab", - Address: "10.0.0.4", - ProtocolPort: 80, - ID: "701b531b-111a-4f21-ad85-4795b7b12af6", - }, - Member{ - Status: "ACTIVE", - Weight: 1, - AdminStateUp: true, - TenantID: "83657cfcdfe44cd5920adaf26c48ceea", - PoolID: "72741b06-df4d-4715-b142-276b6bce75ab", - Address: "10.0.0.3", - ProtocolPort: 80, - ID: "beb53b4d-230b-4abd-8118-575b8fa006ef", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/members", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "member": { - "tenant_id": "453105b9-1754-413f-aab1-55f1af620750", - "pool_id": "foo", - "address": "192.0.2.14", - "protocol_port":8080 - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "member": { - "id": "975592ca-e308-48ad-8298-731935ee9f45", - "address": "192.0.2.14", - "protocol_port": 8080, - "tenant_id": "453105b9-1754-413f-aab1-55f1af620750", - "admin_state_up":true, - "weight": 1, - "status": "DOWN" - } -} - `) - }) - - options := CreateOpts{ - TenantID: "453105b9-1754-413f-aab1-55f1af620750", - Address: "192.0.2.14", - ProtocolPort: 8080, - PoolID: "foo", - } - _, err := Create(fake.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/members/975592ca-e308-48ad-8298-731935ee9f45", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "member":{ - "id":"975592ca-e308-48ad-8298-731935ee9f45", - "address":"192.0.2.14", - "protocol_port":8080, - "tenant_id":"453105b9-1754-413f-aab1-55f1af620750", - "admin_state_up":true, - "weight":1, - "status":"DOWN" - } -} - `) - }) - - m, err := Get(fake.ServiceClient(), "975592ca-e308-48ad-8298-731935ee9f45").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "975592ca-e308-48ad-8298-731935ee9f45", m.ID) - th.AssertEquals(t, "192.0.2.14", m.Address) - th.AssertEquals(t, 8080, m.ProtocolPort) - th.AssertEquals(t, "453105b9-1754-413f-aab1-55f1af620750", m.TenantID) - th.AssertEquals(t, true, m.AdminStateUp) - th.AssertEquals(t, 1, m.Weight) - th.AssertEquals(t, "DOWN", m.Status) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/members/332abe93-f488-41ba-870b-2ac66be7f853", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "member":{ - "admin_state_up":false - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "member":{ - "status":"PENDING_UPDATE", - "protocol_port":8080, - "weight":1, - "admin_state_up":false, - "tenant_id":"4fd44f30292945e481c7b8a0c8908869", - "pool_id":"7803631d-f181-4500-b3a2-1b68ba2a75fd", - "address":"10.0.0.5", - "status_description":null, - "id":"48a471ea-64f1-4eb6-9be7-dae6bbe40a0f" - } -} - `) - }) - - options := UpdateOpts{AdminStateUp: false} - - _, err := Update(fake.ServiceClient(), "332abe93-f488-41ba-870b-2ac66be7f853", options).Extract() - th.AssertNoErr(t, err) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/members/332abe93-f488-41ba-870b-2ac66be7f853", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "332abe93-f488-41ba-870b-2ac66be7f853") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/monitors/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/monitors/requests_test.go deleted file mode 100644 index 79a99bf8a2..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/monitors/requests_test.go +++ /dev/null @@ -1,312 +0,0 @@ -package monitors - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestURLs(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.AssertEquals(t, th.Endpoint()+"v2.0/lb/health_monitors", rootURL(fake.ServiceClient())) -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/health_monitors", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "health_monitors":[ - { - "admin_state_up":true, - "tenant_id":"83657cfcdfe44cd5920adaf26c48ceea", - "delay":10, - "max_retries":1, - "timeout":1, - "type":"PING", - "id":"466c8345-28d8-4f84-a246-e04380b0461d" - }, - { - "admin_state_up":true, - "tenant_id":"83657cfcdfe44cd5920adaf26c48ceea", - "delay":5, - "expected_codes":"200", - "max_retries":2, - "http_method":"GET", - "timeout":2, - "url_path":"/", - "type":"HTTP", - "id":"5d4b5228-33b0-4e60-b225-9b727c1a20e7" - } - ] -} - `) - }) - - count := 0 - - List(fake.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractMonitors(page) - if err != nil { - t.Errorf("Failed to extract monitors: %v", err) - return false, err - } - - expected := []Monitor{ - Monitor{ - AdminStateUp: true, - TenantID: "83657cfcdfe44cd5920adaf26c48ceea", - Delay: 10, - MaxRetries: 1, - Timeout: 1, - Type: "PING", - ID: "466c8345-28d8-4f84-a246-e04380b0461d", - }, - Monitor{ - AdminStateUp: true, - TenantID: "83657cfcdfe44cd5920adaf26c48ceea", - Delay: 5, - ExpectedCodes: "200", - MaxRetries: 2, - Timeout: 2, - URLPath: "/", - Type: "HTTP", - HTTPMethod: "GET", - ID: "5d4b5228-33b0-4e60-b225-9b727c1a20e7", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestDelayMustBeGreaterOrEqualThanTimeout(t *testing.T) { - _, err := Create(fake.ServiceClient(), CreateOpts{ - Type: "HTTP", - Delay: 1, - Timeout: 10, - MaxRetries: 5, - URLPath: "/check", - ExpectedCodes: "200-299", - }).Extract() - - if err == nil { - t.Fatalf("Expected error, got none") - } - - _, err = Update(fake.ServiceClient(), "453105b9-1754-413f-aab1-55f1af620750", UpdateOpts{ - Delay: 1, - Timeout: 10, - }).Extract() - - if err == nil { - t.Fatalf("Expected error, got none") - } -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/health_monitors", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "health_monitor":{ - "type":"HTTP", - "tenant_id":"453105b9-1754-413f-aab1-55f1af620750", - "delay":20, - "timeout":10, - "max_retries":5, - "url_path":"/check", - "expected_codes":"200-299" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "health_monitor":{ - "id":"f3eeab00-8367-4524-b662-55e64d4cacb5", - "tenant_id":"453105b9-1754-413f-aab1-55f1af620750", - "type":"HTTP", - "delay":20, - "timeout":10, - "max_retries":5, - "http_method":"GET", - "url_path":"/check", - "expected_codes":"200-299", - "admin_state_up":true, - "status":"ACTIVE" - } -} - `) - }) - - _, err := Create(fake.ServiceClient(), CreateOpts{ - Type: "HTTP", - TenantID: "453105b9-1754-413f-aab1-55f1af620750", - Delay: 20, - Timeout: 10, - MaxRetries: 5, - URLPath: "/check", - ExpectedCodes: "200-299", - }).Extract() - - th.AssertNoErr(t, err) -} - -func TestRequiredCreateOpts(t *testing.T) { - res := Create(fake.ServiceClient(), CreateOpts{}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } - res = Create(fake.ServiceClient(), CreateOpts{Type: TypeHTTP}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/health_monitors/f3eeab00-8367-4524-b662-55e64d4cacb5", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "health_monitor":{ - "id":"f3eeab00-8367-4524-b662-55e64d4cacb5", - "tenant_id":"453105b9-1754-413f-aab1-55f1af620750", - "type":"HTTP", - "delay":20, - "timeout":10, - "max_retries":5, - "http_method":"GET", - "url_path":"/check", - "expected_codes":"200-299", - "admin_state_up":true, - "status":"ACTIVE" - } -} - `) - }) - - hm, err := Get(fake.ServiceClient(), "f3eeab00-8367-4524-b662-55e64d4cacb5").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "f3eeab00-8367-4524-b662-55e64d4cacb5", hm.ID) - th.AssertEquals(t, "453105b9-1754-413f-aab1-55f1af620750", hm.TenantID) - th.AssertEquals(t, "HTTP", hm.Type) - th.AssertEquals(t, 20, hm.Delay) - th.AssertEquals(t, 10, hm.Timeout) - th.AssertEquals(t, 5, hm.MaxRetries) - th.AssertEquals(t, "GET", hm.HTTPMethod) - th.AssertEquals(t, "/check", hm.URLPath) - th.AssertEquals(t, "200-299", hm.ExpectedCodes) - th.AssertEquals(t, true, hm.AdminStateUp) - th.AssertEquals(t, "ACTIVE", hm.Status) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/health_monitors/b05e44b5-81f9-4551-b474-711a722698f7", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "health_monitor":{ - "delay": 3, - "timeout": 20, - "max_retries": 10, - "url_path": "/another_check", - "expected_codes": "301" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusAccepted) - - fmt.Fprintf(w, ` -{ - "health_monitor": { - "admin_state_up": true, - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "delay": 3, - "max_retries": 10, - "http_method": "GET", - "timeout": 20, - "pools": [ - { - "status": "PENDING_CREATE", - "status_description": null, - "pool_id": "6e55751f-6ad4-4e53-b8d4-02e442cd21df" - } - ], - "type": "PING", - "id": "b05e44b5-81f9-4551-b474-711a722698f7" - } -} - `) - }) - - _, err := Update(fake.ServiceClient(), "b05e44b5-81f9-4551-b474-711a722698f7", UpdateOpts{ - Delay: 3, - Timeout: 20, - MaxRetries: 10, - URLPath: "/another_check", - ExpectedCodes: "301", - }).Extract() - - th.AssertNoErr(t, err) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/health_monitors/b05e44b5-81f9-4551-b474-711a722698f7", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "b05e44b5-81f9-4551-b474-711a722698f7") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/pools/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/pools/requests_test.go deleted file mode 100644 index 3b5c7c7105..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/pools/requests_test.go +++ /dev/null @@ -1,318 +0,0 @@ -package pools - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestURLs(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.AssertEquals(t, th.Endpoint()+"v2.0/lb/pools", rootURL(fake.ServiceClient())) -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/pools", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "pools":[ - { - "status":"ACTIVE", - "lb_method":"ROUND_ROBIN", - "protocol":"HTTP", - "description":"", - "health_monitors":[ - "466c8345-28d8-4f84-a246-e04380b0461d", - "5d4b5228-33b0-4e60-b225-9b727c1a20e7" - ], - "members":[ - "701b531b-111a-4f21-ad85-4795b7b12af6", - "beb53b4d-230b-4abd-8118-575b8fa006ef" - ], - "status_description": null, - "id":"72741b06-df4d-4715-b142-276b6bce75ab", - "vip_id":"4ec89087-d057-4e2c-911f-60a3b47ee304", - "name":"app_pool", - "admin_state_up":true, - "subnet_id":"8032909d-47a1-4715-90af-5153ffe39861", - "tenant_id":"83657cfcdfe44cd5920adaf26c48ceea", - "health_monitors_status": [], - "provider": "haproxy" - } - ] -} - `) - }) - - count := 0 - - List(fake.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractPools(page) - if err != nil { - t.Errorf("Failed to extract pools: %v", err) - return false, err - } - - expected := []Pool{ - Pool{ - Status: "ACTIVE", - LBMethod: "ROUND_ROBIN", - Protocol: "HTTP", - Description: "", - MonitorIDs: []string{ - "466c8345-28d8-4f84-a246-e04380b0461d", - "5d4b5228-33b0-4e60-b225-9b727c1a20e7", - }, - SubnetID: "8032909d-47a1-4715-90af-5153ffe39861", - TenantID: "83657cfcdfe44cd5920adaf26c48ceea", - AdminStateUp: true, - Name: "app_pool", - MemberIDs: []string{ - "701b531b-111a-4f21-ad85-4795b7b12af6", - "beb53b4d-230b-4abd-8118-575b8fa006ef", - }, - ID: "72741b06-df4d-4715-b142-276b6bce75ab", - VIPID: "4ec89087-d057-4e2c-911f-60a3b47ee304", - Provider: "haproxy", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/pools", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "pool": { - "lb_method": "ROUND_ROBIN", - "protocol": "HTTP", - "name": "Example pool", - "subnet_id": "1981f108-3c48-48d2-b908-30f7d28532c9", - "tenant_id": "2ffc6e22aae24e4795f87155d24c896f" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "pool": { - "status": "PENDING_CREATE", - "lb_method": "ROUND_ROBIN", - "protocol": "HTTP", - "description": "", - "health_monitors": [], - "members": [], - "status_description": null, - "id": "69055154-f603-4a28-8951-7cc2d9e54a9a", - "vip_id": null, - "name": "Example pool", - "admin_state_up": true, - "subnet_id": "1981f108-3c48-48d2-b908-30f7d28532c9", - "tenant_id": "2ffc6e22aae24e4795f87155d24c896f", - "health_monitors_status": [] - } -} - `) - }) - - options := CreateOpts{ - LBMethod: LBMethodRoundRobin, - Protocol: "HTTP", - Name: "Example pool", - SubnetID: "1981f108-3c48-48d2-b908-30f7d28532c9", - TenantID: "2ffc6e22aae24e4795f87155d24c896f", - } - p, err := Create(fake.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "PENDING_CREATE", p.Status) - th.AssertEquals(t, "ROUND_ROBIN", p.LBMethod) - th.AssertEquals(t, "HTTP", p.Protocol) - th.AssertEquals(t, "", p.Description) - th.AssertDeepEquals(t, []string{}, p.MonitorIDs) - th.AssertDeepEquals(t, []string{}, p.MemberIDs) - th.AssertEquals(t, "69055154-f603-4a28-8951-7cc2d9e54a9a", p.ID) - th.AssertEquals(t, "Example pool", p.Name) - th.AssertEquals(t, "1981f108-3c48-48d2-b908-30f7d28532c9", p.SubnetID) - th.AssertEquals(t, "2ffc6e22aae24e4795f87155d24c896f", p.TenantID) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/pools/332abe93-f488-41ba-870b-2ac66be7f853", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "pool":{ - "id":"332abe93-f488-41ba-870b-2ac66be7f853", - "tenant_id":"19eaa775-cf5d-49bc-902e-2f85f668d995", - "name":"Example pool", - "description":"", - "protocol":"tcp", - "lb_algorithm":"ROUND_ROBIN", - "session_persistence":{ - }, - "healthmonitor_id":null, - "members":[ - ], - "admin_state_up":true, - "status":"ACTIVE" - } -} - `) - }) - - n, err := Get(fake.ServiceClient(), "332abe93-f488-41ba-870b-2ac66be7f853").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.ID, "332abe93-f488-41ba-870b-2ac66be7f853") -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/pools/332abe93-f488-41ba-870b-2ac66be7f853", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "pool":{ - "name":"SuperPool", - "lb_method": "LEAST_CONNECTIONS" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "pool":{ - "status":"PENDING_UPDATE", - "lb_method":"LEAST_CONNECTIONS", - "protocol":"TCP", - "description":"", - "health_monitors":[ - - ], - "subnet_id":"8032909d-47a1-4715-90af-5153ffe39861", - "tenant_id":"83657cfcdfe44cd5920adaf26c48ceea", - "admin_state_up":true, - "name":"SuperPool", - "members":[ - - ], - "id":"61b1f87a-7a21-4ad3-9dda-7f81d249944f", - "vip_id":null - } -} - `) - }) - - options := UpdateOpts{Name: "SuperPool", LBMethod: LBMethodLeastConnections} - - n, err := Update(fake.ServiceClient(), "332abe93-f488-41ba-870b-2ac66be7f853", options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "SuperPool", n.Name) - th.AssertDeepEquals(t, "LEAST_CONNECTIONS", n.LBMethod) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/pools/332abe93-f488-41ba-870b-2ac66be7f853", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "332abe93-f488-41ba-870b-2ac66be7f853") - th.AssertNoErr(t, res.Err) -} - -func TestAssociateHealthMonitor(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/pools/332abe93-f488-41ba-870b-2ac66be7f853/health_monitors", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "health_monitor":{ - "id":"b624decf-d5d3-4c66-9a3d-f047e7786181" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - fmt.Fprintf(w, `{}`) - }) - - _, err := AssociateMonitor(fake.ServiceClient(), "332abe93-f488-41ba-870b-2ac66be7f853", "b624decf-d5d3-4c66-9a3d-f047e7786181").Extract() - th.AssertNoErr(t, err) -} - -func TestDisassociateHealthMonitor(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/pools/332abe93-f488-41ba-870b-2ac66be7f853/health_monitors/b624decf-d5d3-4c66-9a3d-f047e7786181", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := DisassociateMonitor(fake.ServiceClient(), "332abe93-f488-41ba-870b-2ac66be7f853", "b624decf-d5d3-4c66-9a3d-f047e7786181") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/vips/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/vips/requests_test.go deleted file mode 100644 index 430f1a1eeb..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas/vips/requests_test.go +++ /dev/null @@ -1,336 +0,0 @@ -package vips - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestURLs(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.AssertEquals(t, th.Endpoint()+"v2.0/lb/vips", rootURL(fake.ServiceClient())) - th.AssertEquals(t, th.Endpoint()+"v2.0/lb/vips/foo", resourceURL(fake.ServiceClient(), "foo")) -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/vips", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "vips":[ - { - "id": "db902c0c-d5ff-4753-b465-668ad9656918", - "tenant_id": "310df60f-2a10-4ee5-9554-98393092194c", - "name": "web_vip", - "description": "lb config for the web tier", - "subnet_id": "96a4386a-f8c3-42ed-afce-d7954eee77b3", - "address" : "10.30.176.47", - "port_id" : "cd1f7a47-4fa6-449c-9ee7-632838aedfea", - "protocol": "HTTP", - "protocol_port": 80, - "pool_id" : "cfc6589d-f949-4c66-99d2-c2da56ef3764", - "admin_state_up": true, - "status": "ACTIVE" - }, - { - "id": "36e08a3e-a78f-4b40-a229-1e7e23eee1ab", - "tenant_id": "310df60f-2a10-4ee5-9554-98393092194c", - "name": "db_vip", - "description": "lb config for the db tier", - "subnet_id": "9cedb85d-0759-4898-8a4b-fa5a5ea10086", - "address" : "10.30.176.48", - "port_id" : "cd1f7a47-4fa6-449c-9ee7-632838aedfea", - "protocol": "TCP", - "protocol_port": 3306, - "pool_id" : "41efe233-7591-43c5-9cf7-923964759f9e", - "session_persistence" : {"type" : "SOURCE_IP"}, - "connection_limit" : 2000, - "admin_state_up": true, - "status": "INACTIVE" - } - ] -} - `) - }) - - count := 0 - - List(fake.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractVIPs(page) - if err != nil { - t.Errorf("Failed to extract LBs: %v", err) - return false, err - } - - expected := []VirtualIP{ - VirtualIP{ - ID: "db902c0c-d5ff-4753-b465-668ad9656918", - TenantID: "310df60f-2a10-4ee5-9554-98393092194c", - Name: "web_vip", - Description: "lb config for the web tier", - SubnetID: "96a4386a-f8c3-42ed-afce-d7954eee77b3", - Address: "10.30.176.47", - PortID: "cd1f7a47-4fa6-449c-9ee7-632838aedfea", - Protocol: "HTTP", - ProtocolPort: 80, - PoolID: "cfc6589d-f949-4c66-99d2-c2da56ef3764", - Persistence: SessionPersistence{}, - ConnLimit: 0, - AdminStateUp: true, - Status: "ACTIVE", - }, - VirtualIP{ - ID: "36e08a3e-a78f-4b40-a229-1e7e23eee1ab", - TenantID: "310df60f-2a10-4ee5-9554-98393092194c", - Name: "db_vip", - Description: "lb config for the db tier", - SubnetID: "9cedb85d-0759-4898-8a4b-fa5a5ea10086", - Address: "10.30.176.48", - PortID: "cd1f7a47-4fa6-449c-9ee7-632838aedfea", - Protocol: "TCP", - ProtocolPort: 3306, - PoolID: "41efe233-7591-43c5-9cf7-923964759f9e", - Persistence: SessionPersistence{Type: "SOURCE_IP"}, - ConnLimit: 2000, - AdminStateUp: true, - Status: "INACTIVE", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/vips", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "vip": { - "protocol": "HTTP", - "name": "NewVip", - "admin_state_up": true, - "subnet_id": "8032909d-47a1-4715-90af-5153ffe39861", - "pool_id": "61b1f87a-7a21-4ad3-9dda-7f81d249944f", - "protocol_port": 80, - "session_persistence": {"type": "SOURCE_IP"} - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "vip": { - "status": "PENDING_CREATE", - "protocol": "HTTP", - "description": "", - "admin_state_up": true, - "subnet_id": "8032909d-47a1-4715-90af-5153ffe39861", - "tenant_id": "83657cfcdfe44cd5920adaf26c48ceea", - "connection_limit": -1, - "pool_id": "61b1f87a-7a21-4ad3-9dda-7f81d249944f", - "address": "10.0.0.11", - "protocol_port": 80, - "port_id": "f7e6fe6a-b8b5-43a8-8215-73456b32e0f5", - "id": "c987d2be-9a3c-4ac9-a046-e8716b1350e2", - "name": "NewVip" - } -} - `) - }) - - opts := CreateOpts{ - Protocol: "HTTP", - Name: "NewVip", - AdminStateUp: Up, - SubnetID: "8032909d-47a1-4715-90af-5153ffe39861", - PoolID: "61b1f87a-7a21-4ad3-9dda-7f81d249944f", - ProtocolPort: 80, - Persistence: &SessionPersistence{Type: "SOURCE_IP"}, - } - - r, err := Create(fake.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "PENDING_CREATE", r.Status) - th.AssertEquals(t, "HTTP", r.Protocol) - th.AssertEquals(t, "", r.Description) - th.AssertEquals(t, true, r.AdminStateUp) - th.AssertEquals(t, "8032909d-47a1-4715-90af-5153ffe39861", r.SubnetID) - th.AssertEquals(t, "83657cfcdfe44cd5920adaf26c48ceea", r.TenantID) - th.AssertEquals(t, -1, r.ConnLimit) - th.AssertEquals(t, "61b1f87a-7a21-4ad3-9dda-7f81d249944f", r.PoolID) - th.AssertEquals(t, "10.0.0.11", r.Address) - th.AssertEquals(t, 80, r.ProtocolPort) - th.AssertEquals(t, "f7e6fe6a-b8b5-43a8-8215-73456b32e0f5", r.PortID) - th.AssertEquals(t, "c987d2be-9a3c-4ac9-a046-e8716b1350e2", r.ID) - th.AssertEquals(t, "NewVip", r.Name) -} - -func TestRequiredCreateOpts(t *testing.T) { - res := Create(fake.ServiceClient(), CreateOpts{}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } - res = Create(fake.ServiceClient(), CreateOpts{Name: "foo"}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } - res = Create(fake.ServiceClient(), CreateOpts{Name: "foo", SubnetID: "bar"}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } - res = Create(fake.ServiceClient(), CreateOpts{Name: "foo", SubnetID: "bar", Protocol: "bar"}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } - res = Create(fake.ServiceClient(), CreateOpts{Name: "foo", SubnetID: "bar", Protocol: "bar", ProtocolPort: 80}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/vips/4ec89087-d057-4e2c-911f-60a3b47ee304", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "vip": { - "status": "ACTIVE", - "protocol": "HTTP", - "description": "", - "admin_state_up": true, - "subnet_id": "8032909d-47a1-4715-90af-5153ffe39861", - "tenant_id": "83657cfcdfe44cd5920adaf26c48ceea", - "connection_limit": 1000, - "pool_id": "72741b06-df4d-4715-b142-276b6bce75ab", - "session_persistence": { - "cookie_name": "MyAppCookie", - "type": "APP_COOKIE" - }, - "address": "10.0.0.10", - "protocol_port": 80, - "port_id": "b5a743d6-056b-468b-862d-fb13a9aa694e", - "id": "4ec89087-d057-4e2c-911f-60a3b47ee304", - "name": "my-vip" - } -} - `) - }) - - vip, err := Get(fake.ServiceClient(), "4ec89087-d057-4e2c-911f-60a3b47ee304").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "ACTIVE", vip.Status) - th.AssertEquals(t, "HTTP", vip.Protocol) - th.AssertEquals(t, "", vip.Description) - th.AssertEquals(t, true, vip.AdminStateUp) - th.AssertEquals(t, 1000, vip.ConnLimit) - th.AssertEquals(t, SessionPersistence{Type: "APP_COOKIE", CookieName: "MyAppCookie"}, vip.Persistence) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/vips/4ec89087-d057-4e2c-911f-60a3b47ee304", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "vip": { - "connection_limit": 1000, - "session_persistence": {"type": "SOURCE_IP"} - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusAccepted) - - fmt.Fprintf(w, ` -{ - "vip": { - "status": "PENDING_UPDATE", - "protocol": "HTTP", - "description": "", - "admin_state_up": true, - "subnet_id": "8032909d-47a1-4715-90af-5153ffe39861", - "tenant_id": "83657cfcdfe44cd5920adaf26c48ceea", - "connection_limit": 1000, - "pool_id": "61b1f87a-7a21-4ad3-9dda-7f81d249944f", - "address": "10.0.0.11", - "protocol_port": 80, - "port_id": "f7e6fe6a-b8b5-43a8-8215-73456b32e0f5", - "id": "c987d2be-9a3c-4ac9-a046-e8716b1350e2", - "name": "NewVip" - } -} - `) - }) - - i1000 := 1000 - options := UpdateOpts{ - ConnLimit: &i1000, - Persistence: &SessionPersistence{Type: "SOURCE_IP"}, - } - vip, err := Update(fake.ServiceClient(), "4ec89087-d057-4e2c-911f-60a3b47ee304", options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "PENDING_UPDATE", vip.Status) - th.AssertEquals(t, 1000, vip.ConnLimit) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/lb/vips/4ec89087-d057-4e2c-911f-60a3b47ee304", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "4ec89087-d057-4e2c-911f-60a3b47ee304") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/provider/results_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/provider/results_test.go deleted file mode 100644 index 80816926da..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/provider/results_test.go +++ /dev/null @@ -1,253 +0,0 @@ -package provider - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - "github.com/rackspace/gophercloud/openstack/networking/v2/networks" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/networks", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "networks": [ - { - "status": "ACTIVE", - "subnets": [ - "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" - ], - "name": "private-network", - "admin_state_up": true, - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "shared": true, - "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", - "provider:segmentation_id": null, - "provider:physical_network": null, - "provider:network_type": "local" - }, - { - "status": "ACTIVE", - "subnets": [ - "08eae331-0402-425a-923c-34f7cfe39c1b" - ], - "name": "private", - "admin_state_up": true, - "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e", - "shared": true, - "id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324", - "provider:segmentation_id": 1234567890, - "provider:physical_network": null, - "provider:network_type": "local" - } - ] -} - `) - }) - - count := 0 - - networks.List(fake.ServiceClient(), networks.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractList(page) - if err != nil { - t.Errorf("Failed to extract networks: %v", err) - return false, err - } - - expected := []NetworkExtAttrs{ - NetworkExtAttrs{ - Status: "ACTIVE", - Subnets: []string{"54d6f61d-db07-451c-9ab3-b9609b6b6f0b"}, - Name: "private-network", - AdminStateUp: true, - TenantID: "4fd44f30292945e481c7b8a0c8908869", - Shared: true, - ID: "d32019d3-bc6e-4319-9c1d-6722fc136a22", - NetworkType: "local", - PhysicalNetwork: "", - SegmentationID: "", - }, - NetworkExtAttrs{ - Status: "ACTIVE", - Subnets: []string{"08eae331-0402-425a-923c-34f7cfe39c1b"}, - Name: "private", - AdminStateUp: true, - TenantID: "26a7980765d0414dbc1fc1f88cdb7e6e", - Shared: true, - ID: "db193ab3-96e3-4cb3-8fc5-05f4296d0324", - NetworkType: "local", - PhysicalNetwork: "", - SegmentationID: "1234567890", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/networks/d32019d3-bc6e-4319-9c1d-6722fc136a22", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "network": { - "status": "ACTIVE", - "subnets": [ - "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" - ], - "name": "private-network", - "provider:physical_network": null, - "admin_state_up": true, - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "provider:network_type": "local", - "shared": true, - "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", - "provider:segmentation_id": null - } -} - `) - }) - - res := networks.Get(fake.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22") - n, err := ExtractGet(res) - - th.AssertNoErr(t, err) - - th.AssertEquals(t, "", n.PhysicalNetwork) - th.AssertEquals(t, "local", n.NetworkType) - th.AssertEquals(t, "", n.SegmentationID) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/networks", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "network": { - "name": "sample_network", - "admin_state_up": true - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "network": { - "status": "ACTIVE", - "subnets": [ - "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" - ], - "name": "private-network", - "provider:physical_network": null, - "admin_state_up": true, - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "provider:network_type": "local", - "shared": true, - "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", - "provider:segmentation_id": null - } -} - `) - }) - - options := networks.CreateOpts{Name: "sample_network", AdminStateUp: Up} - res := networks.Create(fake.ServiceClient(), options) - n, err := ExtractCreate(res) - - th.AssertNoErr(t, err) - - th.AssertEquals(t, "", n.PhysicalNetwork) - th.AssertEquals(t, "local", n.NetworkType) - th.AssertEquals(t, "", n.SegmentationID) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/networks/4e8e5957-649f-477b-9e5b-f1f75b21c03c", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "network": { - "name": "new_network_name", - "admin_state_up": false, - "shared": true - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "network": { - "status": "ACTIVE", - "subnets": [ - "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" - ], - "name": "private-network", - "provider:physical_network": null, - "admin_state_up": true, - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "provider:network_type": "local", - "shared": true, - "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", - "provider:segmentation_id": null - } -} - `) - }) - - iTrue := true - options := networks.UpdateOpts{Name: "new_network_name", AdminStateUp: Down, Shared: &iTrue} - res := networks.Update(fake.ServiceClient(), "4e8e5957-649f-477b-9e5b-f1f75b21c03c", options) - n, err := ExtractUpdate(res) - - th.AssertNoErr(t, err) - - th.AssertEquals(t, "", n.PhysicalNetwork) - th.AssertEquals(t, "local", n.NetworkType) - th.AssertEquals(t, "", n.SegmentationID) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/groups/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/groups/requests_test.go deleted file mode 100644 index 5f074c72f3..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/groups/requests_test.go +++ /dev/null @@ -1,213 +0,0 @@ -package groups - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/rules" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestURLs(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.AssertEquals(t, th.Endpoint()+"v2.0/security-groups", rootURL(fake.ServiceClient())) - th.AssertEquals(t, th.Endpoint()+"v2.0/security-groups/foo", resourceURL(fake.ServiceClient(), "foo")) -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/security-groups", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "security_groups": [ - { - "description": "default", - "id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "name": "default", - "security_group_rules": [], - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - } - ] -} - `) - }) - - count := 0 - - List(fake.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractGroups(page) - if err != nil { - t.Errorf("Failed to extract secgroups: %v", err) - return false, err - } - - expected := []SecGroup{ - SecGroup{ - Description: "default", - ID: "85cc3048-abc3-43cc-89b3-377341426ac5", - Name: "default", - Rules: []rules.SecGroupRule{}, - TenantID: "e4f50856753b4dc6afee5fa6b9b6c550", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/security-groups", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "security_group": { - "name": "new-webservers", - "description": "security group for webservers" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "security_group": { - "description": "security group for webservers", - "id": "2076db17-a522-4506-91de-c6dd8e837028", - "name": "new-webservers", - "security_group_rules": [ - { - "direction": "egress", - "ethertype": "IPv4", - "id": "38ce2d8e-e8f1-48bd-83c2-d33cb9f50c3d", - "port_range_max": null, - "port_range_min": null, - "protocol": null, - "remote_group_id": null, - "remote_ip_prefix": null, - "security_group_id": "2076db17-a522-4506-91de-c6dd8e837028", - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - }, - { - "direction": "egress", - "ethertype": "IPv6", - "id": "565b9502-12de-4ffd-91e9-68885cff6ae1", - "port_range_max": null, - "port_range_min": null, - "protocol": null, - "remote_group_id": null, - "remote_ip_prefix": null, - "security_group_id": "2076db17-a522-4506-91de-c6dd8e837028", - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - } - ], - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - } -} - `) - }) - - opts := CreateOpts{Name: "new-webservers", Description: "security group for webservers"} - _, err := Create(fake.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/security-groups/85cc3048-abc3-43cc-89b3-377341426ac5", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "security_group": { - "description": "default", - "id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "name": "default", - "security_group_rules": [ - { - "direction": "egress", - "ethertype": "IPv6", - "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff", - "port_range_max": null, - "port_range_min": null, - "protocol": null, - "remote_group_id": null, - "remote_ip_prefix": null, - "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - }, - { - "direction": "egress", - "ethertype": "IPv4", - "id": "93aa42e5-80db-4581-9391-3a608bd0e448", - "port_range_max": null, - "port_range_min": null, - "protocol": null, - "remote_group_id": null, - "remote_ip_prefix": null, - "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - } - ], - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - } -} - `) - }) - - sg, err := Get(fake.ServiceClient(), "85cc3048-abc3-43cc-89b3-377341426ac5").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "default", sg.Description) - th.AssertEquals(t, "85cc3048-abc3-43cc-89b3-377341426ac5", sg.ID) - th.AssertEquals(t, "default", sg.Name) - th.AssertEquals(t, 2, len(sg.Rules)) - th.AssertEquals(t, "e4f50856753b4dc6afee5fa6b9b6c550", sg.TenantID) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/security-groups/4ec89087-d057-4e2c-911f-60a3b47ee304", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "4ec89087-d057-4e2c-911f-60a3b47ee304") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/rules/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/rules/requests_test.go deleted file mode 100644 index b5afef31ed..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/rules/requests_test.go +++ /dev/null @@ -1,243 +0,0 @@ -package rules - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestURLs(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.AssertEquals(t, th.Endpoint()+"v2.0/security-group-rules", rootURL(fake.ServiceClient())) - th.AssertEquals(t, th.Endpoint()+"v2.0/security-group-rules/foo", resourceURL(fake.ServiceClient(), "foo")) -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/security-group-rules", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "security_group_rules": [ - { - "direction": "egress", - "ethertype": "IPv6", - "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff", - "port_range_max": null, - "port_range_min": null, - "protocol": null, - "remote_group_id": null, - "remote_ip_prefix": null, - "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - }, - { - "direction": "egress", - "ethertype": "IPv4", - "id": "93aa42e5-80db-4581-9391-3a608bd0e448", - "port_range_max": null, - "port_range_min": null, - "protocol": null, - "remote_group_id": null, - "remote_ip_prefix": null, - "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - } - ] -} - `) - }) - - count := 0 - - List(fake.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractRules(page) - if err != nil { - t.Errorf("Failed to extract secrules: %v", err) - return false, err - } - - expected := []SecGroupRule{ - SecGroupRule{ - Direction: "egress", - EtherType: "IPv6", - ID: "3c0e45ff-adaf-4124-b083-bf390e5482ff", - PortRangeMax: 0, - PortRangeMin: 0, - Protocol: "", - RemoteGroupID: "", - RemoteIPPrefix: "", - SecGroupID: "85cc3048-abc3-43cc-89b3-377341426ac5", - TenantID: "e4f50856753b4dc6afee5fa6b9b6c550", - }, - SecGroupRule{ - Direction: "egress", - EtherType: "IPv4", - ID: "93aa42e5-80db-4581-9391-3a608bd0e448", - PortRangeMax: 0, - PortRangeMin: 0, - Protocol: "", - RemoteGroupID: "", - RemoteIPPrefix: "", - SecGroupID: "85cc3048-abc3-43cc-89b3-377341426ac5", - TenantID: "e4f50856753b4dc6afee5fa6b9b6c550", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/security-group-rules", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "security_group_rule": { - "direction": "ingress", - "port_range_min": 80, - "ethertype": "IPv4", - "port_range_max": 80, - "protocol": "tcp", - "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "security_group_id": "a7734e61-b545-452d-a3cd-0189cbd9747a" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "security_group_rule": { - "direction": "ingress", - "ethertype": "IPv4", - "id": "2bc0accf-312e-429a-956e-e4407625eb62", - "port_range_max": 80, - "port_range_min": 80, - "protocol": "tcp", - "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "remote_ip_prefix": null, - "security_group_id": "a7734e61-b545-452d-a3cd-0189cbd9747a", - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - } -} - `) - }) - - opts := CreateOpts{ - Direction: "ingress", - PortRangeMin: 80, - EtherType: "IPv4", - PortRangeMax: 80, - Protocol: "tcp", - RemoteGroupID: "85cc3048-abc3-43cc-89b3-377341426ac5", - SecGroupID: "a7734e61-b545-452d-a3cd-0189cbd9747a", - } - _, err := Create(fake.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) -} - -func TestRequiredCreateOpts(t *testing.T) { - res := Create(fake.ServiceClient(), CreateOpts{Direction: "something"}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } - res = Create(fake.ServiceClient(), CreateOpts{Direction: DirIngress, EtherType: "something"}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } - res = Create(fake.ServiceClient(), CreateOpts{Direction: DirIngress, EtherType: Ether4}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } - res = Create(fake.ServiceClient(), CreateOpts{Direction: DirIngress, EtherType: Ether4, SecGroupID: "something", Protocol: "foo"}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/security-group-rules/3c0e45ff-adaf-4124-b083-bf390e5482ff", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "security_group_rule": { - "direction": "egress", - "ethertype": "IPv6", - "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff", - "port_range_max": null, - "port_range_min": null, - "protocol": null, - "remote_group_id": null, - "remote_ip_prefix": null, - "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - } -} - `) - }) - - sr, err := Get(fake.ServiceClient(), "3c0e45ff-adaf-4124-b083-bf390e5482ff").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "egress", sr.Direction) - th.AssertEquals(t, "IPv6", sr.EtherType) - th.AssertEquals(t, "3c0e45ff-adaf-4124-b083-bf390e5482ff", sr.ID) - th.AssertEquals(t, 0, sr.PortRangeMax) - th.AssertEquals(t, 0, sr.PortRangeMin) - th.AssertEquals(t, "", sr.Protocol) - th.AssertEquals(t, "", sr.RemoteGroupID) - th.AssertEquals(t, "", sr.RemoteIPPrefix) - th.AssertEquals(t, "85cc3048-abc3-43cc-89b3-377341426ac5", sr.SecGroupID) - th.AssertEquals(t, "e4f50856753b4dc6afee5fa6b9b6c550", sr.TenantID) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/security-group-rules/4ec89087-d057-4e2c-911f-60a3b47ee304", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "4ec89087-d057-4e2c-911f-60a3b47ee304") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/networks/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/networks/requests_test.go deleted file mode 100644 index 81eb79cb54..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/networks/requests_test.go +++ /dev/null @@ -1,276 +0,0 @@ -package networks - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/networks", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "networks": [ - { - "status": "ACTIVE", - "subnets": [ - "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" - ], - "name": "private-network", - "admin_state_up": true, - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "shared": true, - "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22" - }, - { - "status": "ACTIVE", - "subnets": [ - "08eae331-0402-425a-923c-34f7cfe39c1b" - ], - "name": "private", - "admin_state_up": true, - "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e", - "shared": true, - "id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324" - } - ] -} - `) - }) - - client := fake.ServiceClient() - count := 0 - - List(client, ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractNetworks(page) - if err != nil { - t.Errorf("Failed to extract networks: %v", err) - return false, err - } - - expected := []Network{ - Network{ - Status: "ACTIVE", - Subnets: []string{"54d6f61d-db07-451c-9ab3-b9609b6b6f0b"}, - Name: "private-network", - AdminStateUp: true, - TenantID: "4fd44f30292945e481c7b8a0c8908869", - Shared: true, - ID: "d32019d3-bc6e-4319-9c1d-6722fc136a22", - }, - Network{ - Status: "ACTIVE", - Subnets: []string{"08eae331-0402-425a-923c-34f7cfe39c1b"}, - Name: "private", - AdminStateUp: true, - TenantID: "26a7980765d0414dbc1fc1f88cdb7e6e", - Shared: true, - ID: "db193ab3-96e3-4cb3-8fc5-05f4296d0324", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/networks/d32019d3-bc6e-4319-9c1d-6722fc136a22", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "network": { - "status": "ACTIVE", - "subnets": [ - "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" - ], - "name": "private-network", - "admin_state_up": true, - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "shared": true, - "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22" - } -} - `) - }) - - n, err := Get(fake.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.Status, "ACTIVE") - th.AssertDeepEquals(t, n.Subnets, []string{"54d6f61d-db07-451c-9ab3-b9609b6b6f0b"}) - th.AssertEquals(t, n.Name, "private-network") - th.AssertEquals(t, n.AdminStateUp, true) - th.AssertEquals(t, n.TenantID, "4fd44f30292945e481c7b8a0c8908869") - th.AssertEquals(t, n.Shared, true) - th.AssertEquals(t, n.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/networks", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "network": { - "name": "sample_network", - "admin_state_up": true - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "network": { - "status": "ACTIVE", - "subnets": [], - "name": "net1", - "admin_state_up": true, - "tenant_id": "9bacb3c5d39d41a79512987f338cf177", - "shared": false, - "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c" - } -} - `) - }) - - iTrue := true - options := CreateOpts{Name: "sample_network", AdminStateUp: &iTrue} - n, err := Create(fake.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.Status, "ACTIVE") - th.AssertDeepEquals(t, n.Subnets, []string{}) - th.AssertEquals(t, n.Name, "net1") - th.AssertEquals(t, n.AdminStateUp, true) - th.AssertEquals(t, n.TenantID, "9bacb3c5d39d41a79512987f338cf177") - th.AssertEquals(t, n.Shared, false) - th.AssertEquals(t, n.ID, "4e8e5957-649f-477b-9e5b-f1f75b21c03c") -} - -func TestCreateWithOptionalFields(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/networks", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "network": { - "name": "sample_network", - "admin_state_up": true, - "shared": true, - "tenant_id": "12345" - } -} - `) - - w.WriteHeader(http.StatusCreated) - fmt.Fprintf(w, `{}`) - }) - - iTrue := true - options := CreateOpts{Name: "sample_network", AdminStateUp: &iTrue, Shared: &iTrue, TenantID: "12345"} - _, err := Create(fake.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/networks/4e8e5957-649f-477b-9e5b-f1f75b21c03c", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "network": { - "name": "new_network_name", - "admin_state_up": false, - "shared": true - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "network": { - "status": "ACTIVE", - "subnets": [], - "name": "new_network_name", - "admin_state_up": false, - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "shared": true, - "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c" - } -} - `) - }) - - iTrue, iFalse := true, false - options := UpdateOpts{Name: "new_network_name", AdminStateUp: &iFalse, Shared: &iTrue} - n, err := Update(fake.ServiceClient(), "4e8e5957-649f-477b-9e5b-f1f75b21c03c", options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.Name, "new_network_name") - th.AssertEquals(t, n.AdminStateUp, false) - th.AssertEquals(t, n.Shared, true) - th.AssertEquals(t, n.ID, "4e8e5957-649f-477b-9e5b-f1f75b21c03c") -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/networks/4e8e5957-649f-477b-9e5b-f1f75b21c03c", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "4e8e5957-649f-477b-9e5b-f1f75b21c03c") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/networks/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/networks/urls_test.go deleted file mode 100644 index caf77dbe04..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/networks/urls_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package networks - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909/" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint, ResourceBase: endpoint + "v2.0/"} -} - -func TestGetURL(t *testing.T) { - actual := getURL(endpointClient(), "foo") - expected := endpoint + "v2.0/networks/foo" - th.AssertEquals(t, expected, actual) -} - -func TestCreateURL(t *testing.T) { - actual := createURL(endpointClient()) - expected := endpoint + "v2.0/networks" - th.AssertEquals(t, expected, actual) -} - -func TestListURL(t *testing.T) { - actual := createURL(endpointClient()) - expected := endpoint + "v2.0/networks" - th.AssertEquals(t, expected, actual) -} - -func TestDeleteURL(t *testing.T) { - actual := deleteURL(endpointClient(), "foo") - expected := endpoint + "v2.0/networks/foo" - th.AssertEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/ports/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/ports/requests_test.go deleted file mode 100644 index 9e323efa3a..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/ports/requests_test.go +++ /dev/null @@ -1,321 +0,0 @@ -package ports - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/ports", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "ports": [ - { - "status": "ACTIVE", - "binding:host_id": "devstack", - "name": "", - "admin_state_up": true, - "network_id": "70c1db1f-b701-45bd-96e0-a313ee3430b3", - "tenant_id": "", - "device_owner": "network:router_gateway", - "mac_address": "fa:16:3e:58:42:ed", - "fixed_ips": [ - { - "subnet_id": "008ba151-0b8c-4a67-98b5-0d2b87666062", - "ip_address": "172.24.4.2" - } - ], - "id": "d80b1a3b-4fc1-49f3-952e-1e2ab7081d8b", - "security_groups": [], - "device_id": "9ae135f4-b6e0-4dad-9e91-3c223e385824" - } - ] -} - `) - }) - - count := 0 - - List(fake.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractPorts(page) - if err != nil { - t.Errorf("Failed to extract subnets: %v", err) - return false, nil - } - - expected := []Port{ - Port{ - Status: "ACTIVE", - Name: "", - AdminStateUp: true, - NetworkID: "70c1db1f-b701-45bd-96e0-a313ee3430b3", - TenantID: "", - DeviceOwner: "network:router_gateway", - MACAddress: "fa:16:3e:58:42:ed", - FixedIPs: []IP{ - IP{ - SubnetID: "008ba151-0b8c-4a67-98b5-0d2b87666062", - IPAddress: "172.24.4.2", - }, - }, - ID: "d80b1a3b-4fc1-49f3-952e-1e2ab7081d8b", - SecurityGroups: []string{}, - DeviceID: "9ae135f4-b6e0-4dad-9e91-3c223e385824", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/ports/46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "port": { - "status": "ACTIVE", - "name": "", - "admin_state_up": true, - "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", - "tenant_id": "7e02058126cc4950b75f9970368ba177", - "device_owner": "network:router_interface", - "mac_address": "fa:16:3e:23:fd:d7", - "fixed_ips": [ - { - "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2", - "ip_address": "10.0.0.1" - } - ], - "id": "46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2", - "security_groups": [], - "device_id": "5e3898d7-11be-483e-9732-b2f5eccd2b2e" - } -} - `) - }) - - n, err := Get(fake.ServiceClient(), "46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.Status, "ACTIVE") - th.AssertEquals(t, n.Name, "") - th.AssertEquals(t, n.AdminStateUp, true) - th.AssertEquals(t, n.NetworkID, "a87cc70a-3e15-4acf-8205-9b711a3531b7") - th.AssertEquals(t, n.TenantID, "7e02058126cc4950b75f9970368ba177") - th.AssertEquals(t, n.DeviceOwner, "network:router_interface") - th.AssertEquals(t, n.MACAddress, "fa:16:3e:23:fd:d7") - th.AssertDeepEquals(t, n.FixedIPs, []IP{ - IP{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.1"}, - }) - th.AssertEquals(t, n.ID, "46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2") - th.AssertDeepEquals(t, n.SecurityGroups, []string{}) - th.AssertEquals(t, n.Status, "ACTIVE") - th.AssertEquals(t, n.DeviceID, "5e3898d7-11be-483e-9732-b2f5eccd2b2e") -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/ports", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "port": { - "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", - "name": "private-port", - "admin_state_up": true, - "fixed_ips": [ - { - "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2", - "ip_address": "10.0.0.2" - } - ], - "security_groups": ["foo"] - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "port": { - "status": "DOWN", - "name": "private-port", - "allowed_address_pairs": [], - "admin_state_up": true, - "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", - "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa", - "device_owner": "", - "mac_address": "fa:16:3e:c9:cb:f0", - "fixed_ips": [ - { - "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2", - "ip_address": "10.0.0.2" - } - ], - "id": "65c0ee9f-d634-4522-8954-51021b570b0d", - "security_groups": [ - "f0ac4394-7e4a-4409-9701-ba8be283dbc3" - ], - "device_id": "" - } -} - `) - }) - - asu := true - options := CreateOpts{ - Name: "private-port", - AdminStateUp: &asu, - NetworkID: "a87cc70a-3e15-4acf-8205-9b711a3531b7", - FixedIPs: []IP{ - IP{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.2"}, - }, - SecurityGroups: []string{"foo"}, - } - n, err := Create(fake.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.Status, "DOWN") - th.AssertEquals(t, n.Name, "private-port") - th.AssertEquals(t, n.AdminStateUp, true) - th.AssertEquals(t, n.NetworkID, "a87cc70a-3e15-4acf-8205-9b711a3531b7") - th.AssertEquals(t, n.TenantID, "d6700c0c9ffa4f1cb322cd4a1f3906fa") - th.AssertEquals(t, n.DeviceOwner, "") - th.AssertEquals(t, n.MACAddress, "fa:16:3e:c9:cb:f0") - th.AssertDeepEquals(t, n.FixedIPs, []IP{ - IP{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.2"}, - }) - th.AssertEquals(t, n.ID, "65c0ee9f-d634-4522-8954-51021b570b0d") - th.AssertDeepEquals(t, n.SecurityGroups, []string{"f0ac4394-7e4a-4409-9701-ba8be283dbc3"}) -} - -func TestRequiredCreateOpts(t *testing.T) { - res := Create(fake.ServiceClient(), CreateOpts{}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/ports/65c0ee9f-d634-4522-8954-51021b570b0d", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "port": { - "name": "new_port_name", - "fixed_ips": [ - { - "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2", - "ip_address": "10.0.0.3" - } - ], - "security_groups": [ - "f0ac4394-7e4a-4409-9701-ba8be283dbc3" - ] - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "port": { - "status": "DOWN", - "name": "new_port_name", - "admin_state_up": true, - "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", - "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa", - "device_owner": "", - "mac_address": "fa:16:3e:c9:cb:f0", - "fixed_ips": [ - { - "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2", - "ip_address": "10.0.0.3" - } - ], - "id": "65c0ee9f-d634-4522-8954-51021b570b0d", - "security_groups": [ - "f0ac4394-7e4a-4409-9701-ba8be283dbc3" - ], - "device_id": "" - } -} - `) - }) - - options := UpdateOpts{ - Name: "new_port_name", - FixedIPs: []IP{ - IP{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.3"}, - }, - SecurityGroups: []string{"f0ac4394-7e4a-4409-9701-ba8be283dbc3"}, - } - - s, err := Update(fake.ServiceClient(), "65c0ee9f-d634-4522-8954-51021b570b0d", options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, s.Name, "new_port_name") - th.AssertDeepEquals(t, s.FixedIPs, []IP{ - IP{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.3"}, - }) - th.AssertDeepEquals(t, s.SecurityGroups, []string{"f0ac4394-7e4a-4409-9701-ba8be283dbc3"}) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/ports/65c0ee9f-d634-4522-8954-51021b570b0d", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "65c0ee9f-d634-4522-8954-51021b570b0d") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/ports/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/ports/urls_test.go deleted file mode 100644 index 7fadd4dcb7..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/ports/urls_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package ports - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909/" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint, ResourceBase: endpoint + "v2.0/"} -} - -func TestListURL(t *testing.T) { - actual := listURL(endpointClient()) - expected := endpoint + "v2.0/ports" - th.AssertEquals(t, expected, actual) -} - -func TestGetURL(t *testing.T) { - actual := getURL(endpointClient(), "foo") - expected := endpoint + "v2.0/ports/foo" - th.AssertEquals(t, expected, actual) -} - -func TestCreateURL(t *testing.T) { - actual := createURL(endpointClient()) - expected := endpoint + "v2.0/ports" - th.AssertEquals(t, expected, actual) -} - -func TestUpdateURL(t *testing.T) { - actual := updateURL(endpointClient(), "foo") - expected := endpoint + "v2.0/ports/foo" - th.AssertEquals(t, expected, actual) -} - -func TestDeleteURL(t *testing.T) { - actual := deleteURL(endpointClient(), "foo") - expected := endpoint + "v2.0/ports/foo" - th.AssertEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/subnets/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/subnets/requests_test.go deleted file mode 100644 index 987064ada6..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/subnets/requests_test.go +++ /dev/null @@ -1,362 +0,0 @@ -package subnets - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/subnets", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "subnets": [ - { - "name": "private-subnet", - "enable_dhcp": true, - "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324", - "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e", - "dns_nameservers": [], - "allocation_pools": [ - { - "start": "10.0.0.2", - "end": "10.0.0.254" - } - ], - "host_routes": [], - "ip_version": 4, - "gateway_ip": "10.0.0.1", - "cidr": "10.0.0.0/24", - "id": "08eae331-0402-425a-923c-34f7cfe39c1b" - }, - { - "name": "my_subnet", - "enable_dhcp": true, - "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "dns_nameservers": [], - "allocation_pools": [ - { - "start": "192.0.0.2", - "end": "192.255.255.254" - } - ], - "host_routes": [], - "ip_version": 4, - "gateway_ip": "192.0.0.1", - "cidr": "192.0.0.0/8", - "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" - } - ] -} - `) - }) - - count := 0 - - List(fake.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractSubnets(page) - if err != nil { - t.Errorf("Failed to extract subnets: %v", err) - return false, nil - } - - expected := []Subnet{ - Subnet{ - Name: "private-subnet", - EnableDHCP: true, - NetworkID: "db193ab3-96e3-4cb3-8fc5-05f4296d0324", - TenantID: "26a7980765d0414dbc1fc1f88cdb7e6e", - DNSNameservers: []string{}, - AllocationPools: []AllocationPool{ - AllocationPool{ - Start: "10.0.0.2", - End: "10.0.0.254", - }, - }, - HostRoutes: []HostRoute{}, - IPVersion: 4, - GatewayIP: "10.0.0.1", - CIDR: "10.0.0.0/24", - ID: "08eae331-0402-425a-923c-34f7cfe39c1b", - }, - Subnet{ - Name: "my_subnet", - EnableDHCP: true, - NetworkID: "d32019d3-bc6e-4319-9c1d-6722fc136a22", - TenantID: "4fd44f30292945e481c7b8a0c8908869", - DNSNameservers: []string{}, - AllocationPools: []AllocationPool{ - AllocationPool{ - Start: "192.0.0.2", - End: "192.255.255.254", - }, - }, - HostRoutes: []HostRoute{}, - IPVersion: 4, - GatewayIP: "192.0.0.1", - CIDR: "192.0.0.0/8", - ID: "54d6f61d-db07-451c-9ab3-b9609b6b6f0b", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/subnets/54d6f61d-db07-451c-9ab3-b9609b6b6f0b", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "subnet": { - "name": "my_subnet", - "enable_dhcp": true, - "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "dns_nameservers": [], - "allocation_pools": [ - { - "start": "192.0.0.2", - "end": "192.255.255.254" - } - ], - "host_routes": [], - "ip_version": 4, - "gateway_ip": "192.0.0.1", - "cidr": "192.0.0.0/8", - "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" - } -} - `) - }) - - s, err := Get(fake.ServiceClient(), "54d6f61d-db07-451c-9ab3-b9609b6b6f0b").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, s.Name, "my_subnet") - th.AssertEquals(t, s.EnableDHCP, true) - th.AssertEquals(t, s.NetworkID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") - th.AssertEquals(t, s.TenantID, "4fd44f30292945e481c7b8a0c8908869") - th.AssertDeepEquals(t, s.DNSNameservers, []string{}) - th.AssertDeepEquals(t, s.AllocationPools, []AllocationPool{ - AllocationPool{ - Start: "192.0.0.2", - End: "192.255.255.254", - }, - }) - th.AssertDeepEquals(t, s.HostRoutes, []HostRoute{}) - th.AssertEquals(t, s.IPVersion, 4) - th.AssertEquals(t, s.GatewayIP, "192.0.0.1") - th.AssertEquals(t, s.CIDR, "192.0.0.0/8") - th.AssertEquals(t, s.ID, "54d6f61d-db07-451c-9ab3-b9609b6b6f0b") -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/subnets", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "subnet": { - "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", - "ip_version": 4, - "cidr": "192.168.199.0/24", - "dns_nameservers": ["foo"], - "allocation_pools": [ - { - "start": "192.168.199.2", - "end": "192.168.199.254" - } - ], - "host_routes": [{"destination":"","nexthop": "bar"}] - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "subnet": { - "name": "", - "enable_dhcp": true, - "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "dns_nameservers": [], - "allocation_pools": [ - { - "start": "192.168.199.2", - "end": "192.168.199.254" - } - ], - "host_routes": [], - "ip_version": 4, - "gateway_ip": "192.168.199.1", - "cidr": "192.168.199.0/24", - "id": "3b80198d-4f7b-4f77-9ef5-774d54e17126" - } -} - `) - }) - - opts := CreateOpts{ - NetworkID: "d32019d3-bc6e-4319-9c1d-6722fc136a22", - IPVersion: 4, - CIDR: "192.168.199.0/24", - AllocationPools: []AllocationPool{ - AllocationPool{ - Start: "192.168.199.2", - End: "192.168.199.254", - }, - }, - DNSNameservers: []string{"foo"}, - HostRoutes: []HostRoute{ - HostRoute{NextHop: "bar"}, - }, - } - s, err := Create(fake.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, s.Name, "") - th.AssertEquals(t, s.EnableDHCP, true) - th.AssertEquals(t, s.NetworkID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") - th.AssertEquals(t, s.TenantID, "4fd44f30292945e481c7b8a0c8908869") - th.AssertDeepEquals(t, s.DNSNameservers, []string{}) - th.AssertDeepEquals(t, s.AllocationPools, []AllocationPool{ - AllocationPool{ - Start: "192.168.199.2", - End: "192.168.199.254", - }, - }) - th.AssertDeepEquals(t, s.HostRoutes, []HostRoute{}) - th.AssertEquals(t, s.IPVersion, 4) - th.AssertEquals(t, s.GatewayIP, "192.168.199.1") - th.AssertEquals(t, s.CIDR, "192.168.199.0/24") - th.AssertEquals(t, s.ID, "3b80198d-4f7b-4f77-9ef5-774d54e17126") -} - -func TestRequiredCreateOpts(t *testing.T) { - res := Create(fake.ServiceClient(), CreateOpts{}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } - - res = Create(fake.ServiceClient(), CreateOpts{NetworkID: "foo"}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } - - res = Create(fake.ServiceClient(), CreateOpts{NetworkID: "foo", CIDR: "bar", IPVersion: 40}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/subnets/08eae331-0402-425a-923c-34f7cfe39c1b", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "subnet": { - "name": "my_new_subnet", - "dns_nameservers": ["foo"], - "host_routes": [{"destination":"","nexthop": "bar"}] - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "subnet": { - "name": "my_new_subnet", - "enable_dhcp": true, - "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324", - "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e", - "dns_nameservers": [], - "allocation_pools": [ - { - "start": "10.0.0.2", - "end": "10.0.0.254" - } - ], - "host_routes": [], - "ip_version": 4, - "gateway_ip": "10.0.0.1", - "cidr": "10.0.0.0/24", - "id": "08eae331-0402-425a-923c-34f7cfe39c1b" - } -} - `) - }) - - opts := UpdateOpts{ - Name: "my_new_subnet", - DNSNameservers: []string{"foo"}, - HostRoutes: []HostRoute{ - HostRoute{NextHop: "bar"}, - }, - } - s, err := Update(fake.ServiceClient(), "08eae331-0402-425a-923c-34f7cfe39c1b", opts).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, s.Name, "my_new_subnet") - th.AssertEquals(t, s.ID, "08eae331-0402-425a-923c-34f7cfe39c1b") -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/subnets/08eae331-0402-425a-923c-34f7cfe39c1b", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "08eae331-0402-425a-923c-34f7cfe39c1b") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/subnets/results_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/subnets/results_test.go deleted file mode 100644 index d4048388cd..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/subnets/results_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package subnets - -import ( - "encoding/json" - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" - "testing" -) - -func TestHostRoute(t *testing.T) { - sejson := []byte(` - {"subnet": { - "name": "test-subnet", - "enable_dhcp": false, - "network_id": "3e66c41e-cbbd-4019-9aab-740b7e4150a0", - "tenant_id": "f86e123198cf42d19c8854c5f80c2f06", - "dns_nameservers": [], - "gateway_ip": "172.16.0.1", - "ipv6_ra_mode": null, - "allocation_pools": [ - { - "start": "172.16.0.2", - "end": "172.16.255.254" - } - ], - "host_routes": [ - { - "destination": "172.20.1.0/24", - "nexthop": "172.16.0.2" - } - ], - "ip_version": 4, - "ipv6_address_mode": null, - "cidr": "172.16.0.0/16", - "id": "6dcaa873-7115-41af-9ef5-915f73636e43", - "subnetpool_id": null - }} -`) - - var dejson interface{} - err := json.Unmarshal(sejson, &dejson) - if err != nil { - t.Fatalf("%s", err) - } - - resp := commonResult{gophercloud.Result{Body: dejson}} - subnet, err := resp.Extract() - if err != nil { - t.Fatalf("%s", err) - } - route := subnet.HostRoutes[0] - th.AssertEquals(t, route.NextHop, "172.16.0.2") - th.AssertEquals(t, route.DestinationCIDR, "172.20.1.0/24") -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/subnets/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/subnets/urls_test.go deleted file mode 100644 index aeeddf3549..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/networking/v2/subnets/urls_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package subnets - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909/" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint, ResourceBase: endpoint + "v2.0/"} -} - -func TestListURL(t *testing.T) { - actual := listURL(endpointClient()) - expected := endpoint + "v2.0/subnets" - th.AssertEquals(t, expected, actual) -} - -func TestGetURL(t *testing.T) { - actual := getURL(endpointClient(), "foo") - expected := endpoint + "v2.0/subnets/foo" - th.AssertEquals(t, expected, actual) -} - -func TestCreateURL(t *testing.T) { - actual := createURL(endpointClient()) - expected := endpoint + "v2.0/subnets" - th.AssertEquals(t, expected, actual) -} - -func TestUpdateURL(t *testing.T) { - actual := updateURL(endpointClient(), "foo") - expected := endpoint + "v2.0/subnets/foo" - th.AssertEquals(t, expected, actual) -} - -func TestDeleteURL(t *testing.T) { - actual := deleteURL(endpointClient(), "foo") - expected := endpoint + "v2.0/subnets/foo" - th.AssertEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/accounts/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/accounts/requests_test.go deleted file mode 100644 index 6454c0ac4c..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/accounts/requests_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package accounts - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestUpdateAccount(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleUpdateAccountSuccessfully(t) - - options := &UpdateOpts{Metadata: map[string]string{"gophercloud-test": "accounts"}} - res := Update(fake.ServiceClient(), options) - th.AssertNoErr(t, res.Err) -} - -func TestGetAccount(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetAccountSuccessfully(t) - - expectedMetadata := map[string]string{"Subject": "books"} - res := Get(fake.ServiceClient(), &GetOpts{}) - th.AssertNoErr(t, res.Err) - actualMetadata, _ := res.ExtractMetadata() - th.CheckDeepEquals(t, expectedMetadata, actualMetadata) - //headers, err := res.Extract() - //th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/accounts/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/accounts/urls_test.go deleted file mode 100644 index 074d52dfd5..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/accounts/urls_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package accounts - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909/" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestGetURL(t *testing.T) { - actual := getURL(endpointClient()) - expected := endpoint - th.CheckEquals(t, expected, actual) -} - -func TestUpdateURL(t *testing.T) { - actual := updateURL(endpointClient()) - expected := endpoint - th.CheckEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers/requests_test.go deleted file mode 100644 index 0ccd5a7786..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers/requests_test.go +++ /dev/null @@ -1,117 +0,0 @@ -package containers - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -var metadata = map[string]string{"gophercloud-test": "containers"} - -func TestListContainerInfo(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListContainerInfoSuccessfully(t) - - count := 0 - err := List(fake.ServiceClient(), &ListOpts{Full: true}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractInfo(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, ExpectedListInfo, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestListAllContainerInfo(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListContainerInfoSuccessfully(t) - - allPages, err := List(fake.ServiceClient(), &ListOpts{Full: true}).AllPages() - th.AssertNoErr(t, err) - actual, err := ExtractInfo(allPages) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, ExpectedListInfo, actual) -} - -func TestListContainerNames(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListContainerNamesSuccessfully(t) - - count := 0 - err := List(fake.ServiceClient(), &ListOpts{Full: false}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractNames(page) - if err != nil { - t.Errorf("Failed to extract container names: %v", err) - return false, err - } - - th.CheckDeepEquals(t, ExpectedListNames, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestListAllContainerNames(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListContainerNamesSuccessfully(t) - - allPages, err := List(fake.ServiceClient(), &ListOpts{Full: false}).AllPages() - th.AssertNoErr(t, err) - actual, err := ExtractNames(allPages) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, ExpectedListNames, actual) -} - -func TestCreateContainer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleCreateContainerSuccessfully(t) - - options := CreateOpts{ContentType: "application/json", Metadata: map[string]string{"foo": "bar"}} - res := Create(fake.ServiceClient(), "testContainer", options) - c, err := res.Extract() - th.CheckNoErr(t, err) - th.CheckEquals(t, "bar", res.Header["X-Container-Meta-Foo"][0]) - th.CheckEquals(t, "1234567", c.TransID) -} - -func TestDeleteContainer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleDeleteContainerSuccessfully(t) - - res := Delete(fake.ServiceClient(), "testContainer") - th.CheckNoErr(t, res.Err) -} - -func TestUpateContainer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleUpdateContainerSuccessfully(t) - - options := &UpdateOpts{Metadata: map[string]string{"foo": "bar"}} - res := Update(fake.ServiceClient(), "testContainer", options) - th.CheckNoErr(t, res.Err) -} - -func TestGetContainer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetContainerSuccessfully(t) - - _, err := Get(fake.ServiceClient(), "testContainer").ExtractMetadata() - th.CheckNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers/urls_test.go deleted file mode 100644 index d043a2aae5..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers/urls_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package containers - -import ( - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" - "testing" -) - -const endpoint = "http://localhost:57909/" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestListURL(t *testing.T) { - actual := listURL(endpointClient()) - expected := endpoint - th.CheckEquals(t, expected, actual) -} - -func TestCreateURL(t *testing.T) { - actual := createURL(endpointClient(), "foo") - expected := endpoint + "foo" - th.CheckEquals(t, expected, actual) -} - -func TestGetURL(t *testing.T) { - actual := getURL(endpointClient(), "foo") - expected := endpoint + "foo" - th.CheckEquals(t, expected, actual) -} - -func TestDeleteURL(t *testing.T) { - actual := deleteURL(endpointClient(), "foo") - expected := endpoint + "foo" - th.CheckEquals(t, expected, actual) -} - -func TestUpdateURL(t *testing.T) { - actual := updateURL(endpointClient(), "foo") - expected := endpoint + "foo" - th.CheckEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects/requests_test.go deleted file mode 100644 index f7d6822913..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects/requests_test.go +++ /dev/null @@ -1,165 +0,0 @@ -package objects - -import ( - "bytes" - "fmt" - "io" - "net/http" - "strings" - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestDownloadReader(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleDownloadObjectSuccessfully(t) - - response := Download(fake.ServiceClient(), "testContainer", "testObject", nil) - defer response.Body.Close() - - // Check reader - buf := bytes.NewBuffer(make([]byte, 0)) - io.CopyN(buf, response.Body, 10) - th.CheckEquals(t, "Successful", string(buf.Bytes())) -} - -func TestDownloadExtraction(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleDownloadObjectSuccessfully(t) - - response := Download(fake.ServiceClient(), "testContainer", "testObject", nil) - - // Check []byte extraction - bytes, err := response.ExtractContent() - th.AssertNoErr(t, err) - th.CheckEquals(t, "Successful download with Gophercloud", string(bytes)) -} - -func TestListObjectInfo(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListObjectsInfoSuccessfully(t) - - count := 0 - options := &ListOpts{Full: true} - err := List(fake.ServiceClient(), "testContainer", options).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractInfo(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, ExpectedListInfo, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestListObjectNames(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListObjectNamesSuccessfully(t) - - count := 0 - options := &ListOpts{Full: false} - err := List(fake.ServiceClient(), "testContainer", options).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractNames(page) - if err != nil { - t.Errorf("Failed to extract container names: %v", err) - return false, err - } - - th.CheckDeepEquals(t, ExpectedListNames, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestCreateObject(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - content := "Did gyre and gimble in the wabe" - - HandleCreateTextObjectSuccessfully(t, content) - - options := &CreateOpts{ContentType: "text/plain"} - res := Create(fake.ServiceClient(), "testContainer", "testObject", strings.NewReader(content), options) - th.AssertNoErr(t, res.Err) -} - -func TestCreateObjectWithoutContentType(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - content := "The sky was the color of television, tuned to a dead channel." - - HandleCreateTypelessObjectSuccessfully(t, content) - - res := Create(fake.ServiceClient(), "testContainer", "testObject", strings.NewReader(content), &CreateOpts{}) - th.AssertNoErr(t, res.Err) -} - -func TestErrorIsRaisedForChecksumMismatch(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/testContainer/testObject", func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("ETag", "acbd18db4cc2f85cedef654fccc4a4d8") - w.WriteHeader(http.StatusCreated) - }) - - content := strings.NewReader("The sky was the color of television, tuned to a dead channel.") - res := Create(fake.ServiceClient(), "testContainer", "testObject", content, &CreateOpts{}) - - err := fmt.Errorf("Local checksum does not match API ETag header") - th.AssertDeepEquals(t, err, res.Err) -} - -func TestCopyObject(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleCopyObjectSuccessfully(t) - - options := &CopyOpts{Destination: "/newTestContainer/newTestObject"} - res := Copy(fake.ServiceClient(), "testContainer", "testObject", options) - th.AssertNoErr(t, res.Err) -} - -func TestDeleteObject(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleDeleteObjectSuccessfully(t) - - res := Delete(fake.ServiceClient(), "testContainer", "testObject", nil) - th.AssertNoErr(t, res.Err) -} - -func TestUpateObjectMetadata(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleUpdateObjectSuccessfully(t) - - options := &UpdateOpts{Metadata: map[string]string{"Gophercloud-Test": "objects"}} - res := Update(fake.ServiceClient(), "testContainer", "testObject", options) - th.AssertNoErr(t, res.Err) -} - -func TestGetObject(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetObjectSuccessfully(t) - - expected := map[string]string{"Gophercloud-Test": "objects"} - actual, err := Get(fake.ServiceClient(), "testContainer", "testObject", nil).ExtractMetadata() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects/urls_test.go b/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects/urls_test.go deleted file mode 100644 index 1dcfe3543c..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects/urls_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package objects - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909/" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestListURL(t *testing.T) { - actual := listURL(endpointClient(), "foo") - expected := endpoint + "foo" - th.CheckEquals(t, expected, actual) -} - -func TestCopyURL(t *testing.T) { - actual := copyURL(endpointClient(), "foo", "bar") - expected := endpoint + "foo/bar" - th.CheckEquals(t, expected, actual) -} - -func TestCreateURL(t *testing.T) { - actual := createURL(endpointClient(), "foo", "bar") - expected := endpoint + "foo/bar" - th.CheckEquals(t, expected, actual) -} - -func TestGetURL(t *testing.T) { - actual := getURL(endpointClient(), "foo", "bar") - expected := endpoint + "foo/bar" - th.CheckEquals(t, expected, actual) -} - -func TestDeleteURL(t *testing.T) { - actual := deleteURL(endpointClient(), "foo", "bar") - expected := endpoint + "foo/bar" - th.CheckEquals(t, expected, actual) -} - -func TestDownloadURL(t *testing.T) { - actual := downloadURL(endpointClient(), "foo", "bar") - expected := endpoint + "foo/bar" - th.CheckEquals(t, expected, actual) -} - -func TestUpdateURL(t *testing.T) { - actual := updateURL(endpointClient(), "foo", "bar") - expected := endpoint + "foo/bar" - th.CheckEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/apiversions/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/apiversions/requests_test.go deleted file mode 100644 index a2fc980d35..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/apiversions/requests_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package apiversions - -import ( - "fmt" - "net/http" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListVersions(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "versions": [ - { - "status": "CURRENT", - "id": "v1.0", - "links": [ - { - "href": "http://23.253.228.211:8000/v1", - "rel": "self" - } - ] - } - ] -}`) - }) - - count := 0 - - ListVersions(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractAPIVersions(page) - if err != nil { - t.Errorf("Failed to extract API versions: %v", err) - return false, err - } - - expected := []APIVersion{ - APIVersion{ - Status: "CURRENT", - ID: "v1.0", - Links: []gophercloud.Link{ - gophercloud.Link{ - Href: "http://23.253.228.211:8000/v1", - Rel: "self", - }, - }, - }, - } - - th.AssertDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestNonJSONCannotBeExtractedIntoAPIVersions(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - }) - - ListVersions(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - if _, err := ExtractAPIVersions(page); err == nil { - t.Fatalf("Expected error, got nil") - } - return true, nil - }) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/buildinfo/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/buildinfo/requests_test.go deleted file mode 100644 index 1e0fe230d6..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/buildinfo/requests_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package buildinfo - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestGetTemplate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetSuccessfully(t, GetOutput) - - actual, err := Get(fake.ServiceClient()).Extract() - th.AssertNoErr(t, err) - - expected := GetExpected - th.AssertDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stackevents/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stackevents/requests_test.go deleted file mode 100644 index a4da4d04e6..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stackevents/requests_test.go +++ /dev/null @@ -1,71 +0,0 @@ -package stackevents - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestFindEvents(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleFindSuccessfully(t, FindOutput) - - actual, err := Find(fake.ServiceClient(), "postman_stack").Extract() - th.AssertNoErr(t, err) - - expected := FindExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListSuccessfully(t, ListOutput) - - count := 0 - err := List(fake.ServiceClient(), "hello_world", "49181cd6-169a-4130-9455-31185bbfc5bf", nil).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractEvents(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, ListExpected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestListResourceEvents(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListResourceEventsSuccessfully(t, ListResourceEventsOutput) - - count := 0 - err := ListResourceEvents(fake.ServiceClient(), "hello_world", "49181cd6-169a-4130-9455-31185bbfc5bf", "my_resource", nil).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractEvents(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, ListResourceEventsExpected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestGetEvent(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetSuccessfully(t, GetOutput) - - actual, err := Get(fake.ServiceClient(), "hello_world", "49181cd6-169a-4130-9455-31185bbfc5bf", "my_resource", "93940999-7d40-44ae-8de4-19624e7b8d18").Extract() - th.AssertNoErr(t, err) - - expected := GetExpected - th.AssertDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stackresources/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stackresources/requests_test.go deleted file mode 100644 index e5045a71f7..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stackresources/requests_test.go +++ /dev/null @@ -1,111 +0,0 @@ -package stackresources - -import ( - "sort" - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestFindResources(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleFindSuccessfully(t, FindOutput) - - actual, err := Find(fake.ServiceClient(), "hello_world").Extract() - th.AssertNoErr(t, err) - - expected := FindExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestListResources(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListSuccessfully(t, ListOutput) - - count := 0 - err := List(fake.ServiceClient(), "hello_world", "49181cd6-169a-4130-9455-31185bbfc5bf", nil).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractResources(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, ListExpected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestGetResource(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetSuccessfully(t, GetOutput) - - actual, err := Get(fake.ServiceClient(), "teststack", "0b1771bd-9336-4f2b-ae86-a80f971faf1e", "wordpress_instance").Extract() - th.AssertNoErr(t, err) - - expected := GetExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestResourceMetadata(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleMetadataSuccessfully(t, MetadataOutput) - - actual, err := Metadata(fake.ServiceClient(), "teststack", "0b1771bd-9336-4f2b-ae86-a80f971faf1e", "wordpress_instance").Extract() - th.AssertNoErr(t, err) - - expected := MetadataExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestListResourceTypes(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListTypesSuccessfully(t, ListTypesOutput) - - count := 0 - err := ListTypes(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractResourceTypes(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, ListTypesExpected, actual) - // test if sorting works - sort.Sort(actual) - th.CheckDeepEquals(t, SortedListTypesExpected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestGetResourceSchema(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetSchemaSuccessfully(t, GetSchemaOutput) - - actual, err := Schema(fake.ServiceClient(), "OS::Heat::AResourceName").Extract() - th.AssertNoErr(t, err) - - expected := GetSchemaExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestGetResourceTemplate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetTemplateSuccessfully(t, GetTemplateOutput) - - actual, err := Template(fake.ServiceClient(), "OS::Heat::AResourceName").Extract() - th.AssertNoErr(t, err) - - expected := GetTemplateExpected - th.AssertDeepEquals(t, expected, string(actual)) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks/environment_test.go b/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks/environment_test.go deleted file mode 100644 index 3a3c2b98ef..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks/environment_test.go +++ /dev/null @@ -1,184 +0,0 @@ -package stacks - -import ( - "fmt" - "net/http" - "net/url" - "strings" - "testing" - - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestEnvironmentValidation(t *testing.T) { - environmentJSON := new(Environment) - environmentJSON.Bin = []byte(ValidJSONEnvironment) - err := environmentJSON.Validate() - th.AssertNoErr(t, err) - - environmentYAML := new(Environment) - environmentYAML.Bin = []byte(ValidYAMLEnvironment) - err = environmentYAML.Validate() - th.AssertNoErr(t, err) - - environmentInvalid := new(Environment) - environmentInvalid.Bin = []byte(InvalidEnvironment) - if err = environmentInvalid.Validate(); err == nil { - t.Error("environment validation did not catch invalid environment") - } -} - -func TestEnvironmentParsing(t *testing.T) { - environmentJSON := new(Environment) - environmentJSON.Bin = []byte(ValidJSONEnvironment) - err := environmentJSON.Parse() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, ValidJSONEnvironmentParsed, environmentJSON.Parsed) - - environmentYAML := new(Environment) - environmentYAML.Bin = []byte(ValidJSONEnvironment) - err = environmentYAML.Parse() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, ValidJSONEnvironmentParsed, environmentYAML.Parsed) - - environmentInvalid := new(Environment) - environmentInvalid.Bin = []byte("Keep Austin Weird") - err = environmentInvalid.Parse() - if err == nil { - t.Error("environment parsing did not catch invalid environment") - } -} - -func TestIgnoreIfEnvironment(t *testing.T) { - var keyValueTests = []struct { - key string - value interface{} - out bool - }{ - {"base_url", "afksdf", true}, - {"not_type", "hooks", false}, - {"get_file", "::", true}, - {"hooks", "dfsdfsd", true}, - {"type", "sdfubsduf.yaml", false}, - {"type", "sdfsdufs.environment", false}, - {"type", "sdfsdf.file", false}, - {"type", map[string]string{"key": "value"}, true}, - } - var result bool - for _, kv := range keyValueTests { - result = ignoreIfEnvironment(kv.key, kv.value) - if result != kv.out { - t.Errorf("key: %v, value: %v expected: %v, actual: %v", kv.key, kv.value, kv.out, result) - } - } -} - -func TestGetRRFileContents(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - environmentContent := ` -heat_template_version: 2013-05-23 - -description: - Heat WordPress template to support F18, using only Heat OpenStack-native - resource types, and without the requirement for heat-cfntools in the image. - WordPress is web software you can use to create a beautiful website or blog. - This template installs a single-instance WordPress deployment using a local - MySQL database to store the data. - -parameters: - - key_name: - type: string - description : Name of a KeyPair to enable SSH access to the instance - -resources: - wordpress_instance: - type: OS::Nova::Server - properties: - image: { get_param: image_id } - flavor: { get_param: instance_type } - key_name: { get_param: key_name }` - - dbContent := ` -heat_template_version: 2014-10-16 - -description: - Test template for Trove resource capabilities - -parameters: - db_pass: - type: string - hidden: true - description: Database access password - default: secrete - -resources: - -service_db: - type: OS::Trove::Instance - properties: - name: trove_test_db - datastore_type: mariadb - flavor: 1GB Instance - size: 10 - databases: - - name: test_data - users: - - name: kitchen_sink - password: { get_param: db_pass } - databases: [ test_data ]` - baseurl, err := getBasePath() - th.AssertNoErr(t, err) - - fakeEnvURL := strings.Join([]string{baseurl, "my_env.yaml"}, "/") - urlparsed, err := url.Parse(fakeEnvURL) - th.AssertNoErr(t, err) - // handler for my_env.yaml - th.Mux.HandleFunc(urlparsed.Path, func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - w.Header().Set("Content-Type", "application/jason") - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, environmentContent) - }) - - fakeDBURL := strings.Join([]string{baseurl, "my_db.yaml"}, "/") - urlparsed, err = url.Parse(fakeDBURL) - th.AssertNoErr(t, err) - - // handler for my_db.yaml - th.Mux.HandleFunc(urlparsed.Path, func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - w.Header().Set("Content-Type", "application/jason") - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, dbContent) - }) - - client := fakeClient{BaseClient: getHTTPClient()} - env := new(Environment) - env.Bin = []byte(`{"resource_registry": {"My::WP::Server": "my_env.yaml", "resources": {"my_db_server": {"OS::DBInstance": "my_db.yaml"}}}}`) - env.client = client - - err = env.Parse() - th.AssertNoErr(t, err) - err = env.getRRFileContents(ignoreIfEnvironment) - th.AssertNoErr(t, err) - expectedEnvFilesContent := "\nheat_template_version: 2013-05-23\n\ndescription:\n Heat WordPress template to support F18, using only Heat OpenStack-native\n resource types, and without the requirement for heat-cfntools in the image.\n WordPress is web software you can use to create a beautiful website or blog.\n This template installs a single-instance WordPress deployment using a local\n MySQL database to store the data.\n\nparameters:\n\n key_name:\n type: string\n description : Name of a KeyPair to enable SSH access to the instance\n\nresources:\n wordpress_instance:\n type: OS::Nova::Server\n properties:\n image: { get_param: image_id }\n flavor: { get_param: instance_type }\n key_name: { get_param: key_name }" - expectedDBFilesContent := "\nheat_template_version: 2014-10-16\n\ndescription:\n Test template for Trove resource capabilities\n\nparameters:\n db_pass:\n type: string\n hidden: true\n description: Database access password\n default: secrete\n\nresources:\n\nservice_db:\n type: OS::Trove::Instance\n properties:\n name: trove_test_db\n datastore_type: mariadb\n flavor: 1GB Instance\n size: 10\n databases:\n - name: test_data\n users:\n - name: kitchen_sink\n password: { get_param: db_pass }\n databases: [ test_data ]" - - th.AssertEquals(t, expectedEnvFilesContent, env.Files[fakeEnvURL]) - th.AssertEquals(t, expectedDBFilesContent, env.Files[fakeDBURL]) - - env.fixFileRefs() - expectedParsed := map[string]interface{}{ - "resource_registry": "2015-04-30", - "My::WP::Server": fakeEnvURL, - "resources": map[string]interface{}{ - "my_db_server": map[string]interface{}{ - "OS::DBInstance": fakeDBURL, - }, - }, - } - env.Parse() - th.AssertDeepEquals(t, expectedParsed, env.Parsed) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks/requests_test.go deleted file mode 100644 index 0fde44bd02..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks/requests_test.go +++ /dev/null @@ -1,358 +0,0 @@ -package stacks - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestCreateStack(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleCreateSuccessfully(t, CreateOutput) - - createOpts := CreateOpts{ - Name: "stackcreated", - Timeout: 60, - Template: ` - { - "stack_name": "postman_stack", - "template": { - "heat_template_version": "2013-05-23", - "description": "Simple template to test heat commands", - "parameters": { - "flavor": { - "default": "m1.tiny", - "type": "string" - } - }, - "resources": { - "hello_world": { - "type":"OS::Nova::Server", - "properties": { - "key_name": "heat_key", - "flavor": { - "get_param": "flavor" - }, - "image": "ad091b52-742f-469e-8f3c-fd81cadf0743", - "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n" - } - } - } - } - }`, - DisableRollback: Disable, - } - actual, err := Create(fake.ServiceClient(), createOpts).Extract() - th.AssertNoErr(t, err) - - expected := CreateExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestCreateStackNewTemplateFormat(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleCreateSuccessfully(t, CreateOutput) - template := new(Template) - template.Bin = []byte(` - { - "heat_template_version": "2013-05-23", - "description": "Simple template to test heat commands", - "parameters": { - "flavor": { - "default": "m1.tiny", - "type": "string" - } - } - }`) - createOpts := CreateOpts{ - Name: "stackcreated", - Timeout: 60, - TemplateOpts: template, - DisableRollback: Disable, - } - actual, err := Create(fake.ServiceClient(), createOpts).Extract() - th.AssertNoErr(t, err) - - expected := CreateExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestAdoptStack(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleCreateSuccessfully(t, CreateOutput) - - adoptOpts := AdoptOpts{ - AdoptStackData: `{environment{parameters{}}}`, - Name: "stackcreated", - Timeout: 60, - Template: ` - { - "stack_name": "postman_stack", - "template": { - "heat_template_version": "2013-05-23", - "description": "Simple template to test heat commands", - "parameters": { - "flavor": { - "default": "m1.tiny", - "type": "string" - } - }, - "resources": { - "hello_world": { - "type":"OS::Nova::Server", - "properties": { - "key_name": "heat_key", - "flavor": { - "get_param": "flavor" - }, - "image": "ad091b52-742f-469e-8f3c-fd81cadf0743", - "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n" - } - } - } - } - }`, - DisableRollback: Disable, - } - actual, err := Adopt(fake.ServiceClient(), adoptOpts).Extract() - th.AssertNoErr(t, err) - - expected := CreateExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestAdoptStackNewTemplateFormat(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleCreateSuccessfully(t, CreateOutput) - template := new(Template) - template.Bin = []byte(` -{ - "stack_name": "postman_stack", - "template": { - "heat_template_version": "2013-05-23", - "description": "Simple template to test heat commands", - "parameters": { - "flavor": { - "default": "m1.tiny", - "type": "string" - } - }, - "resources": { - "hello_world": { - "type":"OS::Nova::Server", - "properties": { - "key_name": "heat_key", - "flavor": { - "get_param": "flavor" - }, - "image": "ad091b52-742f-469e-8f3c-fd81cadf0743", - "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n" - } - } - } - } -}`) - adoptOpts := AdoptOpts{ - AdoptStackData: `{environment{parameters{}}}`, - Name: "stackcreated", - Timeout: 60, - TemplateOpts: template, - DisableRollback: Disable, - } - actual, err := Adopt(fake.ServiceClient(), adoptOpts).Extract() - th.AssertNoErr(t, err) - - expected := CreateExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestListStack(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleListSuccessfully(t, FullListOutput) - - count := 0 - err := List(fake.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractStacks(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, ListExpected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestGetStack(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetSuccessfully(t, GetOutput) - - actual, err := Get(fake.ServiceClient(), "postman_stack", "16ef0584-4458-41eb-87c8-0dc8d5f66c87").Extract() - th.AssertNoErr(t, err) - - expected := GetExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestUpdateStack(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleUpdateSuccessfully(t) - - updateOpts := UpdateOpts{ - Template: ` - { - "heat_template_version": "2013-05-23", - "description": "Simple template to test heat commands", - "parameters": { - "flavor": { - "default": "m1.tiny", - "type": "string" - } - }, - "resources": { - "hello_world": { - "type":"OS::Nova::Server", - "properties": { - "key_name": "heat_key", - "flavor": { - "get_param": "flavor" - }, - "image": "ad091b52-742f-469e-8f3c-fd81cadf0743", - "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n" - } - } - } - }`, - } - err := Update(fake.ServiceClient(), "gophercloud-test-stack-2", "db6977b2-27aa-4775-9ae7-6213212d4ada", updateOpts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestUpdateStackNewTemplateFormat(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleUpdateSuccessfully(t) - - template := new(Template) - template.Bin = []byte(` - { - "heat_template_version": "2013-05-23", - "description": "Simple template to test heat commands", - "parameters": { - "flavor": { - "default": "m1.tiny", - "type": "string" - } - } - }`) - updateOpts := UpdateOpts{ - TemplateOpts: template, - } - err := Update(fake.ServiceClient(), "gophercloud-test-stack-2", "db6977b2-27aa-4775-9ae7-6213212d4ada", updateOpts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestDeleteStack(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleDeleteSuccessfully(t) - - err := Delete(fake.ServiceClient(), "gophercloud-test-stack-2", "db6977b2-27aa-4775-9ae7-6213212d4ada").ExtractErr() - th.AssertNoErr(t, err) -} - -func TestPreviewStack(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandlePreviewSuccessfully(t, GetOutput) - - previewOpts := PreviewOpts{ - Name: "stackcreated", - Timeout: 60, - Template: ` - { - "stack_name": "postman_stack", - "template": { - "heat_template_version": "2013-05-23", - "description": "Simple template to test heat commands", - "parameters": { - "flavor": { - "default": "m1.tiny", - "type": "string" - } - }, - "resources": { - "hello_world": { - "type":"OS::Nova::Server", - "properties": { - "key_name": "heat_key", - "flavor": { - "get_param": "flavor" - }, - "image": "ad091b52-742f-469e-8f3c-fd81cadf0743", - "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n" - } - } - } - } - }`, - DisableRollback: Disable, - } - actual, err := Preview(fake.ServiceClient(), previewOpts).Extract() - th.AssertNoErr(t, err) - - expected := PreviewExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestPreviewStackNewTemplateFormat(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandlePreviewSuccessfully(t, GetOutput) - - template := new(Template) - template.Bin = []byte(` - { - "heat_template_version": "2013-05-23", - "description": "Simple template to test heat commands", - "parameters": { - "flavor": { - "default": "m1.tiny", - "type": "string" - } - } - }`) - previewOpts := PreviewOpts{ - Name: "stackcreated", - Timeout: 60, - TemplateOpts: template, - DisableRollback: Disable, - } - actual, err := Preview(fake.ServiceClient(), previewOpts).Extract() - th.AssertNoErr(t, err) - - expected := PreviewExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestAbandonStack(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleAbandonSuccessfully(t, AbandonOutput) - - actual, err := Abandon(fake.ServiceClient(), "postman_stack", "16ef0584-4458-41eb-87c8-0dc8d5f66c8").Extract() - th.AssertNoErr(t, err) - - expected := AbandonExpected - th.AssertDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks/template_test.go b/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks/template_test.go deleted file mode 100644 index 6884db860e..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks/template_test.go +++ /dev/null @@ -1,148 +0,0 @@ -package stacks - -import ( - "fmt" - "net/http" - "net/url" - "strings" - "testing" - - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestTemplateValidation(t *testing.T) { - templateJSON := new(Template) - templateJSON.Bin = []byte(ValidJSONTemplate) - err := templateJSON.Validate() - th.AssertNoErr(t, err) - - templateYAML := new(Template) - templateYAML.Bin = []byte(ValidYAMLTemplate) - err = templateYAML.Validate() - th.AssertNoErr(t, err) - - templateInvalid := new(Template) - templateInvalid.Bin = []byte(InvalidTemplateNoVersion) - if err = templateInvalid.Validate(); err == nil { - t.Error("Template validation did not catch invalid template") - } -} - -func TestTemplateParsing(t *testing.T) { - templateJSON := new(Template) - templateJSON.Bin = []byte(ValidJSONTemplate) - err := templateJSON.Parse() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, ValidJSONTemplateParsed, templateJSON.Parsed) - - templateYAML := new(Template) - templateYAML.Bin = []byte(ValidJSONTemplate) - err = templateYAML.Parse() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, ValidJSONTemplateParsed, templateYAML.Parsed) - - templateInvalid := new(Template) - templateInvalid.Bin = []byte("Keep Austin Weird") - err = templateInvalid.Parse() - if err == nil { - t.Error("Template parsing did not catch invalid template") - } -} - -func TestIgnoreIfTemplate(t *testing.T) { - var keyValueTests = []struct { - key string - value interface{} - out bool - }{ - {"not_get_file", "afksdf", true}, - {"not_type", "sdfd", true}, - {"get_file", "shdfuisd", false}, - {"type", "dfsdfsd", true}, - {"type", "sdfubsduf.yaml", false}, - {"type", "sdfsdufs.template", false}, - {"type", "sdfsdf.file", true}, - {"type", map[string]string{"key": "value"}, true}, - } - var result bool - for _, kv := range keyValueTests { - result = ignoreIfTemplate(kv.key, kv.value) - if result != kv.out { - t.Errorf("key: %v, value: %v expected: %v, actual: %v", kv.key, kv.value, result, kv.out) - } - } -} - -func TestGetFileContents(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - baseurl, err := getBasePath() - th.AssertNoErr(t, err) - fakeURL := strings.Join([]string{baseurl, "my_nova.yaml"}, "/") - urlparsed, err := url.Parse(fakeURL) - th.AssertNoErr(t, err) - myNovaContent := `heat_template_version: 2014-10-16 -parameters: - flavor: - type: string - description: Flavor for the server to be created - default: 4353 - hidden: true -resources: - test_server: - type: "OS::Nova::Server" - properties: - name: test-server - flavor: 2 GB General Purpose v1 - image: Debian 7 (Wheezy) (PVHVM) - networks: - - {uuid: 11111111-1111-1111-1111-111111111111}` - th.Mux.HandleFunc(urlparsed.Path, func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - w.Header().Set("Content-Type", "application/jason") - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, myNovaContent) - }) - - client := fakeClient{BaseClient: getHTTPClient()} - te := new(Template) - te.Bin = []byte(`heat_template_version: 2015-04-30 -resources: - my_server: - type: my_nova.yaml`) - te.client = client - - err = te.Parse() - th.AssertNoErr(t, err) - err = te.getFileContents(te.Parsed, ignoreIfTemplate, true) - th.AssertNoErr(t, err) - expectedFiles := map[string]string{ - "my_nova.yaml": `heat_template_version: 2014-10-16 -parameters: - flavor: - type: string - description: Flavor for the server to be created - default: 4353 - hidden: true -resources: - test_server: - type: "OS::Nova::Server" - properties: - name: test-server - flavor: 2 GB General Purpose v1 - image: Debian 7 (Wheezy) (PVHVM) - networks: - - {uuid: 11111111-1111-1111-1111-111111111111}`} - th.AssertEquals(t, expectedFiles["my_nova.yaml"], te.Files[fakeURL]) - te.fixFileRefs() - expectedParsed := map[string]interface{}{ - "heat_template_version": "2015-04-30", - "resources": map[string]interface{}{ - "my_server": map[string]interface{}{ - "type": fakeURL, - }, - }, - } - te.Parse() - th.AssertDeepEquals(t, expectedParsed, te.Parsed) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks/utils_test.go b/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks/utils_test.go deleted file mode 100644 index 2536e033a6..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks/utils_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package stacks - -import ( - "fmt" - "net/http" - "net/url" - "strings" - "testing" - - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestTEFixFileRefs(t *testing.T) { - te := TE{ - Bin: []byte(`string_to_replace: my fair lady`), - fileMaps: map[string]string{ - "string_to_replace": "london bridge is falling down", - }, - } - te.fixFileRefs() - th.AssertEquals(t, string(te.Bin), `london bridge is falling down: my fair lady`) -} - -func TesttoStringKeys(t *testing.T) { - var test1 interface{} = map[interface{}]interface{}{ - "Adam": "Smith", - "Isaac": "Newton", - } - result1, err := toStringKeys(test1) - th.AssertNoErr(t, err) - - expected := map[string]interface{}{ - "Adam": "Smith", - "Isaac": "Newton", - } - th.AssertDeepEquals(t, result1, expected) -} - -func TestGetBasePath(t *testing.T) { - _, err := getBasePath() - th.AssertNoErr(t, err) -} - -// test if HTTP client can read file type URLS. Read the URL of this file -// because if this test is running, it means this file _must_ exist -func TestGetHTTPClient(t *testing.T) { - client := getHTTPClient() - baseurl, err := getBasePath() - th.AssertNoErr(t, err) - resp, err := client.Get(baseurl) - th.AssertNoErr(t, err) - th.AssertEquals(t, resp.StatusCode, 200) -} - -// Implement a fakeclient that can be used to mock out HTTP requests -type fakeClient struct { - BaseClient Client -} - -// this client's Get method first changes the URL given to point to -// testhelper's (th) endpoints. This is done because the http Mux does not seem -// to work for fqdns with the `file` scheme -func (c fakeClient) Get(url string) (*http.Response, error) { - newurl := strings.Replace(url, "file://", th.Endpoint(), 1) - return c.BaseClient.Get(newurl) -} - -// test the fetch function -func TestFetch(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - baseurl, err := getBasePath() - th.AssertNoErr(t, err) - fakeURL := strings.Join([]string{baseurl, "file.yaml"}, "/") - urlparsed, err := url.Parse(fakeURL) - th.AssertNoErr(t, err) - - th.Mux.HandleFunc(urlparsed.Path, func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - w.Header().Set("Content-Type", "application/jason") - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, "Fee-fi-fo-fum") - }) - - client := fakeClient{BaseClient: getHTTPClient()} - te := TE{ - URL: "file.yaml", - client: client, - } - err = te.Fetch() - th.AssertNoErr(t, err) - th.AssertEquals(t, fakeURL, te.URL) - th.AssertEquals(t, "Fee-fi-fo-fum", string(te.Bin)) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacktemplates/requests_test.go b/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacktemplates/requests_test.go deleted file mode 100644 index 42667c927d..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacktemplates/requests_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package stacktemplates - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestGetTemplate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleGetSuccessfully(t, GetOutput) - - actual, err := Get(fake.ServiceClient(), "postman_stack", "16ef0584-4458-41eb-87c8-0dc8d5f66c87").Extract() - th.AssertNoErr(t, err) - - expected := GetExpected - th.AssertDeepEquals(t, expected, string(actual)) -} - -func TestValidateTemplate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - HandleValidateSuccessfully(t, ValidateOutput) - - opts := ValidateOpts{ - Template: `{ - "heat_template_version": "2013-05-23", - "description": "Simple template to test heat commands", - "parameters": { - "flavor": { - "default": "m1.tiny", - "type": "string" - } - }, - "resources": { - "hello_world": { - "type": "OS::Nova::Server", - "properties": { - "key_name": "heat_key", - "flavor": { - "get_param": "flavor" - }, - "image": "ad091b52-742f-469e-8f3c-fd81cadf0743", - "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n" - } - } - } - }`, - } - actual, err := Validate(fake.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) - - expected := ValidateExpected - th.AssertDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/openstack/utils/choose_version_test.go b/vendor/github.com/rackspace/gophercloud/openstack/utils/choose_version_test.go deleted file mode 100644 index 388d6892cf..0000000000 --- a/vendor/github.com/rackspace/gophercloud/openstack/utils/choose_version_test.go +++ /dev/null @@ -1,118 +0,0 @@ -package utils - -import ( - "fmt" - "net/http" - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/testhelper" -) - -func setupVersionHandler() { - testhelper.Mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, ` - { - "versions": { - "values": [ - { - "status": "stable", - "id": "v3.0", - "links": [ - { "href": "%s/v3.0", "rel": "self" } - ] - }, - { - "status": "stable", - "id": "v2.0", - "links": [ - { "href": "%s/v2.0", "rel": "self" } - ] - } - ] - } - } - `, testhelper.Server.URL, testhelper.Server.URL) - }) -} - -func TestChooseVersion(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - setupVersionHandler() - - v2 := &Version{ID: "v2.0", Priority: 2, Suffix: "blarg"} - v3 := &Version{ID: "v3.0", Priority: 3, Suffix: "hargl"} - - c := &gophercloud.ProviderClient{ - IdentityBase: testhelper.Endpoint(), - IdentityEndpoint: "", - } - v, endpoint, err := ChooseVersion(c, []*Version{v2, v3}) - - if err != nil { - t.Fatalf("Unexpected error from ChooseVersion: %v", err) - } - - if v != v3 { - t.Errorf("Expected %#v to win, but %#v did instead", v3, v) - } - - expected := testhelper.Endpoint() + "v3.0/" - if endpoint != expected { - t.Errorf("Expected endpoint [%s], but was [%s] instead", expected, endpoint) - } -} - -func TestChooseVersionOpinionatedLink(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - setupVersionHandler() - - v2 := &Version{ID: "v2.0", Priority: 2, Suffix: "nope"} - v3 := &Version{ID: "v3.0", Priority: 3, Suffix: "northis"} - - c := &gophercloud.ProviderClient{ - IdentityBase: testhelper.Endpoint(), - IdentityEndpoint: testhelper.Endpoint() + "v2.0/", - } - v, endpoint, err := ChooseVersion(c, []*Version{v2, v3}) - if err != nil { - t.Fatalf("Unexpected error from ChooseVersion: %v", err) - } - - if v != v2 { - t.Errorf("Expected %#v to win, but %#v did instead", v2, v) - } - - expected := testhelper.Endpoint() + "v2.0/" - if endpoint != expected { - t.Errorf("Expected endpoint [%s], but was [%s] instead", expected, endpoint) - } -} - -func TestChooseVersionFromSuffix(t *testing.T) { - testhelper.SetupHTTP() - defer testhelper.TeardownHTTP() - - v2 := &Version{ID: "v2.0", Priority: 2, Suffix: "/v2.0/"} - v3 := &Version{ID: "v3.0", Priority: 3, Suffix: "/v3.0/"} - - c := &gophercloud.ProviderClient{ - IdentityBase: testhelper.Endpoint(), - IdentityEndpoint: testhelper.Endpoint() + "v2.0/", - } - v, endpoint, err := ChooseVersion(c, []*Version{v2, v3}) - if err != nil { - t.Fatalf("Unexpected error from ChooseVersion: %v", err) - } - - if v != v2 { - t.Errorf("Expected %#v to win, but %#v did instead", v2, v) - } - - expected := testhelper.Endpoint() + "v2.0/" - if endpoint != expected { - t.Errorf("Expected endpoint [%s], but was [%s] instead", expected, endpoint) - } -} diff --git a/vendor/github.com/rackspace/gophercloud/pagination/linked_test.go b/vendor/github.com/rackspace/gophercloud/pagination/linked_test.go deleted file mode 100644 index 1ac0f73164..0000000000 --- a/vendor/github.com/rackspace/gophercloud/pagination/linked_test.go +++ /dev/null @@ -1,120 +0,0 @@ -package pagination - -import ( - "fmt" - "net/http" - "reflect" - "testing" - - "github.com/mitchellh/mapstructure" - "github.com/rackspace/gophercloud/testhelper" -) - -// LinkedPager sample and test cases. - -type LinkedPageResult struct { - LinkedPageBase -} - -func (r LinkedPageResult) IsEmpty() (bool, error) { - is, err := ExtractLinkedInts(r) - if err != nil { - return true, nil - } - return len(is) == 0, nil -} - -func ExtractLinkedInts(page Page) ([]int, error) { - var response struct { - Ints []int `mapstructure:"ints"` - } - - err := mapstructure.Decode(page.(LinkedPageResult).Body, &response) - if err != nil { - return nil, err - } - - return response.Ints, nil -} - -func createLinked(t *testing.T) Pager { - testhelper.SetupHTTP() - - testhelper.Mux.HandleFunc("/page1", func(w http.ResponseWriter, r *http.Request) { - w.Header().Add("Content-Type", "application/json") - fmt.Fprintf(w, `{ "ints": [1, 2, 3], "links": { "next": "%s/page2" } }`, testhelper.Server.URL) - }) - - testhelper.Mux.HandleFunc("/page2", func(w http.ResponseWriter, r *http.Request) { - w.Header().Add("Content-Type", "application/json") - fmt.Fprintf(w, `{ "ints": [4, 5, 6], "links": { "next": "%s/page3" } }`, testhelper.Server.URL) - }) - - testhelper.Mux.HandleFunc("/page3", func(w http.ResponseWriter, r *http.Request) { - w.Header().Add("Content-Type", "application/json") - fmt.Fprintf(w, `{ "ints": [7, 8, 9], "links": { "next": null } }`) - }) - - client := createClient() - - createPage := func(r PageResult) Page { - return LinkedPageResult{LinkedPageBase{PageResult: r}} - } - - return NewPager(client, testhelper.Server.URL+"/page1", createPage) -} - -func TestEnumerateLinked(t *testing.T) { - pager := createLinked(t) - defer testhelper.TeardownHTTP() - - callCount := 0 - err := pager.EachPage(func(page Page) (bool, error) { - actual, err := ExtractLinkedInts(page) - if err != nil { - return false, err - } - - t.Logf("Handler invoked with %v", actual) - - var expected []int - switch callCount { - case 0: - expected = []int{1, 2, 3} - case 1: - expected = []int{4, 5, 6} - case 2: - expected = []int{7, 8, 9} - default: - t.Fatalf("Unexpected call count: %d", callCount) - return false, nil - } - - if !reflect.DeepEqual(expected, actual) { - t.Errorf("Call %d: Expected %#v, but was %#v", callCount, expected, actual) - } - - callCount++ - return true, nil - }) - if err != nil { - t.Errorf("Unexpected error for page iteration: %v", err) - } - - if callCount != 3 { - t.Errorf("Expected 3 calls, but was %d", callCount) - } -} - -func TestAllPagesLinked(t *testing.T) { - pager := createLinked(t) - defer testhelper.TeardownHTTP() - - page, err := pager.AllPages() - testhelper.AssertNoErr(t, err) - - expected := []int{1, 2, 3, 4, 5, 6, 7, 8, 9} - actual, err := ExtractLinkedInts(page) - testhelper.AssertNoErr(t, err) - testhelper.CheckDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/pagination/marker_test.go b/vendor/github.com/rackspace/gophercloud/pagination/marker_test.go deleted file mode 100644 index f4d55be810..0000000000 --- a/vendor/github.com/rackspace/gophercloud/pagination/marker_test.go +++ /dev/null @@ -1,126 +0,0 @@ -package pagination - -import ( - "fmt" - "net/http" - "strings" - "testing" - - "github.com/rackspace/gophercloud/testhelper" -) - -// MarkerPager sample and test cases. - -type MarkerPageResult struct { - MarkerPageBase -} - -func (r MarkerPageResult) IsEmpty() (bool, error) { - results, err := ExtractMarkerStrings(r) - if err != nil { - return true, err - } - return len(results) == 0, err -} - -func (r MarkerPageResult) LastMarker() (string, error) { - results, err := ExtractMarkerStrings(r) - if err != nil { - return "", err - } - if len(results) == 0 { - return "", nil - } - return results[len(results)-1], nil -} - -func createMarkerPaged(t *testing.T) Pager { - testhelper.SetupHTTP() - - testhelper.Mux.HandleFunc("/page", func(w http.ResponseWriter, r *http.Request) { - r.ParseForm() - ms := r.Form["marker"] - switch { - case len(ms) == 0: - fmt.Fprintf(w, "aaa\nbbb\nccc") - case len(ms) == 1 && ms[0] == "ccc": - fmt.Fprintf(w, "ddd\neee\nfff") - case len(ms) == 1 && ms[0] == "fff": - fmt.Fprintf(w, "ggg\nhhh\niii") - case len(ms) == 1 && ms[0] == "iii": - w.WriteHeader(http.StatusNoContent) - default: - t.Errorf("Request with unexpected marker: [%v]", ms) - } - }) - - client := createClient() - - createPage := func(r PageResult) Page { - p := MarkerPageResult{MarkerPageBase{PageResult: r}} - p.MarkerPageBase.Owner = p - return p - } - - return NewPager(client, testhelper.Server.URL+"/page", createPage) -} - -func ExtractMarkerStrings(page Page) ([]string, error) { - content := page.(MarkerPageResult).Body.([]uint8) - parts := strings.Split(string(content), "\n") - results := make([]string, 0, len(parts)) - for _, part := range parts { - if len(part) > 0 { - results = append(results, part) - } - } - return results, nil -} - -func TestEnumerateMarker(t *testing.T) { - pager := createMarkerPaged(t) - defer testhelper.TeardownHTTP() - - callCount := 0 - err := pager.EachPage(func(page Page) (bool, error) { - actual, err := ExtractMarkerStrings(page) - if err != nil { - return false, err - } - - t.Logf("Handler invoked with %v", actual) - - var expected []string - switch callCount { - case 0: - expected = []string{"aaa", "bbb", "ccc"} - case 1: - expected = []string{"ddd", "eee", "fff"} - case 2: - expected = []string{"ggg", "hhh", "iii"} - default: - t.Fatalf("Unexpected call count: %d", callCount) - return false, nil - } - - testhelper.CheckDeepEquals(t, expected, actual) - - callCount++ - return true, nil - }) - testhelper.AssertNoErr(t, err) - testhelper.AssertEquals(t, callCount, 3) -} - -func TestAllPagesMarker(t *testing.T) { - pager := createMarkerPaged(t) - defer testhelper.TeardownHTTP() - - page, err := pager.AllPages() - testhelper.AssertNoErr(t, err) - - expected := []string{"aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii"} - actual, err := ExtractMarkerStrings(page) - testhelper.AssertNoErr(t, err) - testhelper.CheckDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/pagination/pagination_test.go b/vendor/github.com/rackspace/gophercloud/pagination/pagination_test.go deleted file mode 100644 index f3e4de1b04..0000000000 --- a/vendor/github.com/rackspace/gophercloud/pagination/pagination_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package pagination - -import ( - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/testhelper" -) - -func createClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{ - ProviderClient: &gophercloud.ProviderClient{TokenID: "abc123"}, - Endpoint: testhelper.Endpoint(), - } -} diff --git a/vendor/github.com/rackspace/gophercloud/pagination/single_test.go b/vendor/github.com/rackspace/gophercloud/pagination/single_test.go deleted file mode 100644 index 4af0fee69a..0000000000 --- a/vendor/github.com/rackspace/gophercloud/pagination/single_test.go +++ /dev/null @@ -1,84 +0,0 @@ -package pagination - -import ( - "fmt" - "net/http" - "testing" - - "github.com/mitchellh/mapstructure" - "github.com/rackspace/gophercloud/testhelper" -) - -// SinglePage sample and test cases. - -type SinglePageResult struct { - SinglePageBase -} - -func (r SinglePageResult) IsEmpty() (bool, error) { - is, err := ExtractSingleInts(r) - if err != nil { - return true, err - } - return len(is) == 0, nil -} - -func ExtractSingleInts(page Page) ([]int, error) { - var response struct { - Ints []int `mapstructure:"ints"` - } - - err := mapstructure.Decode(page.(SinglePageResult).Body, &response) - if err != nil { - return nil, err - } - - return response.Ints, nil -} - -func setupSinglePaged() Pager { - testhelper.SetupHTTP() - client := createClient() - - testhelper.Mux.HandleFunc("/only", func(w http.ResponseWriter, r *http.Request) { - w.Header().Add("Content-Type", "application/json") - fmt.Fprintf(w, `{ "ints": [1, 2, 3] }`) - }) - - createPage := func(r PageResult) Page { - return SinglePageResult{SinglePageBase(r)} - } - - return NewPager(client, testhelper.Server.URL+"/only", createPage) -} - -func TestEnumerateSinglePaged(t *testing.T) { - callCount := 0 - pager := setupSinglePaged() - defer testhelper.TeardownHTTP() - - err := pager.EachPage(func(page Page) (bool, error) { - callCount++ - - expected := []int{1, 2, 3} - actual, err := ExtractSingleInts(page) - testhelper.AssertNoErr(t, err) - testhelper.CheckDeepEquals(t, expected, actual) - return true, nil - }) - testhelper.CheckNoErr(t, err) - testhelper.CheckEquals(t, 1, callCount) -} - -func TestAllPagesSingle(t *testing.T) { - pager := setupSinglePaged() - defer testhelper.TeardownHTTP() - - page, err := pager.AllPages() - testhelper.AssertNoErr(t, err) - - expected := []int{1, 2, 3} - actual, err := ExtractSingleInts(page) - testhelper.AssertNoErr(t, err) - testhelper.CheckDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/params_test.go b/vendor/github.com/rackspace/gophercloud/params_test.go deleted file mode 100644 index 2f40eec812..0000000000 --- a/vendor/github.com/rackspace/gophercloud/params_test.go +++ /dev/null @@ -1,165 +0,0 @@ -package gophercloud - -import ( - "net/url" - "reflect" - "testing" - "time" - - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestMaybeString(t *testing.T) { - testString := "" - var expected *string - actual := MaybeString(testString) - th.CheckDeepEquals(t, expected, actual) - - testString = "carol" - expected = &testString - actual = MaybeString(testString) - th.CheckDeepEquals(t, expected, actual) -} - -func TestMaybeInt(t *testing.T) { - testInt := 0 - var expected *int - actual := MaybeInt(testInt) - th.CheckDeepEquals(t, expected, actual) - - testInt = 4 - expected = &testInt - actual = MaybeInt(testInt) - th.CheckDeepEquals(t, expected, actual) -} - -func TestBuildQueryString(t *testing.T) { - type testVar string - opts := struct { - J int `q:"j"` - R string `q:"r,required"` - C bool `q:"c"` - S []string `q:"s"` - TS []testVar `q:"ts"` - TI []int `q:"ti"` - }{ - J: 2, - R: "red", - C: true, - S: []string{"one", "two", "three"}, - TS: []testVar{"a", "b"}, - TI: []int{1, 2}, - } - expected := &url.URL{RawQuery: "c=true&j=2&r=red&s=one&s=two&s=three&ti=1&ti=2&ts=a&ts=b"} - actual, err := BuildQueryString(&opts) - if err != nil { - t.Errorf("Error building query string: %v", err) - } - th.CheckDeepEquals(t, expected, actual) - - opts = struct { - J int `q:"j"` - R string `q:"r,required"` - C bool `q:"c"` - S []string `q:"s"` - TS []testVar `q:"ts"` - TI []int `q:"ti"` - }{ - J: 2, - C: true, - } - _, err = BuildQueryString(&opts) - if err == nil { - t.Errorf("Expected error: 'Required field not set'") - } - th.CheckDeepEquals(t, expected, actual) - - _, err = BuildQueryString(map[string]interface{}{"Number": 4}) - if err == nil { - t.Errorf("Expected error: 'Options type is not a struct'") - } -} - -func TestBuildHeaders(t *testing.T) { - testStruct := struct { - Accept string `h:"Accept"` - Num int `h:"Number,required"` - Style bool `h:"Style"` - }{ - Accept: "application/json", - Num: 4, - Style: true, - } - expected := map[string]string{"Accept": "application/json", "Number": "4", "Style": "true"} - actual, err := BuildHeaders(&testStruct) - th.CheckNoErr(t, err) - th.CheckDeepEquals(t, expected, actual) - - testStruct.Num = 0 - _, err = BuildHeaders(&testStruct) - if err == nil { - t.Errorf("Expected error: 'Required header not set'") - } - - _, err = BuildHeaders(map[string]interface{}{"Number": 4}) - if err == nil { - t.Errorf("Expected error: 'Options type is not a struct'") - } -} - -func TestIsZero(t *testing.T) { - var testMap map[string]interface{} - testMapValue := reflect.ValueOf(testMap) - expected := true - actual := isZero(testMapValue) - th.CheckEquals(t, expected, actual) - testMap = map[string]interface{}{"empty": false} - testMapValue = reflect.ValueOf(testMap) - expected = false - actual = isZero(testMapValue) - th.CheckEquals(t, expected, actual) - - var testArray [2]string - testArrayValue := reflect.ValueOf(testArray) - expected = true - actual = isZero(testArrayValue) - th.CheckEquals(t, expected, actual) - testArray = [2]string{"one", "two"} - testArrayValue = reflect.ValueOf(testArray) - expected = false - actual = isZero(testArrayValue) - th.CheckEquals(t, expected, actual) - - var testStruct struct { - A string - B time.Time - } - testStructValue := reflect.ValueOf(testStruct) - expected = true - actual = isZero(testStructValue) - th.CheckEquals(t, expected, actual) - testStruct = struct { - A string - B time.Time - }{ - B: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC), - } - testStructValue = reflect.ValueOf(testStruct) - expected = false - actual = isZero(testStructValue) - th.CheckEquals(t, expected, actual) -} - -func TestQueriesAreEscaped(t *testing.T) { - type foo struct { - Name string `q:"something"` - Shape string `q:"else"` - } - - expected := &url.URL{RawQuery: "else=Triangl+e&something=blah%2B%3F%21%21foo"} - - actual, err := BuildQueryString(foo{Name: "blah+?!!foo", Shape: "Triangl e"}) - th.AssertNoErr(t, err) - - th.AssertDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/provider_client_test.go b/vendor/github.com/rackspace/gophercloud/provider_client_test.go deleted file mode 100644 index d79d862b2c..0000000000 --- a/vendor/github.com/rackspace/gophercloud/provider_client_test.go +++ /dev/null @@ -1,35 +0,0 @@ -package gophercloud - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestAuthenticatedHeaders(t *testing.T) { - p := &ProviderClient{ - TokenID: "1234", - } - expected := map[string]string{"X-Auth-Token": "1234"} - actual := p.AuthenticatedHeaders() - th.CheckDeepEquals(t, expected, actual) -} - -func TestUserAgent(t *testing.T) { - p := &ProviderClient{} - - p.UserAgent.Prepend("custom-user-agent/2.4.0") - expected := "custom-user-agent/2.4.0 gophercloud/1.0.0" - actual := p.UserAgent.Join() - th.CheckEquals(t, expected, actual) - - p.UserAgent.Prepend("another-custom-user-agent/0.3.0", "a-third-ua/5.9.0") - expected = "another-custom-user-agent/0.3.0 a-third-ua/5.9.0 custom-user-agent/2.4.0 gophercloud/1.0.0" - actual = p.UserAgent.Join() - th.CheckEquals(t, expected, actual) - - p.UserAgent = UserAgent{} - expected = "gophercloud/1.0.0" - actual = p.UserAgent.Join() - th.CheckEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/blockstorage/v1/snapshots/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/blockstorage/v1/snapshots/delegate_test.go deleted file mode 100644 index 1a02b46527..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/blockstorage/v1/snapshots/delegate_test.go +++ /dev/null @@ -1,97 +0,0 @@ -package snapshots - -import ( - "testing" - - "github.com/rackspace/gophercloud" - os "github.com/rackspace/gophercloud/openstack/blockstorage/v1/snapshots" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -const endpoint = "http://localhost:57909/v1/12345" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestUpdateURL(t *testing.T) { - actual := updateURL(endpointClient(), "foo") - expected := endpoint + "snapshots/foo" - th.AssertEquals(t, expected, actual) -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.MockListResponse(t) - - count := 0 - - err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractSnapshots(page) - if err != nil { - t.Errorf("Failed to extract snapshots: %v", err) - return false, err - } - - expected := []Snapshot{ - Snapshot{ - ID: "289da7f8-6440-407c-9fb4-7db01ec49164", - Name: "snapshot-001", - }, - Snapshot{ - ID: "96c3bda7-c82a-4f50-be73-ca7621794835", - Name: "snapshot-002", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertEquals(t, 1, count) - th.AssertNoErr(t, err) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.MockGetResponse(t) - - v, err := Get(fake.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, v.Name, "snapshot-001") - th.AssertEquals(t, v.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.MockCreateResponse(t) - - options := &CreateOpts{VolumeID: "1234", Name: "snapshot-001"} - n, err := Create(fake.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.VolumeID, "1234") - th.AssertEquals(t, n.Name, "snapshot-001") - th.AssertEquals(t, n.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.MockDeleteResponse(t) - - res := Delete(fake.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/blockstorage/v1/volumes/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/blockstorage/v1/volumes/delegate_test.go deleted file mode 100644 index b6831f2114..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/blockstorage/v1/volumes/delegate_test.go +++ /dev/null @@ -1,107 +0,0 @@ -package volumes - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes" - os "github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes/testing" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.MockListResponse(t) - - count := 0 - - err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractVolumes(page) - if err != nil { - t.Errorf("Failed to extract volumes: %v", err) - return false, err - } - - expected := []Volume{ - Volume{ - ID: "289da7f8-6440-407c-9fb4-7db01ec49164", - Name: "vol-001", - }, - Volume{ - ID: "96c3bda7-c82a-4f50-be73-ca7621794835", - Name: "vol-002", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertEquals(t, 1, count) - th.AssertNoErr(t, err) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.MockGetResponse(t) - - v, err := Get(fake.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, v.Name, "vol-001") - th.AssertEquals(t, v.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.MockCreateResponse(t) - - n, err := Create(fake.ServiceClient(), CreateOpts{volumes.CreateOpts{Size: 75}}).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.Size, 4) - th.AssertEquals(t, n.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") -} - -func TestSizeRange(t *testing.T) { - _, err := Create(fake.ServiceClient(), CreateOpts{volumes.CreateOpts{Size: 1}}).Extract() - if err == nil { - t.Fatalf("Expected error, got none") - } - - _, err = Create(fake.ServiceClient(), CreateOpts{volumes.CreateOpts{Size: 2000}}).Extract() - if err == nil { - t.Fatalf("Expected error, got none") - } -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.MockDeleteResponse(t) - - res := Delete(fake.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22") - th.AssertNoErr(t, res.Err) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.MockUpdateResponse(t) - - options := &UpdateOpts{Name: "vol-002"} - v, err := Update(fake.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22", options).Extract() - th.AssertNoErr(t, err) - th.CheckEquals(t, "vol-002", v.Name) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/blockstorage/v1/volumetypes/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/blockstorage/v1/volumetypes/delegate_test.go deleted file mode 100644 index 6e65c904b5..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/blockstorage/v1/volumetypes/delegate_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package volumetypes - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumetypes" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.MockListResponse(t) - - count := 0 - - err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractVolumeTypes(page) - if err != nil { - t.Errorf("Failed to extract volume types: %v", err) - return false, err - } - - expected := []VolumeType{ - VolumeType{ - ID: "289da7f8-6440-407c-9fb4-7db01ec49164", - Name: "vol-type-001", - ExtraSpecs: map[string]interface{}{ - "capabilities": "gpu", - }, - }, - VolumeType{ - ID: "96c3bda7-c82a-4f50-be73-ca7621794835", - Name: "vol-type-002", - ExtraSpecs: map[string]interface{}{}, - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertEquals(t, 1, count) - th.AssertNoErr(t, err) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.MockGetResponse(t) - - vt, err := Get(fake.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22").Extract() - th.AssertNoErr(t, err) - - th.AssertDeepEquals(t, vt.ExtraSpecs, map[string]interface{}{"serverNumber": "2"}) - th.AssertEquals(t, vt.Name, "vol-type-001") - th.AssertEquals(t, vt.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/cdn/v1/base/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/cdn/v1/base/delegate_test.go deleted file mode 100644 index 731fc6dd00..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/cdn/v1/base/delegate_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package base - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/cdn/v1/base" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestGetHomeDocument(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleGetSuccessfully(t) - - actual, err := Get(fake.ServiceClient()).Extract() - th.CheckNoErr(t, err) - - expected := os.HomeDocument{ - "rel/cdn": map[string]interface{}{ - "href-template": "services{?marker,limit}", - "href-vars": map[string]interface{}{ - "marker": "param/marker", - "limit": "param/limit", - }, - "hints": map[string]interface{}{ - "allow": []string{"GET"}, - "formats": map[string]interface{}{ - "application/json": map[string]interface{}{}, - }, - }, - }, - } - th.CheckDeepEquals(t, expected, *actual) -} - -func TestPing(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandlePingSuccessfully(t) - - err := Ping(fake.ServiceClient()).ExtractErr() - th.CheckNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/cdn/v1/flavors/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/cdn/v1/flavors/delegate_test.go deleted file mode 100644 index d6d299df8e..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/cdn/v1/flavors/delegate_test.go +++ /dev/null @@ -1,90 +0,0 @@ -package flavors - -import ( - "testing" - - "github.com/rackspace/gophercloud" - os "github.com/rackspace/gophercloud/openstack/cdn/v1/flavors" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.HandleListCDNFlavorsSuccessfully(t) - - count := 0 - - err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := os.ExtractFlavors(page) - if err != nil { - t.Errorf("Failed to extract flavors: %v", err) - return false, err - } - - expected := []os.Flavor{ - os.Flavor{ - ID: "europe", - Providers: []os.Provider{ - os.Provider{ - Provider: "Fastly", - Links: []gophercloud.Link{ - gophercloud.Link{ - Href: "http://www.fastly.com", - Rel: "provider_url", - }, - }, - }, - }, - Links: []gophercloud.Link{ - gophercloud.Link{ - Href: "https://www.poppycdn.io/v1.0/flavors/europe", - Rel: "self", - }, - }, - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.HandleGetCDNFlavorSuccessfully(t) - - expected := &os.Flavor{ - ID: "asia", - Providers: []os.Provider{ - os.Provider{ - Provider: "ChinaCache", - Links: []gophercloud.Link{ - gophercloud.Link{ - Href: "http://www.chinacache.com", - Rel: "provider_url", - }, - }, - }, - }, - Links: []gophercloud.Link{ - gophercloud.Link{ - Href: "https://www.poppycdn.io/v1.0/flavors/asia", - Rel: "self", - }, - }, - } - - actual, err := Get(fake.ServiceClient(), "asia").Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/cdn/v1/serviceassets/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/cdn/v1/serviceassets/delegate_test.go deleted file mode 100644 index 328e1682d3..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/cdn/v1/serviceassets/delegate_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package serviceassets - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/cdn/v1/serviceassets" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.HandleDeleteCDNAssetSuccessfully(t) - - err := Delete(fake.ServiceClient(), "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0", nil).ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/cdn/v1/services/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/cdn/v1/services/delegate_test.go deleted file mode 100644 index 6c48365e4e..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/cdn/v1/services/delegate_test.go +++ /dev/null @@ -1,359 +0,0 @@ -package services - -import ( - "testing" - - "github.com/rackspace/gophercloud" - os "github.com/rackspace/gophercloud/openstack/cdn/v1/services" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.HandleListCDNServiceSuccessfully(t) - - count := 0 - - err := List(fake.ServiceClient(), &os.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := os.ExtractServices(page) - if err != nil { - t.Errorf("Failed to extract services: %v", err) - return false, err - } - - expected := []os.Service{ - os.Service{ - ID: "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0", - Name: "mywebsite.com", - Domains: []os.Domain{ - os.Domain{ - Domain: "www.mywebsite.com", - }, - }, - Origins: []os.Origin{ - os.Origin{ - Origin: "mywebsite.com", - Port: 80, - SSL: false, - }, - }, - Caching: []os.CacheRule{ - os.CacheRule{ - Name: "default", - TTL: 3600, - }, - os.CacheRule{ - Name: "home", - TTL: 17200, - Rules: []os.TTLRule{ - os.TTLRule{ - Name: "index", - RequestURL: "/index.htm", - }, - }, - }, - os.CacheRule{ - Name: "images", - TTL: 12800, - Rules: []os.TTLRule{ - os.TTLRule{ - Name: "images", - RequestURL: "*.png", - }, - }, - }, - }, - Restrictions: []os.Restriction{ - os.Restriction{ - Name: "website only", - Rules: []os.RestrictionRule{ - os.RestrictionRule{ - Name: "mywebsite.com", - Referrer: "www.mywebsite.com", - }, - }, - }, - }, - FlavorID: "asia", - Status: "deployed", - Errors: []os.Error{}, - Links: []gophercloud.Link{ - gophercloud.Link{ - Href: "https://www.poppycdn.io/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0", - Rel: "self", - }, - gophercloud.Link{ - Href: "mywebsite.com.cdn123.poppycdn.net", - Rel: "access_url", - }, - gophercloud.Link{ - Href: "https://www.poppycdn.io/v1.0/flavors/asia", - Rel: "flavor", - }, - }, - }, - os.Service{ - ID: "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f1", - Name: "myothersite.com", - Domains: []os.Domain{ - os.Domain{ - Domain: "www.myothersite.com", - }, - }, - Origins: []os.Origin{ - os.Origin{ - Origin: "44.33.22.11", - Port: 80, - SSL: false, - }, - os.Origin{ - Origin: "77.66.55.44", - Port: 80, - SSL: false, - Rules: []os.OriginRule{ - os.OriginRule{ - Name: "videos", - RequestURL: "^/videos/*.m3u", - }, - }, - }, - }, - Caching: []os.CacheRule{ - os.CacheRule{ - Name: "default", - TTL: 3600, - }, - }, - Restrictions: []os.Restriction{}, - FlavorID: "europe", - Status: "deployed", - Links: []gophercloud.Link{ - gophercloud.Link{ - Href: "https://www.poppycdn.io/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f1", - Rel: "self", - }, - gophercloud.Link{ - Href: "myothersite.com.poppycdn.net", - Rel: "access_url", - }, - gophercloud.Link{ - Href: "https://www.poppycdn.io/v1.0/flavors/europe", - Rel: "flavor", - }, - }, - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.HandleCreateCDNServiceSuccessfully(t) - - createOpts := os.CreateOpts{ - Name: "mywebsite.com", - Domains: []os.Domain{ - os.Domain{ - Domain: "www.mywebsite.com", - }, - os.Domain{ - Domain: "blog.mywebsite.com", - }, - }, - Origins: []os.Origin{ - os.Origin{ - Origin: "mywebsite.com", - Port: 80, - SSL: false, - }, - }, - Restrictions: []os.Restriction{ - os.Restriction{ - Name: "website only", - Rules: []os.RestrictionRule{ - os.RestrictionRule{ - Name: "mywebsite.com", - Referrer: "www.mywebsite.com", - }, - }, - }, - }, - Caching: []os.CacheRule{ - os.CacheRule{ - Name: "default", - TTL: 3600, - }, - }, - FlavorID: "cdn", - } - - expected := "https://global.cdn.api.rackspacecloud.com/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0" - actual, err := Create(fake.ServiceClient(), createOpts).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, expected, actual) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.HandleGetCDNServiceSuccessfully(t) - - expected := &os.Service{ - ID: "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0", - Name: "mywebsite.com", - Domains: []os.Domain{ - os.Domain{ - Domain: "www.mywebsite.com", - Protocol: "http", - }, - }, - Origins: []os.Origin{ - os.Origin{ - Origin: "mywebsite.com", - Port: 80, - SSL: false, - }, - }, - Caching: []os.CacheRule{ - os.CacheRule{ - Name: "default", - TTL: 3600, - }, - os.CacheRule{ - Name: "home", - TTL: 17200, - Rules: []os.TTLRule{ - os.TTLRule{ - Name: "index", - RequestURL: "/index.htm", - }, - }, - }, - os.CacheRule{ - Name: "images", - TTL: 12800, - Rules: []os.TTLRule{ - os.TTLRule{ - Name: "images", - RequestURL: "*.png", - }, - }, - }, - }, - Restrictions: []os.Restriction{ - os.Restriction{ - Name: "website only", - Rules: []os.RestrictionRule{ - os.RestrictionRule{ - Name: "mywebsite.com", - Referrer: "www.mywebsite.com", - }, - }, - }, - }, - FlavorID: "cdn", - Status: "deployed", - Errors: []os.Error{}, - Links: []gophercloud.Link{ - gophercloud.Link{ - Href: "https://global.cdn.api.rackspacecloud.com/v1.0/110011/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0", - Rel: "self", - }, - gophercloud.Link{ - Href: "blog.mywebsite.com.cdn1.raxcdn.com", - Rel: "access_url", - }, - gophercloud.Link{ - Href: "https://global.cdn.api.rackspacecloud.com/v1.0/110011/flavors/cdn", - Rel: "flavor", - }, - }, - } - - actual, err := Get(fake.ServiceClient(), "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0").Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expected, actual) -} - -func TestSuccessfulUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.HandleUpdateCDNServiceSuccessfully(t) - - expected := "https://www.poppycdn.io/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0" - ops := []os.Patch{ - // Append a single Domain - os.Append{Value: os.Domain{Domain: "appended.mocksite4.com"}}, - // Insert a single Domain - os.Insertion{ - Index: 4, - Value: os.Domain{Domain: "inserted.mocksite4.com"}, - }, - // Bulk addition - os.Append{ - Value: os.DomainList{ - os.Domain{Domain: "bulkadded1.mocksite4.com"}, - os.Domain{Domain: "bulkadded2.mocksite4.com"}, - }, - }, - // Replace a single Origin - os.Replacement{ - Index: 2, - Value: os.Origin{Origin: "44.33.22.11", Port: 80, SSL: false}, - }, - // Bulk replace Origins - os.Replacement{ - Index: 0, // Ignored - Value: os.OriginList{ - os.Origin{Origin: "44.33.22.11", Port: 80, SSL: false}, - os.Origin{Origin: "55.44.33.22", Port: 443, SSL: true}, - }, - }, - // Remove a single CacheRule - os.Removal{ - Index: 8, - Path: os.PathCaching, - }, - // Bulk removal - os.Removal{ - All: true, - Path: os.PathCaching, - }, - // Service name replacement - os.NameReplacement{ - NewName: "differentServiceName", - }, - } - - actual, err := Update(fake.ServiceClient(), "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0", ops).Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, expected, actual) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.HandleDeleteCDNServiceSuccessfully(t) - - err := Delete(fake.ServiceClient(), "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0").ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/client_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/client_test.go deleted file mode 100644 index 73b1c886ff..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/client_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package rackspace - -import ( - "fmt" - "net/http" - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestAuthenticatedClientV2(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/tokens", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, ` - { - "access": { - "token": { - "id": "01234567890", - "expires": "2014-10-01T10:00:00.000000Z" - }, - "serviceCatalog": [] - } - } - `) - }) - - options := gophercloud.AuthOptions{ - Username: "me", - APIKey: "09876543210", - IdentityEndpoint: th.Endpoint() + "v2.0/", - } - client, err := AuthenticatedClient(options) - th.AssertNoErr(t, err) - th.CheckEquals(t, "01234567890", client.TokenID) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/bootfromvolume/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/bootfromvolume/delegate_test.go deleted file mode 100644 index 571a1bed2b..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/bootfromvolume/delegate_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package bootfromvolume - -import ( - "testing" - - osBFV "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume" - "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestCreateOpts(t *testing.T) { - base := servers.CreateOpts{ - Name: "createdserver", - ImageRef: "asdfasdfasdf", - FlavorRef: "performance1-1", - } - - ext := osBFV.CreateOptsExt{ - CreateOptsBuilder: base, - BlockDevice: []osBFV.BlockDevice{ - osBFV.BlockDevice{ - UUID: "123456", - SourceType: osBFV.Image, - DestinationType: "volume", - VolumeSize: 10, - }, - }, - } - - expected := ` - { - "server": { - "name": "createdserver", - "imageRef": "asdfasdfasdf", - "flavorRef": "performance1-1", - "flavorName": "", - "imageName": "", - "block_device_mapping_v2":[ - { - "uuid":"123456", - "source_type":"image", - "destination_type":"volume", - "boot_index": "0", - "delete_on_termination": "false", - "volume_size": "10" - } - ] - } - } - ` - actual, err := ext.ToServerCreateMap() - th.AssertNoErr(t, err) - th.CheckJSONEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/flavors/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/flavors/delegate_test.go deleted file mode 100644 index 204081dd17..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/flavors/delegate_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package flavors - -import ( - "fmt" - "net/http" - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListFlavors(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/flavors/detail", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", client.TokenID) - - w.Header().Add("Content-Type", "application/json") - r.ParseForm() - marker := r.Form.Get("marker") - switch marker { - case "": - fmt.Fprintf(w, ListOutput) - case "performance1-2": - fmt.Fprintf(w, `{ "flavors": [] }`) - default: - t.Fatalf("Unexpected marker: [%s]", marker) - } - }) - - count := 0 - err := ListDetail(client.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) { - actual, err := ExtractFlavors(page) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, ExpectedFlavorSlice, actual) - - count++ - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestGetFlavor(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/flavors/performance1-1", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", client.TokenID) - - w.Header().Add("Content-Type", "application/json") - fmt.Fprintf(w, GetOutput) - }) - - actual, err := Get(client.ServiceClient(), "performance1-1").Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &Performance1Flavor, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/images/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/images/delegate_test.go deleted file mode 100644 index db0a6e3414..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/images/delegate_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package images - -import ( - "fmt" - "net/http" - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListImageDetails(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/images/detail", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", client.TokenID) - - w.Header().Add("Content-Type", "application/json") - r.ParseForm() - marker := r.Form.Get("marker") - switch marker { - case "": - fmt.Fprintf(w, ListOutput) - case "e19a734c-c7e6-443a-830c-242209c4d65d": - fmt.Fprintf(w, `{ "images": [] }`) - default: - t.Fatalf("Unexpected marker: [%s]", marker) - } - }) - - count := 0 - err := ListDetail(client.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractImages(page) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, ExpectedImageSlice, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestGetImageDetails(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/images/e19a734c-c7e6-443a-830c-242209c4d65d", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", client.TokenID) - - w.Header().Add("Content-Type", "application/json") - fmt.Fprintf(w, GetOutput) - }) - - actual, err := Get(client.ServiceClient(), "e19a734c-c7e6-443a-830c-242209c4d65d").Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &UbuntuImage, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/keypairs/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/keypairs/delegate_test.go deleted file mode 100644 index 62e5df950c..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/keypairs/delegate_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package keypairs - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/keypairs" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleListSuccessfully(t) - - count := 0 - err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractKeyPairs(page) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, os.ExpectedKeyPairSlice, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleCreateSuccessfully(t) - - actual, err := Create(client.ServiceClient(), os.CreateOpts{ - Name: "createdkey", - }).Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &os.CreatedKeyPair, actual) -} - -func TestImport(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleImportSuccessfully(t) - - actual, err := Create(client.ServiceClient(), os.CreateOpts{ - Name: "importedkey", - PublicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDx8nkQv/zgGgB4rMYmIf+6A4l6Rr+o/6lHBQdW5aYd44bd8JttDCE/F/pNRr0lRE+PiqSPO8nDPHw0010JeMH9gYgnnFlyY3/OcJ02RhIPyyxYpv9FhY+2YiUkpwFOcLImyrxEsYXpD/0d3ac30bNH6Sw9JD9UZHYcpSxsIbECHw== Generated by Nova", - }).Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &os.ImportedKeyPair, actual) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleGetSuccessfully(t) - - actual, err := Get(client.ServiceClient(), "firstkey").Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &os.FirstKeyPair, actual) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleDeleteSuccessfully(t) - - err := Delete(client.ServiceClient(), "deletedkey").ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/networks/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/networks/requests_test.go deleted file mode 100644 index 6f44c1caba..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/networks/requests_test.go +++ /dev/null @@ -1,156 +0,0 @@ -package networks - -import ( - "fmt" - "net/http" - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/os-networksv2", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "networks": [ - { - "label": "test-network-1", - "cidr": "192.168.100.0/24", - "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22" - }, - { - "label": "test-network-2", - "cidr": "192.30.250.00/18", - "id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324" - } - ] -} - `) - }) - - client := fake.ServiceClient() - count := 0 - - err := List(client).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractNetworks(page) - if err != nil { - t.Errorf("Failed to extract networks: %v", err) - return false, err - } - - expected := []Network{ - Network{ - Label: "test-network-1", - CIDR: "192.168.100.0/24", - ID: "d32019d3-bc6e-4319-9c1d-6722fc136a22", - }, - Network{ - Label: "test-network-2", - CIDR: "192.30.250.00/18", - ID: "db193ab3-96e3-4cb3-8fc5-05f4296d0324", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/os-networksv2/d32019d3-bc6e-4319-9c1d-6722fc136a22", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "network": { - "label": "test-network-1", - "cidr": "192.168.100.0/24", - "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22" - } -} - `) - }) - - n, err := Get(fake.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.CIDR, "192.168.100.0/24") - th.AssertEquals(t, n.Label, "test-network-1") - th.AssertEquals(t, n.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/os-networksv2", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "network": { - "label": "test-network-1", - "cidr": "192.168.100.0/24" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "network": { - "label": "test-network-1", - "cidr": "192.168.100.0/24", - "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c" - } -} - `) - }) - - options := CreateOpts{Label: "test-network-1", CIDR: "192.168.100.0/24"} - n, err := Create(fake.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.Label, "test-network-1") - th.AssertEquals(t, n.ID, "4e8e5957-649f-477b-9e5b-f1f75b21c03c") -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/os-networksv2/4e8e5957-649f-477b-9e5b-f1f75b21c03c", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "4e8e5957-649f-477b-9e5b-f1f75b21c03c") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/networks/urls_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/networks/urls_test.go deleted file mode 100644 index 983992e2b9..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/networks/urls_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package networks - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909/" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestGetURL(t *testing.T) { - actual := getURL(endpointClient(), "foo") - expected := endpoint + "os-networksv2/foo" - th.AssertEquals(t, expected, actual) -} - -func TestCreateURL(t *testing.T) { - actual := createURL(endpointClient()) - expected := endpoint + "os-networksv2" - th.AssertEquals(t, expected, actual) -} - -func TestListURL(t *testing.T) { - actual := createURL(endpointClient()) - expected := endpoint + "os-networksv2" - th.AssertEquals(t, expected, actual) -} - -func TestDeleteURL(t *testing.T) { - actual := deleteURL(endpointClient(), "foo") - expected := endpoint + "os-networksv2/foo" - th.AssertEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/servers/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/servers/delegate_test.go deleted file mode 100644 index 03e7acea84..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/servers/delegate_test.go +++ /dev/null @@ -1,182 +0,0 @@ -package servers - -import ( - "fmt" - "net/http" - "testing" - - os "github.com/rackspace/gophercloud/openstack/compute/v2/servers" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListServers(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/servers/detail", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", client.TokenID) - - w.Header().Add("Content-Type", "application/json") - fmt.Fprintf(w, ListOutput) - }) - - count := 0 - err := List(client.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractServers(page) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, ExpectedServerSlice, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestCreateServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleServerCreationSuccessfully(t, CreateOutput) - - actual, err := Create(client.ServiceClient(), os.CreateOpts{ - Name: "derp", - ImageRef: "f90f6034-2570-4974-8351-6b49732ef2eb", - FlavorRef: "1", - }).Extract() - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, &CreatedServer, actual) -} - -func TestDeleteServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleServerDeletionSuccessfully(t) - - res := Delete(client.ServiceClient(), "asdfasdfasdf") - th.AssertNoErr(t, res.Err) -} - -func TestGetServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", client.TokenID) - - w.Header().Add("Content-Type", "application/json") - fmt.Fprintf(w, GetOutput) - }) - - actual, err := Get(client.ServiceClient(), "8c65cb68-0681-4c30-bc88-6b83a8a26aee").Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &GophercloudServer, actual) -} - -func TestUpdateServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", client.TokenID) - th.TestJSONRequest(t, r, `{ "server": { "name": "test-server-updated" } }`) - - w.Header().Add("Content-Type", "application/json") - - fmt.Fprintf(w, UpdateOutput) - }) - - opts := os.UpdateOpts{ - Name: "test-server-updated", - } - actual, err := Update(client.ServiceClient(), "8c65cb68-0681-4c30-bc88-6b83a8a26aee", opts).Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &GophercloudUpdatedServer, actual) -} - -func TestChangeAdminPassword(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleAdminPasswordChangeSuccessfully(t) - - res := ChangeAdminPassword(client.ServiceClient(), "1234asdf", "new-password") - th.AssertNoErr(t, res.Err) -} - -func TestReboot(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleRebootSuccessfully(t) - - res := Reboot(client.ServiceClient(), "1234asdf", os.SoftReboot) - th.AssertNoErr(t, res.Err) -} - -func TestRebuildServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleRebuildSuccessfully(t, GetOutput) - - opts := os.RebuildOpts{ - Name: "new-name", - AdminPass: "swordfish", - ImageID: "http://104.130.131.164:8774/fcad67a6189847c4aecfa3c81a05783b/images/f90f6034-2570-4974-8351-6b49732ef2eb", - AccessIPv4: "1.2.3.4", - } - actual, err := Rebuild(client.ServiceClient(), "1234asdf", opts).Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &GophercloudServer, actual) -} - -func TestListAddresses(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleAddressListSuccessfully(t) - - expected := os.ListAddressesExpected - pages := 0 - err := ListAddresses(client.ServiceClient(), "asdfasdfasdf").EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractAddresses(page) - th.AssertNoErr(t, err) - - if len(actual) != 2 { - t.Fatalf("Expected 2 networks, got %d", len(actual)) - } - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, pages) -} - -func TestListAddressesByNetwork(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleNetworkAddressListSuccessfully(t) - - expected := os.ListNetworkAddressesExpected - pages := 0 - err := ListAddressesByNetwork(client.ServiceClient(), "asdfasdfasdf", "public").EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractNetworkAddresses(page) - th.AssertNoErr(t, err) - - if len(actual) != 2 { - t.Fatalf("Expected 2 addresses, got %d", len(actual)) - } - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, pages) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/servers/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/servers/requests_test.go deleted file mode 100644 index 828b5dc491..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/servers/requests_test.go +++ /dev/null @@ -1,59 +0,0 @@ -package servers - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/diskconfig" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestCreateOpts(t *testing.T) { - opts := CreateOpts{ - Name: "createdserver", - ImageRef: "image-id", - FlavorRef: "flavor-id", - KeyPair: "mykey", - DiskConfig: diskconfig.Manual, - } - - expected := ` - { - "server": { - "name": "createdserver", - "imageRef": "image-id", - "flavorRef": "flavor-id", - "flavorName": "", - "imageName": "", - "key_name": "mykey", - "OS-DCF:diskConfig": "MANUAL" - } - } - ` - actual, err := opts.ToServerCreateMap() - th.AssertNoErr(t, err) - th.CheckJSONEquals(t, expected, actual) -} - -func TestRebuildOpts(t *testing.T) { - opts := RebuildOpts{ - Name: "rebuiltserver", - AdminPass: "swordfish", - ImageID: "asdfasdfasdf", - DiskConfig: diskconfig.Auto, - } - - actual, err := opts.ToServerRebuildMap() - th.AssertNoErr(t, err) - - expected := ` - { - "rebuild": { - "name": "rebuiltserver", - "imageRef": "asdfasdfasdf", - "adminPass": "swordfish", - "OS-DCF:diskConfig": "AUTO" - } - } - ` - th.CheckJSONEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/virtualinterfaces/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/virtualinterfaces/requests_test.go deleted file mode 100644 index d40af9c462..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/virtualinterfaces/requests_test.go +++ /dev/null @@ -1,165 +0,0 @@ -package virtualinterfaces - -import ( - "fmt" - "net/http" - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/servers/12345/os-virtual-interfacesv2", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "virtual_interfaces": [ - { - "id": "de7c6d53-b895-4b4a-963c-517ccb0f0775", - "ip_addresses": [ - { - "address": "192.168.0.2", - "network_id": "f212726e-6321-4210-9bae-a13f5a33f83f", - "network_label": "superprivate_xml" - } - ], - "mac_address": "BC:76:4E:04:85:20" - }, - { - "id": "e14e789d-3b98-44a6-9c2d-c23eb1d1465c", - "ip_addresses": [ - { - "address": "10.181.1.30", - "network_id": "3b324a1b-31b8-4db5-9fe5-4a2067f60297", - "network_label": "private" - } - ], - "mac_address": "BC:76:4E:04:81:55" - } - ] -} - `) - }) - - client := fake.ServiceClient() - count := 0 - - err := List(client, "12345").EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractVirtualInterfaces(page) - if err != nil { - t.Errorf("Failed to extract networks: %v", err) - return false, err - } - - expected := []VirtualInterface{ - VirtualInterface{ - MACAddress: "BC:76:4E:04:85:20", - IPAddresses: []IPAddress{ - IPAddress{ - Address: "192.168.0.2", - NetworkID: "f212726e-6321-4210-9bae-a13f5a33f83f", - NetworkLabel: "superprivate_xml", - }, - }, - ID: "de7c6d53-b895-4b4a-963c-517ccb0f0775", - }, - VirtualInterface{ - MACAddress: "BC:76:4E:04:81:55", - IPAddresses: []IPAddress{ - IPAddress{ - Address: "10.181.1.30", - NetworkID: "3b324a1b-31b8-4db5-9fe5-4a2067f60297", - NetworkLabel: "private", - }, - }, - ID: "e14e789d-3b98-44a6-9c2d-c23eb1d1465c", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/servers/12345/os-virtual-interfacesv2", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "virtual_interface": { - "network_id": "6789" - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, `{ - "virtual_interfaces": [ - { - "id": "de7c6d53-b895-4b4a-963c-517ccb0f0775", - "ip_addresses": [ - { - "address": "192.168.0.2", - "network_id": "f212726e-6321-4210-9bae-a13f5a33f83f", - "network_label": "superprivate_xml" - } - ], - "mac_address": "BC:76:4E:04:85:20" - } - ] - }`) - }) - - expected := &VirtualInterface{ - MACAddress: "BC:76:4E:04:85:20", - IPAddresses: []IPAddress{ - IPAddress{ - Address: "192.168.0.2", - NetworkID: "f212726e-6321-4210-9bae-a13f5a33f83f", - NetworkLabel: "superprivate_xml", - }, - }, - ID: "de7c6d53-b895-4b4a-963c-517ccb0f0775", - } - - actual, err := Create(fake.ServiceClient(), "12345", "6789").Extract() - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, expected, actual) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/servers/12345/os-virtual-interfacesv2/6789", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "12345", "6789") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/virtualinterfaces/urls_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/virtualinterfaces/urls_test.go deleted file mode 100644 index 6732e4ed9f..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/virtualinterfaces/urls_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package virtualinterfaces - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909/" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestCreateURL(t *testing.T) { - actual := createURL(endpointClient(), "12345") - expected := endpoint + "servers/12345/os-virtual-interfacesv2" - th.AssertEquals(t, expected, actual) -} - -func TestListURL(t *testing.T) { - actual := createURL(endpointClient(), "12345") - expected := endpoint + "servers/12345/os-virtual-interfacesv2" - th.AssertEquals(t, expected, actual) -} - -func TestDeleteURL(t *testing.T) { - actual := deleteURL(endpointClient(), "12345", "6789") - expected := endpoint + "servers/12345/os-virtual-interfacesv2/6789" - th.AssertEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/volumeattach/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/volumeattach/delegate_test.go deleted file mode 100644 index f7ef45e621..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/compute/v2/volumeattach/delegate_test.go +++ /dev/null @@ -1,95 +0,0 @@ -package volumeattach - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/volumeattach" - fixtures "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/volumeattach/testing" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -// FirstVolumeAttachment is the first result in ListOutput. -var FirstVolumeAttachment = volumeattach.VolumeAttachment{ - Device: "/dev/vdd", - ID: "a26887c6-c47b-4654-abb5-dfadf7d3f803", - ServerID: "4d8c3732-a248-40ed-bebc-539a6ffd25c0", - VolumeID: "a26887c6-c47b-4654-abb5-dfadf7d3f803", -} - -// SecondVolumeAttachment is the first result in ListOutput. -var SecondVolumeAttachment = volumeattach.VolumeAttachment{ - Device: "/dev/vdc", - ID: "a26887c6-c47b-4654-abb5-dfadf7d3f804", - ServerID: "4d8c3732-a248-40ed-bebc-539a6ffd25c0", - VolumeID: "a26887c6-c47b-4654-abb5-dfadf7d3f804", -} - -// ExpectedVolumeAttachmentSlide is the slice of results that should be parsed -// from ListOutput, in the expected order. -var ExpectedVolumeAttachmentSlice = []volumeattach.VolumeAttachment{FirstVolumeAttachment, SecondVolumeAttachment} - -//CreatedVolumeAttachment is the parsed result from CreatedOutput. -var CreatedVolumeAttachment = volumeattach.VolumeAttachment{ - Device: "/dev/vdc", - ID: "a26887c6-c47b-4654-abb5-dfadf7d3f804", - ServerID: "4d8c3732-a248-40ed-bebc-539a6ffd25c0", - VolumeID: "a26887c6-c47b-4654-abb5-dfadf7d3f804", -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixtures.HandleListSuccessfully(t) - serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0" - - count := 0 - err := List(client.ServiceClient(), serverId).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := volumeattach.ExtractVolumeAttachments(page) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, ExpectedVolumeAttachmentSlice, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixtures.HandleCreateSuccessfully(t) - serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0" - - actual, err := Create(client.ServiceClient(), serverId, volumeattach.CreateOpts{ - Device: "/dev/vdc", - VolumeID: "a26887c6-c47b-4654-abb5-dfadf7d3f804", - }).Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &CreatedVolumeAttachment, actual) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixtures.HandleGetSuccessfully(t) - aId := "a26887c6-c47b-4654-abb5-dfadf7d3f804" - serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0" - - actual, err := Get(client.ServiceClient(), serverId, aId).Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, &SecondVolumeAttachment, actual) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixtures.HandleDeleteSuccessfully(t) - aId := "a26887c6-c47b-4654-abb5-dfadf7d3f804" - serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0" - - err := Delete(client.ServiceClient(), serverId, aId).ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/backups/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/backups/requests_test.go deleted file mode 100644 index d7067330f0..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/backups/requests_test.go +++ /dev/null @@ -1,131 +0,0 @@ -package backups - -import ( - "testing" - - "github.com/rackspace/gophercloud/openstack/db/v1/datastores" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" - "github.com/rackspace/gophercloud/testhelper/fixture" -) - -var ( - backupID = "{backupID}" - _rootURL = "/backups" - resURL = _rootURL + "/" + backupID -) - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, _rootURL, "POST", createReq, createResp, 202) - - opts := CreateOpts{ - Name: "snapshot", - Description: "My Backup", - InstanceID: "d4603f69-ec7e-4e9b-803f-600b9205576f", - } - - instance, err := Create(fake.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) - - expected := &Backup{ - Created: timeVal, - Description: "My Backup", - ID: "61f12fef-edb1-4561-8122-e7c00ef26a82", - InstanceID: "d4603f69-ec7e-4e9b-803f-600b9205576f", - LocationRef: "", - Name: "snapshot", - ParentID: "", - Size: 100, - Status: "NEW", - Updated: timeVal, - Datastore: datastores.DatastorePartial{ - Version: "5.1", - Type: "MySQL", - VersionID: "20000000-0000-0000-0000-000000000002", - }, - } - - th.AssertDeepEquals(t, expected, instance) -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, _rootURL, "GET", "", listResp, 200) - - pages := 0 - - err := List(fake.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) { - pages++ - actual, err := ExtractBackups(page) - th.AssertNoErr(t, err) - - expected := []Backup{ - Backup{ - Created: timeVal, - Description: "Backup from Restored Instance", - ID: "87972694-4be2-40f5-83f8-501656e0032a", - InstanceID: "29af2cd9-0674-48ab-b87a-b160f00208e6", - LocationRef: "http://localhost/path/to/backup", - Name: "restored_backup", - ParentID: "", - Size: 0.141026, - Status: "COMPLETED", - Updated: timeVal, - Datastore: datastores.DatastorePartial{ - Version: "5.1", - Type: "MySQL", - VersionID: "20000000-0000-0000-0000-000000000002", - }, - }, - } - - th.AssertDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL, "GET", "", getResp, 200) - - instance, err := Get(fake.ServiceClient(), backupID).Extract() - th.AssertNoErr(t, err) - - expected := &Backup{ - Created: timeVal, - Description: "My Backup", - ID: "61f12fef-edb1-4561-8122-e7c00ef26a82", - InstanceID: "d4603f69-ec7e-4e9b-803f-600b9205576f", - LocationRef: "", - Name: "snapshot", - ParentID: "", - Size: 100, - Status: "NEW", - Updated: timeVal, - Datastore: datastores.DatastorePartial{ - Version: "5.1", - Type: "MySQL", - VersionID: "20000000-0000-0000-0000-000000000002", - }, - } - - th.AssertDeepEquals(t, expected, instance) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL, "DELETE", "", "", 202) - - err := Delete(fake.ServiceClient(), backupID).ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/configurations/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/configurations/delegate_test.go deleted file mode 100644 index 580f02a54f..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/configurations/delegate_test.go +++ /dev/null @@ -1,237 +0,0 @@ -package configurations - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/db/v1/configurations" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/db/v1/instances" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" - "github.com/rackspace/gophercloud/testhelper/fixture" -) - -var ( - configID = "{configID}" - _baseURL = "/configurations" - resURL = _baseURL + "/" + configID - - dsID = "{datastoreID}" - versionID = "{versionID}" - paramID = "{paramID}" - dsParamListURL = "/datastores/" + dsID + "/versions/" + versionID + "/parameters" - dsParamGetURL = "/datastores/" + dsID + "/versions/" + versionID + "/parameters/" + paramID - globalParamListURL = "/datastores/versions/" + versionID + "/parameters" - globalParamGetURL = "/datastores/versions/" + versionID + "/parameters/" + paramID -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, _baseURL, "GET", "", listConfigsJSON, 200) - - count := 0 - err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := os.ExtractConfigs(page) - th.AssertNoErr(t, err) - - expected := []os.Config{exampleConfig} - th.AssertDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertEquals(t, 1, count) - th.AssertNoErr(t, err) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL, "GET", "", getConfigJSON, 200) - - config, err := Get(fake.ServiceClient(), configID).Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, &exampleConfig, config) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, _baseURL, "POST", createReq, createConfigJSON, 200) - - opts := os.CreateOpts{ - Datastore: &os.DatastoreOpts{ - Type: "a00000a0-00a0-0a00-00a0-000a000000aa", - Version: "b00000b0-00b0-0b00-00b0-000b000000bb", - }, - Description: "example description", - Name: "example-configuration-name", - Values: map[string]interface{}{ - "collation_server": "latin1_swedish_ci", - "connect_timeout": 120, - }, - } - - config, err := Create(fake.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, &exampleConfigWithValues, config) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL, "PATCH", updateReq, "", 200) - - opts := os.UpdateOpts{ - Values: map[string]interface{}{ - "connect_timeout": 300, - }, - } - - err := Update(fake.ServiceClient(), configID, opts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestReplace(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL, "PUT", updateReq, "", 202) - - opts := os.UpdateOpts{ - Values: map[string]interface{}{ - "connect_timeout": 300, - }, - } - - err := Replace(fake.ServiceClient(), configID, opts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL, "DELETE", "", "", 202) - - err := Delete(fake.ServiceClient(), configID).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestListInstances(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL+"/instances", "GET", "", listInstancesJSON, 200) - - expectedInstance := instances.Instance{ - ID: "d4603f69-ec7e-4e9b-803f-600b9205576f", - Name: "json_rack_instance", - } - - pages := 0 - err := ListInstances(fake.ServiceClient(), configID).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := instances.ExtractInstances(page) - if err != nil { - return false, err - } - - th.AssertDeepEquals(t, actual, []instances.Instance{expectedInstance}) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestListDSParams(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, dsParamListURL, "GET", "", listParamsJSON, 200) - - pages := 0 - err := ListDatastoreParams(fake.ServiceClient(), dsID, versionID).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := os.ExtractParams(page) - if err != nil { - return false, err - } - - expected := []os.Param{ - os.Param{Max: 1, Min: 0, Name: "innodb_file_per_table", RestartRequired: true, Type: "integer"}, - os.Param{Max: 4294967296, Min: 0, Name: "key_buffer_size", RestartRequired: false, Type: "integer"}, - os.Param{Max: 65535, Min: 2, Name: "connect_timeout", RestartRequired: false, Type: "integer"}, - os.Param{Max: 4294967296, Min: 0, Name: "join_buffer_size", RestartRequired: false, Type: "integer"}, - } - - th.AssertDeepEquals(t, actual, expected) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestGetDSParam(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, dsParamGetURL, "GET", "", getParamJSON, 200) - - param, err := GetDatastoreParam(fake.ServiceClient(), dsID, versionID, paramID).Extract() - th.AssertNoErr(t, err) - - expected := &os.Param{ - Max: 1, Min: 0, Name: "innodb_file_per_table", RestartRequired: true, Type: "integer", - } - - th.AssertDeepEquals(t, expected, param) -} - -func TestListGlobalParams(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, globalParamListURL, "GET", "", listParamsJSON, 200) - - pages := 0 - err := ListGlobalParams(fake.ServiceClient(), versionID).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := os.ExtractParams(page) - if err != nil { - return false, err - } - - expected := []os.Param{ - os.Param{Max: 1, Min: 0, Name: "innodb_file_per_table", RestartRequired: true, Type: "integer"}, - os.Param{Max: 4294967296, Min: 0, Name: "key_buffer_size", RestartRequired: false, Type: "integer"}, - os.Param{Max: 65535, Min: 2, Name: "connect_timeout", RestartRequired: false, Type: "integer"}, - os.Param{Max: 4294967296, Min: 0, Name: "join_buffer_size", RestartRequired: false, Type: "integer"}, - } - - th.AssertDeepEquals(t, actual, expected) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestGetGlobalParam(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, globalParamGetURL, "GET", "", getParamJSON, 200) - - param, err := GetGlobalParam(fake.ServiceClient(), versionID, paramID).Extract() - th.AssertNoErr(t, err) - - expected := &os.Param{ - Max: 1, Min: 0, Name: "innodb_file_per_table", RestartRequired: true, Type: "integer", - } - - th.AssertDeepEquals(t, expected, param) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/databases/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/databases/delegate_test.go deleted file mode 100644 index b9e50a53f1..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/databases/delegate_test.go +++ /dev/null @@ -1,71 +0,0 @@ -package databases - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/db/v1/databases" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -var ( - instanceID = "{instanceID}" - rootURL = "/instances" - resURL = rootURL + "/" + instanceID - uRootURL = resURL + "/root" - aURL = resURL + "/action" -) - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleCreate(t) - - opts := os.BatchCreateOpts{ - os.CreateOpts{Name: "testingdb", CharSet: "utf8", Collate: "utf8_general_ci"}, - os.CreateOpts{Name: "sampledb"}, - } - - res := Create(fake.ServiceClient(), instanceID, opts) - th.AssertNoErr(t, res.Err) -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleList(t) - - expectedDBs := []os.Database{ - os.Database{Name: "anotherexampledb"}, - os.Database{Name: "exampledb"}, - os.Database{Name: "nextround"}, - os.Database{Name: "sampledb"}, - os.Database{Name: "testingdb"}, - } - - pages := 0 - err := List(fake.ServiceClient(), instanceID).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := os.ExtractDBs(page) - if err != nil { - return false, err - } - - th.CheckDeepEquals(t, expectedDBs, actual) - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleDelete(t) - - err := os.Delete(fake.ServiceClient(), instanceID, "{dbName}").ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/datastores/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/datastores/delegate_test.go deleted file mode 100644 index 71111b9657..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/datastores/delegate_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package datastores - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/db/v1/datastores" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" - "github.com/rackspace/gophercloud/testhelper/fixture" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, "/datastores", "GET", "", os.ListDSResp, 200) - - pages := 0 - - err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := os.ExtractDatastores(page) - if err != nil { - return false, err - } - - th.CheckDeepEquals(t, []os.Datastore{os.ExampleDatastore}, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, "/datastores/{dsID}", "GET", "", os.GetDSResp, 200) - - ds, err := Get(fake.ServiceClient(), "{dsID}").Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, &os.ExampleDatastore, ds) -} - -func TestListVersions(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, "/datastores/{dsID}/versions", "GET", "", os.ListVersionsResp, 200) - - pages := 0 - - err := ListVersions(fake.ServiceClient(), "{dsID}").EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := os.ExtractVersions(page) - if err != nil { - return false, err - } - - th.CheckDeepEquals(t, os.ExampleVersions, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestGetVersion(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, "/datastores/{dsID}/versions/{versionID}", "GET", "", os.GetVersionResp, 200) - - ds, err := GetVersion(fake.ServiceClient(), "{dsID}", "{versionID}").Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, &os.ExampleVersion1, ds) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/flavors/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/flavors/delegate_test.go deleted file mode 100644 index f5f6442dd9..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/flavors/delegate_test.go +++ /dev/null @@ -1,95 +0,0 @@ -package flavors - -import ( - "testing" - - "github.com/rackspace/gophercloud" - os "github.com/rackspace/gophercloud/openstack/db/v1/flavors" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListFlavors(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleList(t) - - pages := 0 - err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := os.ExtractFlavors(page) - if err != nil { - return false, err - } - - expected := []os.Flavor{ - os.Flavor{ - ID: "1", - Name: "m1.tiny", - RAM: 512, - Links: []gophercloud.Link{ - gophercloud.Link{Href: "https://openstack.example.com/v1.0/1234/flavors/1", Rel: "self"}, - gophercloud.Link{Href: "https://openstack.example.com/flavors/1", Rel: "bookmark"}, - }, - }, - os.Flavor{ - ID: "2", - Name: "m1.small", - RAM: 1024, - Links: []gophercloud.Link{ - gophercloud.Link{Href: "https://openstack.example.com/v1.0/1234/flavors/2", Rel: "self"}, - gophercloud.Link{Href: "https://openstack.example.com/flavors/2", Rel: "bookmark"}, - }, - }, - os.Flavor{ - ID: "3", - Name: "m1.medium", - RAM: 2048, - Links: []gophercloud.Link{ - gophercloud.Link{Href: "https://openstack.example.com/v1.0/1234/flavors/3", Rel: "self"}, - gophercloud.Link{Href: "https://openstack.example.com/flavors/3", Rel: "bookmark"}, - }, - }, - os.Flavor{ - ID: "4", - Name: "m1.large", - RAM: 4096, - Links: []gophercloud.Link{ - gophercloud.Link{Href: "https://openstack.example.com/v1.0/1234/flavors/4", Rel: "self"}, - gophercloud.Link{Href: "https://openstack.example.com/flavors/4", Rel: "bookmark"}, - }, - }, - } - - th.AssertDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - if pages != 1 { - t.Errorf("Expected one page, got %d", pages) - } -} - -func TestGetFlavor(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleGet(t) - - actual, err := Get(fake.ServiceClient(), "{flavorID}").Extract() - th.AssertNoErr(t, err) - - expected := &os.Flavor{ - ID: "1", - Name: "m1.tiny", - RAM: 512, - Links: []gophercloud.Link{ - gophercloud.Link{Href: "https://openstack.example.com/v1.0/1234/flavors/1", Rel: "self"}, - }, - } - - th.AssertDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/instances/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/instances/delegate_test.go deleted file mode 100644 index 716e0a45bd..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/instances/delegate_test.go +++ /dev/null @@ -1,107 +0,0 @@ -package instances - -import ( - "testing" - - osDBs "github.com/rackspace/gophercloud/openstack/db/v1/databases" - os "github.com/rackspace/gophercloud/openstack/db/v1/instances" - osUsers "github.com/rackspace/gophercloud/openstack/db/v1/users" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" - "github.com/rackspace/gophercloud/testhelper/fixture" -) - -var ( - _rootURL = "/instances" - resURL = "/instances/" + instanceID -) - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, _rootURL, "POST", createReq, createResp, 200) - - opts := CreateOpts{ - Name: "json_rack_instance", - FlavorRef: "1", - Databases: osDBs.BatchCreateOpts{ - osDBs.CreateOpts{CharSet: "utf8", Collate: "utf8_general_ci", Name: "sampledb"}, - osDBs.CreateOpts{Name: "nextround"}, - }, - Users: osUsers.BatchCreateOpts{ - osUsers.CreateOpts{ - Name: "demouser", - Password: "demopassword", - Databases: osDBs.BatchCreateOpts{ - osDBs.CreateOpts{Name: "sampledb"}, - }, - }, - }, - Size: 2, - RestorePoint: "1234567890", - } - - instance, err := Create(fake.ServiceClient(), opts).Extract() - - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expectedInstance, instance) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL, "GET", "", getResp, 200) - - instance, err := Get(fake.ServiceClient(), instanceID).Extract() - - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expectedInstance, instance) -} - -func TestDeleteInstance(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleDelete(t) - - res := Delete(fake.ServiceClient(), instanceID) - th.AssertNoErr(t, res.Err) -} - -func TestEnableRootUser(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleEnableRoot(t) - - expected := &osUsers.User{Name: "root", Password: "secretsecret"} - - user, err := EnableRootUser(fake.ServiceClient(), instanceID).Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expected, user) -} - -func TestRestart(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleRestart(t) - - res := Restart(fake.ServiceClient(), instanceID) - th.AssertNoErr(t, res.Err) -} - -func TestResize(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleResize(t) - - res := Resize(fake.ServiceClient(), instanceID, "2") - th.AssertNoErr(t, res.Err) -} - -func TestResizeVolume(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleResizeVol(t) - - res := ResizeVolume(fake.ServiceClient(), instanceID, 4) - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/instances/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/instances/requests_test.go deleted file mode 100644 index 7fa460117f..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/instances/requests_test.go +++ /dev/null @@ -1,246 +0,0 @@ -package instances - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/openstack/db/v1/datastores" - "github.com/rackspace/gophercloud/openstack/db/v1/flavors" - os "github.com/rackspace/gophercloud/openstack/db/v1/instances" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/db/v1/backups" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" - "github.com/rackspace/gophercloud/testhelper/fixture" -) - -func TestInstanceList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - fixture.SetupHandler(t, "/instances", "GET", "", listInstancesResp, 200) - - opts := &ListOpts{ - IncludeHA: false, - IncludeReplicas: false, - } - - pages := 0 - err := List(fake.ServiceClient(), opts).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractInstances(page) - if err != nil { - return false, err - } - - th.CheckDeepEquals(t, []Instance{*expectedInstance}, actual) - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestGetConfig(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL+"/configuration", "GET", "", getConfigResp, 200) - - config, err := GetDefaultConfig(fake.ServiceClient(), instanceID).Extract() - - expected := map[string]string{ - "basedir": "/usr", - "connect_timeout": "15", - "datadir": "/var/lib/mysql", - "default_storage_engine": "innodb", - "innodb_buffer_pool_instances": "1", - "innodb_buffer_pool_size": "175M", - "innodb_checksum_algorithm": "crc32", - "innodb_data_file_path": "ibdata1:10M:autoextend", - "innodb_file_per_table": "1", - "innodb_io_capacity": "200", - "innodb_log_file_size": "256M", - "innodb_log_files_in_group": "2", - "innodb_open_files": "8192", - "innodb_thread_concurrency": "0", - "join_buffer_size": "1M", - "key_buffer_size": "50M", - "local-infile": "0", - "log-error": "/var/log/mysql/mysqld.log", - "max_allowed_packet": "16M", - "max_connect_errors": "10000", - "max_connections": "40", - "max_heap_table_size": "16M", - "myisam-recover": "BACKUP", - "open_files_limit": "8192", - "performance_schema": "off", - "pid_file": "/var/run/mysqld/mysqld.pid", - "port": "3306", - "query_cache_limit": "1M", - "query_cache_size": "8M", - "query_cache_type": "1", - "read_buffer_size": "256K", - "read_rnd_buffer_size": "1M", - "server_id": "1", - "skip-external-locking": "1", - "skip_name_resolve": "1", - "sort_buffer_size": "256K", - "table_open_cache": "4096", - "thread_stack": "192K", - "tmp_table_size": "16M", - "tmpdir": "/var/tmp", - "user": "mysql", - "wait_timeout": "3600", - } - - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expected, config) -} - -func TestAssociateWithConfigGroup(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL, "PUT", associateReq, associateResp, 202) - - res := AssociateWithConfigGroup(fake.ServiceClient(), instanceID, "{configGroupID}") - th.AssertNoErr(t, res.Err) -} - -func TestListBackups(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL+"/backups", "GET", "", listBackupsResp, 200) - - pages := 0 - - err := ListBackups(fake.ServiceClient(), instanceID).EachPage(func(page pagination.Page) (bool, error) { - pages++ - actual, err := backups.ExtractBackups(page) - th.AssertNoErr(t, err) - - expected := []backups.Backup{ - backups.Backup{ - Created: timeVal, - Description: "Backup from Restored Instance", - ID: "87972694-4be2-40f5-83f8-501656e0032a", - InstanceID: "29af2cd9-0674-48ab-b87a-b160f00208e6", - LocationRef: "http://localhost/path/to/backup", - Name: "restored_backup", - ParentID: "", - Size: 0.141026, - Status: "COMPLETED", - Updated: timeVal, - Datastore: datastores.DatastorePartial{Version: "5.1", Type: "MySQL", VersionID: "20000000-0000-0000-0000-000000000002"}, - }, - } - - th.AssertDeepEquals(t, expected, actual) - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestCreateReplica(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, _rootURL, "POST", createReplicaReq, createReplicaResp, 200) - - opts := CreateOpts{ - Name: "t2s1_ALT_GUEST", - FlavorRef: "9", - Size: 1, - ReplicaOf: "6bdca2fc-418e-40bd-a595-62abda61862d", - } - - replica, err := Create(fake.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expectedReplica, replica) -} - -func TestListReplicas(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, _rootURL, "GET", "", listReplicasResp, 200) - - pages := 0 - err := List(fake.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractInstances(page) - if err != nil { - return false, err - } - - expected := []Instance{ - Instance{ - Status: "ACTIVE", - Name: "t1s1_ALT_GUEST", - Links: []gophercloud.Link{ - gophercloud.Link{Rel: "self", Href: "https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/3c691f06-bf9a-4618-b7ec-2817ce0cf254"}, - gophercloud.Link{Rel: "bookmark", Href: "https://ord.databases.api.rackspacecloud.com/instances/3c691f06-bf9a-4618-b7ec-2817ce0cf254"}, - }, - ID: "3c691f06-bf9a-4618-b7ec-2817ce0cf254", - IP: []string{"10.0.0.3"}, - Volume: os.Volume{Size: 1}, - Flavor: flavors.Flavor{ID: "9"}, - Datastore: datastores.DatastorePartial{Version: "5.6", Type: "mysql"}, - ReplicaOf: &Instance{ - ID: "8b499b45-52d6-402d-b398-f9d8f279c69a", - }, - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestGetReplica(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL, "GET", "", getReplicaResp, 200) - - replica, err := Get(fake.ServiceClient(), instanceID).Extract() - th.AssertNoErr(t, err) - - expectedReplica := &Instance{ - Status: "ACTIVE", - Updated: timeVal, - Name: "t1_ALT_GUEST", - Created: timeVal, - IP: []string{ - "10.0.0.2", - }, - Replicas: []Instance{ - Instance{ID: "3c691f06-bf9a-4618-b7ec-2817ce0cf254"}, - }, - ID: "8b499b45-52d6-402d-b398-f9d8f279c69a", - Volume: os.Volume{ - Used: 0.54, - Size: 1, - }, - Flavor: flavors.Flavor{ID: "9"}, - Datastore: datastores.DatastorePartial{ - Version: "5.6", - Type: "mysql", - }, - } - - th.AssertDeepEquals(t, replica, expectedReplica) -} - -func TestDetachReplica(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, resURL, "PATCH", detachReq, "", 202) - - err := DetachReplica(fake.ServiceClient(), instanceID).ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/users/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/users/delegate_test.go deleted file mode 100644 index 7a1b773cda..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/users/delegate_test.go +++ /dev/null @@ -1,48 +0,0 @@ -package users - -import ( - "testing" - - db "github.com/rackspace/gophercloud/openstack/db/v1/databases" - os "github.com/rackspace/gophercloud/openstack/db/v1/users" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -const instanceID = "{instanceID}" - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleCreate(t) - - opts := os.BatchCreateOpts{ - os.CreateOpts{ - Databases: db.BatchCreateOpts{ - db.CreateOpts{Name: "databaseA"}, - }, - Name: "dbuser3", - Password: "secretsecret", - }, - os.CreateOpts{ - Databases: db.BatchCreateOpts{ - db.CreateOpts{Name: "databaseB"}, - db.CreateOpts{Name: "databaseC"}, - }, - Name: "dbuser4", - Password: "secretsecret", - }, - } - - res := Create(fake.ServiceClient(), instanceID, opts) - th.AssertNoErr(t, res.Err) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleDelete(t) - - res := Delete(fake.ServiceClient(), instanceID, "{userName}") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/users/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/users/requests_test.go deleted file mode 100644 index 2f2dca700e..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/db/v1/users/requests_test.go +++ /dev/null @@ -1,156 +0,0 @@ -package users - -import ( - "testing" - - db "github.com/rackspace/gophercloud/openstack/db/v1/databases" - os "github.com/rackspace/gophercloud/openstack/db/v1/users" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" - "github.com/rackspace/gophercloud/testhelper/fixture" -) - -var ( - userName = "{userName}" - _rootURL = "/instances/" + instanceID + "/users" - _userURL = _rootURL + "/" + userName - _dbURL = _userURL + "/databases" -) - -func TestChangeUserPassword(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, _rootURL, "PUT", changePwdReq, "", 202) - - opts := os.BatchCreateOpts{ - os.CreateOpts{Name: "dbuser1", Password: "newpassword"}, - os.CreateOpts{Name: "dbuser2", Password: "anotherpassword"}, - } - - err := ChangePassword(fake.ServiceClient(), instanceID, opts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestUpdateUser(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, _userURL, "PUT", updateReq, "", 202) - - opts := UpdateOpts{ - Name: "new_username", - Password: "new_password", - } - - err := Update(fake.ServiceClient(), instanceID, userName, opts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestGetUser(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, _userURL, "GET", "", getResp, 200) - - user, err := Get(fake.ServiceClient(), instanceID, userName).Extract() - - th.AssertNoErr(t, err) - - expected := &User{ - Name: "exampleuser", - Host: "foo", - Databases: []db.Database{ - db.Database{Name: "databaseA"}, - db.Database{Name: "databaseB"}, - }, - } - - th.AssertDeepEquals(t, expected, user) -} - -func TestUserAccessList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, _userURL+"/databases", "GET", "", listUserAccessResp, 200) - - expectedDBs := []db.Database{ - db.Database{Name: "databaseE"}, - } - - pages := 0 - err := ListAccess(fake.ServiceClient(), instanceID, userName).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractDBs(page) - if err != nil { - return false, err - } - - th.CheckDeepEquals(t, expectedDBs, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestUserList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - fixture.SetupHandler(t, "/instances/"+instanceID+"/users", "GET", "", listResp, 200) - - expectedUsers := []User{ - User{ - Databases: []db.Database{ - db.Database{Name: "databaseA"}, - }, - Name: "dbuser1", - Host: "localhost", - }, - User{ - Databases: []db.Database{ - db.Database{Name: "databaseB"}, - db.Database{Name: "databaseC"}, - }, - Name: "dbuser2", - Host: "localhost", - }, - } - - pages := 0 - err := List(fake.ServiceClient(), instanceID).EachPage(func(page pagination.Page) (bool, error) { - pages++ - - actual, err := ExtractUsers(page) - if err != nil { - return false, err - } - - th.CheckDeepEquals(t, expectedUsers, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, pages) -} - -func TestGrantAccess(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, _dbURL, "PUT", grantUserAccessReq, "", 202) - - opts := db.BatchCreateOpts{db.CreateOpts{Name: "databaseE"}} - err := GrantAccess(fake.ServiceClient(), instanceID, userName, opts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestRevokeAccess(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - fixture.SetupHandler(t, _dbURL+"/{dbName}", "DELETE", "", "", 202) - - err := RevokeAccess(fake.ServiceClient(), instanceID, userName, "{dbName}").ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/extensions/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/extensions/delegate_test.go deleted file mode 100644 index e30f79404d..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/extensions/delegate_test.go +++ /dev/null @@ -1,39 +0,0 @@ -package extensions - -import ( - "testing" - - common "github.com/rackspace/gophercloud/openstack/common/extensions" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - common.HandleListExtensionsSuccessfully(t) - - count := 0 - - err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractExtensions(page) - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, common.ExpectedExtensions, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - common.HandleGetExtensionSuccessfully(t) - - actual, err := Get(fake.ServiceClient(), "agent").Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, common.SingleExtension, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/roles/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/roles/delegate_test.go deleted file mode 100644 index fcee97d0bc..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/roles/delegate_test.go +++ /dev/null @@ -1,66 +0,0 @@ -package roles - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/identity/v2/extensions/admin/roles" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestRole(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - MockListRoleResponse(t) - - count := 0 - - err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := os.ExtractRoles(page) - if err != nil { - t.Errorf("Failed to extract users: %v", err) - return false, err - } - - expected := []os.Role{ - os.Role{ - ID: "123", - Name: "compute:admin", - Description: "Nova Administrator", - ServiceID: "cke5372ebabeeabb70a0e702a4626977x4406e5", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, count) -} - -func TestAddUserRole(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - MockAddUserRoleResponse(t) - - err := AddUserRole(client.ServiceClient(), "{user_id}", "{role_id}").ExtractErr() - - th.AssertNoErr(t, err) -} - -func TestDeleteUserRole(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - MockDeleteUserRoleResponse(t) - - err := DeleteUserRole(client.ServiceClient(), "{user_id}", "{role_id}").ExtractErr() - - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/tenants/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/tenants/delegate_test.go deleted file mode 100644 index eccbfe23eb..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/tenants/delegate_test.go +++ /dev/null @@ -1,28 +0,0 @@ -package tenants - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/identity/v2/tenants" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListTenants(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleListTenantsSuccessfully(t) - - count := 0 - err := List(fake.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) { - actual, err := ExtractTenants(page) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, os.ExpectedTenantSlice, actual) - - count++ - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/tokens/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/tokens/delegate_test.go deleted file mode 100644 index 6678ff4a7c..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/tokens/delegate_test.go +++ /dev/null @@ -1,36 +0,0 @@ -package tokens - -import ( - "testing" - - "github.com/rackspace/gophercloud" - os "github.com/rackspace/gophercloud/openstack/identity/v2/tokens" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func tokenPost(t *testing.T, options gophercloud.AuthOptions, requestJSON string) os.CreateResult { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleTokenPost(t, requestJSON) - - return Create(client.ServiceClient(), WrapOptions(options)) -} - -func TestCreateTokenWithAPIKey(t *testing.T) { - options := gophercloud.AuthOptions{ - Username: "me", - APIKey: "1234567890abcdef", - } - - os.IsSuccessful(t, tokenPost(t, options, ` - { - "auth": { - "RAX-KSKEY:apiKeyCredentials": { - "username": "me", - "apiKey": "1234567890abcdef" - } - } - } - `)) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/users/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/users/delegate_test.go deleted file mode 100644 index 62faf0c5be..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/identity/v2/users/delegate_test.go +++ /dev/null @@ -1,111 +0,0 @@ -package users - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/identity/v2/users" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockListResponse(t) - - count := 0 - - err := List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - users, err := os.ExtractUsers(page) - - th.AssertNoErr(t, err) - th.AssertEquals(t, "u1000", users[0].ID) - th.AssertEquals(t, "u1001", users[1].ID) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, count) -} - -func TestCreateUser(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockCreateUser(t) - - opts := CreateOpts{ - Username: "new_user", - Enabled: os.Disabled, - Email: "new_user@foo.com", - Password: "foo", - } - - user, err := Create(client.ServiceClient(), opts).Extract() - - th.AssertNoErr(t, err) - - th.AssertEquals(t, "123456", user.ID) - th.AssertEquals(t, "5830280", user.DomainID) - th.AssertEquals(t, "DFW", user.DefaultRegion) -} - -func TestGetUser(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockGetUser(t) - - user, err := Get(client.ServiceClient(), "new_user").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, true, user.Enabled) - th.AssertEquals(t, true, user.MultiFactorEnabled) -} - -func TestUpdateUser(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockUpdateUser(t) - - id := "c39e3de9be2d4c779f1dfd6abacc176d" - - opts := UpdateOpts{ - Enabled: os.Enabled, - Email: "new_email@foo.com", - } - - user, err := Update(client.ServiceClient(), id, opts).Extract() - - th.AssertNoErr(t, err) - - th.AssertEquals(t, true, user.Enabled) - th.AssertEquals(t, "new_email@foo.com", user.Email) -} - -func TestDeleteServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDeleteUser(t) - - res := Delete(client.ServiceClient(), "c39e3de9be2d4c779f1dfd6abacc176d") - th.AssertNoErr(t, res.Err) -} - -func TestResetAPIKey(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockResetAPIKey(t) - - apiKey, err := ResetAPIKey(client.ServiceClient(), "99").Extract() - th.AssertNoErr(t, err) - th.AssertEquals(t, "joesmith", apiKey.Username) - th.AssertEquals(t, "mooH1eiLahd5ahYood7r", apiKey.APIKey) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/acl/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/acl/requests_test.go deleted file mode 100644 index c4961a3dd8..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/acl/requests_test.go +++ /dev/null @@ -1,91 +0,0 @@ -package acl - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -const ( - lbID = 12345 - itemID1 = 67890 - itemID2 = 67891 -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockListResponse(t, lbID) - - count := 0 - - err := List(client.ServiceClient(), lbID).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractAccessList(page) - th.AssertNoErr(t, err) - - expected := AccessList{ - NetworkItem{Address: "206.160.163.21", ID: 21, Type: DENY}, - NetworkItem{Address: "206.160.163.22", ID: 22, Type: DENY}, - NetworkItem{Address: "206.160.163.23", ID: 23, Type: DENY}, - NetworkItem{Address: "206.160.163.24", ID: 24, Type: DENY}, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, count) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockCreateResponse(t, lbID) - - opts := CreateOpts{ - CreateOpt{Address: "206.160.163.21", Type: DENY}, - CreateOpt{Address: "206.160.165.11", Type: DENY}, - } - - err := Create(client.ServiceClient(), lbID, opts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestBulkDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - ids := []int{itemID1, itemID2} - - mockBatchDeleteResponse(t, lbID, ids) - - err := BulkDelete(client.ServiceClient(), lbID, ids).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDeleteResponse(t, lbID, itemID1) - - err := Delete(client.ServiceClient(), lbID, itemID1).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestDeleteAll(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDeleteAllResponse(t, lbID) - - err := DeleteAll(client.ServiceClient(), lbID).ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/lbs/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/lbs/requests_test.go deleted file mode 100644 index a8ec19e07c..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/lbs/requests_test.go +++ /dev/null @@ -1,438 +0,0 @@ -package lbs - -import ( - "testing" - "time" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/pagination" - "github.com/rackspace/gophercloud/rackspace/lb/v1/nodes" - "github.com/rackspace/gophercloud/rackspace/lb/v1/sessions" - "github.com/rackspace/gophercloud/rackspace/lb/v1/throttle" - "github.com/rackspace/gophercloud/rackspace/lb/v1/vips" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -const ( - id1 = 12345 - id2 = 67890 - ts1 = "2010-11-30T03:23:42Z" - ts2 = "2010-11-30T03:23:44Z" -) - -func toTime(t *testing.T, str string) time.Time { - ts, err := time.Parse(time.RFC3339, str) - if err != nil { - t.Fatalf("Could not parse time: %s", err.Error()) - } - return ts -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockListLBResponse(t) - - count := 0 - - err := List(client.ServiceClient(), ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractLBs(page) - th.AssertNoErr(t, err) - - expected := []LoadBalancer{ - LoadBalancer{ - Name: "lb-site1", - ID: 71, - Protocol: "HTTP", - Port: 80, - Algorithm: "RANDOM", - Status: ACTIVE, - NodeCount: 3, - VIPs: []vips.VIP{ - vips.VIP{ - ID: 403, - Address: "206.55.130.1", - Type: "PUBLIC", - Version: "IPV4", - }, - }, - Created: Datetime{Time: toTime(t, ts1)}, - Updated: Datetime{Time: toTime(t, ts2)}, - }, - LoadBalancer{ - ID: 72, - Name: "lb-site2", - Created: Datetime{Time: toTime(t, "2011-11-30T03:23:42Z")}, - Updated: Datetime{Time: toTime(t, "2011-11-30T03:23:44Z")}, - }, - LoadBalancer{ - ID: 73, - Name: "lb-site3", - Created: Datetime{Time: toTime(t, "2012-11-30T03:23:42Z")}, - Updated: Datetime{Time: toTime(t, "2012-11-30T03:23:44Z")}, - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, count) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockCreateLBResponse(t) - - opts := CreateOpts{ - Name: "a-new-loadbalancer", - Port: 80, - Protocol: "HTTP", - VIPs: []vips.VIP{ - vips.VIP{ID: 2341}, - vips.VIP{ID: 900001}, - }, - Nodes: []nodes.Node{ - nodes.Node{Address: "10.1.1.1", Port: 80, Condition: "ENABLED"}, - }, - } - - lb, err := Create(client.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) - - expected := &LoadBalancer{ - Name: "a-new-loadbalancer", - ID: 144, - Protocol: "HTTP", - HalfClosed: false, - Port: 83, - Algorithm: "RANDOM", - Status: BUILD, - Timeout: 30, - Cluster: Cluster{Name: "ztm-n01.staging1.lbaas.rackspace.net"}, - Nodes: []nodes.Node{ - nodes.Node{ - Address: "10.1.1.1", - ID: 653, - Port: 80, - Status: "ONLINE", - Condition: "ENABLED", - Weight: 1, - }, - }, - VIPs: []vips.VIP{ - vips.VIP{ - ID: 39, - Address: "206.10.10.210", - Type: vips.PUBLIC, - Version: vips.IPV4, - }, - vips.VIP{ - ID: 900001, - Address: "2001:4801:79f1:0002:711b:be4c:0000:0021", - Type: vips.PUBLIC, - Version: vips.IPV6, - }, - }, - Created: Datetime{Time: toTime(t, ts1)}, - Updated: Datetime{Time: toTime(t, ts2)}, - ConnectionLogging: ConnectionLogging{Enabled: false}, - } - - th.AssertDeepEquals(t, expected, lb) -} - -func TestBulkDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - ids := []int{id1, id2} - - mockBatchDeleteLBResponse(t, ids) - - err := BulkDelete(client.ServiceClient(), ids).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDeleteLBResponse(t, id1) - - err := Delete(client.ServiceClient(), id1).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockGetLBResponse(t, id1) - - lb, err := Get(client.ServiceClient(), id1).Extract() - - expected := &LoadBalancer{ - Name: "sample-loadbalancer", - ID: 2000, - Protocol: "HTTP", - Port: 80, - Algorithm: "RANDOM", - Status: ACTIVE, - Timeout: 30, - ConnectionLogging: ConnectionLogging{Enabled: true}, - VIPs: []vips.VIP{ - vips.VIP{ - ID: 1000, - Address: "206.10.10.210", - Type: "PUBLIC", - Version: "IPV4", - }, - }, - Nodes: []nodes.Node{ - nodes.Node{ - Address: "10.1.1.1", - ID: 1041, - Port: 80, - Status: "ONLINE", - Condition: "ENABLED", - }, - nodes.Node{ - Address: "10.1.1.2", - ID: 1411, - Port: 80, - Status: "ONLINE", - Condition: "ENABLED", - }, - }, - SessionPersistence: sessions.SessionPersistence{Type: "HTTP_COOKIE"}, - ConnectionThrottle: throttle.ConnectionThrottle{MaxConnections: 100}, - Cluster: Cluster{Name: "c1.dfw1"}, - Created: Datetime{Time: toTime(t, ts1)}, - Updated: Datetime{Time: toTime(t, ts2)}, - SourceAddrs: SourceAddrs{ - IPv4Public: "10.12.99.28", - IPv4Private: "10.0.0.0", - IPv6Public: "2001:4801:79f1:1::1/64", - }, - } - - th.AssertDeepEquals(t, expected, lb) - th.AssertNoErr(t, err) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockUpdateLBResponse(t, id1) - - opts := UpdateOpts{ - Name: "a-new-loadbalancer", - Protocol: "TCP", - HalfClosed: gophercloud.Enabled, - Algorithm: "RANDOM", - Port: 8080, - Timeout: 100, - HTTPSRedirect: gophercloud.Disabled, - } - - err := Update(client.ServiceClient(), id1, opts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestListProtocols(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockListProtocolsResponse(t) - - count := 0 - - err := ListProtocols(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractProtocols(page) - th.AssertNoErr(t, err) - - expected := []Protocol{ - Protocol{Name: "DNS_TCP", Port: 53}, - Protocol{Name: "DNS_UDP", Port: 53}, - Protocol{Name: "FTP", Port: 21}, - Protocol{Name: "HTTP", Port: 80}, - Protocol{Name: "HTTPS", Port: 443}, - Protocol{Name: "IMAPS", Port: 993}, - Protocol{Name: "IMAPv4", Port: 143}, - } - - th.CheckDeepEquals(t, expected[0:7], actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, count) -} - -func TestListAlgorithms(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockListAlgorithmsResponse(t) - - count := 0 - - err := ListAlgorithms(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractAlgorithms(page) - th.AssertNoErr(t, err) - - expected := []Algorithm{ - Algorithm{Name: "LEAST_CONNECTIONS"}, - Algorithm{Name: "RANDOM"}, - Algorithm{Name: "ROUND_ROBIN"}, - Algorithm{Name: "WEIGHTED_LEAST_CONNECTIONS"}, - Algorithm{Name: "WEIGHTED_ROUND_ROBIN"}, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, count) -} - -func TestIsLoggingEnabled(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockGetLoggingResponse(t, id1) - - res, err := IsLoggingEnabled(client.ServiceClient(), id1) - th.AssertNoErr(t, err) - th.AssertEquals(t, true, res) -} - -func TestEnablingLogging(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockEnableLoggingResponse(t, id1) - - err := EnableLogging(client.ServiceClient(), id1).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestDisablingLogging(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDisableLoggingResponse(t, id1) - - err := DisableLogging(client.ServiceClient(), id1).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestGetErrorPage(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockGetErrorPageResponse(t, id1) - - content, err := GetErrorPage(client.ServiceClient(), id1).Extract() - th.AssertNoErr(t, err) - - expected := &ErrorPage{Content: "DEFAULT ERROR PAGE"} - th.AssertDeepEquals(t, expected, content) -} - -func TestSetErrorPage(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockSetErrorPageResponse(t, id1) - - html := "New error page" - content, err := SetErrorPage(client.ServiceClient(), id1, html).Extract() - th.AssertNoErr(t, err) - - expected := &ErrorPage{Content: html} - th.AssertDeepEquals(t, expected, content) -} - -func TestDeleteErrorPage(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDeleteErrorPageResponse(t, id1) - - err := DeleteErrorPage(client.ServiceClient(), id1).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestGetStats(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockGetStatsResponse(t, id1) - - content, err := GetStats(client.ServiceClient(), id1).Extract() - th.AssertNoErr(t, err) - - expected := &Stats{ - ConnectTimeout: 10, - ConnectError: 20, - ConnectFailure: 30, - DataTimedOut: 40, - KeepAliveTimedOut: 50, - MaxConnections: 60, - CurrentConnections: 40, - SSLConnectTimeout: 10, - SSLConnectError: 20, - SSLConnectFailure: 30, - SSLDataTimedOut: 40, - SSLKeepAliveTimedOut: 50, - SSLMaxConnections: 60, - SSLCurrentConnections: 40, - } - th.AssertDeepEquals(t, expected, content) -} - -func TestIsCached(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockGetCachingResponse(t, id1) - - res, err := IsContentCached(client.ServiceClient(), id1) - th.AssertNoErr(t, err) - th.AssertEquals(t, true, res) -} - -func TestEnablingCaching(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockEnableCachingResponse(t, id1) - - err := EnableCaching(client.ServiceClient(), id1).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestDisablingCaching(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDisableCachingResponse(t, id1) - - err := DisableCaching(client.ServiceClient(), id1).ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/monitors/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/monitors/requests_test.go deleted file mode 100644 index 76a60db7f4..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/monitors/requests_test.go +++ /dev/null @@ -1,75 +0,0 @@ -package monitors - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -const lbID = 12345 - -func TestUpdateCONNECT(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockUpdateConnectResponse(t, lbID) - - opts := UpdateConnectMonitorOpts{ - AttemptLimit: 3, - Delay: 10, - Timeout: 10, - } - - err := Update(client.ServiceClient(), lbID, opts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestUpdateHTTP(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockUpdateHTTPResponse(t, lbID) - - opts := UpdateHTTPMonitorOpts{ - AttemptLimit: 3, - Delay: 10, - Timeout: 10, - BodyRegex: "{regex}", - Path: "/foo", - StatusRegex: "200", - Type: HTTPS, - } - - err := Update(client.ServiceClient(), lbID, opts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockGetResponse(t, lbID) - - m, err := Get(client.ServiceClient(), lbID).Extract() - th.AssertNoErr(t, err) - - expected := &Monitor{ - Type: CONNECT, - Delay: 10, - Timeout: 10, - AttemptLimit: 3, - } - - th.AssertDeepEquals(t, expected, m) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDeleteResponse(t, lbID) - - err := Delete(client.ServiceClient(), lbID).ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/nodes/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/nodes/requests_test.go deleted file mode 100644 index a964af8f90..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/nodes/requests_test.go +++ /dev/null @@ -1,243 +0,0 @@ -package nodes - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -const ( - lbID = 12345 - nodeID = 67890 - nodeID2 = 67891 -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockListResponse(t, lbID) - - count := 0 - - err := List(client.ServiceClient(), lbID, nil).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractNodes(page) - th.AssertNoErr(t, err) - - expected := []Node{ - Node{ - ID: 410, - Address: "10.1.1.1", - Port: 80, - Condition: ENABLED, - Status: ONLINE, - Weight: 3, - Type: PRIMARY, - }, - Node{ - ID: 411, - Address: "10.1.1.2", - Port: 80, - Condition: ENABLED, - Status: ONLINE, - Weight: 8, - Type: SECONDARY, - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, count) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockCreateResponse(t, lbID) - - opts := CreateOpts{ - CreateOpt{ - Address: "10.2.2.3", - Port: 80, - Condition: ENABLED, - Type: PRIMARY, - }, - CreateOpt{ - Address: "10.2.2.4", - Port: 81, - Condition: ENABLED, - Type: SECONDARY, - }, - } - - page := Create(client.ServiceClient(), lbID, opts) - - actual, err := page.ExtractNodes() - th.AssertNoErr(t, err) - - expected := []Node{ - Node{ - ID: 185, - Address: "10.2.2.3", - Port: 80, - Condition: ENABLED, - Status: ONLINE, - Weight: 1, - Type: PRIMARY, - }, - Node{ - ID: 186, - Address: "10.2.2.4", - Port: 81, - Condition: ENABLED, - Status: ONLINE, - Weight: 1, - Type: SECONDARY, - }, - } - - th.CheckDeepEquals(t, expected, actual) -} - -func TestCreateErr(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockCreateErrResponse(t, lbID) - - opts := CreateOpts{ - CreateOpt{ - Address: "10.2.2.3", - Port: 80, - Condition: ENABLED, - Type: PRIMARY, - }, - CreateOpt{ - Address: "10.2.2.4", - Port: 81, - Condition: ENABLED, - Type: SECONDARY, - }, - } - - page := Create(client.ServiceClient(), lbID, opts) - - actual, err := page.ExtractNodes() - if err == nil { - t.Fatal("Did not receive expected error from ExtractNodes") - } - if actual != nil { - t.Fatalf("Received non-nil result from failed ExtractNodes: %#v", actual) - } -} - -func TestBulkDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - ids := []int{nodeID, nodeID2} - - mockBatchDeleteResponse(t, lbID, ids) - - err := BulkDelete(client.ServiceClient(), lbID, ids).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockGetResponse(t, lbID, nodeID) - - node, err := Get(client.ServiceClient(), lbID, nodeID).Extract() - th.AssertNoErr(t, err) - - expected := &Node{ - ID: 410, - Address: "10.1.1.1", - Port: 80, - Condition: ENABLED, - Status: ONLINE, - Weight: 12, - Type: PRIMARY, - } - - th.AssertDeepEquals(t, expected, node) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockUpdateResponse(t, lbID, nodeID) - - opts := UpdateOpts{ - Weight: gophercloud.IntToPointer(10), - Condition: DRAINING, - Type: SECONDARY, - } - - err := Update(client.ServiceClient(), lbID, nodeID, opts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDeleteResponse(t, lbID, nodeID) - - err := Delete(client.ServiceClient(), lbID, nodeID).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestListEvents(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockListEventsResponse(t, lbID) - - count := 0 - - pager := ListEvents(client.ServiceClient(), lbID, ListEventsOpts{}) - - err := pager.EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractNodeEvents(page) - th.AssertNoErr(t, err) - - expected := []NodeEvent{ - NodeEvent{ - DetailedMessage: "Node is ok", - NodeID: 373, - ID: 7, - Type: "UPDATE_NODE", - Description: "Node '373' status changed to 'ONLINE' for load balancer '323'", - Category: "UPDATE", - Severity: "INFO", - RelativeURI: "/406271/loadbalancers/323/nodes/373/events", - AccountID: 406271, - LoadBalancerID: 323, - Title: "Node Status Updated", - Author: "Rackspace Cloud", - Created: "10-30-2012 10:18:23", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, count) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/sessions/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/sessions/requests_test.go deleted file mode 100644 index f319e540bb..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/sessions/requests_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package sessions - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -const lbID = 12345 - -func TestEnable(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockEnableResponse(t, lbID) - - opts := CreateOpts{Type: HTTPCOOKIE} - err := Enable(client.ServiceClient(), lbID, opts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockGetResponse(t, lbID) - - sp, err := Get(client.ServiceClient(), lbID).Extract() - th.AssertNoErr(t, err) - - expected := &SessionPersistence{Type: HTTPCOOKIE} - th.AssertDeepEquals(t, expected, sp) -} - -func TestDisable(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDisableResponse(t, lbID) - - err := Disable(client.ServiceClient(), lbID).ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/ssl/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/ssl/requests_test.go deleted file mode 100644 index fb14c4a28d..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/ssl/requests_test.go +++ /dev/null @@ -1,167 +0,0 @@ -package ssl - -import ( - "testing" - - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -const ( - lbID = 12345 - certID = 67890 -) - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockGetResponse(t, lbID) - - sp, err := Get(client.ServiceClient(), lbID).Extract() - th.AssertNoErr(t, err) - - expected := &SSLTermConfig{ - Certificate: "-----BEGIN CERTIFICATE-----\nMIIEXTCCA0WgAwIBAgIGATTEAjK3MA0GCSqGSIb3DQEBBQUAMIGDMRkwFwYDVQQD\nExBUZXN0IENBIFNUdWIgS2V5MRcwFQYDVQQLEw5QbGF0Zm9ybSBMYmFhczEaMBgG\nA1UEChMRUmFja3NwYWNlIEhvc3RpbmcxFDASBgNVBAcTC1NhbiBBbnRvbmlvMQ4w\nDAYDVQQIEwVUZXhhczELMAkGA1UEBhMCVVMwHhcNMTIwMTA5MTk0NjQ1WhcNMTQw\nMTA4MTk0NjQ1WjCBgjELMAkGA1UEBhMCVVMxDjAMBgNVBAgTBVRleGFzMRQwEgYD\nVQQHEwtTYW4gQW50b25pbzEaMBgGA1UEChMRUmFja3NwYWNlIEhvc3RpbmcxFzAV\nBgNVBAsTDlBsYXRmb3JtIExiYWFzMRgwFgYDVQQDEw9UZXN0IENsaWVudCBLZXkw\nggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAi51IylFnHtNLT8C0NVfc\nOBfAsP2D5es1qhrOWHCGlgAuDMksBsCc7FPo5PSBOmQ+6z8HtCFbrLoC5/Zx0F5b\nfVegjA+xKjI2HGASsYHHM0BFEH2UjUcJrWiMWtxQuW6Phbqulo7JwjmygMEmIkeK\nf+FtkE9mrq+E8K40/thrjxl3/ZcJD1+3dcp+ZuzVJ2t1E4iGKCx79IZFsysKiuf+\n+E0i6iGvvI6UcbcZxVxQj2TplJkFuoX5kDgClIX9Dr9y6aJ4SCh+GRhvHl+DTaz0\nnCvghachHZtIeztRDqxWApjOOzs93dSelrviMXDr8fqyEAGg7YIhgui0aZBsWCen\nAgMBAAGjgdUwgdIwgbAGA1UdIwSBqDCBpYAUNpx1Pc6cGA7KqEwHMmHBTZMA7lSh\ngYmkgYYwgYMxGTAXBgNVBAMTEFRlc3QgQ0EgU1R1YiBLZXkxFzAVBgNVBAsTDlBs\nYXRmb3JtIExiYWFzMRowGAYDVQQKExFSYWNrc3BhY2UgSG9zdGluZzEUMBIGA1UE\nBxMLU2FuIEFudG9uaW8xDjAMBgNVBAgTBVRleGFzMQswCQYDVQQGEwJVU4IBATAd\nBgNVHQ4EFgQULueOfsjZZOHwJHZwBy6u0swnpccwDQYJKoZIhvcNAQEFBQADggEB\nAFNuqSVUaotUJoWDv4z7Kbi6JFpTjDht5ORw4BdVYlRD4h9DACAFzPrPV2ym/Osp\nhNMdZq6msZku7MdOSQVhdeGWrSNk3M8O9Hg7cVzPNXOF3iNoo3irQ5tURut44xs4\nWw5YWQqS9WyUY5snD8tm7Y1rQTPfhg+678xIq/zWCv/u+FSnfVv1nlhLVQkEeG/Y\ngh1uMaTIpUKTGEjIAGtpGP7wwIcXptR/HyfzhTUSTaWc1Ef7zoKT9LL5z3IV1hC2\njVWz+RwYs98LjMuksJFoHqRfWyYhCIym0jb6GTwaEmpxAjc+d7OLNQdnoEGoUYGP\nYjtfkRYg265ESMA+Kww4Xy8=\n-----END CERTIFICATE-----\n", - Enabled: true, - SecureTrafficOnly: false, - IntCertificate: "-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBgzEZMBcGA1UEAxMQVGVz\ndCBDQSBTVHViIEtleTEXMBUGA1UECxMOUGxhdGZvcm0gTGJhYXMxGjAYBgNVBAoT\nEVJhY2tzcGFjZSBIb3N0aW5nMRQwEgYDVQQHEwtTYW4gQW50b25pbzEOMAwGA1UE\nCBMFVGV4YXMxCzAJBgNVBAYTAlVTMB4XDTEyMDEwOTE5NDU0OVoXDTE0MDEwODE5\nNDU0OVowgYMxGTAXBgNVBAMTEFRlc3QgQ0EgU1R1YiBLZXkxFzAVBgNVBAsTDlBs\nYXRmb3JtIExiYWFzMRowGAYDVQQKExFSYWNrc3BhY2UgSG9zdGluZzEUMBIGA1UE\nBxMLU2FuIEFudG9uaW8xDjAMBgNVBAgTBVRleGFzMQswCQYDVQQGEwJVUzCCASIw\nDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANNh55lwTVwQvNoEZjq1zGdYz9jA\nXXdjizn8AJhjHLOAallfPtvCfTEgKanhdoyz5FnhQE8HbDAop/KNS1lN2UMvdl5f\nZNLTSjJrNtedqxQwxN/i3bpyBxNVejUH2NjV1mmyj+5CJYwCzWalvI/gLPq/A3as\nO2EQqtf3U8unRgn0zXLRdYxV9MrUzNAmdipPNvNrsVdrCgA42rgF/8KsyRVQfJCX\nfN7PGCfrsC3YaUvhymraWxNnXIzMYTNa9wEeBZLUw8SlEtpa1Zsvui+TPXu3USNZ\nVnWH8Lb6ENlnoX0VBwo62fjOG3JzhNKoJawi3bRqyDdINOvafr7iPrrs/T8CAwEA\nAaMyMDAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUNpx1Pc6cGA7KqEwHMmHB\nTZMA7lQwDQYJKoZIhvcNAQEFBQADggEBAMoRgH3iTG3t317viLKoY+lNMHUgHuR7\nb3mn9MidJKyYVewe6hCDIN6WY4fUojmMW9wFJWJIo0hRMNHL3n3tq8HP2j20Mxy8\nacPdfGZJa+jiBw72CrIGdobKaFduIlIEDBA1pNdZIJ+EulrtqrMesnIt92WaypIS\n8JycbIgDMCiyC0ENHEk8UWlC6429c7OZAsplMTbHME/1R4btxjkdfrYZJjdJ2yL2\n8cjZDUDMCPTdW/ycP07Gkq30RB5tACB5aZdaCn2YaKC8FsEdhff4X7xEOfOEHWEq\nSRxADDj8Lx1MT6QpR07hCiDyHfTCtbqzI0iGjX63Oh7xXSa0f+JVTa8=\n-----END CERTIFICATE-----\n", - SecurePort: 443, - } - th.AssertDeepEquals(t, expected, sp) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockUpdateResponse(t, lbID) - - opts := UpdateOpts{ - Enabled: gophercloud.Enabled, - SecurePort: 443, - SecureTrafficOnly: gophercloud.Disabled, - PrivateKey: "foo", - Certificate: "-----BEGIN CERTIFICATE-----\nMIIEXTCCA0WgAwIBAgIGATTEAjK3MA0GCSqGSIb3DQEBBQUAMIGDMRkwFwYDVQQD\nExBUZXN0IENBIFNUdWIgS2V5MRcwFQYDVQQLEw5QbGF0Zm9ybSBMYmFhczEaMBgG\nA1UEChMRUmFja3NwYWNlIEhvc3RpbmcxFDASBgNVBAcTC1NhbiBBbnRvbmlvMQ4w\nDAYDVQQIEwVUZXhhczELMAkGA1UEBhMCVVMwHhcNMTIwMTA5MTk0NjQ1WhcNMTQw\nMTA4MTk0NjQ1WjCBgjELMAkGA1UEBhMCVVMxDjAMBgNVBAgTBVRleGFzMRQwEgYD\nVQQHEwtTYW4gQW50b25pbzEaMBgGA1UEChMRUmFja3NwYWNlIEhvc3RpbmcxFzAV\nBgNVBAsTDlBsYXRmb3JtIExiYWFzMRgwFgYDVQQDEw9UZXN0IENsaWVudCBLZXkw\nggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAi51IylFnHtNLT8C0NVfc\nOBfAsP2D5es1qhrOWHCGlgAuDMksBsCc7FPo5PSBOmQ+6z8HtCFbrLoC5/Zx0F5b\nfVegjA+xKjI2HGASsYHHM0BFEH2UjUcJrWiMWtxQuW6Phbqulo7JwjmygMEmIkeK\nf+FtkE9mrq+E8K40/thrjxl3/ZcJD1+3dcp+ZuzVJ2t1E4iGKCx79IZFsysKiuf+\n+E0i6iGvvI6UcbcZxVxQj2TplJkFuoX5kDgClIX9Dr9y6aJ4SCh+GRhvHl+DTaz0\nnCvghachHZtIeztRDqxWApjOOzs93dSelrviMXDr8fqyEAGg7YIhgui0aZBsWCen\nAgMBAAGjgdUwgdIwgbAGA1UdIwSBqDCBpYAUNpx1Pc6cGA7KqEwHMmHBTZMA7lSh\ngYmkgYYwgYMxGTAXBgNVBAMTEFRlc3QgQ0EgU1R1YiBLZXkxFzAVBgNVBAsTDlBs\nYXRmb3JtIExiYWFzMRowGAYDVQQKExFSYWNrc3BhY2UgSG9zdGluZzEUMBIGA1UE\nBxMLU2FuIEFudG9uaW8xDjAMBgNVBAgTBVRleGFzMQswCQYDVQQGEwJVU4IBATAd\nBgNVHQ4EFgQULueOfsjZZOHwJHZwBy6u0swnpccwDQYJKoZIhvcNAQEFBQADggEB\nAFNuqSVUaotUJoWDv4z7Kbi6JFpTjDht5ORw4BdVYlRD4h9DACAFzPrPV2ym/Osp\nhNMdZq6msZku7MdOSQVhdeGWrSNk3M8O9Hg7cVzPNXOF3iNoo3irQ5tURut44xs4\nWw5YWQqS9WyUY5snD8tm7Y1rQTPfhg+678xIq/zWCv/u+FSnfVv1nlhLVQkEeG/Y\ngh1uMaTIpUKTGEjIAGtpGP7wwIcXptR/HyfzhTUSTaWc1Ef7zoKT9LL5z3IV1hC2\njVWz+RwYs98LjMuksJFoHqRfWyYhCIym0jb6GTwaEmpxAjc+d7OLNQdnoEGoUYGP\nYjtfkRYg265ESMA+Kww4Xy8=\n-----END CERTIFICATE-----\n", - IntCertificate: "-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBgzEZMBcGA1UEAxMQVGVz\ndCBDQSBTVHViIEtleTEXMBUGA1UECxMOUGxhdGZvcm0gTGJhYXMxGjAYBgNVBAoT\nEVJhY2tzcGFjZSBIb3N0aW5nMRQwEgYDVQQHEwtTYW4gQW50b25pbzEOMAwGA1UE\nCBMFVGV4YXMxCzAJBgNVBAYTAlVTMB4XDTEyMDEwOTE5NDU0OVoXDTE0MDEwODE5\nNDU0OVowgYMxGTAXBgNVBAMTEFRlc3QgQ0EgU1R1YiBLZXkxFzAVBgNVBAsTDlBs\nYXRmb3JtIExiYWFzMRowGAYDVQQKExFSYWNrc3BhY2UgSG9zdGluZzEUMBIGA1UE\nBxMLU2FuIEFudG9uaW8xDjAMBgNVBAgTBVRleGFzMQswCQYDVQQGEwJVUzCCASIw\nDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANNh55lwTVwQvNoEZjq1zGdYz9jA\nXXdjizn8AJhjHLOAallfPtvCfTEgKanhdoyz5FnhQE8HbDAop/KNS1lN2UMvdl5f\nZNLTSjJrNtedqxQwxN/i3bpyBxNVejUH2NjV1mmyj+5CJYwCzWalvI/gLPq/A3as\nO2EQqtf3U8unRgn0zXLRdYxV9MrUzNAmdipPNvNrsVdrCgA42rgF/8KsyRVQfJCX\nfN7PGCfrsC3YaUvhymraWxNnXIzMYTNa9wEeBZLUw8SlEtpa1Zsvui+TPXu3USNZ\nVnWH8Lb6ENlnoX0VBwo62fjOG3JzhNKoJawi3bRqyDdINOvafr7iPrrs/T8CAwEA\nAaMyMDAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUNpx1Pc6cGA7KqEwHMmHB\nTZMA7lQwDQYJKoZIhvcNAQEFBQADggEBAMoRgH3iTG3t317viLKoY+lNMHUgHuR7\nb3mn9MidJKyYVewe6hCDIN6WY4fUojmMW9wFJWJIo0hRMNHL3n3tq8HP2j20Mxy8\nacPdfGZJa+jiBw72CrIGdobKaFduIlIEDBA1pNdZIJ+EulrtqrMesnIt92WaypIS\n8JycbIgDMCiyC0ENHEk8UWlC6429c7OZAsplMTbHME/1R4btxjkdfrYZJjdJ2yL2\n8cjZDUDMCPTdW/ycP07Gkq30RB5tACB5aZdaCn2YaKC8FsEdhff4X7xEOfOEHWEq\nSRxADDj8Lx1MT6QpR07hCiDyHfTCtbqzI0iGjX63Oh7xXSa0f+JVTa8=\n-----END CERTIFICATE-----\n", - } - err := Update(client.ServiceClient(), lbID, opts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDeleteResponse(t, lbID) - - err := Delete(client.ServiceClient(), lbID).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestListCerts(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockListCertsResponse(t, lbID) - - count := 0 - - err := ListCerts(client.ServiceClient(), lbID).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractCerts(page) - th.AssertNoErr(t, err) - - expected := []Certificate{ - Certificate{ID: 123, HostName: "rackspace.com"}, - Certificate{ID: 124, HostName: "*.rackspace.com"}, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, count) -} - -func TestCreateCert(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockAddCertResponse(t, lbID) - - opts := CreateCertOpts{ - HostName: "rackspace.com", - PrivateKey: "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAwIudSMpRZx7TS0/AtDVX3DgXwLD9g+XrNaoazlhwhpYALgzJ\nLAbAnOxT6OT0gTpkPus/B7QhW6y6Auf2cdBeW31XoIwPsSoyNhxgErGBxzNARRB9\nlI1HCa1ojFrcULluj4W6rpaOycI5soDBJiJHin/hbZBPZq6vhPCuNP7Ya48Zd/2X\nCQ9ft3XKfmbs1SdrdROIhigse/SGRbMrCorn/vhNIuohr7yOlHG3GcVcUI9k6ZSZ\nBbqF+ZA4ApSF/Q6/cumieEgofhkYbx5fg02s9Jwr4IWnIR2bSHs7UQ6sVgKYzjs7\nPd3Unpa74jFw6/H6shABoO2CIYLotGmQbFgnpwIDAQABAoIBAQCBCQ+PCIclJHNV\ntUzfeCA5ZR4F9JbxHdRTUnxEbOB8UWotckQfTScoAvj4yvdQ42DrCZxj/UOdvFOs\nPufZvlp91bIz1alugWjE+p8n5+2hIaegoTyHoWZKBfxak0myj5KYfHZvKlbmv1ML\nXV4TwEVRfAIG+v87QTY/UUxuF5vR+BpKIbgUJLfPUFFvJUdl84qsJ44pToxaYUd/\nh5YAGC00U4ay1KVSAUnTkkPNZ0lPG/rWU6w6WcTvNRLMd8DzFLTKLOgQfHhbExAF\n+sXPWjWSzbBRP1O7fHqq96QQh4VFiY/7w9W+sDKQyV6Ul17OSXs6aZ4f+lq4rJTI\n1FG96YiBAoGBAO1tiH0h1oWDBYfJB3KJJ6CQQsDGwtHo/DEgznFVP4XwEVbZ98Ha\nBfBCn3sAybbaikyCV1Hwj7kfHMZPDHbrcUSFX7quu/2zPK+wO3lZKXSyu4YsguSa\nRedInN33PpdnlPhLyQdWSuD5sVHJDF6xn22vlyxeILH3ooLg2WOFMPmVAoGBAM+b\nUG/a7iyfpAQKYyuFAsXz6SeFaDY+ZYeX45L112H8Pu+Ie/qzon+bzLB9FIH8GP6+\nQpQgmm/p37U2gD1zChUv7iW6OfQBKk9rWvMpfRF6d7YHquElejhizfTZ+ntBV/VY\ndOYEczxhrdW7keLpatYaaWUy/VboRZmlz/9JGqVLAoGAHfqNmFc0cgk4IowEj7a3\ntTNh6ltub/i+FynwRykfazcDyXaeLPDtfQe8gVh5H8h6W+y9P9BjJVnDVVrX1RAn\nbiJ1EupLPF5sVDapW8ohTOXgfbGTGXBNUUW+4Nv+IDno+mz/RhjkPYHpnM0I7c/5\ntGzOZsC/2hjNgT8I0+MWav0CgYEAuULdJeQVlKalI6HtW2Gn1uRRVJ49H+LQkY6e\nW3+cw2jo9LI0CMWSphNvNrN3wIMp/vHj0fHCP0pSApDvIWbuQXfzKaGko7UCf7rK\nf6GvZRCHkV4IREBAb97j8bMvThxClMNqFfU0rFZyXP+0MOyhFQyertswrgQ6T+Fi\n2mnvKD8CgYAmJHP3NTDRMoMRyAzonJ6nEaGUbAgNmivTaUWMe0+leCvAdwD89gzC\nTKbm3eDUg/6Va3X6ANh3wsfIOe4RXXxcbcFDk9R4zO2M5gfLSjYm5Q87EBZ2hrdj\nM2gLI7dt6thx0J8lR8xRHBEMrVBdgwp0g1gQzo5dAV88/kpkZVps8Q==\n-----END RSA PRIVATE KEY-----\n", - Certificate: "-----BEGIN CERTIFICATE-----\nMIIEXTCCA0WgAwIBAgIGATTEAjK3MA0GCSqGSIb3DQEBBQUAMIGDMRkwFwYDVQQD\nExBUZXN0IENBIFNUdWIgS2V5MRcwFQYDVQQLEw5QbGF0Zm9ybSBMYmFhczEaMBgG\nA1UEChMRUmFja3NwYWNlIEhvc3RpbmcxFDASBgNVBAcTC1NhbiBBbnRvbmlvMQ4w\nDAYDVQQIEwVUZXhhczELMAkGA1UEBhMCVVMwHhcNMTIwMTA5MTk0NjQ1WhcNMTQw\nMTA4MTk0NjQ1WjCBgjELMAkGA1UEBhMCVVMxDjAMBgNVBAgTBVRleGFzMRQwEgYD\nVQQHEwtTYW4gQW50b25pbzEaMBgGA1UEChMRUmFja3NwYWNlIEhvc3RpbmcxFzAV\nBgNVBAsTDlBsYXRmb3JtIExiYWFzMRgwFgYDVQQDEw9UZXN0IENsaWVudCBLZXkw\nggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAi51IylFnHtNLT8C0NVfc\nOBfAsP2D5es1qhrOWHCGlgAuDMksBsCc7FPo5PSBOmQ+6z8HtCFbrLoC5/Zx0F5b\nfVegjA+xKjI2HGASsYHHM0BFEH2UjUcJrWiMWtxQuW6Phbqulo7JwjmygMEmIkeK\nf+FtkE9mrq+E8K40/thrjxl3/ZcJD1+3dcp+ZuzVJ2t1E4iGKCx79IZFsysKiuf+\n+E0i6iGvvI6UcbcZxVxQj2TplJkFuoX5kDgClIX9Dr9y6aJ4SCh+GRhvHl+DTaz0\nnCvghachHZtIeztRDqxWApjOOzs93dSelrviMXDr8fqyEAGg7YIhgui0aZBsWCen\nAgMBAAGjgdUwgdIwgbAGA1UdIwSBqDCBpYAUNpx1Pc6cGA7KqEwHMmHBTZMA7lSh\ngYmkgYYwgYMxGTAXBgNVBAMTEFRlc3QgQ0EgU1R1YiBLZXkxFzAVBgNVBAsTDlBs\nYXRmb3JtIExiYWFzMRowGAYDVQQKExFSYWNrc3BhY2UgSG9zdGluZzEUMBIGA1UE\nBxMLU2FuIEFudG9uaW8xDjAMBgNVBAgTBVRleGFzMQswCQYDVQQGEwJVU4IBATAd\nBgNVHQ4EFgQULueOfsjZZOHwJHZwBy6u0swnpccwDQYJKoZIhvcNAQEFBQADggEB\nAFNuqSVUaotUJoWDv4z7Kbi6JFpTjDht5ORw4BdVYlRD4h9DACAFzPrPV2ym/Osp\nhNMdZq6msZku7MdOSQVhdeGWrSNk3M8O9Hg7cVzPNXOF3iNoo3irQ5tURut44xs4\nWw5YWQqS9WyUY5snD8tm7Y1rQTPfhg+678xIq/zWCv/u+FSnfVv1nlhLVQkEeG/Y\ngh1uMaTIpUKTGEjIAGtpGP7wwIcXptR/HyfzhTUSTaWc1Ef7zoKT9LL5z3IV1hC2\njVWz+RwYs98LjMuksJFoHqRfWyYhCIym0jb6GTwaEmpxAjc+d7OLNQdnoEGoUYGP\nYjtfkRYg265ESMA+Kww4Xy8=\n-----END CERTIFICATE-----\n", - IntCertificate: "-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBgzEZMBcGA1UEAxMQVGVz\ndCBDQSBTVHViIEtleTEXMBUGA1UECxMOUGxhdGZvcm0gTGJhYXMxGjAYBgNVBAoT\nEVJhY2tzcGFjZSBIb3N0aW5nMRQwEgYDVQQHEwtTYW4gQW50b25pbzEOMAwGA1UE\nCBMFVGV4YXMxCzAJBgNVBAYTAlVTMB4XDTEyMDEwOTE5NDU0OVoXDTE0MDEwODE5\nNDU0OVowgYMxGTAXBgNVBAMTEFRlc3QgQ0EgU1R1YiBLZXkxFzAVBgNVBAsTDlBs\nYXRmb3JtIExiYWFzMRowGAYDVQQKExFSYWNrc3BhY2UgSG9zdGluZzEUMBIGA1UE\nBxMLU2FuIEFudG9uaW8xDjAMBgNVBAgTBVRleGFzMQswCQYDVQQGEwJVUzCCASIw\nDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANNh55lwTVwQvNoEZjq1zGdYz9jA\nXXdjizn8AJhjHLOAallfPtvCfTEgKanhdoyz5FnhQE8HbDAop/KNS1lN2UMvdl5f\nZNLTSjJrNtedqxQwxN/i3bpyBxNVejUH2NjV1mmyj+5CJYwCzWalvI/gLPq/A3as\nO2EQqtf3U8unRgn0zXLRdYxV9MrUzNAmdipPNvNrsVdrCgA42rgF/8KsyRVQfJCX\nfN7PGCfrsC3YaUvhymraWxNnXIzMYTNa9wEeBZLUw8SlEtpa1Zsvui+TPXu3USNZ\nVnWH8Lb6ENlnoX0VBwo62fjOG3JzhNKoJawi3bRqyDdINOvafr7iPrrs/T8CAwEA\nAaMyMDAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUNpx1Pc6cGA7KqEwHMmHB\nTZMA7lQwDQYJKoZIhvcNAQEFBQADggEBAMoRgH3iTG3t317viLKoY+lNMHUgHuR7\nb3mn9MidJKyYVewe6hCDIN6WY4fUojmMW9wFJWJIo0hRMNHL3n3tq8HP2j20Mxy8\nacPdfGZJa+jiBw72CrIGdobKaFduIlIEDBA1pNdZIJ+EulrtqrMesnIt92WaypIS\n8JycbIgDMCiyC0ENHEk8UWlC6429c7OZAsplMTbHME/1R4btxjkdfrYZJjdJ2yL2\n8cjZDUDMCPTdW/ycP07Gkq30RB5tACB5aZdaCn2YaKC8FsEdhff4X7xEOfOEHWEq\nSRxADDj8Lx1MT6QpR07hCiDyHfTCtbqzI0iGjX63Oh7xXSa0f+JVTa8=\n-----END CERTIFICATE-----\n", - } - - cm, err := CreateCert(client.ServiceClient(), lbID, opts).Extract() - th.AssertNoErr(t, err) - - expected := &Certificate{ - ID: 123, - HostName: "rackspace.com", - Certificate: "-----BEGIN CERTIFICATE-----\nMIIEXTCCA0WgAwIBAgIGATTEAjK3MA0GCSqGSIb3DQEBBQUAMIGDMRkwFwYDVQQD\nExBUZXN0IENBIFNUdWIgS2V5MRcwFQYDVQQLEw5QbGF0Zm9ybSBMYmFhczEaMBgG\nA1UEChMRUmFja3NwYWNlIEhvc3RpbmcxFDASBgNVBAcTC1NhbiBBbnRvbmlvMQ4w\nDAYDVQQIEwVUZXhhczELMAkGA1UEBhMCVVMwHhcNMTIwMTA5MTk0NjQ1WhcNMTQw\nMTA4MTk0NjQ1WjCBgjELMAkGA1UEBhMCVVMxDjAMBgNVBAgTBVRleGFzMRQwEgYD\nVQQHEwtTYW4gQW50b25pbzEaMBgGA1UEChMRUmFja3NwYWNlIEhvc3RpbmcxFzAV\nBgNVBAsTDlBsYXRmb3JtIExiYWFzMRgwFgYDVQQDEw9UZXN0IENsaWVudCBLZXkw\nggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAi51IylFnHtNLT8C0NVfc\nOBfAsP2D5es1qhrOWHCGlgAuDMksBsCc7FPo5PSBOmQ+6z8HtCFbrLoC5/Zx0F5b\nfVegjA+xKjI2HGASsYHHM0BFEH2UjUcJrWiMWtxQuW6Phbqulo7JwjmygMEmIkeK\nf+FtkE9mrq+E8K40/thrjxl3/ZcJD1+3dcp+ZuzVJ2t1E4iGKCx79IZFsysKiuf+\n+E0i6iGvvI6UcbcZxVxQj2TplJkFuoX5kDgClIX9Dr9y6aJ4SCh+GRhvHl+DTaz0\nnCvghachHZtIeztRDqxWApjOOzs93dSelrviMXDr8fqyEAGg7YIhgui0aZBsWCen\nAgMBAAGjgdUwgdIwgbAGA1UdIwSBqDCBpYAUNpx1Pc6cGA7KqEwHMmHBTZMA7lSh\ngYmkgYYwgYMxGTAXBgNVBAMTEFRlc3QgQ0EgU1R1YiBLZXkxFzAVBgNVBAsTDlBs\nYXRmb3JtIExiYWFzMRowGAYDVQQKExFSYWNrc3BhY2UgSG9zdGluZzEUMBIGA1UE\nBxMLU2FuIEFudG9uaW8xDjAMBgNVBAgTBVRleGFzMQswCQYDVQQGEwJVU4IBATAd\nBgNVHQ4EFgQULueOfsjZZOHwJHZwBy6u0swnpccwDQYJKoZIhvcNAQEFBQADggEB\nAFNuqSVUaotUJoWDv4z7Kbi6JFpTjDht5ORw4BdVYlRD4h9DACAFzPrPV2ym/Osp\nhNMdZq6msZku7MdOSQVhdeGWrSNk3M8O9Hg7cVzPNXOF3iNoo3irQ5tURut44xs4\nWw5YWQqS9WyUY5snD8tm7Y1rQTPfhg+678xIq/zWCv/u+FSnfVv1nlhLVQkEeG/Y\ngh1uMaTIpUKTGEjIAGtpGP7wwIcXptR/HyfzhTUSTaWc1Ef7zoKT9LL5z3IV1hC2\njVWz+RwYs98LjMuksJFoHqRfWyYhCIym0jb6GTwaEmpxAjc+d7OLNQdnoEGoUYGP\nYjtfkRYg265ESMA+Kww4Xy8=\n-----END CERTIFICATE-----\n", - IntCertificate: "-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBgzEZMBcGA1UEAxMQVGVz\ndCBDQSBTVHViIEtleTEXMBUGA1UECxMOUGxhdGZvcm0gTGJhYXMxGjAYBgNVBAoT\nEVJhY2tzcGFjZSBIb3N0aW5nMRQwEgYDVQQHEwtTYW4gQW50b25pbzEOMAwGA1UE\nCBMFVGV4YXMxCzAJBgNVBAYTAlVTMB4XDTEyMDEwOTE5NDU0OVoXDTE0MDEwODE5\nNDU0OVowgYMxGTAXBgNVBAMTEFRlc3QgQ0EgU1R1YiBLZXkxFzAVBgNVBAsTDlBs\nYXRmb3JtIExiYWFzMRowGAYDVQQKExFSYWNrc3BhY2UgSG9zdGluZzEUMBIGA1UE\nBxMLU2FuIEFudG9uaW8xDjAMBgNVBAgTBVRleGFzMQswCQYDVQQGEwJVUzCCASIw\nDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANNh55lwTVwQvNoEZjq1zGdYz9jA\nXXdjizn8AJhjHLOAallfPtvCfTEgKanhdoyz5FnhQE8HbDAop/KNS1lN2UMvdl5f\nZNLTSjJrNtedqxQwxN/i3bpyBxNVejUH2NjV1mmyj+5CJYwCzWalvI/gLPq/A3as\nO2EQqtf3U8unRgn0zXLRdYxV9MrUzNAmdipPNvNrsVdrCgA42rgF/8KsyRVQfJCX\nfN7PGCfrsC3YaUvhymraWxNnXIzMYTNa9wEeBZLUw8SlEtpa1Zsvui+TPXu3USNZ\nVnWH8Lb6ENlnoX0VBwo62fjOG3JzhNKoJawi3bRqyDdINOvafr7iPrrs/T8CAwEA\nAaMyMDAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUNpx1Pc6cGA7KqEwHMmHB\nTZMA7lQwDQYJKoZIhvcNAQEFBQADggEBAMoRgH3iTG3t317viLKoY+lNMHUgHuR7\nb3mn9MidJKyYVewe6hCDIN6WY4fUojmMW9wFJWJIo0hRMNHL3n3tq8HP2j20Mxy8\nacPdfGZJa+jiBw72CrIGdobKaFduIlIEDBA1pNdZIJ+EulrtqrMesnIt92WaypIS\n8JycbIgDMCiyC0ENHEk8UWlC6429c7OZAsplMTbHME/1R4btxjkdfrYZJjdJ2yL2\n8cjZDUDMCPTdW/ycP07Gkq30RB5tACB5aZdaCn2YaKC8FsEdhff4X7xEOfOEHWEq\nSRxADDj8Lx1MT6QpR07hCiDyHfTCtbqzI0iGjX63Oh7xXSa0f+JVTa8=\n-----END CERTIFICATE-----\n", - } - th.AssertDeepEquals(t, expected, cm) -} - -func TestGetCertMapping(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockGetCertResponse(t, lbID, certID) - - sp, err := GetCert(client.ServiceClient(), lbID, certID).Extract() - th.AssertNoErr(t, err) - - expected := &Certificate{ - ID: 123, - HostName: "rackspace.com", - Certificate: "-----BEGIN CERTIFICATE-----\nMIIEXTCCA0WgAwIBAgIGATTEAjK3MA0GCSqGSIb3DQEBBQUAMIGDMRkwFwYDVQQD\nExBUZXN0IENBIFNUdWIgS2V5MRcwFQYDVQQLEw5QbGF0Zm9ybSBMYmFhczEaMBgG\nA1UEChMRUmFja3NwYWNlIEhvc3RpbmcxFDASBgNVBAcTC1NhbiBBbnRvbmlvMQ4w\nDAYDVQQIEwVUZXhhczELMAkGA1UEBhMCVVMwHhcNMTIwMTA5MTk0NjQ1WhcNMTQw\nMTA4MTk0NjQ1WjCBgjELMAkGA1UEBhMCVVMxDjAMBgNVBAgTBVRleGFzMRQwEgYD\nVQQHEwtTYW4gQW50b25pbzEaMBgGA1UEChMRUmFja3NwYWNlIEhvc3RpbmcxFzAV\nBgNVBAsTDlBsYXRmb3JtIExiYWFzMRgwFgYDVQQDEw9UZXN0IENsaWVudCBLZXkw\nggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAi51IylFnHtNLT8C0NVfc\nOBfAsP2D5es1qhrOWHCGlgAuDMksBsCc7FPo5PSBOmQ+6z8HtCFbrLoC5/Zx0F5b\nfVegjA+xKjI2HGASsYHHM0BFEH2UjUcJrWiMWtxQuW6Phbqulo7JwjmygMEmIkeK\nf+FtkE9mrq+E8K40/thrjxl3/ZcJD1+3dcp+ZuzVJ2t1E4iGKCx79IZFsysKiuf+\n+E0i6iGvvI6UcbcZxVxQj2TplJkFuoX5kDgClIX9Dr9y6aJ4SCh+GRhvHl+DTaz0\nnCvghachHZtIeztRDqxWApjOOzs93dSelrviMXDr8fqyEAGg7YIhgui0aZBsWCen\nAgMBAAGjgdUwgdIwgbAGA1UdIwSBqDCBpYAUNpx1Pc6cGA7KqEwHMmHBTZMA7lSh\ngYmkgYYwgYMxGTAXBgNVBAMTEFRlc3QgQ0EgU1R1YiBLZXkxFzAVBgNVBAsTDlBs\nYXRmb3JtIExiYWFzMRowGAYDVQQKExFSYWNrc3BhY2UgSG9zdGluZzEUMBIGA1UE\nBxMLU2FuIEFudG9uaW8xDjAMBgNVBAgTBVRleGFzMQswCQYDVQQGEwJVU4IBATAd\nBgNVHQ4EFgQULueOfsjZZOHwJHZwBy6u0swnpccwDQYJKoZIhvcNAQEFBQADggEB\nAFNuqSVUaotUJoWDv4z7Kbi6JFpTjDht5ORw4BdVYlRD4h9DACAFzPrPV2ym/Osp\nhNMdZq6msZku7MdOSQVhdeGWrSNk3M8O9Hg7cVzPNXOF3iNoo3irQ5tURut44xs4\nWw5YWQqS9WyUY5snD8tm7Y1rQTPfhg+678xIq/zWCv/u+FSnfVv1nlhLVQkEeG/Y\ngh1uMaTIpUKTGEjIAGtpGP7wwIcXptR/HyfzhTUSTaWc1Ef7zoKT9LL5z3IV1hC2\njVWz+RwYs98LjMuksJFoHqRfWyYhCIym0jb6GTwaEmpxAjc+d7OLNQdnoEGoUYGP\nYjtfkRYg265ESMA+Kww4Xy8=\n-----END CERTIFICATE-----\n", - IntCertificate: "-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBgzEZMBcGA1UEAxMQVGVz\ndCBDQSBTVHViIEtleTEXMBUGA1UECxMOUGxhdGZvcm0gTGJhYXMxGjAYBgNVBAoT\nEVJhY2tzcGFjZSBIb3N0aW5nMRQwEgYDVQQHEwtTYW4gQW50b25pbzEOMAwGA1UE\nCBMFVGV4YXMxCzAJBgNVBAYTAlVTMB4XDTEyMDEwOTE5NDU0OVoXDTE0MDEwODE5\nNDU0OVowgYMxGTAXBgNVBAMTEFRlc3QgQ0EgU1R1YiBLZXkxFzAVBgNVBAsTDlBs\nYXRmb3JtIExiYWFzMRowGAYDVQQKExFSYWNrc3BhY2UgSG9zdGluZzEUMBIGA1UE\nBxMLU2FuIEFudG9uaW8xDjAMBgNVBAgTBVRleGFzMQswCQYDVQQGEwJVUzCCASIw\nDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANNh55lwTVwQvNoEZjq1zGdYz9jA\nXXdjizn8AJhjHLOAallfPtvCfTEgKanhdoyz5FnhQE8HbDAop/KNS1lN2UMvdl5f\nZNLTSjJrNtedqxQwxN/i3bpyBxNVejUH2NjV1mmyj+5CJYwCzWalvI/gLPq/A3as\nO2EQqtf3U8unRgn0zXLRdYxV9MrUzNAmdipPNvNrsVdrCgA42rgF/8KsyRVQfJCX\nfN7PGCfrsC3YaUvhymraWxNnXIzMYTNa9wEeBZLUw8SlEtpa1Zsvui+TPXu3USNZ\nVnWH8Lb6ENlnoX0VBwo62fjOG3JzhNKoJawi3bRqyDdINOvafr7iPrrs/T8CAwEA\nAaMyMDAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUNpx1Pc6cGA7KqEwHMmHB\nTZMA7lQwDQYJKoZIhvcNAQEFBQADggEBAMoRgH3iTG3t317viLKoY+lNMHUgHuR7\nb3mn9MidJKyYVewe6hCDIN6WY4fUojmMW9wFJWJIo0hRMNHL3n3tq8HP2j20Mxy8\nacPdfGZJa+jiBw72CrIGdobKaFduIlIEDBA1pNdZIJ+EulrtqrMesnIt92WaypIS\n8JycbIgDMCiyC0ENHEk8UWlC6429c7OZAsplMTbHME/1R4btxjkdfrYZJjdJ2yL2\n8cjZDUDMCPTdW/ycP07Gkq30RB5tACB5aZdaCn2YaKC8FsEdhff4X7xEOfOEHWEq\nSRxADDj8Lx1MT6QpR07hCiDyHfTCtbqzI0iGjX63Oh7xXSa0f+JVTa8=\n-----END CERTIFICATE-----\n", - } - th.AssertDeepEquals(t, expected, sp) -} - -func TestUpdateCert(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockUpdateCertResponse(t, lbID, certID) - - opts := UpdateCertOpts{ - HostName: "rackspace.com", - PrivateKey: "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAwIudSMpRZx7TS0/AtDVX3DgXwLD9g+XrNaoazlhwhpYALgzJ\nLAbAnOxT6OT0gTpkPus/B7QhW6y6Auf2cdBeW31XoIwPsSoyNhxgErGBxzNARRB9\nlI1HCa1ojFrcULluj4W6rpaOycI5soDBJiJHin/hbZBPZq6vhPCuNP7Ya48Zd/2X\nCQ9ft3XKfmbs1SdrdROIhigse/SGRbMrCorn/vhNIuohr7yOlHG3GcVcUI9k6ZSZ\nBbqF+ZA4ApSF/Q6/cumieEgofhkYbx5fg02s9Jwr4IWnIR2bSHs7UQ6sVgKYzjs7\nPd3Unpa74jFw6/H6shABoO2CIYLotGmQbFgnpwIDAQABAoIBAQCBCQ+PCIclJHNV\ntUzfeCA5ZR4F9JbxHdRTUnxEbOB8UWotckQfTScoAvj4yvdQ42DrCZxj/UOdvFOs\nPufZvlp91bIz1alugWjE+p8n5+2hIaegoTyHoWZKBfxak0myj5KYfHZvKlbmv1ML\nXV4TwEVRfAIG+v87QTY/UUxuF5vR+BpKIbgUJLfPUFFvJUdl84qsJ44pToxaYUd/\nh5YAGC00U4ay1KVSAUnTkkPNZ0lPG/rWU6w6WcTvNRLMd8DzFLTKLOgQfHhbExAF\n+sXPWjWSzbBRP1O7fHqq96QQh4VFiY/7w9W+sDKQyV6Ul17OSXs6aZ4f+lq4rJTI\n1FG96YiBAoGBAO1tiH0h1oWDBYfJB3KJJ6CQQsDGwtHo/DEgznFVP4XwEVbZ98Ha\nBfBCn3sAybbaikyCV1Hwj7kfHMZPDHbrcUSFX7quu/2zPK+wO3lZKXSyu4YsguSa\nRedInN33PpdnlPhLyQdWSuD5sVHJDF6xn22vlyxeILH3ooLg2WOFMPmVAoGBAM+b\nUG/a7iyfpAQKYyuFAsXz6SeFaDY+ZYeX45L112H8Pu+Ie/qzon+bzLB9FIH8GP6+\nQpQgmm/p37U2gD1zChUv7iW6OfQBKk9rWvMpfRF6d7YHquElejhizfTZ+ntBV/VY\ndOYEczxhrdW7keLpatYaaWUy/VboRZmlz/9JGqVLAoGAHfqNmFc0cgk4IowEj7a3\ntTNh6ltub/i+FynwRykfazcDyXaeLPDtfQe8gVh5H8h6W+y9P9BjJVnDVVrX1RAn\nbiJ1EupLPF5sVDapW8ohTOXgfbGTGXBNUUW+4Nv+IDno+mz/RhjkPYHpnM0I7c/5\ntGzOZsC/2hjNgT8I0+MWav0CgYEAuULdJeQVlKalI6HtW2Gn1uRRVJ49H+LQkY6e\nW3+cw2jo9LI0CMWSphNvNrN3wIMp/vHj0fHCP0pSApDvIWbuQXfzKaGko7UCf7rK\nf6GvZRCHkV4IREBAb97j8bMvThxClMNqFfU0rFZyXP+0MOyhFQyertswrgQ6T+Fi\n2mnvKD8CgYAmJHP3NTDRMoMRyAzonJ6nEaGUbAgNmivTaUWMe0+leCvAdwD89gzC\nTKbm3eDUg/6Va3X6ANh3wsfIOe4RXXxcbcFDk9R4zO2M5gfLSjYm5Q87EBZ2hrdj\nM2gLI7dt6thx0J8lR8xRHBEMrVBdgwp0g1gQzo5dAV88/kpkZVps8Q==\n-----END RSA PRIVATE KEY-----\n", - Certificate: "-----BEGIN CERTIFICATE-----\nMIIEXTCCA0WgAwIBAgIGATTEAjK3MA0GCSqGSIb3DQEBBQUAMIGDMRkwFwYDVQQD\nExBUZXN0IENBIFNUdWIgS2V5MRcwFQYDVQQLEw5QbGF0Zm9ybSBMYmFhczEaMBgG\nA1UEChMRUmFja3NwYWNlIEhvc3RpbmcxFDASBgNVBAcTC1NhbiBBbnRvbmlvMQ4w\nDAYDVQQIEwVUZXhhczELMAkGA1UEBhMCVVMwHhcNMTIwMTA5MTk0NjQ1WhcNMTQw\nMTA4MTk0NjQ1WjCBgjELMAkGA1UEBhMCVVMxDjAMBgNVBAgTBVRleGFzMRQwEgYD\nVQQHEwtTYW4gQW50b25pbzEaMBgGA1UEChMRUmFja3NwYWNlIEhvc3RpbmcxFzAV\nBgNVBAsTDlBsYXRmb3JtIExiYWFzMRgwFgYDVQQDEw9UZXN0IENsaWVudCBLZXkw\nggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAi51IylFnHtNLT8C0NVfc\nOBfAsP2D5es1qhrOWHCGlgAuDMksBsCc7FPo5PSBOmQ+6z8HtCFbrLoC5/Zx0F5b\nfVegjA+xKjI2HGASsYHHM0BFEH2UjUcJrWiMWtxQuW6Phbqulo7JwjmygMEmIkeK\nf+FtkE9mrq+E8K40/thrjxl3/ZcJD1+3dcp+ZuzVJ2t1E4iGKCx79IZFsysKiuf+\n+E0i6iGvvI6UcbcZxVxQj2TplJkFuoX5kDgClIX9Dr9y6aJ4SCh+GRhvHl+DTaz0\nnCvghachHZtIeztRDqxWApjOOzs93dSelrviMXDr8fqyEAGg7YIhgui0aZBsWCen\nAgMBAAGjgdUwgdIwgbAGA1UdIwSBqDCBpYAUNpx1Pc6cGA7KqEwHMmHBTZMA7lSh\ngYmkgYYwgYMxGTAXBgNVBAMTEFRlc3QgQ0EgU1R1YiBLZXkxFzAVBgNVBAsTDlBs\nYXRmb3JtIExiYWFzMRowGAYDVQQKExFSYWNrc3BhY2UgSG9zdGluZzEUMBIGA1UE\nBxMLU2FuIEFudG9uaW8xDjAMBgNVBAgTBVRleGFzMQswCQYDVQQGEwJVU4IBATAd\nBgNVHQ4EFgQULueOfsjZZOHwJHZwBy6u0swnpccwDQYJKoZIhvcNAQEFBQADggEB\nAFNuqSVUaotUJoWDv4z7Kbi6JFpTjDht5ORw4BdVYlRD4h9DACAFzPrPV2ym/Osp\nhNMdZq6msZku7MdOSQVhdeGWrSNk3M8O9Hg7cVzPNXOF3iNoo3irQ5tURut44xs4\nWw5YWQqS9WyUY5snD8tm7Y1rQTPfhg+678xIq/zWCv/u+FSnfVv1nlhLVQkEeG/Y\ngh1uMaTIpUKTGEjIAGtpGP7wwIcXptR/HyfzhTUSTaWc1Ef7zoKT9LL5z3IV1hC2\njVWz+RwYs98LjMuksJFoHqRfWyYhCIym0jb6GTwaEmpxAjc+d7OLNQdnoEGoUYGP\nYjtfkRYg265ESMA+Kww4Xy8=\n-----END CERTIFICATE-----\n", - IntCertificate: "-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBgzEZMBcGA1UEAxMQVGVz\ndCBDQSBTVHViIEtleTEXMBUGA1UECxMOUGxhdGZvcm0gTGJhYXMxGjAYBgNVBAoT\nEVJhY2tzcGFjZSBIb3N0aW5nMRQwEgYDVQQHEwtTYW4gQW50b25pbzEOMAwGA1UE\nCBMFVGV4YXMxCzAJBgNVBAYTAlVTMB4XDTEyMDEwOTE5NDU0OVoXDTE0MDEwODE5\nNDU0OVowgYMxGTAXBgNVBAMTEFRlc3QgQ0EgU1R1YiBLZXkxFzAVBgNVBAsTDlBs\nYXRmb3JtIExiYWFzMRowGAYDVQQKExFSYWNrc3BhY2UgSG9zdGluZzEUMBIGA1UE\nBxMLU2FuIEFudG9uaW8xDjAMBgNVBAgTBVRleGFzMQswCQYDVQQGEwJVUzCCASIw\nDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANNh55lwTVwQvNoEZjq1zGdYz9jA\nXXdjizn8AJhjHLOAallfPtvCfTEgKanhdoyz5FnhQE8HbDAop/KNS1lN2UMvdl5f\nZNLTSjJrNtedqxQwxN/i3bpyBxNVejUH2NjV1mmyj+5CJYwCzWalvI/gLPq/A3as\nO2EQqtf3U8unRgn0zXLRdYxV9MrUzNAmdipPNvNrsVdrCgA42rgF/8KsyRVQfJCX\nfN7PGCfrsC3YaUvhymraWxNnXIzMYTNa9wEeBZLUw8SlEtpa1Zsvui+TPXu3USNZ\nVnWH8Lb6ENlnoX0VBwo62fjOG3JzhNKoJawi3bRqyDdINOvafr7iPrrs/T8CAwEA\nAaMyMDAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUNpx1Pc6cGA7KqEwHMmHB\nTZMA7lQwDQYJKoZIhvcNAQEFBQADggEBAMoRgH3iTG3t317viLKoY+lNMHUgHuR7\nb3mn9MidJKyYVewe6hCDIN6WY4fUojmMW9wFJWJIo0hRMNHL3n3tq8HP2j20Mxy8\nacPdfGZJa+jiBw72CrIGdobKaFduIlIEDBA1pNdZIJ+EulrtqrMesnIt92WaypIS\n8JycbIgDMCiyC0ENHEk8UWlC6429c7OZAsplMTbHME/1R4btxjkdfrYZJjdJ2yL2\n8cjZDUDMCPTdW/ycP07Gkq30RB5tACB5aZdaCn2YaKC8FsEdhff4X7xEOfOEHWEq\nSRxADDj8Lx1MT6QpR07hCiDyHfTCtbqzI0iGjX63Oh7xXSa0f+JVTa8=\n-----END CERTIFICATE-----\n", - } - - cm, err := UpdateCert(client.ServiceClient(), lbID, certID, opts).Extract() - th.AssertNoErr(t, err) - - expected := &Certificate{ - ID: 123, - HostName: "rackspace.com", - Certificate: "-----BEGIN CERTIFICATE-----\nMIIEXTCCA0WgAwIBAgIGATTEAjK3MA0GCSqGSIb3DQEBBQUAMIGDMRkwFwYDVQQD\nExBUZXN0IENBIFNUdWIgS2V5MRcwFQYDVQQLEw5QbGF0Zm9ybSBMYmFhczEaMBgG\nA1UEChMRUmFja3NwYWNlIEhvc3RpbmcxFDASBgNVBAcTC1NhbiBBbnRvbmlvMQ4w\nDAYDVQQIEwVUZXhhczELMAkGA1UEBhMCVVMwHhcNMTIwMTA5MTk0NjQ1WhcNMTQw\nMTA4MTk0NjQ1WjCBgjELMAkGA1UEBhMCVVMxDjAMBgNVBAgTBVRleGFzMRQwEgYD\nVQQHEwtTYW4gQW50b25pbzEaMBgGA1UEChMRUmFja3NwYWNlIEhvc3RpbmcxFzAV\nBgNVBAsTDlBsYXRmb3JtIExiYWFzMRgwFgYDVQQDEw9UZXN0IENsaWVudCBLZXkw\nggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAi51IylFnHtNLT8C0NVfc\nOBfAsP2D5es1qhrOWHCGlgAuDMksBsCc7FPo5PSBOmQ+6z8HtCFbrLoC5/Zx0F5b\nfVegjA+xKjI2HGASsYHHM0BFEH2UjUcJrWiMWtxQuW6Phbqulo7JwjmygMEmIkeK\nf+FtkE9mrq+E8K40/thrjxl3/ZcJD1+3dcp+ZuzVJ2t1E4iGKCx79IZFsysKiuf+\n+E0i6iGvvI6UcbcZxVxQj2TplJkFuoX5kDgClIX9Dr9y6aJ4SCh+GRhvHl+DTaz0\nnCvghachHZtIeztRDqxWApjOOzs93dSelrviMXDr8fqyEAGg7YIhgui0aZBsWCen\nAgMBAAGjgdUwgdIwgbAGA1UdIwSBqDCBpYAUNpx1Pc6cGA7KqEwHMmHBTZMA7lSh\ngYmkgYYwgYMxGTAXBgNVBAMTEFRlc3QgQ0EgU1R1YiBLZXkxFzAVBgNVBAsTDlBs\nYXRmb3JtIExiYWFzMRowGAYDVQQKExFSYWNrc3BhY2UgSG9zdGluZzEUMBIGA1UE\nBxMLU2FuIEFudG9uaW8xDjAMBgNVBAgTBVRleGFzMQswCQYDVQQGEwJVU4IBATAd\nBgNVHQ4EFgQULueOfsjZZOHwJHZwBy6u0swnpccwDQYJKoZIhvcNAQEFBQADggEB\nAFNuqSVUaotUJoWDv4z7Kbi6JFpTjDht5ORw4BdVYlRD4h9DACAFzPrPV2ym/Osp\nhNMdZq6msZku7MdOSQVhdeGWrSNk3M8O9Hg7cVzPNXOF3iNoo3irQ5tURut44xs4\nWw5YWQqS9WyUY5snD8tm7Y1rQTPfhg+678xIq/zWCv/u+FSnfVv1nlhLVQkEeG/Y\ngh1uMaTIpUKTGEjIAGtpGP7wwIcXptR/HyfzhTUSTaWc1Ef7zoKT9LL5z3IV1hC2\njVWz+RwYs98LjMuksJFoHqRfWyYhCIym0jb6GTwaEmpxAjc+d7OLNQdnoEGoUYGP\nYjtfkRYg265ESMA+Kww4Xy8=\n-----END CERTIFICATE-----\n", - IntCertificate: "-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBgzEZMBcGA1UEAxMQVGVz\ndCBDQSBTVHViIEtleTEXMBUGA1UECxMOUGxhdGZvcm0gTGJhYXMxGjAYBgNVBAoT\nEVJhY2tzcGFjZSBIb3N0aW5nMRQwEgYDVQQHEwtTYW4gQW50b25pbzEOMAwGA1UE\nCBMFVGV4YXMxCzAJBgNVBAYTAlVTMB4XDTEyMDEwOTE5NDU0OVoXDTE0MDEwODE5\nNDU0OVowgYMxGTAXBgNVBAMTEFRlc3QgQ0EgU1R1YiBLZXkxFzAVBgNVBAsTDlBs\nYXRmb3JtIExiYWFzMRowGAYDVQQKExFSYWNrc3BhY2UgSG9zdGluZzEUMBIGA1UE\nBxMLU2FuIEFudG9uaW8xDjAMBgNVBAgTBVRleGFzMQswCQYDVQQGEwJVUzCCASIw\nDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANNh55lwTVwQvNoEZjq1zGdYz9jA\nXXdjizn8AJhjHLOAallfPtvCfTEgKanhdoyz5FnhQE8HbDAop/KNS1lN2UMvdl5f\nZNLTSjJrNtedqxQwxN/i3bpyBxNVejUH2NjV1mmyj+5CJYwCzWalvI/gLPq/A3as\nO2EQqtf3U8unRgn0zXLRdYxV9MrUzNAmdipPNvNrsVdrCgA42rgF/8KsyRVQfJCX\nfN7PGCfrsC3YaUvhymraWxNnXIzMYTNa9wEeBZLUw8SlEtpa1Zsvui+TPXu3USNZ\nVnWH8Lb6ENlnoX0VBwo62fjOG3JzhNKoJawi3bRqyDdINOvafr7iPrrs/T8CAwEA\nAaMyMDAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUNpx1Pc6cGA7KqEwHMmHB\nTZMA7lQwDQYJKoZIhvcNAQEFBQADggEBAMoRgH3iTG3t317viLKoY+lNMHUgHuR7\nb3mn9MidJKyYVewe6hCDIN6WY4fUojmMW9wFJWJIo0hRMNHL3n3tq8HP2j20Mxy8\nacPdfGZJa+jiBw72CrIGdobKaFduIlIEDBA1pNdZIJ+EulrtqrMesnIt92WaypIS\n8JycbIgDMCiyC0ENHEk8UWlC6429c7OZAsplMTbHME/1R4btxjkdfrYZJjdJ2yL2\n8cjZDUDMCPTdW/ycP07Gkq30RB5tACB5aZdaCn2YaKC8FsEdhff4X7xEOfOEHWEq\nSRxADDj8Lx1MT6QpR07hCiDyHfTCtbqzI0iGjX63Oh7xXSa0f+JVTa8=\n-----END CERTIFICATE-----\n", - } - th.AssertDeepEquals(t, expected, cm) -} - -func TestDeleteCert(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDeleteCertResponse(t, lbID, certID) - - err := DeleteCert(client.ServiceClient(), lbID, certID).ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/throttle/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/throttle/requests_test.go deleted file mode 100644 index 6e9703ffce..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/throttle/requests_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package throttle - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -const lbID = 12345 - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockCreateResponse(t, lbID) - - opts := CreateOpts{MaxConnections: 200} - err := Create(client.ServiceClient(), lbID, opts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockGetResponse(t, lbID) - - sp, err := Get(client.ServiceClient(), lbID).Extract() - th.AssertNoErr(t, err) - - expected := &ConnectionThrottle{MaxConnections: 100} - th.AssertDeepEquals(t, expected, sp) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDeleteResponse(t, lbID) - - err := Delete(client.ServiceClient(), lbID).ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/vips/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/vips/requests_test.go deleted file mode 100644 index 74ac461738..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/lb/v1/vips/requests_test.go +++ /dev/null @@ -1,87 +0,0 @@ -package vips - -import ( - "testing" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" -) - -const ( - lbID = 12345 - vipID = 67890 - vipID2 = 67891 -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockListResponse(t, lbID) - - count := 0 - - err := List(client.ServiceClient(), lbID).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractVIPs(page) - th.AssertNoErr(t, err) - - expected := []VIP{ - VIP{ID: 1000, Address: "206.10.10.210", Type: "PUBLIC"}, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - th.AssertNoErr(t, err) - th.AssertEquals(t, 1, count) -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockCreateResponse(t, lbID) - - opts := CreateOpts{ - Type: "PUBLIC", - Version: "IPV6", - } - - vip, err := Create(client.ServiceClient(), lbID, opts).Extract() - th.AssertNoErr(t, err) - - expected := &VIP{ - Address: "fd24:f480:ce44:91bc:1af2:15ff:0000:0002", - ID: 9000134, - Type: "PUBLIC", - Version: "IPV6", - } - - th.CheckDeepEquals(t, expected, vip) -} - -func TestBulkDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - ids := []int{vipID, vipID2} - - mockBatchDeleteResponse(t, lbID, ids) - - err := BulkDelete(client.ServiceClient(), lbID, ids).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - mockDeleteResponse(t, lbID, vipID) - - err := Delete(client.ServiceClient(), lbID, vipID).ExtractErr() - th.AssertNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/networks/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/networks/delegate_test.go deleted file mode 100644 index 0b3a6b15eb..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/networks/delegate_test.go +++ /dev/null @@ -1,285 +0,0 @@ -package networks - -import ( - "fmt" - "net/http" - "testing" - - os "github.com/rackspace/gophercloud/openstack/networking/v2/networks" - "github.com/rackspace/gophercloud/pagination" - fake "github.com/rackspace/gophercloud/rackspace/networking/v2/common" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/networks", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "networks": [ - { - "status": "ACTIVE", - "subnets": [ - "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" - ], - "name": "private-network", - "admin_state_up": true, - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "shared": true, - "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22" - }, - { - "status": "ACTIVE", - "subnets": [ - "08eae331-0402-425a-923c-34f7cfe39c1b" - ], - "name": "private", - "admin_state_up": true, - "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e", - "shared": true, - "id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324" - } - ] -} - `) - }) - - client := fake.ServiceClient() - count := 0 - - List(client, os.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := os.ExtractNetworks(page) - if err != nil { - t.Errorf("Failed to extract networks: %v", err) - return false, err - } - - expected := []os.Network{ - os.Network{ - Status: "ACTIVE", - Subnets: []string{"54d6f61d-db07-451c-9ab3-b9609b6b6f0b"}, - Name: "private-network", - AdminStateUp: true, - TenantID: "4fd44f30292945e481c7b8a0c8908869", - Shared: true, - ID: "d32019d3-bc6e-4319-9c1d-6722fc136a22", - }, - os.Network{ - Status: "ACTIVE", - Subnets: []string{"08eae331-0402-425a-923c-34f7cfe39c1b"}, - Name: "private", - AdminStateUp: true, - TenantID: "26a7980765d0414dbc1fc1f88cdb7e6e", - Shared: true, - ID: "db193ab3-96e3-4cb3-8fc5-05f4296d0324", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/networks/d32019d3-bc6e-4319-9c1d-6722fc136a22", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "network": { - "status": "ACTIVE", - "subnets": [ - "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" - ], - "name": "private-network", - "admin_state_up": true, - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "shared": true, - "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22" - } -} - `) - }) - - n, err := Get(fake.ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.Status, "ACTIVE") - th.AssertDeepEquals(t, n.Subnets, []string{"54d6f61d-db07-451c-9ab3-b9609b6b6f0b"}) - th.AssertEquals(t, n.Name, "private-network") - th.AssertEquals(t, n.AdminStateUp, true) - th.AssertEquals(t, n.TenantID, "4fd44f30292945e481c7b8a0c8908869") - th.AssertEquals(t, n.Shared, true) - th.AssertEquals(t, n.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/networks", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "network": { - "name": "sample_network", - "admin_state_up": true - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "network": { - "status": "ACTIVE", - "subnets": [], - "name": "net1", - "admin_state_up": true, - "tenant_id": "9bacb3c5d39d41a79512987f338cf177", - "shared": false, - "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c" - } -} - `) - }) - - iTrue := true - options := os.CreateOpts{Name: "sample_network", AdminStateUp: &iTrue} - n, err := Create(fake.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.Status, "ACTIVE") - th.AssertDeepEquals(t, n.Subnets, []string{}) - th.AssertEquals(t, n.Name, "net1") - th.AssertEquals(t, n.AdminStateUp, true) - th.AssertEquals(t, n.TenantID, "9bacb3c5d39d41a79512987f338cf177") - th.AssertEquals(t, n.Shared, false) - th.AssertEquals(t, n.ID, "4e8e5957-649f-477b-9e5b-f1f75b21c03c") -} - -func TestCreateWithOptionalFields(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/networks", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "network": { - "name": "sample_network", - "admin_state_up": true, - "shared": true, - "tenant_id": "12345" - } -} - `) - w.WriteHeader(http.StatusCreated) - fmt.Fprintf(w, ` -{ - "network": { - "name": "sample_network", - "admin_state_up": true, - "shared": true, - "tenant_id": "12345" - } -} - `) - }) - - iTrue := true - options := os.CreateOpts{Name: "sample_network", AdminStateUp: &iTrue, Shared: &iTrue, TenantID: "12345"} - _, err := Create(fake.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/networks/4e8e5957-649f-477b-9e5b-f1f75b21c03c", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "network": { - "name": "new_network_name", - "admin_state_up": false, - "shared": true - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "network": { - "status": "ACTIVE", - "subnets": [], - "name": "new_network_name", - "admin_state_up": false, - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "shared": true, - "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c" - } -} - `) - }) - - iTrue := true - options := os.UpdateOpts{Name: "new_network_name", AdminStateUp: os.Down, Shared: &iTrue} - n, err := Update(fake.ServiceClient(), "4e8e5957-649f-477b-9e5b-f1f75b21c03c", options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.Name, "new_network_name") - th.AssertEquals(t, n.AdminStateUp, false) - th.AssertEquals(t, n.Shared, true) - th.AssertEquals(t, n.ID, "4e8e5957-649f-477b-9e5b-f1f75b21c03c") -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/networks/4e8e5957-649f-477b-9e5b-f1f75b21c03c", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "4e8e5957-649f-477b-9e5b-f1f75b21c03c") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/ports/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/ports/delegate_test.go deleted file mode 100644 index f53ff595a0..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/ports/delegate_test.go +++ /dev/null @@ -1,322 +0,0 @@ -package ports - -import ( - "fmt" - "net/http" - "testing" - - os "github.com/rackspace/gophercloud/openstack/networking/v2/ports" - "github.com/rackspace/gophercloud/pagination" - fake "github.com/rackspace/gophercloud/rackspace/networking/v2/common" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/ports", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "ports": [ - { - "status": "ACTIVE", - "binding:host_id": "devstack", - "name": "", - "admin_state_up": true, - "network_id": "70c1db1f-b701-45bd-96e0-a313ee3430b3", - "tenant_id": "", - "device_owner": "network:router_gateway", - "mac_address": "fa:16:3e:58:42:ed", - "fixed_ips": [ - { - "subnet_id": "008ba151-0b8c-4a67-98b5-0d2b87666062", - "ip_address": "172.24.4.2" - } - ], - "id": "d80b1a3b-4fc1-49f3-952e-1e2ab7081d8b", - "security_groups": [], - "device_id": "9ae135f4-b6e0-4dad-9e91-3c223e385824" - } - ] -} - `) - }) - - count := 0 - - List(fake.ServiceClient(), os.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := os.ExtractPorts(page) - if err != nil { - t.Errorf("Failed to extract subnets: %v", err) - return false, nil - } - - expected := []os.Port{ - os.Port{ - Status: "ACTIVE", - Name: "", - AdminStateUp: true, - NetworkID: "70c1db1f-b701-45bd-96e0-a313ee3430b3", - TenantID: "", - DeviceOwner: "network:router_gateway", - MACAddress: "fa:16:3e:58:42:ed", - FixedIPs: []os.IP{ - os.IP{ - SubnetID: "008ba151-0b8c-4a67-98b5-0d2b87666062", - IPAddress: "172.24.4.2", - }, - }, - ID: "d80b1a3b-4fc1-49f3-952e-1e2ab7081d8b", - SecurityGroups: []string{}, - DeviceID: "9ae135f4-b6e0-4dad-9e91-3c223e385824", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/ports/46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "port": { - "status": "ACTIVE", - "name": "", - "admin_state_up": true, - "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", - "tenant_id": "7e02058126cc4950b75f9970368ba177", - "device_owner": "network:router_interface", - "mac_address": "fa:16:3e:23:fd:d7", - "fixed_ips": [ - { - "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2", - "ip_address": "10.0.0.1" - } - ], - "id": "46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2", - "security_groups": [], - "device_id": "5e3898d7-11be-483e-9732-b2f5eccd2b2e" - } -} - `) - }) - - n, err := Get(fake.ServiceClient(), "46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.Status, "ACTIVE") - th.AssertEquals(t, n.Name, "") - th.AssertEquals(t, n.AdminStateUp, true) - th.AssertEquals(t, n.NetworkID, "a87cc70a-3e15-4acf-8205-9b711a3531b7") - th.AssertEquals(t, n.TenantID, "7e02058126cc4950b75f9970368ba177") - th.AssertEquals(t, n.DeviceOwner, "network:router_interface") - th.AssertEquals(t, n.MACAddress, "fa:16:3e:23:fd:d7") - th.AssertDeepEquals(t, n.FixedIPs, []os.IP{ - os.IP{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.1"}, - }) - th.AssertEquals(t, n.ID, "46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2") - th.AssertDeepEquals(t, n.SecurityGroups, []string{}) - th.AssertEquals(t, n.Status, "ACTIVE") - th.AssertEquals(t, n.DeviceID, "5e3898d7-11be-483e-9732-b2f5eccd2b2e") -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/ports", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "port": { - "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", - "name": "private-port", - "admin_state_up": true, - "fixed_ips": [ - { - "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2", - "ip_address": "10.0.0.2" - } - ], - "security_groups": ["foo"] - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "port": { - "status": "DOWN", - "name": "private-port", - "allowed_address_pairs": [], - "admin_state_up": true, - "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", - "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa", - "device_owner": "", - "mac_address": "fa:16:3e:c9:cb:f0", - "fixed_ips": [ - { - "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2", - "ip_address": "10.0.0.2" - } - ], - "id": "65c0ee9f-d634-4522-8954-51021b570b0d", - "security_groups": [ - "f0ac4394-7e4a-4409-9701-ba8be283dbc3" - ], - "device_id": "" - } -} - `) - }) - - asu := true - options := os.CreateOpts{ - Name: "private-port", - AdminStateUp: &asu, - NetworkID: "a87cc70a-3e15-4acf-8205-9b711a3531b7", - FixedIPs: []os.IP{ - os.IP{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.2"}, - }, - SecurityGroups: []string{"foo"}, - } - n, err := Create(fake.ServiceClient(), options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, n.Status, "DOWN") - th.AssertEquals(t, n.Name, "private-port") - th.AssertEquals(t, n.AdminStateUp, true) - th.AssertEquals(t, n.NetworkID, "a87cc70a-3e15-4acf-8205-9b711a3531b7") - th.AssertEquals(t, n.TenantID, "d6700c0c9ffa4f1cb322cd4a1f3906fa") - th.AssertEquals(t, n.DeviceOwner, "") - th.AssertEquals(t, n.MACAddress, "fa:16:3e:c9:cb:f0") - th.AssertDeepEquals(t, n.FixedIPs, []os.IP{ - os.IP{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.2"}, - }) - th.AssertEquals(t, n.ID, "65c0ee9f-d634-4522-8954-51021b570b0d") - th.AssertDeepEquals(t, n.SecurityGroups, []string{"f0ac4394-7e4a-4409-9701-ba8be283dbc3"}) -} - -func TestRequiredCreateOpts(t *testing.T) { - res := Create(fake.ServiceClient(), os.CreateOpts{}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/ports/65c0ee9f-d634-4522-8954-51021b570b0d", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "port": { - "name": "new_port_name", - "fixed_ips": [ - { - "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2", - "ip_address": "10.0.0.3" - } - ], - "security_groups": [ - "f0ac4394-7e4a-4409-9701-ba8be283dbc3" - ] - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "port": { - "status": "DOWN", - "name": "new_port_name", - "admin_state_up": true, - "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", - "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa", - "device_owner": "", - "mac_address": "fa:16:3e:c9:cb:f0", - "fixed_ips": [ - { - "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2", - "ip_address": "10.0.0.3" - } - ], - "id": "65c0ee9f-d634-4522-8954-51021b570b0d", - "security_groups": [ - "f0ac4394-7e4a-4409-9701-ba8be283dbc3" - ], - "device_id": "" - } -} - `) - }) - - options := os.UpdateOpts{ - Name: "new_port_name", - FixedIPs: []os.IP{ - os.IP{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.3"}, - }, - SecurityGroups: []string{"f0ac4394-7e4a-4409-9701-ba8be283dbc3"}, - } - - s, err := Update(fake.ServiceClient(), "65c0ee9f-d634-4522-8954-51021b570b0d", options).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, s.Name, "new_port_name") - th.AssertDeepEquals(t, s.FixedIPs, []os.IP{ - os.IP{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.3"}, - }) - th.AssertDeepEquals(t, s.SecurityGroups, []string{"f0ac4394-7e4a-4409-9701-ba8be283dbc3"}) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/ports/65c0ee9f-d634-4522-8954-51021b570b0d", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "65c0ee9f-d634-4522-8954-51021b570b0d") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/security/groups/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/security/groups/delegate_test.go deleted file mode 100644 index 45cd3ba8d4..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/security/groups/delegate_test.go +++ /dev/null @@ -1,206 +0,0 @@ -package groups - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - osGroups "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/groups" - osRules "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/rules" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/security-groups", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` - { - "security_groups": [ - { - "description": "default", - "id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "name": "default", - "security_group_rules": [], - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - } - ] - } - `) - }) - - count := 0 - - List(fake.ServiceClient(), osGroups.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := osGroups.ExtractGroups(page) - if err != nil { - t.Errorf("Failed to extract secgroups: %v", err) - return false, err - } - - expected := []osGroups.SecGroup{ - osGroups.SecGroup{ - Description: "default", - ID: "85cc3048-abc3-43cc-89b3-377341426ac5", - Name: "default", - Rules: []osRules.SecGroupRule{}, - TenantID: "e4f50856753b4dc6afee5fa6b9b6c550", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/security-groups", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` - { - "security_group": { - "name": "new-webservers", - "description": "security group for webservers" - } - } - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` - { - "security_group": { - "description": "security group for webservers", - "id": "2076db17-a522-4506-91de-c6dd8e837028", - "name": "new-webservers", - "security_group_rules": [ - { - "direction": "egress", - "ethertype": "IPv4", - "id": "38ce2d8e-e8f1-48bd-83c2-d33cb9f50c3d", - "port_range_max": null, - "port_range_min": null, - "protocol": null, - "remote_group_id": null, - "remote_ip_prefix": null, - "security_group_id": "2076db17-a522-4506-91de-c6dd8e837028", - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - }, - { - "direction": "egress", - "ethertype": "IPv6", - "id": "565b9502-12de-4ffd-91e9-68885cff6ae1", - "port_range_max": null, - "port_range_min": null, - "protocol": null, - "remote_group_id": null, - "remote_ip_prefix": null, - "security_group_id": "2076db17-a522-4506-91de-c6dd8e837028", - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - } - ], - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - } - } - `) - }) - - opts := osGroups.CreateOpts{Name: "new-webservers", Description: "security group for webservers"} - _, err := Create(fake.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/security-groups/85cc3048-abc3-43cc-89b3-377341426ac5", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` - { - "security_group": { - "description": "default", - "id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "name": "default", - "security_group_rules": [ - { - "direction": "egress", - "ethertype": "IPv6", - "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff", - "port_range_max": null, - "port_range_min": null, - "protocol": null, - "remote_group_id": null, - "remote_ip_prefix": null, - "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - }, - { - "direction": "egress", - "ethertype": "IPv4", - "id": "93aa42e5-80db-4581-9391-3a608bd0e448", - "port_range_max": null, - "port_range_min": null, - "protocol": null, - "remote_group_id": null, - "remote_ip_prefix": null, - "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - } - ], - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - } - } - `) - }) - - sg, err := Get(fake.ServiceClient(), "85cc3048-abc3-43cc-89b3-377341426ac5").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "default", sg.Description) - th.AssertEquals(t, "85cc3048-abc3-43cc-89b3-377341426ac5", sg.ID) - th.AssertEquals(t, "default", sg.Name) - th.AssertEquals(t, 2, len(sg.Rules)) - th.AssertEquals(t, "e4f50856753b4dc6afee5fa6b9b6c550", sg.TenantID) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/security-groups/4ec89087-d057-4e2c-911f-60a3b47ee304", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "4ec89087-d057-4e2c-911f-60a3b47ee304") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/security/rules/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/security/rules/delegate_test.go deleted file mode 100644 index 3563fbeaa6..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/security/rules/delegate_test.go +++ /dev/null @@ -1,236 +0,0 @@ -package rules - -import ( - "fmt" - "net/http" - "testing" - - fake "github.com/rackspace/gophercloud/openstack/networking/v2/common" - osRules "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/rules" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/security-group-rules", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` - { - "security_group_rules": [ - { - "direction": "egress", - "ethertype": "IPv6", - "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff", - "port_range_max": null, - "port_range_min": null, - "protocol": null, - "remote_group_id": null, - "remote_ip_prefix": null, - "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - }, - { - "direction": "egress", - "ethertype": "IPv4", - "id": "93aa42e5-80db-4581-9391-3a608bd0e448", - "port_range_max": null, - "port_range_min": null, - "protocol": null, - "remote_group_id": null, - "remote_ip_prefix": null, - "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - } - ] - } - `) - }) - - count := 0 - - List(fake.ServiceClient(), osRules.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := osRules.ExtractRules(page) - if err != nil { - t.Errorf("Failed to extract secrules: %v", err) - return false, err - } - - expected := []osRules.SecGroupRule{ - osRules.SecGroupRule{ - Direction: "egress", - EtherType: "IPv6", - ID: "3c0e45ff-adaf-4124-b083-bf390e5482ff", - PortRangeMax: 0, - PortRangeMin: 0, - Protocol: "", - RemoteGroupID: "", - RemoteIPPrefix: "", - SecGroupID: "85cc3048-abc3-43cc-89b3-377341426ac5", - TenantID: "e4f50856753b4dc6afee5fa6b9b6c550", - }, - osRules.SecGroupRule{ - Direction: "egress", - EtherType: "IPv4", - ID: "93aa42e5-80db-4581-9391-3a608bd0e448", - PortRangeMax: 0, - PortRangeMin: 0, - Protocol: "", - RemoteGroupID: "", - RemoteIPPrefix: "", - SecGroupID: "85cc3048-abc3-43cc-89b3-377341426ac5", - TenantID: "e4f50856753b4dc6afee5fa6b9b6c550", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/security-group-rules", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` - { - "security_group_rule": { - "direction": "ingress", - "port_range_min": 80, - "ethertype": "IPv4", - "port_range_max": 80, - "protocol": "tcp", - "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "security_group_id": "a7734e61-b545-452d-a3cd-0189cbd9747a" - } - } - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` - { - "security_group_rule": { - "direction": "ingress", - "ethertype": "IPv4", - "id": "2bc0accf-312e-429a-956e-e4407625eb62", - "port_range_max": 80, - "port_range_min": 80, - "protocol": "tcp", - "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "remote_ip_prefix": null, - "security_group_id": "a7734e61-b545-452d-a3cd-0189cbd9747a", - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - } - } - `) - }) - - opts := osRules.CreateOpts{ - Direction: "ingress", - PortRangeMin: 80, - EtherType: "IPv4", - PortRangeMax: 80, - Protocol: "tcp", - RemoteGroupID: "85cc3048-abc3-43cc-89b3-377341426ac5", - SecGroupID: "a7734e61-b545-452d-a3cd-0189cbd9747a", - } - _, err := Create(fake.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) -} - -func TestRequiredCreateOpts(t *testing.T) { - res := Create(fake.ServiceClient(), osRules.CreateOpts{Direction: "something"}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } - res = Create(fake.ServiceClient(), osRules.CreateOpts{Direction: osRules.DirIngress, EtherType: "something"}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } - res = Create(fake.ServiceClient(), osRules.CreateOpts{Direction: osRules.DirIngress, EtherType: osRules.Ether4}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } - res = Create(fake.ServiceClient(), osRules.CreateOpts{Direction: osRules.DirIngress, EtherType: osRules.Ether4, SecGroupID: "something", Protocol: "foo"}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/security-group-rules/3c0e45ff-adaf-4124-b083-bf390e5482ff", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` - { - "security_group_rule": { - "direction": "egress", - "ethertype": "IPv6", - "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff", - "port_range_max": null, - "port_range_min": null, - "protocol": null, - "remote_group_id": null, - "remote_ip_prefix": null, - "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", - "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" - } - } - `) - }) - - sr, err := Get(fake.ServiceClient(), "3c0e45ff-adaf-4124-b083-bf390e5482ff").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, "egress", sr.Direction) - th.AssertEquals(t, "IPv6", sr.EtherType) - th.AssertEquals(t, "3c0e45ff-adaf-4124-b083-bf390e5482ff", sr.ID) - th.AssertEquals(t, 0, sr.PortRangeMax) - th.AssertEquals(t, 0, sr.PortRangeMin) - th.AssertEquals(t, "", sr.Protocol) - th.AssertEquals(t, "", sr.RemoteGroupID) - th.AssertEquals(t, "", sr.RemoteIPPrefix) - th.AssertEquals(t, "85cc3048-abc3-43cc-89b3-377341426ac5", sr.SecGroupID) - th.AssertEquals(t, "e4f50856753b4dc6afee5fa6b9b6c550", sr.TenantID) -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/v2.0/security-group-rules/4ec89087-d057-4e2c-911f-60a3b47ee304", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "4ec89087-d057-4e2c-911f-60a3b47ee304") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/subnets/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/subnets/delegate_test.go deleted file mode 100644 index fafc6fb302..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/networking/v2/subnets/delegate_test.go +++ /dev/null @@ -1,363 +0,0 @@ -package subnets - -import ( - "fmt" - "net/http" - "testing" - - os "github.com/rackspace/gophercloud/openstack/networking/v2/subnets" - "github.com/rackspace/gophercloud/pagination" - fake "github.com/rackspace/gophercloud/rackspace/networking/v2/common" - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/subnets", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "subnets": [ - { - "name": "private-subnet", - "enable_dhcp": true, - "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324", - "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e", - "dns_nameservers": [], - "allocation_pools": [ - { - "start": "10.0.0.2", - "end": "10.0.0.254" - } - ], - "host_routes": [], - "ip_version": 4, - "gateway_ip": "10.0.0.1", - "cidr": "10.0.0.0/24", - "id": "08eae331-0402-425a-923c-34f7cfe39c1b" - }, - { - "name": "my_subnet", - "enable_dhcp": true, - "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "dns_nameservers": [], - "allocation_pools": [ - { - "start": "192.0.0.2", - "end": "192.255.255.254" - } - ], - "host_routes": [], - "ip_version": 4, - "gateway_ip": "192.0.0.1", - "cidr": "192.0.0.0/8", - "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" - } - ] -} - `) - }) - - count := 0 - - List(fake.ServiceClient(), os.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := os.ExtractSubnets(page) - if err != nil { - t.Errorf("Failed to extract subnets: %v", err) - return false, nil - } - - expected := []os.Subnet{ - os.Subnet{ - Name: "private-subnet", - EnableDHCP: true, - NetworkID: "db193ab3-96e3-4cb3-8fc5-05f4296d0324", - TenantID: "26a7980765d0414dbc1fc1f88cdb7e6e", - DNSNameservers: []string{}, - AllocationPools: []os.AllocationPool{ - os.AllocationPool{ - Start: "10.0.0.2", - End: "10.0.0.254", - }, - }, - HostRoutes: []os.HostRoute{}, - IPVersion: 4, - GatewayIP: "10.0.0.1", - CIDR: "10.0.0.0/24", - ID: "08eae331-0402-425a-923c-34f7cfe39c1b", - }, - os.Subnet{ - Name: "my_subnet", - EnableDHCP: true, - NetworkID: "d32019d3-bc6e-4319-9c1d-6722fc136a22", - TenantID: "4fd44f30292945e481c7b8a0c8908869", - DNSNameservers: []string{}, - AllocationPools: []os.AllocationPool{ - os.AllocationPool{ - Start: "192.0.0.2", - End: "192.255.255.254", - }, - }, - HostRoutes: []os.HostRoute{}, - IPVersion: 4, - GatewayIP: "192.0.0.1", - CIDR: "192.0.0.0/8", - ID: "54d6f61d-db07-451c-9ab3-b9609b6b6f0b", - }, - } - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - - if count != 1 { - t.Errorf("Expected 1 page, got %d", count) - } -} - -func TestGet(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/subnets/54d6f61d-db07-451c-9ab3-b9609b6b6f0b", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - fmt.Fprintf(w, ` -{ - "subnet": { - "name": "my_subnet", - "enable_dhcp": true, - "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "dns_nameservers": [], - "allocation_pools": [ - { - "start": "192.0.0.2", - "end": "192.255.255.254" - } - ], - "host_routes": [], - "ip_version": 4, - "gateway_ip": "192.0.0.1", - "cidr": "192.0.0.0/8", - "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" - } -} - `) - }) - - s, err := Get(fake.ServiceClient(), "54d6f61d-db07-451c-9ab3-b9609b6b6f0b").Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, s.Name, "my_subnet") - th.AssertEquals(t, s.EnableDHCP, true) - th.AssertEquals(t, s.NetworkID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") - th.AssertEquals(t, s.TenantID, "4fd44f30292945e481c7b8a0c8908869") - th.AssertDeepEquals(t, s.DNSNameservers, []string{}) - th.AssertDeepEquals(t, s.AllocationPools, []os.AllocationPool{ - os.AllocationPool{ - Start: "192.0.0.2", - End: "192.255.255.254", - }, - }) - th.AssertDeepEquals(t, s.HostRoutes, []os.HostRoute{}) - th.AssertEquals(t, s.IPVersion, 4) - th.AssertEquals(t, s.GatewayIP, "192.0.0.1") - th.AssertEquals(t, s.CIDR, "192.0.0.0/8") - th.AssertEquals(t, s.ID, "54d6f61d-db07-451c-9ab3-b9609b6b6f0b") -} - -func TestCreate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/subnets", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "subnet": { - "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", - "ip_version": 4, - "cidr": "192.168.199.0/24", - "dns_nameservers": ["foo"], - "allocation_pools": [ - { - "start": "192.168.199.2", - "end": "192.168.199.254" - } - ], - "host_routes": [{"destination":"","nexthop": "bar"}] - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "subnet": { - "name": "", - "enable_dhcp": true, - "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", - "tenant_id": "4fd44f30292945e481c7b8a0c8908869", - "dns_nameservers": [], - "allocation_pools": [ - { - "start": "192.168.199.2", - "end": "192.168.199.254" - } - ], - "host_routes": [], - "ip_version": 4, - "gateway_ip": "192.168.199.1", - "cidr": "192.168.199.0/24", - "id": "3b80198d-4f7b-4f77-9ef5-774d54e17126" - } -} - `) - }) - - opts := os.CreateOpts{ - NetworkID: "d32019d3-bc6e-4319-9c1d-6722fc136a22", - IPVersion: 4, - CIDR: "192.168.199.0/24", - AllocationPools: []os.AllocationPool{ - os.AllocationPool{ - Start: "192.168.199.2", - End: "192.168.199.254", - }, - }, - DNSNameservers: []string{"foo"}, - HostRoutes: []os.HostRoute{ - os.HostRoute{NextHop: "bar"}, - }, - } - s, err := Create(fake.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, s.Name, "") - th.AssertEquals(t, s.EnableDHCP, true) - th.AssertEquals(t, s.NetworkID, "d32019d3-bc6e-4319-9c1d-6722fc136a22") - th.AssertEquals(t, s.TenantID, "4fd44f30292945e481c7b8a0c8908869") - th.AssertDeepEquals(t, s.DNSNameservers, []string{}) - th.AssertDeepEquals(t, s.AllocationPools, []os.AllocationPool{ - os.AllocationPool{ - Start: "192.168.199.2", - End: "192.168.199.254", - }, - }) - th.AssertDeepEquals(t, s.HostRoutes, []os.HostRoute{}) - th.AssertEquals(t, s.IPVersion, 4) - th.AssertEquals(t, s.GatewayIP, "192.168.199.1") - th.AssertEquals(t, s.CIDR, "192.168.199.0/24") - th.AssertEquals(t, s.ID, "3b80198d-4f7b-4f77-9ef5-774d54e17126") -} - -func TestRequiredCreateOpts(t *testing.T) { - res := Create(fake.ServiceClient(), os.CreateOpts{}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } - - res = Create(fake.ServiceClient(), os.CreateOpts{NetworkID: "foo"}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } - - res = Create(fake.ServiceClient(), os.CreateOpts{NetworkID: "foo", CIDR: "bar", IPVersion: 40}) - if res.Err == nil { - t.Fatalf("Expected error, got none") - } -} - -func TestUpdate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/subnets/08eae331-0402-425a-923c-34f7cfe39c1b", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Content-Type", "application/json") - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` -{ - "subnet": { - "name": "my_new_subnet", - "dns_nameservers": ["foo"], - "host_routes": [{"destination":"","nexthop": "bar"}] - } -} - `) - - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - - fmt.Fprintf(w, ` -{ - "subnet": { - "name": "my_new_subnet", - "enable_dhcp": true, - "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324", - "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e", - "dns_nameservers": [], - "allocation_pools": [ - { - "start": "10.0.0.2", - "end": "10.0.0.254" - } - ], - "host_routes": [], - "ip_version": 4, - "gateway_ip": "10.0.0.1", - "cidr": "10.0.0.0/24", - "id": "08eae331-0402-425a-923c-34f7cfe39c1b" - } -} - `) - }) - - opts := os.UpdateOpts{ - Name: "my_new_subnet", - DNSNameservers: []string{"foo"}, - HostRoutes: []os.HostRoute{ - os.HostRoute{NextHop: "bar"}, - }, - } - s, err := Update(fake.ServiceClient(), "08eae331-0402-425a-923c-34f7cfe39c1b", opts).Extract() - th.AssertNoErr(t, err) - - th.AssertEquals(t, s.Name, "my_new_subnet") - th.AssertEquals(t, s.ID, "08eae331-0402-425a-923c-34f7cfe39c1b") -} - -func TestDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - th.Mux.HandleFunc("/subnets/08eae331-0402-425a-923c-34f7cfe39c1b", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - w.WriteHeader(http.StatusNoContent) - }) - - res := Delete(fake.ServiceClient(), "08eae331-0402-425a-923c-34f7cfe39c1b") - th.AssertNoErr(t, res.Err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/accounts/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/accounts/delegate_test.go deleted file mode 100644 index a1ea98bb70..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/accounts/delegate_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package accounts - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/objectstorage/v1/accounts" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestUpdateAccounts(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.HandleUpdateAccountSuccessfully(t) - - options := &UpdateOpts{Metadata: map[string]string{"gophercloud-test": "accounts"}} - res := Update(fake.ServiceClient(), options) - th.CheckNoErr(t, res.Err) -} - -func TestGetAccounts(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - os.HandleGetAccountSuccessfully(t) - - expected := map[string]string{"Foo": "bar"} - actual, err := Get(fake.ServiceClient()).ExtractMetadata() - th.CheckNoErr(t, err) - th.CheckDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/bulk/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/bulk/requests_test.go deleted file mode 100644 index 8b5578e91e..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/bulk/requests_test.go +++ /dev/null @@ -1,36 +0,0 @@ -package bulk - -import ( - "fmt" - "net/http" - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestBulkDelete(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.AssertEquals(t, r.URL.RawQuery, "bulk-delete") - - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, ` - { - "Number Not Found": 1, - "Response Status": "200 OK", - "Errors": [], - "Number Deleted": 1, - "Response Body": "" - } - `) - }) - - options := DeleteOpts{"gophercloud-testcontainer1", "gophercloud-testcontainer2"} - actual, err := Delete(fake.ServiceClient(), options).ExtractBody() - th.AssertNoErr(t, err) - th.AssertEquals(t, actual.NumberDeleted, 1) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/bulk/urls_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/bulk/urls_test.go deleted file mode 100644 index 9169e52f16..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/bulk/urls_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package bulk - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909/" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestDeleteURL(t *testing.T) { - actual := deleteURL(endpointClient()) - expected := endpoint + "?bulk-delete" - th.CheckEquals(t, expected, actual) -} - -func TestExtractURL(t *testing.T) { - actual := extractURL(endpointClient(), "tar") - expected := endpoint + "?extract-archive=tar" - th.CheckEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdncontainers/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdncontainers/delegate_test.go deleted file mode 100644 index 02c3c5e150..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdncontainers/delegate_test.go +++ /dev/null @@ -1,50 +0,0 @@ -package cdncontainers - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListCDNContainers(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleListContainerNamesSuccessfully(t) - - count := 0 - err := List(fake.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractNames(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, os.ExpectedListNames, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestGetCDNContainer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleGetContainerSuccessfully(t) - - _, err := Get(fake.ServiceClient(), "testContainer").ExtractMetadata() - th.CheckNoErr(t, err) - -} - -func TestUpdateCDNContainer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleUpdateContainerSuccessfully(t) - - options := &UpdateOpts{TTL: 3600} - res := Update(fake.ServiceClient(), "testContainer", options) - th.CheckNoErr(t, res.Err) - -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdncontainers/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdncontainers/requests_test.go deleted file mode 100644 index 28b963dace..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdncontainers/requests_test.go +++ /dev/null @@ -1,29 +0,0 @@ -package cdncontainers - -import ( - "net/http" - "testing" - - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestEnableCDNContainer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/testContainer", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "PUT") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - - w.Header().Add("X-Ttl", "259200") - w.Header().Add("X-Cdn-Enabled", "True") - w.WriteHeader(http.StatusNoContent) - }) - - options := &EnableOpts{CDNEnabled: true, TTL: 259200} - actual := Enable(fake.ServiceClient(), "testContainer", options) - th.AssertNoErr(t, actual.Err) - th.CheckEquals(t, actual.Header["X-Ttl"][0], "259200") - th.CheckEquals(t, actual.Header["X-Cdn-Enabled"][0], "True") -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdncontainers/urls_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdncontainers/urls_test.go deleted file mode 100644 index aa5bfe68b2..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdncontainers/urls_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package cdncontainers - -import ( - "testing" - - "github.com/rackspace/gophercloud" - th "github.com/rackspace/gophercloud/testhelper" -) - -const endpoint = "http://localhost:57909/" - -func endpointClient() *gophercloud.ServiceClient { - return &gophercloud.ServiceClient{Endpoint: endpoint} -} - -func TestEnableURL(t *testing.T) { - actual := enableURL(endpointClient(), "foo") - expected := endpoint + "foo" - th.CheckEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdnobjects/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdnobjects/delegate_test.go deleted file mode 100644 index b5e04a98c3..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/cdnobjects/delegate_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package cdnobjects - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestDeleteCDNObject(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleDeleteObjectSuccessfully(t) - - res := Delete(fake.ServiceClient(), "testContainer", "testObject", nil) - th.AssertNoErr(t, res.Err) - -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/containers/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/containers/delegate_test.go deleted file mode 100644 index 7ba4eb21c6..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/containers/delegate_test.go +++ /dev/null @@ -1,91 +0,0 @@ -package containers - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListContainerInfo(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleListContainerInfoSuccessfully(t) - - count := 0 - err := List(fake.ServiceClient(), &os.ListOpts{Full: true}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractInfo(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, os.ExpectedListInfo, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestListContainerNames(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleListContainerNamesSuccessfully(t) - - count := 0 - err := List(fake.ServiceClient(), &os.ListOpts{Full: false}).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractNames(page) - if err != nil { - t.Errorf("Failed to extract container names: %v", err) - return false, err - } - - th.CheckDeepEquals(t, os.ExpectedListNames, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestCreateContainers(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleCreateContainerSuccessfully(t) - - options := os.CreateOpts{ContentType: "application/json", Metadata: map[string]string{"foo": "bar"}} - res := Create(fake.ServiceClient(), "testContainer", options) - th.CheckNoErr(t, res.Err) - th.CheckEquals(t, "bar", res.Header["X-Container-Meta-Foo"][0]) - -} - -func TestDeleteContainers(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleDeleteContainerSuccessfully(t) - - res := Delete(fake.ServiceClient(), "testContainer") - th.CheckNoErr(t, res.Err) -} - -func TestUpdateContainers(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleUpdateContainerSuccessfully(t) - - options := &os.UpdateOpts{Metadata: map[string]string{"foo": "bar"}} - res := Update(fake.ServiceClient(), "testContainer", options) - th.CheckNoErr(t, res.Err) -} - -func TestGetContainers(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleGetContainerSuccessfully(t) - - _, err := Get(fake.ServiceClient(), "testContainer").ExtractMetadata() - th.CheckNoErr(t, err) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/objects/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/objects/delegate_test.go deleted file mode 100644 index 21cd4179a5..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/objects/delegate_test.go +++ /dev/null @@ -1,127 +0,0 @@ -package objects - -import ( - "strings" - "testing" - - os "github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestDownloadObject(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleDownloadObjectSuccessfully(t) - - content, err := Download(fake.ServiceClient(), "testContainer", "testObject", nil).ExtractContent() - th.AssertNoErr(t, err) - th.CheckEquals(t, string(content), "Successful download with Gophercloud") -} - -func TestListObjectsInfo(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleListObjectsInfoSuccessfully(t) - - count := 0 - options := &os.ListOpts{Full: true} - err := List(fake.ServiceClient(), "testContainer", options).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractInfo(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, os.ExpectedListInfo, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestListObjectNames(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleListObjectNamesSuccessfully(t) - - count := 0 - options := &os.ListOpts{Full: false} - err := List(fake.ServiceClient(), "testContainer", options).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractNames(page) - if err != nil { - t.Errorf("Failed to extract container names: %v", err) - return false, err - } - - th.CheckDeepEquals(t, os.ExpectedListNames, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestCreateObject(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - content := "Did gyre and gimble in the wabe" - os.HandleCreateTextObjectSuccessfully(t, content) - - options := &os.CreateOpts{ContentType: "text/plain"} - res := Create(fake.ServiceClient(), "testContainer", "testObject", strings.NewReader(content), options) - th.AssertNoErr(t, res.Err) -} - -func TestCreateObjectWithoutContentType(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - - content := "The sky was the color of television, tuned to a dead channel." - os.HandleCreateTypelessObjectSuccessfully(t, content) - - res := Create(fake.ServiceClient(), "testContainer", "testObject", strings.NewReader(content), &os.CreateOpts{}) - th.AssertNoErr(t, res.Err) -} - -func TestCopyObject(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleCopyObjectSuccessfully(t) - - options := &CopyOpts{Destination: "/newTestContainer/newTestObject"} - res := Copy(fake.ServiceClient(), "testContainer", "testObject", options) - th.AssertNoErr(t, res.Err) -} - -func TestDeleteObject(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleDeleteObjectSuccessfully(t) - - res := Delete(fake.ServiceClient(), "testContainer", "testObject", nil) - th.AssertNoErr(t, res.Err) -} - -func TestUpdateObject(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleUpdateObjectSuccessfully(t) - - options := &os.UpdateOpts{Metadata: map[string]string{"Gophercloud-Test": "objects"}} - res := Update(fake.ServiceClient(), "testContainer", "testObject", options) - th.AssertNoErr(t, res.Err) -} - -func TestGetObject(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleGetObjectSuccessfully(t) - - expected := map[string]string{"Gophercloud-Test": "objects"} - actual, err := Get(fake.ServiceClient(), "testContainer", "testObject", nil).ExtractMetadata() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/buildinfo/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/buildinfo/delegate_test.go deleted file mode 100644 index b25a690c8d..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/buildinfo/delegate_test.go +++ /dev/null @@ -1,21 +0,0 @@ -package buildinfo - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/orchestration/v1/buildinfo" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestGetTemplate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleGetSuccessfully(t, os.GetOutput) - - actual, err := Get(fake.ServiceClient()).Extract() - th.AssertNoErr(t, err) - - expected := os.GetExpected - th.AssertDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stackevents/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stackevents/delegate_test.go deleted file mode 100644 index e1c0bc8dbc..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stackevents/delegate_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package stackevents - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/orchestration/v1/stackevents" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestFindEvents(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleFindSuccessfully(t, os.FindOutput) - - actual, err := Find(fake.ServiceClient(), "postman_stack").Extract() - th.AssertNoErr(t, err) - - expected := os.FindExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestList(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleListSuccessfully(t, os.ListOutput) - - count := 0 - err := List(fake.ServiceClient(), "hello_world", "49181cd6-169a-4130-9455-31185bbfc5bf", nil).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := os.ExtractEvents(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, os.ListExpected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestListResourceEvents(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleListResourceEventsSuccessfully(t, os.ListResourceEventsOutput) - - count := 0 - err := ListResourceEvents(fake.ServiceClient(), "hello_world", "49181cd6-169a-4130-9455-31185bbfc5bf", "my_resource", nil).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := os.ExtractEvents(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, os.ListResourceEventsExpected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestGetEvent(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleGetSuccessfully(t, os.GetOutput) - - actual, err := Get(fake.ServiceClient(), "hello_world", "49181cd6-169a-4130-9455-31185bbfc5bf", "my_resource", "93940999-7d40-44ae-8de4-19624e7b8d18").Extract() - th.AssertNoErr(t, err) - - expected := os.GetExpected - th.AssertDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stackresources/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stackresources/delegate_test.go deleted file mode 100644 index 116e44ce73..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stackresources/delegate_test.go +++ /dev/null @@ -1,108 +0,0 @@ -package stackresources - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/orchestration/v1/stackresources" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestFindResources(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleFindSuccessfully(t, os.FindOutput) - - actual, err := Find(fake.ServiceClient(), "hello_world").Extract() - th.AssertNoErr(t, err) - - expected := os.FindExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestListResources(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleListSuccessfully(t, os.ListOutput) - - count := 0 - err := List(fake.ServiceClient(), "hello_world", "49181cd6-169a-4130-9455-31185bbfc5bf", nil).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := os.ExtractResources(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, os.ListExpected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestGetResource(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleGetSuccessfully(t, os.GetOutput) - - actual, err := Get(fake.ServiceClient(), "teststack", "0b1771bd-9336-4f2b-ae86-a80f971faf1e", "wordpress_instance").Extract() - th.AssertNoErr(t, err) - - expected := os.GetExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestResourceMetadata(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleMetadataSuccessfully(t, os.MetadataOutput) - - actual, err := Metadata(fake.ServiceClient(), "teststack", "0b1771bd-9336-4f2b-ae86-a80f971faf1e", "wordpress_instance").Extract() - th.AssertNoErr(t, err) - - expected := os.MetadataExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestListResourceTypes(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleListTypesSuccessfully(t, os.ListTypesOutput) - - count := 0 - err := ListTypes(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := os.ExtractResourceTypes(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, os.ListTypesExpected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, 1, count) -} - -func TestGetResourceSchema(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleGetSchemaSuccessfully(t, os.GetSchemaOutput) - - actual, err := Schema(fake.ServiceClient(), "OS::Heat::AResourceName").Extract() - th.AssertNoErr(t, err) - - expected := os.GetSchemaExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestGetResourceTemplate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleGetTemplateSuccessfully(t, os.GetTemplateOutput) - - actual, err := Template(fake.ServiceClient(), "OS::Heat::AResourceName").Extract() - th.AssertNoErr(t, err) - - expected := os.GetTemplateExpected - th.AssertDeepEquals(t, expected, string(actual)) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stacks/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stacks/delegate_test.go deleted file mode 100644 index 553ae94042..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stacks/delegate_test.go +++ /dev/null @@ -1,870 +0,0 @@ -package stacks - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks" - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestCreateStack(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleCreateSuccessfully(t, CreateOutput) - - createOpts := os.CreateOpts{ - Name: "stackcreated", - Timeout: 60, - Template: `{ - "outputs": { - "db_host": { - "value": { - "get_attr": [ - "db", - "hostname" - ] - } - } - }, - "heat_template_version": "2014-10-16", - "description": "HEAT template for creating a Cloud Database.\n", - "parameters": { - "db_name": { - "default": "wordpress", - "type": "string", - "description": "the name for the database", - "constraints": [ - { - "length": { - "max": 64, - "min": 1 - }, - "description": "must be between 1 and 64 characters" - }, - { - "allowed_pattern": "[a-zA-Z][a-zA-Z0-9]*", - "description": "must begin with a letter and contain only alphanumeric characters." - } - ] - }, - "db_instance_name": { - "default": "Cloud_DB", - "type": "string", - "description": "the database instance name" - }, - "db_username": { - "default": "admin", - "hidden": true, - "type": "string", - "description": "database admin account username", - "constraints": [ - { - "length": { - "max": 16, - "min": 1 - }, - "description": "must be between 1 and 16 characters" - }, - { - "allowed_pattern": "[a-zA-Z][a-zA-Z0-9]*", - "description": "must begin with a letter and contain only alphanumeric characters." - } - ] - }, - "db_volume_size": { - "default": 30, - "type": "number", - "description": "database volume size (in GB)", - "constraints": [ - { - "range": { - "max": 1024, - "min": 1 - }, - "description": "must be between 1 and 1024 GB" - } - ] - }, - "db_flavor": { - "default": "1GB Instance", - "type": "string", - "description": "database instance size", - "constraints": [ - { - "description": "must be a valid cloud database flavor", - "allowed_values": [ - "1GB Instance", - "2GB Instance", - "4GB Instance", - "8GB Instance", - "16GB Instance" - ] - } - ] - }, - "db_password": { - "default": "admin", - "hidden": true, - "type": "string", - "description": "database admin account password", - "constraints": [ - { - "length": { - "max": 41, - "min": 1 - }, - "description": "must be between 1 and 14 characters" - }, - { - "allowed_pattern": "[a-zA-Z0-9]*", - "description": "must contain only alphanumeric characters." - } - ] - } - }, - "resources": { - "db": { - "type": "OS::Trove::Instance", - "properties": { - "flavor": { - "get_param": "db_flavor" - }, - "size": { - "get_param": "db_volume_size" - }, - "users": [ - { - "password": { - "get_param": "db_password" - }, - "name": { - "get_param": "db_username" - }, - "databases": [ - { - "get_param": "db_name" - } - ] - } - ], - "name": { - "get_param": "db_instance_name" - }, - "databases": [ - { - "name": { - "get_param": "db_name" - } - } - ] - } - } - } - }`, - DisableRollback: os.Disable, - } - actual, err := Create(fake.ServiceClient(), createOpts).Extract() - th.AssertNoErr(t, err) - - expected := CreateExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestCreateStackNewTemplateFormat(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleCreateSuccessfully(t, CreateOutput) - - createOpts := os.CreateOpts{ - Name: "stackcreated", - Timeout: 60, - TemplateOpts: new(os.Template), - DisableRollback: os.Disable, - } - createOpts.TemplateOpts.Bin = []byte(`{ - "outputs": { - "db_host": { - "value": { - "get_attr": [ - "db", - "hostname" - ] - } - } - }, - "heat_template_version": "2014-10-16", - "description": "HEAT template for creating a Cloud Database.\n", - "parameters": { - "db_name": { - "default": "wordpress", - "type": "string", - "description": "the name for the database", - "constraints": [ - { - "length": { - "max": 64, - "min": 1 - }, - "description": "must be between 1 and 64 characters" - }, - { - "allowed_pattern": "[a-zA-Z][a-zA-Z0-9]*", - "description": "must begin with a letter and contain only alphanumeric characters." - } - ] - }, - "db_instance_name": { - "default": "Cloud_DB", - "type": "string", - "description": "the database instance name" - }, - "db_username": { - "default": "admin", - "hidden": true, - "type": "string", - "description": "database admin account username", - "constraints": [ - { - "length": { - "max": 16, - "min": 1 - }, - "description": "must be between 1 and 16 characters" - }, - { - "allowed_pattern": "[a-zA-Z][a-zA-Z0-9]*", - "description": "must begin with a letter and contain only alphanumeric characters." - } - ] - }, - "db_volume_size": { - "default": 30, - "type": "number", - "description": "database volume size (in GB)", - "constraints": [ - { - "range": { - "max": 1024, - "min": 1 - }, - "description": "must be between 1 and 1024 GB" - } - ] - }, - "db_flavor": { - "default": "1GB Instance", - "type": "string", - "description": "database instance size", - "constraints": [ - { - "description": "must be a valid cloud database flavor", - "allowed_values": [ - "1GB Instance", - "2GB Instance", - "4GB Instance", - "8GB Instance", - "16GB Instance" - ] - } - ] - }, - "db_password": { - "default": "admin", - "hidden": true, - "type": "string", - "description": "database admin account password", - "constraints": [ - { - "length": { - "max": 41, - "min": 1 - }, - "description": "must be between 1 and 14 characters" - }, - { - "allowed_pattern": "[a-zA-Z0-9]*", - "description": "must contain only alphanumeric characters." - } - ] - } - }, - "resources": { - "db": { - "type": "OS::Trove::Instance", - "properties": { - "flavor": { - "get_param": "db_flavor" - }, - "size": { - "get_param": "db_volume_size" - }, - "users": [ - { - "password": { - "get_param": "db_password" - }, - "name": { - "get_param": "db_username" - }, - "databases": [ - { - "get_param": "db_name" - } - ] - } - ], - "name": { - "get_param": "db_instance_name" - }, - "databases": [ - { - "name": { - "get_param": "db_name" - } - } - ] - } - } - } - }`) - actual, err := Create(fake.ServiceClient(), createOpts).Extract() - th.AssertNoErr(t, err) - - expected := CreateExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestAdoptStack(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleCreateSuccessfully(t, CreateOutput) - - adoptOpts := os.AdoptOpts{ - AdoptStackData: `{\"environment\":{\"parameters\":{}}, \"status\":\"COMPLETE\",\"name\": \"trovestack\",\n \"template\": {\n \"outputs\": {\n \"db_host\": {\n \"value\": {\n \"get_attr\": [\n \"db\",\n \"hostname\"\n ]\n }\n }\n },\n \"heat_template_version\": \"2014-10-16\",\n \"description\": \"HEAT template for creating a Cloud Database.\\n\",\n \"parameters\": {\n \"db_instance_name\": {\n \"default\": \"Cloud_DB\",\n \"type\": \"string\",\n \"description\": \"the database instance name\"\n },\n \"db_flavor\": {\n \"default\": \"1GB Instance\",\n \"type\": \"string\",\n \"description\": \"database instance size\",\n \"constraints\": [\n {\n \"description\": \"must be a valid cloud database flavor\",\n \"allowed_values\": [\n \"1GB Instance\",\n \"2GB Instance\",\n \"4GB Instance\",\n \"8GB Instance\",\n \"16GB Instance\"\n ]\n }\n ]\n },\n \"db_password\": {\n \"default\": \"admin\",\n \"hidden\": true,\n \"type\": \"string\",\n \"description\": \"database admin account password\",\n \"constraints\": [\n {\n \"length\": {\n \"max\": 41,\n \"min\": 1\n },\n \"description\": \"must be between 1 and 14 characters\"\n },\n {\n \"allowed_pattern\": \"[a-zA-Z0-9]*\",\n \"description\": \"must contain only alphanumeric characters.\"\n }\n ]\n },\n \"db_name\": {\n \"default\": \"wordpress\",\n \"type\": \"string\",\n \"description\": \"the name for the database\",\n \"constraints\": [\n {\n \"length\": {\n \"max\": 64,\n \"min\": 1\n },\n \"description\": \"must be between 1 and 64 characters\"\n },\n {\n \"allowed_pattern\": \"[a-zA-Z][a-zA-Z0-9]*\",\n \"description\": \"must begin with a letter and contain only alphanumeric characters.\"\n }\n ]\n },\n \"db_username\": {\n \"default\": \"admin\",\n \"hidden\": true,\n \"type\": \"string\",\n \"description\": \"database admin account username\",\n \"constraints\": [\n {\n \"length\": {\n \"max\": 16,\n \"min\": 1\n },\n \"description\": \"must be between 1 and 16 characters\"\n },\n {\n \"allowed_pattern\": \"[a-zA-Z][a-zA-Z0-9]*\",\n \"description\": \"must begin with a letter and contain only alphanumeric characters.\"\n }\n ]\n },\n \"db_volume_size\": {\n \"default\": 30,\n \"type\": \"number\",\n \"description\": \"database volume size (in GB)\",\n \"constraints\": [\n {\n \"range\": {\n \"max\": 1024,\n \"min\": 1\n },\n \"description\": \"must be between 1 and 1024 GB\"\n }\n ]\n }\n },\n \"resources\": {\n \"db\": {\n \"type\": \"OS::Trove::Instance\",\n \"properties\": {\n \"flavor\": {\n \"get_param\": \"db_flavor\"\n },\n \"databases\": [\n {\n \"name\": {\n \"get_param\": \"db_name\"\n }\n }\n ],\n \"users\": [\n {\n \"password\": {\n \"get_param\": \"db_password\"\n },\n \"name\": {\n \"get_param\": \"db_username\"\n },\n \"databases\": [\n {\n \"get_param\": \"db_name\"\n }\n ]\n }\n ],\n \"name\": {\n \"get_param\": \"db_instance_name\"\n },\n \"size\": {\n \"get_param\": \"db_volume_size\"\n }\n }\n }\n }\n },\n \"action\": \"CREATE\",\n \"id\": \"exxxxd-7xx5-4xxb-bxx2-cxxxxxx5\",\n \"resources\": {\n \"db\": {\n \"status\": \"COMPLETE\",\n \"name\": \"db\",\n \"resource_data\": {},\n \"resource_id\": \"exxxx2-9xx0-4xxxb-bxx2-dxxxxxx4\",\n \"action\": \"CREATE\",\n \"type\": \"OS::Trove::Instance\",\n \"metadata\": {}\n }\n }\n},`, - Name: "stackadopted", - Timeout: 60, - Template: `{ - "outputs": { - "db_host": { - "value": { - "get_attr": [ - "db", - "hostname" - ] - } - } - }, - "heat_template_version": "2014-10-16", - "description": "HEAT template for creating a Cloud Database.\n", - "parameters": { - "db_name": { - "default": "wordpress", - "type": "string", - "description": "the name for the database", - "constraints": [ - { - "length": { - "max": 64, - "min": 1 - }, - "description": "must be between 1 and 64 characters" - }, - { - "allowed_pattern": "[a-zA-Z][a-zA-Z0-9]*", - "description": "must begin with a letter and contain only alphanumeric characters." - } - ] - }, - "db_instance_name": { - "default": "Cloud_DB", - "type": "string", - "description": "the database instance name" - }, - "db_username": { - "default": "admin", - "hidden": true, - "type": "string", - "description": "database admin account username", - "constraints": [ - { - "length": { - "max": 16, - "min": 1 - }, - "description": "must be between 1 and 16 characters" - }, - { - "allowed_pattern": "[a-zA-Z][a-zA-Z0-9]*", - "description": "must begin with a letter and contain only alphanumeric characters." - } - ] - }, - "db_volume_size": { - "default": 30, - "type": "number", - "description": "database volume size (in GB)", - "constraints": [ - { - "range": { - "max": 1024, - "min": 1 - }, - "description": "must be between 1 and 1024 GB" - } - ] - }, - "db_flavor": { - "default": "1GB Instance", - "type": "string", - "description": "database instance size", - "constraints": [ - { - "description": "must be a valid cloud database flavor", - "allowed_values": [ - "1GB Instance", - "2GB Instance", - "4GB Instance", - "8GB Instance", - "16GB Instance" - ] - } - ] - }, - "db_password": { - "default": "admin", - "hidden": true, - "type": "string", - "description": "database admin account password", - "constraints": [ - { - "length": { - "max": 41, - "min": 1 - }, - "description": "must be between 1 and 14 characters" - }, - { - "allowed_pattern": "[a-zA-Z0-9]*", - "description": "must contain only alphanumeric characters." - } - ] - } - }, - "resources": { - "db": { - "type": "OS::Trove::Instance", - "properties": { - "flavor": { - "get_param": "db_flavor" - }, - "size": { - "get_param": "db_volume_size" - }, - "users": [ - { - "password": { - "get_param": "db_password" - }, - "name": { - "get_param": "db_username" - }, - "databases": [ - { - "get_param": "db_name" - } - ] - } - ], - "name": { - "get_param": "db_instance_name" - }, - "databases": [ - { - "name": { - "get_param": "db_name" - } - } - ] - } - } - } - }`, - DisableRollback: os.Disable, - } - actual, err := Adopt(fake.ServiceClient(), adoptOpts).Extract() - th.AssertNoErr(t, err) - - expected := CreateExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestAdoptStackNewTemplateFormat(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleCreateSuccessfully(t, CreateOutput) - template := new(os.Template) - template.Bin = []byte(`{ - "outputs": { - "db_host": { - "value": { - "get_attr": [ - "db", - "hostname" - ] - } - } - }, - "heat_template_version": "2014-10-16", - "description": "HEAT template for creating a Cloud Database.\n", - "parameters": { - "db_name": { - "default": "wordpress", - "type": "string", - "description": "the name for the database", - "constraints": [ - { - "length": { - "max": 64, - "min": 1 - }, - "description": "must be between 1 and 64 characters" - }, - { - "allowed_pattern": "[a-zA-Z][a-zA-Z0-9]*", - "description": "must begin with a letter and contain only alphanumeric characters." - } - ] - }, - "db_instance_name": { - "default": "Cloud_DB", - "type": "string", - "description": "the database instance name" - }, - "db_username": { - "default": "admin", - "hidden": true, - "type": "string", - "description": "database admin account username", - "constraints": [ - { - "length": { - "max": 16, - "min": 1 - }, - "description": "must be between 1 and 16 characters" - }, - { - "allowed_pattern": "[a-zA-Z][a-zA-Z0-9]*", - "description": "must begin with a letter and contain only alphanumeric characters." - } - ] - }, - "db_volume_size": { - "default": 30, - "type": "number", - "description": "database volume size (in GB)", - "constraints": [ - { - "range": { - "max": 1024, - "min": 1 - }, - "description": "must be between 1 and 1024 GB" - } - ] - }, - "db_flavor": { - "default": "1GB Instance", - "type": "string", - "description": "database instance size", - "constraints": [ - { - "description": "must be a valid cloud database flavor", - "allowed_values": [ - "1GB Instance", - "2GB Instance", - "4GB Instance", - "8GB Instance", - "16GB Instance" - ] - } - ] - }, - "db_password": { - "default": "admin", - "hidden": true, - "type": "string", - "description": "database admin account password", - "constraints": [ - { - "length": { - "max": 41, - "min": 1 - }, - "description": "must be between 1 and 14 characters" - }, - { - "allowed_pattern": "[a-zA-Z0-9]*", - "description": "must contain only alphanumeric characters." - } - ] - } - }, - "resources": { - "db": { - "type": "OS::Trove::Instance", - "properties": { - "flavor": { - "get_param": "db_flavor" - }, - "size": { - "get_param": "db_volume_size" - }, - "users": [ - { - "password": { - "get_param": "db_password" - }, - "name": { - "get_param": "db_username" - }, - "databases": [ - { - "get_param": "db_name" - } - ] - } - ], - "name": { - "get_param": "db_instance_name" - }, - "databases": [ - { - "name": { - "get_param": "db_name" - } - } - ] - } - } - } -}`) - - adoptOpts := os.AdoptOpts{ - AdoptStackData: `{\"environment\":{\"parameters\":{}}, \"status\":\"COMPLETE\",\"name\": \"trovestack\",\n \"template\": {\n \"outputs\": {\n \"db_host\": {\n \"value\": {\n \"get_attr\": [\n \"db\",\n \"hostname\"\n ]\n }\n }\n },\n \"heat_template_version\": \"2014-10-16\",\n \"description\": \"HEAT template for creating a Cloud Database.\\n\",\n \"parameters\": {\n \"db_instance_name\": {\n \"default\": \"Cloud_DB\",\n \"type\": \"string\",\n \"description\": \"the database instance name\"\n },\n \"db_flavor\": {\n \"default\": \"1GB Instance\",\n \"type\": \"string\",\n \"description\": \"database instance size\",\n \"constraints\": [\n {\n \"description\": \"must be a valid cloud database flavor\",\n \"allowed_values\": [\n \"1GB Instance\",\n \"2GB Instance\",\n \"4GB Instance\",\n \"8GB Instance\",\n \"16GB Instance\"\n ]\n }\n ]\n },\n \"db_password\": {\n \"default\": \"admin\",\n \"hidden\": true,\n \"type\": \"string\",\n \"description\": \"database admin account password\",\n \"constraints\": [\n {\n \"length\": {\n \"max\": 41,\n \"min\": 1\n },\n \"description\": \"must be between 1 and 14 characters\"\n },\n {\n \"allowed_pattern\": \"[a-zA-Z0-9]*\",\n \"description\": \"must contain only alphanumeric characters.\"\n }\n ]\n },\n \"db_name\": {\n \"default\": \"wordpress\",\n \"type\": \"string\",\n \"description\": \"the name for the database\",\n \"constraints\": [\n {\n \"length\": {\n \"max\": 64,\n \"min\": 1\n },\n \"description\": \"must be between 1 and 64 characters\"\n },\n {\n \"allowed_pattern\": \"[a-zA-Z][a-zA-Z0-9]*\",\n \"description\": \"must begin with a letter and contain only alphanumeric characters.\"\n }\n ]\n },\n \"db_username\": {\n \"default\": \"admin\",\n \"hidden\": true,\n \"type\": \"string\",\n \"description\": \"database admin account username\",\n \"constraints\": [\n {\n \"length\": {\n \"max\": 16,\n \"min\": 1\n },\n \"description\": \"must be between 1 and 16 characters\"\n },\n {\n \"allowed_pattern\": \"[a-zA-Z][a-zA-Z0-9]*\",\n \"description\": \"must begin with a letter and contain only alphanumeric characters.\"\n }\n ]\n },\n \"db_volume_size\": {\n \"default\": 30,\n \"type\": \"number\",\n \"description\": \"database volume size (in GB)\",\n \"constraints\": [\n {\n \"range\": {\n \"max\": 1024,\n \"min\": 1\n },\n \"description\": \"must be between 1 and 1024 GB\"\n }\n ]\n }\n },\n \"resources\": {\n \"db\": {\n \"type\": \"OS::Trove::Instance\",\n \"properties\": {\n \"flavor\": {\n \"get_param\": \"db_flavor\"\n },\n \"databases\": [\n {\n \"name\": {\n \"get_param\": \"db_name\"\n }\n }\n ],\n \"users\": [\n {\n \"password\": {\n \"get_param\": \"db_password\"\n },\n \"name\": {\n \"get_param\": \"db_username\"\n },\n \"databases\": [\n {\n \"get_param\": \"db_name\"\n }\n ]\n }\n ],\n \"name\": {\n \"get_param\": \"db_instance_name\"\n },\n \"size\": {\n \"get_param\": \"db_volume_size\"\n }\n }\n }\n }\n },\n \"action\": \"CREATE\",\n \"id\": \"exxxxd-7xx5-4xxb-bxx2-cxxxxxx5\",\n \"resources\": {\n \"db\": {\n \"status\": \"COMPLETE\",\n \"name\": \"db\",\n \"resource_data\": {},\n \"resource_id\": \"exxxx2-9xx0-4xxxb-bxx2-dxxxxxx4\",\n \"action\": \"CREATE\",\n \"type\": \"OS::Trove::Instance\",\n \"metadata\": {}\n }\n }\n},`, - Name: "stackadopted", - Timeout: 60, - TemplateOpts: template, - DisableRollback: os.Disable, - } - actual, err := Adopt(fake.ServiceClient(), adoptOpts).Extract() - th.AssertNoErr(t, err) - - expected := CreateExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestListStack(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleListSuccessfully(t, os.FullListOutput) - - count := 0 - err := List(fake.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := os.ExtractStacks(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, os.ListExpected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestUpdateStack(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleUpdateSuccessfully(t) - - updateOpts := os.UpdateOpts{ - Template: ` - { - "heat_template_version": "2013-05-23", - "description": "Simple template to test heat commands", - "parameters": { - "flavor": { - "default": "m1.tiny", - "type": "string" - } - }, - "resources": { - "hello_world": { - "type":"OS::Nova::Server", - "properties": { - "key_name": "heat_key", - "flavor": { - "get_param": "flavor" - }, - "image": "ad091b52-742f-469e-8f3c-fd81cadf0743", - "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n" - } - } - } - }`, - } - err := Update(fake.ServiceClient(), "gophercloud-test-stack-2", "db6977b2-27aa-4775-9ae7-6213212d4ada", updateOpts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestUpdateStackNewTemplateFormat(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleUpdateSuccessfully(t) - - updateOpts := os.UpdateOpts{ - TemplateOpts: new(os.Template), - } - updateOpts.TemplateOpts.Bin = []byte(` - { - "stack_name": "postman_stack", - "template": { - "heat_template_version": "2013-05-23", - "description": "Simple template to test heat commands", - "parameters": { - "flavor": { - "default": "m1.tiny", - "type": "string" - } - }, - "resources": { - "hello_world": { - "type": "OS::Nova::Server", - "properties": { - "key_name": "heat_key", - "flavor": { - "get_param": "flavor" - }, - "image": "ad091b52-742f-469e-8f3c-fd81cadf0743", - "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n" - } - } - } - } - }`) - err := Update(fake.ServiceClient(), "gophercloud-test-stack-2", "db6977b2-27aa-4775-9ae7-6213212d4ada", updateOpts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestDeleteStack(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleDeleteSuccessfully(t) - - err := Delete(fake.ServiceClient(), "gophercloud-test-stack-2", "db6977b2-27aa-4775-9ae7-6213212d4ada").ExtractErr() - th.AssertNoErr(t, err) -} - -func TestPreviewStack(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandlePreviewSuccessfully(t, os.GetOutput) - - previewOpts := os.PreviewOpts{ - Name: "stackcreated", - Timeout: 60, - Template: ` - { - "stack_name": "postman_stack", - "template": { - "heat_template_version": "2013-05-23", - "description": "Simple template to test heat commands", - "parameters": { - "flavor": { - "default": "m1.tiny", - "type": "string" - } - }, - "resources": { - "hello_world": { - "type":"OS::Nova::Server", - "properties": { - "key_name": "heat_key", - "flavor": { - "get_param": "flavor" - }, - "image": "ad091b52-742f-469e-8f3c-fd81cadf0743", - "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n" - } - } - } - } - }`, - DisableRollback: os.Disable, - } - actual, err := Preview(fake.ServiceClient(), previewOpts).Extract() - th.AssertNoErr(t, err) - - expected := os.PreviewExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestPreviewStackNewTemplateFormat(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandlePreviewSuccessfully(t, os.GetOutput) - - previewOpts := os.PreviewOpts{ - Name: "stackcreated", - Timeout: 60, - TemplateOpts: new(os.Template), - DisableRollback: os.Disable, - } - previewOpts.TemplateOpts.Bin = []byte(` - { - "stack_name": "postman_stack", - "template": { - "heat_template_version": "2013-05-23", - "description": "Simple template to test heat commands", - "parameters": { - "flavor": { - "default": "m1.tiny", - "type": "string" - } - }, - "resources": { - "hello_world": { - "type": "OS::Nova::Server", - "properties": { - "key_name": "heat_key", - "flavor": { - "get_param": "flavor" - }, - "image": "ad091b52-742f-469e-8f3c-fd81cadf0743", - "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n" - } - } - } - } - }`) - actual, err := Preview(fake.ServiceClient(), previewOpts).Extract() - th.AssertNoErr(t, err) - - expected := os.PreviewExpected - th.AssertDeepEquals(t, expected, actual) -} - -func TestAbandonStack(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleAbandonSuccessfully(t, os.AbandonOutput) - - actual, err := Abandon(fake.ServiceClient(), "postman_stack", "16ef0584-4458-41eb-87c8-0dc8d5f66c8").Extract() - th.AssertNoErr(t, err) - - expected := os.AbandonExpected - th.AssertDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stacktemplates/delegate_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stacktemplates/delegate_test.go deleted file mode 100644 index d4d0f8f5ab..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stacktemplates/delegate_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package stacktemplates - -import ( - "testing" - - os "github.com/rackspace/gophercloud/openstack/orchestration/v1/stacktemplates" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestGetTemplate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleGetSuccessfully(t, os.GetOutput) - - actual, err := Get(fake.ServiceClient(), "postman_stack", "16ef0584-4458-41eb-87c8-0dc8d5f66c87").Extract() - th.AssertNoErr(t, err) - - expected := os.GetExpected - th.AssertDeepEquals(t, expected, string(actual)) -} - -func TestValidateTemplate(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - os.HandleValidateSuccessfully(t, os.ValidateOutput) - - opts := os.ValidateOpts{ - Template: `{ - "Description": "Simple template to test heat commands", - "Parameters": { - "flavor": { - "Default": "m1.tiny", - "Type": "String", - "NoEcho": "false", - "Description": "", - "Label": "flavor" - } - } - }`, - } - actual, err := Validate(fake.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) - - expected := os.ValidateExpected - th.AssertDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/rackconnect/v3/cloudnetworks/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/rackconnect/v3/cloudnetworks/requests_test.go deleted file mode 100644 index 10d15dd11f..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/rackconnect/v3/cloudnetworks/requests_test.go +++ /dev/null @@ -1,87 +0,0 @@ -package cloudnetworks - -import ( - "fmt" - "net/http" - "testing" - "time" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListCloudNetworks(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/cloud_networks", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, `[{ - "cidr": "192.168.100.0/24", - "created": "2014-05-25T01:23:42Z", - "id": "07426958-1ebf-4c38-b032-d456820ca21a", - "name": "RC-CLOUD", - "updated": "2014-05-25T02:28:44Z" - }]`) - }) - - expected := []CloudNetwork{ - CloudNetwork{ - CIDR: "192.168.100.0/24", - CreatedAt: time.Date(2014, 5, 25, 1, 23, 42, 0, time.UTC), - ID: "07426958-1ebf-4c38-b032-d456820ca21a", - Name: "RC-CLOUD", - UpdatedAt: time.Date(2014, 5, 25, 2, 28, 44, 0, time.UTC), - }, - } - - count := 0 - err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractCloudNetworks(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestGetCloudNetwork(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/cloud_networks/07426958-1ebf-4c38-b032-d456820ca21a", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, `{ - "cidr": "192.168.100.0/24", - "created": "2014-05-25T01:23:42Z", - "id": "07426958-1ebf-4c38-b032-d456820ca21a", - "name": "RC-CLOUD", - "updated": "2014-05-25T02:28:44Z" - }`) - }) - - expected := &CloudNetwork{ - CIDR: "192.168.100.0/24", - CreatedAt: time.Date(2014, 5, 25, 1, 23, 42, 0, time.UTC), - ID: "07426958-1ebf-4c38-b032-d456820ca21a", - Name: "RC-CLOUD", - UpdatedAt: time.Date(2014, 5, 25, 2, 28, 44, 0, time.UTC), - } - - actual, err := Get(fake.ServiceClient(), "07426958-1ebf-4c38-b032-d456820ca21a").Extract() - th.AssertNoErr(t, err) - - th.AssertDeepEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/rackconnect/v3/lbpools/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/rackconnect/v3/lbpools/requests_test.go deleted file mode 100644 index 48ebcece13..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/rackconnect/v3/lbpools/requests_test.go +++ /dev/null @@ -1,876 +0,0 @@ -package lbpools - -import ( - "fmt" - "net/http" - "testing" - "time" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListPools(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/load_balancer_pools", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, `[ - { - "id": "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - "name": "RCv3Test", - "node_counts": { - "cloud_servers": 3, - "external": 4, - "total": 7 - }, - "port": 80, - "status": "ACTIVE", - "status_detail": null, - "virtual_ip": "203.0.113.5" - }, - { - "id": "33021100-4abf-4836-9080-465a6d87ab68", - "name": "RCv3Test2", - "node_counts": { - "cloud_servers": 1, - "external": 0, - "total": 1 - }, - "port": 80, - "status": "ACTIVE", - "status_detail": null, - "virtual_ip": "203.0.113.7" - }, - { - "id": "b644350a-301b-47b5-a411-c6e0f933c347", - "name": "RCv3Test3", - "node_counts": { - "cloud_servers": 2, - "external": 3, - "total": 5 - }, - "port": 443, - "status": "ACTIVE", - "status_detail": null, - "virtual_ip": "203.0.113.15" - } - ]`) - }) - - expected := []Pool{ - Pool{ - ID: "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - Name: "RCv3Test", - NodeCounts: struct { - CloudServers int `mapstructure:"cloud_servers"` - External int `mapstructure:"external"` - Total int `mapstructure:"total"` - }{ - CloudServers: 3, - External: 4, - Total: 7, - }, - Port: 80, - Status: "ACTIVE", - VirtualIP: "203.0.113.5", - }, - Pool{ - ID: "33021100-4abf-4836-9080-465a6d87ab68", - Name: "RCv3Test2", - NodeCounts: struct { - CloudServers int `mapstructure:"cloud_servers"` - External int `mapstructure:"external"` - Total int `mapstructure:"total"` - }{ - CloudServers: 1, - External: 0, - Total: 1, - }, - Port: 80, - Status: "ACTIVE", - VirtualIP: "203.0.113.7", - }, - Pool{ - ID: "b644350a-301b-47b5-a411-c6e0f933c347", - Name: "RCv3Test3", - NodeCounts: struct { - CloudServers int `mapstructure:"cloud_servers"` - External int `mapstructure:"external"` - Total int `mapstructure:"total"` - }{ - CloudServers: 2, - External: 3, - Total: 5, - }, - Port: 443, - Status: "ACTIVE", - VirtualIP: "203.0.113.15", - }, - } - - count := 0 - err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractPools(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestGetLBPool(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/load_balancer_pools/d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, `{ - "id": "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - "name": "RCv3Test", - "node_counts": { - "cloud_servers": 3, - "external": 4, - "total": 7 - }, - "port": 80, - "status": "ACTIVE", - "status_detail": null, - "virtual_ip": "203.0.113.5" - }`) - }) - - expected := &Pool{ - ID: "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - Name: "RCv3Test", - NodeCounts: struct { - CloudServers int `mapstructure:"cloud_servers"` - External int `mapstructure:"external"` - Total int `mapstructure:"total"` - }{ - CloudServers: 3, - External: 4, - Total: 7, - }, - Port: 80, - Status: "ACTIVE", - VirtualIP: "203.0.113.5", - } - - actual, err := Get(fake.ServiceClient(), "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2").Extract() - th.AssertNoErr(t, err) - - th.AssertDeepEquals(t, expected, actual) -} - -func TestListNodes(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/load_balancer_pools/d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2/nodes", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, `[ - { - "created": "2014-05-30T03:23:42Z", - "cloud_server": { - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2" - }, - "id": "1860451d-fb89-45b8-b54e-151afceb50e5", - "load_balancer_pool": { - "id": "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2" - }, - "status": "ACTIVE", - "updated": "2014-05-30T03:24:18Z" - }, - { - "created": "2014-05-31T08:23:12Z", - "cloud_server": { - "id": "f28b870f-a063-498a-8b12-7025e5b1caa6" - }, - "id": "b70481dd-7edf-4dbb-a44b-41cc7679d4fb", - "load_balancer_pool": { - "id": "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2" - }, - "status": "ADDING", - "updated": "2014-05-31T08:23:26Z" - }, - { - "created": "2014-05-31T08:23:18Z", - "cloud_server": { - "id": "a3d3a6b3-e4e4-496f-9a3d-5c987163e458" - }, - "id": "ced9ddc8-6fae-4e72-9457-16ead52b5515", - "load_balancer_pool": { - "id": "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2" - }, - "status": "ADD_FAILED", - "status_detail": "Unable to communicate with network device", - "updated": "2014-05-31T08:24:36Z" - } - ]`) - }) - - expected := []Node{ - Node{ - CreatedAt: time.Date(2014, 5, 30, 3, 23, 42, 0, time.UTC), - CloudServer: struct { - ID string `mapstructure:"id"` - }{ - ID: "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - }, - ID: "1860451d-fb89-45b8-b54e-151afceb50e5", - LoadBalancerPool: struct { - ID string `mapstructure:"id"` - }{ - ID: "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - }, - Status: "ACTIVE", - UpdatedAt: time.Date(2014, 5, 30, 3, 24, 18, 0, time.UTC), - }, - Node{ - CreatedAt: time.Date(2014, 5, 31, 8, 23, 12, 0, time.UTC), - CloudServer: struct { - ID string `mapstructure:"id"` - }{ - ID: "f28b870f-a063-498a-8b12-7025e5b1caa6", - }, - ID: "b70481dd-7edf-4dbb-a44b-41cc7679d4fb", - LoadBalancerPool: struct { - ID string `mapstructure:"id"` - }{ - ID: "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - }, - Status: "ADDING", - UpdatedAt: time.Date(2014, 5, 31, 8, 23, 26, 0, time.UTC), - }, - Node{ - CreatedAt: time.Date(2014, 5, 31, 8, 23, 18, 0, time.UTC), - CloudServer: struct { - ID string `mapstructure:"id"` - }{ - ID: "a3d3a6b3-e4e4-496f-9a3d-5c987163e458", - }, - ID: "ced9ddc8-6fae-4e72-9457-16ead52b5515", - LoadBalancerPool: struct { - ID string `mapstructure:"id"` - }{ - ID: "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - }, - Status: "ADD_FAILED", - StatusDetail: "Unable to communicate with network device", - UpdatedAt: time.Date(2014, 5, 31, 8, 24, 36, 0, time.UTC), - }, - } - - count := 0 - err := ListNodes(fake.ServiceClient(), "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2").EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractNodes(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestCreateNode(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/load_balancer_pools/d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2/nodes", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` - { - "cloud_server": { - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2" - } - } - `) - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - fmt.Fprintf(w, ` - { - "created": "2014-05-30T03:23:42Z", - "cloud_server": { - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2" - }, - "id": "1860451d-fb89-45b8-b54e-151afceb50e5", - "load_balancer_pool": { - "id": "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2" - }, - "status": "ACTIVE", - "status_detail": null, - "updated": "2014-05-30T03:24:18Z" - } - `) - }) - - expected := &Node{ - CreatedAt: time.Date(2014, 5, 30, 3, 23, 42, 0, time.UTC), - CloudServer: struct { - ID string `mapstructure:"id"` - }{ - ID: "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - }, - ID: "1860451d-fb89-45b8-b54e-151afceb50e5", - LoadBalancerPool: struct { - ID string `mapstructure:"id"` - }{ - ID: "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - }, - Status: "ACTIVE", - UpdatedAt: time.Date(2014, 5, 30, 3, 24, 18, 0, time.UTC), - } - - actual, err := CreateNode(fake.ServiceClient(), "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", "d95ae0c4-6ab8-4873-b82f-f8433840cff2").Extract() - th.AssertNoErr(t, err) - - th.AssertDeepEquals(t, expected, actual) -} - -func TestListNodesDetails(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/load_balancer_pools/d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2/nodes/details", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, ` - [ - { - "created": "2014-05-30T03:23:42Z", - "cloud_server": { - "cloud_network": { - "cidr": "192.168.100.0/24", - "created": "2014-05-25T01:23:42Z", - "id": "07426958-1ebf-4c38-b032-d456820ca21a", - "name": "RC-CLOUD", - "private_ip_v4": "192.168.100.5", - "updated": "2014-05-25T02:28:44Z" - }, - "created": "2014-05-30T02:18:42Z", - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - "name": "RCv3TestServer1", - "updated": "2014-05-30T02:19:18Z" - }, - "id": "1860451d-fb89-45b8-b54e-151afceb50e5", - "load_balancer_pool": { - "id": "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - "name": "RCv3Test", - "node_counts": { - "cloud_servers": 3, - "external": 4, - "total": 7 - }, - "port": 80, - "status": "ACTIVE", - "status_detail": null, - "virtual_ip": "203.0.113.5" - }, - "status": "ACTIVE", - "status_detail": null, - "updated": "2014-05-30T03:24:18Z" - } - ] - `) - }) - - expected := []NodeDetails{ - NodeDetails{ - CreatedAt: time.Date(2014, 5, 30, 3, 23, 42, 0, time.UTC), - CloudServer: struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - CloudNetwork struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - PrivateIPv4 string `mapstructure:"private_ip_v4"` - CIDR string `mapstructure:"cidr"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - } `mapstructure:"cloud_network"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - }{ - ID: "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - CloudNetwork: struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - PrivateIPv4 string `mapstructure:"private_ip_v4"` - CIDR string `mapstructure:"cidr"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - }{ - ID: "07426958-1ebf-4c38-b032-d456820ca21a", - CIDR: "192.168.100.0/24", - CreatedAt: time.Date(2014, 5, 25, 1, 23, 42, 0, time.UTC), - Name: "RC-CLOUD", - PrivateIPv4: "192.168.100.5", - UpdatedAt: time.Date(2014, 5, 25, 2, 28, 44, 0, time.UTC), - }, - CreatedAt: time.Date(2014, 5, 30, 2, 18, 42, 0, time.UTC), - Name: "RCv3TestServer1", - UpdatedAt: time.Date(2014, 5, 30, 2, 19, 18, 0, time.UTC), - }, - ID: "1860451d-fb89-45b8-b54e-151afceb50e5", - LoadBalancerPool: Pool{ - ID: "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - Name: "RCv3Test", - NodeCounts: struct { - CloudServers int `mapstructure:"cloud_servers"` - External int `mapstructure:"external"` - Total int `mapstructure:"total"` - }{ - CloudServers: 3, - External: 4, - Total: 7, - }, - Port: 80, - Status: "ACTIVE", - VirtualIP: "203.0.113.5", - }, - Status: "ACTIVE", - UpdatedAt: time.Date(2014, 5, 30, 3, 24, 18, 0, time.UTC), - }, - } - count := 0 - err := ListNodesDetails(fake.ServiceClient(), "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2").EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractNodesDetails(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestGetNode(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/load_balancer_pools/d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2/nodes/1860451d-fb89-45b8-b54e-151afceb50e5", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, ` - { - "created": "2014-05-30T03:23:42Z", - "cloud_server": { - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2" - }, - "id": "1860451d-fb89-45b8-b54e-151afceb50e5", - "load_balancer_pool": { - "id": "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2" - }, - "status": "ACTIVE", - "status_detail": null, - "updated": "2014-05-30T03:24:18Z" - } - `) - }) - - expected := &Node{ - CreatedAt: time.Date(2014, 5, 30, 3, 23, 42, 0, time.UTC), - CloudServer: struct { - ID string `mapstructure:"id"` - }{ - ID: "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - }, - ID: "1860451d-fb89-45b8-b54e-151afceb50e5", - LoadBalancerPool: struct { - ID string `mapstructure:"id"` - }{ - ID: "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - }, - Status: "ACTIVE", - UpdatedAt: time.Date(2014, 5, 30, 3, 24, 18, 0, time.UTC), - } - - actual, err := GetNode(fake.ServiceClient(), "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", "1860451d-fb89-45b8-b54e-151afceb50e5").Extract() - th.AssertNoErr(t, err) - - th.AssertDeepEquals(t, expected, actual) -} - -func TestDeleteNode(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/load_balancer_pools/d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2/nodes/1860451d-fb89-45b8-b54e-151afceb50e5", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusNoContent) - }) - - err := DeleteNode(client.ServiceClient(), "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", "1860451d-fb89-45b8-b54e-151afceb50e5").ExtractErr() - th.AssertNoErr(t, err) -} - -func TestGetNodeDetails(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/load_balancer_pools/d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2/nodes/d95ae0c4-6ab8-4873-b82f-f8433840cff2/details", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, ` - { - "created": "2014-05-30T03:23:42Z", - "cloud_server": { - "cloud_network": { - "cidr": "192.168.100.0/24", - "created": "2014-05-25T01:23:42Z", - "id": "07426958-1ebf-4c38-b032-d456820ca21a", - "name": "RC-CLOUD", - "private_ip_v4": "192.168.100.5", - "updated": "2014-05-25T02:28:44Z" - }, - "created": "2014-05-30T02:18:42Z", - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - "name": "RCv3TestServer1", - "updated": "2014-05-30T02:19:18Z" - }, - "id": "1860451d-fb89-45b8-b54e-151afceb50e5", - "load_balancer_pool": { - "id": "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - "name": "RCv3Test", - "node_counts": { - "cloud_servers": 3, - "external": 4, - "total": 7 - }, - "port": 80, - "status": "ACTIVE", - "status_detail": null, - "virtual_ip": "203.0.113.5" - }, - "status": "ACTIVE", - "status_detail": null, - "updated": "2014-05-30T03:24:18Z" - } - `) - }) - - expected := &NodeDetails{ - CreatedAt: time.Date(2014, 5, 30, 3, 23, 42, 0, time.UTC), - CloudServer: struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - CloudNetwork struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - PrivateIPv4 string `mapstructure:"private_ip_v4"` - CIDR string `mapstructure:"cidr"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - } `mapstructure:"cloud_network"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - }{ - ID: "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - CloudNetwork: struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - PrivateIPv4 string `mapstructure:"private_ip_v4"` - CIDR string `mapstructure:"cidr"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - }{ - ID: "07426958-1ebf-4c38-b032-d456820ca21a", - CIDR: "192.168.100.0/24", - CreatedAt: time.Date(2014, 5, 25, 1, 23, 42, 0, time.UTC), - Name: "RC-CLOUD", - PrivateIPv4: "192.168.100.5", - UpdatedAt: time.Date(2014, 5, 25, 2, 28, 44, 0, time.UTC), - }, - CreatedAt: time.Date(2014, 5, 30, 2, 18, 42, 0, time.UTC), - Name: "RCv3TestServer1", - UpdatedAt: time.Date(2014, 5, 30, 2, 19, 18, 0, time.UTC), - }, - ID: "1860451d-fb89-45b8-b54e-151afceb50e5", - LoadBalancerPool: Pool{ - ID: "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - Name: "RCv3Test", - NodeCounts: struct { - CloudServers int `mapstructure:"cloud_servers"` - External int `mapstructure:"external"` - Total int `mapstructure:"total"` - }{ - CloudServers: 3, - External: 4, - Total: 7, - }, - Port: 80, - Status: "ACTIVE", - VirtualIP: "203.0.113.5", - }, - Status: "ACTIVE", - UpdatedAt: time.Date(2014, 5, 30, 3, 24, 18, 0, time.UTC), - } - - actual, err := GetNodeDetails(fake.ServiceClient(), "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", "d95ae0c4-6ab8-4873-b82f-f8433840cff2").Extract() - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, expected, actual) -} - -func TestCreateNodes(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/load_balancer_pools/nodes", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` - [ - { - "cloud_server": { - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2" - }, - "load_balancer_pool": { - "id": "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2" - } - }, - { - "cloud_server": { - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2" - }, - "load_balancer_pool": { - "id": "33021100-4abf-4836-9080-465a6d87ab68" - } - } - ] - `) - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - fmt.Fprintf(w, ` - [ - { - "created": "2014-05-30T03:23:42Z", - "cloud_server": { - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2" - }, - "id": "1860451d-fb89-45b8-b54e-151afceb50e5", - "load_balancer_pool": { - "id": "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2" - }, - "status": "ADDING", - "status_detail": null, - "updated": null - }, - { - "created": "2014-05-31T08:23:12Z", - "cloud_server": { - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2" - }, - "id": "b70481dd-7edf-4dbb-a44b-41cc7679d4fb", - "load_balancer_pool": { - "id": "33021100-4abf-4836-9080-465a6d87ab68" - }, - "status": "ADDING", - "status_detail": null, - "updated": null - } - ] - `) - }) - - expected := []Node{ - Node{ - CreatedAt: time.Date(2014, 5, 30, 3, 23, 42, 0, time.UTC), - CloudServer: struct { - ID string `mapstructure:"id"` - }{ - ID: "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - }, - ID: "1860451d-fb89-45b8-b54e-151afceb50e5", - LoadBalancerPool: struct { - ID string `mapstructure:"id"` - }{ - ID: "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - }, - Status: "ADDING", - }, - Node{ - CreatedAt: time.Date(2014, 5, 31, 8, 23, 12, 0, time.UTC), - CloudServer: struct { - ID string `mapstructure:"id"` - }{ - ID: "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - }, - ID: "b70481dd-7edf-4dbb-a44b-41cc7679d4fb", - LoadBalancerPool: struct { - ID string `mapstructure:"id"` - }{ - ID: "33021100-4abf-4836-9080-465a6d87ab68", - }, - Status: "ADDING", - }, - } - - opts := NodesOpts{ - NodeOpts{ - ServerID: "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - PoolID: "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - }, - NodeOpts{ - ServerID: "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - PoolID: "33021100-4abf-4836-9080-465a6d87ab68", - }, - } - actual, err := CreateNodes(fake.ServiceClient(), opts).Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expected, actual) -} - -func TestDeleteNodes(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/load_balancer_pools/nodes", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` - [ - { - "cloud_server": { - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2" - }, - "load_balancer_pool": { - "id": "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2" - } - }, - { - "cloud_server": { - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2" - }, - "load_balancer_pool": { - "id": "33021100-4abf-4836-9080-465a6d87ab68" - } - } - ] - `) - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusNoContent) - }) - - opts := NodesOpts{ - NodeOpts{ - ServerID: "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - PoolID: "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - }, - NodeOpts{ - ServerID: "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - PoolID: "33021100-4abf-4836-9080-465a6d87ab68", - }, - } - err := DeleteNodes(client.ServiceClient(), opts).ExtractErr() - th.AssertNoErr(t, err) -} - -func TestListNodesForServerDetails(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/load_balancer_pools/nodes/details", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, ` - [ - { - "created": "2014-05-30T03:23:42Z", - "id": "1860451d-fb89-45b8-b54e-151afceb50e5", - "load_balancer_pool": { - "id": "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - "name": "RCv3Test", - "node_counts": { - "cloud_servers": 3, - "external": 4, - "total": 7 - }, - "port": 80, - "status": "ACTIVE", - "status_detail": null, - "virtual_ip": "203.0.113.5" - }, - "status": "ACTIVE", - "status_detail": null, - "updated": "2014-05-30T03:24:18Z" - } - ] - `) - }) - - expected := []NodeDetailsForServer{ - NodeDetailsForServer{ - CreatedAt: time.Date(2014, 5, 30, 3, 23, 42, 0, time.UTC), - ID: "1860451d-fb89-45b8-b54e-151afceb50e5", - LoadBalancerPool: Pool{ - ID: "d6d3aa7c-dfa5-4e61-96ee-1d54ac1075d2", - Name: "RCv3Test", - NodeCounts: struct { - CloudServers int `mapstructure:"cloud_servers"` - External int `mapstructure:"external"` - Total int `mapstructure:"total"` - }{ - CloudServers: 3, - External: 4, - Total: 7, - }, - Port: 80, - Status: "ACTIVE", - VirtualIP: "203.0.113.5", - }, - Status: "ACTIVE", - UpdatedAt: time.Date(2014, 5, 30, 3, 24, 18, 0, time.UTC), - }, - } - count := 0 - err := ListNodesDetailsForServer(fake.ServiceClient(), "07426958-1ebf-4c38-b032-d456820ca21a").EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractNodesDetailsForServer(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} diff --git a/vendor/github.com/rackspace/gophercloud/rackspace/rackconnect/v3/publicips/requests_test.go b/vendor/github.com/rackspace/gophercloud/rackspace/rackconnect/v3/publicips/requests_test.go deleted file mode 100644 index 61da2b03d9..0000000000 --- a/vendor/github.com/rackspace/gophercloud/rackspace/rackconnect/v3/publicips/requests_test.go +++ /dev/null @@ -1,378 +0,0 @@ -package publicips - -import ( - "fmt" - "net/http" - "testing" - "time" - - "github.com/rackspace/gophercloud/pagination" - th "github.com/rackspace/gophercloud/testhelper" - "github.com/rackspace/gophercloud/testhelper/client" - fake "github.com/rackspace/gophercloud/testhelper/client" -) - -func TestListIPs(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/public_ips", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, `[ - { - "created": "2014-05-30T03:23:42Z", - "cloud_server": { - "cloud_network": { - "cidr": "192.168.100.0/24", - "created": "2014-05-25T01:23:42Z", - "id": "07426958-1ebf-4c38-b032-d456820ca21a", - "name": "RC-CLOUD", - "private_ip_v4": "192.168.100.5", - "updated": "2014-05-25T02:28:44Z" - }, - "created": "2014-05-30T02:18:42Z", - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - "name": "RCv3TestServer1", - "updated": "2014-05-30T02:19:18Z" - }, - "id": "2d0f586b-37a7-4ae0-adac-2743d5feb450", - "public_ip_v4": "203.0.113.110", - "status": "ACTIVE", - "status_detail": null, - "updated": "2014-05-30T03:24:18Z" - } - ]`) - }) - - expected := []PublicIP{ - PublicIP{ - ID: "2d0f586b-37a7-4ae0-adac-2743d5feb450", - PublicIPv4: "203.0.113.110", - CreatedAt: time.Date(2014, 5, 30, 3, 23, 42, 0, time.UTC), - CloudServer: struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - CloudNetwork struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - PrivateIPv4 string `mapstructure:"private_ip_v4"` - CIDR string `mapstructure:"cidr"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - } `mapstructure:"cloud_network"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - }{ - ID: "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - CloudNetwork: struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - PrivateIPv4 string `mapstructure:"private_ip_v4"` - CIDR string `mapstructure:"cidr"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - }{ - ID: "07426958-1ebf-4c38-b032-d456820ca21a", - CIDR: "192.168.100.0/24", - CreatedAt: time.Date(2014, 5, 25, 1, 23, 42, 0, time.UTC), - Name: "RC-CLOUD", - PrivateIPv4: "192.168.100.5", - UpdatedAt: time.Date(2014, 5, 25, 2, 28, 44, 0, time.UTC), - }, - CreatedAt: time.Date(2014, 5, 30, 2, 18, 42, 0, time.UTC), - Name: "RCv3TestServer1", - UpdatedAt: time.Date(2014, 5, 30, 2, 19, 18, 0, time.UTC), - }, - Status: "ACTIVE", - UpdatedAt: time.Date(2014, 5, 30, 3, 24, 18, 0, time.UTC), - }, - } - - count := 0 - err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractPublicIPs(page) - th.AssertNoErr(t, err) - - th.CheckDeepEquals(t, expected, actual) - - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} - -func TestCreateIP(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/public_ips", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "POST") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - th.TestJSONRequest(t, r, ` - { - "cloud_server": { - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2" - } - } - `) - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusCreated) - fmt.Fprintf(w, ` - { - "created": "2014-05-30T03:23:42Z", - "cloud_server": { - "cloud_network": { - "cidr": "192.168.100.0/24", - "created": "2014-05-25T01:23:42Z", - "id": "07426958-1ebf-4c38-b032-d456820ca21a", - "name": "RC-CLOUD", - "private_ip_v4": "192.168.100.5", - "updated": "2014-05-25T02:28:44Z" - }, - "created": "2014-05-30T02:18:42Z", - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - "name": "RCv3TestServer1", - "updated": "2014-05-30T02:19:18Z" - }, - "id": "2d0f586b-37a7-4ae0-adac-2743d5feb450", - "status": "ADDING" - }`) - }) - - expected := &PublicIP{ - CreatedAt: time.Date(2014, 5, 30, 3, 23, 42, 0, time.UTC), - CloudServer: struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - CloudNetwork struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - PrivateIPv4 string `mapstructure:"private_ip_v4"` - CIDR string `mapstructure:"cidr"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - } `mapstructure:"cloud_network"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - }{ - ID: "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - CloudNetwork: struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - PrivateIPv4 string `mapstructure:"private_ip_v4"` - CIDR string `mapstructure:"cidr"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - }{ - ID: "07426958-1ebf-4c38-b032-d456820ca21a", - CIDR: "192.168.100.0/24", - CreatedAt: time.Date(2014, 5, 25, 1, 23, 42, 0, time.UTC), - Name: "RC-CLOUD", - PrivateIPv4: "192.168.100.5", - UpdatedAt: time.Date(2014, 5, 25, 2, 28, 44, 0, time.UTC), - }, - CreatedAt: time.Date(2014, 5, 30, 2, 18, 42, 0, time.UTC), - Name: "RCv3TestServer1", - UpdatedAt: time.Date(2014, 5, 30, 2, 19, 18, 0, time.UTC), - }, - ID: "2d0f586b-37a7-4ae0-adac-2743d5feb450", - Status: "ADDING", - } - - actual, err := Create(fake.ServiceClient(), "d95ae0c4-6ab8-4873-b82f-f8433840cff2").Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expected, actual) -} - -func TestGetIP(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/public_ips/2d0f586b-37a7-4ae0-adac-2743d5feb450", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, ` - { - "created": "2014-05-30T03:23:42Z", - "cloud_server": { - "cloud_network": { - "cidr": "192.168.100.0/24", - "created": "2014-05-25T01:23:42Z", - "id": "07426958-1ebf-4c38-b032-d456820ca21a", - "name": "RC-CLOUD", - "private_ip_v4": "192.168.100.5", - "updated": "2014-05-25T02:28:44Z" - }, - "created": "2014-05-30T02:18:42Z", - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - "name": "RCv3TestServer1", - "updated": "2014-05-30T02:19:18Z" - }, - "id": "2d0f586b-37a7-4ae0-adac-2743d5feb450", - "public_ip_v4": "203.0.113.110", - "status": "ACTIVE", - "status_detail": null, - "updated": "2014-05-30T03:24:18Z" - }`) - }) - - expected := &PublicIP{ - CreatedAt: time.Date(2014, 5, 30, 3, 23, 42, 0, time.UTC), - CloudServer: struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - CloudNetwork struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - PrivateIPv4 string `mapstructure:"private_ip_v4"` - CIDR string `mapstructure:"cidr"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - } `mapstructure:"cloud_network"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - }{ - ID: "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - CloudNetwork: struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - PrivateIPv4 string `mapstructure:"private_ip_v4"` - CIDR string `mapstructure:"cidr"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - }{ - ID: "07426958-1ebf-4c38-b032-d456820ca21a", - CIDR: "192.168.100.0/24", - CreatedAt: time.Date(2014, 5, 25, 1, 23, 42, 0, time.UTC), - Name: "RC-CLOUD", - PrivateIPv4: "192.168.100.5", - UpdatedAt: time.Date(2014, 5, 25, 2, 28, 44, 0, time.UTC), - }, - CreatedAt: time.Date(2014, 5, 30, 2, 18, 42, 0, time.UTC), - Name: "RCv3TestServer1", - UpdatedAt: time.Date(2014, 5, 30, 2, 19, 18, 0, time.UTC), - }, - ID: "2d0f586b-37a7-4ae0-adac-2743d5feb450", - Status: "ACTIVE", - PublicIPv4: "203.0.113.110", - UpdatedAt: time.Date(2014, 5, 30, 3, 24, 18, 0, time.UTC), - } - - actual, err := Get(fake.ServiceClient(), "2d0f586b-37a7-4ae0-adac-2743d5feb450").Extract() - th.AssertNoErr(t, err) - th.AssertDeepEquals(t, expected, actual) -} - -func TestDeleteIP(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/public_ips/2d0f586b-37a7-4ae0-adac-2743d5feb450", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "DELETE") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusNoContent) - }) - - err := Delete(client.ServiceClient(), "2d0f586b-37a7-4ae0-adac-2743d5feb450").ExtractErr() - th.AssertNoErr(t, err) -} - -func TestListForServer(t *testing.T) { - th.SetupHTTP() - defer th.TeardownHTTP() - th.Mux.HandleFunc("/public_ips", func(w http.ResponseWriter, r *http.Request) { - th.TestMethod(t, r, "GET") - th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) - th.TestHeader(t, r, "Accept", "application/json") - - w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, ` - [ - { - "created": "2014-05-30T03:23:42Z", - "cloud_server": { - "cloud_network": { - "cidr": "192.168.100.0/24", - "created": "2014-05-25T01:23:42Z", - "id": "07426958-1ebf-4c38-b032-d456820ca21a", - "name": "RC-CLOUD", - "private_ip_v4": "192.168.100.5", - "updated": "2014-05-25T02:28:44Z" - }, - "created": "2014-05-30T02:18:42Z", - "id": "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - "name": "RCv3TestServer1", - "updated": "2014-05-30T02:19:18Z" - }, - "id": "2d0f586b-37a7-4ae0-adac-2743d5feb450", - "public_ip_v4": "203.0.113.110", - "status": "ACTIVE", - "updated": "2014-05-30T03:24:18Z" - } - ]`) - }) - - expected := []PublicIP{ - PublicIP{ - CreatedAt: time.Date(2014, 5, 30, 3, 23, 42, 0, time.UTC), - CloudServer: struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - CloudNetwork struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - PrivateIPv4 string `mapstructure:"private_ip_v4"` - CIDR string `mapstructure:"cidr"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - } `mapstructure:"cloud_network"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - }{ - ID: "d95ae0c4-6ab8-4873-b82f-f8433840cff2", - CloudNetwork: struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - PrivateIPv4 string `mapstructure:"private_ip_v4"` - CIDR string `mapstructure:"cidr"` - CreatedAt time.Time `mapstructure:"-"` - UpdatedAt time.Time `mapstructure:"-"` - }{ - ID: "07426958-1ebf-4c38-b032-d456820ca21a", - CIDR: "192.168.100.0/24", - CreatedAt: time.Date(2014, 5, 25, 1, 23, 42, 0, time.UTC), - Name: "RC-CLOUD", - PrivateIPv4: "192.168.100.5", - UpdatedAt: time.Date(2014, 5, 25, 2, 28, 44, 0, time.UTC), - }, - CreatedAt: time.Date(2014, 5, 30, 2, 18, 42, 0, time.UTC), - Name: "RCv3TestServer1", - UpdatedAt: time.Date(2014, 5, 30, 2, 19, 18, 0, time.UTC), - }, - ID: "2d0f586b-37a7-4ae0-adac-2743d5feb450", - Status: "ACTIVE", - PublicIPv4: "203.0.113.110", - UpdatedAt: time.Date(2014, 5, 30, 3, 24, 18, 0, time.UTC), - }, - } - count := 0 - err := ListForServer(fake.ServiceClient(), "d95ae0c4-6ab8-4873-b82f-f8433840cff2").EachPage(func(page pagination.Page) (bool, error) { - count++ - actual, err := ExtractPublicIPs(page) - th.AssertNoErr(t, err) - th.CheckDeepEquals(t, expected, actual) - return true, nil - }) - th.AssertNoErr(t, err) - th.CheckEquals(t, count, 1) -} diff --git a/vendor/github.com/rackspace/gophercloud/service_client_test.go b/vendor/github.com/rackspace/gophercloud/service_client_test.go deleted file mode 100644 index 84beb3f768..0000000000 --- a/vendor/github.com/rackspace/gophercloud/service_client_test.go +++ /dev/null @@ -1,14 +0,0 @@ -package gophercloud - -import ( - "testing" - - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestServiceURL(t *testing.T) { - c := &ServiceClient{Endpoint: "http://123.45.67.8/"} - expected := "http://123.45.67.8/more/parts/here" - actual := c.ServiceURL("more", "parts", "here") - th.CheckEquals(t, expected, actual) -} diff --git a/vendor/github.com/rackspace/gophercloud/util_test.go b/vendor/github.com/rackspace/gophercloud/util_test.go deleted file mode 100644 index dcec77f244..0000000000 --- a/vendor/github.com/rackspace/gophercloud/util_test.go +++ /dev/null @@ -1,85 +0,0 @@ -package gophercloud - -import ( - "os" - "path/filepath" - "strings" - "testing" - - th "github.com/rackspace/gophercloud/testhelper" -) - -func TestWaitFor(t *testing.T) { - err := WaitFor(5, func() (bool, error) { - return true, nil - }) - th.CheckNoErr(t, err) -} - -func TestNormalizeURL(t *testing.T) { - urls := []string{ - "NoSlashAtEnd", - "SlashAtEnd/", - } - expected := []string{ - "NoSlashAtEnd/", - "SlashAtEnd/", - } - for i := 0; i < len(expected); i++ { - th.CheckEquals(t, expected[i], NormalizeURL(urls[i])) - } - -} - -func TestNormalizePathURL(t *testing.T) { - baseDir, _ := os.Getwd() - - rawPath := "template.yaml" - basePath, _ := filepath.Abs(".") - result, _ := NormalizePathURL(basePath, rawPath) - expected := strings.Join([]string{"file:/", filepath.ToSlash(baseDir), "template.yaml"}, "/") - th.CheckEquals(t, expected, result) - - rawPath = "http://www.google.com" - basePath, _ = filepath.Abs(".") - result, _ = NormalizePathURL(basePath, rawPath) - expected = "http://www.google.com" - th.CheckEquals(t, expected, result) - - rawPath = "very/nested/file.yaml" - basePath, _ = filepath.Abs(".") - result, _ = NormalizePathURL(basePath, rawPath) - expected = strings.Join([]string{"file:/", filepath.ToSlash(baseDir), "very/nested/file.yaml"}, "/") - th.CheckEquals(t, expected, result) - - rawPath = "very/nested/file.yaml" - basePath = "http://www.google.com" - result, _ = NormalizePathURL(basePath, rawPath) - expected = "http://www.google.com/very/nested/file.yaml" - th.CheckEquals(t, expected, result) - - rawPath = "very/nested/file.yaml/" - basePath = "http://www.google.com/" - result, _ = NormalizePathURL(basePath, rawPath) - expected = "http://www.google.com/very/nested/file.yaml" - th.CheckEquals(t, expected, result) - - rawPath = "very/nested/file.yaml" - basePath = "http://www.google.com/even/more" - result, _ = NormalizePathURL(basePath, rawPath) - expected = "http://www.google.com/even/more/very/nested/file.yaml" - th.CheckEquals(t, expected, result) - - rawPath = "very/nested/file.yaml" - basePath = strings.Join([]string{"file:/", filepath.ToSlash(baseDir), "only/file/even/more"}, "/") - result, _ = NormalizePathURL(basePath, rawPath) - expected = strings.Join([]string{"file:/", filepath.ToSlash(baseDir), "only/file/even/more/very/nested/file.yaml"}, "/") - th.CheckEquals(t, expected, result) - - rawPath = "very/nested/file.yaml/" - basePath = strings.Join([]string{"file:/", filepath.ToSlash(baseDir), "only/file/even/more"}, "/") - result, _ = NormalizePathURL(basePath, rawPath) - expected = strings.Join([]string{"file:/", filepath.ToSlash(baseDir), "only/file/even/more/very/nested/file.yaml"}, "/") - th.CheckEquals(t, expected, result) - -} diff --git a/vendor/github.com/satori/go.uuid/benchmarks_test.go b/vendor/github.com/satori/go.uuid/benchmarks_test.go deleted file mode 100644 index 9a85f7c6b6..0000000000 --- a/vendor/github.com/satori/go.uuid/benchmarks_test.go +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (C) 2013-2014 by Maxim Bublis -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -package uuid - -import ( - "testing" -) - -func BenchmarkFromBytes(b *testing.B) { - bytes := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - for i := 0; i < b.N; i++ { - FromBytes(bytes) - } -} - -func BenchmarkFromString(b *testing.B) { - s := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" - for i := 0; i < b.N; i++ { - FromString(s) - } -} - -func BenchmarkFromStringUrn(b *testing.B) { - s := "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" - for i := 0; i < b.N; i++ { - FromString(s) - } -} - -func BenchmarkFromStringWithBrackets(b *testing.B) { - s := "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" - for i := 0; i < b.N; i++ { - FromString(s) - } -} - -func BenchmarkNewV1(b *testing.B) { - for i := 0; i < b.N; i++ { - NewV1() - } -} - -func BenchmarkNewV2(b *testing.B) { - for i := 0; i < b.N; i++ { - NewV2(DomainPerson) - } -} - -func BenchmarkNewV3(b *testing.B) { - for i := 0; i < b.N; i++ { - NewV3(NamespaceDNS, "www.example.com") - } -} - -func BenchmarkNewV4(b *testing.B) { - for i := 0; i < b.N; i++ { - NewV4() - } -} - -func BenchmarkNewV5(b *testing.B) { - for i := 0; i < b.N; i++ { - NewV5(NamespaceDNS, "www.example.com") - } -} - -func BenchmarkMarshalBinary(b *testing.B) { - u := NewV4() - for i := 0; i < b.N; i++ { - u.MarshalBinary() - } -} - -func BenchmarkMarshalText(b *testing.B) { - u := NewV4() - for i := 0; i < b.N; i++ { - u.MarshalText() - } -} - -func BenchmarkUnmarshalBinary(b *testing.B) { - bytes := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - u := UUID{} - for i := 0; i < b.N; i++ { - u.UnmarshalBinary(bytes) - } -} - -func BenchmarkUnmarshalText(b *testing.B) { - bytes := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - u := UUID{} - for i := 0; i < b.N; i++ { - u.UnmarshalText(bytes) - } -} - -func BenchmarkMarshalToString(b *testing.B) { - u := NewV4() - for i := 0; i < b.N; i++ { - u.String() - } -} diff --git a/vendor/github.com/satori/go.uuid/uuid_test.go b/vendor/github.com/satori/go.uuid/uuid_test.go deleted file mode 100644 index a501503159..0000000000 --- a/vendor/github.com/satori/go.uuid/uuid_test.go +++ /dev/null @@ -1,508 +0,0 @@ -// Copyright (C) 2013, 2015 by Maxim Bublis -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -package uuid - -import ( - "bytes" - "testing" -) - -func TestBytes(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - bytes1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - if !bytes.Equal(u.Bytes(), bytes1) { - t.Errorf("Incorrect bytes representation for UUID: %s", u) - } -} - -func TestString(t *testing.T) { - if NamespaceDNS.String() != "6ba7b810-9dad-11d1-80b4-00c04fd430c8" { - t.Errorf("Incorrect string representation for UUID: %s", NamespaceDNS.String()) - } -} - -func TestEqual(t *testing.T) { - if !Equal(NamespaceDNS, NamespaceDNS) { - t.Errorf("Incorrect comparison of %s and %s", NamespaceDNS, NamespaceDNS) - } - - if Equal(NamespaceDNS, NamespaceURL) { - t.Errorf("Incorrect comparison of %s and %s", NamespaceDNS, NamespaceURL) - } -} - -func TestOr(t *testing.T) { - u1 := UUID{0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff} - u2 := UUID{0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00} - - u := UUID{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} - - if !Equal(u, Or(u1, u2)) { - t.Errorf("Incorrect bitwise OR result %s", Or(u1, u2)) - } -} - -func TestAnd(t *testing.T) { - u1 := UUID{0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff} - u2 := UUID{0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00} - - u := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if !Equal(u, And(u1, u2)) { - t.Errorf("Incorrect bitwise AND result %s", And(u1, u2)) - } -} - -func TestVersion(t *testing.T) { - u := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if u.Version() != 1 { - t.Errorf("Incorrect version for UUID: %d", u.Version()) - } -} - -func TestSetVersion(t *testing.T) { - u := UUID{} - u.SetVersion(4) - - if u.Version() != 4 { - t.Errorf("Incorrect version for UUID after u.setVersion(4): %d", u.Version()) - } -} - -func TestVariant(t *testing.T) { - u1 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if u1.Variant() != VariantNCS { - t.Errorf("Incorrect variant for UUID variant %d: %d", VariantNCS, u1.Variant()) - } - - u2 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if u2.Variant() != VariantRFC4122 { - t.Errorf("Incorrect variant for UUID variant %d: %d", VariantRFC4122, u2.Variant()) - } - - u3 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if u3.Variant() != VariantMicrosoft { - t.Errorf("Incorrect variant for UUID variant %d: %d", VariantMicrosoft, u3.Variant()) - } - - u4 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if u4.Variant() != VariantFuture { - t.Errorf("Incorrect variant for UUID variant %d: %d", VariantFuture, u4.Variant()) - } -} - -func TestSetVariant(t *testing.T) { - u := new(UUID) - u.SetVariant() - - if u.Variant() != VariantRFC4122 { - t.Errorf("Incorrect variant for UUID after u.setVariant(): %d", u.Variant()) - } -} - -func TestFromBytes(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - u1, err := FromBytes(b1) - if err != nil { - t.Errorf("Error parsing UUID from bytes: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - b2 := []byte{} - - _, err = FromBytes(b2) - if err == nil { - t.Errorf("Should return error parsing from empty byte slice, got %s", err) - } -} - -func TestMarshalBinary(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - b2, err := u.MarshalBinary() - if err != nil { - t.Errorf("Error marshaling UUID: %s", err) - } - - if !bytes.Equal(b1, b2) { - t.Errorf("Marshaled UUID should be %s, got %s", b1, b2) - } -} - -func TestUnmarshalBinary(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - u1 := UUID{} - err := u1.UnmarshalBinary(b1) - if err != nil { - t.Errorf("Error unmarshaling UUID: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - b2 := []byte{} - u2 := UUID{} - - err = u2.UnmarshalBinary(b2) - if err == nil { - t.Errorf("Should return error unmarshalling from empty byte slice, got %s", err) - } -} - -func TestFromString(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" - s2 := "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" - s3 := "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" - - _, err := FromString("") - if err == nil { - t.Errorf("Should return error trying to parse empty string, got %s", err) - } - - u1, err := FromString(s1) - if err != nil { - t.Errorf("Error parsing UUID from string: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - u2, err := FromString(s2) - if err != nil { - t.Errorf("Error parsing UUID from string: %s", err) - } - - if !Equal(u, u2) { - t.Errorf("UUIDs should be equal: %s and %s", u, u2) - } - - u3, err := FromString(s3) - if err != nil { - t.Errorf("Error parsing UUID from string: %s", err) - } - - if !Equal(u, u3) { - t.Errorf("UUIDs should be equal: %s and %s", u, u3) - } -} - -func TestFromStringOrNil(t *testing.T) { - u := FromStringOrNil("") - if u != Nil { - t.Errorf("Should return Nil UUID on parse failure, got %s", u) - } -} - -func TestFromBytesOrNil(t *testing.T) { - b := []byte{} - u := FromBytesOrNil(b) - if u != Nil { - t.Errorf("Should return Nil UUID on parse failure, got %s", u) - } -} - -func TestMarshalText(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - - b2, err := u.MarshalText() - if err != nil { - t.Errorf("Error marshaling UUID: %s", err) - } - - if !bytes.Equal(b1, b2) { - t.Errorf("Marshaled UUID should be %s, got %s", b1, b2) - } -} - -func TestUnmarshalText(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - - u1 := UUID{} - err := u1.UnmarshalText(b1) - if err != nil { - t.Errorf("Error unmarshaling UUID: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - b2 := []byte("") - u2 := UUID{} - - err = u2.UnmarshalText(b2) - if err == nil { - t.Errorf("Should return error trying to unmarshal from empty string") - } -} - -func TestValue(t *testing.T) { - u, err := FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - if err != nil { - t.Errorf("Error parsing UUID from string: %s", err) - } - - val, err := u.Value() - if err != nil { - t.Errorf("Error getting UUID value: %s", err) - } - - if val != u.String() { - t.Errorf("Wrong value returned, should be equal: %s and %s", val, u) - } -} - -func TestScanBinary(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - u1 := UUID{} - err := u1.Scan(b1) - if err != nil { - t.Errorf("Error unmarshaling UUID: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - b2 := []byte{} - u2 := UUID{} - - err = u2.Scan(b2) - if err == nil { - t.Errorf("Should return error unmarshalling from empty byte slice, got %s", err) - } -} - -func TestScanString(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" - - u1 := UUID{} - err := u1.Scan(s1) - if err != nil { - t.Errorf("Error unmarshaling UUID: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - s2 := "" - u2 := UUID{} - - err = u2.Scan(s2) - if err == nil { - t.Errorf("Should return error trying to unmarshal from empty string") - } -} - -func TestScanText(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - - u1 := UUID{} - err := u1.Scan(b1) - if err != nil { - t.Errorf("Error unmarshaling UUID: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - b2 := []byte("") - u2 := UUID{} - - err = u2.Scan(b2) - if err == nil { - t.Errorf("Should return error trying to unmarshal from empty string") - } -} - -func TestScanUnsupported(t *testing.T) { - u := UUID{} - - err := u.Scan(true) - if err == nil { - t.Errorf("Should return error trying to unmarshal from bool") - } -} - -func TestNewV1(t *testing.T) { - u := NewV1() - - if u.Version() != 1 { - t.Errorf("UUIDv1 generated with incorrect version: %d", u.Version()) - } - - if u.Variant() != VariantRFC4122 { - t.Errorf("UUIDv1 generated with incorrect variant: %d", u.Variant()) - } - - u1 := NewV1() - u2 := NewV1() - - if Equal(u1, u2) { - t.Errorf("UUIDv1 generated two equal UUIDs: %s and %s", u1, u2) - } - - oldFunc := epochFunc - epochFunc = func() uint64 { return 0 } - - u3 := NewV1() - u4 := NewV1() - - if Equal(u3, u4) { - t.Errorf("UUIDv1 generated two equal UUIDs: %s and %s", u3, u4) - } - - epochFunc = oldFunc -} - -func TestNewV2(t *testing.T) { - u1 := NewV2(DomainPerson) - - if u1.Version() != 2 { - t.Errorf("UUIDv2 generated with incorrect version: %d", u1.Version()) - } - - if u1.Variant() != VariantRFC4122 { - t.Errorf("UUIDv2 generated with incorrect variant: %d", u1.Variant()) - } - - u2 := NewV2(DomainGroup) - - if u2.Version() != 2 { - t.Errorf("UUIDv2 generated with incorrect version: %d", u2.Version()) - } - - if u2.Variant() != VariantRFC4122 { - t.Errorf("UUIDv2 generated with incorrect variant: %d", u2.Variant()) - } -} - -func TestNewV3(t *testing.T) { - u := NewV3(NamespaceDNS, "www.example.com") - - if u.Version() != 3 { - t.Errorf("UUIDv3 generated with incorrect version: %d", u.Version()) - } - - if u.Variant() != VariantRFC4122 { - t.Errorf("UUIDv3 generated with incorrect variant: %d", u.Variant()) - } - - if u.String() != "5df41881-3aed-3515-88a7-2f4a814cf09e" { - t.Errorf("UUIDv3 generated incorrectly: %s", u.String()) - } - - u = NewV3(NamespaceDNS, "python.org") - - if u.String() != "6fa459ea-ee8a-3ca4-894e-db77e160355e" { - t.Errorf("UUIDv3 generated incorrectly: %s", u.String()) - } - - u1 := NewV3(NamespaceDNS, "golang.org") - u2 := NewV3(NamespaceDNS, "golang.org") - if !Equal(u1, u2) { - t.Errorf("UUIDv3 generated different UUIDs for same namespace and name: %s and %s", u1, u2) - } - - u3 := NewV3(NamespaceDNS, "example.com") - if Equal(u1, u3) { - t.Errorf("UUIDv3 generated same UUIDs for different names in same namespace: %s and %s", u1, u2) - } - - u4 := NewV3(NamespaceURL, "golang.org") - if Equal(u1, u4) { - t.Errorf("UUIDv3 generated same UUIDs for sane names in different namespaces: %s and %s", u1, u4) - } -} - -func TestNewV4(t *testing.T) { - u := NewV4() - - if u.Version() != 4 { - t.Errorf("UUIDv4 generated with incorrect version: %d", u.Version()) - } - - if u.Variant() != VariantRFC4122 { - t.Errorf("UUIDv4 generated with incorrect variant: %d", u.Variant()) - } -} - -func TestNewV5(t *testing.T) { - u := NewV5(NamespaceDNS, "www.example.com") - - if u.Version() != 5 { - t.Errorf("UUIDv5 generated with incorrect version: %d", u.Version()) - } - - if u.Variant() != VariantRFC4122 { - t.Errorf("UUIDv5 generated with incorrect variant: %d", u.Variant()) - } - - u = NewV5(NamespaceDNS, "python.org") - - if u.String() != "886313e1-3b8a-5372-9b90-0c9aee199e5d" { - t.Errorf("UUIDv5 generated incorrectly: %s", u.String()) - } - - u1 := NewV5(NamespaceDNS, "golang.org") - u2 := NewV5(NamespaceDNS, "golang.org") - if !Equal(u1, u2) { - t.Errorf("UUIDv5 generated different UUIDs for same namespace and name: %s and %s", u1, u2) - } - - u3 := NewV5(NamespaceDNS, "example.com") - if Equal(u1, u3) { - t.Errorf("UUIDv5 generated same UUIDs for different names in same namespace: %s and %s", u1, u2) - } - - u4 := NewV5(NamespaceURL, "golang.org") - if Equal(u1, u4) { - t.Errorf("UUIDv3 generated same UUIDs for sane names in different namespaces: %s and %s", u1, u4) - } -} diff --git a/vendor/github.com/soniah/dnsmadeeasy/api_test.go b/vendor/github.com/soniah/dnsmadeeasy/api_test.go deleted file mode 100644 index 9521e5fa0c..0000000000 --- a/vendor/github.com/soniah/dnsmadeeasy/api_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package dnsmadeeasy - -import ( - "bytes" - "errors" - "fmt" - "net/http" - "testing" -) - -func makeClient(t *testing.T) *Client { - client, err := NewClient("aaaaaa1a-11a1-1aa1-a101-11a1a11aa1aa", - "11a0a11a-a1a1-111a-a11a-a11110a11111") - - if err != nil { - t.Fatalf("err: %v", err) - } - - if client.AKey != "aaaaaa1a-11a1-1aa1-a101-11a1a11aa1aa" { - t.Fatalf("api key not set on client: %s", client.AKey) - } - - if client.SKey != "11a0a11a-a1a1-111a-a11a-a11110a11111" { - t.Fatalf("secret key not set on client: %s", client.SKey) - } - - return client -} - -func TestClient_NewRequest(t *testing.T) { - c := makeClient(t) - - body := bytes.NewBuffer(nil) - req, err := c.NewRequest("POST", "/bar", body, "Thu, 04 Dec 2014 11:02:57 GMT") - if err != nil { - t.Fatalf("bad: %v", err) - } - - if req.URL.String() != "https://api.dnsmadeeasy.com/V2.0/bar" { - t.Fatalf("bad base url: %v", req.URL.String()) - } - - if req.Header.Get("X-Dnsme-Apikey") != "aaaaaa1a-11a1-1aa1-a101-11a1a11aa1aa" { - t.Fatalf("bad auth header: %v", req.Header) - } - - if req.Header.Get("X-Dnsme-Requestdate") != "Thu, 04 Dec 2014 11:02:57 GMT" { - t.Fatalf("bad auth header: %v", req.Header) - } - - if req.Header.Get("X-Dnsme-Hmac") != "7a8c517d5eab84e524a537ce3a73e565cabf8f6a" { - t.Fatalf("bad auth header: %v", req.Header) - } - - if req.Method != "POST" { - t.Fatalf("bad method: %v", req.Method) - } -} - -type ClosingBuffer struct { - *bytes.Buffer -} - -func (cb *ClosingBuffer) Close() error { - return nil -} - -var errExample = &http.Response{ - Body: &ClosingBuffer{bytes.NewBufferString(`{"error":["Record with this type (A), name (test), and value (1.1.1.9) already exists."]}`)}, -} - -func Test_ParseError(t *testing.T) { - should := errors.New("API Error (0): Record with this type (A), name (test), and value (1.1.1.9) already exists.") - actual := parseError(errExample) - - if fmt.Sprintf("%v", should) != fmt.Sprintf("%v", actual) { - t.Fatalf("parseError\nshould: |%v|\nactual: |%v|\n", should, actual) - } -} diff --git a/vendor/github.com/soniah/dnsmadeeasy/record_test.go b/vendor/github.com/soniah/dnsmadeeasy/record_test.go deleted file mode 100644 index ea7d0eb194..0000000000 --- a/vendor/github.com/soniah/dnsmadeeasy/record_test.go +++ /dev/null @@ -1,173 +0,0 @@ -package dnsmadeeasy - -import ( - "fmt" - . "github.com/motain/gocheck" - "github.com/soniah/dnsmadeeasy/testutil" - "testing" -) - -func Test(t *testing.T) { - TestingT(t) -} - -type S struct { - client *Client -} - -var _ = Suite(&S{}) - -var testServer = testutil.NewHTTPServer() - -func (s *S) SetUpSuite(c *C) { - testServer.Start() - var err error - s.client, err = NewClient("aaaaaa1a-11a1-1aa1-a101-11a1a11aa1aa", - "11a0a11a-a1a1-111a-a11a-a11110a11111") - s.client.URL = "http://localhost:4444" - if err != nil { - panic(err) - } -} - -func (s *S) TearDownTest(c *C) { - testServer.Flush() -} - -func (s *S) Test_endpoint(c *C) { - c.Assert(create.endpoint("1", ""), Equals, "/dns/managed/1/records/") - c.Assert(retrieve.endpoint("1", ""), Equals, "/dns/managed/1/records/") - c.Assert(update.endpoint("1", "2"), Equals, "/dns/managed/1/records/2/") - c.Assert(destroy.endpoint("1", "2"), Equals, "/dns/managed/1/records/2/") -} - -func (s *S) Test_CreateRecordGood(c *C) { - testServer.Response(201, nil, recordCreate) - cr := map[string]interface{}{ - "Name": "test", - "Value": "1.1.1.1", - } - id, err := s.client.CreateRecord("870073", cr) - _ = testServer.WaitRequest() - c.Assert(err, IsNil) - c.Assert(id, Equals, "10022989") -} - -func (s *S) Test_CreateRecordBad(c *C) { - testServer.Response(404, nil, "") - cr := map[string]interface{}{ - "Name": "test", - "Value": "1.1.1.1", - } - _, err := s.client.CreateRecord("70073", cr) - _ = testServer.WaitRequest() - c.Assert(err, NotNil) -} - -func (s *S) Test_ReadRecordGood(c *C) { - testServer.Response(200, nil, recordRead) - record, err := s.client.ReadRecord("870073", "10039429") - _ = testServer.WaitRequest() - c.Assert(err, IsNil) - c.Assert(record.RecordID, Equals, int64(10039429)) -} - -func (s *S) Test_ReadRecordBad(c *C) { - testServer.Response(200, nil, recordRead) - record, err := s.client.ReadRecord("870073", "1003942") - _ = testServer.WaitRequest() - c.Assert(err, NotNil) - c.Assert(record, IsNil) - c.Assert(fmt.Sprintf("%s", err), Equals, "Unable to find record 1003942") -} - -func (s *S) Test_UpdateRecordGood(c *C) { - testServer.Response(200, nil, recordRead) - testServer.Response(200, nil, "") - cr := map[string]interface{}{ - "Name": "test-update", - } - recordID, err := s.client.UpdateRecord("870073", "10039429", cr) - _ = testServer.WaitRequest() - c.Assert(err, IsNil) - c.Assert(recordID, Equals, "10039429") -} - -func (s *S) Test_UpdateRecordBad(c *C) { - testServer.Response(200, nil, recordRead) - cr := map[string]interface{}{ - "Name": "test-update", - } - recordID, err := s.client.UpdateRecord("870073", "100394", cr) - _ = testServer.WaitRequest() - c.Assert(err, NotNil) - c.Assert(recordID, Equals, "") - c.Assert(fmt.Sprintf("%s", err), Equals, "Unable to find record 100394") -} - -func (s *S) Test_DeleteRecordGood(c *C) { - testServer.Response(200, nil, "") - err := s.client.DeleteRecord("870073", "10039429") - c.Assert(err, IsNil) -} - -func (s *S) Test_DeleteRecordBad(c *C) { - testServer.Response(404, nil, "") - err := s.client.DeleteRecord("870073", "100394") - c.Assert(err, NotNil) - c.Assert(fmt.Sprintf("%s", err), Equals, "Unable to find record 100394") -} - -var recordCreate = `{ - "name":"test", - "value":"1.1.1.1", - "id":10022989, - "type":"A", - "source":1, - "failover":false, - "monitor":false, - "sourceId":870073, - "dynamicDns":false, - "failed":false, - "gtdLocation":"DEFAULT", - "hardLink":false, - "ttl":86400 -}` - -var recordRead = `{ - "data":[ - { - "name":"test", - "value":"1.1.1.1", - "id":10039428, - "type":"A", - "source":1, - "failover":false, - "monitor":false, - "sourceId":870073, - "dynamicDns":false, - "failed":false, - "gtdLocation":"DEFAULT", - "ha rdLink":false, - "ttl":86400 - }, - { - "name":"test", - "value":"1.1.1.2", - "id":10039429, - "type":"A", - "source":1, - "failover":false, - "monitor":false, - "sourceId":870073, - "dynamicDns":false, - "failed":false, - "gtdLocation":"DEFAULT", - "ha rdLink":false, - "ttl":86400 - } - ], - "page":0, - "totalPages":1, - "totalRecords":2 -}` diff --git a/vendor/github.com/sthulb/mime/multipart/example_test.go b/vendor/github.com/sthulb/mime/multipart/example_test.go deleted file mode 100644 index 6d6ba81d5e..0000000000 --- a/vendor/github.com/sthulb/mime/multipart/example_test.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package multipart_test - -import ( - "fmt" - "io" - "io/ioutil" - "log" - "mime" - "mime/multipart" - "net/mail" - "strings" -) - -func ExampleNewReader() { - msg := &mail.Message{ - Header: map[string][]string{ - "Content-Type": {"multipart/mixed; boundary=foo"}, - }, - Body: strings.NewReader( - "--foo\r\nFoo: one\r\n\r\nA section\r\n" + - "--foo\r\nFoo: two\r\n\r\nAnd another\r\n" + - "--foo--\r\n"), - } - mediaType, params, err := mime.ParseMediaType(msg.Header.Get("Content-Type")) - if err != nil { - log.Fatal(err) - } - if strings.HasPrefix(mediaType, "multipart/") { - mr := multipart.NewReader(msg.Body, params["boundary"]) - for { - p, err := mr.NextPart() - if err == io.EOF { - return - } - if err != nil { - log.Fatal(err) - } - slurp, err := ioutil.ReadAll(p) - if err != nil { - log.Fatal(err) - } - fmt.Printf("Part %q: %q\n", p.Header.Get("Foo"), slurp) - } - } - - // Output: - // Part "one": "A section" - // Part "two": "And another" -} diff --git a/vendor/github.com/sthulb/mime/multipart/formdata_test.go b/vendor/github.com/sthulb/mime/multipart/formdata_test.go deleted file mode 100644 index 6e2388bafe..0000000000 --- a/vendor/github.com/sthulb/mime/multipart/formdata_test.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package multipart - -import ( - "bytes" - "io" - "os" - "regexp" - "strings" - "testing" -) - -func TestReadForm(t *testing.T) { - testBody := regexp.MustCompile("\n").ReplaceAllString(message, "\r\n") - b := strings.NewReader(testBody) - r := NewReader(b, boundary) - f, err := r.ReadForm(25) - if err != nil { - t.Fatal("ReadForm:", err) - } - defer f.RemoveAll() - if g, e := f.Value["texta"][0], textaValue; g != e { - t.Errorf("texta value = %q, want %q", g, e) - } - if g, e := f.Value["textb"][0], textbValue; g != e { - t.Errorf("texta value = %q, want %q", g, e) - } - fd := testFile(t, f.File["filea"][0], "filea.txt", fileaContents) - if _, ok := fd.(*os.File); ok { - t.Error("file is *os.File, should not be") - } - fd.Close() - fd = testFile(t, f.File["fileb"][0], "fileb.txt", filebContents) - if _, ok := fd.(*os.File); !ok { - t.Errorf("file has unexpected underlying type %T", fd) - } - fd.Close() -} - -func testFile(t *testing.T, fh *FileHeader, efn, econtent string) File { - if fh.Filename != efn { - t.Errorf("filename = %q, want %q", fh.Filename, efn) - } - f, err := fh.Open() - if err != nil { - t.Fatal("opening file:", err) - } - b := new(bytes.Buffer) - _, err = io.Copy(b, f) - if err != nil { - t.Fatal("copying contents:", err) - } - if g := b.String(); g != econtent { - t.Errorf("contents = %q, want %q", g, econtent) - } - return f -} - -const ( - fileaContents = "This is a test file." - filebContents = "Another test file." - textaValue = "foo" - textbValue = "bar" - boundary = `MyBoundary` -) - -const message = ` ---MyBoundary -Content-Disposition: form-data; name="filea"; filename="filea.txt" -Content-Type: text/plain - -` + fileaContents + ` ---MyBoundary -Content-Disposition: form-data; name="fileb"; filename="fileb.txt" -Content-Type: text/plain - -` + filebContents + ` ---MyBoundary -Content-Disposition: form-data; name="texta" - -` + textaValue + ` ---MyBoundary -Content-Disposition: form-data; name="textb" - -` + textbValue + ` ---MyBoundary-- -` diff --git a/vendor/github.com/sthulb/mime/multipart/multipart_test.go b/vendor/github.com/sthulb/mime/multipart/multipart_test.go deleted file mode 100644 index d06bb4159a..0000000000 --- a/vendor/github.com/sthulb/mime/multipart/multipart_test.go +++ /dev/null @@ -1,813 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package multipart - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "io/ioutil" - "net/textproto" - "os" - "reflect" - "strings" - "testing" -) - -func TestBoundaryLine(t *testing.T) { - mr := NewReader(strings.NewReader(""), "myBoundary") - if !mr.isBoundaryDelimiterLine([]byte("--myBoundary\r\n")) { - t.Error("expected") - } - if !mr.isBoundaryDelimiterLine([]byte("--myBoundary \r\n")) { - t.Error("expected") - } - if !mr.isBoundaryDelimiterLine([]byte("--myBoundary \n")) { - t.Error("expected") - } - if mr.isBoundaryDelimiterLine([]byte("--myBoundary bogus \n")) { - t.Error("expected fail") - } - if mr.isBoundaryDelimiterLine([]byte("--myBoundary bogus--")) { - t.Error("expected fail") - } -} - -func escapeString(v string) string { - bytes, _ := json.Marshal(v) - return string(bytes) -} - -func expectEq(t *testing.T, expected, actual, what string) { - if expected == actual { - return - } - t.Errorf("Unexpected value for %s; got %s (len %d) but expected: %s (len %d)", - what, escapeString(actual), len(actual), escapeString(expected), len(expected)) -} - -func TestNameAccessors(t *testing.T) { - tests := [...][3]string{ - {`form-data; name="foo"`, "foo", ""}, - {` form-data ; name=foo`, "foo", ""}, - {`FORM-DATA;name="foo"`, "foo", ""}, - {` FORM-DATA ; name="foo"`, "foo", ""}, - {` FORM-DATA ; name="foo"`, "foo", ""}, - {` FORM-DATA ; name=foo`, "foo", ""}, - {` FORM-DATA ; filename="foo.txt"; name=foo; baz=quux`, "foo", "foo.txt"}, - {` not-form-data ; filename="bar.txt"; name=foo; baz=quux`, "", "bar.txt"}, - } - for i, test := range tests { - p := &Part{Header: make(map[string][]string)} - p.Header.Set("Content-Disposition", test[0]) - if g, e := p.FormName(), test[1]; g != e { - t.Errorf("test %d: FormName() = %q; want %q", i, g, e) - } - if g, e := p.FileName(), test[2]; g != e { - t.Errorf("test %d: FileName() = %q; want %q", i, g, e) - } - } -} - -var longLine = strings.Repeat("\n\n\r\r\r\n\r\000", (1<<20)/8) - -func testMultipartBody(sep string) string { - testBody := ` -This is a multi-part message. This line is ignored. ---MyBoundary -Header1: value1 -HEADER2: value2 -foo-bar: baz - -My value -The end. ---MyBoundary -name: bigsection - -[longline] ---MyBoundary -Header1: value1b -HEADER2: value2b -foo-bar: bazb - -Line 1 -Line 2 -Line 3 ends in a newline, but just one. - ---MyBoundary - -never read data ---MyBoundary-- - - -useless trailer -` - testBody = strings.Replace(testBody, "\n", sep, -1) - return strings.Replace(testBody, "[longline]", longLine, 1) -} - -func TestMultipart(t *testing.T) { - bodyReader := strings.NewReader(testMultipartBody("\r\n")) - testMultipart(t, bodyReader, false) -} - -func TestMultipartOnlyNewlines(t *testing.T) { - bodyReader := strings.NewReader(testMultipartBody("\n")) - testMultipart(t, bodyReader, true) -} - -func TestMultipartSlowInput(t *testing.T) { - bodyReader := strings.NewReader(testMultipartBody("\r\n")) - testMultipart(t, &slowReader{bodyReader}, false) -} - -func testMultipart(t *testing.T, r io.Reader, onlyNewlines bool) { - reader := NewReader(r, "MyBoundary") - buf := new(bytes.Buffer) - - // Part1 - part, err := reader.NextPart() - if part == nil || err != nil { - t.Error("Expected part1") - return - } - if x := part.Header.Get("Header1"); x != "value1" { - t.Errorf("part.Header.Get(%q) = %q, want %q", "Header1", x, "value1") - } - if x := part.Header.Get("foo-bar"); x != "baz" { - t.Errorf("part.Header.Get(%q) = %q, want %q", "foo-bar", x, "baz") - } - if x := part.Header.Get("Foo-Bar"); x != "baz" { - t.Errorf("part.Header.Get(%q) = %q, want %q", "Foo-Bar", x, "baz") - } - buf.Reset() - if _, err := io.Copy(buf, part); err != nil { - t.Errorf("part 1 copy: %v", err) - } - - adjustNewlines := func(s string) string { - if onlyNewlines { - return strings.Replace(s, "\r\n", "\n", -1) - } - return s - } - - expectEq(t, adjustNewlines("My value\r\nThe end."), buf.String(), "Value of first part") - - // Part2 - part, err = reader.NextPart() - if err != nil { - t.Fatalf("Expected part2; got: %v", err) - return - } - if e, g := "bigsection", part.Header.Get("name"); e != g { - t.Errorf("part2's name header: expected %q, got %q", e, g) - } - buf.Reset() - if _, err := io.Copy(buf, part); err != nil { - t.Errorf("part 2 copy: %v", err) - } - s := buf.String() - if len(s) != len(longLine) { - t.Errorf("part2 body expected long line of length %d; got length %d", - len(longLine), len(s)) - } - if s != longLine { - t.Errorf("part2 long body didn't match") - } - - // Part3 - part, err = reader.NextPart() - if part == nil || err != nil { - t.Error("Expected part3") - return - } - if part.Header.Get("foo-bar") != "bazb" { - t.Error("Expected foo-bar: bazb") - } - buf.Reset() - if _, err := io.Copy(buf, part); err != nil { - t.Errorf("part 3 copy: %v", err) - } - expectEq(t, adjustNewlines("Line 1\r\nLine 2\r\nLine 3 ends in a newline, but just one.\r\n"), - buf.String(), "body of part 3") - - // Part4 - part, err = reader.NextPart() - if part == nil || err != nil { - t.Error("Expected part 4 without errors") - return - } - - // Non-existent part5 - part, err = reader.NextPart() - if part != nil { - t.Error("Didn't expect a fifth part.") - } - if err != io.EOF { - t.Errorf("On fifth part expected io.EOF; got %v", err) - } -} - -func TestVariousTextLineEndings(t *testing.T) { - tests := [...]string{ - "Foo\nBar", - "Foo\nBar\n", - "Foo\r\nBar", - "Foo\r\nBar\r\n", - "Foo\rBar", - "Foo\rBar\r", - "\x00\x01\x02\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10", - } - - for testNum, expectedBody := range tests { - body := "--BOUNDARY\r\n" + - "Content-Disposition: form-data; name=\"value\"\r\n" + - "\r\n" + - expectedBody + - "\r\n--BOUNDARY--\r\n" - bodyReader := strings.NewReader(body) - - reader := NewReader(bodyReader, "BOUNDARY") - buf := new(bytes.Buffer) - part, err := reader.NextPart() - if part == nil { - t.Errorf("Expected a body part on text %d", testNum) - continue - } - if err != nil { - t.Errorf("Unexpected error on text %d: %v", testNum, err) - continue - } - written, err := io.Copy(buf, part) - expectEq(t, expectedBody, buf.String(), fmt.Sprintf("test %d", testNum)) - if err != nil { - t.Errorf("Error copying multipart; bytes=%v, error=%v", written, err) - } - - part, err = reader.NextPart() - if part != nil { - t.Errorf("Unexpected part in test %d", testNum) - } - if err != io.EOF { - t.Errorf("On test %d expected io.EOF; got %v", testNum, err) - } - - } -} - -type maliciousReader struct { - t *testing.T - n int -} - -const maxReadThreshold = 1 << 20 - -func (mr *maliciousReader) Read(b []byte) (n int, err error) { - mr.n += len(b) - if mr.n >= maxReadThreshold { - mr.t.Fatal("too much was read") - return 0, io.EOF - } - return len(b), nil -} - -func TestLineLimit(t *testing.T) { - mr := &maliciousReader{t: t} - r := NewReader(mr, "fooBoundary") - part, err := r.NextPart() - if part != nil { - t.Errorf("unexpected part read") - } - if err == nil { - t.Errorf("expected an error") - } - if mr.n >= maxReadThreshold { - t.Errorf("expected to read < %d bytes; read %d", maxReadThreshold, mr.n) - } -} - -func TestMultipartTruncated(t *testing.T) { - testBody := ` -This is a multi-part message. This line is ignored. ---MyBoundary -foo-bar: baz - -Oh no, premature EOF! -` - body := strings.Replace(testBody, "\n", "\r\n", -1) - bodyReader := strings.NewReader(body) - r := NewReader(bodyReader, "MyBoundary") - - part, err := r.NextPart() - if err != nil { - t.Fatalf("didn't get a part") - } - _, err = io.Copy(ioutil.Discard, part) - if err != io.ErrUnexpectedEOF { - t.Fatalf("expected error io.ErrUnexpectedEOF; got %v", err) - } -} - -type slowReader struct { - r io.Reader -} - -func (s *slowReader) Read(p []byte) (int, error) { - if len(p) == 0 { - return s.r.Read(p) - } - return s.r.Read(p[:1]) -} - -func TestLineContinuation(t *testing.T) { - // This body, extracted from an email, contains headers that span multiple - // lines. - - // TODO: The original mail ended with a double-newline before the - // final delimiter; this was manually edited to use a CRLF. - testBody := - "\n--Apple-Mail-2-292336769\nContent-Transfer-Encoding: 7bit\nContent-Type: text/plain;\n\tcharset=US-ASCII;\n\tdelsp=yes;\n\tformat=flowed\n\nI'm finding the same thing happening on my system (10.4.1).\n\n\n--Apple-Mail-2-292336769\nContent-Transfer-Encoding: quoted-printable\nContent-Type: text/html;\n\tcharset=ISO-8859-1\n\nI'm finding the same thing =\nhappening on my system (10.4.1).=A0 But I built it with XCode =\n2.0.=\n\r\n--Apple-Mail-2-292336769--\n" - - r := NewReader(strings.NewReader(testBody), "Apple-Mail-2-292336769") - - for i := 0; i < 2; i++ { - part, err := r.NextPart() - if err != nil { - t.Fatalf("didn't get a part") - } - var buf bytes.Buffer - n, err := io.Copy(&buf, part) - if err != nil { - t.Errorf("error reading part: %v\nread so far: %q", err, buf.String()) - } - if n <= 0 { - t.Errorf("read %d bytes; expected >0", n) - } - } -} - -func TestQuotedPrintableEncoding(t *testing.T) { - // From https://golang.org/issue/4411 - body := "--0016e68ee29c5d515f04cedf6733\r\nContent-Type: text/plain; charset=ISO-8859-1\r\nContent-Disposition: form-data; name=text\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\nwords words words words words words words words words words words words wor=\r\nds words words words words words words words words words words words words =\r\nwords words words words words words words words words words words words wor=\r\nds words words words words words words words words words words words words =\r\nwords words words words words words words words words\r\n--0016e68ee29c5d515f04cedf6733\r\nContent-Type: text/plain; charset=ISO-8859-1\r\nContent-Disposition: form-data; name=submit\r\n\r\nSubmit\r\n--0016e68ee29c5d515f04cedf6733--" - r := NewReader(strings.NewReader(body), "0016e68ee29c5d515f04cedf6733") - part, err := r.NextPart() - if err != nil { - t.Fatal(err) - } - if te, ok := part.Header["Content-Transfer-Encoding"]; ok { - t.Errorf("unexpected Content-Transfer-Encoding of %q", te) - } - var buf bytes.Buffer - _, err = io.Copy(&buf, part) - if err != nil { - t.Error(err) - } - got := buf.String() - want := "words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words words" - if got != want { - t.Errorf("wrong part value:\n got: %q\nwant: %q", got, want) - } -} - -// Test parsing an image attachment from gmail, which previously failed. -func TestNested(t *testing.T) { - // nested-mime is the body part of a multipart/mixed email - // with boundary e89a8ff1c1e83553e304be640612 - f, err := os.Open("testdata/nested-mime") - if err != nil { - t.Fatal(err) - } - defer f.Close() - mr := NewReader(f, "e89a8ff1c1e83553e304be640612") - p, err := mr.NextPart() - if err != nil { - t.Fatalf("error reading first section (alternative): %v", err) - } - - // Read the inner text/plain and text/html sections of the multipart/alternative. - mr2 := NewReader(p, "e89a8ff1c1e83553e004be640610") - p, err = mr2.NextPart() - if err != nil { - t.Fatalf("reading text/plain part: %v", err) - } - if b, err := ioutil.ReadAll(p); string(b) != "*body*\r\n" || err != nil { - t.Fatalf("reading text/plain part: got %q, %v", b, err) - } - p, err = mr2.NextPart() - if err != nil { - t.Fatalf("reading text/html part: %v", err) - } - if b, err := ioutil.ReadAll(p); string(b) != "body\r\n" || err != nil { - t.Fatalf("reading text/html part: got %q, %v", b, err) - } - - p, err = mr2.NextPart() - if err != io.EOF { - t.Fatalf("final inner NextPart = %v; want io.EOF", err) - } - - // Back to the outer multipart/mixed, reading the image attachment. - _, err = mr.NextPart() - if err != nil { - t.Fatalf("error reading the image attachment at the end: %v", err) - } - - _, err = mr.NextPart() - if err != io.EOF { - t.Fatalf("final outer NextPart = %v; want io.EOF", err) - } -} - -type headerBody struct { - header textproto.MIMEHeader - body string -} - -func formData(key, value string) headerBody { - return headerBody{ - textproto.MIMEHeader{ - "Content-Type": {"text/plain; charset=ISO-8859-1"}, - "Content-Disposition": {"form-data; name=" + key}, - }, - value, - } -} - -type parseTest struct { - name string - in, sep string - want []headerBody -} - -var parseTests = []parseTest{ - // Actual body from App Engine on a blob upload. The final part (the - // Content-Type: message/external-body) is what App Engine replaces - // the uploaded file with. The other form fields (prefixed with - // "other" in their form-data name) are unchanged. A bug was - // reported with blob uploads failing when the other fields were - // empty. This was the MIME POST body that previously failed. - { - name: "App Engine post", - sep: "00151757727e9583fd04bfbca4c6", - in: "--00151757727e9583fd04bfbca4c6\r\nContent-Type: text/plain; charset=ISO-8859-1\r\nContent-Disposition: form-data; name=otherEmpty1\r\n\r\n--00151757727e9583fd04bfbca4c6\r\nContent-Type: text/plain; charset=ISO-8859-1\r\nContent-Disposition: form-data; name=otherFoo1\r\n\r\nfoo\r\n--00151757727e9583fd04bfbca4c6\r\nContent-Type: text/plain; charset=ISO-8859-1\r\nContent-Disposition: form-data; name=otherFoo2\r\n\r\nfoo\r\n--00151757727e9583fd04bfbca4c6\r\nContent-Type: text/plain; charset=ISO-8859-1\r\nContent-Disposition: form-data; name=otherEmpty2\r\n\r\n--00151757727e9583fd04bfbca4c6\r\nContent-Type: text/plain; charset=ISO-8859-1\r\nContent-Disposition: form-data; name=otherRepeatFoo\r\n\r\nfoo\r\n--00151757727e9583fd04bfbca4c6\r\nContent-Type: text/plain; charset=ISO-8859-1\r\nContent-Disposition: form-data; name=otherRepeatFoo\r\n\r\nfoo\r\n--00151757727e9583fd04bfbca4c6\r\nContent-Type: text/plain; charset=ISO-8859-1\r\nContent-Disposition: form-data; name=otherRepeatEmpty\r\n\r\n--00151757727e9583fd04bfbca4c6\r\nContent-Type: text/plain; charset=ISO-8859-1\r\nContent-Disposition: form-data; name=otherRepeatEmpty\r\n\r\n--00151757727e9583fd04bfbca4c6\r\nContent-Type: text/plain; charset=ISO-8859-1\r\nContent-Disposition: form-data; name=submit\r\n\r\nSubmit\r\n--00151757727e9583fd04bfbca4c6\r\nContent-Type: message/external-body; charset=ISO-8859-1; blob-key=AHAZQqG84qllx7HUqO_oou5EvdYQNS3Mbbkb0RjjBoM_Kc1UqEN2ygDxWiyCPulIhpHRPx-VbpB6RX4MrsqhWAi_ZxJ48O9P2cTIACbvATHvg7IgbvZytyGMpL7xO1tlIvgwcM47JNfv_tGhy1XwyEUO8oldjPqg5Q\r\nContent-Disposition: form-data; name=file; filename=\"fall.png\"\r\n\r\nContent-Type: image/png\r\nContent-Length: 232303\r\nX-AppEngine-Upload-Creation: 2012-05-10 23:14:02.715173\r\nContent-MD5: MzRjODU1ZDZhZGU1NmRlOWEwZmMwMDdlODBmZTA0NzA=\r\nContent-Disposition: form-data; name=file; filename=\"fall.png\"\r\n\r\n\r\n--00151757727e9583fd04bfbca4c6--", - want: []headerBody{ - formData("otherEmpty1", ""), - formData("otherFoo1", "foo"), - formData("otherFoo2", "foo"), - formData("otherEmpty2", ""), - formData("otherRepeatFoo", "foo"), - formData("otherRepeatFoo", "foo"), - formData("otherRepeatEmpty", ""), - formData("otherRepeatEmpty", ""), - formData("submit", "Submit"), - {textproto.MIMEHeader{ - "Content-Type": {"message/external-body; charset=ISO-8859-1; blob-key=AHAZQqG84qllx7HUqO_oou5EvdYQNS3Mbbkb0RjjBoM_Kc1UqEN2ygDxWiyCPulIhpHRPx-VbpB6RX4MrsqhWAi_ZxJ48O9P2cTIACbvATHvg7IgbvZytyGMpL7xO1tlIvgwcM47JNfv_tGhy1XwyEUO8oldjPqg5Q"}, - "Content-Disposition": {"form-data; name=file; filename=\"fall.png\""}, - }, "Content-Type: image/png\r\nContent-Length: 232303\r\nX-AppEngine-Upload-Creation: 2012-05-10 23:14:02.715173\r\nContent-MD5: MzRjODU1ZDZhZGU1NmRlOWEwZmMwMDdlODBmZTA0NzA=\r\nContent-Disposition: form-data; name=file; filename=\"fall.png\"\r\n\r\n"}, - }, - }, - - // Single empty part, ended with --boundary immediately after headers. - { - name: "single empty part, --boundary", - sep: "abc", - in: "--abc\r\nFoo: bar\r\n\r\n--abc--", - want: []headerBody{ - {textproto.MIMEHeader{"Foo": {"bar"}}, ""}, - }, - }, - - // Single empty part, ended with \r\n--boundary immediately after headers. - { - name: "single empty part, \r\n--boundary", - sep: "abc", - in: "--abc\r\nFoo: bar\r\n\r\n\r\n--abc--", - want: []headerBody{ - {textproto.MIMEHeader{"Foo": {"bar"}}, ""}, - }, - }, - - // Final part empty. - { - name: "final part empty", - sep: "abc", - in: "--abc\r\nFoo: bar\r\n\r\n--abc\r\nFoo2: bar2\r\n\r\n--abc--", - want: []headerBody{ - {textproto.MIMEHeader{"Foo": {"bar"}}, ""}, - {textproto.MIMEHeader{"Foo2": {"bar2"}}, ""}, - }, - }, - - // Final part empty with newlines after final separator. - { - name: "final part empty then crlf", - sep: "abc", - in: "--abc\r\nFoo: bar\r\n\r\n--abc--\r\n", - want: []headerBody{ - {textproto.MIMEHeader{"Foo": {"bar"}}, ""}, - }, - }, - - // Final part empty with lwsp-chars after final separator. - { - name: "final part empty then lwsp", - sep: "abc", - in: "--abc\r\nFoo: bar\r\n\r\n--abc-- \t", - want: []headerBody{ - {textproto.MIMEHeader{"Foo": {"bar"}}, ""}, - }, - }, - - // No parts (empty form as submitted by Chrome) - { - name: "no parts", - sep: "----WebKitFormBoundaryQfEAfzFOiSemeHfA", - in: "------WebKitFormBoundaryQfEAfzFOiSemeHfA--\r\n", - want: []headerBody{}, - }, - - // Part containing data starting with the boundary, but with additional suffix. - { - name: "fake separator as data", - sep: "sep", - in: "--sep\r\nFoo: bar\r\n\r\n--sepFAKE\r\n--sep--", - want: []headerBody{ - {textproto.MIMEHeader{"Foo": {"bar"}}, "--sepFAKE"}, - }, - }, - - // Part containing a boundary with whitespace following it. - { - name: "boundary with whitespace", - sep: "sep", - in: "--sep \r\nFoo: bar\r\n\r\ntext\r\n--sep--", - want: []headerBody{ - {textproto.MIMEHeader{"Foo": {"bar"}}, "text"}, - }, - }, - - // With ignored leading line. - { - name: "leading line", - sep: "MyBoundary", - in: strings.Replace(`This is a multi-part message. This line is ignored. ---MyBoundary -foo: bar - - ---MyBoundary--`, "\n", "\r\n", -1), - want: []headerBody{ - {textproto.MIMEHeader{"Foo": {"bar"}}, ""}, - }, - }, - - // Issue 10616; minimal - { - name: "issue 10616 minimal", - sep: "sep", - in: "--sep \r\nFoo: bar\r\n\r\n" + - "a\r\n" + - "--sep_alt\r\n" + - "b\r\n" + - "\r\n--sep--", - want: []headerBody{ - {textproto.MIMEHeader{"Foo": {"bar"}}, "a\r\n--sep_alt\r\nb\r\n"}, - }, - }, - - // Issue 10616; full example from bug. - { - name: "nested separator prefix is outer separator", - sep: "----=_NextPart_4c2fbafd7ec4c8bf08034fe724b608d9", - in: strings.Replace(`------=_NextPart_4c2fbafd7ec4c8bf08034fe724b608d9 -Content-Type: multipart/alternative; boundary="----=_NextPart_4c2fbafd7ec4c8bf08034fe724b608d9_alt" - -------=_NextPart_4c2fbafd7ec4c8bf08034fe724b608d9_alt -Content-Type: text/plain; charset="utf-8" -Content-Transfer-Encoding: 8bit - -This is a multi-part message in MIME format. - -------=_NextPart_4c2fbafd7ec4c8bf08034fe724b608d9_alt -Content-Type: text/html; charset="utf-8" -Content-Transfer-Encoding: 8bit - -html things -------=_NextPart_4c2fbafd7ec4c8bf08034fe724b608d9_alt-- -------=_NextPart_4c2fbafd7ec4c8bf08034fe724b608d9--`, "\n", "\r\n", -1), - want: []headerBody{ - {textproto.MIMEHeader{"Content-Type": {`multipart/alternative; boundary="----=_NextPart_4c2fbafd7ec4c8bf08034fe724b608d9_alt"`}}, - strings.Replace(`------=_NextPart_4c2fbafd7ec4c8bf08034fe724b608d9_alt -Content-Type: text/plain; charset="utf-8" -Content-Transfer-Encoding: 8bit - -This is a multi-part message in MIME format. - -------=_NextPart_4c2fbafd7ec4c8bf08034fe724b608d9_alt -Content-Type: text/html; charset="utf-8" -Content-Transfer-Encoding: 8bit - -html things -------=_NextPart_4c2fbafd7ec4c8bf08034fe724b608d9_alt--`, "\n", "\r\n", -1), - }, - }, - }, - // Issue 12662: Check that we don't consume the leading \r if the peekBuffer - // ends in '\r\n--separator-' - { - name: "peek buffer boundary condition", - sep: "00ffded004d4dd0fdf945fbdef9d9050cfd6a13a821846299b27fc71b9db", - in: strings.Replace(`--00ffded004d4dd0fdf945fbdef9d9050cfd6a13a821846299b27fc71b9db -Content-Disposition: form-data; name="block"; filename="block" -Content-Type: application/octet-stream - -`+strings.Repeat("A", peekBufferSize-65)+"\n--00ffded004d4dd0fdf945fbdef9d9050cfd6a13a821846299b27fc71b9db--", "\n", "\r\n", -1), - want: []headerBody{ - {textproto.MIMEHeader{"Content-Type": {`application/octet-stream`}, "Content-Disposition": {`form-data; name="block"; filename="block"`}}, - strings.Repeat("A", peekBufferSize-65), - }, - }, - }, - // Issue 12662: Same test as above with \r\n at the end - { - name: "peek buffer boundary condition", - sep: "00ffded004d4dd0fdf945fbdef9d9050cfd6a13a821846299b27fc71b9db", - in: strings.Replace(`--00ffded004d4dd0fdf945fbdef9d9050cfd6a13a821846299b27fc71b9db -Content-Disposition: form-data; name="block"; filename="block" -Content-Type: application/octet-stream - -`+strings.Repeat("A", peekBufferSize-65)+"\n--00ffded004d4dd0fdf945fbdef9d9050cfd6a13a821846299b27fc71b9db--\n", "\n", "\r\n", -1), - want: []headerBody{ - {textproto.MIMEHeader{"Content-Type": {`application/octet-stream`}, "Content-Disposition": {`form-data; name="block"; filename="block"`}}, - strings.Repeat("A", peekBufferSize-65), - }, - }, - }, - // Issue 12662v2: We want to make sure that for short buffers that end with - // '\r\n--separator-' we always consume at least one (valid) symbol from the - // peekBuffer - { - name: "peek buffer boundary condition", - sep: "aaaaaaaaaa00ffded004d4dd0fdf945fbdef9d9050cfd6a13a821846299b27fc71b9db", - in: strings.Replace(`--aaaaaaaaaa00ffded004d4dd0fdf945fbdef9d9050cfd6a13a821846299b27fc71b9db -Content-Disposition: form-data; name="block"; filename="block" -Content-Type: application/octet-stream - -`+strings.Repeat("A", peekBufferSize)+"\n--aaaaaaaaaa00ffded004d4dd0fdf945fbdef9d9050cfd6a13a821846299b27fc71b9db--", "\n", "\r\n", -1), - want: []headerBody{ - {textproto.MIMEHeader{"Content-Type": {`application/octet-stream`}, "Content-Disposition": {`form-data; name="block"; filename="block"`}}, - strings.Repeat("A", peekBufferSize), - }, - }, - }, - // Context: https://github.com/camlistore/camlistore/issues/642 - // If the file contents in the form happens to have a size such as: - // size = peekBufferSize - (len("\n--") + len(boundary) + len("\r") + 1), (modulo peekBufferSize) - // then peekBufferSeparatorIndex was wrongly returning (-1, false), which was leading to an nCopy - // cut such as: - // "somedata\r| |\n--Boundary\r" (instead of "somedata| |\r\n--Boundary\r"), which was making the - // subsequent Read miss the boundary. - { - name: "safeCount off by one", - sep: "08b84578eabc563dcba967a945cdf0d9f613864a8f4a716f0e81caa71a74", - in: strings.Replace(`--08b84578eabc563dcba967a945cdf0d9f613864a8f4a716f0e81caa71a74 -Content-Disposition: form-data; name="myfile"; filename="my-file.txt" -Content-Type: application/octet-stream - -`, "\n", "\r\n", -1) + - strings.Repeat("A", peekBufferSize-(len("\n--")+len("08b84578eabc563dcba967a945cdf0d9f613864a8f4a716f0e81caa71a74")+len("\r")+1)) + - strings.Replace(` ---08b84578eabc563dcba967a945cdf0d9f613864a8f4a716f0e81caa71a74 -Content-Disposition: form-data; name="key" - -val ---08b84578eabc563dcba967a945cdf0d9f613864a8f4a716f0e81caa71a74-- -`, "\n", "\r\n", -1), - want: []headerBody{ - {textproto.MIMEHeader{"Content-Type": {`application/octet-stream`}, "Content-Disposition": {`form-data; name="myfile"; filename="my-file.txt"`}}, - strings.Repeat("A", peekBufferSize-(len("\n--")+len("08b84578eabc563dcba967a945cdf0d9f613864a8f4a716f0e81caa71a74")+len("\r")+1)), - }, - {textproto.MIMEHeader{"Content-Disposition": {`form-data; name="key"`}}, - "val", - }, - }, - }, - - roundTripParseTest(), -} - -func TestParse(t *testing.T) { -Cases: - for _, tt := range parseTests { - r := NewReader(strings.NewReader(tt.in), tt.sep) - got := []headerBody{} - for { - p, err := r.NextPart() - if err == io.EOF { - break - } - if err != nil { - t.Errorf("in test %q, NextPart: %v", tt.name, err) - continue Cases - } - pbody, err := ioutil.ReadAll(p) - if err != nil { - t.Errorf("in test %q, error reading part: %v", tt.name, err) - continue Cases - } - got = append(got, headerBody{p.Header, string(pbody)}) - } - if !reflect.DeepEqual(tt.want, got) { - t.Errorf("test %q:\n got: %v\nwant: %v", tt.name, got, tt.want) - if len(tt.want) != len(got) { - t.Errorf("test %q: got %d parts, want %d", tt.name, len(got), len(tt.want)) - } else if len(got) > 1 { - for pi, wantPart := range tt.want { - if !reflect.DeepEqual(wantPart, got[pi]) { - t.Errorf("test %q, part %d:\n got: %v\nwant: %v", tt.name, pi, got[pi], wantPart) - } - } - } - } - } -} - -func partsFromReader(r *Reader) ([]headerBody, error) { - got := []headerBody{} - for { - p, err := r.NextPart() - if err == io.EOF { - return got, nil - } - if err != nil { - return nil, fmt.Errorf("NextPart: %v", err) - } - pbody, err := ioutil.ReadAll(p) - if err != nil { - return nil, fmt.Errorf("error reading part: %v", err) - } - got = append(got, headerBody{p.Header, string(pbody)}) - } -} - -func TestParseAllSizes(t *testing.T) { - const maxSize = 5 << 10 - var buf bytes.Buffer - body := strings.Repeat("a", maxSize) - bodyb := []byte(body) - for size := 0; size < maxSize; size++ { - buf.Reset() - w := NewWriter(&buf) - part, _ := w.CreateFormField("f") - part.Write(bodyb[:size]) - part, _ = w.CreateFormField("key") - part.Write([]byte("val")) - w.Close() - r := NewReader(&buf, w.Boundary()) - got, err := partsFromReader(r) - if err != nil { - t.Errorf("For size %d: %v", size, err) - continue - } - if len(got) != 2 { - t.Errorf("For size %d, num parts = %d; want 2", size, len(got)) - continue - } - if got[0].body != body[:size] { - t.Errorf("For size %d, got unexpected len %d: %q", size, len(got[0].body), got[0].body) - } - } -} - -func roundTripParseTest() parseTest { - t := parseTest{ - name: "round trip", - want: []headerBody{ - formData("empty", ""), - formData("lf", "\n"), - formData("cr", "\r"), - formData("crlf", "\r\n"), - formData("foo", "bar"), - }, - } - var buf bytes.Buffer - w := NewWriter(&buf) - for _, p := range t.want { - pw, err := w.CreatePart(p.header) - if err != nil { - panic(err) - } - _, err = pw.Write([]byte(p.body)) - if err != nil { - panic(err) - } - } - w.Close() - t.in = buf.String() - t.sep = w.Boundary() - return t -} diff --git a/vendor/github.com/sthulb/mime/multipart/testdata/nested-mime b/vendor/github.com/sthulb/mime/multipart/testdata/nested-mime deleted file mode 100644 index 71c238e389..0000000000 --- a/vendor/github.com/sthulb/mime/multipart/testdata/nested-mime +++ /dev/null @@ -1,29 +0,0 @@ ---e89a8ff1c1e83553e304be640612 -Content-Type: multipart/alternative; boundary=e89a8ff1c1e83553e004be640610 - ---e89a8ff1c1e83553e004be640610 -Content-Type: text/plain; charset=UTF-8 - -*body* - ---e89a8ff1c1e83553e004be640610 -Content-Type: text/html; charset=UTF-8 - -body - ---e89a8ff1c1e83553e004be640610-- ---e89a8ff1c1e83553e304be640612 -Content-Type: image/png; name="x.png" -Content-Disposition: attachment; - filename="x.png" -Content-Transfer-Encoding: base64 -X-Attachment-Id: f_h1edgigu0 - -iVBORw0KGgoAAAANSUhEUgAAAagAAADrCAIAAACza5XhAAAKMWlDQ1BJQ0MgUHJvZmlsZQAASImd -lndUU9kWh8+9N71QkhCKlNBraFICSA29SJEuKjEJEErAkAAiNkRUcERRkaYIMijggKNDkbEiioUB -8b2kqeGaj4aTNftesu5mob4pr07ecMywRwLBvDCJOksqlUyldAZD7g9fxIZRWWPMvXRNJROJRBIG -Y7Vx0mva1HAwYqibdKONXye3dW4iUonhWFJnqK7OaanU1gGkErFYEgaj0cg8wK+zVPh2ziwnHy07 -U8lYTNapezSzOuevRwLB7CFkqQQCwaJDiBQIBIJFhwh8AoFg0SHUqQUCASRJKkwkhMy/JfODWPEJ -BIJFhwh8AoFg0TFnQqQ55GtPFopcJsN97e1nYtNuIBYeGBgYCmYrmE3jZ05iaGAoMX0xzxkWz6Hv -yO7WvrlwzA0uLzrD+VkKqViwl9IfTBVNFMyc/x9alloiPPlqhQAAAABJRU5ErkJggg== ---e89a8ff1c1e83553e304be640612-- diff --git a/vendor/github.com/sthulb/mime/multipart/writer_test.go b/vendor/github.com/sthulb/mime/multipart/writer_test.go deleted file mode 100644 index 04a6a9b3cb..0000000000 --- a/vendor/github.com/sthulb/mime/multipart/writer_test.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package multipart - -import ( - "bytes" - "io/ioutil" - "net/textproto" - "strings" - "testing" -) - -func TestWriter(t *testing.T) { - fileContents := []byte("my file contents") - - var b bytes.Buffer - w := NewWriter(&b) - { - part, err := w.CreateFormFile("myfile", "my-file.txt") - if err != nil { - t.Fatalf("CreateFormFile: %v", err) - } - part.Write(fileContents) - err = w.WriteField("key", "val") - if err != nil { - t.Fatalf("WriteField: %v", err) - } - part.Write([]byte("val")) - err = w.Close() - if err != nil { - t.Fatalf("Close: %v", err) - } - s := b.String() - if len(s) == 0 { - t.Fatal("String: unexpected empty result") - } - if s[0] == '\r' || s[0] == '\n' { - t.Fatal("String: unexpected newline") - } - } - - r := NewReader(&b, w.Boundary()) - - part, err := r.NextPart() - if err != nil { - t.Fatalf("part 1: %v", err) - } - if g, e := part.FormName(), "myfile"; g != e { - t.Errorf("part 1: want form name %q, got %q", e, g) - } - slurp, err := ioutil.ReadAll(part) - if err != nil { - t.Fatalf("part 1: ReadAll: %v", err) - } - if e, g := string(fileContents), string(slurp); e != g { - t.Errorf("part 1: want contents %q, got %q", e, g) - } - - part, err = r.NextPart() - if err != nil { - t.Fatalf("part 2: %v", err) - } - if g, e := part.FormName(), "key"; g != e { - t.Errorf("part 2: want form name %q, got %q", e, g) - } - slurp, err = ioutil.ReadAll(part) - if err != nil { - t.Fatalf("part 2: ReadAll: %v", err) - } - if e, g := "val", string(slurp); e != g { - t.Errorf("part 2: want contents %q, got %q", e, g) - } - - part, err = r.NextPart() - if part != nil || err == nil { - t.Fatalf("expected end of parts; got %v, %v", part, err) - } -} - -func TestWriterSetBoundary(t *testing.T) { - var b bytes.Buffer - w := NewWriter(&b) - tests := []struct { - b string - ok bool - }{ - {"abc", true}, - {"", false}, - {"ungültig", false}, - {"!", false}, - {strings.Repeat("x", 69), true}, - {strings.Repeat("x", 70), false}, - {"bad!ascii!", false}, - {"my-separator", true}, - } - for i, tt := range tests { - err := w.SetBoundary(tt.b) - got := err == nil - if got != tt.ok { - t.Errorf("%d. boundary %q = %v (%v); want %v", i, tt.b, got, err, tt.ok) - } else if tt.ok { - got := w.Boundary() - if got != tt.b { - t.Errorf("boundary = %q; want %q", got, tt.b) - } - } - } - w.Close() - if got := b.String(); !strings.Contains(got, "\r\n--my-separator--\r\n") { - t.Errorf("expected my-separator in output. got: %q", got) - } -} - -func TestWriterBoundaryGoroutines(t *testing.T) { - // Verify there's no data race accessing any lazy boundary if it's used by - // different goroutines. This was previously broken by - // https://codereview.appspot.com/95760043/ and reverted in - // https://codereview.appspot.com/117600043/ - w := NewWriter(ioutil.Discard) - done := make(chan int) - go func() { - w.CreateFormField("foo") - done <- 1 - }() - w.Boundary() - <-done -} - -func TestSortedHeader(t *testing.T) { - var buf bytes.Buffer - mimeWriter := NewWriter(&buf) - if err := mimeWriter.SetBoundary("MIMEBOUNDARY"); err != nil { - t.Fatalf("Error setting mime boundary: %v", err) - } - - header := textproto.MIMEHeader{"Z": {"1"}, "A": {"2"}, "M": {"3"}, "C": {"4"}} - - part, err := mimeWriter.CreatePart(header) - if err != nil { - t.Fatalf("Unable to create part: %v", err) - } - part.Write([]byte("foo")) - - mimeWriter.Close() - - want := "--MIMEBOUNDARY\r\nA: 2\r\nC: 4\r\nM: 3\r\nZ: 1\r\n\r\nfoo\r\n--MIMEBOUNDARY--\r\n" - if want != buf.String() { - t.Fatalf("\n got: %q\nwant: %q\n", buf.String(), want) - } -} diff --git a/vendor/github.com/tent/http-link-go/link_test.go b/vendor/github.com/tent/http-link-go/link_test.go deleted file mode 100644 index 8a78eeabb8..0000000000 --- a/vendor/github.com/tent/http-link-go/link_test.go +++ /dev/null @@ -1,67 +0,0 @@ -package link - -import ( - "testing" - - . "launchpad.net/gocheck" -) - -// Hook up gocheck into the "go test" runner. -func Test(t *testing.T) { TestingT(t) } - -type LinkSuite struct{} - -var _ = Suite(&LinkSuite{}) - -// TODO: add more tests -var linkParseTests = []struct { - in string - out []Link -}{ - { - "; rel=\"previous\";\n title=\"previous chapter\"", - []Link{{URI: "http://example.com/TheBook/chapter2", Rel: "previous", Params: map[string]string{"title": "previous chapter"}}}, - }, - { - ";\n rel=\"previous\"; title*=UTF-8'de'letztes%20Kapitel,\n ;\n rel=\"next\"; title*=UTF-8'de'n%c3%a4chstes%20Kapitel", - []Link{ - {URI: "/TheBook/chapter2", Rel: "previous", Params: map[string]string{"title*": "UTF-8'de'letztes%20Kapitel"}}, - {URI: "/TheBook/chapter4", Rel: "next", Params: map[string]string{"title*": "UTF-8'de'n%c3%a4chstes%20Kapitel"}}, - }, - }, -} - -func (s *LinkSuite) TestLinkParsing(c *C) { - for i, t := range linkParseTests { - res, err := Parse(t.in) - c.Assert(err, IsNil, Commentf("test %d", i)) - c.Assert(res, DeepEquals, t.out, Commentf("test %d", i)) - } -} - -var linkFormatTests = []struct { - in []Link - out string -}{ - { - []Link{{URI: "/a", Rel: "foo", Params: map[string]string{"a": "b", "c": "d"}}}, - `; rel="foo"; a="b"; c="d"`, - }, - { - []Link{ - {URI: "/b", Rel: "foo", Params: map[string]string{"a": "b", "c": "d"}}, - {URI: "/a", Rel: "foo", Params: map[string]string{"a": "b", "c": "d"}}}, - `; rel="foo"; a="b"; c="d", ; rel="foo"; a="b"; c="d"`, - }, -} - -func (s *LinkSuite) TestLinkGeneration(c *C) { - for i, t := range linkFormatTests { - res := Format(t.in) - cm := Commentf("test %d", i) - c.Assert(res, Equals, t.out, cm) - parsed, err := Parse(res) - c.Assert(err, IsNil, cm) - c.Assert(parsed, DeepEquals, t.in, cm) - } -} diff --git a/vendor/github.com/vmware/govmomi/client_test.go b/vendor/github.com/vmware/govmomi/client_test.go deleted file mode 100644 index 558adc551e..0000000000 --- a/vendor/github.com/vmware/govmomi/client_test.go +++ /dev/null @@ -1,138 +0,0 @@ -/* -Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package govmomi - -import ( - "errors" - "net/http" - "net/url" - "testing" - - "github.com/vmware/govmomi/test" - "github.com/vmware/govmomi/vim25/mo" - "github.com/vmware/govmomi/vim25/types" - "golang.org/x/net/context" -) - -func TestNewClient(t *testing.T) { - u := test.URL() - if u == nil { - t.SkipNow() - } - - c, err := NewClient(context.Background(), u, true) - if err != nil { - t.Fatal(err) - } - - f := func() error { - var x mo.Folder - err = mo.RetrieveProperties(context.Background(), c, c.ServiceContent.PropertyCollector, c.ServiceContent.RootFolder, &x) - if err != nil { - return err - } - if len(x.Name) == 0 { - return errors.New("empty response") - } - return nil - } - - // check cookie is valid with an sdk request - if err := f(); err != nil { - t.Fatal(err) - } - - // check cookie is valid with a non-sdk request - u.User = nil // turn off Basic auth - u.Path = "/folder" - r, err := c.Client.Get(u.String()) - if err != nil { - t.Fatal(err) - } - if r.StatusCode != http.StatusOK { - t.Fatal(r) - } - - // sdk request should fail w/o a valid cookie - c.Client.Jar = nil - if err := f(); err == nil { - t.Fatal("should fail") - } - - // invalid login - u.Path = "/sdk" - u.User = url.UserPassword("ENOENT", "EINVAL") - _, err = NewClient(context.Background(), u, true) - if err == nil { - t.Fatal("should fail") - } -} - -func TestInvalidSdk(t *testing.T) { - u := test.URL() - if u == nil { - t.SkipNow() - } - - // a URL other than a valid /sdk should error, not panic - u.Path = "/mob" - _, err := NewClient(context.Background(), u, true) - if err == nil { - t.Fatal("should fail") - } -} - -func TestPropertiesN(t *testing.T) { - u := test.URL() - if u == nil { - t.SkipNow() - } - - c, err := NewClient(context.Background(), u, true) - if err != nil { - t.Fatal(err) - } - - var f mo.Folder - err = c.RetrieveOne(context.Background(), c.ServiceContent.RootFolder, nil, &f) - if err != nil { - t.Fatal(err) - } - - var dc mo.Datacenter - err = c.RetrieveOne(context.Background(), f.ChildEntity[0], nil, &dc) - if err != nil { - t.Fatal(err) - } - - var folderReferences = []types.ManagedObjectReference{ - dc.DatastoreFolder, - dc.HostFolder, - dc.NetworkFolder, - dc.VmFolder, - } - - var folders []mo.Folder - err = c.Retrieve(context.Background(), folderReferences, []string{"name"}, &folders) - if err != nil { - t.Fatal(err) - } - - if len(folders) != len(folderReferences) { - t.Fatalf("Expected %d, got %d", len(folderReferences), len(folders)) - } -} diff --git a/vendor/github.com/vmware/govmomi/govc/flags/optional_bool_test.go b/vendor/github.com/vmware/govmomi/govc/flags/optional_bool_test.go deleted file mode 100644 index 127bf4666d..0000000000 --- a/vendor/github.com/vmware/govmomi/govc/flags/optional_bool_test.go +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package flags - -import ( - "flag" - "testing" -) - -func TestOptionalBool(t *testing.T) { - fs := flag.NewFlagSet("", flag.ContinueOnError) - var val *bool - - fs.Var(NewOptionalBool(&val), "obool", "optional bool") - - b := fs.Lookup("obool") - - if b.DefValue != "" { - t.Fail() - } - - if b.Value.String() != "" { - t.Fail() - } - - if b.Value.(flag.Getter).Get() != nil { - t.Fail() - } - - b.Value.Set("true") - - if b.Value.String() != "true" { - t.Fail() - } - - if b.Value.(flag.Getter).Get() != true { - t.Fail() - } - - b.Value.Set("false") - - if b.Value.String() != "false" { - t.Fail() - } - - if b.Value.(flag.Getter).Get() != false { - t.Fail() - } -} diff --git a/vendor/github.com/vmware/govmomi/govc/flags/version_test.go b/vendor/github.com/vmware/govmomi/govc/flags/version_test.go deleted file mode 100644 index dc155e9a5a..0000000000 --- a/vendor/github.com/vmware/govmomi/govc/flags/version_test.go +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package flags - -import "testing" - -func TestParseVersion(t *testing.T) { - var v version - var err error - - v, err = ParseVersion("5.5.5.5") - if err != nil { - t.Error(err) - } - - if len(v) != 4 { - t.Errorf("Expected %d elements, got %d", 4, len(v)) - } - - for i := 0; i < len(v); i++ { - if v[i] != 5 { - t.Errorf("Expected %d, got %d", 5, v[i]) - } - } -} - -func TestLte(t *testing.T) { - v1, err := ParseVersion("5.5") - if err != nil { - panic(err) - } - - v2, err := ParseVersion("5.6") - if err != nil { - panic(err) - } - - if !v1.Lte(v1) { - t.Errorf("Expected 5.5 <= 5.5") - } - - if !v1.Lte(v2) { - t.Errorf("Expected 5.5 <= 5.6") - } - - if v2.Lte(v1) { - t.Errorf("Expected not 5.6 <= 5.5") - } -} diff --git a/vendor/github.com/vmware/govmomi/govc/host/esxcli/command_test.go b/vendor/github.com/vmware/govmomi/govc/host/esxcli/command_test.go deleted file mode 100644 index 210da8459a..0000000000 --- a/vendor/github.com/vmware/govmomi/govc/host/esxcli/command_test.go +++ /dev/null @@ -1,124 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package esxcli - -import ( - "reflect" - "testing" - - "github.com/vmware/govmomi/vim25/types" -) - -func TestSystemSettingsAdvancedSetCommand(t *testing.T) { - c := NewCommand([]string{"system", "settings", "advanced", "set", "-o", "/Net/GuestIPHack", "-i", "1"}) - - tests := []struct { - f func() string - expect string - }{ - {c.Name, "set"}, - {c.Namespace, "system.settings.advanced"}, - {c.Method, "vim.EsxCLI.system.settings.advanced.set"}, - {c.Moid, "ha-cli-handler-system-settings-advanced"}, - } - - for _, test := range tests { - actual := test.f() - if actual != test.expect { - t.Errorf("%s != %s", actual, test.expect) - } - } - - params := []CommandInfoParam{ - { - CommandInfoItem: CommandInfoItem{Name: "default", DisplayName: "default", Help: "Reset the option to its default value."}, - Aliases: []string{"-d", "--default"}, - Flag: true, - }, - { - CommandInfoItem: CommandInfoItem{Name: "intvalue", DisplayName: "int-value", Help: "If the option is an integer value use this option."}, - Aliases: []string{"-i", "--int-value"}, - Flag: false, - }, - { - CommandInfoItem: CommandInfoItem{Name: "option", DisplayName: "option", Help: "The name of the option to set the value of. Example: \"/Misc/HostName\""}, - Aliases: []string{"-o", "--option"}, - Flag: false, - }, - { - CommandInfoItem: CommandInfoItem{Name: "stringvalue", DisplayName: "string-value", Help: "If the option is a string use this option."}, - Aliases: []string{"-s", "--string-value"}, - Flag: false, - }, - } - - args, err := c.Parse(params) - if err != nil { - t.Fatal(err) - } - - expect := []types.ReflectManagedMethodExecuterSoapArgument{ - { - DynamicData: types.DynamicData{}, - Name: "intvalue", - Val: "1", - }, - { - DynamicData: types.DynamicData{}, - Name: "option", - Val: "", - }, - } - - if !reflect.DeepEqual(args, expect) { - t.Errorf("%s != %s", args, expect) - } -} - -func TestNetworkVmListCommand(t *testing.T) { - c := NewCommand([]string{"network", "vm", "list"}) - - tests := []struct { - f func() string - expect string - }{ - {c.Name, "list"}, - {c.Namespace, "network.vm"}, - {c.Method, "vim.EsxCLI.network.vm.list"}, - {c.Moid, "ha-cli-handler-network-vm"}, - } - - for _, test := range tests { - actual := test.f() - if actual != test.expect { - t.Errorf("%s != %s", actual, test.expect) - } - } - - var params []CommandInfoParam - - args, err := c.Parse(params) - if err != nil { - t.Fatal(err) - } - - expect := []types.ReflectManagedMethodExecuterSoapArgument{} - - if !reflect.DeepEqual(args, expect) { - t.Errorf("%s != %s", args, expect) - } -} diff --git a/vendor/github.com/vmware/govmomi/govc/host/esxcli/response_test.go b/vendor/github.com/vmware/govmomi/govc/host/esxcli/response_test.go deleted file mode 100644 index 2d96ccef2b..0000000000 --- a/vendor/github.com/vmware/govmomi/govc/host/esxcli/response_test.go +++ /dev/null @@ -1,105 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package esxcli - -import ( - "os" - "reflect" - "testing" - - "github.com/vmware/govmomi/vim25/types" - "github.com/vmware/govmomi/vim25/xml" -) - -func load(name string) *Response { - f, err := os.Open(name) - if err != nil { - panic(err) - } - - defer f.Close() - - var b Response - - dec := xml.NewDecoder(f) - dec.TypeFunc = types.TypeFunc() - if err := dec.Decode(&b); err != nil { - panic(err) - } - - return &b -} - -func TestSystemHostnameGetResponse(t *testing.T) { - res := load("fixtures/system_hostname_get.xml") - - expect := []Values{ - { - "DomainName": {"localdomain"}, - "FullyQualifiedDomainName": {"esxbox.localdomain"}, - "HostName": {"esxbox"}, - }, - } - - if !reflect.DeepEqual(res.Values, expect) { - t.Errorf("%s != %s", res.Values, expect) - } -} - -func TestNetworkVmList(t *testing.T) { - res := load("fixtures/network_vm_list.xml") - - expect := []Values{ - { - "Name": {"foo"}, - "Networks": {"VM Network", "dougm"}, - "NumPorts": {"2"}, - "WorldID": {"98842"}, - }, - { - "Name": {"bar"}, - "Networks": {"VM Network"}, - "NumPorts": {"1"}, - "WorldID": {"236235"}, - }, - } - - if !reflect.DeepEqual(res.Values, expect) { - t.Errorf("%s != %s", res.Values, expect) - } -} - -func TestNetworkVmPortList(t *testing.T) { - r := load("fixtures/network_vm_port_list.xml") - - expect := []Values{ - { - "IPAddress": {"192.168.247.149"}, - "MACAddress": {"00:0c:29:12:b2:cf"}, - "PortID": {"33554438"}, - "Portgroup": {"VM Network"}, - "TeamUplink": {"vmnic0"}, - "UplinkPortID": {"33554434"}, - "vSwitch": {"vSwitch0"}, - "DVPortID": {""}, - }, - } - - if !reflect.DeepEqual(r.Values, expect) { - t.Errorf("%s != %s", r.Values, expect) - } -} diff --git a/vendor/github.com/vmware/govmomi/govc/main_test.go b/vendor/github.com/vmware/govmomi/govc/main_test.go deleted file mode 100644 index 50f99b11e1..0000000000 --- a/vendor/github.com/vmware/govmomi/govc/main_test.go +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package main - -import ( - "flag" - "testing" - - "golang.org/x/net/context" - - "github.com/vmware/govmomi/govc/cli" -) - -func TestMain(t *testing.T) { - // Execute flag registration for every command to verify there are no - // commands with flag name collisions - for _, cmd := range cli.Commands() { - fs := flag.NewFlagSet("", flag.ContinueOnError) - - // Use fresh context for every command - ctx, _ := context.WithCancel(context.Background()) - cmd.Register(ctx, fs) - } -} diff --git a/vendor/github.com/vmware/govmomi/list/path_test.go b/vendor/github.com/vmware/govmomi/list/path_test.go deleted file mode 100644 index 8cb73c3844..0000000000 --- a/vendor/github.com/vmware/govmomi/list/path_test.go +++ /dev/null @@ -1,93 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package list - -import ( - "reflect" - "testing" -) - -func TestToParts(t *testing.T) { - tests := []struct { - In string - Out []string - }{ - { - In: "/", - Out: []string{}, - }, - { - In: "/foo", - Out: []string{"foo"}, - }, - { - In: "/foo/..", - Out: []string{}, - }, - { - In: "/./foo", - Out: []string{"foo"}, - }, - { - In: "/../foo", - Out: []string{"foo"}, - }, - { - In: "/foo/bar", - Out: []string{"foo", "bar"}, - }, - { - In: "/foo/bar/..", - Out: []string{"foo"}, - }, - { - In: "", - Out: []string{"."}, - }, - { - In: ".", - Out: []string{"."}, - }, - { - In: "foo", - Out: []string{".", "foo"}, - }, - { - In: "foo/..", - Out: []string{"."}, - }, - { - In: "./foo", - Out: []string{".", "foo"}, - }, - { - In: "../foo", // Special case... - Out: []string{"..", "foo"}, - }, - { - In: "foo/bar/..", - Out: []string{".", "foo"}, - }, - } - - for _, test := range tests { - out := ToParts(test.In) - if !reflect.DeepEqual(test.Out, out) { - t.Errorf("Expected %s to return: %#v, actual: %#v", test.In, test.Out, out) - } - } -} diff --git a/vendor/github.com/vmware/govmomi/object/cluster_compute_resource_test.go b/vendor/github.com/vmware/govmomi/object/cluster_compute_resource_test.go deleted file mode 100644 index 684f4a6715..0000000000 --- a/vendor/github.com/vmware/govmomi/object/cluster_compute_resource_test.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package object - -// ComputeResource should implement the Reference interface. -var _ Reference = ClusterComputeResource{} diff --git a/vendor/github.com/vmware/govmomi/object/compute_resource_test.go b/vendor/github.com/vmware/govmomi/object/compute_resource_test.go deleted file mode 100644 index 0f29d58e9d..0000000000 --- a/vendor/github.com/vmware/govmomi/object/compute_resource_test.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package object - -// ComputeResource should implement the Reference interface. -var _ Reference = ComputeResource{} diff --git a/vendor/github.com/vmware/govmomi/object/datacenter_test.go b/vendor/github.com/vmware/govmomi/object/datacenter_test.go deleted file mode 100644 index 1eb4105767..0000000000 --- a/vendor/github.com/vmware/govmomi/object/datacenter_test.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package object - -// Datacenter should implement the Reference interface. -var _ Reference = Datacenter{} diff --git a/vendor/github.com/vmware/govmomi/object/distributed_virtual_portgroup_test.go b/vendor/github.com/vmware/govmomi/object/distributed_virtual_portgroup_test.go deleted file mode 100644 index fcbbab26e9..0000000000 --- a/vendor/github.com/vmware/govmomi/object/distributed_virtual_portgroup_test.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package object - -// DistributedVirtualPortgroup should implement the Reference interface. -var _ Reference = DistributedVirtualPortgroup{} - -// DistributedVirtualPortgroup should implement the NetworkReference interface. -var _ NetworkReference = DistributedVirtualPortgroup{} diff --git a/vendor/github.com/vmware/govmomi/object/network_test.go b/vendor/github.com/vmware/govmomi/object/network_test.go deleted file mode 100644 index e957615452..0000000000 --- a/vendor/github.com/vmware/govmomi/object/network_test.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package object - -// Network should implement the Reference interface. -var _ Reference = Network{} - -// Network should implement the NetworkReference interface. -var _ NetworkReference = Network{} diff --git a/vendor/github.com/vmware/govmomi/object/search_index_test.go b/vendor/github.com/vmware/govmomi/object/search_index_test.go deleted file mode 100644 index a601f0aeeb..0000000000 --- a/vendor/github.com/vmware/govmomi/object/search_index_test.go +++ /dev/null @@ -1,155 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package object - -import ( - "fmt" - "reflect" - "testing" - - "github.com/vmware/govmomi/test" - "github.com/vmware/govmomi/vim25/mo" - "golang.org/x/net/context" -) - -func TestSearch(t *testing.T) { - c := test.NewAuthenticatedClient(t) - s := NewSearchIndex(c) - - ref, err := s.FindChild(context.Background(), NewRootFolder(c), "ha-datacenter") - if err != nil { - t.Fatal(err) - } - - dc, ok := ref.(*Datacenter) - if !ok { - t.Errorf("Expected Datacenter: %#v", ref) - } - - folders, err := dc.Folders(context.Background()) - if err != nil { - t.Fatal(err) - } - - ref, err = s.FindChild(context.Background(), folders.DatastoreFolder, "datastore1") - if err != nil { - t.Fatal(err) - } - - _, ok = ref.(*Datastore) - if !ok { - t.Errorf("Expected Datastore: %#v", ref) - } - - ref, err = s.FindByInventoryPath(context.Background(), "/ha-datacenter/network/VM Network") - if err != nil { - t.Fatal(err) - } - - _, ok = ref.(*Network) - if !ok { - t.Errorf("Expected Network: %#v", ref) - } - - crs, err := folders.HostFolder.Children(context.Background()) - if err != nil { - if err != nil { - t.Fatal(err) - } - } - if len(crs) != 0 { - var cr mo.ComputeResource - ref = crs[0] - err = s.Properties(context.Background(), ref.Reference(), []string{"host"}, &cr) - if err != nil { - t.Fatal(err) - } - - var host mo.HostSystem - ref = NewHostSystem(c, cr.Host[0]) - err = s.Properties(context.Background(), ref.Reference(), []string{"name", "hardware", "config"}, &host) - if err != nil { - t.Fatal(err) - } - - dnsConfig := host.Config.Network.DnsConfig.GetHostDnsConfig() - dnsName := fmt.Sprintf("%s.%s", dnsConfig.HostName, dnsConfig.DomainName) - shost, err := s.FindByDnsName(context.Background(), dc, dnsName, false) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(ref, shost) { - t.Errorf("%#v != %#v\n", ref, shost) - } - - shost, err = s.FindByUuid(context.Background(), dc, host.Hardware.SystemInfo.Uuid, false, nil) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(ref, shost) { - t.Errorf("%#v != %#v\n", ref, shost) - } - } - - vms, err := folders.VmFolder.Children(context.Background()) - if err != nil { - t.Fatal(err) - } - if len(vms) != 0 { - var vm mo.VirtualMachine - ref = vms[0] - err = s.Properties(context.Background(), ref.Reference(), []string{"config", "guest"}, &vm) - if err != nil { - t.Fatal(err) - } - svm, err := s.FindByDatastorePath(context.Background(), dc, vm.Config.Files.VmPathName) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(ref, svm) { - t.Errorf("%#v != %#v\n", ref, svm) - } - - svm, err = s.FindByUuid(context.Background(), dc, vm.Config.Uuid, true, nil) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(ref, svm) { - t.Errorf("%#v != %#v\n", ref, svm) - } - - if vm.Guest.HostName != "" { - svm, err := s.FindByDnsName(context.Background(), dc, vm.Guest.HostName, true) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(ref, svm) { - t.Errorf("%#v != %#v\n", ref, svm) - } - } - - if vm.Guest.IpAddress != "" { - svm, err := s.FindByIp(context.Background(), dc, vm.Guest.IpAddress, true) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(ref, svm) { - t.Errorf("%#v != %#v\n", ref, svm) - } - } - } -} diff --git a/vendor/github.com/vmware/govmomi/object/virtual_device_list_test.go b/vendor/github.com/vmware/govmomi/object/virtual_device_list_test.go deleted file mode 100644 index f15c0d68ac..0000000000 --- a/vendor/github.com/vmware/govmomi/object/virtual_device_list_test.go +++ /dev/null @@ -1,848 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package object - -import ( - "math/rand" - "reflect" - "testing" - - "github.com/vmware/govmomi/vim25/types" -) - -var devices = VirtualDeviceList([]types.BaseVirtualDevice{ - &types.VirtualIDEController{ - VirtualController: types.VirtualController{ - VirtualDevice: types.VirtualDevice{ - DynamicData: types.DynamicData{}, - Key: 200, - DeviceInfo: &types.Description{ - DynamicData: types.DynamicData{}, - Label: "IDE 0", - Summary: "IDE 0", - }, - Backing: nil, - Connectable: (*types.VirtualDeviceConnectInfo)(nil), - SlotInfo: nil, - ControllerKey: 0, - UnitNumber: 0, - }, - BusNumber: 0, - Device: []int{3001, 3000}, - }, - }, - &types.VirtualIDEController{ - VirtualController: types.VirtualController{ - VirtualDevice: types.VirtualDevice{ - DynamicData: types.DynamicData{}, - Key: 201, - DeviceInfo: &types.Description{ - DynamicData: types.DynamicData{}, - Label: "IDE 1", - Summary: "IDE 1", - }, - Backing: nil, - Connectable: (*types.VirtualDeviceConnectInfo)(nil), - SlotInfo: nil, - ControllerKey: 0, - UnitNumber: 0, - }, - BusNumber: 1, - Device: []int{3002}, - }, - }, - &types.VirtualPS2Controller{ - VirtualController: types.VirtualController{ - VirtualDevice: types.VirtualDevice{ - DynamicData: types.DynamicData{}, - Key: 300, - DeviceInfo: &types.Description{ - DynamicData: types.DynamicData{}, - Label: "PS2 controller 0", - Summary: "PS2 controller 0", - }, - Backing: nil, - Connectable: (*types.VirtualDeviceConnectInfo)(nil), - SlotInfo: nil, - ControllerKey: 0, - UnitNumber: 0, - }, - BusNumber: 0, - Device: []int{600, 700}, - }, - }, - &types.VirtualPCIController{ - VirtualController: types.VirtualController{ - VirtualDevice: types.VirtualDevice{ - DynamicData: types.DynamicData{}, - Key: 100, - DeviceInfo: &types.Description{ - DynamicData: types.DynamicData{}, - Label: "PCI controller 0", - Summary: "PCI controller 0", - }, - Backing: nil, - Connectable: (*types.VirtualDeviceConnectInfo)(nil), - SlotInfo: nil, - ControllerKey: 0, - UnitNumber: 0, - }, - BusNumber: 0, - Device: []int{500, 12000, 1000, 4000}, - }, - }, - &types.VirtualSIOController{ - VirtualController: types.VirtualController{ - VirtualDevice: types.VirtualDevice{ - DynamicData: types.DynamicData{}, - Key: 400, - DeviceInfo: &types.Description{ - DynamicData: types.DynamicData{}, - Label: "SIO controller 0", - Summary: "SIO controller 0", - }, - Backing: nil, - Connectable: (*types.VirtualDeviceConnectInfo)(nil), - SlotInfo: nil, - ControllerKey: 0, - UnitNumber: 0, - }, - BusNumber: 0, - Device: []int{9000}, - }, - }, - &types.VirtualKeyboard{ - VirtualDevice: types.VirtualDevice{ - DynamicData: types.DynamicData{}, - Key: 600, - DeviceInfo: &types.Description{ - DynamicData: types.DynamicData{}, - Label: "Keyboard ", - Summary: "Keyboard", - }, - Backing: nil, - Connectable: (*types.VirtualDeviceConnectInfo)(nil), - SlotInfo: nil, - ControllerKey: 300, - UnitNumber: 0, - }, - }, - &types.VirtualPointingDevice{ - VirtualDevice: types.VirtualDevice{ - DynamicData: types.DynamicData{}, - Key: 700, - DeviceInfo: &types.Description{ - DynamicData: types.DynamicData{}, - Label: "Pointing device", - Summary: "Pointing device; Device", - }, - Backing: &types.VirtualPointingDeviceDeviceBackingInfo{ - VirtualDeviceDeviceBackingInfo: types.VirtualDeviceDeviceBackingInfo{}, - HostPointingDevice: "autodetect", - }, - Connectable: (*types.VirtualDeviceConnectInfo)(nil), - SlotInfo: nil, - ControllerKey: 300, - UnitNumber: 1, - }, - }, - &types.VirtualMachineVideoCard{ - VirtualDevice: types.VirtualDevice{ - DynamicData: types.DynamicData{}, - Key: 500, - DeviceInfo: &types.Description{ - DynamicData: types.DynamicData{}, - Label: "Video card ", - Summary: "Video card", - }, - Backing: nil, - Connectable: (*types.VirtualDeviceConnectInfo)(nil), - SlotInfo: nil, - ControllerKey: 100, - UnitNumber: 0, - }, - VideoRamSizeInKB: 4096, - NumDisplays: 1, - UseAutoDetect: types.NewBool(false), - Enable3DSupport: types.NewBool(false), - Use3dRenderer: "automatic", - }, - &types.VirtualMachineVMCIDevice{ - VirtualDevice: types.VirtualDevice{ - DynamicData: types.DynamicData{}, - Key: 12000, - DeviceInfo: &types.Description{ - DynamicData: types.DynamicData{}, - Label: "VMCI device", - Summary: "Device on the virtual machine PCI bus that provides support for the virtual machine communication interface", - }, - Backing: nil, - Connectable: (*types.VirtualDeviceConnectInfo)(nil), - SlotInfo: &types.VirtualDevicePciBusSlotInfo{ - VirtualDeviceBusSlotInfo: types.VirtualDeviceBusSlotInfo{}, - PciSlotNumber: 33, - }, - ControllerKey: 100, - UnitNumber: 17, - }, - Id: 1754519335, - AllowUnrestrictedCommunication: types.NewBool(false), - }, - &types.VirtualLsiLogicController{ - VirtualSCSIController: types.VirtualSCSIController{ - VirtualController: types.VirtualController{ - VirtualDevice: types.VirtualDevice{ - DynamicData: types.DynamicData{}, - Key: 1000, - DeviceInfo: &types.Description{ - DynamicData: types.DynamicData{}, - Label: "SCSI controller 0", - Summary: "LSI Logic", - }, - Backing: nil, - Connectable: (*types.VirtualDeviceConnectInfo)(nil), - SlotInfo: nil, - ControllerKey: 100, - UnitNumber: 3, - }, - BusNumber: 0, - Device: nil, - }, - HotAddRemove: types.NewBool(true), - SharedBus: "noSharing", - ScsiCtlrUnitNumber: 7, - }, - }, - &types.VirtualCdrom{ - VirtualDevice: types.VirtualDevice{ - DynamicData: types.DynamicData{}, - Key: 3001, - DeviceInfo: &types.Description{ - DynamicData: types.DynamicData{}, - Label: "CD/DVD drive 1", - Summary: "ISO [datastore1] ttylinux-pc_i486-16.1.iso", - }, - Backing: &types.VirtualCdromIsoBackingInfo{ - VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{ - VirtualDeviceBackingInfo: types.VirtualDeviceBackingInfo{}, - FileName: "[datastore1] foo.iso", - Datastore: &types.ManagedObjectReference{Type: "Datastore", Value: "53fe43cc-75dc5110-3643-000c2918dc41"}, - BackingObjectId: "", - }, - }, - Connectable: &types.VirtualDeviceConnectInfo{ - DynamicData: types.DynamicData{}, - StartConnected: true, - AllowGuestControl: true, - Connected: false, - Status: "untried", - }, - SlotInfo: nil, - ControllerKey: 200, - UnitNumber: 1, - }, - }, - &types.VirtualDisk{ - VirtualDevice: types.VirtualDevice{ - DynamicData: types.DynamicData{}, - Key: 3000, - DeviceInfo: &types.Description{ - DynamicData: types.DynamicData{}, - Label: "Hard disk 1", - Summary: "30,720 KB", - }, - Backing: &types.VirtualDiskFlatVer2BackingInfo{ - VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{ - VirtualDeviceBackingInfo: types.VirtualDeviceBackingInfo{}, - FileName: "[datastore1] bar/bar.vmdk", - Datastore: &types.ManagedObjectReference{Type: "Datastore", Value: "53fe43cc-75dc5110-3643-000c2918dc41"}, - BackingObjectId: "3-3000-0", - }, - DiskMode: "persistent", - Split: types.NewBool(false), - WriteThrough: types.NewBool(false), - ThinProvisioned: types.NewBool(false), - EagerlyScrub: types.NewBool(true), - Uuid: "6000C296-d0af-1209-1975-10c98eae10e4", - ContentId: "d46395062e2d1b1790985bdec573b211", - ChangeId: "", - Parent: &types.VirtualDiskFlatVer2BackingInfo{ - VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{ - VirtualDeviceBackingInfo: types.VirtualDeviceBackingInfo{}, - FileName: "[datastore1] ttylinux.vmdk", - Datastore: &types.ManagedObjectReference{Type: "Datastore", Value: "53fe43cc-75dc5110-3643-000c2918dc41"}, - BackingObjectId: "3-3000-1", - }, - DiskMode: "persistent", - Split: types.NewBool(false), - WriteThrough: types.NewBool(false), - ThinProvisioned: types.NewBool(false), - EagerlyScrub: types.NewBool(true), - Uuid: "6000C296-d0af-1209-1975-10c98eae10e4", - ContentId: "1c2dad9e1662219e962a620c6d238a7c", - ChangeId: "", - Parent: (*types.VirtualDiskFlatVer2BackingInfo)(nil), - DeltaDiskFormat: "", - DigestEnabled: types.NewBool(false), - DeltaGrainSize: 0, - }, - DeltaDiskFormat: "redoLogFormat", - DigestEnabled: types.NewBool(false), - DeltaGrainSize: 0, - }, - Connectable: (*types.VirtualDeviceConnectInfo)(nil), - SlotInfo: nil, - ControllerKey: 200, - UnitNumber: 0, - }, - CapacityInKB: 30720, - CapacityInBytes: 31457280, - Shares: &types.SharesInfo{ - DynamicData: types.DynamicData{}, - Shares: 1000, - Level: "normal", - }, - StorageIOAllocation: &types.StorageIOAllocationInfo{ - DynamicData: types.DynamicData{}, - Limit: -1, - Shares: &types.SharesInfo{ - DynamicData: types.DynamicData{}, - Shares: 1000, - Level: "normal", - }, - Reservation: 0, - }, - DiskObjectId: "3-3000", - VFlashCacheConfigInfo: (*types.VirtualDiskVFlashCacheConfigInfo)(nil), - }, - &types.VirtualDisk{ - VirtualDevice: types.VirtualDevice{ - DynamicData: types.DynamicData{}, - Key: 3002, - DeviceInfo: &types.Description{ - DynamicData: types.DynamicData{}, - Label: "Hard disk 2", - Summary: "10,000,000 KB", - }, - Backing: &types.VirtualDiskFlatVer2BackingInfo{ - VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{ - VirtualDeviceBackingInfo: types.VirtualDeviceBackingInfo{}, - FileName: "[datastore1] bar/disk-201-0.vmdk", - Datastore: &types.ManagedObjectReference{Type: "Datastore", Value: "53fe43cc-75dc5110-3643-000c2918dc41"}, - BackingObjectId: "3-3002-0", - }, - DiskMode: "persistent", - Split: types.NewBool(false), - WriteThrough: types.NewBool(false), - ThinProvisioned: types.NewBool(true), - EagerlyScrub: types.NewBool(false), - Uuid: "6000C293-fde5-4457-5118-dd267ea992a7", - ContentId: "90399989b9d520eed6793ab0fffffffe", - ChangeId: "", - Parent: (*types.VirtualDiskFlatVer2BackingInfo)(nil), - DeltaDiskFormat: "", - DigestEnabled: types.NewBool(false), - DeltaGrainSize: 0, - }, - Connectable: (*types.VirtualDeviceConnectInfo)(nil), - SlotInfo: nil, - ControllerKey: 201, - UnitNumber: 0, - }, - CapacityInKB: 10000000, - CapacityInBytes: 10240000000, - Shares: &types.SharesInfo{ - DynamicData: types.DynamicData{}, - Shares: 1000, - Level: "normal", - }, - StorageIOAllocation: &types.StorageIOAllocationInfo{ - DynamicData: types.DynamicData{}, - Limit: -1, - Shares: &types.SharesInfo{ - DynamicData: types.DynamicData{}, - Shares: 1000, - Level: "normal", - }, - Reservation: 0, - }, - DiskObjectId: "3-3002", - VFlashCacheConfigInfo: (*types.VirtualDiskVFlashCacheConfigInfo)(nil), - }, - &types.VirtualE1000{ - VirtualEthernetCard: types.VirtualEthernetCard{ - VirtualDevice: types.VirtualDevice{ - DynamicData: types.DynamicData{}, - Key: 4000, - DeviceInfo: &types.Description{ - DynamicData: types.DynamicData{}, - Label: "Network adapter 1", - Summary: "VM Network", - }, - Backing: &types.VirtualEthernetCardNetworkBackingInfo{ - VirtualDeviceDeviceBackingInfo: types.VirtualDeviceDeviceBackingInfo{ - VirtualDeviceBackingInfo: types.VirtualDeviceBackingInfo{}, - DeviceName: "VM Network", - UseAutoDetect: types.NewBool(false), - }, - Network: &types.ManagedObjectReference{Type: "Network", Value: "HaNetwork-VM Network"}, - InPassthroughMode: types.NewBool(false), - }, - Connectable: &types.VirtualDeviceConnectInfo{ - DynamicData: types.DynamicData{}, - StartConnected: true, - AllowGuestControl: true, - Connected: false, - Status: "untried", - }, - SlotInfo: &types.VirtualDevicePciBusSlotInfo{ - VirtualDeviceBusSlotInfo: types.VirtualDeviceBusSlotInfo{}, - PciSlotNumber: 32, - }, - ControllerKey: 100, - UnitNumber: 7, - }, - AddressType: "generated", - MacAddress: "00:0c:29:93:d7:27", - WakeOnLanEnabled: types.NewBool(true), - }, - }, - &types.VirtualSerialPort{ - VirtualDevice: types.VirtualDevice{ - DynamicData: types.DynamicData{}, - Key: 9000, - DeviceInfo: &types.Description{ - DynamicData: types.DynamicData{}, - Label: "Serial port 1", - Summary: "Remote localhost:0", - }, - Backing: &types.VirtualSerialPortURIBackingInfo{ - VirtualDeviceURIBackingInfo: types.VirtualDeviceURIBackingInfo{ - VirtualDeviceBackingInfo: types.VirtualDeviceBackingInfo{}, - ServiceURI: "localhost:0", - Direction: "client", - ProxyURI: "", - }, - }, - Connectable: &types.VirtualDeviceConnectInfo{ - DynamicData: types.DynamicData{}, - StartConnected: true, - AllowGuestControl: true, - Connected: false, - Status: "untried", - }, - SlotInfo: nil, - ControllerKey: 400, - UnitNumber: 0, - }, - YieldOnPoll: true, - }, -}) - -func TestSelectByType(t *testing.T) { - tests := []struct { - dtype types.BaseVirtualDevice - expect int - }{ - { - (*types.VirtualCdrom)(nil), - 1, - }, - { - (*types.VirtualEthernetCard)(nil), - 1, - }, - { - (*types.VirtualDisk)(nil), - 2, - }, - { - (*types.VirtualController)(nil), - 6, - }, - { - (*types.VirtualIDEController)(nil), - 2, - }, - { - (*types.VirtualSCSIController)(nil), - 1, - }, - { - (*types.VirtualLsiLogicController)(nil), - 1, - }, - { - (*types.ParaVirtualSCSIController)(nil), - 0, - }, - } - - for _, test := range tests { - d := devices.SelectByType(test.dtype) - - if len(d) != test.expect { - t.Errorf("%#v has %d", test.dtype, len(devices)) - } - } -} - -func TestSelectByBackingInfo(t *testing.T) { - tests := []types.BaseVirtualDeviceBackingInfo{ - &types.VirtualEthernetCardNetworkBackingInfo{ - VirtualDeviceDeviceBackingInfo: types.VirtualDeviceDeviceBackingInfo{ - DeviceName: "VM Network", - }, - }, - &types.VirtualDiskFlatVer2BackingInfo{ - VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{ - FileName: "[datastore1] bar/bar.vmdk", - }, - }, - &types.VirtualDiskFlatVer2BackingInfo{ - Parent: &types.VirtualDiskFlatVer2BackingInfo{ - VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{ - FileName: "[datastore1] ttylinux.vmdk", - }, - }, - }, - &types.VirtualCdromIsoBackingInfo{ - VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{ - VirtualDeviceBackingInfo: types.VirtualDeviceBackingInfo{}, - FileName: "[datastore1] foo.iso", - }, - }, - (*types.VirtualCdromIsoBackingInfo)(nil), - &types.VirtualSerialPortURIBackingInfo{ - VirtualDeviceURIBackingInfo: types.VirtualDeviceURIBackingInfo{ - VirtualDeviceBackingInfo: types.VirtualDeviceBackingInfo{}, - ServiceURI: "localhost:0", - Direction: "client", - ProxyURI: "", - }, - }, - (*types.VirtualSerialPortURIBackingInfo)(nil), - } - - for _, test := range tests { - l := devices.SelectByBackingInfo(test) - - if len(l) != 1 { - t.Errorf("Expected 1, got %d: %#v", len(l), test) - } - } - - // test selecting by backing type - tests = []types.BaseVirtualDeviceBackingInfo{ - (*types.VirtualDiskFlatVer2BackingInfo)(nil), - } - - for _, test := range tests { - l := devices.SelectByBackingInfo(test) - - if len(l) != 2 { - t.Errorf("Expected 2, got %d: %#v", len(l), test) - } - } -} - -func TestFind(t *testing.T) { - for _, device := range devices { - name := devices.Name(device) - d := devices.Find(name) - if name != devices.Name(d) { - t.Errorf("expected name: %s, got: %s", name, devices.Name(d)) - } - } - - d := devices.Find("enoent") - if d != nil { - t.Errorf("unexpected: %#v", d) - } -} - -func TestFindController(t *testing.T) { - for _, name := range []string{"", "ide-200"} { - _, err := devices.FindIDEController(name) - if err != nil { - t.Error(err) - } - } - - for _, name := range []string{"", "lsilogic-1000"} { - _, err := devices.FindSCSIController(name) - if err != nil { - t.Error(err) - } - } - - fns := []func() error{ - func() error { - _, err := devices.FindIDEController("lsilogic-1000") - return err - }, - func() error { - _, err := devices.FindSCSIController("ide-200") - return err - }, - } - - for _, f := range fns { - err := f() - if err == nil { - t.Error("should fail") - } - } -} - -func TestPickController(t *testing.T) { - list := devices - - tests := []struct { - ctype types.BaseVirtualController - key int - unit int - }{ - { - (*types.VirtualIDEController)(nil), 201, 1, - }, - { - (*types.VirtualSCSIController)(nil), 1000, 0, - }, - { - (*types.VirtualSCSIController)(nil), 1000, 1, - }, - } - - for _, test := range tests { - c := list.PickController(test.ctype).GetVirtualController() - - key := c.Key - if key != test.key { - t.Errorf("expected controller key: %d, got: %d\n", test.key, key) - } - - unit := list.newUnitNumber(c) - if unit != test.unit { - t.Errorf("expected unit number: %d, got: %d\n", test.unit, unit) - } - - dev := &types.VirtualDevice{ - Key: rand.Int(), - UnitNumber: unit, - ControllerKey: key, - } - - list = append(list, dev) - c.Device = append(c.Device, dev.Key) - } - - if list.PickController((*types.VirtualIDEController)(nil)) != nil { - t.Error("should be nil") - } - - if list.PickController((*types.VirtualSCSIController)(nil)) == nil { - t.Errorf("should not be nil") - } -} - -func TestCreateSCSIController(t *testing.T) { - for _, l := range []VirtualDeviceList{SCSIControllerTypes(), devices} { - _, err := l.CreateSCSIController("enoent") - if err == nil { - t.Error("should fail") - } - - for _, name := range []string{"", "scsi", "pvscsi", "buslogic", "lsilogic", "lsilogic-sas"} { - _, err = l.CreateSCSIController(name) - if err != nil { - t.Error(err) - } - } - } -} - -func TestCreateEthernetCard(t *testing.T) { - _, err := EthernetCardTypes().CreateEthernetCard("enoent", nil) - if err == nil { - t.Error("should fail") - } - - for _, name := range []string{"", "e1000", "e1000e", "vmxnet3"} { - _, err := EthernetCardTypes().CreateEthernetCard(name, nil) - if err != nil { - t.Error(err) - } - } -} - -func TestCdrom(t *testing.T) { - c, err := devices.FindCdrom("") - if err != nil { - t.Error(err) - } - - d := devices.Find(devices.Name(c)) - - if c.Key != d.GetVirtualDevice().Key { - t.Error("device key mismatch") - } - - for _, name := range []string{"enoent", "ide-200"} { - c, err = devices.FindCdrom(name) - if err == nil { - t.Errorf("FindCdrom(%s) should fail", name) - } - } - - c, err = devices.Select(func(device types.BaseVirtualDevice) bool { - if _, ok := device.(*types.VirtualCdrom); ok { - return false - } - return true - }).FindCdrom("") - - if err == nil { - t.Error("FindCdrom('') should fail") - } -} - -func TestSerialPort(t *testing.T) { - device, err := devices.CreateSerialPort() - if err != nil { - t.Error(err) - } - devices.ConnectSerialPort(device, "telnet://:33233", false) -} - -func TestPrimaryMacAddress(t *testing.T) { - expect := "00:0c:29:93:d7:27" - mac := devices.PrimaryMacAddress() - if expect != mac { - t.Errorf("expected: %s, got: %s", expect, mac) - } -} - -func TestBootOrder(t *testing.T) { - o := []string{DeviceTypeEthernet, DeviceTypeCdrom, DeviceTypeFloppy, DeviceTypeDisk} - list := devices - - n := 4 // 1 ethernet, 1 cdrom, 2 disk - order := list.BootOrder(o) - if len(order) != n { - t.Errorf("expected %d boot devices, got: %d", n, len(order)) - } - - list = list.SelectBootOrder(order) - if len(list) != n { - t.Errorf("expected %d boot devices, got: %d", n, len(list)) - } - - // test lookup by name - var names []string - for _, x := range list { - names = append(names, list.Name(x)) - } - - order = list.BootOrder(names) - if len(order) != n { - t.Errorf("expected %d boot devices, got: %d", n, len(order)) - } - - if !reflect.DeepEqual(list, list.SelectBootOrder(order)) { - t.Error("boot order mismatch") - } - - // remove disks - list = list.Select(func(device types.BaseVirtualDevice) bool { - if _, ok := device.(*types.VirtualDisk); ok { - return false - } - return true - }) - - n = 2 // 1 ethernet, 1 cdrom - order = list.BootOrder(o) - if len(order) != n { - t.Errorf("expected %d boot devices, got: %d", n, len(order)) - } - - if !reflect.DeepEqual(list, list.SelectBootOrder(order)) { - t.Error("boot order mismatch") - } - - if len(list.BootOrder([]string{DeviceTypeDisk})) != 0 { - t.Error("expected 0 disks") - } -} - -func TestName(t *testing.T) { - tests := []struct { - device types.BaseVirtualDevice - expect string - }{ - { - &types.VirtualCdrom{}, - "cdrom-0", - }, - { - &types.VirtualDisk{}, - "disk-0-0", - }, - { - &types.VirtualFloppy{}, - "floppy-0", - }, - { - &types.VirtualIDEController{}, - "ide-0", - }, - { - &types.VirtualMachineVideoCard{}, - "video-0", - }, - { - &types.VirtualPointingDevice{}, - "pointing-0", - }, - { - &types.ParaVirtualSCSIController{}, - "pvscsi-0", - }, - { - &types.VirtualSerialPort{}, - "serialport-0", - }, - { - &types.VirtualE1000{ - VirtualEthernetCard: types.VirtualEthernetCard{ - VirtualDevice: types.VirtualDevice{ - UnitNumber: 7, - }, - }, - }, - "ethernet-0", - }, - } - - for _, test := range tests { - name := devices.Name(test.device) - if name != test.expect { - t.Errorf("expected: %s, got: %s", test.expect, name) - } - } -} diff --git a/vendor/github.com/vmware/govmomi/object/virtual_machine_test.go b/vendor/github.com/vmware/govmomi/object/virtual_machine_test.go deleted file mode 100644 index 3cd1c8d53e..0000000000 --- a/vendor/github.com/vmware/govmomi/object/virtual_machine_test.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package object - -// VirtualMachine should implement the Reference interface. -var _ Reference = VirtualMachine{} diff --git a/vendor/github.com/vmware/govmomi/ovf/env_test.go b/vendor/github.com/vmware/govmomi/ovf/env_test.go deleted file mode 100644 index 096a5c2354..0000000000 --- a/vendor/github.com/vmware/govmomi/ovf/env_test.go +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -package ovf - -import "testing" - -func testEnv() Env { - return Env{ - EsxID: "vm moref", - Platform: &PlatformSection{ - Kind: "VMware vCenter Server", - Version: "5.5.0", - Vendor: "VMware, Inc.", - Locale: "US", - }, - Property: &PropertySection{ - Properties: []EnvProperty{ - EnvProperty{"foo", "bar"}, - EnvProperty{"ham", "eggs"}}}, - } -} - -func TestMarshalEnv(t *testing.T) { - env := testEnv() - - xenv, err := env.Marshal() - if err != nil { - t.Fatal("Error marshalling environment") - } - if len(xenv) < 1 { - t.Fatal("Marshalled document is empty") - } - t.Log(xenv) -} - -func TestMarshalManualEnv(t *testing.T) { - env := testEnv() - - xenv := env.MarshalManual() - if len(xenv) < 1 { - t.Fatal("Marshalled document is empty") - } - t.Log(xenv) -} diff --git a/vendor/github.com/vmware/govmomi/ovf/ovf_test.go b/vendor/github.com/vmware/govmomi/ovf/ovf_test.go deleted file mode 100644 index 40f2f08b59..0000000000 --- a/vendor/github.com/vmware/govmomi/ovf/ovf_test.go +++ /dev/null @@ -1,85 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package ovf - -import ( - "bytes" - "fmt" - "os" - "testing" - "text/tabwriter" -) - -func testFile(t *testing.T) *os.File { - n := os.Getenv("OVF_TEST_FILE") - if n == "" { - t.Skip("Please specify OVF_TEST_FILE") - } - - f, err := os.Open(n) - if err != nil { - t.Fatal(err) - } - - return f -} - -func testEnvelope(t *testing.T) *Envelope { - f := testFile(t) - defer f.Close() - - e, err := Unmarshal(f) - if err != nil { - t.Fatal(f) - } - - if e == nil { - t.Fatal("Empty envelope") - } - - return e -} - -func TestUnmarshal(t *testing.T) { - testEnvelope(t) -} - -func TestDeploymentOptions(t *testing.T) { - e := testEnvelope(t) - - if e.DeploymentOption == nil { - t.Fatal("Missing DeploymentOptionSection") - } - - var b bytes.Buffer - tw := tabwriter.NewWriter(&b, 2, 0, 2, ' ', 0) - fmt.Fprintf(tw, "\n") - for _, c := range e.DeploymentOption.Configuration { - fmt.Fprintf(tw, "id=%s\t", c.ID) - fmt.Fprintf(tw, "label=%s\t", c.Label) - - d := false - if c.Default != nil { - d = *c.Default - } - - fmt.Fprintf(tw, "default=%t\t", d) - fmt.Fprintf(tw, "\n") - } - tw.Flush() - t.Log(b.String()) -} diff --git a/vendor/github.com/vmware/govmomi/session/keep_alive_test.go b/vendor/github.com/vmware/govmomi/session/keep_alive_test.go deleted file mode 100644 index 69b317c7d7..0000000000 --- a/vendor/github.com/vmware/govmomi/session/keep_alive_test.go +++ /dev/null @@ -1,280 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package session - -import ( - "fmt" - "net/url" - "os" - "runtime" - "testing" - "time" - - "github.com/vmware/govmomi/test" - "github.com/vmware/govmomi/vim25" - "github.com/vmware/govmomi/vim25/methods" - "github.com/vmware/govmomi/vim25/soap" - "github.com/vmware/govmomi/vim25/types" - "golang.org/x/net/context" -) - -type testKeepAlive int - -func (t *testKeepAlive) Func(soap.RoundTripper) error { - *t++ - return nil -} - -func newManager(t *testing.T) (*Manager, *url.URL) { - u := test.URL() - if u == nil { - t.SkipNow() - } - - soapClient := soap.NewClient(u, true) - vimClient, err := vim25.NewClient(context.Background(), soapClient) - if err != nil { - t.Fatal(err) - } - - return NewManager(vimClient), u -} - -func TestKeepAlive(t *testing.T) { - var i testKeepAlive - var j int - - m, u := newManager(t) - k := KeepAlive(m.client.RoundTripper, time.Millisecond) - k.(*keepAlive).keepAlive = i.Func - m.client.RoundTripper = k - - // Expect keep alive to not have triggered yet - if i != 0 { - t.Errorf("Expected i == 0, got i: %d", i) - } - - // Logging in starts keep alive - err := m.Login(context.Background(), u.User) - if err != nil { - t.Error(err) - } - - time.Sleep(2 * time.Millisecond) - - // Expect keep alive to triggered at least once - if i == 0 { - t.Errorf("Expected i != 0, got i: %d", i) - } - - j = int(i) - time.Sleep(2 * time.Millisecond) - - // Expect keep alive to triggered at least once more - if int(i) <= j { - t.Errorf("Expected i > j, got i: %d, j: %d", i, j) - } - - // Logging out stops keep alive - err = m.Logout(context.Background()) - if err != nil { - t.Error(err) - } - - j = int(i) - time.Sleep(2 * time.Millisecond) - - // Expect keep alive to have stopped - if int(i) != j { - t.Errorf("Expected i == j, got i: %d, j: %d", i, j) - } -} - -func testSessionOK(t *testing.T, m *Manager, ok bool) { - s, err := m.UserSession(context.Background()) - if err != nil { - t.Fatal(err) - } - - _, file, line, _ := runtime.Caller(1) - prefix := fmt.Sprintf("%s:%d", file, line) - - if ok && s == nil { - t.Fatalf("%s: Expected session to be OK, but is invalid", prefix) - } - - if !ok && s != nil { - t.Fatalf("%s: Expected session to be invalid, but is OK", prefix) - } -} - -// Run with: -// -// env GOVMOMI_KEEPALIVE_TEST=1 go test -timeout=60m -run TestRealKeepAlive -// -func TestRealKeepAlive(t *testing.T) { - if os.Getenv("GOVMOMI_KEEPALIVE_TEST") != "1" { - t.SkipNow() - } - - m1, u1 := newManager(t) - m2, u2 := newManager(t) - - // Enable keepalive on m2 - k := KeepAlive(m2.client.RoundTripper, 10*time.Minute) - m2.client.RoundTripper = k - - // Expect both sessions to be invalid - testSessionOK(t, m1, false) - testSessionOK(t, m2, false) - - // Logging in starts keep alive - if err := m1.Login(context.Background(), u1.User); err != nil { - t.Error(err) - } - if err := m2.Login(context.Background(), u2.User); err != nil { - t.Error(err) - } - - // Expect both sessions to be valid - testSessionOK(t, m1, true) - testSessionOK(t, m2, true) - - // Wait for m1 to time out - delay := 31 * time.Minute - fmt.Printf("%s: Waiting %d minutes for session to time out...\n", time.Now(), int(delay.Minutes())) - time.Sleep(delay) - - // Expect m1's session to be invalid, m2's session to be valid - testSessionOK(t, m1, false) - testSessionOK(t, m2, true) -} - -func isNotAuthenticated(err error) bool { - if soap.IsSoapFault(err) { - switch soap.ToSoapFault(err).VimFault().(type) { - case types.NotAuthenticated: - return true - } - } - return false -} - -func isInvalidLogin(err error) bool { - if soap.IsSoapFault(err) { - switch soap.ToSoapFault(err).VimFault().(type) { - case types.InvalidLogin: - return true - } - } - return false -} - -func TestKeepAliveHandler(t *testing.T) { - u := test.URL() - if u == nil { - t.SkipNow() - } - - m1, u1 := newManager(t) - m2, u2 := newManager(t) - - reauth := make(chan bool) - - // Keep alive handler that will re-login. - // Real-world case: connectivity to ESX/VC is down long enough for the session to expire - // Test-world case: we call TerminateSession below - k := KeepAliveHandler(m2.client.RoundTripper, 2*time.Second, func(roundTripper soap.RoundTripper) error { - _, err := methods.GetCurrentTime(context.Background(), roundTripper) - if err != nil { - if isNotAuthenticated(err) { - err = m2.Login(context.Background(), u2.User) - - if err != nil { - if isInvalidLogin(err) { - reauth <- false - t.Log("failed to re-authenticate, quitting keep alive handler") - return err - } - } else { - reauth <- true - } - } - } - - return nil - }) - - m2.client.RoundTripper = k - - // Logging in starts keep alive - if err := m1.Login(context.Background(), u1.User); err != nil { - t.Error(err) - } - if err := m2.Login(context.Background(), u2.User); err != nil { - t.Error(err) - } - - // Terminate session for m2. Note that self terminate fails, so we need 2 sessions for this test. - s, err := m2.UserSession(context.Background()) - if err != nil { - t.Fatal(err) - } - - err = m1.TerminateSession(context.Background(), []string{s.Key}) - if err != nil { - t.Fatal(err) - } - - _, err = methods.GetCurrentTime(context.Background(), m2.client) - if err == nil { - t.Error("expected to fail") - } - - // Wait for keepalive to re-authenticate - <-reauth - - _, err = methods.GetCurrentTime(context.Background(), m2.client) - if err != nil { - t.Fatal(err) - } - - // Clear credentials to test re-authentication failure - u2.User = nil - - s, err = m2.UserSession(context.Background()) - if err != nil { - t.Fatal(err) - } - - err = m1.TerminateSession(context.Background(), []string{s.Key}) - if err != nil { - t.Fatal(err) - } - - // Wait for keepalive re-authenticate attempt - result := <-reauth - - _, err = methods.GetCurrentTime(context.Background(), m2.client) - if err == nil { - t.Error("expected to fail") - } - - if result { - t.Errorf("expected reauth to fail") - } -} diff --git a/vendor/github.com/vmware/govmomi/session/manager_test.go b/vendor/github.com/vmware/govmomi/session/manager_test.go deleted file mode 100644 index 7ad0092e6e..0000000000 --- a/vendor/github.com/vmware/govmomi/session/manager_test.go +++ /dev/null @@ -1,106 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package session - -import ( - "net/url" - "testing" - - "github.com/vmware/govmomi/test" - "github.com/vmware/govmomi/vim25" - "github.com/vmware/govmomi/vim25/soap" - "golang.org/x/net/context" -) - -func sessionClient(u *url.URL, t *testing.T) *Manager { - soapClient := soap.NewClient(u, true) - vimClient, err := vim25.NewClient(context.Background(), soapClient) - if err != nil { - t.Fatal(err) - } - - return NewManager(vimClient) -} - -func TestLogin(t *testing.T) { - u := test.URL() - if u == nil { - t.SkipNow() - } - - session := sessionClient(u, t) - err := session.Login(context.Background(), u.User) - if err != nil { - t.Errorf("Expected no error, got %v", err) - } -} - -func TestLogout(t *testing.T) { - u := test.URL() - if u == nil { - t.SkipNow() - } - - session := sessionClient(u, t) - err := session.Login(context.Background(), u.User) - if err != nil { - t.Error("Login Error: ", err) - } - - err = session.Logout(context.Background()) - if err != nil { - t.Errorf("Expected nil, got %v", err) - } - - err = session.Logout(context.Background()) - if err == nil { - t.Errorf("Expected NotAuthenticated, got nil") - } -} - -func TestSessionIsActive(t *testing.T) { - u := test.URL() - if u == nil { - t.SkipNow() - } - - session := sessionClient(u, t) - - // Skip test against ESXi -- SessionIsActive is not implemented - if session.client.ServiceContent.About.ApiType != "VirtualCenter" { - t.Skipf("Talking to %s instead of %s", session.client.ServiceContent.About.ApiType, "VirtualCenter") - } - - err := session.Login(context.Background(), u.User) - if err != nil { - t.Error("Login Error: ", err) - } - - active, err := session.SessionIsActive(context.Background()) - if err != nil || !active { - t.Errorf("Expected %t, got %t", true, active) - t.Errorf("Expected nil, got %v", err) - } - - session.Logout(context.Background()) - - active, err = session.SessionIsActive(context.Background()) - if err == nil || active { - t.Errorf("Expected %t, got %t", false, active) - t.Errorf("Expected NotAuthenticated, got %v", err) - } -} diff --git a/vendor/github.com/vmware/govmomi/test/functional/issue_242_test.go b/vendor/github.com/vmware/govmomi/test/functional/issue_242_test.go deleted file mode 100644 index f1bba52856..0000000000 --- a/vendor/github.com/vmware/govmomi/test/functional/issue_242_test.go +++ /dev/null @@ -1,104 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package functional - -import ( - "fmt" - "testing" - "time" - - "github.com/vmware/govmomi/object" - "github.com/vmware/govmomi/property" - "github.com/vmware/govmomi/vim25/mo" - "github.com/vmware/govmomi/vim25/types" - "golang.org/x/net/context" -) - -func TestIssue242(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - h := NewHelper(t) - defer h.Teardown() - - h.RequireVirtualCenter() - - df, err := h.Datacenter().Folders(ctx) - if err != nil { - t.Fatal(err) - } - - cr := h.ComputeResource() - - // Get local datastores for compute resource - dss, err := h.LocalDatastores(ctx, cr) - if err != nil { - t.Fatal(err) - } - if len(dss) == 0 { - t.Fatalf("No local datastores") - } - - // Get root resource pool for compute resource - rp, err := cr.ResourcePool(ctx) - if err != nil { - t.Fatal(err) - } - - spec := types.VirtualMachineConfigSpec{ - Name: fmt.Sprintf("govmomi-test-%s", time.Now().Format(time.RFC3339)), - Files: &types.VirtualMachineFileInfo{VmPathName: fmt.Sprintf("[%s]", dss[0].Name())}, - NumCPUs: 1, - MemoryMB: 32, - } - - // Create new VM - task, err := df.VmFolder.CreateVM(context.Background(), spec, rp, nil) - if err != nil { - t.Fatal(err) - } - - info, err := task.WaitForResult(context.Background(), nil) - if err != nil { - t.Fatal(err) - } - - vm := object.NewVirtualMachine(h.c, info.Result.(types.ManagedObjectReference)) - defer func() { - task, err := vm.Destroy(context.Background()) - if err != nil { - panic(err) - } - err = task.Wait(context.Background()) - if err != nil { - panic(err) - } - }() - - // Mark VM as template - err = vm.MarkAsTemplate(context.Background()) - if err != nil { - t.Fatal(err) - } - - // Get "environmentBrowser" property for VM template - var mvm mo.VirtualMachine - err = property.DefaultCollector(h.c).RetrieveOne(ctx, vm.Reference(), []string{"environmentBrowser"}, &mvm) - if err != nil { - t.Fatal(err) - } -} diff --git a/vendor/github.com/vmware/govmomi/units/size_test.go b/vendor/github.com/vmware/govmomi/units/size_test.go deleted file mode 100644 index 14772887b6..0000000000 --- a/vendor/github.com/vmware/govmomi/units/size_test.go +++ /dev/null @@ -1,145 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package units - -import ( - "fmt" - "math" - "testing" -) - -func TestMB(t *testing.T) { - b := ByteSize(1024 * 1024) - expected := "1.0MB" - if b.String() != expected { - t.Errorf("Expected '%v' but got '%v'", expected, b) - } -} - -func TestTenMB(t *testing.T) { - b := ByteSize(10 * 1024 * 1024) - actual := fmt.Sprintf("%s", b) - expected := "10.0MB" - if actual != expected { - t.Errorf("Expected '%v' but got '%v'", expected, actual) - } -} - -func assertEquals(t *testing.T, expected string, actual ByteSize) { - if expected != actual.String() { - t.Errorf("Expected '%v' but got '%v'", expected, actual.String()) - } -} - -func TestByteSize(t *testing.T) { - assertEquals(t, "1B", ByteSize(1)) - assertEquals(t, "10B", ByteSize(10)) - assertEquals(t, "100B", ByteSize(100)) - assertEquals(t, "1000B", ByteSize(1000)) - assertEquals(t, "1.0KB", ByteSize(1024)) - assertEquals(t, "1.0MB", ByteSize(1024*1024)) - assertEquals(t, "1.0MB", ByteSize(1048576)) - assertEquals(t, "10.0MB", ByteSize(10*math.Pow(1024, 2))) - assertEquals(t, "1.0GB", ByteSize(1024*1024*1024)) - assertEquals(t, "1.0TB", ByteSize(1024*1024*1024*1024)) - assertEquals(t, "1.0TB", ByteSize(1048576*1048576)) - assertEquals(t, "1.0PB", ByteSize(1024*1024*1024*1024*1024)) - assertEquals(t, "1.0EB", ByteSize(1024*1024*1024*1024*1024*1024)) - assertEquals(t, "1.0EB", ByteSize(1048576*1048576*1048576)) -} - -func TestByteSizeSet(t *testing.T) { - var tests = []struct { - In string - OutStr string - Out ByteSize - }{ - { - In: "345", - OutStr: "345B", - Out: 345.0, - }, - { - In: "345b", - OutStr: "345B", - Out: 345.0, - }, - { - In: "345K", - OutStr: "345.0KB", - Out: 345 * KB, - }, - { - In: "345kb", - OutStr: "345.0KB", - Out: 345 * KB, - }, - { - In: "345kib", - OutStr: "345.0KB", - Out: 345 * KB, - }, - { - In: "345KiB", - OutStr: "345.0KB", - Out: 345 * KB, - }, - { - In: "345M", - OutStr: "345.0MB", - Out: 345 * MB, - }, - { - In: "345G", - OutStr: "345.0GB", - Out: 345 * GB, - }, - { - In: "345T", - OutStr: "345.0TB", - Out: 345 * TB, - }, - { - In: "345P", - OutStr: "345.0PB", - Out: 345 * PB, - }, - { - In: "3E", - OutStr: "3.0EB", - Out: 3 * EB, - }, - } - - for _, test := range tests { - var v ByteSize - err := v.Set(test.In) - if err != nil { - t.Errorf("Error: %s [%v]", err, test.In) - continue - } - - if v != test.Out { - t.Errorf("Out: expect '%v' actual '%v'", test.Out, v) - continue - } - - if v.String() != test.OutStr { - t.Errorf("String: expect '%v' actual '%v'", test.OutStr, v.String()) - } - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/client_test.go b/vendor/github.com/vmware/govmomi/vim25/client_test.go deleted file mode 100644 index 05885c7f8d..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/client_test.go +++ /dev/null @@ -1,97 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package vim25 - -import ( - "encoding/json" - "net/url" - "os" - "testing" - - "github.com/vmware/govmomi/vim25/methods" - "github.com/vmware/govmomi/vim25/mo" - "github.com/vmware/govmomi/vim25/soap" - "github.com/vmware/govmomi/vim25/types" - "golang.org/x/net/context" -) - -// Duplicated to prevent cyclic dependency... -func testURL(t *testing.T) *url.URL { - s := os.Getenv("GOVMOMI_TEST_URL") - if s == "" { - t.SkipNow() - } - u, err := soap.ParseURL(s) - if err != nil { - panic(err) - } - return u -} - -func sessionLogin(t *testing.T, c *Client) { - req := types.Login{ - This: *c.ServiceContent.SessionManager, - } - - u := testURL(t).User - req.UserName = u.Username() - if pw, ok := u.Password(); ok { - req.Password = pw - } - - _, err := methods.Login(context.Background(), c, &req) - if err != nil { - t.Fatal(err) - } -} - -func sessionCheck(t *testing.T, c *Client) { - var mgr mo.SessionManager - - err := mo.RetrieveProperties(context.Background(), c, c.ServiceContent.PropertyCollector, *c.ServiceContent.SessionManager, &mgr) - if err != nil { - t.Fatal(err) - } -} - -func TestClientSerialization(t *testing.T) { - var c1, c2 *Client - - soapClient := soap.NewClient(testURL(t), true) - c1, err := NewClient(context.Background(), soapClient) - if err != nil { - t.Fatal(err) - } - - // Login - sessionLogin(t, c1) - sessionCheck(t, c1) - - // Serialize/deserialize - b, err := json.Marshal(c1) - if err != nil { - t.Fatal(err) - } - c2 = &Client{} - err = json.Unmarshal(b, c2) - if err != nil { - t.Fatal(err) - } - - // Check the session is still valid - sessionCheck(t, c2) -} diff --git a/vendor/github.com/vmware/govmomi/vim25/methods/fault_test.go b/vendor/github.com/vmware/govmomi/vim25/methods/fault_test.go deleted file mode 100644 index 78bcaae811..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/methods/fault_test.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package methods - -import ( - "bytes" - "testing" - - "github.com/vmware/govmomi/vim25/soap" - "github.com/vmware/govmomi/vim25/types" - "github.com/vmware/govmomi/vim25/xml" -) - -var invalidLoginFault = ` - - - -ServerFaultCodeCannot complete login due to an incorrect user name or password. - -` - -type TestBody struct { - Fault *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` -} - -func TestFaultDetail(t *testing.T) { - body := TestBody{} - env := soap.Envelope{Body: &body} - - dec := xml.NewDecoder(bytes.NewReader([]byte(invalidLoginFault))) - dec.TypeFunc = types.TypeFunc() - - err := dec.Decode(&env) - if err != nil { - t.Fatalf("Decode: %s", err) - } - - if body.Fault == nil { - t.Fatal("Expected fault") - } - - if _, ok := body.Fault.Detail.Fault.(types.InvalidLogin); !ok { - t.Fatalf("Expected InvalidLogin, got: %#v", body.Fault.Detail.Fault) - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/mo/retrieve_test.go b/vendor/github.com/vmware/govmomi/vim25/mo/retrieve_test.go deleted file mode 100644 index 5d6e011df1..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/mo/retrieve_test.go +++ /dev/null @@ -1,144 +0,0 @@ -/* -Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package mo - -import ( - "os" - "testing" - - "github.com/vmware/govmomi/vim25/soap" - "github.com/vmware/govmomi/vim25/types" - "github.com/vmware/govmomi/vim25/xml" -) - -func load(name string) *types.RetrievePropertiesResponse { - f, err := os.Open(name) - if err != nil { - panic(err) - } - - defer f.Close() - - var b types.RetrievePropertiesResponse - - dec := xml.NewDecoder(f) - dec.TypeFunc = types.TypeFunc() - if err := dec.Decode(&b); err != nil { - panic(err) - } - - return &b -} - -func TestNotAuthenticatedFault(t *testing.T) { - var s SessionManager - - err := LoadRetrievePropertiesResponse(load("fixtures/not_authenticated_fault.xml"), &s) - if !soap.IsVimFault(err) { - t.Errorf("Expected IsVimFault") - } - - fault := soap.ToVimFault(err).(*types.NotAuthenticated) - if fault.PrivilegeId != "System.View" { - t.Errorf("Expected first fault to be returned") - } -} - -func TestNestedProperty(t *testing.T) { - var vm VirtualMachine - - err := LoadRetrievePropertiesResponse(load("fixtures/nested_property.xml"), &vm) - if err != nil { - t.Fatalf("Expected no error, got: %s", err) - } - - self := types.ManagedObjectReference{ - Type: "VirtualMachine", - Value: "vm-411", - } - - if vm.Self != self { - t.Fatalf("Expected vm.Self to be set") - } - - if vm.Config == nil { - t.Fatalf("Expected vm.Config to be set") - } - - if vm.Config.Name != "kubernetes-master" { - t.Errorf("Got: %s", vm.Config.Name) - } - - if vm.Config.Uuid != "422ec880-ab06-06b4-23f3-beb7a052a4c9" { - t.Errorf("Got: %s", vm.Config.Uuid) - } -} - -func TestPointerProperty(t *testing.T) { - var vm VirtualMachine - - err := LoadRetrievePropertiesResponse(load("fixtures/pointer_property.xml"), &vm) - if err != nil { - t.Fatalf("Expected no error, got: %s", err) - } - - if vm.Config == nil { - t.Fatalf("Expected vm.Config to be set") - } - - if vm.Config.BootOptions == nil { - t.Fatalf("Expected vm.Config.BootOptions to be set") - } -} - -func TestEmbeddedTypeProperty(t *testing.T) { - // Test that we avoid in this case: - // panic: reflect.Set: value of type mo.ClusterComputeResource is not assignable to type mo.ComputeResource - var cr ComputeResource - - err := LoadRetrievePropertiesResponse(load("fixtures/cluster_host_property.xml"), &cr) - if err != nil { - t.Fatalf("Expected no error, got: %s", err) - } - - if len(cr.Host) != 4 { - t.Fatalf("Expected cr.Host to be set") - } -} - -func TestEmbeddedTypePropertySlice(t *testing.T) { - var me []ManagedEntity - - err := LoadRetrievePropertiesResponse(load("fixtures/hostsystem_list_name_property.xml"), &me) - if err != nil { - t.Fatalf("Expected no error, got: %s", err) - } - - if len(me) != 2 { - t.Fatalf("Expected 2 elements") - } - - for _, m := range me { - if m.Name == "" { - t.Fatal("Expected Name field to be set") - } - } - - if me[0].Name == me[1].Name { - t.Fatal("Name fields should not be the same") - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/mo/type_info_test.go b/vendor/github.com/vmware/govmomi/vim25/mo/type_info_test.go deleted file mode 100644 index 849d9eea46..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/mo/type_info_test.go +++ /dev/null @@ -1,37 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package mo - -import ( - "reflect" - "testing" -) - -func TestLoadAll(*testing.T) { - for _, typ := range t { - newTypeInfo(typ) - } -} - -// The virtual machine managed object has about 500 nested properties. -// It's likely to be indicative of the function's performance in general. -func BenchmarkLoadVirtualMachine(b *testing.B) { - vmtyp := reflect.TypeOf((*VirtualMachine)(nil)).Elem() - for i := 0; i < b.N; i++ { - newTypeInfo(vmtyp) - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/progress/aggregator_test.go b/vendor/github.com/vmware/govmomi/vim25/progress/aggregator_test.go deleted file mode 100644 index bac9594284..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/progress/aggregator_test.go +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package progress - -import ( - "testing" - "time" -) - -func TestAggregatorNoSinks(t *testing.T) { - ch := make(chan Report) - a := NewAggregator(dummySinker{ch}) - a.Done() - - _, ok := <-ch - if ok { - t.Errorf("Expected channel to be closed") - } -} - -func TestAggregatorMultipleSinks(t *testing.T) { - ch := make(chan Report) - a := NewAggregator(dummySinker{ch}) - - for i := 0; i < 5; i++ { - go func(ch chan<- Report) { - ch <- dummyReport{} - ch <- dummyReport{} - close(ch) - }(a.Sink()) - - <-ch - <-ch - } - - a.Done() - - _, ok := <-ch - if ok { - t.Errorf("Expected channel to be closed") - } -} - -func TestAggregatorSinkInFlightOnDone(t *testing.T) { - ch := make(chan Report) - a := NewAggregator(dummySinker{ch}) - - // Simulate upstream - go func(ch chan<- Report) { - time.Sleep(1 * time.Millisecond) - ch <- dummyReport{} - close(ch) - }(a.Sink()) - - // Drain downstream - go func(ch <-chan Report) { - <-ch - }(ch) - - // This should wait for upstream to complete - a.Done() - - _, ok := <-ch - if ok { - t.Errorf("Expected channel to be closed") - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/progress/common_test.go b/vendor/github.com/vmware/govmomi/vim25/progress/common_test.go deleted file mode 100644 index c0da5e418a..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/progress/common_test.go +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package progress - -type dummySinker struct { - ch chan Report -} - -func (d dummySinker) Sink() chan<- Report { - return d.ch -} - -type dummyReport struct { - p float32 - d string - e error -} - -func (p dummyReport) Percentage() float32 { - return p.p -} - -func (p dummyReport) Detail() string { - return p.d -} - -func (p dummyReport) Error() error { - return p.e -} diff --git a/vendor/github.com/vmware/govmomi/vim25/progress/prefix_test.go b/vendor/github.com/vmware/govmomi/vim25/progress/prefix_test.go deleted file mode 100644 index 2438bfd799..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/progress/prefix_test.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package progress - -import "testing" - -func TestPrefix(t *testing.T) { - var r Report - - ch := make(chan Report, 1) - s := Prefix(dummySinker{ch}, "prefix").Sink() - - // No detail - s <- dummyReport{d: ""} - r = <-ch - if r.Detail() != "prefix" { - t.Errorf("Expected detail to be prefixed") - } - - // With detail - s <- dummyReport{d: "something"} - r = <-ch - if r.Detail() != "prefix: something" { - t.Errorf("Expected detail to be prefixed") - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/progress/reader_test.go b/vendor/github.com/vmware/govmomi/vim25/progress/reader_test.go deleted file mode 100644 index 2d60582234..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/progress/reader_test.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package progress - -import ( - "io" - "strings" - "testing" -) - -func TestReader(t *testing.T) { - s := "helloworld" - ch := make(chan Report, 1) - pr := NewReader(&dummySinker{ch}, strings.NewReader(s), int64(len(s))) - - var buf [10]byte - var q Report - var n int - var err error - - // Read first byte - n, err = pr.Read(buf[0:1]) - if n != 1 { - t.Errorf("Expected n=1, but got: %d", n) - } - - if err != nil { - t.Errorf("Error: %s", err) - } - - q = <-ch - if q.Error() != nil { - t.Errorf("Error: %s", err) - } - - if f := q.Percentage(); f != 10.0 { - t.Errorf("Expected percentage after 1 byte to be 10%%, but got: %.0f%%", f) - } - - // Read remaining bytes - n, err = pr.Read(buf[:]) - if n != 9 { - t.Errorf("Expected n=1, but got: %d", n) - } - if err != nil { - t.Errorf("Error: %s", err) - } - - q = <-ch - if q.Error() != nil { - t.Errorf("Error: %s", err) - } - - if f := q.Percentage(); f != 100.0 { - t.Errorf("Expected percentage after 10 bytes to be 100%%, but got: %.0f%%", f) - } - - // Read EOF - _, err = pr.Read(buf[:]) - if err != io.EOF { - t.Errorf("Expected io.EOF, but got: %s", err) - } - - // Mark progress reader as done - pr.Done(io.EOF) - q = <-ch - if err != io.EOF { - t.Errorf("Expected io.EOF, but got: %s", err) - } - - // Progress channel should be closed after progress reader is marked done - _, ok := <-ch - if ok { - t.Errorf("Expected channel to be closed") - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/progress/scale_test.go b/vendor/github.com/vmware/govmomi/vim25/progress/scale_test.go deleted file mode 100644 index 8b722e9a95..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/progress/scale_test.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package progress - -import "testing" - -func TestScaleMany(t *testing.T) { - ch := make(chan Report) - a := NewAggregator(dummySinker{ch}) - defer a.Done() - - s := Scale(a, 5) - - go func() { - for i := 0; i < 5; i++ { - go func(ch chan<- Report) { - ch <- dummyReport{p: 0.0} - ch <- dummyReport{p: 50.0} - close(ch) - }(s.Sink()) - } - }() - - // Expect percentages to be scaled across sinks - for p := float32(0.0); p < 100.0; p += 10.0 { - r := <-ch - if r.Percentage() != p { - t.Errorf("Expected percentage to be: %.0f%%", p) - } - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/progress/tee_test.go b/vendor/github.com/vmware/govmomi/vim25/progress/tee_test.go deleted file mode 100644 index 350f6f1cb9..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/progress/tee_test.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package progress - -import "testing" - -func TestTee(t *testing.T) { - var ok bool - - ch1 := make(chan Report) - ch2 := make(chan Report) - - s := Tee(&dummySinker{ch: ch1}, &dummySinker{ch: ch2}) - - in := s.Sink() - in <- dummyReport{} - close(in) - - // Receive dummy on both sinks - <-ch1 - <-ch2 - - _, ok = <-ch1 - if ok { - t.Errorf("Expected channel to be closed") - } - - _, ok = <-ch2 - if ok { - t.Errorf("Expected channel to be closed") - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/retry_test.go b/vendor/github.com/vmware/govmomi/vim25/retry_test.go deleted file mode 100644 index 14a636dc8c..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/retry_test.go +++ /dev/null @@ -1,86 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package vim25 - -import ( - "testing" - - "github.com/vmware/govmomi/vim25/soap" - "golang.org/x/net/context" -) - -type tempError struct{} - -func (tempError) Error() string { return "tempError" } -func (tempError) Timeout() bool { return true } -func (tempError) Temporary() bool { return true } - -type nonTempError struct{} - -func (nonTempError) Error() string { return "nonTempError" } -func (nonTempError) Timeout() bool { return false } -func (nonTempError) Temporary() bool { return false } - -type fakeRoundTripper struct { - errs []error -} - -func (f *fakeRoundTripper) RoundTrip(ctx context.Context, req, res soap.HasFault) error { - err := f.errs[0] - f.errs = f.errs[1:] - return err -} - -func TestRetry(t *testing.T) { - var tcs = []struct { - errs []error - expected error - }{ - { - errs: []error{nil}, - expected: nil, - }, - { - errs: []error{tempError{}, nil}, - expected: nil, - }, - { - errs: []error{tempError{}, tempError{}}, - expected: tempError{}, - }, - { - errs: []error{nonTempError{}}, - expected: nonTempError{}, - }, - { - errs: []error{tempError{}, nonTempError{}}, - expected: nonTempError{}, - }, - } - - for _, tc := range tcs { - var rt soap.RoundTripper - - rt = &fakeRoundTripper{errs: tc.errs} - rt = Retry(rt, TemporaryNetworkError(2)) - - err := rt.RoundTrip(nil, nil, nil) - if err != tc.expected { - t.Errorf("Expected: %s, got: %s", tc.expected, err) - } - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/soap/client_test.go b/vendor/github.com/vmware/govmomi/vim25/soap/client_test.go deleted file mode 100644 index 0cf4729dd8..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/soap/client_test.go +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package soap - -import "testing" - -func TestSplitHostPort(t *testing.T) { - tests := []struct { - url string - host string - port string - }{ - {"127.0.0.1", "127.0.0.1", ""}, - {"*:1234", "*", "1234"}, - {"127.0.0.1:80", "127.0.0.1", "80"}, - {"[::1]:6767", "[::1]", "6767"}, - {"[::1]", "[::1]", ""}, - } - - for _, test := range tests { - host, port := splitHostPort(test.url) - if host != test.host { - t.Errorf("(%s) %s != %s", test.url, host, test.host) - } - if port != test.port { - t.Errorf("(%s) %s != %s", test.url, port, test.port) - } - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/soap/soap_test.go b/vendor/github.com/vmware/govmomi/vim25/soap/soap_test.go deleted file mode 100644 index d90a17d19f..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/soap/soap_test.go +++ /dev/null @@ -1,55 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package soap - -import ( - "testing" - - "github.com/vmware/govmomi/vim25/xml" -) - -func TestEmptyEnvelope(t *testing.T) { - env := Envelope{} - - b, err := xml.Marshal(env) - if err != nil { - t.Errorf("error: %s", err) - return - } - - expected := `` - actual := string(b) - if expected != actual { - t.Fatalf("expected: %s, actual: %s", expected, actual) - } -} - -func TestEmptyHeader(t *testing.T) { - h := Header{} - - b, err := xml.Marshal(h) - if err != nil { - t.Errorf("error: %s", err) - return - } - - expected := `
` - actual := string(b) - if expected != actual { - t.Fatalf("expected: %s, actual: %s", expected, actual) - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/types/base_test.go b/vendor/github.com/vmware/govmomi/vim25/types/base_test.go deleted file mode 100644 index ab8b1de734..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/types/base_test.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package types - -import ( - "bytes" - "reflect" - "testing" - - "github.com/vmware/govmomi/vim25/xml" -) - -func TestAnyType(t *testing.T) { - x := func(s string) []byte { - s = `` + s - s += `` - return []byte(s) - } - - tests := []struct { - Input []byte - Value interface{} - }{ - { - Input: x(`test`), - Value: "test", - }, - { - Input: x(`AABB`), - Value: ArrayOfString{String: []string{"AA", "BB"}}, - }, - } - - for _, test := range tests { - var r struct { - A interface{} `xml:"name,typeattr"` - } - - dec := xml.NewDecoder(bytes.NewReader(test.Input)) - dec.TypeFunc = TypeFunc() - - err := dec.Decode(&r) - if err != nil { - t.Fatalf("Decode: %s", err) - } - - if !reflect.DeepEqual(r.A, test.Value) { - t.Errorf("Expected: %#v, actual: %#v", r.A, test.Value) - } - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/types/registry_test.go b/vendor/github.com/vmware/govmomi/vim25/types/registry_test.go deleted file mode 100644 index 1ea675c5c4..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/types/registry_test.go +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package types - -import ( - "reflect" - "testing" -) - -func TestTypeFunc(t *testing.T) { - var ok bool - - fn := TypeFunc() - - _, ok = fn("unknown") - if ok { - t.Errorf("Expected ok==false") - } - - actual, ok := fn("UserProfile") - if !ok { - t.Errorf("Expected ok==true") - } - - expected := reflect.TypeOf(UserProfile{}) - if !reflect.DeepEqual(expected, actual) { - t.Errorf("Expected: %#v, actual: %#v", expected, actual) - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/types/types_test.go b/vendor/github.com/vmware/govmomi/vim25/types/types_test.go deleted file mode 100644 index 0bb67dc511..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/types/types_test.go +++ /dev/null @@ -1,92 +0,0 @@ -/* -Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package types - -import ( - "testing" - - "github.com/vmware/govmomi/vim25/xml" -) - -func TestVirtualMachineConfigSpec(t *testing.T) { - spec := VirtualMachineConfigSpec{ - Name: "vm-001", - GuestId: "otherGuest", - Files: &VirtualMachineFileInfo{VmPathName: "[datastore1]"}, - NumCPUs: 1, - MemoryMB: 128, - DeviceChange: []BaseVirtualDeviceConfigSpec{ - &VirtualDeviceConfigSpec{ - Operation: VirtualDeviceConfigSpecOperationAdd, - Device: &VirtualLsiLogicController{VirtualSCSIController{ - SharedBus: VirtualSCSISharingNoSharing, - VirtualController: VirtualController{ - BusNumber: 0, - VirtualDevice: VirtualDevice{ - Key: 1000, - }, - }, - }}, - }, - &VirtualDeviceConfigSpec{ - Operation: VirtualDeviceConfigSpecOperationAdd, - FileOperation: VirtualDeviceConfigSpecFileOperationCreate, - Device: &VirtualDisk{ - VirtualDevice: VirtualDevice{ - Key: 0, - ControllerKey: 1000, - UnitNumber: 0, - Backing: &VirtualDiskFlatVer2BackingInfo{ - DiskMode: string(VirtualDiskModePersistent), - ThinProvisioned: NewBool(true), - VirtualDeviceFileBackingInfo: VirtualDeviceFileBackingInfo{ - FileName: "[datastore1]", - }, - }, - }, - CapacityInKB: 4000000, - }, - }, - &VirtualDeviceConfigSpec{ - Operation: VirtualDeviceConfigSpecOperationAdd, - Device: &VirtualE1000{VirtualEthernetCard{ - VirtualDevice: VirtualDevice{ - Key: 0, - DeviceInfo: &Description{ - Label: "Network Adapter 1", - Summary: "VM Network", - }, - Backing: &VirtualEthernetCardNetworkBackingInfo{ - VirtualDeviceDeviceBackingInfo: VirtualDeviceDeviceBackingInfo{ - DeviceName: "VM Network", - }, - }, - }, - AddressType: string(VirtualEthernetCardMacTypeGenerated), - }}, - }, - }, - ExtraConfig: []BaseOptionValue{ - &OptionValue{Key: "bios.bootOrder", Value: "ethernet0"}, - }, - } - - _, err := xml.MarshalIndent(spec, "", " ") - if err != nil { - t.Fatal(err) - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/xml/atom_test.go b/vendor/github.com/vmware/govmomi/vim25/xml/atom_test.go deleted file mode 100644 index a71284312a..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/xml/atom_test.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xml - -import "time" - -var atomValue = &Feed{ - XMLName: Name{"http://www.w3.org/2005/Atom", "feed"}, - Title: "Example Feed", - Link: []Link{{Href: "http://example.org/"}}, - Updated: ParseTime("2003-12-13T18:30:02Z"), - Author: Person{Name: "John Doe"}, - Id: "urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6", - - Entry: []Entry{ - { - Title: "Atom-Powered Robots Run Amok", - Link: []Link{{Href: "http://example.org/2003/12/13/atom03"}}, - Id: "urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a", - Updated: ParseTime("2003-12-13T18:30:02Z"), - Summary: NewText("Some text."), - }, - }, -} - -var atomXml = `` + - `` + - `Example Feed` + - `urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6` + - `` + - `John Doe` + - `` + - `Atom-Powered Robots Run Amok` + - `urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a` + - `` + - `2003-12-13T18:30:02Z` + - `` + - `Some text.` + - `` + - `` - -func ParseTime(str string) time.Time { - t, err := time.Parse(time.RFC3339, str) - if err != nil { - panic(err) - } - return t -} - -func NewText(text string) Text { - return Text{ - Body: text, - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/xml/example_test.go b/vendor/github.com/vmware/govmomi/vim25/xml/example_test.go deleted file mode 100644 index becedd5839..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/xml/example_test.go +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xml_test - -import ( - "encoding/xml" - "fmt" - "os" -) - -func ExampleMarshalIndent() { - type Address struct { - City, State string - } - type Person struct { - XMLName xml.Name `xml:"person"` - Id int `xml:"id,attr"` - FirstName string `xml:"name>first"` - LastName string `xml:"name>last"` - Age int `xml:"age"` - Height float32 `xml:"height,omitempty"` - Married bool - Address - Comment string `xml:",comment"` - } - - v := &Person{Id: 13, FirstName: "John", LastName: "Doe", Age: 42} - v.Comment = " Need more details. " - v.Address = Address{"Hanga Roa", "Easter Island"} - - output, err := xml.MarshalIndent(v, " ", " ") - if err != nil { - fmt.Printf("error: %v\n", err) - } - - os.Stdout.Write(output) - // Output: - // - // - // John - // Doe - // - // 42 - // false - // Hanga Roa - // Easter Island - // - // -} - -func ExampleEncoder() { - type Address struct { - City, State string - } - type Person struct { - XMLName xml.Name `xml:"person"` - Id int `xml:"id,attr"` - FirstName string `xml:"name>first"` - LastName string `xml:"name>last"` - Age int `xml:"age"` - Height float32 `xml:"height,omitempty"` - Married bool - Address - Comment string `xml:",comment"` - } - - v := &Person{Id: 13, FirstName: "John", LastName: "Doe", Age: 42} - v.Comment = " Need more details. " - v.Address = Address{"Hanga Roa", "Easter Island"} - - enc := xml.NewEncoder(os.Stdout) - enc.Indent(" ", " ") - if err := enc.Encode(v); err != nil { - fmt.Printf("error: %v\n", err) - } - - // Output: - // - // - // John - // Doe - // - // 42 - // false - // Hanga Roa - // Easter Island - // - // -} - -// This example demonstrates unmarshaling an XML excerpt into a value with -// some preset fields. Note that the Phone field isn't modified and that -// the XML element is ignored. Also, the Groups field is assigned -// considering the element path provided in its tag. -func ExampleUnmarshal() { - type Email struct { - Where string `xml:"where,attr"` - Addr string - } - type Address struct { - City, State string - } - type Result struct { - XMLName xml.Name `xml:"Person"` - Name string `xml:"FullName"` - Phone string - Email []Email - Groups []string `xml:"Group>Value"` - Address - } - v := Result{Name: "none", Phone: "none"} - - data := ` - - Grace R. Emlin - Example Inc. - - gre@example.com - - - gre@work.com - - - Friends - Squash - - Hanga Roa - Easter Island - - ` - err := xml.Unmarshal([]byte(data), &v) - if err != nil { - fmt.Printf("error: %v", err) - return - } - fmt.Printf("XMLName: %#v\n", v.XMLName) - fmt.Printf("Name: %q\n", v.Name) - fmt.Printf("Phone: %q\n", v.Phone) - fmt.Printf("Email: %v\n", v.Email) - fmt.Printf("Groups: %v\n", v.Groups) - fmt.Printf("Address: %v\n", v.Address) - // Output: - // XMLName: xml.Name{Space:"", Local:"Person"} - // Name: "Grace R. Emlin" - // Phone: "none" - // Email: [{home gre@example.com} {work gre@work.com}] - // Groups: [Friends Squash] - // Address: {Hanga Roa Easter Island} -} diff --git a/vendor/github.com/vmware/govmomi/vim25/xml/extras_test.go b/vendor/github.com/vmware/govmomi/vim25/xml/extras_test.go deleted file mode 100644 index 8e200578a5..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/xml/extras_test.go +++ /dev/null @@ -1,222 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package xml - -import ( - "bytes" - "reflect" - "testing" - "time" -) - -type MyType struct { - Value string -} - -var myTypes = map[string]reflect.Type{ - "MyType": reflect.TypeOf(MyType{}), - "ValueType": reflect.TypeOf(ValueType{}), - "PointerType": reflect.TypeOf(PointerType{}), -} - -func MyTypes(name string) (reflect.Type, bool) { - t, ok := myTypes[name] - return t, ok -} - -func TestMarshalWithEmptyInterface(t *testing.T) { - var r1, r2 struct { - XMLName Name `xml:"root"` - Values []interface{} `xml:"value,typeattr"` - } - - var tests = []struct { - Value interface{} - }{ - {Value: bool(true)}, - {Value: int8(-8)}, - {Value: int16(-16)}, - {Value: int32(-32)}, - {Value: int64(-64)}, - {Value: uint8(8)}, - {Value: uint16(16)}, - {Value: uint32(32)}, - {Value: uint64(64)}, - {Value: float32(32.0)}, - {Value: float64(64.0)}, - {Value: string("string")}, - {Value: time.Now()}, - {Value: ParseTime("2009-10-04T01:35:58+00:00")}, - {Value: []byte("bytes")}, - {Value: MyType{Value: "v"}}, - } - - for _, test := range tests { - r1.XMLName.Local = "root" - r1.Values = []interface{}{test.Value} - r2.XMLName = Name{} - r2.Values = nil - - b, err := Marshal(r1) - if err != nil { - t.Fatalf("Marshal: %s", err) - } - - dec := NewDecoder(bytes.NewReader(b)) - dec.TypeFunc = MyTypes - err = dec.Decode(&r2) - if err != nil { - t.Fatalf("Unmarshal: %s", err) - } - - switch r1.Values[0].(type) { - case time.Time: - if !r1.Values[0].(time.Time).Equal(r2.Values[0].(time.Time)) { - t.Errorf("Expected: %#v, actual: %#v", r1, r2) - } - default: - if !reflect.DeepEqual(r1, r2) { - t.Errorf("Expected: %#v, actual: %#v", r1, r2) - } - } - } -} - -type VIntf interface { - V() string -} - -type ValueType struct { - Value string `xml:",chardata"` -} - -type PointerType struct { - Value string `xml:",chardata"` -} - -func (t ValueType) V() string { - return t.Value -} - -func (t *PointerType) V() string { - return t.Value -} - -func TestMarshalWithInterface(t *testing.T) { - var r1, r2 struct { - XMLName Name `xml:"root"` - Values []VIntf `xml:"value,typeattr"` - } - - r1.XMLName.Local = "root" - r1.Values = []VIntf{ - ValueType{"v1"}, - &PointerType{"v2"}, - } - - b, err := Marshal(r1) - if err != nil { - t.Fatalf("Marshal: %s", err) - } - - dec := NewDecoder(bytes.NewReader(b)) - dec.TypeFunc = MyTypes - err = dec.Decode(&r2) - if err != nil { - t.Fatalf("Unmarshal: %s", err) - } - - if !reflect.DeepEqual(r1, r2) { - t.Errorf("expected: %#v, actual: %#v", r1, r2) - } -} - -type test3iface interface { - Value() string -} - -type test3a struct { - V string `xml:",chardata"` -} - -func (t test3a) Value() string { return t.V } - -type test3b struct { - V string `xml:",chardata"` -} - -func (t test3b) Value() string { return t.V } - -func TestUnmarshalInterfaceWithoutTypeAttr(t *testing.T) { - var r struct { - XMLName Name `xml:"root"` - Values []test3iface `xml:"value,typeattr"` - } - - b := ` - - A - B - - ` - - fn := func(name string) (reflect.Type, bool) { - switch name { - case "test3a": - return reflect.TypeOf(test3a{}), true - case "test3iface": - return reflect.TypeOf(test3b{}), true - default: - return nil, false - } - } - - dec := NewDecoder(bytes.NewReader([]byte(b))) - dec.TypeFunc = fn - err := dec.Decode(&r) - if err != nil { - t.Fatalf("Unmarshal: %s", err) - } - - if len(r.Values) != 2 { - t.Errorf("Expected 2 values") - } - - exps := []struct { - Typ reflect.Type - Val string - }{ - { - Typ: reflect.TypeOf(test3a{}), - Val: "A", - }, - { - Typ: reflect.TypeOf(test3b{}), - Val: "B", - }, - } - - for i, e := range exps { - if val := r.Values[i].Value(); val != e.Val { - t.Errorf("Expected: %s, got: %s", e.Val, val) - } - - if typ := reflect.TypeOf(r.Values[i]); typ.Name() != e.Typ.Name() { - t.Errorf("Expected: %s, got: %s", e.Typ.Name(), typ.Name()) - } - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/xml/marshal_test.go b/vendor/github.com/vmware/govmomi/vim25/xml/marshal_test.go deleted file mode 100644 index 14f73a75d5..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/xml/marshal_test.go +++ /dev/null @@ -1,1266 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xml - -import ( - "bytes" - "errors" - "fmt" - "io" - "reflect" - "strconv" - "strings" - "testing" - "time" -) - -type DriveType int - -const ( - HyperDrive DriveType = iota - ImprobabilityDrive -) - -type Passenger struct { - Name []string `xml:"name"` - Weight float32 `xml:"weight"` -} - -type Ship struct { - XMLName struct{} `xml:"spaceship"` - - Name string `xml:"name,attr"` - Pilot string `xml:"pilot,attr"` - Drive DriveType `xml:"drive"` - Age uint `xml:"age"` - Passenger []*Passenger `xml:"passenger"` - secret string -} - -type NamedType string - -type Port struct { - XMLName struct{} `xml:"port"` - Type string `xml:"type,attr,omitempty"` - Comment string `xml:",comment"` - Number string `xml:",chardata"` -} - -type Domain struct { - XMLName struct{} `xml:"domain"` - Country string `xml:",attr,omitempty"` - Name []byte `xml:",chardata"` - Comment []byte `xml:",comment"` -} - -type Book struct { - XMLName struct{} `xml:"book"` - Title string `xml:",chardata"` -} - -type Event struct { - XMLName struct{} `xml:"event"` - Year int `xml:",chardata"` -} - -type Movie struct { - XMLName struct{} `xml:"movie"` - Length uint `xml:",chardata"` -} - -type Pi struct { - XMLName struct{} `xml:"pi"` - Approximation float32 `xml:",chardata"` -} - -type Universe struct { - XMLName struct{} `xml:"universe"` - Visible float64 `xml:",chardata"` -} - -type Particle struct { - XMLName struct{} `xml:"particle"` - HasMass bool `xml:",chardata"` -} - -type Departure struct { - XMLName struct{} `xml:"departure"` - When time.Time `xml:",chardata"` -} - -type SecretAgent struct { - XMLName struct{} `xml:"agent"` - Handle string `xml:"handle,attr"` - Identity string - Obfuscate string `xml:",innerxml"` -} - -type NestedItems struct { - XMLName struct{} `xml:"result"` - Items []string `xml:">item"` - Item1 []string `xml:"Items>item1"` -} - -type NestedOrder struct { - XMLName struct{} `xml:"result"` - Field1 string `xml:"parent>c"` - Field2 string `xml:"parent>b"` - Field3 string `xml:"parent>a"` -} - -type MixedNested struct { - XMLName struct{} `xml:"result"` - A string `xml:"parent1>a"` - B string `xml:"b"` - C string `xml:"parent1>parent2>c"` - D string `xml:"parent1>d"` -} - -type NilTest struct { - A interface{} `xml:"parent1>parent2>a"` - B interface{} `xml:"parent1>b"` - C interface{} `xml:"parent1>parent2>c"` -} - -type Service struct { - XMLName struct{} `xml:"service"` - Domain *Domain `xml:"host>domain"` - Port *Port `xml:"host>port"` - Extra1 interface{} - Extra2 interface{} `xml:"host>extra2"` -} - -var nilStruct *Ship - -type EmbedA struct { - EmbedC - EmbedB EmbedB - FieldA string -} - -type EmbedB struct { - FieldB string - *EmbedC -} - -type EmbedC struct { - FieldA1 string `xml:"FieldA>A1"` - FieldA2 string `xml:"FieldA>A2"` - FieldB string - FieldC string -} - -type NameCasing struct { - XMLName struct{} `xml:"casing"` - Xy string - XY string - XyA string `xml:"Xy,attr"` - XYA string `xml:"XY,attr"` -} - -type NamePrecedence struct { - XMLName Name `xml:"Parent"` - FromTag XMLNameWithoutTag `xml:"InTag"` - FromNameVal XMLNameWithoutTag - FromNameTag XMLNameWithTag - InFieldName string -} - -type XMLNameWithTag struct { - XMLName Name `xml:"InXMLNameTag"` - Value string `xml:",chardata"` -} - -type XMLNameWithoutTag struct { - XMLName Name - Value string `xml:",chardata"` -} - -type NameInField struct { - Foo Name `xml:"ns foo"` -} - -type AttrTest struct { - Int int `xml:",attr"` - Named int `xml:"int,attr"` - Float float64 `xml:",attr"` - Uint8 uint8 `xml:",attr"` - Bool bool `xml:",attr"` - Str string `xml:",attr"` - Bytes []byte `xml:",attr"` -} - -type OmitAttrTest struct { - Int int `xml:",attr,omitempty"` - Named int `xml:"int,attr,omitempty"` - Float float64 `xml:",attr,omitempty"` - Uint8 uint8 `xml:",attr,omitempty"` - Bool bool `xml:",attr,omitempty"` - Str string `xml:",attr,omitempty"` - Bytes []byte `xml:",attr,omitempty"` -} - -type OmitFieldTest struct { - Int int `xml:",omitempty"` - Named int `xml:"int,omitempty"` - Float float64 `xml:",omitempty"` - Uint8 uint8 `xml:",omitempty"` - Bool bool `xml:",omitempty"` - Str string `xml:",omitempty"` - Bytes []byte `xml:",omitempty"` - Ptr *PresenceTest `xml:",omitempty"` -} - -type AnyTest struct { - XMLName struct{} `xml:"a"` - Nested string `xml:"nested>value"` - AnyField AnyHolder `xml:",any"` -} - -type AnyOmitTest struct { - XMLName struct{} `xml:"a"` - Nested string `xml:"nested>value"` - AnyField *AnyHolder `xml:",any,omitempty"` -} - -type AnySliceTest struct { - XMLName struct{} `xml:"a"` - Nested string `xml:"nested>value"` - AnyField []AnyHolder `xml:",any"` -} - -type AnyHolder struct { - XMLName Name - XML string `xml:",innerxml"` -} - -type RecurseA struct { - A string - B *RecurseB -} - -type RecurseB struct { - A *RecurseA - B string -} - -type PresenceTest struct { - Exists *struct{} -} - -type IgnoreTest struct { - PublicSecret string `xml:"-"` -} - -type MyBytes []byte - -type Data struct { - Bytes []byte - Attr []byte `xml:",attr"` - Custom MyBytes -} - -type Plain struct { - V interface{} -} - -type MyInt int - -type EmbedInt struct { - MyInt -} - -type Strings struct { - X []string `xml:"A>B,omitempty"` -} - -type PointerFieldsTest struct { - XMLName Name `xml:"dummy"` - Name *string `xml:"name,attr"` - Age *uint `xml:"age,attr"` - Empty *string `xml:"empty,attr"` - Contents *string `xml:",chardata"` -} - -type ChardataEmptyTest struct { - XMLName Name `xml:"test"` - Contents *string `xml:",chardata"` -} - -type MyMarshalerTest struct { -} - -var _ Marshaler = (*MyMarshalerTest)(nil) - -func (m *MyMarshalerTest) MarshalXML(e *Encoder, start StartElement) error { - e.EncodeToken(start) - e.EncodeToken(CharData([]byte("hello world"))) - e.EncodeToken(EndElement{start.Name}) - return nil -} - -type MyMarshalerAttrTest struct { -} - -var _ MarshalerAttr = (*MyMarshalerAttrTest)(nil) - -func (m *MyMarshalerAttrTest) MarshalXMLAttr(name Name) (Attr, error) { - return Attr{name, "hello world"}, nil -} - -type MarshalerStruct struct { - Foo MyMarshalerAttrTest `xml:",attr"` -} - -type InnerStruct struct { - XMLName Name `xml:"testns outer"` -} - -type OuterStruct struct { - InnerStruct - IntAttr int `xml:"int,attr"` -} - -type OuterNamedStruct struct { - InnerStruct - XMLName Name `xml:"outerns test"` - IntAttr int `xml:"int,attr"` -} - -type OuterNamedOrderedStruct struct { - XMLName Name `xml:"outerns test"` - InnerStruct - IntAttr int `xml:"int,attr"` -} - -type OuterOuterStruct struct { - OuterStruct -} - -func ifaceptr(x interface{}) interface{} { - return &x -} - -var ( - nameAttr = "Sarah" - ageAttr = uint(12) - contentsAttr = "lorem ipsum" -) - -// Unless explicitly stated as such (or *Plain), all of the -// tests below are two-way tests. When introducing new tests, -// please try to make them two-way as well to ensure that -// marshalling and unmarshalling are as symmetrical as feasible. -var marshalTests = []struct { - Value interface{} - ExpectXML string - MarshalOnly bool - UnmarshalOnly bool -}{ - // Test nil marshals to nothing - {Value: nil, ExpectXML: ``, MarshalOnly: true}, - {Value: nilStruct, ExpectXML: ``, MarshalOnly: true}, - - // Test value types - {Value: &Plain{true}, ExpectXML: `true`}, - {Value: &Plain{false}, ExpectXML: `false`}, - {Value: &Plain{int(42)}, ExpectXML: `42`}, - {Value: &Plain{int8(42)}, ExpectXML: `42`}, - {Value: &Plain{int16(42)}, ExpectXML: `42`}, - {Value: &Plain{int32(42)}, ExpectXML: `42`}, - {Value: &Plain{uint(42)}, ExpectXML: `42`}, - {Value: &Plain{uint8(42)}, ExpectXML: `42`}, - {Value: &Plain{uint16(42)}, ExpectXML: `42`}, - {Value: &Plain{uint32(42)}, ExpectXML: `42`}, - {Value: &Plain{float32(1.25)}, ExpectXML: `1.25`}, - {Value: &Plain{float64(1.25)}, ExpectXML: `1.25`}, - {Value: &Plain{uintptr(0xFFDD)}, ExpectXML: `65501`}, - {Value: &Plain{"gopher"}, ExpectXML: `gopher`}, - {Value: &Plain{[]byte("gopher")}, ExpectXML: `gopher`}, - {Value: &Plain{""}, ExpectXML: `</>`}, - {Value: &Plain{[]byte("")}, ExpectXML: `</>`}, - {Value: &Plain{[3]byte{'<', '/', '>'}}, ExpectXML: `</>`}, - {Value: &Plain{NamedType("potato")}, ExpectXML: `potato`}, - {Value: &Plain{[]int{1, 2, 3}}, ExpectXML: `123`}, - {Value: &Plain{[3]int{1, 2, 3}}, ExpectXML: `123`}, - {Value: ifaceptr(true), MarshalOnly: true, ExpectXML: `true`}, - - // Test time. - { - Value: &Plain{time.Unix(1e9, 123456789).UTC()}, - ExpectXML: `2001-09-09T01:46:40.123456789Z`, - }, - - // A pointer to struct{} may be used to test for an element's presence. - { - Value: &PresenceTest{new(struct{})}, - ExpectXML: ``, - }, - { - Value: &PresenceTest{}, - ExpectXML: ``, - }, - - // A pointer to struct{} may be used to test for an element's presence. - { - Value: &PresenceTest{new(struct{})}, - ExpectXML: ``, - }, - { - Value: &PresenceTest{}, - ExpectXML: ``, - }, - - // A []byte field is only nil if the element was not found. - { - Value: &Data{}, - ExpectXML: ``, - UnmarshalOnly: true, - }, - { - Value: &Data{Bytes: []byte{}, Custom: MyBytes{}, Attr: []byte{}}, - ExpectXML: ``, - UnmarshalOnly: true, - }, - - // Check that []byte works, including named []byte types. - { - Value: &Data{Bytes: []byte("ab"), Custom: MyBytes("cd"), Attr: []byte{'v'}}, - ExpectXML: `abcd`, - }, - - // Test innerxml - { - Value: &SecretAgent{ - Handle: "007", - Identity: "James Bond", - Obfuscate: "", - }, - ExpectXML: `James Bond`, - MarshalOnly: true, - }, - { - Value: &SecretAgent{ - Handle: "007", - Identity: "James Bond", - Obfuscate: "James Bond", - }, - ExpectXML: `James Bond`, - UnmarshalOnly: true, - }, - - // Test structs - {Value: &Port{Type: "ssl", Number: "443"}, ExpectXML: `443`}, - {Value: &Port{Number: "443"}, ExpectXML: `443`}, - {Value: &Port{Type: ""}, ExpectXML: ``}, - {Value: &Port{Number: "443", Comment: "https"}, ExpectXML: `443`}, - {Value: &Port{Number: "443", Comment: "add space-"}, ExpectXML: `443`, MarshalOnly: true}, - {Value: &Domain{Name: []byte("google.com&friends")}, ExpectXML: `google.com&friends`}, - {Value: &Domain{Name: []byte("google.com"), Comment: []byte(" &friends ")}, ExpectXML: `google.com`}, - {Value: &Book{Title: "Pride & Prejudice"}, ExpectXML: `Pride & Prejudice`}, - {Value: &Event{Year: -3114}, ExpectXML: `-3114`}, - {Value: &Movie{Length: 13440}, ExpectXML: `13440`}, - {Value: &Pi{Approximation: 3.14159265}, ExpectXML: `3.1415927`}, - {Value: &Universe{Visible: 9.3e13}, ExpectXML: `9.3e+13`}, - {Value: &Particle{HasMass: true}, ExpectXML: `true`}, - {Value: &Departure{When: ParseTime("2013-01-09T00:15:00-09:00")}, ExpectXML: `2013-01-09T00:15:00-09:00`}, - {Value: atomValue, ExpectXML: atomXml}, - { - Value: &Ship{ - Name: "Heart of Gold", - Pilot: "Computer", - Age: 1, - Drive: ImprobabilityDrive, - Passenger: []*Passenger{ - { - Name: []string{"Zaphod", "Beeblebrox"}, - Weight: 7.25, - }, - { - Name: []string{"Trisha", "McMillen"}, - Weight: 5.5, - }, - { - Name: []string{"Ford", "Prefect"}, - Weight: 7, - }, - { - Name: []string{"Arthur", "Dent"}, - Weight: 6.75, - }, - }, - }, - ExpectXML: `` + - `` + strconv.Itoa(int(ImprobabilityDrive)) + `` + - `1` + - `` + - `Zaphod` + - `Beeblebrox` + - `7.25` + - `` + - `` + - `Trisha` + - `McMillen` + - `5.5` + - `` + - `` + - `Ford` + - `Prefect` + - `7` + - `` + - `` + - `Arthur` + - `Dent` + - `6.75` + - `` + - ``, - }, - - // Test a>b - { - Value: &NestedItems{Items: nil, Item1: nil}, - ExpectXML: `` + - `` + - `` + - ``, - }, - { - Value: &NestedItems{Items: []string{}, Item1: []string{}}, - ExpectXML: `` + - `` + - `` + - ``, - MarshalOnly: true, - }, - { - Value: &NestedItems{Items: nil, Item1: []string{"A"}}, - ExpectXML: `` + - `` + - `A` + - `` + - ``, - }, - { - Value: &NestedItems{Items: []string{"A", "B"}, Item1: nil}, - ExpectXML: `` + - `` + - `A` + - `B` + - `` + - ``, - }, - { - Value: &NestedItems{Items: []string{"A", "B"}, Item1: []string{"C"}}, - ExpectXML: `` + - `` + - `A` + - `B` + - `C` + - `` + - ``, - }, - { - Value: &NestedOrder{Field1: "C", Field2: "B", Field3: "A"}, - ExpectXML: `` + - `` + - `C` + - `B` + - `A` + - `` + - ``, - }, - { - Value: &NilTest{A: "A", B: nil, C: "C"}, - ExpectXML: `` + - `` + - `A` + - `C` + - `` + - ``, - MarshalOnly: true, // Uses interface{} - }, - { - Value: &MixedNested{A: "A", B: "B", C: "C", D: "D"}, - ExpectXML: `` + - `A` + - `B` + - `` + - `C` + - `D` + - `` + - ``, - }, - { - Value: &Service{Port: &Port{Number: "80"}}, - ExpectXML: `80`, - }, - { - Value: &Service{}, - ExpectXML: ``, - }, - { - Value: &Service{Port: &Port{Number: "80"}, Extra1: "A", Extra2: "B"}, - ExpectXML: `` + - `80` + - `A` + - `B` + - ``, - MarshalOnly: true, - }, - { - Value: &Service{Port: &Port{Number: "80"}, Extra2: "example"}, - ExpectXML: `` + - `80` + - `example` + - ``, - MarshalOnly: true, - }, - - // Test struct embedding - { - Value: &EmbedA{ - EmbedC: EmbedC{ - FieldA1: "", // Shadowed by A.A - FieldA2: "", // Shadowed by A.A - FieldB: "A.C.B", - FieldC: "A.C.C", - }, - EmbedB: EmbedB{ - FieldB: "A.B.B", - EmbedC: &EmbedC{ - FieldA1: "A.B.C.A1", - FieldA2: "A.B.C.A2", - FieldB: "", // Shadowed by A.B.B - FieldC: "A.B.C.C", - }, - }, - FieldA: "A.A", - }, - ExpectXML: `` + - `A.C.B` + - `A.C.C` + - `` + - `A.B.B` + - `` + - `A.B.C.A1` + - `A.B.C.A2` + - `` + - `A.B.C.C` + - `` + - `A.A` + - ``, - }, - - // Test that name casing matters - { - Value: &NameCasing{Xy: "mixed", XY: "upper", XyA: "mixedA", XYA: "upperA"}, - ExpectXML: `mixedupper`, - }, - - // Test the order in which the XML element name is chosen - { - Value: &NamePrecedence{ - FromTag: XMLNameWithoutTag{Value: "A"}, - FromNameVal: XMLNameWithoutTag{XMLName: Name{Local: "InXMLName"}, Value: "B"}, - FromNameTag: XMLNameWithTag{Value: "C"}, - InFieldName: "D", - }, - ExpectXML: `` + - `A` + - `B` + - `C` + - `D` + - ``, - MarshalOnly: true, - }, - { - Value: &NamePrecedence{ - XMLName: Name{Local: "Parent"}, - FromTag: XMLNameWithoutTag{XMLName: Name{Local: "InTag"}, Value: "A"}, - FromNameVal: XMLNameWithoutTag{XMLName: Name{Local: "FromNameVal"}, Value: "B"}, - FromNameTag: XMLNameWithTag{XMLName: Name{Local: "InXMLNameTag"}, Value: "C"}, - InFieldName: "D", - }, - ExpectXML: `` + - `A` + - `B` + - `C` + - `D` + - ``, - UnmarshalOnly: true, - }, - - // xml.Name works in a plain field as well. - { - Value: &NameInField{Name{Space: "ns", Local: "foo"}}, - ExpectXML: ``, - }, - { - Value: &NameInField{Name{Space: "ns", Local: "foo"}}, - ExpectXML: ``, - UnmarshalOnly: true, - }, - - // Marshaling zero xml.Name uses the tag or field name. - { - Value: &NameInField{}, - ExpectXML: ``, - MarshalOnly: true, - }, - - // Test attributes - { - Value: &AttrTest{ - Int: 8, - Named: 9, - Float: 23.5, - Uint8: 255, - Bool: true, - Str: "str", - Bytes: []byte("byt"), - }, - ExpectXML: ``, - }, - { - Value: &AttrTest{Bytes: []byte{}}, - ExpectXML: ``, - }, - { - Value: &OmitAttrTest{ - Int: 8, - Named: 9, - Float: 23.5, - Uint8: 255, - Bool: true, - Str: "str", - Bytes: []byte("byt"), - }, - ExpectXML: ``, - }, - { - Value: &OmitAttrTest{}, - ExpectXML: ``, - }, - - // pointer fields - { - Value: &PointerFieldsTest{Name: &nameAttr, Age: &ageAttr, Contents: &contentsAttr}, - ExpectXML: `lorem ipsum`, - MarshalOnly: true, - }, - - // empty chardata pointer field - { - Value: &ChardataEmptyTest{}, - ExpectXML: ``, - MarshalOnly: true, - }, - - // omitempty on fields - { - Value: &OmitFieldTest{ - Int: 8, - Named: 9, - Float: 23.5, - Uint8: 255, - Bool: true, - Str: "str", - Bytes: []byte("byt"), - Ptr: &PresenceTest{}, - }, - ExpectXML: `` + - `8` + - `9` + - `23.5` + - `255` + - `true` + - `str` + - `byt` + - `` + - ``, - }, - { - Value: &OmitFieldTest{}, - ExpectXML: ``, - }, - - // Test ",any" - { - ExpectXML: `knownunknown`, - Value: &AnyTest{ - Nested: "known", - AnyField: AnyHolder{ - XMLName: Name{Local: "other"}, - XML: "unknown", - }, - }, - }, - { - Value: &AnyTest{Nested: "known", - AnyField: AnyHolder{ - XML: "", - XMLName: Name{Local: "AnyField"}, - }, - }, - ExpectXML: `known`, - }, - { - ExpectXML: `b`, - Value: &AnyOmitTest{ - Nested: "b", - }, - }, - { - ExpectXML: `bei`, - Value: &AnySliceTest{ - Nested: "b", - AnyField: []AnyHolder{ - { - XMLName: Name{Local: "c"}, - XML: "e", - }, - { - XMLName: Name{Space: "f", Local: "g"}, - XML: "i", - }, - }, - }, - }, - { - ExpectXML: `b`, - Value: &AnySliceTest{ - Nested: "b", - }, - }, - - // Test recursive types. - { - Value: &RecurseA{ - A: "a1", - B: &RecurseB{ - A: &RecurseA{"a2", nil}, - B: "b1", - }, - }, - ExpectXML: `a1a2b1`, - }, - - // Test ignoring fields via "-" tag - { - ExpectXML: ``, - Value: &IgnoreTest{}, - }, - { - ExpectXML: ``, - Value: &IgnoreTest{PublicSecret: "can't tell"}, - MarshalOnly: true, - }, - { - ExpectXML: `ignore me`, - Value: &IgnoreTest{}, - UnmarshalOnly: true, - }, - - // Test escaping. - { - ExpectXML: `dquote: "; squote: '; ampersand: &; less: <; greater: >;`, - Value: &AnyTest{ - Nested: `dquote: "; squote: '; ampersand: &; less: <; greater: >;`, - AnyField: AnyHolder{XMLName: Name{Local: "empty"}}, - }, - }, - { - ExpectXML: `newline: ; cr: ; tab: ;`, - Value: &AnyTest{ - Nested: "newline: \n; cr: \r; tab: \t;", - AnyField: AnyHolder{XMLName: Name{Local: "AnyField"}}, - }, - }, - { - ExpectXML: "1\r2\r\n3\n\r4\n5", - Value: &AnyTest{ - Nested: "1\n2\n3\n\n4\n5", - }, - UnmarshalOnly: true, - }, - { - ExpectXML: `42`, - Value: &EmbedInt{ - MyInt: 42, - }, - }, - // Test omitempty with parent chain; see golang.org/issue/4168. - { - ExpectXML: ``, - Value: &Strings{}, - }, - // Custom marshalers. - { - ExpectXML: `hello world`, - Value: &MyMarshalerTest{}, - }, - { - ExpectXML: ``, - Value: &MarshalerStruct{}, - }, - { - ExpectXML: ``, - Value: &OuterStruct{IntAttr: 10}, - }, - { - ExpectXML: ``, - Value: &OuterNamedStruct{XMLName: Name{Space: "outerns", Local: "test"}, IntAttr: 10}, - }, - { - ExpectXML: ``, - Value: &OuterNamedOrderedStruct{XMLName: Name{Space: "outerns", Local: "test"}, IntAttr: 10}, - }, - { - ExpectXML: ``, - Value: &OuterOuterStruct{OuterStruct{IntAttr: 10}}, - }, -} - -func TestMarshal(t *testing.T) { - for idx, test := range marshalTests { - if test.UnmarshalOnly { - continue - } - data, err := Marshal(test.Value) - if err != nil { - t.Errorf("#%d: Error: %s", idx, err) - continue - } - if got, want := string(data), test.ExpectXML; got != want { - if strings.Contains(want, "\n") { - t.Errorf("#%d: marshal(%#v):\nHAVE:\n%s\nWANT:\n%s", idx, test.Value, got, want) - } else { - t.Errorf("#%d: marshal(%#v):\nhave %#q\nwant %#q", idx, test.Value, got, want) - } - } - } -} - -type AttrParent struct { - X string `xml:"X>Y,attr"` -} - -type BadAttr struct { - Name []string `xml:"name,attr"` -} - -var marshalErrorTests = []struct { - Value interface{} - Err string - Kind reflect.Kind -}{ - { - Value: make(chan bool), - Err: "xml: unsupported type: chan bool", - Kind: reflect.Chan, - }, - { - Value: map[string]string{ - "question": "What do you get when you multiply six by nine?", - "answer": "42", - }, - Err: "xml: unsupported type: map[string]string", - Kind: reflect.Map, - }, - { - Value: map[*Ship]bool{nil: false}, - Err: "xml: unsupported type: map[*xml.Ship]bool", - Kind: reflect.Map, - }, - { - Value: &Domain{Comment: []byte("f--bar")}, - Err: `xml: comments must not contain "--"`, - }, - // Reject parent chain with attr, never worked; see golang.org/issue/5033. - { - Value: &AttrParent{}, - Err: `xml: X>Y chain not valid with attr flag`, - }, - { - Value: BadAttr{[]string{"X", "Y"}}, - Err: `xml: unsupported type: []string`, - }, -} - -var marshalIndentTests = []struct { - Value interface{} - Prefix string - Indent string - ExpectXML string -}{ - { - Value: &SecretAgent{ - Handle: "007", - Identity: "James Bond", - Obfuscate: "", - }, - Prefix: "", - Indent: "\t", - ExpectXML: fmt.Sprintf("\n\tJames Bond\n"), - }, -} - -func TestMarshalErrors(t *testing.T) { - for idx, test := range marshalErrorTests { - data, err := Marshal(test.Value) - if err == nil { - t.Errorf("#%d: marshal(%#v) = [success] %q, want error %v", idx, test.Value, data, test.Err) - continue - } - if err.Error() != test.Err { - t.Errorf("#%d: marshal(%#v) = [error] %v, want %v", idx, test.Value, err, test.Err) - } - if test.Kind != reflect.Invalid { - if kind := err.(*UnsupportedTypeError).Type.Kind(); kind != test.Kind { - t.Errorf("#%d: marshal(%#v) = [error kind] %s, want %s", idx, test.Value, kind, test.Kind) - } - } - } -} - -// Do invertibility testing on the various structures that we test -func TestUnmarshal(t *testing.T) { - for i, test := range marshalTests { - if test.MarshalOnly { - continue - } - if _, ok := test.Value.(*Plain); ok { - continue - } - - vt := reflect.TypeOf(test.Value) - dest := reflect.New(vt.Elem()).Interface() - err := Unmarshal([]byte(test.ExpectXML), dest) - - switch fix := dest.(type) { - case *Feed: - fix.Author.InnerXML = "" - for i := range fix.Entry { - fix.Entry[i].Author.InnerXML = "" - } - } - - if err != nil { - t.Errorf("#%d: unexpected error: %#v", i, err) - } else if got, want := dest, test.Value; !reflect.DeepEqual(got, want) { - t.Errorf("#%d: unmarshal(%q):\nhave %#v\nwant %#v", i, test.ExpectXML, got, want) - } - } -} - -func TestMarshalIndent(t *testing.T) { - for i, test := range marshalIndentTests { - data, err := MarshalIndent(test.Value, test.Prefix, test.Indent) - if err != nil { - t.Errorf("#%d: Error: %s", i, err) - continue - } - if got, want := string(data), test.ExpectXML; got != want { - t.Errorf("#%d: MarshalIndent:\nGot:%s\nWant:\n%s", i, got, want) - } - } -} - -type limitedBytesWriter struct { - w io.Writer - remain int // until writes fail -} - -func (lw *limitedBytesWriter) Write(p []byte) (n int, err error) { - if lw.remain <= 0 { - println("error") - return 0, errors.New("write limit hit") - } - if len(p) > lw.remain { - p = p[:lw.remain] - n, _ = lw.w.Write(p) - lw.remain = 0 - return n, errors.New("write limit hit") - } - n, err = lw.w.Write(p) - lw.remain -= n - return n, err -} - -func TestMarshalWriteErrors(t *testing.T) { - var buf bytes.Buffer - const writeCap = 1024 - w := &limitedBytesWriter{&buf, writeCap} - enc := NewEncoder(w) - var err error - var i int - const n = 4000 - for i = 1; i <= n; i++ { - err = enc.Encode(&Passenger{ - Name: []string{"Alice", "Bob"}, - Weight: 5, - }) - if err != nil { - break - } - } - if err == nil { - t.Error("expected an error") - } - if i == n { - t.Errorf("expected to fail before the end") - } - if buf.Len() != writeCap { - t.Errorf("buf.Len() = %d; want %d", buf.Len(), writeCap) - } -} - -func TestMarshalWriteIOErrors(t *testing.T) { - enc := NewEncoder(errWriter{}) - - expectErr := "unwritable" - err := enc.Encode(&Passenger{}) - if err == nil || err.Error() != expectErr { - t.Errorf("EscapeTest = [error] %v, want %v", err, expectErr) - } -} - -func TestMarshalFlush(t *testing.T) { - var buf bytes.Buffer - enc := NewEncoder(&buf) - if err := enc.EncodeToken(CharData("hello world")); err != nil { - t.Fatalf("enc.EncodeToken: %v", err) - } - if buf.Len() > 0 { - t.Fatalf("enc.EncodeToken caused actual write: %q", buf.Bytes()) - } - if err := enc.Flush(); err != nil { - t.Fatalf("enc.Flush: %v", err) - } - if buf.String() != "hello world" { - t.Fatalf("after enc.Flush, buf.String() = %q, want %q", buf.String(), "hello world") - } -} - -func BenchmarkMarshal(b *testing.B) { - for i := 0; i < b.N; i++ { - Marshal(atomValue) - } -} - -func BenchmarkUnmarshal(b *testing.B) { - xml := []byte(atomXml) - for i := 0; i < b.N; i++ { - Unmarshal(xml, &Feed{}) - } -} - -// golang.org/issue/6556 -func TestStructPointerMarshal(t *testing.T) { - type A struct { - XMLName string `xml:"a"` - B []interface{} - } - type C struct { - XMLName Name - Value string `xml:"value"` - } - - a := new(A) - a.B = append(a.B, &C{ - XMLName: Name{Local: "c"}, - Value: "x", - }) - - b, err := Marshal(a) - if err != nil { - t.Fatal(err) - } - if x := string(b); x != "x" { - t.Fatal(x) - } - var v A - err = Unmarshal(b, &v) - if err != nil { - t.Fatal(err) - } -} - -var encodeTokenTests = []struct { - tok Token - want string - ok bool -}{ - {StartElement{Name{"space", "local"}, nil}, "", true}, - {StartElement{Name{"space", ""}, nil}, "", false}, - {EndElement{Name{"space", ""}}, "", false}, - {CharData("foo"), "foo", true}, - {Comment("foo"), "", true}, - {Comment("foo-->"), "", false}, - {ProcInst{"Target", []byte("Instruction")}, "", true}, - {ProcInst{"", []byte("Instruction")}, "", false}, - {ProcInst{"Target", []byte("Instruction?>")}, "", false}, - {Directive("foo"), "", true}, - {Directive("foo>"), "", false}, -} - -func TestEncodeToken(t *testing.T) { - for _, tt := range encodeTokenTests { - var buf bytes.Buffer - enc := NewEncoder(&buf) - err := enc.EncodeToken(tt.tok) - switch { - case !tt.ok && err == nil: - t.Errorf("enc.EncodeToken(%#v): expected error; got none", tt.tok) - case tt.ok && err != nil: - t.Fatalf("enc.EncodeToken: %v", err) - case !tt.ok && err != nil: - // expected error, got one - } - if err := enc.Flush(); err != nil { - t.Fatalf("enc.EncodeToken: %v", err) - } - if got := buf.String(); got != tt.want { - t.Errorf("enc.EncodeToken = %s; want: %s", got, tt.want) - } - } -} - -func TestProcInstEncodeToken(t *testing.T) { - var buf bytes.Buffer - enc := NewEncoder(&buf) - - if err := enc.EncodeToken(ProcInst{"xml", []byte("Instruction")}); err != nil { - t.Fatalf("enc.EncodeToken: expected to be able to encode xml target ProcInst as first token, %s", err) - } - - if err := enc.EncodeToken(ProcInst{"Target", []byte("Instruction")}); err != nil { - t.Fatalf("enc.EncodeToken: expected to be able to add non-xml target ProcInst") - } - - if err := enc.EncodeToken(ProcInst{"xml", []byte("Instruction")}); err == nil { - t.Fatalf("enc.EncodeToken: expected to not be allowed to encode xml target ProcInst when not first token") - } -} - -func TestDecodeEncode(t *testing.T) { - var in, out bytes.Buffer - in.WriteString(` - - - -`) - dec := NewDecoder(&in) - enc := NewEncoder(&out) - for tok, err := dec.Token(); err == nil; tok, err = dec.Token() { - err = enc.EncodeToken(tok) - if err != nil { - t.Fatalf("enc.EncodeToken: Unable to encode token (%#v), %v", tok, err) - } - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/xml/read_test.go b/vendor/github.com/vmware/govmomi/vim25/xml/read_test.go deleted file mode 100644 index 77f43023ec..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/xml/read_test.go +++ /dev/null @@ -1,762 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xml - -import ( - "io" - "reflect" - "strings" - "testing" - "time" -) - -// Stripped down Atom feed data structures. - -func TestUnmarshalFeed(t *testing.T) { - var f Feed - if err := Unmarshal([]byte(atomFeedString), &f); err != nil { - t.Fatalf("Unmarshal: %s", err) - } - if !reflect.DeepEqual(f, atomFeed) { - t.Fatalf("have %#v\nwant %#v", f, atomFeed) - } -} - -// hget http://codereview.appspot.com/rss/mine/rsc -const atomFeedString = ` - -Code Review - My issueshttp://codereview.appspot.com/rietveld<>rietveld: an attempt at pubsubhubbub -2009-10-04T01:35:58+00:00email-address-removedurn:md5:134d9179c41f806be79b3a5f7877d19a - An attempt at adding pubsubhubbub support to Rietveld. -http://code.google.com/p/pubsubhubbub -http://code.google.com/p/rietveld/issues/detail?id=155 - -The server side of the protocol is trivial: - 1. add a &lt;link rel=&quot;hub&quot; href=&quot;hub-server&quot;&gt; tag to all - feeds that will be pubsubhubbubbed. - 2. every time one of those feeds changes, tell the hub - with a simple POST request. - -I have tested this by adding debug prints to a local hub -server and checking that the server got the right publish -requests. - -I can&#39;t quite get the server to work, but I think the bug -is not in my code. I think that the server expects to be -able to grab the feed and see the feed&#39;s actual URL in -the link rel=&quot;self&quot;, but the default value for that drops -the :port from the URL, and I cannot for the life of me -figure out how to get the Atom generator deep inside -django not to do that, or even where it is doing that, -or even what code is running to generate the Atom feed. -(I thought I knew but I added some assert False statements -and it kept running!) - -Ignoring that particular problem, I would appreciate -feedback on the right way to get the two values at -the top of feeds.py marked NOTE(rsc). - - -rietveld: correct tab handling -2009-10-03T23:02:17+00:00email-address-removedurn:md5:0a2a4f19bb815101f0ba2904aed7c35a - This fixes the buggy tab rendering that can be seen at -http://codereview.appspot.com/116075/diff/1/2 - -The fundamental problem was that the tab code was -not being told what column the text began in, so it -didn&#39;t know where to put the tab stops. Another problem -was that some of the code assumed that string byte -offsets were the same as column offsets, which is only -true if there are no tabs. - -In the process of fixing this, I cleaned up the arguments -to Fold and ExpandTabs and renamed them Break and -_ExpandTabs so that I could be sure that I found all the -call sites. I also wanted to verify that ExpandTabs was -not being used from outside intra_region_diff.py. - - - ` - -type Feed struct { - XMLName Name `xml:"http://www.w3.org/2005/Atom feed"` - Title string `xml:"title"` - Id string `xml:"id"` - Link []Link `xml:"link"` - Updated time.Time `xml:"updated,attr"` - Author Person `xml:"author"` - Entry []Entry `xml:"entry"` -} - -type Entry struct { - Title string `xml:"title"` - Id string `xml:"id"` - Link []Link `xml:"link"` - Updated time.Time `xml:"updated"` - Author Person `xml:"author"` - Summary Text `xml:"summary"` -} - -type Link struct { - Rel string `xml:"rel,attr,omitempty"` - Href string `xml:"href,attr"` -} - -type Person struct { - Name string `xml:"name"` - URI string `xml:"uri"` - Email string `xml:"email"` - InnerXML string `xml:",innerxml"` -} - -type Text struct { - Type string `xml:"type,attr,omitempty"` - Body string `xml:",chardata"` -} - -var atomFeed = Feed{ - XMLName: Name{"http://www.w3.org/2005/Atom", "feed"}, - Title: "Code Review - My issues", - Link: []Link{ - {Rel: "alternate", Href: "http://codereview.appspot.com/"}, - {Rel: "self", Href: "http://codereview.appspot.com/rss/mine/rsc"}, - }, - Id: "http://codereview.appspot.com/", - Updated: ParseTime("2009-10-04T01:35:58+00:00"), - Author: Person{ - Name: "rietveld<>", - InnerXML: "rietveld<>", - }, - Entry: []Entry{ - { - Title: "rietveld: an attempt at pubsubhubbub\n", - Link: []Link{ - {Rel: "alternate", Href: "http://codereview.appspot.com/126085"}, - }, - Updated: ParseTime("2009-10-04T01:35:58+00:00"), - Author: Person{ - Name: "email-address-removed", - InnerXML: "email-address-removed", - }, - Id: "urn:md5:134d9179c41f806be79b3a5f7877d19a", - Summary: Text{ - Type: "html", - Body: ` - An attempt at adding pubsubhubbub support to Rietveld. -http://code.google.com/p/pubsubhubbub -http://code.google.com/p/rietveld/issues/detail?id=155 - -The server side of the protocol is trivial: - 1. add a <link rel="hub" href="hub-server"> tag to all - feeds that will be pubsubhubbubbed. - 2. every time one of those feeds changes, tell the hub - with a simple POST request. - -I have tested this by adding debug prints to a local hub -server and checking that the server got the right publish -requests. - -I can't quite get the server to work, but I think the bug -is not in my code. I think that the server expects to be -able to grab the feed and see the feed's actual URL in -the link rel="self", but the default value for that drops -the :port from the URL, and I cannot for the life of me -figure out how to get the Atom generator deep inside -django not to do that, or even where it is doing that, -or even what code is running to generate the Atom feed. -(I thought I knew but I added some assert False statements -and it kept running!) - -Ignoring that particular problem, I would appreciate -feedback on the right way to get the two values at -the top of feeds.py marked NOTE(rsc). - - -`, - }, - }, - { - Title: "rietveld: correct tab handling\n", - Link: []Link{ - {Rel: "alternate", Href: "http://codereview.appspot.com/124106"}, - }, - Updated: ParseTime("2009-10-03T23:02:17+00:00"), - Author: Person{ - Name: "email-address-removed", - InnerXML: "email-address-removed", - }, - Id: "urn:md5:0a2a4f19bb815101f0ba2904aed7c35a", - Summary: Text{ - Type: "html", - Body: ` - This fixes the buggy tab rendering that can be seen at -http://codereview.appspot.com/116075/diff/1/2 - -The fundamental problem was that the tab code was -not being told what column the text began in, so it -didn't know where to put the tab stops. Another problem -was that some of the code assumed that string byte -offsets were the same as column offsets, which is only -true if there are no tabs. - -In the process of fixing this, I cleaned up the arguments -to Fold and ExpandTabs and renamed them Break and -_ExpandTabs so that I could be sure that I found all the -call sites. I also wanted to verify that ExpandTabs was -not being used from outside intra_region_diff.py. - - -`, - }, - }, - }, -} - -const pathTestString = ` - - 1 - - - A - - - B - - - C - D - - <_> - E - - - 2 - -` - -type PathTestItem struct { - Value string -} - -type PathTestA struct { - Items []PathTestItem `xml:">Item1"` - Before, After string -} - -type PathTestB struct { - Other []PathTestItem `xml:"Items>Item1"` - Before, After string -} - -type PathTestC struct { - Values1 []string `xml:"Items>Item1>Value"` - Values2 []string `xml:"Items>Item2>Value"` - Before, After string -} - -type PathTestSet struct { - Item1 []PathTestItem -} - -type PathTestD struct { - Other PathTestSet `xml:"Items"` - Before, After string -} - -type PathTestE struct { - Underline string `xml:"Items>_>Value"` - Before, After string -} - -var pathTests = []interface{}{ - &PathTestA{Items: []PathTestItem{{"A"}, {"D"}}, Before: "1", After: "2"}, - &PathTestB{Other: []PathTestItem{{"A"}, {"D"}}, Before: "1", After: "2"}, - &PathTestC{Values1: []string{"A", "C", "D"}, Values2: []string{"B"}, Before: "1", After: "2"}, - &PathTestD{Other: PathTestSet{Item1: []PathTestItem{{"A"}, {"D"}}}, Before: "1", After: "2"}, - &PathTestE{Underline: "E", Before: "1", After: "2"}, -} - -func TestUnmarshalPaths(t *testing.T) { - for _, pt := range pathTests { - v := reflect.New(reflect.TypeOf(pt).Elem()).Interface() - if err := Unmarshal([]byte(pathTestString), v); err != nil { - t.Fatalf("Unmarshal: %s", err) - } - if !reflect.DeepEqual(v, pt) { - t.Fatalf("have %#v\nwant %#v", v, pt) - } - } -} - -type BadPathTestA struct { - First string `xml:"items>item1"` - Other string `xml:"items>item2"` - Second string `xml:"items"` -} - -type BadPathTestB struct { - Other string `xml:"items>item2>value"` - First string `xml:"items>item1"` - Second string `xml:"items>item1>value"` -} - -type BadPathTestC struct { - First string - Second string `xml:"First"` -} - -type BadPathTestD struct { - BadPathEmbeddedA - BadPathEmbeddedB -} - -type BadPathEmbeddedA struct { - First string -} - -type BadPathEmbeddedB struct { - Second string `xml:"First"` -} - -var badPathTests = []struct { - v, e interface{} -}{ - {&BadPathTestA{}, &TagPathError{reflect.TypeOf(BadPathTestA{}), "First", "items>item1", "Second", "items"}}, - {&BadPathTestB{}, &TagPathError{reflect.TypeOf(BadPathTestB{}), "First", "items>item1", "Second", "items>item1>value"}}, - {&BadPathTestC{}, &TagPathError{reflect.TypeOf(BadPathTestC{}), "First", "", "Second", "First"}}, - {&BadPathTestD{}, &TagPathError{reflect.TypeOf(BadPathTestD{}), "First", "", "Second", "First"}}, -} - -func TestUnmarshalBadPaths(t *testing.T) { - for _, tt := range badPathTests { - err := Unmarshal([]byte(pathTestString), tt.v) - if !reflect.DeepEqual(err, tt.e) { - t.Fatalf("Unmarshal with %#v didn't fail properly:\nhave %#v,\nwant %#v", tt.v, err, tt.e) - } - } -} - -const OK = "OK" -const withoutNameTypeData = ` - -` - -type TestThree struct { - XMLName Name `xml:"Test3"` - Attr string `xml:",attr"` -} - -func TestUnmarshalWithoutNameType(t *testing.T) { - var x TestThree - if err := Unmarshal([]byte(withoutNameTypeData), &x); err != nil { - t.Fatalf("Unmarshal: %s", err) - } - if x.Attr != OK { - t.Fatalf("have %v\nwant %v", x.Attr, OK) - } -} - -func TestUnmarshalAttr(t *testing.T) { - type ParamVal struct { - Int int `xml:"int,attr"` - } - - type ParamPtr struct { - Int *int `xml:"int,attr"` - } - - type ParamStringPtr struct { - Int *string `xml:"int,attr"` - } - - x := []byte(``) - - p1 := &ParamPtr{} - if err := Unmarshal(x, p1); err != nil { - t.Fatalf("Unmarshal: %s", err) - } - if p1.Int == nil { - t.Fatalf("Unmarshal failed in to *int field") - } else if *p1.Int != 1 { - t.Fatalf("Unmarshal with %s failed:\nhave %#v,\n want %#v", x, p1.Int, 1) - } - - p2 := &ParamVal{} - if err := Unmarshal(x, p2); err != nil { - t.Fatalf("Unmarshal: %s", err) - } - if p2.Int != 1 { - t.Fatalf("Unmarshal with %s failed:\nhave %#v,\n want %#v", x, p2.Int, 1) - } - - p3 := &ParamStringPtr{} - if err := Unmarshal(x, p3); err != nil { - t.Fatalf("Unmarshal: %s", err) - } - if p3.Int == nil { - t.Fatalf("Unmarshal failed in to *string field") - } else if *p3.Int != "1" { - t.Fatalf("Unmarshal with %s failed:\nhave %#v,\n want %#v", x, p3.Int, 1) - } -} - -type Tables struct { - HTable string `xml:"http://www.w3.org/TR/html4/ table"` - FTable string `xml:"http://www.w3schools.com/furniture table"` -} - -var tables = []struct { - xml string - tab Tables - ns string -}{ - { - xml: `` + - `hello
` + - `world
` + - `
`, - tab: Tables{"hello", "world"}, - }, - { - xml: `` + - `world
` + - `hello
` + - `
`, - tab: Tables{"hello", "world"}, - }, - { - xml: `` + - `world` + - `hello` + - ``, - tab: Tables{"hello", "world"}, - }, - { - xml: `` + - `bogus
` + - `
`, - tab: Tables{}, - }, - { - xml: `` + - `only
` + - `
`, - tab: Tables{HTable: "only"}, - ns: "http://www.w3.org/TR/html4/", - }, - { - xml: `` + - `only
` + - `
`, - tab: Tables{FTable: "only"}, - ns: "http://www.w3schools.com/furniture", - }, - { - xml: `` + - `only
` + - `
`, - tab: Tables{}, - ns: "something else entirely", - }, -} - -func TestUnmarshalNS(t *testing.T) { - for i, tt := range tables { - var dst Tables - var err error - if tt.ns != "" { - d := NewDecoder(strings.NewReader(tt.xml)) - d.DefaultSpace = tt.ns - err = d.Decode(&dst) - } else { - err = Unmarshal([]byte(tt.xml), &dst) - } - if err != nil { - t.Errorf("#%d: Unmarshal: %v", i, err) - continue - } - want := tt.tab - if dst != want { - t.Errorf("#%d: dst=%+v, want %+v", i, dst, want) - } - } -} - -func TestMarshalNS(t *testing.T) { - dst := Tables{"hello", "world"} - data, err := Marshal(&dst) - if err != nil { - t.Fatalf("Marshal: %v", err) - } - want := `hello
world
` - str := string(data) - if str != want { - t.Errorf("have: %q\nwant: %q\n", str, want) - } -} - -type TableAttrs struct { - TAttr TAttr -} - -type TAttr struct { - HTable string `xml:"http://www.w3.org/TR/html4/ table,attr"` - FTable string `xml:"http://www.w3schools.com/furniture table,attr"` - Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr,omitempty"` - Other1 string `xml:"http://golang.org/xml/ other,attr,omitempty"` - Other2 string `xml:"http://golang.org/xmlfoo/ other,attr,omitempty"` - Other3 string `xml:"http://golang.org/json/ other,attr,omitempty"` - Other4 string `xml:"http://golang.org/2/json/ other,attr,omitempty"` -} - -var tableAttrs = []struct { - xml string - tab TableAttrs - ns string -}{ - { - xml: ``, - tab: TableAttrs{TAttr{HTable: "hello", FTable: "world"}}, - }, - { - xml: ``, - tab: TableAttrs{TAttr{HTable: "hello", FTable: "world"}}, - }, - { - xml: ``, - tab: TableAttrs{TAttr{HTable: "hello", FTable: "world"}}, - }, - { - // Default space does not apply to attribute names. - xml: ``, - tab: TableAttrs{TAttr{HTable: "hello", FTable: ""}}, - }, - { - // Default space does not apply to attribute names. - xml: ``, - tab: TableAttrs{TAttr{HTable: "", FTable: "world"}}, - }, - { - xml: ``, - tab: TableAttrs{}, - }, - { - // Default space does not apply to attribute names. - xml: ``, - tab: TableAttrs{TAttr{HTable: "hello", FTable: ""}}, - ns: "http://www.w3schools.com/furniture", - }, - { - // Default space does not apply to attribute names. - xml: ``, - tab: TableAttrs{TAttr{HTable: "", FTable: "world"}}, - ns: "http://www.w3.org/TR/html4/", - }, - { - xml: ``, - tab: TableAttrs{}, - ns: "something else entirely", - }, -} - -func TestUnmarshalNSAttr(t *testing.T) { - for i, tt := range tableAttrs { - var dst TableAttrs - var err error - if tt.ns != "" { - d := NewDecoder(strings.NewReader(tt.xml)) - d.DefaultSpace = tt.ns - err = d.Decode(&dst) - } else { - err = Unmarshal([]byte(tt.xml), &dst) - } - if err != nil { - t.Errorf("#%d: Unmarshal: %v", i, err) - continue - } - want := tt.tab - if dst != want { - t.Errorf("#%d: dst=%+v, want %+v", i, dst, want) - } - } -} - -func TestMarshalNSAttr(t *testing.T) { - src := TableAttrs{TAttr{"hello", "world", "en_US", "other1", "other2", "other3", "other4"}} - data, err := Marshal(&src) - if err != nil { - t.Fatalf("Marshal: %v", err) - } - want := `` - str := string(data) - if str != want { - t.Errorf("Marshal:\nhave: %#q\nwant: %#q\n", str, want) - } - - var dst TableAttrs - if err := Unmarshal(data, &dst); err != nil { - t.Errorf("Unmarshal: %v", err) - } - - if dst != src { - t.Errorf("Unmarshal = %q, want %q", dst, src) - } -} - -type MyCharData struct { - body string -} - -func (m *MyCharData) UnmarshalXML(d *Decoder, start StartElement) error { - for { - t, err := d.Token() - if err == io.EOF { // found end of element - break - } - if err != nil { - return err - } - if char, ok := t.(CharData); ok { - m.body += string(char) - } - } - return nil -} - -var _ Unmarshaler = (*MyCharData)(nil) - -func (m *MyCharData) UnmarshalXMLAttr(attr Attr) error { - panic("must not call") -} - -type MyAttr struct { - attr string -} - -func (m *MyAttr) UnmarshalXMLAttr(attr Attr) error { - m.attr = attr.Value - return nil -} - -var _ UnmarshalerAttr = (*MyAttr)(nil) - -type MyStruct struct { - Data *MyCharData - Attr *MyAttr `xml:",attr"` - - Data2 MyCharData - Attr2 MyAttr `xml:",attr"` -} - -func TestUnmarshaler(t *testing.T) { - xml := ` - - hello world - howdy world - - ` - - var m MyStruct - if err := Unmarshal([]byte(xml), &m); err != nil { - t.Fatal(err) - } - - if m.Data == nil || m.Attr == nil || m.Data.body != "hello world" || m.Attr.attr != "attr1" || m.Data2.body != "howdy world" || m.Attr2.attr != "attr2" { - t.Errorf("m=%#+v\n", m) - } -} - -type Pea struct { - Cotelydon string -} - -type Pod struct { - Pea interface{} `xml:"Pea"` -} - -// https://code.google.com/p/go/issues/detail?id=6836 -func TestUnmarshalIntoInterface(t *testing.T) { - pod := new(Pod) - pod.Pea = new(Pea) - xml := `Green stuff` - err := Unmarshal([]byte(xml), pod) - if err != nil { - t.Fatalf("failed to unmarshal %q: %v", xml, err) - } - pea, ok := pod.Pea.(*Pea) - if !ok { - t.Fatalf("unmarshalled into wrong type: have %T want *Pea", pod.Pea) - } - have, want := pea.Cotelydon, "Green stuff" - if have != want { - t.Errorf("failed to unmarshal into interface, have %q want %q", have, want) - } -} - -// https://github.com/vmware/govmomi/issues/246 -func TestNegativeValuesUnsignedFields(t *testing.T) { - type T struct { - I string - O interface{} - U8 uint8 `xml:"u8"` - U16 uint16 `xml:"u16"` - U32 uint32 `xml:"u32"` - U64 uint64 `xml:"u64"` - } - - var tests = []T{ - {I: "-128", O: uint8(0x80)}, - {I: "-1", O: uint8(0xff)}, - {I: "-32768", O: uint16(0x8000)}, - {I: "-1", O: uint16(0xffff)}, - {I: "-2147483648", O: uint32(0x80000000)}, - {I: "-1", O: uint32(0xffffffff)}, - {I: "-9223372036854775808", O: uint64(0x8000000000000000)}, - {I: "-1", O: uint64(0xffffffffffffffff)}, - } - - for _, test := range tests { - err := Unmarshal([]byte(test.I), &test) - if err != nil { - t.Errorf("Unmarshal error: %v", err) - continue - } - - var expected = test.O - var actual interface{} - switch reflect.ValueOf(test.O).Type().Kind() { - case reflect.Uint8: - actual = test.U8 - case reflect.Uint16: - actual = test.U16 - case reflect.Uint32: - actual = test.U32 - case reflect.Uint64: - actual = test.U64 - } - - if !reflect.DeepEqual(actual, expected) { - t.Errorf("Actual: %v, expected: %v", actual, expected) - } - } -} diff --git a/vendor/github.com/vmware/govmomi/vim25/xml/xml_test.go b/vendor/github.com/vmware/govmomi/vim25/xml/xml_test.go deleted file mode 100644 index 7723ab1c9f..0000000000 --- a/vendor/github.com/vmware/govmomi/vim25/xml/xml_test.go +++ /dev/null @@ -1,726 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xml - -import ( - "bytes" - "fmt" - "io" - "reflect" - "strings" - "testing" - "unicode/utf8" -) - -const testInput = ` - - - - World <>'" 白鵬翔 - &何; &is-it; - - - - - - - -` - -var testEntity = map[string]string{"何": "What", "is-it": "is it?"} - -var rawTokens = []Token{ - CharData("\n"), - ProcInst{"xml", []byte(`version="1.0" encoding="UTF-8"`)}, - CharData("\n"), - Directive(`DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"`), - CharData("\n"), - StartElement{Name{"", "body"}, []Attr{{Name{"xmlns", "foo"}, "ns1"}, {Name{"", "xmlns"}, "ns2"}, {Name{"xmlns", "tag"}, "ns3"}}}, - CharData("\n "), - StartElement{Name{"", "hello"}, []Attr{{Name{"", "lang"}, "en"}}}, - CharData("World <>'\" 白鵬翔"), - EndElement{Name{"", "hello"}}, - CharData("\n "), - StartElement{Name{"", "query"}, []Attr{}}, - CharData("What is it?"), - EndElement{Name{"", "query"}}, - CharData("\n "), - StartElement{Name{"", "goodbye"}, []Attr{}}, - EndElement{Name{"", "goodbye"}}, - CharData("\n "), - StartElement{Name{"", "outer"}, []Attr{{Name{"foo", "attr"}, "value"}, {Name{"xmlns", "tag"}, "ns4"}}}, - CharData("\n "), - StartElement{Name{"", "inner"}, []Attr{}}, - EndElement{Name{"", "inner"}}, - CharData("\n "), - EndElement{Name{"", "outer"}}, - CharData("\n "), - StartElement{Name{"tag", "name"}, []Attr{}}, - CharData("\n "), - CharData("Some text here."), - CharData("\n "), - EndElement{Name{"tag", "name"}}, - CharData("\n"), - EndElement{Name{"", "body"}}, - Comment(" missing final newline "), -} - -var cookedTokens = []Token{ - CharData("\n"), - ProcInst{"xml", []byte(`version="1.0" encoding="UTF-8"`)}, - CharData("\n"), - Directive(`DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"`), - CharData("\n"), - StartElement{Name{"ns2", "body"}, []Attr{{Name{"xmlns", "foo"}, "ns1"}, {Name{"", "xmlns"}, "ns2"}, {Name{"xmlns", "tag"}, "ns3"}}}, - CharData("\n "), - StartElement{Name{"ns2", "hello"}, []Attr{{Name{"", "lang"}, "en"}}}, - CharData("World <>'\" 白鵬翔"), - EndElement{Name{"ns2", "hello"}}, - CharData("\n "), - StartElement{Name{"ns2", "query"}, []Attr{}}, - CharData("What is it?"), - EndElement{Name{"ns2", "query"}}, - CharData("\n "), - StartElement{Name{"ns2", "goodbye"}, []Attr{}}, - EndElement{Name{"ns2", "goodbye"}}, - CharData("\n "), - StartElement{Name{"ns2", "outer"}, []Attr{{Name{"ns1", "attr"}, "value"}, {Name{"xmlns", "tag"}, "ns4"}}}, - CharData("\n "), - StartElement{Name{"ns2", "inner"}, []Attr{}}, - EndElement{Name{"ns2", "inner"}}, - CharData("\n "), - EndElement{Name{"ns2", "outer"}}, - CharData("\n "), - StartElement{Name{"ns3", "name"}, []Attr{}}, - CharData("\n "), - CharData("Some text here."), - CharData("\n "), - EndElement{Name{"ns3", "name"}}, - CharData("\n"), - EndElement{Name{"ns2", "body"}}, - Comment(" missing final newline "), -} - -const testInputAltEncoding = ` - -VALUE` - -var rawTokensAltEncoding = []Token{ - CharData("\n"), - ProcInst{"xml", []byte(`version="1.0" encoding="x-testing-uppercase"`)}, - CharData("\n"), - StartElement{Name{"", "tag"}, []Attr{}}, - CharData("value"), - EndElement{Name{"", "tag"}}, -} - -var xmlInput = []string{ - // unexpected EOF cases - "<", - "", - "", - "", - // "", // let the Token() caller handle - "", - "", - "", - "", - " c;", - "", - "", - "", - // "", // let the Token() caller handle - "", - "", - "cdata]]>", -} - -func TestRawToken(t *testing.T) { - d := NewDecoder(strings.NewReader(testInput)) - d.Entity = testEntity - testRawToken(t, d, rawTokens) -} - -const nonStrictInput = ` -non&entity -&unknown;entity -{ -&#zzz; -&なまえ3; -<-gt; -&; -&0a; -` - -var nonStringEntity = map[string]string{"": "oops!", "0a": "oops!"} - -var nonStrictTokens = []Token{ - CharData("\n"), - StartElement{Name{"", "tag"}, []Attr{}}, - CharData("non&entity"), - EndElement{Name{"", "tag"}}, - CharData("\n"), - StartElement{Name{"", "tag"}, []Attr{}}, - CharData("&unknown;entity"), - EndElement{Name{"", "tag"}}, - CharData("\n"), - StartElement{Name{"", "tag"}, []Attr{}}, - CharData("{"), - EndElement{Name{"", "tag"}}, - CharData("\n"), - StartElement{Name{"", "tag"}, []Attr{}}, - CharData("&#zzz;"), - EndElement{Name{"", "tag"}}, - CharData("\n"), - StartElement{Name{"", "tag"}, []Attr{}}, - CharData("&なまえ3;"), - EndElement{Name{"", "tag"}}, - CharData("\n"), - StartElement{Name{"", "tag"}, []Attr{}}, - CharData("<-gt;"), - EndElement{Name{"", "tag"}}, - CharData("\n"), - StartElement{Name{"", "tag"}, []Attr{}}, - CharData("&;"), - EndElement{Name{"", "tag"}}, - CharData("\n"), - StartElement{Name{"", "tag"}, []Attr{}}, - CharData("&0a;"), - EndElement{Name{"", "tag"}}, - CharData("\n"), -} - -func TestNonStrictRawToken(t *testing.T) { - d := NewDecoder(strings.NewReader(nonStrictInput)) - d.Strict = false - testRawToken(t, d, nonStrictTokens) -} - -type downCaser struct { - t *testing.T - r io.ByteReader -} - -func (d *downCaser) ReadByte() (c byte, err error) { - c, err = d.r.ReadByte() - if c >= 'A' && c <= 'Z' { - c += 'a' - 'A' - } - return -} - -func (d *downCaser) Read(p []byte) (int, error) { - d.t.Fatalf("unexpected Read call on downCaser reader") - panic("unreachable") -} - -func TestRawTokenAltEncoding(t *testing.T) { - d := NewDecoder(strings.NewReader(testInputAltEncoding)) - d.CharsetReader = func(charset string, input io.Reader) (io.Reader, error) { - if charset != "x-testing-uppercase" { - t.Fatalf("unexpected charset %q", charset) - } - return &downCaser{t, input.(io.ByteReader)}, nil - } - testRawToken(t, d, rawTokensAltEncoding) -} - -func TestRawTokenAltEncodingNoConverter(t *testing.T) { - d := NewDecoder(strings.NewReader(testInputAltEncoding)) - token, err := d.RawToken() - if token == nil { - t.Fatalf("expected a token on first RawToken call") - } - if err != nil { - t.Fatal(err) - } - token, err = d.RawToken() - if token != nil { - t.Errorf("expected a nil token; got %#v", token) - } - if err == nil { - t.Fatalf("expected an error on second RawToken call") - } - const encoding = "x-testing-uppercase" - if !strings.Contains(err.Error(), encoding) { - t.Errorf("expected error to contain %q; got error: %v", - encoding, err) - } -} - -func testRawToken(t *testing.T, d *Decoder, rawTokens []Token) { - for i, want := range rawTokens { - have, err := d.RawToken() - if err != nil { - t.Fatalf("token %d: unexpected error: %s", i, err) - } - if !reflect.DeepEqual(have, want) { - var shave, swant string - if _, ok := have.(CharData); ok { - shave = fmt.Sprintf("CharData(%q)", have) - } else { - shave = fmt.Sprintf("%#v", have) - } - if _, ok := want.(CharData); ok { - swant = fmt.Sprintf("CharData(%q)", want) - } else { - swant = fmt.Sprintf("%#v", want) - } - t.Errorf("token %d = %s, want %s", i, shave, swant) - } - } -} - -// Ensure that directives (specifically !DOCTYPE) include the complete -// text of any nested directives, noting that < and > do not change -// nesting depth if they are in single or double quotes. - -var nestedDirectivesInput = ` -]> -">]> -]> -'>]> -]> -'>]> -]> -` - -var nestedDirectivesTokens = []Token{ - CharData("\n"), - Directive(`DOCTYPE []`), - CharData("\n"), - Directive(`DOCTYPE [">]`), - CharData("\n"), - Directive(`DOCTYPE []`), - CharData("\n"), - Directive(`DOCTYPE ['>]`), - CharData("\n"), - Directive(`DOCTYPE []`), - CharData("\n"), - Directive(`DOCTYPE ['>]`), - CharData("\n"), - Directive(`DOCTYPE []`), - CharData("\n"), -} - -func TestNestedDirectives(t *testing.T) { - d := NewDecoder(strings.NewReader(nestedDirectivesInput)) - - for i, want := range nestedDirectivesTokens { - have, err := d.Token() - if err != nil { - t.Fatalf("token %d: unexpected error: %s", i, err) - } - if !reflect.DeepEqual(have, want) { - t.Errorf("token %d = %#v want %#v", i, have, want) - } - } -} - -func TestToken(t *testing.T) { - d := NewDecoder(strings.NewReader(testInput)) - d.Entity = testEntity - - for i, want := range cookedTokens { - have, err := d.Token() - if err != nil { - t.Fatalf("token %d: unexpected error: %s", i, err) - } - if !reflect.DeepEqual(have, want) { - t.Errorf("token %d = %#v want %#v", i, have, want) - } - } -} - -func TestSyntax(t *testing.T) { - for i := range xmlInput { - d := NewDecoder(strings.NewReader(xmlInput[i])) - var err error - for _, err = d.Token(); err == nil; _, err = d.Token() { - } - if _, ok := err.(*SyntaxError); !ok { - t.Fatalf(`xmlInput "%s": expected SyntaxError not received`, xmlInput[i]) - } - } -} - -type allScalars struct { - True1 bool - True2 bool - False1 bool - False2 bool - Int int - Int8 int8 - Int16 int16 - Int32 int32 - Int64 int64 - Uint int - Uint8 uint8 - Uint16 uint16 - Uint32 uint32 - Uint64 uint64 - Uintptr uintptr - Float32 float32 - Float64 float64 - String string - PtrString *string -} - -var all = allScalars{ - True1: true, - True2: true, - False1: false, - False2: false, - Int: 1, - Int8: -2, - Int16: 3, - Int32: -4, - Int64: 5, - Uint: 6, - Uint8: 7, - Uint16: 8, - Uint32: 9, - Uint64: 10, - Uintptr: 11, - Float32: 13.0, - Float64: 14.0, - String: "15", - PtrString: &sixteen, -} - -var sixteen = "16" - -const testScalarsInput = ` - true - 1 - false - 0 - 1 - -2 - 3 - -4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12.0 - 13.0 - 14.0 - 15 - 16 -` - -func TestAllScalars(t *testing.T) { - var a allScalars - err := Unmarshal([]byte(testScalarsInput), &a) - - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(a, all) { - t.Errorf("have %+v want %+v", a, all) - } -} - -type item struct { - Field_a string -} - -func TestIssue569(t *testing.T) { - data := `abcd` - var i item - err := Unmarshal([]byte(data), &i) - - if err != nil || i.Field_a != "abcd" { - t.Fatal("Expecting abcd") - } -} - -func TestUnquotedAttrs(t *testing.T) { - data := "" - d := NewDecoder(strings.NewReader(data)) - d.Strict = false - token, err := d.Token() - if _, ok := err.(*SyntaxError); ok { - t.Errorf("Unexpected error: %v", err) - } - if token.(StartElement).Name.Local != "tag" { - t.Errorf("Unexpected tag name: %v", token.(StartElement).Name.Local) - } - attr := token.(StartElement).Attr[0] - if attr.Value != "azAZ09:-_" { - t.Errorf("Unexpected attribute value: %v", attr.Value) - } - if attr.Name.Local != "attr" { - t.Errorf("Unexpected attribute name: %v", attr.Name.Local) - } -} - -func TestValuelessAttrs(t *testing.T) { - tests := [][3]string{ - {"

", "p", "nowrap"}, - {"

", "p", "nowrap"}, - {"", "input", "checked"}, - {"", "input", "checked"}, - } - for _, test := range tests { - d := NewDecoder(strings.NewReader(test[0])) - d.Strict = false - token, err := d.Token() - if _, ok := err.(*SyntaxError); ok { - t.Errorf("Unexpected error: %v", err) - } - if token.(StartElement).Name.Local != test[1] { - t.Errorf("Unexpected tag name: %v", token.(StartElement).Name.Local) - } - attr := token.(StartElement).Attr[0] - if attr.Value != test[2] { - t.Errorf("Unexpected attribute value: %v", attr.Value) - } - if attr.Name.Local != test[2] { - t.Errorf("Unexpected attribute name: %v", attr.Name.Local) - } - } -} - -func TestCopyTokenCharData(t *testing.T) { - data := []byte("same data") - var tok1 Token = CharData(data) - tok2 := CopyToken(tok1) - if !reflect.DeepEqual(tok1, tok2) { - t.Error("CopyToken(CharData) != CharData") - } - data[1] = 'o' - if reflect.DeepEqual(tok1, tok2) { - t.Error("CopyToken(CharData) uses same buffer.") - } -} - -func TestCopyTokenStartElement(t *testing.T) { - elt := StartElement{Name{"", "hello"}, []Attr{{Name{"", "lang"}, "en"}}} - var tok1 Token = elt - tok2 := CopyToken(tok1) - if tok1.(StartElement).Attr[0].Value != "en" { - t.Error("CopyToken overwrote Attr[0]") - } - if !reflect.DeepEqual(tok1, tok2) { - t.Error("CopyToken(StartElement) != StartElement") - } - tok1.(StartElement).Attr[0] = Attr{Name{"", "lang"}, "de"} - if reflect.DeepEqual(tok1, tok2) { - t.Error("CopyToken(CharData) uses same buffer.") - } -} - -func TestSyntaxErrorLineNum(t *testing.T) { - testInput := "

Foo

\n\n

Bar\n" - d := NewDecoder(strings.NewReader(testInput)) - var err error - for _, err = d.Token(); err == nil; _, err = d.Token() { - } - synerr, ok := err.(*SyntaxError) - if !ok { - t.Error("Expected SyntaxError.") - } - if synerr.Line != 3 { - t.Error("SyntaxError didn't have correct line number.") - } -} - -func TestTrailingRawToken(t *testing.T) { - input := ` ` - d := NewDecoder(strings.NewReader(input)) - var err error - for _, err = d.RawToken(); err == nil; _, err = d.RawToken() { - } - if err != io.EOF { - t.Fatalf("d.RawToken() = _, %v, want _, io.EOF", err) - } -} - -func TestTrailingToken(t *testing.T) { - input := ` ` - d := NewDecoder(strings.NewReader(input)) - var err error - for _, err = d.Token(); err == nil; _, err = d.Token() { - } - if err != io.EOF { - t.Fatalf("d.Token() = _, %v, want _, io.EOF", err) - } -} - -func TestEntityInsideCDATA(t *testing.T) { - input := `` - d := NewDecoder(strings.NewReader(input)) - var err error - for _, err = d.Token(); err == nil; _, err = d.Token() { - } - if err != io.EOF { - t.Fatalf("d.Token() = _, %v, want _, io.EOF", err) - } -} - -var characterTests = []struct { - in string - err string -}{ - {"\x12", "illegal character code U+0012"}, - {"\x0b", "illegal character code U+000B"}, - {"\xef\xbf\xbe", "illegal character code U+FFFE"}, - {"\r\n\x07", "illegal character code U+0007"}, - {"what's up", "expected attribute name in element"}, - {"&abc\x01;", "invalid character entity &abc (no semicolon)"}, - {"&\x01;", "invalid character entity & (no semicolon)"}, - {"&\xef\xbf\xbe;", "invalid character entity &\uFFFE;"}, - {"&hello;", "invalid character entity &hello;"}, -} - -func TestDisallowedCharacters(t *testing.T) { - - for i, tt := range characterTests { - d := NewDecoder(strings.NewReader(tt.in)) - var err error - - for err == nil { - _, err = d.Token() - } - synerr, ok := err.(*SyntaxError) - if !ok { - t.Fatalf("input %d d.Token() = _, %v, want _, *SyntaxError", i, err) - } - if synerr.Msg != tt.err { - t.Fatalf("input %d synerr.Msg wrong: want %q, got %q", i, tt.err, synerr.Msg) - } - } -} - -type procInstEncodingTest struct { - expect, got string -} - -var procInstTests = []struct { - input, expect string -}{ - {`version="1.0" encoding="utf-8"`, "utf-8"}, - {`version="1.0" encoding='utf-8'`, "utf-8"}, - {`version="1.0" encoding='utf-8' `, "utf-8"}, - {`version="1.0" encoding=utf-8`, ""}, - {`encoding="FOO" `, "FOO"}, -} - -func TestProcInstEncoding(t *testing.T) { - for _, test := range procInstTests { - got := procInstEncoding(test.input) - if got != test.expect { - t.Errorf("procInstEncoding(%q) = %q; want %q", test.input, got, test.expect) - } - } -} - -// Ensure that directives with comments include the complete -// text of any nested directives. - -var directivesWithCommentsInput = ` -]> -]> - --> --> []> -` - -var directivesWithCommentsTokens = []Token{ - CharData("\n"), - Directive(`DOCTYPE []`), - CharData("\n"), - Directive(`DOCTYPE []`), - CharData("\n"), - Directive(`DOCTYPE []`), - CharData("\n"), -} - -func TestDirectivesWithComments(t *testing.T) { - d := NewDecoder(strings.NewReader(directivesWithCommentsInput)) - - for i, want := range directivesWithCommentsTokens { - have, err := d.Token() - if err != nil { - t.Fatalf("token %d: unexpected error: %s", i, err) - } - if !reflect.DeepEqual(have, want) { - t.Errorf("token %d = %#v want %#v", i, have, want) - } - } -} - -// Writer whose Write method always returns an error. -type errWriter struct{} - -func (errWriter) Write(p []byte) (n int, err error) { return 0, fmt.Errorf("unwritable") } - -func TestEscapeTextIOErrors(t *testing.T) { - expectErr := "unwritable" - err := EscapeText(errWriter{}, []byte{'A'}) - - if err == nil || err.Error() != expectErr { - t.Errorf("have %v, want %v", err, expectErr) - } -} - -func TestEscapeTextInvalidChar(t *testing.T) { - input := []byte("A \x00 terminated string.") - expected := "A \uFFFD terminated string." - - buff := new(bytes.Buffer) - if err := EscapeText(buff, input); err != nil { - t.Fatalf("have %v, want nil", err) - } - text := buff.String() - - if text != expected { - t.Errorf("have %v, want %v", text, expected) - } -} - -func TestIssue5880(t *testing.T) { - type T []byte - data, err := Marshal(T{192, 168, 0, 1}) - if err != nil { - t.Errorf("Marshal error: %v", err) - } - if !utf8.Valid(data) { - t.Errorf("Marshal generated invalid UTF-8: %x", data) - } -} diff --git a/vendor/github.com/xanzy/go-cloudstack/LICENSE b/vendor/github.com/xanzy/go-cloudstack/LICENSE new file mode 100644 index 0000000000..5c304d1a4a --- /dev/null +++ b/vendor/github.com/xanzy/go-cloudstack/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/ziutek/mymysql/LICENSE b/vendor/github.com/ziutek/mymysql/LICENSE new file mode 100644 index 0000000000..8eab9a6ec5 --- /dev/null +++ b/vendor/github.com/ziutek/mymysql/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2010, Michal Derkacz +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/ziutek/mymysql/autorc/LICENSE b/vendor/github.com/ziutek/mymysql/autorc/LICENSE new file mode 100644 index 0000000000..8eab9a6ec5 --- /dev/null +++ b/vendor/github.com/ziutek/mymysql/autorc/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2010, Michal Derkacz +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/ziutek/mymysql/mysql/types_test.go b/vendor/github.com/ziutek/mymysql/mysql/types_test.go deleted file mode 100644 index 63d479eeac..0000000000 --- a/vendor/github.com/ziutek/mymysql/mysql/types_test.go +++ /dev/null @@ -1,100 +0,0 @@ -package mysql - -import ( - "testing" - "time" -) - -type sio struct { - in, out string -} - -func checkRow(t *testing.T, examples []sio, conv func(string) interface{}) { - row := make(Row, 1) - for _, ex := range examples { - row[0] = conv(ex.in) - str := row.Str(0) - if str != ex.out { - t.Fatalf("Wrong conversion: '%s' != '%s'", str, ex.out) - } - } -} - -var dates = []sio{ - sio{"2121-11-22", "2121-11-22"}, - sio{"0000-00-00", "0000-00-00"}, - sio{" 1234-12-18 ", "1234-12-18"}, - sio{"\t1234-12-18 \r\n", "1234-12-18"}, -} - -func TestConvDate(t *testing.T) { - conv := func(str string) interface{} { - d, err := ParseDate(str) - if err != nil { - return err - } - return d - } - checkRow(t, dates, conv) -} - -var datetimes = []sio{ - sio{"2121-11-22 11:22:32", "2121-11-22 11:22:32"}, - sio{" 1234-12-18 22:11:22 ", "1234-12-18 22:11:22"}, - sio{"\t 1234-12-18 22:11:22 \r\n", "1234-12-18 22:11:22"}, - sio{"2000-11-11", "2000-11-11 00:00:00"}, - sio{"0000-00-00 00:00:00", "0000-00-00 00:00:00"}, - sio{"0000-00-00", "0000-00-00 00:00:00"}, - sio{"2000-11-22 11:11:11.000111222", "2000-11-22 11:11:11.000111222"}, -} - -func TestConvTime(t *testing.T) { - conv := func(str string) interface{} { - d, err := ParseTime(str, time.Local) - if err != nil { - return err - } - return d - } - checkRow(t, datetimes, conv) -} - -var times = []sio{ - sio{"1:23:45", "1:23:45"}, - sio{"-112:23:45", "-112:23:45"}, - sio{"+112:23:45", "112:23:45"}, - sio{"1:60:00", "invalid MySQL TIME string: 1:60:00"}, - sio{"1:00:60", "invalid MySQL TIME string: 1:00:60"}, - sio{"1:23:45.000111333", "1:23:45.000111333"}, - sio{"-1:23:45.000111333", "-1:23:45.000111333"}, -} - -func TestConvDuration(t *testing.T) { - conv := func(str string) interface{} { - d, err := ParseDuration(str) - if err != nil { - return err - } - return d - - } - checkRow(t, times, conv) -} - -func TestEscapeString(t *testing.T) { - txt := " \000 \n \r \\ ' \" \032 " - exp := ` \0 \n \r \\ \' \" \Z ` - out := escapeString(txt) - if out != exp { - t.Fatalf("escapeString: ret='%s' exp='%s'", out, exp) - } -} - -func TestEscapeQuotes(t *testing.T) { - txt := " '' '' ' ' ' " - exp := ` '''' '''' '' '' '' ` - out := escapeQuotes(txt) - if out != exp { - t.Fatalf("escapeString: ret='%s' exp='%s'", out, exp) - } -} diff --git a/vendor/github.com/ziutek/mymysql/native/bind_test.go b/vendor/github.com/ziutek/mymysql/native/bind_test.go deleted file mode 100644 index 218cd1ee3d..0000000000 --- a/vendor/github.com/ziutek/mymysql/native/bind_test.go +++ /dev/null @@ -1,386 +0,0 @@ -package native - -import ( - "bufio" - "bytes" - "github.com/ziutek/mymysql/mysql" - "math" - "reflect" - "strconv" - "testing" - "time" -) - -var ( - Bytes = []byte("Ala ma Kota!") - String = "ssss" //"A kot ma Alę!" - blob = mysql.Blob{1, 2, 3} - dateT = time.Date(2010, 12, 30, 17, 21, 01, 0, time.Local) - tstamp = mysql.Timestamp{dateT.Add(1e9)} - date = mysql.Date{Year: 2011, Month: 2, Day: 3} - tim = -time.Duration((5*24*3600+4*3600+3*60+2)*1e9 + 1) - bol = true - - pBytes *[]byte - pString *string - pBlob *mysql.Blob - pDateT *time.Time - pTstamp *mysql.Timestamp - pDate *mysql.Date - pTim *time.Duration - pBol *bool - - raw = mysql.Raw{MYSQL_TYPE_INT24, &[]byte{3, 2, 1, 0}} - - Int8 = int8(1) - Uint8 = uint8(2) - Int16 = int16(3) - Uint16 = uint16(4) - Int32 = int32(5) - Uint32 = uint32(6) - Int64 = int64(0x7000100020003001) - Uint64 = uint64(0xffff0000ffff0000) - Int = int(7) - Uint = uint(8) - - Float32 = float32(1e10) - Float64 = 256e256 - - pInt8 *int8 - pUint8 *uint8 - pInt16 *int16 - pUint16 *uint16 - pInt32 *int32 - pUint32 *uint32 - pInt64 *int64 - pUint64 *uint64 - pInt *int - pUint *uint - pFloat32 *float32 - pFloat64 *float64 -) - -type BindTest struct { - val interface{} - typ uint16 - length int -} - -func intSize() int { - switch strconv.IntSize { - case 32: - return 4 - case 64: - return 8 - } - panic("bad int size") -} - -func intType() uint16 { - switch strconv.IntSize { - case 32: - return MYSQL_TYPE_LONG - case 64: - return MYSQL_TYPE_LONGLONG - } - panic("bad int size") - -} - -var bindTests = []BindTest{ - BindTest{nil, MYSQL_TYPE_NULL, 0}, - - BindTest{Bytes, MYSQL_TYPE_VAR_STRING, -1}, - BindTest{String, MYSQL_TYPE_STRING, -1}, - BindTest{blob, MYSQL_TYPE_BLOB, -1}, - BindTest{dateT, MYSQL_TYPE_DATETIME, -1}, - BindTest{tstamp, MYSQL_TYPE_TIMESTAMP, -1}, - BindTest{date, MYSQL_TYPE_DATE, -1}, - BindTest{tim, MYSQL_TYPE_TIME, -1}, - BindTest{bol, MYSQL_TYPE_TINY, -1}, - - BindTest{&Bytes, MYSQL_TYPE_VAR_STRING, -1}, - BindTest{&String, MYSQL_TYPE_STRING, -1}, - BindTest{&blob, MYSQL_TYPE_BLOB, -1}, - BindTest{&dateT, MYSQL_TYPE_DATETIME, -1}, - BindTest{&tstamp, MYSQL_TYPE_TIMESTAMP, -1}, - BindTest{&date, MYSQL_TYPE_DATE, -1}, - BindTest{&tim, MYSQL_TYPE_TIME, -1}, - - BindTest{pBytes, MYSQL_TYPE_VAR_STRING, -1}, - BindTest{pString, MYSQL_TYPE_STRING, -1}, - BindTest{pBlob, MYSQL_TYPE_BLOB, -1}, - BindTest{pDateT, MYSQL_TYPE_DATETIME, -1}, - BindTest{pTstamp, MYSQL_TYPE_TIMESTAMP, -1}, - BindTest{pDate, MYSQL_TYPE_DATE, -1}, - BindTest{pTim, MYSQL_TYPE_TIME, -1}, - BindTest{pBol, MYSQL_TYPE_TINY, -1}, - - BindTest{raw, MYSQL_TYPE_INT24, -1}, - - BindTest{Int8, MYSQL_TYPE_TINY, 1}, - BindTest{Int16, MYSQL_TYPE_SHORT, 2}, - BindTest{Int32, MYSQL_TYPE_LONG, 4}, - BindTest{Int64, MYSQL_TYPE_LONGLONG, 8}, - BindTest{Int, intType(), intSize()}, - - BindTest{&Int8, MYSQL_TYPE_TINY, 1}, - BindTest{&Int16, MYSQL_TYPE_SHORT, 2}, - BindTest{&Int32, MYSQL_TYPE_LONG, 4}, - BindTest{&Int64, MYSQL_TYPE_LONGLONG, 8}, - BindTest{&Int, intType(), intSize()}, - - BindTest{pInt8, MYSQL_TYPE_TINY, 1}, - BindTest{pInt16, MYSQL_TYPE_SHORT, 2}, - BindTest{pInt32, MYSQL_TYPE_LONG, 4}, - BindTest{pInt64, MYSQL_TYPE_LONGLONG, 8}, - BindTest{pInt, intType(), intSize()}, - - BindTest{Uint8, MYSQL_TYPE_TINY | MYSQL_UNSIGNED_MASK, 1}, - BindTest{Uint16, MYSQL_TYPE_SHORT | MYSQL_UNSIGNED_MASK, 2}, - BindTest{Uint32, MYSQL_TYPE_LONG | MYSQL_UNSIGNED_MASK, 4}, - BindTest{Uint64, MYSQL_TYPE_LONGLONG | MYSQL_UNSIGNED_MASK, 8}, - BindTest{Uint, intType() | MYSQL_UNSIGNED_MASK, intSize()}, - - BindTest{&Uint8, MYSQL_TYPE_TINY | MYSQL_UNSIGNED_MASK, 1}, - BindTest{&Uint16, MYSQL_TYPE_SHORT | MYSQL_UNSIGNED_MASK, 2}, - BindTest{&Uint32, MYSQL_TYPE_LONG | MYSQL_UNSIGNED_MASK, 4}, - BindTest{&Uint64, MYSQL_TYPE_LONGLONG | MYSQL_UNSIGNED_MASK, 8}, - BindTest{&Uint, intType() | MYSQL_UNSIGNED_MASK, intSize()}, - - BindTest{pUint8, MYSQL_TYPE_TINY | MYSQL_UNSIGNED_MASK, 1}, - BindTest{pUint16, MYSQL_TYPE_SHORT | MYSQL_UNSIGNED_MASK, 2}, - BindTest{pUint32, MYSQL_TYPE_LONG | MYSQL_UNSIGNED_MASK, 4}, - BindTest{pUint64, MYSQL_TYPE_LONGLONG | MYSQL_UNSIGNED_MASK, 8}, - BindTest{pUint, intType() | MYSQL_UNSIGNED_MASK, intSize()}, - - BindTest{Float32, MYSQL_TYPE_FLOAT, 4}, - BindTest{Float64, MYSQL_TYPE_DOUBLE, 8}, - - BindTest{&Float32, MYSQL_TYPE_FLOAT, 4}, - BindTest{&Float64, MYSQL_TYPE_DOUBLE, 8}, -} - -func makeAddressable(v reflect.Value) reflect.Value { - if v.IsValid() { - // Make an addresable value - av := reflect.New(v.Type()).Elem() - av.Set(v) - v = av - } - return v -} - -func TestBind(t *testing.T) { - for _, test := range bindTests { - v := makeAddressable(reflect.ValueOf(test.val)) - val := bindValue(v) - if val.typ != test.typ || val.length != test.length { - t.Errorf( - "Type: %s exp=0x%x res=0x%x Len: exp=%d res=%d", - reflect.TypeOf(test.val), test.typ, val.typ, test.length, - val.length, - ) - } - } -} - -type WriteTest struct { - val interface{} - exp []byte -} - -var writeTest []WriteTest - -func encodeU16(v uint16) []byte { - buf := make([]byte, 2) - EncodeU16(buf, v) - return buf -} - -func encodeU24(v uint32) []byte { - buf := make([]byte, 3) - EncodeU24(buf, v) - return buf -} - -func encodeU32(v uint32) []byte { - buf := make([]byte, 4) - EncodeU32(buf, v) - return buf -} - -func encodeU64(v uint64) []byte { - buf := make([]byte, 8) - EncodeU64(buf, v) - return buf -} - -func encodeDuration(d time.Duration) []byte { - buf := make([]byte, 13) - n := EncodeDuration(buf, d) - return buf[:n] -} - -func encodeTime(t time.Time) []byte { - buf := make([]byte, 12) - n := EncodeTime(buf, t) - return buf[:n] -} - -func encodeDate(d mysql.Date) []byte { - buf := make([]byte, 5) - n := EncodeDate(buf, d) - return buf[:n] -} - -func encodeUint(u uint) []byte { - switch strconv.IntSize { - case 32: - return encodeU32(uint32(u)) - case 64: - return encodeU64(uint64(u)) - } - panic("bad int size") - -} - -func init() { - b := make([]byte, 64*1024) - for ii := range b { - b[ii] = byte(ii) - } - blob = mysql.Blob(b) - - writeTest = []WriteTest{ - WriteTest{Bytes, append([]byte{byte(len(Bytes))}, Bytes...)}, - WriteTest{String, append([]byte{byte(len(String))}, []byte(String)...)}, - WriteTest{pBytes, nil}, - WriteTest{pString, nil}, - WriteTest{ - blob, - append( - append([]byte{253}, byte(len(blob)), byte(len(blob)>>8), byte(len(blob)>>16)), - []byte(blob)...), - }, - WriteTest{ - dateT, - []byte{ - 7, byte(dateT.Year()), byte(dateT.Year() >> 8), - byte(dateT.Month()), - byte(dateT.Day()), byte(dateT.Hour()), byte(dateT.Minute()), - byte(dateT.Second()), - }, - }, - WriteTest{ - &dateT, - []byte{ - 7, byte(dateT.Year()), byte(dateT.Year() >> 8), - byte(dateT.Month()), - byte(dateT.Day()), byte(dateT.Hour()), byte(dateT.Minute()), - byte(dateT.Second()), - }, - }, - WriteTest{ - date, - []byte{ - 4, byte(date.Year), byte(date.Year >> 8), byte(date.Month), - byte(date.Day), - }, - }, - WriteTest{ - &date, - []byte{ - 4, byte(date.Year), byte(date.Year >> 8), byte(date.Month), - byte(date.Day), - }, - }, - WriteTest{ - tim, - []byte{12, 1, 5, 0, 0, 0, 4, 3, 2, 1, 0, 0, 0}, - }, - WriteTest{ - &tim, - []byte{12, 1, 5, 0, 0, 0, 4, 3, 2, 1, 0, 0, 0}, - }, - WriteTest{bol, []byte{1}}, - WriteTest{&bol, []byte{1}}, - WriteTest{pBol, nil}, - - WriteTest{dateT, encodeTime(dateT)}, - WriteTest{&dateT, encodeTime(dateT)}, - WriteTest{pDateT, nil}, - - WriteTest{tstamp, encodeTime(tstamp.Time)}, - WriteTest{&tstamp, encodeTime(tstamp.Time)}, - WriteTest{pTstamp, nil}, - - WriteTest{date, encodeDate(date)}, - WriteTest{&date, encodeDate(date)}, - WriteTest{pDate, nil}, - - WriteTest{tim, encodeDuration(tim)}, - WriteTest{&tim, encodeDuration(tim)}, - WriteTest{pTim, nil}, - - WriteTest{Int, encodeUint(uint(Int))}, - WriteTest{Int16, encodeU16(uint16(Int16))}, - WriteTest{Int32, encodeU32(uint32(Int32))}, - WriteTest{Int64, encodeU64(uint64(Int64))}, - - WriteTest{Uint, encodeUint(Uint)}, - WriteTest{Uint16, encodeU16(Uint16)}, - WriteTest{Uint32, encodeU32(Uint32)}, - WriteTest{Uint64, encodeU64(Uint64)}, - - WriteTest{&Int, encodeUint(uint(Int))}, - WriteTest{&Int16, encodeU16(uint16(Int16))}, - WriteTest{&Int32, encodeU32(uint32(Int32))}, - WriteTest{&Int64, encodeU64(uint64(Int64))}, - - WriteTest{&Uint, encodeUint(Uint)}, - WriteTest{&Uint16, encodeU16(Uint16)}, - WriteTest{&Uint32, encodeU32(Uint32)}, - WriteTest{&Uint64, encodeU64(Uint64)}, - - WriteTest{pInt, nil}, - WriteTest{pInt16, nil}, - WriteTest{pInt32, nil}, - WriteTest{pInt64, nil}, - - WriteTest{Float32, encodeU32(math.Float32bits(Float32))}, - WriteTest{Float64, encodeU64(math.Float64bits(Float64))}, - - WriteTest{&Float32, encodeU32(math.Float32bits(Float32))}, - WriteTest{&Float64, encodeU64(math.Float64bits(Float64))}, - - WriteTest{pFloat32, nil}, - WriteTest{pFloat64, nil}, - } -} - -func TestWrite(t *testing.T) { - buf := new(bytes.Buffer) - for _, test := range writeTest { - buf.Reset() - var seq byte - pw := &pktWriter{ - wr: bufio.NewWriter(buf), - seq: &seq, - to_write: len(test.exp), - } - v := makeAddressable(reflect.ValueOf(test.val)) - val := bindValue(v) - pw.writeValue(&val) - if !reflect.Indirect(v).IsValid() && len(buf.Bytes()) == 0 { - // writeValue writes nothing for nil - continue - } - if len(buf.Bytes()) != len(test.exp)+4 || !bytes.Equal(buf.Bytes()[4:], test.exp) || val.Len() != len(test.exp) { - t.Fatalf("%s - exp_len=%d res_len=%d exp: %v res: %v", - reflect.TypeOf(test.val), len(test.exp), val.Len(), - test.exp, buf.Bytes(), - ) - } - } -} diff --git a/vendor/github.com/ziutek/mymysql/native/native_test.go b/vendor/github.com/ziutek/mymysql/native/native_test.go deleted file mode 100644 index fb6597108b..0000000000 --- a/vendor/github.com/ziutek/mymysql/native/native_test.go +++ /dev/null @@ -1,1218 +0,0 @@ -package native - -import ( - "bytes" - "fmt" - "github.com/ziutek/mymysql/mysql" - "io/ioutil" - "os" - "reflect" - "testing" - "time" -) - -var ( - my mysql.Conn - user = "testuser" - passwd = "TestPasswd9" - dbname = "test" - //conn = []string{"unix", "", "/var/run/mysqld/mysqld.sock"} - conn = []string{"", "", "127.0.0.1:3306"} - debug = false -) - -type RowsResErr struct { - rows []mysql.Row - res mysql.Result - err error -} - -func query(sql string, params ...interface{}) *RowsResErr { - rows, res, err := my.Query(sql, params...) - return &RowsResErr{rows, res, err} -} - -func exec(stmt *Stmt, params ...interface{}) *RowsResErr { - rows, res, err := stmt.Exec(params...) - return &RowsResErr{rows, res, err} -} - -func checkErr(t *testing.T, err error, exp_err error) { - if err != exp_err { - if exp_err == nil { - t.Fatalf("Error: %v", err) - } else { - t.Fatalf("Error: %v\nExpected error: %v", err, exp_err) - } - } -} - -func checkWarnCount(t *testing.T, res_cnt, exp_cnt int) { - if res_cnt != exp_cnt { - t.Errorf("Warning count: res=%d exp=%d", res_cnt, exp_cnt) - rows, res, err := my.Query("show warnings") - if err != nil { - t.Fatal("Can't get warrnings from MySQL", err) - } - for _, row := range rows { - t.Errorf("%s: \"%s\"", row.Str(res.Map("Level")), - row.Str(res.Map("Message"))) - } - t.FailNow() - } -} - -func checkErrWarn(t *testing.T, res, exp *RowsResErr) { - checkErr(t, res.err, exp.err) - checkWarnCount(t, res.res.WarnCount(), exp.res.WarnCount()) -} - -func types(row mysql.Row) (tt []reflect.Type) { - tt = make([]reflect.Type, len(row)) - for ii, val := range row { - tt[ii] = reflect.TypeOf(val) - } - return -} - -func checkErrWarnRows(t *testing.T, res, exp *RowsResErr) { - checkErrWarn(t, res, exp) - if !reflect.DeepEqual(res.rows, exp.rows) { - rlen := len(res.rows) - elen := len(exp.rows) - t.Error("Rows are different!") - t.Errorf("len/cap: res=%d/%d exp=%d/%d", - rlen, cap(res.rows), elen, cap(exp.rows)) - max := rlen - if elen > max { - max = elen - } - for ii := 0; ii < max; ii++ { - if ii < len(res.rows) { - t.Errorf("%d: res type: %s", ii, types(res.rows[ii])) - } else { - t.Errorf("%d: res: ------", ii) - } - if ii < len(exp.rows) { - t.Errorf("%d: exp type: %s", ii, types(exp.rows[ii])) - } else { - t.Errorf("%d: exp: ------", ii) - } - if ii < len(res.rows) { - t.Error(" res: ", res.rows[ii]) - } - if ii < len(exp.rows) { - t.Error(" exp: ", exp.rows[ii]) - } - if ii < len(res.rows) { - t.Errorf(" res: %#v", res.rows[ii][2]) - } - if ii < len(exp.rows) { - t.Errorf(" exp: %#v", exp.rows[ii][2]) - } - } - t.FailNow() - } -} - -func checkResult(t *testing.T, res, exp *RowsResErr) { - checkErrWarnRows(t, res, exp) - r, e := res.res.(*Result), exp.res.(*Result) - if r.my != e.my || r.binary != e.binary || r.status_only != e.status_only || - r.status&0xdf != e.status || !bytes.Equal(r.message, e.message) || - r.affected_rows != e.affected_rows || - r.eor_returned != e.eor_returned || - !reflect.DeepEqual(res.rows, exp.rows) || res.err != exp.err { - t.Fatalf("Bad result:\nres=%+v\nexp=%+v", res.res, exp.res) - } -} - -func cmdOK(affected uint64, binary, eor bool) *RowsResErr { - return &RowsResErr{ - res: &Result{ - my: my.(*Conn), - binary: binary, - status_only: true, - status: 0x2, - message: []byte{}, - affected_rows: affected, - eor_returned: eor, - }, - } -} - -func selectOK(rows []mysql.Row, binary bool) (exp *RowsResErr) { - exp = cmdOK(0, binary, true) - exp.rows = rows - return -} - -func myConnect(t *testing.T, with_dbname bool, max_pkt_size int) { - if with_dbname { - my = New(conn[0], conn[1], conn[2], user, passwd, dbname) - } else { - my = New(conn[0], conn[1], conn[2], user, passwd) - } - - if max_pkt_size != 0 { - my.SetMaxPktSize(max_pkt_size) - } - my.(*Conn).Debug = debug - - checkErr(t, my.Connect(), nil) - checkResult(t, query("set names utf8"), cmdOK(0, false, true)) -} - -func myClose(t *testing.T) { - checkErr(t, my.Close(), nil) -} - -// Text queries tests - -func TestUse(t *testing.T) { - myConnect(t, false, 0) - checkErr(t, my.Use(dbname), nil) - myClose(t) -} - -func TestPing(t *testing.T) { - myConnect(t, false, 0) - checkErr(t, my.Ping(), nil) - myClose(t) -} - -func TestQuery(t *testing.T) { - myConnect(t, true, 0) - query("drop table t") // Drop test table if exists - checkResult(t, query("create table t (s varchar(40))"), - cmdOK(0, false, true)) - - exp := &RowsResErr{ - res: &Result{ - my: my.(*Conn), - field_count: 1, - fields: []*mysql.Field{ - &mysql.Field{ - Catalog: "def", - Db: "test", - Table: "Test", - OrgTable: "T", - Name: "Str", - OrgName: "s", - DispLen: 3 * 40, //varchar(40) - Flags: 0, - Type: MYSQL_TYPE_VAR_STRING, - Scale: 0, - }, - }, - status: mysql.SERVER_STATUS_AUTOCOMMIT, - eor_returned: true, - }, - } - - for ii := 0; ii > 10000; ii += 3 { - var val interface{} - if ii%10 == 0 { - checkResult(t, query("insert t values (null)"), - cmdOK(1, false, true)) - val = nil - } else { - txt := []byte(fmt.Sprintf("%d %d %d %d %d", ii, ii, ii, ii, ii)) - checkResult(t, - query("insert t values ('%s')", txt), cmdOK(1, false, true)) - val = txt - } - exp.rows = append(exp.rows, mysql.Row{val}) - } - - checkResult(t, query("select s as Str from t as Test"), exp) - checkResult(t, query("drop table t"), cmdOK(0, false, true)) - myClose(t) -} - -// Prepared statements tests - -type StmtErr struct { - stmt *Stmt - err error -} - -func prepare(sql string) *StmtErr { - stmt, err := my.Prepare(sql) - return &StmtErr{stmt.(*Stmt), err} -} - -func checkStmt(t *testing.T, res, exp *StmtErr) { - ok := res.err == exp.err && - // Skipping id - reflect.DeepEqual(res.stmt.fields, exp.stmt.fields) && - res.stmt.field_count == exp.stmt.field_count && - res.stmt.param_count == exp.stmt.param_count && - res.stmt.warning_count == exp.stmt.warning_count && - res.stmt.status == exp.stmt.status - - if !ok { - if exp.err == nil { - checkErr(t, res.err, nil) - checkWarnCount(t, res.stmt.warning_count, exp.stmt.warning_count) - for _, v := range res.stmt.fields { - fmt.Printf("%+v\n", v) - } - t.Fatalf("Bad result statement: res=%v exp=%v", res.stmt, exp.stmt) - } - } -} - -func TestPrepared(t *testing.T) { - myConnect(t, true, 0) - query("drop table p") // Drop test table if exists - checkResult(t, - query( - "create table p ("+ - " ii int not null, ss varchar(20), dd datetime"+ - ") default charset=utf8", - ), - cmdOK(0, false, true), - ) - - exp := Stmt{ - fields: []*mysql.Field{ - &mysql.Field{ - Catalog: "def", Db: "test", Table: "p", OrgTable: "p", - Name: "i", - OrgName: "ii", - DispLen: 11, - Flags: _FLAG_NO_DEFAULT_VALUE | _FLAG_NOT_NULL, - Type: MYSQL_TYPE_LONG, - Scale: 0, - }, - &mysql.Field{ - Catalog: "def", Db: "test", Table: "p", OrgTable: "p", - Name: "s", - OrgName: "ss", - DispLen: 3 * 20, // varchar(20) - Flags: 0, - Type: MYSQL_TYPE_VAR_STRING, - Scale: 0, - }, - &mysql.Field{ - Catalog: "def", Db: "test", Table: "p", OrgTable: "p", - Name: "d", - OrgName: "dd", - DispLen: 19, - Flags: _FLAG_BINARY, - Type: MYSQL_TYPE_DATETIME, - Scale: 0, - }, - }, - field_count: 3, - param_count: 2, - warning_count: 0, - status: 0x2, - } - - sel := prepare("select ii i, ss s, dd d from p where ii = ? and ss = ?") - checkStmt(t, sel, &StmtErr{&exp, nil}) - - all := prepare("select * from p") - checkErr(t, all.err, nil) - - ins := prepare("insert p values (?, ?, ?)") - checkErr(t, ins.err, nil) - - parsed, err := mysql.ParseTime("2012-01-17 01:10:10", time.Local) - checkErr(t, err, nil) - parsedZero, err := mysql.ParseTime("0000-00-00 00:00:00", time.Local) - checkErr(t, err, nil) - if !parsedZero.IsZero() { - t.Fatalf("time '%s' isn't zero", parsedZero) - } - exp_rows := []mysql.Row{ - mysql.Row{ - 2, "Taki tekst", time.Unix(123456789, 0), - }, - mysql.Row{ - 5, "Pąk róży", parsed, - }, - mysql.Row{ - -3, "基础体温", parsed, - }, - mysql.Row{ - 11, "Zero UTC datetime", time.Unix(0, 0), - }, - mysql.Row{ - 17, mysql.Blob([]byte("Zero datetime")), parsedZero, - }, - mysql.Row{ - 23, []byte("NULL datetime"), (*time.Time)(nil), - }, - mysql.Row{ - 23, "NULL", nil, - }, - } - - for _, row := range exp_rows { - checkErrWarn(t, - exec(ins.stmt, row[0], row[1], row[2]), - cmdOK(1, true, true), - ) - } - - // Convert values to expected result types - for _, row := range exp_rows { - for ii, col := range row { - val := reflect.ValueOf(col) - // Dereference pointers - if val.Kind() == reflect.Ptr { - val = val.Elem() - } - switch val.Kind() { - case reflect.Invalid: - row[ii] = nil - - case reflect.String: - row[ii] = []byte(val.String()) - - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, - reflect.Int64: - row[ii] = int32(val.Int()) - - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, - reflect.Uint64: - row[ii] = int32(val.Uint()) - - case reflect.Slice: - if val.Type().Elem().Kind() == reflect.Uint8 { - bytes := make([]byte, val.Len()) - for ii := range bytes { - bytes[ii] = val.Index(ii).Interface().(uint8) - } - row[ii] = bytes - } - } - } - } - - checkErrWarn(t, exec(sel.stmt, 2, "Taki tekst"), selectOK(exp_rows, true)) - checkErrWarnRows(t, exec(all.stmt), selectOK(exp_rows, true)) - - checkResult(t, query("drop table p"), cmdOK(0, false, true)) - - checkErr(t, sel.stmt.Delete(), nil) - checkErr(t, all.stmt.Delete(), nil) - checkErr(t, ins.stmt.Delete(), nil) - - myClose(t) -} - -// Bind testing - -func TestVarBinding(t *testing.T) { - myConnect(t, true, 0) - query("drop table t") // Drop test table if exists - checkResult(t, - query("create table t (id int primary key, str varchar(20))"), - cmdOK(0, false, true), - ) - - ins, err := my.Prepare("insert t values (?, ?)") - checkErr(t, err, nil) - - var ( - rre RowsResErr - id *int - str *string - ii int - ss string - ) - ins.Bind(&id, &str) - - i1 := 1 - s1 := "Ala" - id = &i1 - str = &s1 - rre.res, rre.err = ins.Run() - checkResult(t, &rre, cmdOK(1, true, false)) - - i2 := 2 - s2 := "Ma kota!" - id = &i2 - str = &s2 - - rre.res, rre.err = ins.Run() - checkResult(t, &rre, cmdOK(1, true, false)) - - ins.Bind(&ii, &ss) - ii = 3 - ss = "A kot ma Ale!" - - rre.res, rre.err = ins.Run() - checkResult(t, &rre, cmdOK(1, true, false)) - - sel, err := my.Prepare("select str from t where id = ?") - checkErr(t, err, nil) - - rows, _, err := sel.Exec(1) - checkErr(t, err, nil) - if len(rows) != 1 || bytes.Compare([]byte(s1), rows[0].Bin(0)) != 0 { - t.Fatal("First string don't match") - } - - rows, _, err = sel.Exec(2) - checkErr(t, err, nil) - if len(rows) != 1 || bytes.Compare([]byte(s2), rows[0].Bin(0)) != 0 { - t.Fatal("Second string don't match") - } - - rows, _, err = sel.Exec(3) - checkErr(t, err, nil) - if len(rows) != 1 || bytes.Compare([]byte(ss), rows[0].Bin(0)) != 0 { - t.Fatal("Thrid string don't match") - } - - checkResult(t, query("drop table t"), cmdOK(0, false, true)) - myClose(t) -} - -func TestBindStruct(t *testing.T) { - myConnect(t, true, 0) - query("drop table t") // Drop test table if exists - checkResult(t, - query("create table t (id int primary key, txt varchar(20), b bool)"), - cmdOK(0, false, true), - ) - - ins, err := my.Prepare("insert t values (?, ?, ?)") - checkErr(t, err, nil) - sel, err := my.Prepare("select txt, b from t where id = ?") - checkErr(t, err, nil) - - var ( - s struct { - Id int - Txt string - B bool - } - rre RowsResErr - ) - - ins.Bind(&s) - - s.Id = 2 - s.Txt = "Ala ma kota." - s.B = true - - rre.res, rre.err = ins.Run() - checkResult(t, &rre, cmdOK(1, true, false)) - - rows, _, err := sel.Exec(s.Id) - checkErr(t, err, nil) - if len(rows) != 1 || rows[0].Str(0) != s.Txt || rows[0].Bool(1) != s.B { - t.Fatal("selected data don't match inserted data") - } - - checkResult(t, query("drop table t"), cmdOK(0, false, true)) - myClose(t) -} - -func TestDate(t *testing.T) { - myConnect(t, true, 0) - query("drop table d") // Drop test table if exists - checkResult(t, - query("create table d (id int, dd date, dt datetime, tt time)"), - cmdOK(0, false, true), - ) - - test := []struct { - dd, dt string - tt time.Duration - }{ - { - "2011-11-13", - "2010-12-12 11:24:00", - -time.Duration((128*3600 + 3*60 + 2) * 1e9), - }, { - "0000-00-00", - "0000-00-00 00:00:00", - time.Duration(0), - }, - } - - ins, err := my.Prepare("insert d values (?, ?, ?, ?)") - checkErr(t, err, nil) - - sel, err := my.Prepare("select id, tt from d where dd = ? && dt = ?") - checkErr(t, err, nil) - - for i, r := range test { - _, err = ins.Run(i, r.dd, r.dt, r.tt) - checkErr(t, err, nil) - - sdt, err := mysql.ParseTime(r.dt, time.Local) - checkErr(t, err, nil) - sdd, err := mysql.ParseDate(r.dd) - checkErr(t, err, nil) - - rows, _, err := sel.Exec(sdd, sdt) - checkErr(t, err, nil) - if rows == nil { - t.Fatal("nil result") - } - if rows[0].Int(0) != i { - t.Fatal("Bad id", rows[0].Int(1)) - } - if rows[0][1].(time.Duration) != r.tt { - t.Fatal("Bad tt", rows[0].Duration(1)) - } - } - - checkResult(t, query("drop table d"), cmdOK(0, false, true)) - myClose(t) -} - -func TestDateTimeZone(t *testing.T) { - myConnect(t, true, 0) - query("drop table d") // Drop test table if exists - checkResult(t, - query("create table d (dt datetime)"), - cmdOK(0, false, true), - ) - - ins, err := my.Prepare("insert d values (?)") - checkErr(t, err, nil) - - sel, err := my.Prepare("select dt from d") - checkErr(t, err, nil) - - tstr := "2013-05-10 15:26:00.000000000" - - _, err = ins.Run(tstr) - checkErr(t, err, nil) - - tt := make([]time.Time, 4) - - row, _, err := sel.ExecFirst() - checkErr(t, err, nil) - tt[0] = row.Time(0, time.UTC) - tt[1] = row.Time(0, time.Local) - row, _, err = my.QueryFirst("select dt from d") - checkErr(t, err, nil) - tt[2] = row.Time(0, time.UTC) - tt[3] = row.Time(0, time.Local) - for _, v := range tt { - if v.Format(mysql.TimeFormat) != tstr { - t.Fatal("Timezone problem:", tstr, "!=", v) - } - } - - checkResult(t, query("drop table d"), cmdOK(0, false, true)) - myClose(t) -} - -// Big blob -func TestBigBlob(t *testing.T) { - myConnect(t, true, 34*1024*1024) - query("drop table p") // Drop test table if exists - checkResult(t, - query("create table p (id int primary key, bb longblob)"), - cmdOK(0, false, true), - ) - - ins, err := my.Prepare("insert p values (?, ?)") - checkErr(t, err, nil) - - sel, err := my.Prepare("select bb from p where id = ?") - checkErr(t, err, nil) - - big_blob := make(mysql.Blob, 33*1024*1024) - for ii := range big_blob { - big_blob[ii] = byte(ii) - } - - var ( - rre RowsResErr - bb mysql.Blob - id int - ) - data := struct { - Id int - Bb mysql.Blob - }{} - - // Individual parameters binding - ins.Bind(&id, &bb) - id = 1 - bb = big_blob - - // Insert full blob. Three packets are sended. First two has maximum length - rre.res, rre.err = ins.Run() - checkResult(t, &rre, cmdOK(1, true, false)) - - // Struct binding - ins.Bind(&data) - data.Id = 2 - data.Bb = big_blob[0 : 32*1024*1024-31] - - // Insert part of blob - Two packets are sended. All has maximum length. - rre.res, rre.err = ins.Run() - checkResult(t, &rre, cmdOK(1, true, false)) - - sel.Bind(&id) - - // Check first insert. - tmr := "Too many rows" - - id = 1 - res, err := sel.Run() - checkErr(t, err, nil) - - row, err := res.GetRow() - checkErr(t, err, nil) - end, err := res.GetRow() - checkErr(t, err, nil) - if end != nil { - t.Fatal(tmr) - } - - if bytes.Compare(row[0].([]byte), big_blob) != 0 { - t.Fatal("Full blob data don't match") - } - - // Check second insert. - id = 2 - res, err = sel.Run() - checkErr(t, err, nil) - - row, err = res.GetRow() - checkErr(t, err, nil) - end, err = res.GetRow() - checkErr(t, err, nil) - if end != nil { - t.Fatal(tmr) - } - - if bytes.Compare(row.Bin(res.Map("bb")), data.Bb) != 0 { - t.Fatal("Partial blob data don't match") - } - - checkResult(t, query("drop table p"), cmdOK(0, false, true)) - myClose(t) -} - -// Test for empty result -func TestEmpty(t *testing.T) { - checkNil := func(r mysql.Row) { - if r != nil { - t.Error("Not empty result") - } - } - myConnect(t, true, 0) - query("drop table e") // Drop test table if exists - // Create table - checkResult(t, - query("create table e (id int)"), - cmdOK(0, false, true), - ) - // Text query - res, err := my.Start("select * from e") - checkErr(t, err, nil) - row, err := res.GetRow() - checkErr(t, err, nil) - checkNil(row) - row, err = res.GetRow() - checkErr(t, err, mysql.ErrReadAfterEOR) - checkNil(row) - // Prepared statement - sel, err := my.Prepare("select * from e") - checkErr(t, err, nil) - res, err = sel.Run() - checkErr(t, err, nil) - row, err = res.GetRow() - checkErr(t, err, nil) - checkNil(row) - row, err = res.GetRow() - checkErr(t, err, mysql.ErrReadAfterEOR) - checkNil(row) - // Drop test table - checkResult(t, query("drop table e"), cmdOK(0, false, true)) -} - -// Reconnect test -func TestReconnect(t *testing.T) { - myConnect(t, true, 0) - query("drop table r") // Drop test table if exists - checkResult(t, - query("create table r (id int primary key, str varchar(20))"), - cmdOK(0, false, true), - ) - - ins, err := my.Prepare("insert r values (?, ?)") - checkErr(t, err, nil) - sel, err := my.Prepare("select str from r where id = ?") - checkErr(t, err, nil) - - params := struct { - Id int - Str string - }{} - var sel_id int - - ins.Bind(¶ms) - sel.Bind(&sel_id) - - checkErr(t, my.Reconnect(), nil) - - params.Id = 1 - params.Str = "Bla bla bla" - _, err = ins.Run() - checkErr(t, err, nil) - - checkErr(t, my.Reconnect(), nil) - - sel_id = 1 - res, err := sel.Run() - checkErr(t, err, nil) - - row, err := res.GetRow() - checkErr(t, err, nil) - - checkErr(t, res.End(), nil) - - if row == nil || row[0] == nil || - params.Str != row.Str(0) { - t.Fatal("Bad result") - } - - checkErr(t, my.Reconnect(), nil) - - checkResult(t, query("drop table r"), cmdOK(0, false, true)) - myClose(t) -} - -// StmtSendLongData test - -func TestSendLongData(t *testing.T) { - myConnect(t, true, 64*1024*1024) - query("drop table l") // Drop test table if exists - checkResult(t, - query("create table l (id int primary key, bb longblob)"), - cmdOK(0, false, true), - ) - ins, err := my.Prepare("insert l values (?, ?)") - checkErr(t, err, nil) - - sel, err := my.Prepare("select bb from l where id = ?") - checkErr(t, err, nil) - - var ( - rre RowsResErr - id int64 - ) - - ins.Bind(&id, []byte(nil)) - sel.Bind(&id) - - // Prepare data - data := make([]byte, 4*1024*1024) - for ii := range data { - data[ii] = byte(ii) - } - // Send long data twice - checkErr(t, ins.SendLongData(1, data, 256*1024), nil) - checkErr(t, ins.SendLongData(1, data, 512*1024), nil) - - id = 1 - rre.res, rre.err = ins.Run() - checkResult(t, &rre, cmdOK(1, true, false)) - - res, err := sel.Run() - checkErr(t, err, nil) - - row, err := res.GetRow() - checkErr(t, err, nil) - - checkErr(t, res.End(), nil) - - if row == nil || row[0] == nil || - bytes.Compare(append(data, data...), row.Bin(0)) != 0 { - t.Fatal("Bad result") - } - - file, err := ioutil.TempFile("", "mymysql_test-") - checkErr(t, err, nil) - filename := file.Name() - defer os.Remove(filename) - - buf := make([]byte, 1024) - for i := 0; i < 2048; i++ { - _, err := file.Write(buf) - checkErr(t, err, nil) - } - checkErr(t, file.Close(), nil) - - // Send long data from io.Reader twice - file, err = os.Open(filename) - checkErr(t, err, nil) - checkErr(t, ins.SendLongData(1, file, 128*1024), nil) - checkErr(t, file.Close(), nil) - file, err = os.Open(filename) - checkErr(t, err, nil) - checkErr(t, ins.SendLongData(1, file, 1024*1024), nil) - checkErr(t, file.Close(), nil) - - id = 2 - rre.res, rre.err = ins.Run() - checkResult(t, &rre, cmdOK(1, true, false)) - - res, err = sel.Run() - checkErr(t, err, nil) - - row, err = res.GetRow() - checkErr(t, err, nil) - - checkErr(t, res.End(), nil) - - // Read file for check result - data, err = ioutil.ReadFile(filename) - checkErr(t, err, nil) - - if row == nil || row[0] == nil || - bytes.Compare(append(data, data...), row.Bin(0)) != 0 { - t.Fatal("Bad result") - } - - checkResult(t, query("drop table l"), cmdOK(0, false, true)) - myClose(t) -} - -func TestNull(t *testing.T) { - myConnect(t, true, 0) - query("drop table if exists n") - checkResult(t, - query("create table n (i int not null, n int)"), - cmdOK(0, false, true), - ) - ins, err := my.Prepare("insert n values (?, ?)") - checkErr(t, err, nil) - - var ( - p struct{ I, N *int } - rre RowsResErr - ) - ins.Bind(&p) - - p.I = new(int) - p.N = new(int) - - *p.I = 0 - *p.N = 1 - rre.res, rre.err = ins.Run() - checkResult(t, &rre, cmdOK(1, true, false)) - *p.I = 1 - p.N = nil - rre.res, rre.err = ins.Run() - checkResult(t, &rre, cmdOK(1, true, false)) - - checkResult(t, query("insert n values (2, 1)"), cmdOK(1, false, true)) - checkResult(t, query("insert n values (3, NULL)"), cmdOK(1, false, true)) - - rows, res, err := my.Query("select * from n") - checkErr(t, err, nil) - if len(rows) != 4 { - t.Fatal("str: len(rows) != 4") - } - i := res.Map("i") - n := res.Map("n") - for k, row := range rows { - switch { - case row[i] == nil || row.Int(i) != k: - case k%2 == 1 && row[n] != nil: - case k%2 == 0 && (row[n] == nil || row.Int(n) != 1): - default: - continue - } - t.Fatalf("str row: %d = (%s, %s)", k, row[i], row[n]) - } - - sel, err := my.Prepare("select * from n") - checkErr(t, err, nil) - rows, res, err = sel.Exec() - checkErr(t, err, nil) - if len(rows) != 4 { - t.Fatal("bin: len(rows) != 4") - } - i = res.Map("i") - n = res.Map("n") - for k, row := range rows { - switch { - case row[i] == nil || row.Int(i) != k: - case k%2 == 1 && row[n] != nil: - case k%2 == 0 && (row[n] == nil || row.Int(n) != 1): - default: - continue - } - t.Fatalf("bin row: %d = (%v, %v)", k, row[i], row[n]) - } - - checkResult(t, query("drop table n"), cmdOK(0, false, true)) -} - -func TestMultipleResults(t *testing.T) { - myConnect(t, true, 0) - query("drop table m") // Drop test table if exists - checkResult(t, - query("create table m (id int primary key, str varchar(20))"), - cmdOK(0, false, true), - ) - - str := []string{"zero", "jeden", "dwa"} - - checkResult(t, query("insert m values (0, '%s')", str[0]), - cmdOK(1, false, true)) - checkResult(t, query("insert m values (1, '%s')", str[1]), - cmdOK(1, false, true)) - checkResult(t, query("insert m values (2, '%s')", str[2]), - cmdOK(1, false, true)) - - res, err := my.Start("select id from m; select str from m") - checkErr(t, err, nil) - - for ii := 0; ; ii++ { - row, err := res.GetRow() - checkErr(t, err, nil) - if row == nil { - break - } - if row.Int(0) != ii { - t.Fatal("Bad result") - } - } - res, err = res.NextResult() - checkErr(t, err, nil) - for ii := 0; ; ii++ { - row, err := res.GetRow() - checkErr(t, err, nil) - if row == nil { - break - } - if row.Str(0) != str[ii] { - t.Fatal("Bad result") - } - } - - checkResult(t, query("drop table m"), cmdOK(0, false, true)) - myClose(t) -} - -func TestDecimal(t *testing.T) { - myConnect(t, true, 0) - - query("drop table if exists d") - checkResult(t, - query("create table d (d decimal(4,2))"), - cmdOK(0, false, true), - ) - - checkResult(t, query("insert d values (10.01)"), cmdOK(1, false, true)) - sql := "select * from d" - sel, err := my.Prepare(sql) - checkErr(t, err, nil) - rows, res, err := sel.Exec() - checkErr(t, err, nil) - if len(rows) != 1 || rows[0][res.Map("d")].(float64) != 10.01 { - t.Fatal(sql) - } - - checkResult(t, query("drop table d"), cmdOK(0, false, true)) - myClose(t) -} - -func TestMediumInt(t *testing.T) { - myConnect(t, true, 0) - query("DROP TABLE mi") - checkResult(t, - query( - `CREATE TABLE mi ( - id INT PRIMARY KEY AUTO_INCREMENT, - m MEDIUMINT - )`, - ), - cmdOK(0, false, true), - ) - - const n = 9 - - for i := 0; i < n; i++ { - res, err := my.Start("INSERT mi VALUES (0, %d)", i) - checkErr(t, err, nil) - if res.InsertId() != uint64(i+1) { - t.Fatalf("Wrong insert id: %d, expected: %d", res.InsertId(), i+1) - } - } - - sel, err := my.Prepare("SELECT * FROM mi") - checkErr(t, err, nil) - - res, err := sel.Run() - checkErr(t, err, nil) - - i := 0 - for { - row, err := res.GetRow() - checkErr(t, err, nil) - if row == nil { - break - } - id, m := row.Int(0), row.Int(1) - if id != i+1 || m != i { - t.Fatalf("i=%d id=%d m=%d", i, id, m) - } - i++ - } - if i != n { - t.Fatalf("%d rows read, %d expected", i, n) - } - checkResult(t, query("drop table mi"), cmdOK(0, false, true)) -} - -func TestStoredProcedures(t *testing.T) { - myConnect(t, true, 0) - query("DROP PROCEDURE pr") - query("DROP TABLE p") - checkResult(t, - query( - `CREATE TABLE p ( - id INT PRIMARY KEY AUTO_INCREMENT, - txt VARCHAR(8) - )`, - ), - cmdOK(0, false, true), - ) - _, err := my.Start( - `CREATE PROCEDURE pr (IN i INT) - BEGIN - INSERT p VALUES (0, "aaa"); - SELECT * FROM p; - SELECT i * id FROM p; - END`, - ) - checkErr(t, err, nil) - - res, err := my.Start("CALL pr(3)") - checkErr(t, err, nil) - - rows, err := res.GetRows() - checkErr(t, err, nil) - if len(rows) != 1 || len(rows[0]) != 2 || rows[0].Int(0) != 1 || rows[0].Str(1) != "aaa" { - t.Fatalf("Bad result set: %+v", rows) - } - - res, err = res.NextResult() - checkErr(t, err, nil) - - rows, err = res.GetRows() - checkErr(t, err, nil) - if len(rows) != 1 || len(rows[0]) != 1 || rows[0].Int(0) != 3 { - t.Fatalf("Bad result set: %+v", rows) - } - - res, err = res.NextResult() - checkErr(t, err, nil) - if !res.StatusOnly() { - t.Fatalf("Result includes resultset at end of procedure: %+v", res) - } - - _, err = my.Start("DROP PROCEDURE pr") - checkErr(t, err, nil) - - checkResult(t, query("DROP TABLE p"), cmdOK(0, false, true)) -} - -// Benchamrks - -func check(err error) { - if err != nil { - fmt.Println(err) - os.Exit(1) - } -} - -func BenchmarkInsertSelect(b *testing.B) { - b.StopTimer() - - my := New(conn[0], conn[1], conn[2], user, passwd, dbname) - check(my.Connect()) - - my.Start("drop table b") // Drop test table if exists - - _, err := my.Start("create table b (s varchar(40), i int)") - check(err) - - for ii := 0; ii < 10000; ii++ { - _, err := my.Start("insert b values ('%d-%d-%d', %d)", ii, ii, ii, ii) - check(err) - } - - b.StartTimer() - - for ii := 0; ii < b.N; ii++ { - res, err := my.Start("select * from b") - check(err) - for { - row, err := res.GetRow() - check(err) - if row == nil { - break - } - } - } - - b.StopTimer() - - _, err = my.Start("drop table b") - check(err) - check(my.Close()) -} - -func BenchmarkPreparedInsertSelect(b *testing.B) { - b.StopTimer() - - my := New(conn[0], conn[1], conn[2], user, passwd, dbname) - check(my.Connect()) - - my.Start("drop table b") // Drop test table if exists - - _, err := my.Start("create table b (s varchar(40), i int)") - check(err) - - ins, err := my.Prepare("insert b values (?, ?)") - check(err) - - sel, err := my.Prepare("select * from b") - check(err) - - for ii := 0; ii < 10000; ii++ { - _, err := ins.Run(fmt.Sprintf("%d-%d-%d", ii, ii, ii), ii) - check(err) - } - - b.StartTimer() - - for ii := 0; ii < b.N; ii++ { - res, err := sel.Run() - check(err) - for { - row, err := res.GetRow() - check(err) - if row == nil { - break - } - } - } - - b.StopTimer() - - _, err = my.Start("drop table b") - check(err) - check(my.Close()) -} diff --git a/vendor/github.com/ziutek/mymysql/thrsafe/thrsafe_test.go b/vendor/github.com/ziutek/mymysql/thrsafe/thrsafe_test.go deleted file mode 100644 index 13bb04845e..0000000000 --- a/vendor/github.com/ziutek/mymysql/thrsafe/thrsafe_test.go +++ /dev/null @@ -1,136 +0,0 @@ -package thrsafe - -import ( - "github.com/ziutek/mymysql/mysql" - "github.com/ziutek/mymysql/native" - "testing" -) - -const ( - user = "testuser" - passwd = "TestPasswd9" - dbname = "test" - proto = "tcp" - daddr = "127.0.0.1:3306" - //proto = "unix" - //daddr = "/var/run/mysqld/mysqld.sock" - debug = false -) - -var db mysql.Conn - -func checkErr(t *testing.T, err error) { - if err != nil { - t.Fatalf("Error: %v", err) - } -} - -func connect(t *testing.T) mysql.Conn { - db := New(proto, "", daddr, user, passwd, dbname) - db.(*Conn).Conn.(*native.Conn).Debug = debug - checkErr(t, db.Connect()) - return db -} - -func TestS(t *testing.T) { - db := connect(t) - res, err := db.Start("SET @a=1") - checkErr(t, err) - if !res.StatusOnly() { - t.Fatalf("'SET @a' statement returns result with rows") - } - err = db.Close() - checkErr(t, err) -} - -func TestSS(t *testing.T) { - db := connect(t) - - res, err := db.Start("SET @a=1; SET @b=2") - checkErr(t, err) - if !res.StatusOnly() { - t.Fatalf("'SET @a' statement returns result with rows") - } - - res, err = res.NextResult() - checkErr(t, err) - if !res.StatusOnly() { - t.Fatalf("'SET @b' statement returns result with rows") - } - - err = db.Close() - checkErr(t, err) -} - -func TestSDS(t *testing.T) { - db := connect(t) - - res, err := db.Start("SET @a=1; SELECT @a; SET @b=2") - checkErr(t, err) - if !res.StatusOnly() { - t.Fatalf("'SET @a' statement returns result with rows") - } - - res, err = res.NextResult() - checkErr(t, err) - rows, err := res.GetRows() - checkErr(t, err) - if rows[0].Int(0) != 1 { - t.Fatalf("First query doesn't return '1'") - } - - res, err = res.NextResult() - checkErr(t, err) - if !res.StatusOnly() { - t.Fatalf("'SET @b' statement returns result with rows") - } - - err = db.Close() - checkErr(t, err) -} - -func TestSSDDD(t *testing.T) { - db := connect(t) - - res, err := db.Start("SET @a=1; SET @b=2; SELECT @a; SELECT @b; SELECT 3") - checkErr(t, err) - if !res.StatusOnly() { - t.Fatalf("'SET @a' statement returns result with rows") - } - - res, err = res.NextResult() - checkErr(t, err) - if !res.StatusOnly() { - t.Fatalf("'SET @b' statement returns result with rows") - } - - res, err = res.NextResult() - checkErr(t, err) - rows, err := res.GetRows() - checkErr(t, err) - if rows[0].Int(0) != 1 { - t.Fatalf("First query doesn't return '1'") - } - - res, err = res.NextResult() - checkErr(t, err) - rows, err = res.GetRows() - checkErr(t, err) - if rows[0].Int(0) != 2 { - t.Fatalf("Second query doesn't return '2'") - } - - res, err = res.NextResult() - checkErr(t, err) - rows, err = res.GetRows() - checkErr(t, err) - if rows[0].Int(0) != 3 { - t.Fatalf("Thrid query doesn't return '3'") - } - if res.MoreResults() { - t.Fatalf("There is unexpected one more result") - } - - err = db.Close() - checkErr(t, err) -} diff --git a/vendor/golang.org/x/crypto/LICENSE b/vendor/golang.org/x/crypto/LICENSE new file mode 100644 index 0000000000..6a66aea5ea --- /dev/null +++ b/vendor/golang.org/x/crypto/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/crypto/PATENTS b/vendor/golang.org/x/crypto/PATENTS new file mode 100644 index 0000000000..733099041f --- /dev/null +++ b/vendor/golang.org/x/crypto/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519_test.go b/vendor/golang.org/x/crypto/curve25519/curve25519_test.go deleted file mode 100644 index 14b0ee87cd..0000000000 --- a/vendor/golang.org/x/crypto/curve25519/curve25519_test.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package curve25519 - -import ( - "fmt" - "testing" -) - -const expectedHex = "89161fde887b2b53de549af483940106ecc114d6982daa98256de23bdf77661a" - -func TestBaseScalarMult(t *testing.T) { - var a, b [32]byte - in := &a - out := &b - a[0] = 1 - - for i := 0; i < 200; i++ { - ScalarBaseMult(out, in) - in, out = out, in - } - - result := fmt.Sprintf("%x", in[:]) - if result != expectedHex { - t.Errorf("incorrect result: got %s, want %s", result, expectedHex) - } -} diff --git a/vendor/golang.org/x/crypto/ssh/agent/client_test.go b/vendor/golang.org/x/crypto/ssh/agent/client_test.go deleted file mode 100644 index ec7198d549..0000000000 --- a/vendor/golang.org/x/crypto/ssh/agent/client_test.go +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package agent - -import ( - "bytes" - "crypto/rand" - "errors" - "net" - "os" - "os/exec" - "path/filepath" - "strconv" - "testing" - - "golang.org/x/crypto/ssh" -) - -// startAgent executes ssh-agent, and returns a Agent interface to it. -func startAgent(t *testing.T) (client Agent, socket string, cleanup func()) { - if testing.Short() { - // ssh-agent is not always available, and the key - // types supported vary by platform. - t.Skip("skipping test due to -short") - } - - bin, err := exec.LookPath("ssh-agent") - if err != nil { - t.Skip("could not find ssh-agent") - } - - cmd := exec.Command(bin, "-s") - out, err := cmd.Output() - if err != nil { - t.Fatalf("cmd.Output: %v", err) - } - - /* Output looks like: - - SSH_AUTH_SOCK=/tmp/ssh-P65gpcqArqvH/agent.15541; export SSH_AUTH_SOCK; - SSH_AGENT_PID=15542; export SSH_AGENT_PID; - echo Agent pid 15542; - */ - fields := bytes.Split(out, []byte(";")) - line := bytes.SplitN(fields[0], []byte("="), 2) - line[0] = bytes.TrimLeft(line[0], "\n") - if string(line[0]) != "SSH_AUTH_SOCK" { - t.Fatalf("could not find key SSH_AUTH_SOCK in %q", fields[0]) - } - socket = string(line[1]) - - line = bytes.SplitN(fields[2], []byte("="), 2) - line[0] = bytes.TrimLeft(line[0], "\n") - if string(line[0]) != "SSH_AGENT_PID" { - t.Fatalf("could not find key SSH_AGENT_PID in %q", fields[2]) - } - pidStr := line[1] - pid, err := strconv.Atoi(string(pidStr)) - if err != nil { - t.Fatalf("Atoi(%q): %v", pidStr, err) - } - - conn, err := net.Dial("unix", string(socket)) - if err != nil { - t.Fatalf("net.Dial: %v", err) - } - - ac := NewClient(conn) - return ac, socket, func() { - proc, _ := os.FindProcess(pid) - if proc != nil { - proc.Kill() - } - conn.Close() - os.RemoveAll(filepath.Dir(socket)) - } -} - -func testAgent(t *testing.T, key interface{}, cert *ssh.Certificate, lifetimeSecs uint32) { - agent, _, cleanup := startAgent(t) - defer cleanup() - - testAgentInterface(t, agent, key, cert, lifetimeSecs) -} - -func testAgentInterface(t *testing.T, agent Agent, key interface{}, cert *ssh.Certificate, lifetimeSecs uint32) { - signer, err := ssh.NewSignerFromKey(key) - if err != nil { - t.Fatalf("NewSignerFromKey(%T): %v", key, err) - } - // The agent should start up empty. - if keys, err := agent.List(); err != nil { - t.Fatalf("RequestIdentities: %v", err) - } else if len(keys) > 0 { - t.Fatalf("got %d keys, want 0: %v", len(keys), keys) - } - - // Attempt to insert the key, with certificate if specified. - var pubKey ssh.PublicKey - if cert != nil { - err = agent.Add(AddedKey{ - PrivateKey: key, - Certificate: cert, - Comment: "comment", - LifetimeSecs: lifetimeSecs, - }) - pubKey = cert - } else { - err = agent.Add(AddedKey{PrivateKey: key, Comment: "comment", LifetimeSecs: lifetimeSecs}) - pubKey = signer.PublicKey() - } - if err != nil { - t.Fatalf("insert(%T): %v", key, err) - } - - // Did the key get inserted successfully? - if keys, err := agent.List(); err != nil { - t.Fatalf("List: %v", err) - } else if len(keys) != 1 { - t.Fatalf("got %v, want 1 key", keys) - } else if keys[0].Comment != "comment" { - t.Fatalf("key comment: got %v, want %v", keys[0].Comment, "comment") - } else if !bytes.Equal(keys[0].Blob, pubKey.Marshal()) { - t.Fatalf("key mismatch") - } - - // Can the agent make a valid signature? - data := []byte("hello") - sig, err := agent.Sign(pubKey, data) - if err != nil { - t.Fatalf("Sign(%s): %v", pubKey.Type(), err) - } - - if err := pubKey.Verify(data, sig); err != nil { - t.Fatalf("Verify(%s): %v", pubKey.Type(), err) - } -} - -func TestAgent(t *testing.T) { - for _, keyType := range []string{"rsa", "dsa", "ecdsa"} { - testAgent(t, testPrivateKeys[keyType], nil, 0) - } -} - -func TestCert(t *testing.T) { - cert := &ssh.Certificate{ - Key: testPublicKeys["rsa"], - ValidBefore: ssh.CertTimeInfinity, - CertType: ssh.UserCert, - } - cert.SignCert(rand.Reader, testSigners["ecdsa"]) - - testAgent(t, testPrivateKeys["rsa"], cert, 0) -} - -func TestConstraints(t *testing.T) { - testAgent(t, testPrivateKeys["rsa"], nil, 3600 /* lifetime in seconds */) -} - -// netPipe is analogous to net.Pipe, but it uses a real net.Conn, and -// therefore is buffered (net.Pipe deadlocks if both sides start with -// a write.) -func netPipe() (net.Conn, net.Conn, error) { - listener, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - return nil, nil, err - } - defer listener.Close() - c1, err := net.Dial("tcp", listener.Addr().String()) - if err != nil { - return nil, nil, err - } - - c2, err := listener.Accept() - if err != nil { - c1.Close() - return nil, nil, err - } - - return c1, c2, nil -} - -func TestAuth(t *testing.T) { - a, b, err := netPipe() - if err != nil { - t.Fatalf("netPipe: %v", err) - } - - defer a.Close() - defer b.Close() - - agent, _, cleanup := startAgent(t) - defer cleanup() - - if err := agent.Add(AddedKey{PrivateKey: testPrivateKeys["rsa"], Comment: "comment"}); err != nil { - t.Errorf("Add: %v", err) - } - - serverConf := ssh.ServerConfig{} - serverConf.AddHostKey(testSigners["rsa"]) - serverConf.PublicKeyCallback = func(c ssh.ConnMetadata, key ssh.PublicKey) (*ssh.Permissions, error) { - if bytes.Equal(key.Marshal(), testPublicKeys["rsa"].Marshal()) { - return nil, nil - } - - return nil, errors.New("pubkey rejected") - } - - go func() { - conn, _, _, err := ssh.NewServerConn(a, &serverConf) - if err != nil { - t.Fatalf("Server: %v", err) - } - conn.Close() - }() - - conf := ssh.ClientConfig{} - conf.Auth = append(conf.Auth, ssh.PublicKeysCallback(agent.Signers)) - conn, _, _, err := ssh.NewClientConn(b, "", &conf) - if err != nil { - t.Fatalf("NewClientConn: %v", err) - } - conn.Close() -} - -func TestLockClient(t *testing.T) { - agent, _, cleanup := startAgent(t) - defer cleanup() - testLockAgent(agent, t) -} - -func testLockAgent(agent Agent, t *testing.T) { - if err := agent.Add(AddedKey{PrivateKey: testPrivateKeys["rsa"], Comment: "comment 1"}); err != nil { - t.Errorf("Add: %v", err) - } - if err := agent.Add(AddedKey{PrivateKey: testPrivateKeys["dsa"], Comment: "comment dsa"}); err != nil { - t.Errorf("Add: %v", err) - } - if keys, err := agent.List(); err != nil { - t.Errorf("List: %v", err) - } else if len(keys) != 2 { - t.Errorf("Want 2 keys, got %v", keys) - } - - passphrase := []byte("secret") - if err := agent.Lock(passphrase); err != nil { - t.Errorf("Lock: %v", err) - } - - if keys, err := agent.List(); err != nil { - t.Errorf("List: %v", err) - } else if len(keys) != 0 { - t.Errorf("Want 0 keys, got %v", keys) - } - - signer, _ := ssh.NewSignerFromKey(testPrivateKeys["rsa"]) - if _, err := agent.Sign(signer.PublicKey(), []byte("hello")); err == nil { - t.Fatalf("Sign did not fail") - } - - if err := agent.Remove(signer.PublicKey()); err == nil { - t.Fatalf("Remove did not fail") - } - - if err := agent.RemoveAll(); err == nil { - t.Fatalf("RemoveAll did not fail") - } - - if err := agent.Unlock(nil); err == nil { - t.Errorf("Unlock with wrong passphrase succeeded") - } - if err := agent.Unlock(passphrase); err != nil { - t.Errorf("Unlock: %v", err) - } - - if err := agent.Remove(signer.PublicKey()); err != nil { - t.Fatalf("Remove: %v", err) - } - - if keys, err := agent.List(); err != nil { - t.Errorf("List: %v", err) - } else if len(keys) != 1 { - t.Errorf("Want 1 keys, got %v", keys) - } -} diff --git a/vendor/golang.org/x/crypto/ssh/agent/keyring_test.go b/vendor/golang.org/x/crypto/ssh/agent/keyring_test.go deleted file mode 100644 index 7f05905712..0000000000 --- a/vendor/golang.org/x/crypto/ssh/agent/keyring_test.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package agent - -import ( - "testing" -) - -func addTestKey(t *testing.T, a Agent, keyName string) { - err := a.Add(AddedKey{ - PrivateKey: testPrivateKeys[keyName], - Comment: keyName, - }) - if err != nil { - t.Fatalf("failed to add key %q: %v", keyName, err) - } -} - -func removeTestKey(t *testing.T, a Agent, keyName string) { - err := a.Remove(testPublicKeys[keyName]) - if err != nil { - t.Fatalf("failed to remove key %q: %v", keyName, err) - } -} - -func validateListedKeys(t *testing.T, a Agent, expectedKeys []string) { - listedKeys, err := a.List() - if err != nil { - t.Fatalf("failed to list keys: %v", err) - return - } - actualKeys := make(map[string]bool) - for _, key := range listedKeys { - actualKeys[key.Comment] = true - } - - matchedKeys := make(map[string]bool) - for _, expectedKey := range expectedKeys { - if !actualKeys[expectedKey] { - t.Fatalf("expected key %q, but was not found", expectedKey) - } else { - matchedKeys[expectedKey] = true - } - } - - for actualKey := range actualKeys { - if !matchedKeys[actualKey] { - t.Fatalf("key %q was found, but was not expected", actualKey) - } - } -} - -func TestKeyringAddingAndRemoving(t *testing.T) { - keyNames := []string{"dsa", "ecdsa", "rsa", "user"} - - // add all test private keys - k := NewKeyring() - for _, keyName := range keyNames { - addTestKey(t, k, keyName) - } - validateListedKeys(t, k, keyNames) - - // remove a key in the middle - keyToRemove := keyNames[1] - keyNames = append(keyNames[:1], keyNames[2:]...) - - removeTestKey(t, k, keyToRemove) - validateListedKeys(t, k, keyNames) - - // remove all keys - err := k.RemoveAll() - if err != nil { - t.Fatalf("failed to remove all keys: %v", err) - } - validateListedKeys(t, k, []string{}) -} diff --git a/vendor/golang.org/x/crypto/ssh/agent/server_test.go b/vendor/golang.org/x/crypto/ssh/agent/server_test.go deleted file mode 100644 index ef0ab29348..0000000000 --- a/vendor/golang.org/x/crypto/ssh/agent/server_test.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package agent - -import ( - "testing" - - "golang.org/x/crypto/ssh" -) - -func TestServer(t *testing.T) { - c1, c2, err := netPipe() - if err != nil { - t.Fatalf("netPipe: %v", err) - } - defer c1.Close() - defer c2.Close() - client := NewClient(c1) - - go ServeAgent(NewKeyring(), c2) - - testAgentInterface(t, client, testPrivateKeys["rsa"], nil, 0) -} - -func TestLockServer(t *testing.T) { - testLockAgent(NewKeyring(), t) -} - -func TestSetupForwardAgent(t *testing.T) { - a, b, err := netPipe() - if err != nil { - t.Fatalf("netPipe: %v", err) - } - - defer a.Close() - defer b.Close() - - _, socket, cleanup := startAgent(t) - defer cleanup() - - serverConf := ssh.ServerConfig{ - NoClientAuth: true, - } - serverConf.AddHostKey(testSigners["rsa"]) - incoming := make(chan *ssh.ServerConn, 1) - go func() { - conn, _, _, err := ssh.NewServerConn(a, &serverConf) - if err != nil { - t.Fatalf("Server: %v", err) - } - incoming <- conn - }() - - conf := ssh.ClientConfig{} - conn, chans, reqs, err := ssh.NewClientConn(b, "", &conf) - if err != nil { - t.Fatalf("NewClientConn: %v", err) - } - client := ssh.NewClient(conn, chans, reqs) - - if err := ForwardToRemote(client, socket); err != nil { - t.Fatalf("SetupForwardAgent: %v", err) - } - - server := <-incoming - ch, reqs, err := server.OpenChannel(channelType, nil) - if err != nil { - t.Fatalf("OpenChannel(%q): %v", channelType, err) - } - go ssh.DiscardRequests(reqs) - - agentClient := NewClient(ch) - testAgentInterface(t, agentClient, testPrivateKeys["rsa"], nil, 0) - conn.Close() -} diff --git a/vendor/golang.org/x/crypto/ssh/agent/testdata_test.go b/vendor/golang.org/x/crypto/ssh/agent/testdata_test.go deleted file mode 100644 index b7a8781e1a..0000000000 --- a/vendor/golang.org/x/crypto/ssh/agent/testdata_test.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// IMPLEMENTOR NOTE: To avoid a package loop, this file is in three places: -// ssh/, ssh/agent, and ssh/test/. It should be kept in sync across all three -// instances. - -package agent - -import ( - "crypto/rand" - "fmt" - - "golang.org/x/crypto/ssh" - "golang.org/x/crypto/ssh/testdata" -) - -var ( - testPrivateKeys map[string]interface{} - testSigners map[string]ssh.Signer - testPublicKeys map[string]ssh.PublicKey -) - -func init() { - var err error - - n := len(testdata.PEMBytes) - testPrivateKeys = make(map[string]interface{}, n) - testSigners = make(map[string]ssh.Signer, n) - testPublicKeys = make(map[string]ssh.PublicKey, n) - for t, k := range testdata.PEMBytes { - testPrivateKeys[t], err = ssh.ParseRawPrivateKey(k) - if err != nil { - panic(fmt.Sprintf("Unable to parse test key %s: %v", t, err)) - } - testSigners[t], err = ssh.NewSignerFromKey(testPrivateKeys[t]) - if err != nil { - panic(fmt.Sprintf("Unable to create signer for test key %s: %v", t, err)) - } - testPublicKeys[t] = testSigners[t].PublicKey() - } - - // Create a cert and sign it for use in tests. - testCert := &ssh.Certificate{ - Nonce: []byte{}, // To pass reflect.DeepEqual after marshal & parse, this must be non-nil - ValidPrincipals: []string{"gopher1", "gopher2"}, // increases test coverage - ValidAfter: 0, // unix epoch - ValidBefore: ssh.CertTimeInfinity, // The end of currently representable time. - Reserved: []byte{}, // To pass reflect.DeepEqual after marshal & parse, this must be non-nil - Key: testPublicKeys["ecdsa"], - SignatureKey: testPublicKeys["rsa"], - Permissions: ssh.Permissions{ - CriticalOptions: map[string]string{}, - Extensions: map[string]string{}, - }, - } - testCert.SignCert(rand.Reader, testSigners["rsa"]) - testPrivateKeys["cert"] = testPrivateKeys["ecdsa"] - testSigners["cert"], err = ssh.NewCertSigner(testCert, testSigners["ecdsa"]) - if err != nil { - panic(fmt.Sprintf("Unable to create certificate signer: %v", err)) - } -} diff --git a/vendor/golang.org/x/crypto/ssh/benchmark_test.go b/vendor/golang.org/x/crypto/ssh/benchmark_test.go deleted file mode 100644 index d9f7eb9b60..0000000000 --- a/vendor/golang.org/x/crypto/ssh/benchmark_test.go +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssh - -import ( - "errors" - "io" - "net" - "testing" -) - -type server struct { - *ServerConn - chans <-chan NewChannel -} - -func newServer(c net.Conn, conf *ServerConfig) (*server, error) { - sconn, chans, reqs, err := NewServerConn(c, conf) - if err != nil { - return nil, err - } - go DiscardRequests(reqs) - return &server{sconn, chans}, nil -} - -func (s *server) Accept() (NewChannel, error) { - n, ok := <-s.chans - if !ok { - return nil, io.EOF - } - return n, nil -} - -func sshPipe() (Conn, *server, error) { - c1, c2, err := netPipe() - if err != nil { - return nil, nil, err - } - - clientConf := ClientConfig{ - User: "user", - } - serverConf := ServerConfig{ - NoClientAuth: true, - } - serverConf.AddHostKey(testSigners["ecdsa"]) - done := make(chan *server, 1) - go func() { - server, err := newServer(c2, &serverConf) - if err != nil { - done <- nil - } - done <- server - }() - - client, _, reqs, err := NewClientConn(c1, "", &clientConf) - if err != nil { - return nil, nil, err - } - - server := <-done - if server == nil { - return nil, nil, errors.New("server handshake failed.") - } - go DiscardRequests(reqs) - - return client, server, nil -} - -func BenchmarkEndToEnd(b *testing.B) { - b.StopTimer() - - client, server, err := sshPipe() - if err != nil { - b.Fatalf("sshPipe: %v", err) - } - - defer client.Close() - defer server.Close() - - size := (1 << 20) - input := make([]byte, size) - output := make([]byte, size) - b.SetBytes(int64(size)) - done := make(chan int, 1) - - go func() { - newCh, err := server.Accept() - if err != nil { - b.Fatalf("Client: %v", err) - } - ch, incoming, err := newCh.Accept() - go DiscardRequests(incoming) - for i := 0; i < b.N; i++ { - if _, err := io.ReadFull(ch, output); err != nil { - b.Fatalf("ReadFull: %v", err) - } - } - ch.Close() - done <- 1 - }() - - ch, in, err := client.OpenChannel("speed", nil) - if err != nil { - b.Fatalf("OpenChannel: %v", err) - } - go DiscardRequests(in) - - b.ResetTimer() - b.StartTimer() - for i := 0; i < b.N; i++ { - if _, err := ch.Write(input); err != nil { - b.Fatalf("WriteFull: %v", err) - } - } - ch.Close() - b.StopTimer() - - <-done -} diff --git a/vendor/golang.org/x/crypto/ssh/buffer_test.go b/vendor/golang.org/x/crypto/ssh/buffer_test.go deleted file mode 100644 index d5781cb3da..0000000000 --- a/vendor/golang.org/x/crypto/ssh/buffer_test.go +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssh - -import ( - "io" - "testing" -) - -var alphabet = []byte("abcdefghijklmnopqrstuvwxyz") - -func TestBufferReadwrite(t *testing.T) { - b := newBuffer() - b.write(alphabet[:10]) - r, _ := b.Read(make([]byte, 10)) - if r != 10 { - t.Fatalf("Expected written == read == 10, written: 10, read %d", r) - } - - b = newBuffer() - b.write(alphabet[:5]) - r, _ = b.Read(make([]byte, 10)) - if r != 5 { - t.Fatalf("Expected written == read == 5, written: 5, read %d", r) - } - - b = newBuffer() - b.write(alphabet[:10]) - r, _ = b.Read(make([]byte, 5)) - if r != 5 { - t.Fatalf("Expected written == 10, read == 5, written: 10, read %d", r) - } - - b = newBuffer() - b.write(alphabet[:5]) - b.write(alphabet[5:15]) - r, _ = b.Read(make([]byte, 10)) - r2, _ := b.Read(make([]byte, 10)) - if r != 10 || r2 != 5 || 15 != r+r2 { - t.Fatal("Expected written == read == 15") - } -} - -func TestBufferClose(t *testing.T) { - b := newBuffer() - b.write(alphabet[:10]) - b.eof() - _, err := b.Read(make([]byte, 5)) - if err != nil { - t.Fatal("expected read of 5 to not return EOF") - } - b = newBuffer() - b.write(alphabet[:10]) - b.eof() - r, err := b.Read(make([]byte, 5)) - r2, err2 := b.Read(make([]byte, 10)) - if r != 5 || r2 != 5 || err != nil || err2 != nil { - t.Fatal("expected reads of 5 and 5") - } - - b = newBuffer() - b.write(alphabet[:10]) - b.eof() - r, err = b.Read(make([]byte, 5)) - r2, err2 = b.Read(make([]byte, 10)) - r3, err3 := b.Read(make([]byte, 10)) - if r != 5 || r2 != 5 || r3 != 0 || err != nil || err2 != nil || err3 != io.EOF { - t.Fatal("expected reads of 5 and 5 and 0, with EOF") - } - - b = newBuffer() - b.write(make([]byte, 5)) - b.write(make([]byte, 10)) - b.eof() - r, err = b.Read(make([]byte, 9)) - r2, err2 = b.Read(make([]byte, 3)) - r3, err3 = b.Read(make([]byte, 3)) - r4, err4 := b.Read(make([]byte, 10)) - if err != nil || err2 != nil || err3 != nil || err4 != io.EOF { - t.Fatalf("Expected EOF on forth read only, err=%v, err2=%v, err3=%v, err4=%v", err, err2, err3, err4) - } - if r != 9 || r2 != 3 || r3 != 3 || r4 != 0 { - t.Fatal("Expected written == read == 15", r, r2, r3, r4) - } -} diff --git a/vendor/golang.org/x/crypto/ssh/certs_test.go b/vendor/golang.org/x/crypto/ssh/certs_test.go deleted file mode 100644 index c5f2e53304..0000000000 --- a/vendor/golang.org/x/crypto/ssh/certs_test.go +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssh - -import ( - "bytes" - "crypto/rand" - "reflect" - "testing" - "time" -) - -// Cert generated by ssh-keygen 6.0p1 Debian-4. -// % ssh-keygen -s ca-key -I test user-key -const exampleSSHCert = `ssh-rsa-cert-v01@openssh.com AAAAHHNzaC1yc2EtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgb1srW/W3ZDjYAO45xLYAwzHBDLsJ4Ux6ICFIkTjb1LEAAAADAQABAAAAYQCkoR51poH0wE8w72cqSB8Sszx+vAhzcMdCO0wqHTj7UNENHWEXGrU0E0UQekD7U+yhkhtoyjbPOVIP7hNa6aRk/ezdh/iUnCIt4Jt1v3Z1h1P+hA4QuYFMHNB+rmjPwAcAAAAAAAAAAAAAAAEAAAAEdGVzdAAAAAAAAAAAAAAAAP//////////AAAAAAAAAIIAAAAVcGVybWl0LVgxMS1mb3J3YXJkaW5nAAAAAAAAABdwZXJtaXQtYWdlbnQtZm9yd2FyZGluZwAAAAAAAAAWcGVybWl0LXBvcnQtZm9yd2FyZGluZwAAAAAAAAAKcGVybWl0LXB0eQAAAAAAAAAOcGVybWl0LXVzZXItcmMAAAAAAAAAAAAAAHcAAAAHc3NoLXJzYQAAAAMBAAEAAABhANFS2kaktpSGc+CcmEKPyw9mJC4nZKxHKTgLVZeaGbFZOvJTNzBspQHdy7Q1uKSfktxpgjZnksiu/tFF9ngyY2KFoc+U88ya95IZUycBGCUbBQ8+bhDtw/icdDGQD5WnUwAAAG8AAAAHc3NoLXJzYQAAAGC8Y9Z2LQKhIhxf52773XaWrXdxP0t3GBVo4A10vUWiYoAGepr6rQIoGGXFxT4B9Gp+nEBJjOwKDXPrAevow0T9ca8gZN+0ykbhSrXLE5Ao48rqr3zP4O1/9P7e6gp0gw8=` - -func TestParseCert(t *testing.T) { - authKeyBytes := []byte(exampleSSHCert) - - key, _, _, rest, err := ParseAuthorizedKey(authKeyBytes) - if err != nil { - t.Fatalf("ParseAuthorizedKey: %v", err) - } - if len(rest) > 0 { - t.Errorf("rest: got %q, want empty", rest) - } - - if _, ok := key.(*Certificate); !ok { - t.Fatalf("got %v (%T), want *Certificate", key, key) - } - - marshaled := MarshalAuthorizedKey(key) - // Before comparison, remove the trailing newline that - // MarshalAuthorizedKey adds. - marshaled = marshaled[:len(marshaled)-1] - if !bytes.Equal(authKeyBytes, marshaled) { - t.Errorf("marshaled certificate does not match original: got %q, want %q", marshaled, authKeyBytes) - } -} - -// Cert generated by ssh-keygen OpenSSH_6.8p1 OS X 10.10.3 -// % ssh-keygen -s ca -I testcert -O source-address=192.168.1.0/24 -O force-command=/bin/sleep user.pub -// user.pub key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDACh1rt2DXfV3hk6fszSQcQ/rueMId0kVD9U7nl8cfEnFxqOCrNT92g4laQIGl2mn8lsGZfTLg8ksHq3gkvgO3oo/0wHy4v32JeBOHTsN5AL4gfHNEhWeWb50ev47hnTsRIt9P4dxogeUo/hTu7j9+s9lLpEQXCvq6xocXQt0j8MV9qZBBXFLXVT3cWIkSqOdwt/5ZBg+1GSrc7WfCXVWgTk4a20uPMuJPxU4RQwZW6X3+O8Pqo8C3cW0OzZRFP6gUYUKUsTI5WntlS+LAxgw1mZNsozFGdbiOPRnEryE3SRldh9vjDR3tin1fGpA5P7+CEB/bqaXtG3V+F2OkqaMN -// Critical Options: -// force-command /bin/sleep -// source-address 192.168.1.0/24 -// Extensions: -// permit-X11-forwarding -// permit-agent-forwarding -// permit-port-forwarding -// permit-pty -// permit-user-rc -const exampleSSHCertWithOptions = `ssh-rsa-cert-v01@openssh.com AAAAHHNzaC1yc2EtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgDyysCJY0XrO1n03EeRRoITnTPdjENFmWDs9X58PP3VUAAAADAQABAAABAQDACh1rt2DXfV3hk6fszSQcQ/rueMId0kVD9U7nl8cfEnFxqOCrNT92g4laQIGl2mn8lsGZfTLg8ksHq3gkvgO3oo/0wHy4v32JeBOHTsN5AL4gfHNEhWeWb50ev47hnTsRIt9P4dxogeUo/hTu7j9+s9lLpEQXCvq6xocXQt0j8MV9qZBBXFLXVT3cWIkSqOdwt/5ZBg+1GSrc7WfCXVWgTk4a20uPMuJPxU4RQwZW6X3+O8Pqo8C3cW0OzZRFP6gUYUKUsTI5WntlS+LAxgw1mZNsozFGdbiOPRnEryE3SRldh9vjDR3tin1fGpA5P7+CEB/bqaXtG3V+F2OkqaMNAAAAAAAAAAAAAAABAAAACHRlc3RjZXJ0AAAAAAAAAAAAAAAA//////////8AAABLAAAADWZvcmNlLWNvbW1hbmQAAAAOAAAACi9iaW4vc2xlZXAAAAAOc291cmNlLWFkZHJlc3MAAAASAAAADjE5Mi4xNjguMS4wLzI0AAAAggAAABVwZXJtaXQtWDExLWZvcndhcmRpbmcAAAAAAAAAF3Blcm1pdC1hZ2VudC1mb3J3YXJkaW5nAAAAAAAAABZwZXJtaXQtcG9ydC1mb3J3YXJkaW5nAAAAAAAAAApwZXJtaXQtcHR5AAAAAAAAAA5wZXJtaXQtdXNlci1yYwAAAAAAAAAAAAABFwAAAAdzc2gtcnNhAAAAAwEAAQAAAQEAwU+c5ui5A8+J/CFpjW8wCa52bEODA808WWQDCSuTG/eMXNf59v9Y8Pk0F1E9dGCosSNyVcB/hacUrc6He+i97+HJCyKavBsE6GDxrjRyxYqAlfcOXi/IVmaUGiO8OQ39d4GHrjToInKvExSUeleQyH4Y4/e27T/pILAqPFL3fyrvMLT5qU9QyIt6zIpa7GBP5+urouNavMprV3zsfIqNBbWypinOQAw823a5wN+zwXnhZrgQiHZ/USG09Y6k98y1dTVz8YHlQVR4D3lpTAsKDKJ5hCH9WU4fdf+lU8OyNGaJ/vz0XNqxcToe1l4numLTnaoSuH89pHryjqurB7lJKwAAAQ8AAAAHc3NoLXJzYQAAAQCaHvUIoPL1zWUHIXLvu96/HU1s/i4CAW2IIEuGgxCUCiFj6vyTyYtgxQxcmbfZf6eaITlS6XJZa7Qq4iaFZh75C1DXTX8labXhRSD4E2t//AIP9MC1rtQC5xo6FmbQ+BoKcDskr+mNACcbRSxs3IL3bwCfWDnIw2WbVox9ZdcthJKk4UoCW4ix4QwdHw7zlddlz++fGEEVhmTbll1SUkycGApPFBsAYRTMupUJcYPIeReBI/m8XfkoMk99bV8ZJQTAd7OekHY2/48Ff53jLmyDjP7kNw1F8OaPtkFs6dGJXta4krmaekPy87j+35In5hFj7yoOqvSbmYUkeX70/GGQ` - -func TestParseCertWithOptions(t *testing.T) { - opts := map[string]string{ - "source-address": "192.168.1.0/24", - "force-command": "/bin/sleep", - } - exts := map[string]string{ - "permit-X11-forwarding": "", - "permit-agent-forwarding": "", - "permit-port-forwarding": "", - "permit-pty": "", - "permit-user-rc": "", - } - authKeyBytes := []byte(exampleSSHCertWithOptions) - - key, _, _, rest, err := ParseAuthorizedKey(authKeyBytes) - if err != nil { - t.Fatalf("ParseAuthorizedKey: %v", err) - } - if len(rest) > 0 { - t.Errorf("rest: got %q, want empty", rest) - } - cert, ok := key.(*Certificate) - if !ok { - t.Fatalf("got %v (%T), want *Certificate", key, key) - } - if !reflect.DeepEqual(cert.CriticalOptions, opts) { - t.Errorf("unexpected critical options - got %v, want %v", cert.CriticalOptions, opts) - } - if !reflect.DeepEqual(cert.Extensions, exts) { - t.Errorf("unexpected Extensions - got %v, want %v", cert.Extensions, exts) - } - marshaled := MarshalAuthorizedKey(key) - // Before comparison, remove the trailing newline that - // MarshalAuthorizedKey adds. - marshaled = marshaled[:len(marshaled)-1] - if !bytes.Equal(authKeyBytes, marshaled) { - t.Errorf("marshaled certificate does not match original: got %q, want %q", marshaled, authKeyBytes) - } -} - -func TestValidateCert(t *testing.T) { - key, _, _, _, err := ParseAuthorizedKey([]byte(exampleSSHCert)) - if err != nil { - t.Fatalf("ParseAuthorizedKey: %v", err) - } - validCert, ok := key.(*Certificate) - if !ok { - t.Fatalf("got %v (%T), want *Certificate", key, key) - } - checker := CertChecker{} - checker.IsAuthority = func(k PublicKey) bool { - return bytes.Equal(k.Marshal(), validCert.SignatureKey.Marshal()) - } - - if err := checker.CheckCert("user", validCert); err != nil { - t.Errorf("Unable to validate certificate: %v", err) - } - invalidCert := &Certificate{ - Key: testPublicKeys["rsa"], - SignatureKey: testPublicKeys["ecdsa"], - ValidBefore: CertTimeInfinity, - Signature: &Signature{}, - } - if err := checker.CheckCert("user", invalidCert); err == nil { - t.Error("Invalid cert signature passed validation") - } -} - -func TestValidateCertTime(t *testing.T) { - cert := Certificate{ - ValidPrincipals: []string{"user"}, - Key: testPublicKeys["rsa"], - ValidAfter: 50, - ValidBefore: 100, - } - - cert.SignCert(rand.Reader, testSigners["ecdsa"]) - - for ts, ok := range map[int64]bool{ - 25: false, - 50: true, - 99: true, - 100: false, - 125: false, - } { - checker := CertChecker{ - Clock: func() time.Time { return time.Unix(ts, 0) }, - } - checker.IsAuthority = func(k PublicKey) bool { - return bytes.Equal(k.Marshal(), - testPublicKeys["ecdsa"].Marshal()) - } - - if v := checker.CheckCert("user", &cert); (v == nil) != ok { - t.Errorf("Authenticate(%d): %v", ts, v) - } - } -} - -// TODO(hanwen): tests for -// -// host keys: -// * fallbacks - -func TestHostKeyCert(t *testing.T) { - cert := &Certificate{ - ValidPrincipals: []string{"hostname", "hostname.domain"}, - Key: testPublicKeys["rsa"], - ValidBefore: CertTimeInfinity, - CertType: HostCert, - } - cert.SignCert(rand.Reader, testSigners["ecdsa"]) - - checker := &CertChecker{ - IsAuthority: func(p PublicKey) bool { - return bytes.Equal(testPublicKeys["ecdsa"].Marshal(), p.Marshal()) - }, - } - - certSigner, err := NewCertSigner(cert, testSigners["rsa"]) - if err != nil { - t.Errorf("NewCertSigner: %v", err) - } - - for _, name := range []string{"hostname", "otherhost"} { - c1, c2, err := netPipe() - if err != nil { - t.Fatalf("netPipe: %v", err) - } - defer c1.Close() - defer c2.Close() - - errc := make(chan error) - - go func() { - conf := ServerConfig{ - NoClientAuth: true, - } - conf.AddHostKey(certSigner) - _, _, _, err := NewServerConn(c1, &conf) - errc <- err - }() - - config := &ClientConfig{ - User: "user", - HostKeyCallback: checker.CheckHostKey, - } - _, _, _, err = NewClientConn(c2, name, config) - - succeed := name == "hostname" - if (err == nil) != succeed { - t.Fatalf("NewClientConn(%q): %v", name, err) - } - - err = <-errc - if (err == nil) != succeed { - t.Fatalf("NewServerConn(%q): %v", name, err) - } - } -} diff --git a/vendor/golang.org/x/crypto/ssh/cipher_test.go b/vendor/golang.org/x/crypto/ssh/cipher_test.go deleted file mode 100644 index 54b92b6edc..0000000000 --- a/vendor/golang.org/x/crypto/ssh/cipher_test.go +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssh - -import ( - "bytes" - "crypto" - "crypto/aes" - "crypto/rand" - "testing" -) - -func TestDefaultCiphersExist(t *testing.T) { - for _, cipherAlgo := range supportedCiphers { - if _, ok := cipherModes[cipherAlgo]; !ok { - t.Errorf("default cipher %q is unknown", cipherAlgo) - } - } -} - -func TestPacketCiphers(t *testing.T) { - // Still test aes128cbc cipher althought it's commented out. - cipherModes[aes128cbcID] = &streamCipherMode{16, aes.BlockSize, 0, nil} - defer delete(cipherModes, aes128cbcID) - - for cipher := range cipherModes { - kr := &kexResult{Hash: crypto.SHA1} - algs := directionAlgorithms{ - Cipher: cipher, - MAC: "hmac-sha1", - Compression: "none", - } - client, err := newPacketCipher(clientKeys, algs, kr) - if err != nil { - t.Errorf("newPacketCipher(client, %q): %v", cipher, err) - continue - } - server, err := newPacketCipher(clientKeys, algs, kr) - if err != nil { - t.Errorf("newPacketCipher(client, %q): %v", cipher, err) - continue - } - - want := "bla bla" - input := []byte(want) - buf := &bytes.Buffer{} - if err := client.writePacket(0, buf, rand.Reader, input); err != nil { - t.Errorf("writePacket(%q): %v", cipher, err) - continue - } - - packet, err := server.readPacket(0, buf) - if err != nil { - t.Errorf("readPacket(%q): %v", cipher, err) - continue - } - - if string(packet) != want { - t.Errorf("roundtrip(%q): got %q, want %q", cipher, packet, want) - } - } -} - -func TestCBCOracleCounterMeasure(t *testing.T) { - cipherModes[aes128cbcID] = &streamCipherMode{16, aes.BlockSize, 0, nil} - defer delete(cipherModes, aes128cbcID) - - kr := &kexResult{Hash: crypto.SHA1} - algs := directionAlgorithms{ - Cipher: aes128cbcID, - MAC: "hmac-sha1", - Compression: "none", - } - client, err := newPacketCipher(clientKeys, algs, kr) - if err != nil { - t.Fatalf("newPacketCipher(client): %v", err) - } - - want := "bla bla" - input := []byte(want) - buf := &bytes.Buffer{} - if err := client.writePacket(0, buf, rand.Reader, input); err != nil { - t.Errorf("writePacket: %v", err) - } - - packetSize := buf.Len() - buf.Write(make([]byte, 2*maxPacket)) - - // We corrupt each byte, but this usually will only test the - // 'packet too large' or 'MAC failure' cases. - lastRead := -1 - for i := 0; i < packetSize; i++ { - server, err := newPacketCipher(clientKeys, algs, kr) - if err != nil { - t.Fatalf("newPacketCipher(client): %v", err) - } - - fresh := &bytes.Buffer{} - fresh.Write(buf.Bytes()) - fresh.Bytes()[i] ^= 0x01 - - before := fresh.Len() - _, err = server.readPacket(0, fresh) - if err == nil { - t.Errorf("corrupt byte %d: readPacket succeeded ", i) - continue - } - if _, ok := err.(cbcError); !ok { - t.Errorf("corrupt byte %d: got %v (%T), want cbcError", i, err, err) - continue - } - - after := fresh.Len() - bytesRead := before - after - if bytesRead < maxPacket { - t.Errorf("corrupt byte %d: read %d bytes, want more than %d", i, bytesRead, maxPacket) - continue - } - - if i > 0 && bytesRead != lastRead { - t.Errorf("corrupt byte %d: read %d bytes, want %d bytes read", i, bytesRead, lastRead) - } - lastRead = bytesRead - } -} diff --git a/vendor/golang.org/x/crypto/ssh/client_auth_test.go b/vendor/golang.org/x/crypto/ssh/client_auth_test.go deleted file mode 100644 index 2ea44624fc..0000000000 --- a/vendor/golang.org/x/crypto/ssh/client_auth_test.go +++ /dev/null @@ -1,393 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssh - -import ( - "bytes" - "crypto/rand" - "errors" - "fmt" - "strings" - "testing" -) - -type keyboardInteractive map[string]string - -func (cr keyboardInteractive) Challenge(user string, instruction string, questions []string, echos []bool) ([]string, error) { - var answers []string - for _, q := range questions { - answers = append(answers, cr[q]) - } - return answers, nil -} - -// reused internally by tests -var clientPassword = "tiger" - -// tryAuth runs a handshake with a given config against an SSH server -// with config serverConfig -func tryAuth(t *testing.T, config *ClientConfig) error { - c1, c2, err := netPipe() - if err != nil { - t.Fatalf("netPipe: %v", err) - } - defer c1.Close() - defer c2.Close() - - certChecker := CertChecker{ - IsAuthority: func(k PublicKey) bool { - return bytes.Equal(k.Marshal(), testPublicKeys["ecdsa"].Marshal()) - }, - UserKeyFallback: func(conn ConnMetadata, key PublicKey) (*Permissions, error) { - if conn.User() == "testuser" && bytes.Equal(key.Marshal(), testPublicKeys["rsa"].Marshal()) { - return nil, nil - } - - return nil, fmt.Errorf("pubkey for %q not acceptable", conn.User()) - }, - IsRevoked: func(c *Certificate) bool { - return c.Serial == 666 - }, - } - - serverConfig := &ServerConfig{ - PasswordCallback: func(conn ConnMetadata, pass []byte) (*Permissions, error) { - if conn.User() == "testuser" && string(pass) == clientPassword { - return nil, nil - } - return nil, errors.New("password auth failed") - }, - PublicKeyCallback: certChecker.Authenticate, - KeyboardInteractiveCallback: func(conn ConnMetadata, challenge KeyboardInteractiveChallenge) (*Permissions, error) { - ans, err := challenge("user", - "instruction", - []string{"question1", "question2"}, - []bool{true, true}) - if err != nil { - return nil, err - } - ok := conn.User() == "testuser" && ans[0] == "answer1" && ans[1] == "answer2" - if ok { - challenge("user", "motd", nil, nil) - return nil, nil - } - return nil, errors.New("keyboard-interactive failed") - }, - AuthLogCallback: func(conn ConnMetadata, method string, err error) { - t.Logf("user %q, method %q: %v", conn.User(), method, err) - }, - } - serverConfig.AddHostKey(testSigners["rsa"]) - - go newServer(c1, serverConfig) - _, _, _, err = NewClientConn(c2, "", config) - return err -} - -func TestClientAuthPublicKey(t *testing.T) { - config := &ClientConfig{ - User: "testuser", - Auth: []AuthMethod{ - PublicKeys(testSigners["rsa"]), - }, - } - if err := tryAuth(t, config); err != nil { - t.Fatalf("unable to dial remote side: %s", err) - } -} - -func TestAuthMethodPassword(t *testing.T) { - config := &ClientConfig{ - User: "testuser", - Auth: []AuthMethod{ - Password(clientPassword), - }, - } - - if err := tryAuth(t, config); err != nil { - t.Fatalf("unable to dial remote side: %s", err) - } -} - -func TestAuthMethodFallback(t *testing.T) { - var passwordCalled bool - config := &ClientConfig{ - User: "testuser", - Auth: []AuthMethod{ - PublicKeys(testSigners["rsa"]), - PasswordCallback( - func() (string, error) { - passwordCalled = true - return "WRONG", nil - }), - }, - } - - if err := tryAuth(t, config); err != nil { - t.Fatalf("unable to dial remote side: %s", err) - } - - if passwordCalled { - t.Errorf("password auth tried before public-key auth.") - } -} - -func TestAuthMethodWrongPassword(t *testing.T) { - config := &ClientConfig{ - User: "testuser", - Auth: []AuthMethod{ - Password("wrong"), - PublicKeys(testSigners["rsa"]), - }, - } - - if err := tryAuth(t, config); err != nil { - t.Fatalf("unable to dial remote side: %s", err) - } -} - -func TestAuthMethodKeyboardInteractive(t *testing.T) { - answers := keyboardInteractive(map[string]string{ - "question1": "answer1", - "question2": "answer2", - }) - config := &ClientConfig{ - User: "testuser", - Auth: []AuthMethod{ - KeyboardInteractive(answers.Challenge), - }, - } - - if err := tryAuth(t, config); err != nil { - t.Fatalf("unable to dial remote side: %s", err) - } -} - -func TestAuthMethodWrongKeyboardInteractive(t *testing.T) { - answers := keyboardInteractive(map[string]string{ - "question1": "answer1", - "question2": "WRONG", - }) - config := &ClientConfig{ - User: "testuser", - Auth: []AuthMethod{ - KeyboardInteractive(answers.Challenge), - }, - } - - if err := tryAuth(t, config); err == nil { - t.Fatalf("wrong answers should not have authenticated with KeyboardInteractive") - } -} - -// the mock server will only authenticate ssh-rsa keys -func TestAuthMethodInvalidPublicKey(t *testing.T) { - config := &ClientConfig{ - User: "testuser", - Auth: []AuthMethod{ - PublicKeys(testSigners["dsa"]), - }, - } - - if err := tryAuth(t, config); err == nil { - t.Fatalf("dsa private key should not have authenticated with rsa public key") - } -} - -// the client should authenticate with the second key -func TestAuthMethodRSAandDSA(t *testing.T) { - config := &ClientConfig{ - User: "testuser", - Auth: []AuthMethod{ - PublicKeys(testSigners["dsa"], testSigners["rsa"]), - }, - } - if err := tryAuth(t, config); err != nil { - t.Fatalf("client could not authenticate with rsa key: %v", err) - } -} - -func TestClientHMAC(t *testing.T) { - for _, mac := range supportedMACs { - config := &ClientConfig{ - User: "testuser", - Auth: []AuthMethod{ - PublicKeys(testSigners["rsa"]), - }, - Config: Config{ - MACs: []string{mac}, - }, - } - if err := tryAuth(t, config); err != nil { - t.Fatalf("client could not authenticate with mac algo %s: %v", mac, err) - } - } -} - -// issue 4285. -func TestClientUnsupportedCipher(t *testing.T) { - config := &ClientConfig{ - User: "testuser", - Auth: []AuthMethod{ - PublicKeys(), - }, - Config: Config{ - Ciphers: []string{"aes128-cbc"}, // not currently supported - }, - } - if err := tryAuth(t, config); err == nil { - t.Errorf("expected no ciphers in common") - } -} - -func TestClientUnsupportedKex(t *testing.T) { - config := &ClientConfig{ - User: "testuser", - Auth: []AuthMethod{ - PublicKeys(), - }, - Config: Config{ - KeyExchanges: []string{"diffie-hellman-group-exchange-sha256"}, // not currently supported - }, - } - if err := tryAuth(t, config); err == nil || !strings.Contains(err.Error(), "common algorithm") { - t.Errorf("got %v, expected 'common algorithm'", err) - } -} - -func TestClientLoginCert(t *testing.T) { - cert := &Certificate{ - Key: testPublicKeys["rsa"], - ValidBefore: CertTimeInfinity, - CertType: UserCert, - } - cert.SignCert(rand.Reader, testSigners["ecdsa"]) - certSigner, err := NewCertSigner(cert, testSigners["rsa"]) - if err != nil { - t.Fatalf("NewCertSigner: %v", err) - } - - clientConfig := &ClientConfig{ - User: "user", - } - clientConfig.Auth = append(clientConfig.Auth, PublicKeys(certSigner)) - - t.Log("should succeed") - if err := tryAuth(t, clientConfig); err != nil { - t.Errorf("cert login failed: %v", err) - } - - t.Log("corrupted signature") - cert.Signature.Blob[0]++ - if err := tryAuth(t, clientConfig); err == nil { - t.Errorf("cert login passed with corrupted sig") - } - - t.Log("revoked") - cert.Serial = 666 - cert.SignCert(rand.Reader, testSigners["ecdsa"]) - if err := tryAuth(t, clientConfig); err == nil { - t.Errorf("revoked cert login succeeded") - } - cert.Serial = 1 - - t.Log("sign with wrong key") - cert.SignCert(rand.Reader, testSigners["dsa"]) - if err := tryAuth(t, clientConfig); err == nil { - t.Errorf("cert login passed with non-authoritive key") - } - - t.Log("host cert") - cert.CertType = HostCert - cert.SignCert(rand.Reader, testSigners["ecdsa"]) - if err := tryAuth(t, clientConfig); err == nil { - t.Errorf("cert login passed with wrong type") - } - cert.CertType = UserCert - - t.Log("principal specified") - cert.ValidPrincipals = []string{"user"} - cert.SignCert(rand.Reader, testSigners["ecdsa"]) - if err := tryAuth(t, clientConfig); err != nil { - t.Errorf("cert login failed: %v", err) - } - - t.Log("wrong principal specified") - cert.ValidPrincipals = []string{"fred"} - cert.SignCert(rand.Reader, testSigners["ecdsa"]) - if err := tryAuth(t, clientConfig); err == nil { - t.Errorf("cert login passed with wrong principal") - } - cert.ValidPrincipals = nil - - t.Log("added critical option") - cert.CriticalOptions = map[string]string{"root-access": "yes"} - cert.SignCert(rand.Reader, testSigners["ecdsa"]) - if err := tryAuth(t, clientConfig); err == nil { - t.Errorf("cert login passed with unrecognized critical option") - } - - t.Log("allowed source address") - cert.CriticalOptions = map[string]string{"source-address": "127.0.0.42/24"} - cert.SignCert(rand.Reader, testSigners["ecdsa"]) - if err := tryAuth(t, clientConfig); err != nil { - t.Errorf("cert login with source-address failed: %v", err) - } - - t.Log("disallowed source address") - cert.CriticalOptions = map[string]string{"source-address": "127.0.0.42"} - cert.SignCert(rand.Reader, testSigners["ecdsa"]) - if err := tryAuth(t, clientConfig); err == nil { - t.Errorf("cert login with source-address succeeded") - } -} - -func testPermissionsPassing(withPermissions bool, t *testing.T) { - serverConfig := &ServerConfig{ - PublicKeyCallback: func(conn ConnMetadata, key PublicKey) (*Permissions, error) { - if conn.User() == "nopermissions" { - return nil, nil - } else { - return &Permissions{}, nil - } - }, - } - serverConfig.AddHostKey(testSigners["rsa"]) - - clientConfig := &ClientConfig{ - Auth: []AuthMethod{ - PublicKeys(testSigners["rsa"]), - }, - } - if withPermissions { - clientConfig.User = "permissions" - } else { - clientConfig.User = "nopermissions" - } - - c1, c2, err := netPipe() - if err != nil { - t.Fatalf("netPipe: %v", err) - } - defer c1.Close() - defer c2.Close() - - go NewClientConn(c2, "", clientConfig) - serverConn, err := newServer(c1, serverConfig) - if err != nil { - t.Fatal(err) - } - if p := serverConn.Permissions; (p != nil) != withPermissions { - t.Fatalf("withPermissions is %t, but Permissions object is %#v", withPermissions, p) - } -} - -func TestPermissionsPassing(t *testing.T) { - testPermissionsPassing(true, t) -} - -func TestNoPermissionsPassing(t *testing.T) { - testPermissionsPassing(false, t) -} diff --git a/vendor/golang.org/x/crypto/ssh/client_test.go b/vendor/golang.org/x/crypto/ssh/client_test.go deleted file mode 100644 index 1fe790cb49..0000000000 --- a/vendor/golang.org/x/crypto/ssh/client_test.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssh - -import ( - "net" - "testing" -) - -func testClientVersion(t *testing.T, config *ClientConfig, expected string) { - clientConn, serverConn := net.Pipe() - defer clientConn.Close() - receivedVersion := make(chan string, 1) - go func() { - version, err := readVersion(serverConn) - if err != nil { - receivedVersion <- "" - } else { - receivedVersion <- string(version) - } - serverConn.Close() - }() - NewClientConn(clientConn, "", config) - actual := <-receivedVersion - if actual != expected { - t.Fatalf("got %s; want %s", actual, expected) - } -} - -func TestCustomClientVersion(t *testing.T) { - version := "Test-Client-Version-0.0" - testClientVersion(t, &ClientConfig{ClientVersion: version}, version) -} - -func TestDefaultClientVersion(t *testing.T) { - testClientVersion(t, &ClientConfig{}, packageVersion) -} diff --git a/vendor/golang.org/x/crypto/ssh/example_test.go b/vendor/golang.org/x/crypto/ssh/example_test.go deleted file mode 100644 index dfd9dcab60..0000000000 --- a/vendor/golang.org/x/crypto/ssh/example_test.go +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssh_test - -import ( - "bytes" - "fmt" - "io/ioutil" - "log" - "net" - "net/http" - - "golang.org/x/crypto/ssh" - "golang.org/x/crypto/ssh/terminal" -) - -func ExampleNewServerConn() { - // An SSH server is represented by a ServerConfig, which holds - // certificate details and handles authentication of ServerConns. - config := &ssh.ServerConfig{ - PasswordCallback: func(c ssh.ConnMetadata, pass []byte) (*ssh.Permissions, error) { - // Should use constant-time compare (or better, salt+hash) in - // a production setting. - if c.User() == "testuser" && string(pass) == "tiger" { - return nil, nil - } - return nil, fmt.Errorf("password rejected for %q", c.User()) - }, - } - - privateBytes, err := ioutil.ReadFile("id_rsa") - if err != nil { - panic("Failed to load private key") - } - - private, err := ssh.ParsePrivateKey(privateBytes) - if err != nil { - panic("Failed to parse private key") - } - - config.AddHostKey(private) - - // Once a ServerConfig has been configured, connections can be - // accepted. - listener, err := net.Listen("tcp", "0.0.0.0:2022") - if err != nil { - panic("failed to listen for connection") - } - nConn, err := listener.Accept() - if err != nil { - panic("failed to accept incoming connection") - } - - // Before use, a handshake must be performed on the incoming - // net.Conn. - _, chans, reqs, err := ssh.NewServerConn(nConn, config) - if err != nil { - panic("failed to handshake") - } - // The incoming Request channel must be serviced. - go ssh.DiscardRequests(reqs) - - // Service the incoming Channel channel. - for newChannel := range chans { - // Channels have a type, depending on the application level - // protocol intended. In the case of a shell, the type is - // "session" and ServerShell may be used to present a simple - // terminal interface. - if newChannel.ChannelType() != "session" { - newChannel.Reject(ssh.UnknownChannelType, "unknown channel type") - continue - } - channel, requests, err := newChannel.Accept() - if err != nil { - panic("could not accept channel.") - } - - // Sessions have out-of-band requests such as "shell", - // "pty-req" and "env". Here we handle only the - // "shell" request. - go func(in <-chan *ssh.Request) { - for req := range in { - ok := false - switch req.Type { - case "shell": - ok = true - if len(req.Payload) > 0 { - // We don't accept any - // commands, only the - // default shell. - ok = false - } - } - req.Reply(ok, nil) - } - }(requests) - - term := terminal.NewTerminal(channel, "> ") - - go func() { - defer channel.Close() - for { - line, err := term.ReadLine() - if err != nil { - break - } - fmt.Println(line) - } - }() - } -} - -func ExampleDial() { - // An SSH client is represented with a ClientConn. Currently only - // the "password" authentication method is supported. - // - // To authenticate with the remote server you must pass at least one - // implementation of AuthMethod via the Auth field in ClientConfig. - config := &ssh.ClientConfig{ - User: "username", - Auth: []ssh.AuthMethod{ - ssh.Password("yourpassword"), - }, - } - client, err := ssh.Dial("tcp", "yourserver.com:22", config) - if err != nil { - panic("Failed to dial: " + err.Error()) - } - - // Each ClientConn can support multiple interactive sessions, - // represented by a Session. - session, err := client.NewSession() - if err != nil { - panic("Failed to create session: " + err.Error()) - } - defer session.Close() - - // Once a Session is created, you can execute a single command on - // the remote side using the Run method. - var b bytes.Buffer - session.Stdout = &b - if err := session.Run("/usr/bin/whoami"); err != nil { - panic("Failed to run: " + err.Error()) - } - fmt.Println(b.String()) -} - -func ExampleClient_Listen() { - config := &ssh.ClientConfig{ - User: "username", - Auth: []ssh.AuthMethod{ - ssh.Password("password"), - }, - } - // Dial your ssh server. - conn, err := ssh.Dial("tcp", "localhost:22", config) - if err != nil { - log.Fatalf("unable to connect: %s", err) - } - defer conn.Close() - - // Request the remote side to open port 8080 on all interfaces. - l, err := conn.Listen("tcp", "0.0.0.0:8080") - if err != nil { - log.Fatalf("unable to register tcp forward: %v", err) - } - defer l.Close() - - // Serve HTTP with your SSH server acting as a reverse proxy. - http.Serve(l, http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) { - fmt.Fprintf(resp, "Hello world!\n") - })) -} - -func ExampleSession_RequestPty() { - // Create client config - config := &ssh.ClientConfig{ - User: "username", - Auth: []ssh.AuthMethod{ - ssh.Password("password"), - }, - } - // Connect to ssh server - conn, err := ssh.Dial("tcp", "localhost:22", config) - if err != nil { - log.Fatalf("unable to connect: %s", err) - } - defer conn.Close() - // Create a session - session, err := conn.NewSession() - if err != nil { - log.Fatalf("unable to create session: %s", err) - } - defer session.Close() - // Set up terminal modes - modes := ssh.TerminalModes{ - ssh.ECHO: 0, // disable echoing - ssh.TTY_OP_ISPEED: 14400, // input speed = 14.4kbaud - ssh.TTY_OP_OSPEED: 14400, // output speed = 14.4kbaud - } - // Request pseudo terminal - if err := session.RequestPty("xterm", 80, 40, modes); err != nil { - log.Fatalf("request for pseudo terminal failed: %s", err) - } - // Start remote shell - if err := session.Shell(); err != nil { - log.Fatalf("failed to start shell: %s", err) - } -} diff --git a/vendor/golang.org/x/crypto/ssh/handshake_test.go b/vendor/golang.org/x/crypto/ssh/handshake_test.go deleted file mode 100644 index b86d369cce..0000000000 --- a/vendor/golang.org/x/crypto/ssh/handshake_test.go +++ /dev/null @@ -1,415 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssh - -import ( - "bytes" - "crypto/rand" - "errors" - "fmt" - "net" - "runtime" - "strings" - "sync" - "testing" -) - -type testChecker struct { - calls []string -} - -func (t *testChecker) Check(dialAddr string, addr net.Addr, key PublicKey) error { - if dialAddr == "bad" { - return fmt.Errorf("dialAddr is bad") - } - - if tcpAddr, ok := addr.(*net.TCPAddr); !ok || tcpAddr == nil { - return fmt.Errorf("testChecker: got %T want *net.TCPAddr", addr) - } - - t.calls = append(t.calls, fmt.Sprintf("%s %v %s %x", dialAddr, addr, key.Type(), key.Marshal())) - - return nil -} - -// netPipe is analogous to net.Pipe, but it uses a real net.Conn, and -// therefore is buffered (net.Pipe deadlocks if both sides start with -// a write.) -func netPipe() (net.Conn, net.Conn, error) { - listener, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - return nil, nil, err - } - defer listener.Close() - c1, err := net.Dial("tcp", listener.Addr().String()) - if err != nil { - return nil, nil, err - } - - c2, err := listener.Accept() - if err != nil { - c1.Close() - return nil, nil, err - } - - return c1, c2, nil -} - -func handshakePair(clientConf *ClientConfig, addr string) (client *handshakeTransport, server *handshakeTransport, err error) { - a, b, err := netPipe() - if err != nil { - return nil, nil, err - } - - trC := newTransport(a, rand.Reader, true) - trS := newTransport(b, rand.Reader, false) - clientConf.SetDefaults() - - v := []byte("version") - client = newClientTransport(trC, v, v, clientConf, addr, a.RemoteAddr()) - - serverConf := &ServerConfig{} - serverConf.AddHostKey(testSigners["ecdsa"]) - serverConf.AddHostKey(testSigners["rsa"]) - serverConf.SetDefaults() - server = newServerTransport(trS, v, v, serverConf) - - return client, server, nil -} - -func TestHandshakeBasic(t *testing.T) { - if runtime.GOOS == "plan9" { - t.Skip("see golang.org/issue/7237") - } - checker := &testChecker{} - trC, trS, err := handshakePair(&ClientConfig{HostKeyCallback: checker.Check}, "addr") - if err != nil { - t.Fatalf("handshakePair: %v", err) - } - - defer trC.Close() - defer trS.Close() - - go func() { - // Client writes a bunch of stuff, and does a key - // change in the middle. This should not confuse the - // handshake in progress - for i := 0; i < 10; i++ { - p := []byte{msgRequestSuccess, byte(i)} - if err := trC.writePacket(p); err != nil { - t.Fatalf("sendPacket: %v", err) - } - if i == 5 { - // halfway through, we request a key change. - _, _, err := trC.sendKexInit() - if err != nil { - t.Fatalf("sendKexInit: %v", err) - } - } - } - trC.Close() - }() - - // Server checks that client messages come in cleanly - i := 0 - for { - p, err := trS.readPacket() - if err != nil { - break - } - if p[0] == msgNewKeys { - continue - } - want := []byte{msgRequestSuccess, byte(i)} - if bytes.Compare(p, want) != 0 { - t.Errorf("message %d: got %q, want %q", i, p, want) - } - i++ - } - if i != 10 { - t.Errorf("received %d messages, want 10.", i) - } - - // If all went well, we registered exactly 1 key change. - if len(checker.calls) != 1 { - t.Fatalf("got %d host key checks, want 1", len(checker.calls)) - } - - pub := testSigners["ecdsa"].PublicKey() - want := fmt.Sprintf("%s %v %s %x", "addr", trC.remoteAddr, pub.Type(), pub.Marshal()) - if want != checker.calls[0] { - t.Errorf("got %q want %q for host key check", checker.calls[0], want) - } -} - -func TestHandshakeError(t *testing.T) { - checker := &testChecker{} - trC, trS, err := handshakePair(&ClientConfig{HostKeyCallback: checker.Check}, "bad") - if err != nil { - t.Fatalf("handshakePair: %v", err) - } - defer trC.Close() - defer trS.Close() - - // send a packet - packet := []byte{msgRequestSuccess, 42} - if err := trC.writePacket(packet); err != nil { - t.Errorf("writePacket: %v", err) - } - - // Now request a key change. - _, _, err = trC.sendKexInit() - if err != nil { - t.Errorf("sendKexInit: %v", err) - } - - // the key change will fail, and afterwards we can't write. - if err := trC.writePacket([]byte{msgRequestSuccess, 43}); err == nil { - t.Errorf("writePacket after botched rekey succeeded.") - } - - readback, err := trS.readPacket() - if err != nil { - t.Fatalf("server closed too soon: %v", err) - } - if bytes.Compare(readback, packet) != 0 { - t.Errorf("got %q want %q", readback, packet) - } - readback, err = trS.readPacket() - if err == nil { - t.Errorf("got a message %q after failed key change", readback) - } -} - -func TestHandshakeTwice(t *testing.T) { - checker := &testChecker{} - trC, trS, err := handshakePair(&ClientConfig{HostKeyCallback: checker.Check}, "addr") - if err != nil { - t.Fatalf("handshakePair: %v", err) - } - - defer trC.Close() - defer trS.Close() - - // send a packet - packet := make([]byte, 5) - packet[0] = msgRequestSuccess - if err := trC.writePacket(packet); err != nil { - t.Errorf("writePacket: %v", err) - } - - // Now request a key change. - _, _, err = trC.sendKexInit() - if err != nil { - t.Errorf("sendKexInit: %v", err) - } - - // Send another packet. Use a fresh one, since writePacket destroys. - packet = make([]byte, 5) - packet[0] = msgRequestSuccess - if err := trC.writePacket(packet); err != nil { - t.Errorf("writePacket: %v", err) - } - - // 2nd key change. - _, _, err = trC.sendKexInit() - if err != nil { - t.Errorf("sendKexInit: %v", err) - } - - packet = make([]byte, 5) - packet[0] = msgRequestSuccess - if err := trC.writePacket(packet); err != nil { - t.Errorf("writePacket: %v", err) - } - - packet = make([]byte, 5) - packet[0] = msgRequestSuccess - for i := 0; i < 5; i++ { - msg, err := trS.readPacket() - if err != nil { - t.Fatalf("server closed too soon: %v", err) - } - if msg[0] == msgNewKeys { - continue - } - - if bytes.Compare(msg, packet) != 0 { - t.Errorf("packet %d: got %q want %q", i, msg, packet) - } - } - if len(checker.calls) != 2 { - t.Errorf("got %d key changes, want 2", len(checker.calls)) - } -} - -func TestHandshakeAutoRekeyWrite(t *testing.T) { - checker := &testChecker{} - clientConf := &ClientConfig{HostKeyCallback: checker.Check} - clientConf.RekeyThreshold = 500 - trC, trS, err := handshakePair(clientConf, "addr") - if err != nil { - t.Fatalf("handshakePair: %v", err) - } - defer trC.Close() - defer trS.Close() - - for i := 0; i < 5; i++ { - packet := make([]byte, 251) - packet[0] = msgRequestSuccess - if err := trC.writePacket(packet); err != nil { - t.Errorf("writePacket: %v", err) - } - } - - j := 0 - for ; j < 5; j++ { - _, err := trS.readPacket() - if err != nil { - break - } - } - - if j != 5 { - t.Errorf("got %d, want 5 messages", j) - } - - if len(checker.calls) != 2 { - t.Errorf("got %d key changes, wanted 2", len(checker.calls)) - } -} - -type syncChecker struct { - called chan int -} - -func (t *syncChecker) Check(dialAddr string, addr net.Addr, key PublicKey) error { - t.called <- 1 - return nil -} - -func TestHandshakeAutoRekeyRead(t *testing.T) { - sync := &syncChecker{make(chan int, 2)} - clientConf := &ClientConfig{ - HostKeyCallback: sync.Check, - } - clientConf.RekeyThreshold = 500 - - trC, trS, err := handshakePair(clientConf, "addr") - if err != nil { - t.Fatalf("handshakePair: %v", err) - } - defer trC.Close() - defer trS.Close() - - packet := make([]byte, 501) - packet[0] = msgRequestSuccess - if err := trS.writePacket(packet); err != nil { - t.Fatalf("writePacket: %v", err) - } - // While we read out the packet, a key change will be - // initiated. - if _, err := trC.readPacket(); err != nil { - t.Fatalf("readPacket(client): %v", err) - } - - <-sync.called -} - -// errorKeyingTransport generates errors after a given number of -// read/write operations. -type errorKeyingTransport struct { - packetConn - readLeft, writeLeft int -} - -func (n *errorKeyingTransport) prepareKeyChange(*algorithms, *kexResult) error { - return nil -} -func (n *errorKeyingTransport) getSessionID() []byte { - return nil -} - -func (n *errorKeyingTransport) writePacket(packet []byte) error { - if n.writeLeft == 0 { - n.Close() - return errors.New("barf") - } - - n.writeLeft-- - return n.packetConn.writePacket(packet) -} - -func (n *errorKeyingTransport) readPacket() ([]byte, error) { - if n.readLeft == 0 { - n.Close() - return nil, errors.New("barf") - } - - n.readLeft-- - return n.packetConn.readPacket() -} - -func TestHandshakeErrorHandlingRead(t *testing.T) { - for i := 0; i < 20; i++ { - testHandshakeErrorHandlingN(t, i, -1) - } -} - -func TestHandshakeErrorHandlingWrite(t *testing.T) { - for i := 0; i < 20; i++ { - testHandshakeErrorHandlingN(t, -1, i) - } -} - -// testHandshakeErrorHandlingN runs handshakes, injecting errors. If -// handshakeTransport deadlocks, the go runtime will detect it and -// panic. -func testHandshakeErrorHandlingN(t *testing.T, readLimit, writeLimit int) { - msg := Marshal(&serviceRequestMsg{strings.Repeat("x", int(minRekeyThreshold)/4)}) - - a, b := memPipe() - defer a.Close() - defer b.Close() - - key := testSigners["ecdsa"] - serverConf := Config{RekeyThreshold: minRekeyThreshold} - serverConf.SetDefaults() - serverConn := newHandshakeTransport(&errorKeyingTransport{a, readLimit, writeLimit}, &serverConf, []byte{'a'}, []byte{'b'}) - serverConn.hostKeys = []Signer{key} - go serverConn.readLoop() - - clientConf := Config{RekeyThreshold: 10 * minRekeyThreshold} - clientConf.SetDefaults() - clientConn := newHandshakeTransport(&errorKeyingTransport{b, -1, -1}, &clientConf, []byte{'a'}, []byte{'b'}) - clientConn.hostKeyAlgorithms = []string{key.PublicKey().Type()} - go clientConn.readLoop() - - var wg sync.WaitGroup - wg.Add(4) - - for _, hs := range []packetConn{serverConn, clientConn} { - go func(c packetConn) { - for { - err := c.writePacket(msg) - if err != nil { - break - } - } - wg.Done() - }(hs) - go func(c packetConn) { - for { - _, err := c.readPacket() - if err != nil { - break - } - } - wg.Done() - }(hs) - } - - wg.Wait() -} diff --git a/vendor/golang.org/x/crypto/ssh/kex_test.go b/vendor/golang.org/x/crypto/ssh/kex_test.go deleted file mode 100644 index 12ca0acd31..0000000000 --- a/vendor/golang.org/x/crypto/ssh/kex_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssh - -// Key exchange tests. - -import ( - "crypto/rand" - "reflect" - "testing" -) - -func TestKexes(t *testing.T) { - type kexResultErr struct { - result *kexResult - err error - } - - for name, kex := range kexAlgoMap { - a, b := memPipe() - - s := make(chan kexResultErr, 1) - c := make(chan kexResultErr, 1) - var magics handshakeMagics - go func() { - r, e := kex.Client(a, rand.Reader, &magics) - a.Close() - c <- kexResultErr{r, e} - }() - go func() { - r, e := kex.Server(b, rand.Reader, &magics, testSigners["ecdsa"]) - b.Close() - s <- kexResultErr{r, e} - }() - - clientRes := <-c - serverRes := <-s - if clientRes.err != nil { - t.Errorf("client: %v", clientRes.err) - } - if serverRes.err != nil { - t.Errorf("server: %v", serverRes.err) - } - if !reflect.DeepEqual(clientRes.result, serverRes.result) { - t.Errorf("kex %q: mismatch %#v, %#v", name, clientRes.result, serverRes.result) - } - } -} diff --git a/vendor/golang.org/x/crypto/ssh/keys_test.go b/vendor/golang.org/x/crypto/ssh/keys_test.go deleted file mode 100644 index 27569473fc..0000000000 --- a/vendor/golang.org/x/crypto/ssh/keys_test.go +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssh - -import ( - "bytes" - "crypto/dsa" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "crypto/rsa" - "encoding/base64" - "fmt" - "reflect" - "strings" - "testing" - - "golang.org/x/crypto/ssh/testdata" -) - -func rawKey(pub PublicKey) interface{} { - switch k := pub.(type) { - case *rsaPublicKey: - return (*rsa.PublicKey)(k) - case *dsaPublicKey: - return (*dsa.PublicKey)(k) - case *ecdsaPublicKey: - return (*ecdsa.PublicKey)(k) - case *Certificate: - return k - } - panic("unknown key type") -} - -func TestKeyMarshalParse(t *testing.T) { - for _, priv := range testSigners { - pub := priv.PublicKey() - roundtrip, err := ParsePublicKey(pub.Marshal()) - if err != nil { - t.Errorf("ParsePublicKey(%T): %v", pub, err) - } - - k1 := rawKey(pub) - k2 := rawKey(roundtrip) - - if !reflect.DeepEqual(k1, k2) { - t.Errorf("got %#v in roundtrip, want %#v", k2, k1) - } - } -} - -func TestUnsupportedCurves(t *testing.T) { - raw, err := ecdsa.GenerateKey(elliptic.P224(), rand.Reader) - if err != nil { - t.Fatalf("GenerateKey: %v", err) - } - - if _, err = NewSignerFromKey(raw); err == nil || !strings.Contains(err.Error(), "only P-256") { - t.Fatalf("NewPrivateKey should not succeed with P-224, got: %v", err) - } - - if _, err = NewPublicKey(&raw.PublicKey); err == nil || !strings.Contains(err.Error(), "only P-256") { - t.Fatalf("NewPublicKey should not succeed with P-224, got: %v", err) - } -} - -func TestNewPublicKey(t *testing.T) { - for _, k := range testSigners { - raw := rawKey(k.PublicKey()) - // Skip certificates, as NewPublicKey does not support them. - if _, ok := raw.(*Certificate); ok { - continue - } - pub, err := NewPublicKey(raw) - if err != nil { - t.Errorf("NewPublicKey(%#v): %v", raw, err) - } - if !reflect.DeepEqual(k.PublicKey(), pub) { - t.Errorf("NewPublicKey(%#v) = %#v, want %#v", raw, pub, k.PublicKey()) - } - } -} - -func TestKeySignVerify(t *testing.T) { - for _, priv := range testSigners { - pub := priv.PublicKey() - - data := []byte("sign me") - sig, err := priv.Sign(rand.Reader, data) - if err != nil { - t.Fatalf("Sign(%T): %v", priv, err) - } - - if err := pub.Verify(data, sig); err != nil { - t.Errorf("publicKey.Verify(%T): %v", priv, err) - } - sig.Blob[5]++ - if err := pub.Verify(data, sig); err == nil { - t.Errorf("publicKey.Verify on broken sig did not fail") - } - } -} - -func TestParseRSAPrivateKey(t *testing.T) { - key := testPrivateKeys["rsa"] - - rsa, ok := key.(*rsa.PrivateKey) - if !ok { - t.Fatalf("got %T, want *rsa.PrivateKey", rsa) - } - - if err := rsa.Validate(); err != nil { - t.Errorf("Validate: %v", err) - } -} - -func TestParseECPrivateKey(t *testing.T) { - key := testPrivateKeys["ecdsa"] - - ecKey, ok := key.(*ecdsa.PrivateKey) - if !ok { - t.Fatalf("got %T, want *ecdsa.PrivateKey", ecKey) - } - - if !validateECPublicKey(ecKey.Curve, ecKey.X, ecKey.Y) { - t.Fatalf("public key does not validate.") - } -} - -func TestParseDSA(t *testing.T) { - // We actually exercise the ParsePrivateKey codepath here, as opposed to - // using the ParseRawPrivateKey+NewSignerFromKey path that testdata_test.go - // uses. - s, err := ParsePrivateKey(testdata.PEMBytes["dsa"]) - if err != nil { - t.Fatalf("ParsePrivateKey returned error: %s", err) - } - - data := []byte("sign me") - sig, err := s.Sign(rand.Reader, data) - if err != nil { - t.Fatalf("dsa.Sign: %v", err) - } - - if err := s.PublicKey().Verify(data, sig); err != nil { - t.Errorf("Verify failed: %v", err) - } -} - -// Tests for authorized_keys parsing. - -// getTestKey returns a public key, and its base64 encoding. -func getTestKey() (PublicKey, string) { - k := testPublicKeys["rsa"] - - b := &bytes.Buffer{} - e := base64.NewEncoder(base64.StdEncoding, b) - e.Write(k.Marshal()) - e.Close() - - return k, b.String() -} - -func TestMarshalParsePublicKey(t *testing.T) { - pub, pubSerialized := getTestKey() - line := fmt.Sprintf("%s %s user@host", pub.Type(), pubSerialized) - - authKeys := MarshalAuthorizedKey(pub) - actualFields := strings.Fields(string(authKeys)) - if len(actualFields) == 0 { - t.Fatalf("failed authKeys: %v", authKeys) - } - - // drop the comment - expectedFields := strings.Fields(line)[0:2] - - if !reflect.DeepEqual(actualFields, expectedFields) { - t.Errorf("got %v, expected %v", actualFields, expectedFields) - } - - actPub, _, _, _, err := ParseAuthorizedKey([]byte(line)) - if err != nil { - t.Fatalf("cannot parse %v: %v", line, err) - } - if !reflect.DeepEqual(actPub, pub) { - t.Errorf("got %v, expected %v", actPub, pub) - } -} - -type authResult struct { - pubKey PublicKey - options []string - comments string - rest string - ok bool -} - -func testAuthorizedKeys(t *testing.T, authKeys []byte, expected []authResult) { - rest := authKeys - var values []authResult - for len(rest) > 0 { - var r authResult - var err error - r.pubKey, r.comments, r.options, rest, err = ParseAuthorizedKey(rest) - r.ok = (err == nil) - t.Log(err) - r.rest = string(rest) - values = append(values, r) - } - - if !reflect.DeepEqual(values, expected) { - t.Errorf("got %#v, expected %#v", values, expected) - } -} - -func TestAuthorizedKeyBasic(t *testing.T) { - pub, pubSerialized := getTestKey() - line := "ssh-rsa " + pubSerialized + " user@host" - testAuthorizedKeys(t, []byte(line), - []authResult{ - {pub, nil, "user@host", "", true}, - }) -} - -func TestAuth(t *testing.T) { - pub, pubSerialized := getTestKey() - authWithOptions := []string{ - `# comments to ignore before any keys...`, - ``, - `env="HOME=/home/root",no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host`, - `# comments to ignore, along with a blank line`, - ``, - `env="HOME=/home/root2" ssh-rsa ` + pubSerialized + ` user2@host2`, - ``, - `# more comments, plus a invalid entry`, - `ssh-rsa data-that-will-not-parse user@host3`, - } - for _, eol := range []string{"\n", "\r\n"} { - authOptions := strings.Join(authWithOptions, eol) - rest2 := strings.Join(authWithOptions[3:], eol) - rest3 := strings.Join(authWithOptions[6:], eol) - testAuthorizedKeys(t, []byte(authOptions), []authResult{ - {pub, []string{`env="HOME=/home/root"`, "no-port-forwarding"}, "user@host", rest2, true}, - {pub, []string{`env="HOME=/home/root2"`}, "user2@host2", rest3, true}, - {nil, nil, "", "", false}, - }) - } -} - -func TestAuthWithQuotedSpaceInEnv(t *testing.T) { - pub, pubSerialized := getTestKey() - authWithQuotedSpaceInEnv := []byte(`env="HOME=/home/root dir",no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host`) - testAuthorizedKeys(t, []byte(authWithQuotedSpaceInEnv), []authResult{ - {pub, []string{`env="HOME=/home/root dir"`, "no-port-forwarding"}, "user@host", "", true}, - }) -} - -func TestAuthWithQuotedCommaInEnv(t *testing.T) { - pub, pubSerialized := getTestKey() - authWithQuotedCommaInEnv := []byte(`env="HOME=/home/root,dir",no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host`) - testAuthorizedKeys(t, []byte(authWithQuotedCommaInEnv), []authResult{ - {pub, []string{`env="HOME=/home/root,dir"`, "no-port-forwarding"}, "user@host", "", true}, - }) -} - -func TestAuthWithQuotedQuoteInEnv(t *testing.T) { - pub, pubSerialized := getTestKey() - authWithQuotedQuoteInEnv := []byte(`env="HOME=/home/\"root dir",no-port-forwarding` + "\t" + `ssh-rsa` + "\t" + pubSerialized + ` user@host`) - authWithDoubleQuotedQuote := []byte(`no-port-forwarding,env="HOME=/home/ \"root dir\"" ssh-rsa ` + pubSerialized + "\t" + `user@host`) - testAuthorizedKeys(t, []byte(authWithQuotedQuoteInEnv), []authResult{ - {pub, []string{`env="HOME=/home/\"root dir"`, "no-port-forwarding"}, "user@host", "", true}, - }) - - testAuthorizedKeys(t, []byte(authWithDoubleQuotedQuote), []authResult{ - {pub, []string{"no-port-forwarding", `env="HOME=/home/ \"root dir\""`}, "user@host", "", true}, - }) -} - -func TestAuthWithInvalidSpace(t *testing.T) { - _, pubSerialized := getTestKey() - authWithInvalidSpace := []byte(`env="HOME=/home/root dir", no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host -#more to follow but still no valid keys`) - testAuthorizedKeys(t, []byte(authWithInvalidSpace), []authResult{ - {nil, nil, "", "", false}, - }) -} - -func TestAuthWithMissingQuote(t *testing.T) { - pub, pubSerialized := getTestKey() - authWithMissingQuote := []byte(`env="HOME=/home/root,no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host -env="HOME=/home/root",shared-control ssh-rsa ` + pubSerialized + ` user@host`) - - testAuthorizedKeys(t, []byte(authWithMissingQuote), []authResult{ - {pub, []string{`env="HOME=/home/root"`, `shared-control`}, "user@host", "", true}, - }) -} - -func TestInvalidEntry(t *testing.T) { - authInvalid := []byte(`ssh-rsa`) - _, _, _, _, err := ParseAuthorizedKey(authInvalid) - if err == nil { - t.Errorf("got valid entry for %q", authInvalid) - } -} - -var knownHostsParseTests = []struct { - input string - err string - - marker string - comment string - hosts []string - rest string -} { - { - "", - "EOF", - - "", "", nil, "", - }, - { - "# Just a comment", - "EOF", - - "", "", nil, "", - }, - { - " \t ", - "EOF", - - "", "", nil, "", - }, - { - "localhost ssh-rsa {RSAPUB}", - "", - - "", "", []string{"localhost"}, "", - }, - { - "localhost\tssh-rsa {RSAPUB}", - "", - - "", "", []string{"localhost"}, "", - }, - { - "localhost\tssh-rsa {RSAPUB}\tcomment comment", - "", - - "", "comment comment", []string{"localhost"}, "", - }, - { - "localhost\tssh-rsa {RSAPUB}\tcomment comment\n", - "", - - "", "comment comment", []string{"localhost"}, "", - }, - { - "localhost\tssh-rsa {RSAPUB}\tcomment comment\r\n", - "", - - "", "comment comment", []string{"localhost"}, "", - }, - { - "localhost\tssh-rsa {RSAPUB}\tcomment comment\r\nnext line", - "", - - "", "comment comment", []string{"localhost"}, "next line", - }, - { - "localhost,[host2:123]\tssh-rsa {RSAPUB}\tcomment comment", - "", - - "", "comment comment", []string{"localhost","[host2:123]"}, "", - }, - { - "@marker \tlocalhost,[host2:123]\tssh-rsa {RSAPUB}", - "", - - "marker", "", []string{"localhost","[host2:123]"}, "", - }, - { - "@marker \tlocalhost,[host2:123]\tssh-rsa aabbccdd", - "short read", - - "", "", nil, "", - }, -} - -func TestKnownHostsParsing(t *testing.T) { - rsaPub, rsaPubSerialized := getTestKey() - - for i, test := range knownHostsParseTests { - var expectedKey PublicKey - const rsaKeyToken = "{RSAPUB}" - - input := test.input - if strings.Contains(input, rsaKeyToken) { - expectedKey = rsaPub - input = strings.Replace(test.input, rsaKeyToken, rsaPubSerialized, -1) - } - - marker, hosts, pubKey, comment, rest, err := ParseKnownHosts([]byte(input)) - if err != nil { - if len(test.err) == 0 { - t.Errorf("#%d: unexpectedly failed with %q", i, err) - } else if !strings.Contains(err.Error(), test.err) { - t.Errorf("#%d: expected error containing %q, but got %q", i, test.err, err) - } - continue - } else if len(test.err) != 0 { - t.Errorf("#%d: succeeded but expected error including %q", i, test.err) - continue - } - - if !reflect.DeepEqual(expectedKey, pubKey) { - t.Errorf("#%d: expected key %#v, but got %#v", i, expectedKey, pubKey) - } - - if marker != test.marker { - t.Errorf("#%d: expected marker %q, but got %q", i, test.marker, marker) - } - - if comment != test.comment { - t.Errorf("#%d: expected comment %q, but got %q", i, test.comment, comment) - } - - if !reflect.DeepEqual(test.hosts, hosts) { - t.Errorf("#%d: expected hosts %#v, but got %#v", i, test.hosts, hosts) - } - - if rest := string(rest); rest != test.rest { - t.Errorf("#%d: expected remaining input to be %q, but got %q", i, test.rest, rest) - } - } -} diff --git a/vendor/golang.org/x/crypto/ssh/mempipe_test.go b/vendor/golang.org/x/crypto/ssh/mempipe_test.go deleted file mode 100644 index 8697cd6140..0000000000 --- a/vendor/golang.org/x/crypto/ssh/mempipe_test.go +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssh - -import ( - "io" - "sync" - "testing" -) - -// An in-memory packetConn. It is safe to call Close and writePacket -// from different goroutines. -type memTransport struct { - eof bool - pending [][]byte - write *memTransport - sync.Mutex - *sync.Cond -} - -func (t *memTransport) readPacket() ([]byte, error) { - t.Lock() - defer t.Unlock() - for { - if len(t.pending) > 0 { - r := t.pending[0] - t.pending = t.pending[1:] - return r, nil - } - if t.eof { - return nil, io.EOF - } - t.Cond.Wait() - } -} - -func (t *memTransport) closeSelf() error { - t.Lock() - defer t.Unlock() - if t.eof { - return io.EOF - } - t.eof = true - t.Cond.Broadcast() - return nil -} - -func (t *memTransport) Close() error { - err := t.write.closeSelf() - t.closeSelf() - return err -} - -func (t *memTransport) writePacket(p []byte) error { - t.write.Lock() - defer t.write.Unlock() - if t.write.eof { - return io.EOF - } - c := make([]byte, len(p)) - copy(c, p) - t.write.pending = append(t.write.pending, c) - t.write.Cond.Signal() - return nil -} - -func memPipe() (a, b packetConn) { - t1 := memTransport{} - t2 := memTransport{} - t1.write = &t2 - t2.write = &t1 - t1.Cond = sync.NewCond(&t1.Mutex) - t2.Cond = sync.NewCond(&t2.Mutex) - return &t1, &t2 -} - -func TestMemPipe(t *testing.T) { - a, b := memPipe() - if err := a.writePacket([]byte{42}); err != nil { - t.Fatalf("writePacket: %v", err) - } - if err := a.Close(); err != nil { - t.Fatal("Close: ", err) - } - p, err := b.readPacket() - if err != nil { - t.Fatal("readPacket: ", err) - } - if len(p) != 1 || p[0] != 42 { - t.Fatalf("got %v, want {42}", p) - } - p, err = b.readPacket() - if err != io.EOF { - t.Fatalf("got %v, %v, want EOF", p, err) - } -} - -func TestDoubleClose(t *testing.T) { - a, _ := memPipe() - err := a.Close() - if err != nil { - t.Errorf("Close: %v", err) - } - err = a.Close() - if err != io.EOF { - t.Errorf("expect EOF on double close.") - } -} diff --git a/vendor/golang.org/x/crypto/ssh/messages_test.go b/vendor/golang.org/x/crypto/ssh/messages_test.go deleted file mode 100644 index 955b5127f9..0000000000 --- a/vendor/golang.org/x/crypto/ssh/messages_test.go +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssh - -import ( - "bytes" - "math/big" - "math/rand" - "reflect" - "testing" - "testing/quick" -) - -var intLengthTests = []struct { - val, length int -}{ - {0, 4 + 0}, - {1, 4 + 1}, - {127, 4 + 1}, - {128, 4 + 2}, - {-1, 4 + 1}, -} - -func TestIntLength(t *testing.T) { - for _, test := range intLengthTests { - v := new(big.Int).SetInt64(int64(test.val)) - length := intLength(v) - if length != test.length { - t.Errorf("For %d, got length %d but expected %d", test.val, length, test.length) - } - } -} - -type msgAllTypes struct { - Bool bool `sshtype:"21"` - Array [16]byte - Uint64 uint64 - Uint32 uint32 - Uint8 uint8 - String string - Strings []string - Bytes []byte - Int *big.Int - Rest []byte `ssh:"rest"` -} - -func (t *msgAllTypes) Generate(rand *rand.Rand, size int) reflect.Value { - m := &msgAllTypes{} - m.Bool = rand.Intn(2) == 1 - randomBytes(m.Array[:], rand) - m.Uint64 = uint64(rand.Int63n(1<<63 - 1)) - m.Uint32 = uint32(rand.Intn((1 << 31) - 1)) - m.Uint8 = uint8(rand.Intn(1 << 8)) - m.String = string(m.Array[:]) - m.Strings = randomNameList(rand) - m.Bytes = m.Array[:] - m.Int = randomInt(rand) - m.Rest = m.Array[:] - return reflect.ValueOf(m) -} - -func TestMarshalUnmarshal(t *testing.T) { - rand := rand.New(rand.NewSource(0)) - iface := &msgAllTypes{} - ty := reflect.ValueOf(iface).Type() - - n := 100 - if testing.Short() { - n = 5 - } - for j := 0; j < n; j++ { - v, ok := quick.Value(ty, rand) - if !ok { - t.Errorf("failed to create value") - break - } - - m1 := v.Elem().Interface() - m2 := iface - - marshaled := Marshal(m1) - if err := Unmarshal(marshaled, m2); err != nil { - t.Errorf("Unmarshal %#v: %s", m1, err) - break - } - - if !reflect.DeepEqual(v.Interface(), m2) { - t.Errorf("got: %#v\nwant:%#v\n%x", m2, m1, marshaled) - break - } - } -} - -func TestUnmarshalEmptyPacket(t *testing.T) { - var b []byte - var m channelRequestSuccessMsg - if err := Unmarshal(b, &m); err == nil { - t.Fatalf("unmarshal of empty slice succeeded") - } -} - -func TestUnmarshalUnexpectedPacket(t *testing.T) { - type S struct { - I uint32 `sshtype:"43"` - S string - B bool - } - - s := S{11, "hello", true} - packet := Marshal(s) - packet[0] = 42 - roundtrip := S{} - err := Unmarshal(packet, &roundtrip) - if err == nil { - t.Fatal("expected error, not nil") - } -} - -func TestMarshalPtr(t *testing.T) { - s := struct { - S string - }{"hello"} - - m1 := Marshal(s) - m2 := Marshal(&s) - if !bytes.Equal(m1, m2) { - t.Errorf("got %q, want %q for marshaled pointer", m2, m1) - } -} - -func TestBareMarshalUnmarshal(t *testing.T) { - type S struct { - I uint32 - S string - B bool - } - - s := S{42, "hello", true} - packet := Marshal(s) - roundtrip := S{} - Unmarshal(packet, &roundtrip) - - if !reflect.DeepEqual(s, roundtrip) { - t.Errorf("got %#v, want %#v", roundtrip, s) - } -} - -func TestBareMarshal(t *testing.T) { - type S2 struct { - I uint32 - } - s := S2{42} - packet := Marshal(s) - i, rest, ok := parseUint32(packet) - if len(rest) > 0 || !ok { - t.Errorf("parseInt(%q): parse error", packet) - } - if i != s.I { - t.Errorf("got %d, want %d", i, s.I) - } -} - -func TestUnmarshalShortKexInitPacket(t *testing.T) { - // This used to panic. - // Issue 11348 - packet := []byte{0x14, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xff, 0xff, 0xff, 0xff} - kim := &kexInitMsg{} - if err := Unmarshal(packet, kim); err == nil { - t.Error("truncated packet unmarshaled without error") - } -} - -func randomBytes(out []byte, rand *rand.Rand) { - for i := 0; i < len(out); i++ { - out[i] = byte(rand.Int31()) - } -} - -func randomNameList(rand *rand.Rand) []string { - ret := make([]string, rand.Int31()&15) - for i := range ret { - s := make([]byte, 1+(rand.Int31()&15)) - for j := range s { - s[j] = 'a' + uint8(rand.Int31()&15) - } - ret[i] = string(s) - } - return ret -} - -func randomInt(rand *rand.Rand) *big.Int { - return new(big.Int).SetInt64(int64(int32(rand.Uint32()))) -} - -func (*kexInitMsg) Generate(rand *rand.Rand, size int) reflect.Value { - ki := &kexInitMsg{} - randomBytes(ki.Cookie[:], rand) - ki.KexAlgos = randomNameList(rand) - ki.ServerHostKeyAlgos = randomNameList(rand) - ki.CiphersClientServer = randomNameList(rand) - ki.CiphersServerClient = randomNameList(rand) - ki.MACsClientServer = randomNameList(rand) - ki.MACsServerClient = randomNameList(rand) - ki.CompressionClientServer = randomNameList(rand) - ki.CompressionServerClient = randomNameList(rand) - ki.LanguagesClientServer = randomNameList(rand) - ki.LanguagesServerClient = randomNameList(rand) - if rand.Int31()&1 == 1 { - ki.FirstKexFollows = true - } - return reflect.ValueOf(ki) -} - -func (*kexDHInitMsg) Generate(rand *rand.Rand, size int) reflect.Value { - dhi := &kexDHInitMsg{} - dhi.X = randomInt(rand) - return reflect.ValueOf(dhi) -} - -var ( - _kexInitMsg = new(kexInitMsg).Generate(rand.New(rand.NewSource(0)), 10).Elem().Interface() - _kexDHInitMsg = new(kexDHInitMsg).Generate(rand.New(rand.NewSource(0)), 10).Elem().Interface() - - _kexInit = Marshal(_kexInitMsg) - _kexDHInit = Marshal(_kexDHInitMsg) -) - -func BenchmarkMarshalKexInitMsg(b *testing.B) { - for i := 0; i < b.N; i++ { - Marshal(_kexInitMsg) - } -} - -func BenchmarkUnmarshalKexInitMsg(b *testing.B) { - m := new(kexInitMsg) - for i := 0; i < b.N; i++ { - Unmarshal(_kexInit, m) - } -} - -func BenchmarkMarshalKexDHInitMsg(b *testing.B) { - for i := 0; i < b.N; i++ { - Marshal(_kexDHInitMsg) - } -} - -func BenchmarkUnmarshalKexDHInitMsg(b *testing.B) { - m := new(kexDHInitMsg) - for i := 0; i < b.N; i++ { - Unmarshal(_kexDHInit, m) - } -} diff --git a/vendor/golang.org/x/crypto/ssh/mux_test.go b/vendor/golang.org/x/crypto/ssh/mux_test.go deleted file mode 100644 index 523038960f..0000000000 --- a/vendor/golang.org/x/crypto/ssh/mux_test.go +++ /dev/null @@ -1,525 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssh - -import ( - "io" - "io/ioutil" - "sync" - "testing" -) - -func muxPair() (*mux, *mux) { - a, b := memPipe() - - s := newMux(a) - c := newMux(b) - - return s, c -} - -// Returns both ends of a channel, and the mux for the the 2nd -// channel. -func channelPair(t *testing.T) (*channel, *channel, *mux) { - c, s := muxPair() - - res := make(chan *channel, 1) - go func() { - newCh, ok := <-s.incomingChannels - if !ok { - t.Fatalf("No incoming channel") - } - if newCh.ChannelType() != "chan" { - t.Fatalf("got type %q want chan", newCh.ChannelType()) - } - ch, _, err := newCh.Accept() - if err != nil { - t.Fatalf("Accept %v", err) - } - res <- ch.(*channel) - }() - - ch, err := c.openChannel("chan", nil) - if err != nil { - t.Fatalf("OpenChannel: %v", err) - } - - return <-res, ch, c -} - -// Test that stderr and stdout can be addressed from different -// goroutines. This is intended for use with the race detector. -func TestMuxChannelExtendedThreadSafety(t *testing.T) { - writer, reader, mux := channelPair(t) - defer writer.Close() - defer reader.Close() - defer mux.Close() - - var wr, rd sync.WaitGroup - magic := "hello world" - - wr.Add(2) - go func() { - io.WriteString(writer, magic) - wr.Done() - }() - go func() { - io.WriteString(writer.Stderr(), magic) - wr.Done() - }() - - rd.Add(2) - go func() { - c, err := ioutil.ReadAll(reader) - if string(c) != magic { - t.Fatalf("stdout read got %q, want %q (error %s)", c, magic, err) - } - rd.Done() - }() - go func() { - c, err := ioutil.ReadAll(reader.Stderr()) - if string(c) != magic { - t.Fatalf("stderr read got %q, want %q (error %s)", c, magic, err) - } - rd.Done() - }() - - wr.Wait() - writer.CloseWrite() - rd.Wait() -} - -func TestMuxReadWrite(t *testing.T) { - s, c, mux := channelPair(t) - defer s.Close() - defer c.Close() - defer mux.Close() - - magic := "hello world" - magicExt := "hello stderr" - go func() { - _, err := s.Write([]byte(magic)) - if err != nil { - t.Fatalf("Write: %v", err) - } - _, err = s.Extended(1).Write([]byte(magicExt)) - if err != nil { - t.Fatalf("Write: %v", err) - } - err = s.Close() - if err != nil { - t.Fatalf("Close: %v", err) - } - }() - - var buf [1024]byte - n, err := c.Read(buf[:]) - if err != nil { - t.Fatalf("server Read: %v", err) - } - got := string(buf[:n]) - if got != magic { - t.Fatalf("server: got %q want %q", got, magic) - } - - n, err = c.Extended(1).Read(buf[:]) - if err != nil { - t.Fatalf("server Read: %v", err) - } - - got = string(buf[:n]) - if got != magicExt { - t.Fatalf("server: got %q want %q", got, magic) - } -} - -func TestMuxChannelOverflow(t *testing.T) { - reader, writer, mux := channelPair(t) - defer reader.Close() - defer writer.Close() - defer mux.Close() - - wDone := make(chan int, 1) - go func() { - if _, err := writer.Write(make([]byte, channelWindowSize)); err != nil { - t.Errorf("could not fill window: %v", err) - } - writer.Write(make([]byte, 1)) - wDone <- 1 - }() - writer.remoteWin.waitWriterBlocked() - - // Send 1 byte. - packet := make([]byte, 1+4+4+1) - packet[0] = msgChannelData - marshalUint32(packet[1:], writer.remoteId) - marshalUint32(packet[5:], uint32(1)) - packet[9] = 42 - - if err := writer.mux.conn.writePacket(packet); err != nil { - t.Errorf("could not send packet") - } - if _, err := reader.SendRequest("hello", true, nil); err == nil { - t.Errorf("SendRequest succeeded.") - } - <-wDone -} - -func TestMuxChannelCloseWriteUnblock(t *testing.T) { - reader, writer, mux := channelPair(t) - defer reader.Close() - defer writer.Close() - defer mux.Close() - - wDone := make(chan int, 1) - go func() { - if _, err := writer.Write(make([]byte, channelWindowSize)); err != nil { - t.Errorf("could not fill window: %v", err) - } - if _, err := writer.Write(make([]byte, 1)); err != io.EOF { - t.Errorf("got %v, want EOF for unblock write", err) - } - wDone <- 1 - }() - - writer.remoteWin.waitWriterBlocked() - reader.Close() - <-wDone -} - -func TestMuxConnectionCloseWriteUnblock(t *testing.T) { - reader, writer, mux := channelPair(t) - defer reader.Close() - defer writer.Close() - defer mux.Close() - - wDone := make(chan int, 1) - go func() { - if _, err := writer.Write(make([]byte, channelWindowSize)); err != nil { - t.Errorf("could not fill window: %v", err) - } - if _, err := writer.Write(make([]byte, 1)); err != io.EOF { - t.Errorf("got %v, want EOF for unblock write", err) - } - wDone <- 1 - }() - - writer.remoteWin.waitWriterBlocked() - mux.Close() - <-wDone -} - -func TestMuxReject(t *testing.T) { - client, server := muxPair() - defer server.Close() - defer client.Close() - - go func() { - ch, ok := <-server.incomingChannels - if !ok { - t.Fatalf("Accept") - } - if ch.ChannelType() != "ch" || string(ch.ExtraData()) != "extra" { - t.Fatalf("unexpected channel: %q, %q", ch.ChannelType(), ch.ExtraData()) - } - ch.Reject(RejectionReason(42), "message") - }() - - ch, err := client.openChannel("ch", []byte("extra")) - if ch != nil { - t.Fatal("openChannel not rejected") - } - - ocf, ok := err.(*OpenChannelError) - if !ok { - t.Errorf("got %#v want *OpenChannelError", err) - } else if ocf.Reason != 42 || ocf.Message != "message" { - t.Errorf("got %#v, want {Reason: 42, Message: %q}", ocf, "message") - } - - want := "ssh: rejected: unknown reason 42 (message)" - if err.Error() != want { - t.Errorf("got %q, want %q", err.Error(), want) - } -} - -func TestMuxChannelRequest(t *testing.T) { - client, server, mux := channelPair(t) - defer server.Close() - defer client.Close() - defer mux.Close() - - var received int - var wg sync.WaitGroup - wg.Add(1) - go func() { - for r := range server.incomingRequests { - received++ - r.Reply(r.Type == "yes", nil) - } - wg.Done() - }() - _, err := client.SendRequest("yes", false, nil) - if err != nil { - t.Fatalf("SendRequest: %v", err) - } - ok, err := client.SendRequest("yes", true, nil) - if err != nil { - t.Fatalf("SendRequest: %v", err) - } - - if !ok { - t.Errorf("SendRequest(yes): %v", ok) - - } - - ok, err = client.SendRequest("no", true, nil) - if err != nil { - t.Fatalf("SendRequest: %v", err) - } - if ok { - t.Errorf("SendRequest(no): %v", ok) - - } - - client.Close() - wg.Wait() - - if received != 3 { - t.Errorf("got %d requests, want %d", received, 3) - } -} - -func TestMuxGlobalRequest(t *testing.T) { - clientMux, serverMux := muxPair() - defer serverMux.Close() - defer clientMux.Close() - - var seen bool - go func() { - for r := range serverMux.incomingRequests { - seen = seen || r.Type == "peek" - if r.WantReply { - err := r.Reply(r.Type == "yes", - append([]byte(r.Type), r.Payload...)) - if err != nil { - t.Errorf("AckRequest: %v", err) - } - } - } - }() - - _, _, err := clientMux.SendRequest("peek", false, nil) - if err != nil { - t.Errorf("SendRequest: %v", err) - } - - ok, data, err := clientMux.SendRequest("yes", true, []byte("a")) - if !ok || string(data) != "yesa" || err != nil { - t.Errorf("SendRequest(\"yes\", true, \"a\"): %v %v %v", - ok, data, err) - } - if ok, data, err := clientMux.SendRequest("yes", true, []byte("a")); !ok || string(data) != "yesa" || err != nil { - t.Errorf("SendRequest(\"yes\", true, \"a\"): %v %v %v", - ok, data, err) - } - - if ok, data, err := clientMux.SendRequest("no", true, []byte("a")); ok || string(data) != "noa" || err != nil { - t.Errorf("SendRequest(\"no\", true, \"a\"): %v %v %v", - ok, data, err) - } - - clientMux.Disconnect(0, "") - if !seen { - t.Errorf("never saw 'peek' request") - } -} - -func TestMuxGlobalRequestUnblock(t *testing.T) { - clientMux, serverMux := muxPair() - defer serverMux.Close() - defer clientMux.Close() - - result := make(chan error, 1) - go func() { - _, _, err := clientMux.SendRequest("hello", true, nil) - result <- err - }() - - <-serverMux.incomingRequests - serverMux.conn.Close() - err := <-result - - if err != io.EOF { - t.Errorf("want EOF, got %v", io.EOF) - } -} - -func TestMuxChannelRequestUnblock(t *testing.T) { - a, b, connB := channelPair(t) - defer a.Close() - defer b.Close() - defer connB.Close() - - result := make(chan error, 1) - go func() { - _, err := a.SendRequest("hello", true, nil) - result <- err - }() - - <-b.incomingRequests - connB.conn.Close() - err := <-result - - if err != io.EOF { - t.Errorf("want EOF, got %v", err) - } -} - -func TestMuxDisconnect(t *testing.T) { - a, b := muxPair() - defer a.Close() - defer b.Close() - - go func() { - for r := range b.incomingRequests { - r.Reply(true, nil) - } - }() - - a.Disconnect(42, "whatever") - ok, _, err := a.SendRequest("hello", true, nil) - if ok || err == nil { - t.Errorf("got reply after disconnecting") - } - err = b.Wait() - if d, ok := err.(*disconnectMsg); !ok || d.Reason != 42 { - t.Errorf("got %#v, want disconnectMsg{Reason:42}", err) - } -} - -func TestMuxCloseChannel(t *testing.T) { - r, w, mux := channelPair(t) - defer mux.Close() - defer r.Close() - defer w.Close() - - result := make(chan error, 1) - go func() { - var b [1024]byte - _, err := r.Read(b[:]) - result <- err - }() - if err := w.Close(); err != nil { - t.Errorf("w.Close: %v", err) - } - - if _, err := w.Write([]byte("hello")); err != io.EOF { - t.Errorf("got err %v, want io.EOF after Close", err) - } - - if err := <-result; err != io.EOF { - t.Errorf("got %v (%T), want io.EOF", err, err) - } -} - -func TestMuxCloseWriteChannel(t *testing.T) { - r, w, mux := channelPair(t) - defer mux.Close() - - result := make(chan error, 1) - go func() { - var b [1024]byte - _, err := r.Read(b[:]) - result <- err - }() - if err := w.CloseWrite(); err != nil { - t.Errorf("w.CloseWrite: %v", err) - } - - if _, err := w.Write([]byte("hello")); err != io.EOF { - t.Errorf("got err %v, want io.EOF after CloseWrite", err) - } - - if err := <-result; err != io.EOF { - t.Errorf("got %v (%T), want io.EOF", err, err) - } -} - -func TestMuxInvalidRecord(t *testing.T) { - a, b := muxPair() - defer a.Close() - defer b.Close() - - packet := make([]byte, 1+4+4+1) - packet[0] = msgChannelData - marshalUint32(packet[1:], 29348723 /* invalid channel id */) - marshalUint32(packet[5:], 1) - packet[9] = 42 - - a.conn.writePacket(packet) - go a.SendRequest("hello", false, nil) - // 'a' wrote an invalid packet, so 'b' has exited. - req, ok := <-b.incomingRequests - if ok { - t.Errorf("got request %#v after receiving invalid packet", req) - } -} - -func TestZeroWindowAdjust(t *testing.T) { - a, b, mux := channelPair(t) - defer a.Close() - defer b.Close() - defer mux.Close() - - go func() { - io.WriteString(a, "hello") - // bogus adjust. - a.sendMessage(windowAdjustMsg{}) - io.WriteString(a, "world") - a.Close() - }() - - want := "helloworld" - c, _ := ioutil.ReadAll(b) - if string(c) != want { - t.Errorf("got %q want %q", c, want) - } -} - -func TestMuxMaxPacketSize(t *testing.T) { - a, b, mux := channelPair(t) - defer a.Close() - defer b.Close() - defer mux.Close() - - large := make([]byte, a.maxRemotePayload+1) - packet := make([]byte, 1+4+4+1+len(large)) - packet[0] = msgChannelData - marshalUint32(packet[1:], a.remoteId) - marshalUint32(packet[5:], uint32(len(large))) - packet[9] = 42 - - if err := a.mux.conn.writePacket(packet); err != nil { - t.Errorf("could not send packet") - } - - go a.SendRequest("hello", false, nil) - - _, ok := <-b.incomingRequests - if ok { - t.Errorf("connection still alive after receiving large packet.") - } -} - -// Don't ship code with debug=true. -func TestDebug(t *testing.T) { - if debugMux { - t.Error("mux debug switched on") - } - if debugHandshake { - t.Error("handshake debug switched on") - } -} diff --git a/vendor/golang.org/x/crypto/ssh/session_test.go b/vendor/golang.org/x/crypto/ssh/session_test.go deleted file mode 100644 index f7f0f7642e..0000000000 --- a/vendor/golang.org/x/crypto/ssh/session_test.go +++ /dev/null @@ -1,774 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssh - -// Session tests. - -import ( - "bytes" - crypto_rand "crypto/rand" - "errors" - "io" - "io/ioutil" - "math/rand" - "net" - "testing" - - "golang.org/x/crypto/ssh/terminal" -) - -type serverType func(Channel, <-chan *Request, *testing.T) - -// dial constructs a new test server and returns a *ClientConn. -func dial(handler serverType, t *testing.T) *Client { - c1, c2, err := netPipe() - if err != nil { - t.Fatalf("netPipe: %v", err) - } - - go func() { - defer c1.Close() - conf := ServerConfig{ - NoClientAuth: true, - } - conf.AddHostKey(testSigners["rsa"]) - - _, chans, reqs, err := NewServerConn(c1, &conf) - if err != nil { - t.Fatalf("Unable to handshake: %v", err) - } - go DiscardRequests(reqs) - - for newCh := range chans { - if newCh.ChannelType() != "session" { - newCh.Reject(UnknownChannelType, "unknown channel type") - continue - } - - ch, inReqs, err := newCh.Accept() - if err != nil { - t.Errorf("Accept: %v", err) - continue - } - go func() { - handler(ch, inReqs, t) - }() - } - }() - - config := &ClientConfig{ - User: "testuser", - } - - conn, chans, reqs, err := NewClientConn(c2, "", config) - if err != nil { - t.Fatalf("unable to dial remote side: %v", err) - } - - return NewClient(conn, chans, reqs) -} - -// Test a simple string is returned to session.Stdout. -func TestSessionShell(t *testing.T) { - conn := dial(shellHandler, t) - defer conn.Close() - session, err := conn.NewSession() - if err != nil { - t.Fatalf("Unable to request new session: %v", err) - } - defer session.Close() - stdout := new(bytes.Buffer) - session.Stdout = stdout - if err := session.Shell(); err != nil { - t.Fatalf("Unable to execute command: %s", err) - } - if err := session.Wait(); err != nil { - t.Fatalf("Remote command did not exit cleanly: %v", err) - } - actual := stdout.String() - if actual != "golang" { - t.Fatalf("Remote shell did not return expected string: expected=golang, actual=%s", actual) - } -} - -// TODO(dfc) add support for Std{in,err}Pipe when the Server supports it. - -// Test a simple string is returned via StdoutPipe. -func TestSessionStdoutPipe(t *testing.T) { - conn := dial(shellHandler, t) - defer conn.Close() - session, err := conn.NewSession() - if err != nil { - t.Fatalf("Unable to request new session: %v", err) - } - defer session.Close() - stdout, err := session.StdoutPipe() - if err != nil { - t.Fatalf("Unable to request StdoutPipe(): %v", err) - } - var buf bytes.Buffer - if err := session.Shell(); err != nil { - t.Fatalf("Unable to execute command: %v", err) - } - done := make(chan bool, 1) - go func() { - if _, err := io.Copy(&buf, stdout); err != nil { - t.Errorf("Copy of stdout failed: %v", err) - } - done <- true - }() - if err := session.Wait(); err != nil { - t.Fatalf("Remote command did not exit cleanly: %v", err) - } - <-done - actual := buf.String() - if actual != "golang" { - t.Fatalf("Remote shell did not return expected string: expected=golang, actual=%s", actual) - } -} - -// Test that a simple string is returned via the Output helper, -// and that stderr is discarded. -func TestSessionOutput(t *testing.T) { - conn := dial(fixedOutputHandler, t) - defer conn.Close() - session, err := conn.NewSession() - if err != nil { - t.Fatalf("Unable to request new session: %v", err) - } - defer session.Close() - - buf, err := session.Output("") // cmd is ignored by fixedOutputHandler - if err != nil { - t.Error("Remote command did not exit cleanly:", err) - } - w := "this-is-stdout." - g := string(buf) - if g != w { - t.Error("Remote command did not return expected string:") - t.Logf("want %q", w) - t.Logf("got %q", g) - } -} - -// Test that both stdout and stderr are returned -// via the CombinedOutput helper. -func TestSessionCombinedOutput(t *testing.T) { - conn := dial(fixedOutputHandler, t) - defer conn.Close() - session, err := conn.NewSession() - if err != nil { - t.Fatalf("Unable to request new session: %v", err) - } - defer session.Close() - - buf, err := session.CombinedOutput("") // cmd is ignored by fixedOutputHandler - if err != nil { - t.Error("Remote command did not exit cleanly:", err) - } - const stdout = "this-is-stdout." - const stderr = "this-is-stderr." - g := string(buf) - if g != stdout+stderr && g != stderr+stdout { - t.Error("Remote command did not return expected string:") - t.Logf("want %q, or %q", stdout+stderr, stderr+stdout) - t.Logf("got %q", g) - } -} - -// Test non-0 exit status is returned correctly. -func TestExitStatusNonZero(t *testing.T) { - conn := dial(exitStatusNonZeroHandler, t) - defer conn.Close() - session, err := conn.NewSession() - if err != nil { - t.Fatalf("Unable to request new session: %v", err) - } - defer session.Close() - if err := session.Shell(); err != nil { - t.Fatalf("Unable to execute command: %v", err) - } - err = session.Wait() - if err == nil { - t.Fatalf("expected command to fail but it didn't") - } - e, ok := err.(*ExitError) - if !ok { - t.Fatalf("expected *ExitError but got %T", err) - } - if e.ExitStatus() != 15 { - t.Fatalf("expected command to exit with 15 but got %v", e.ExitStatus()) - } -} - -// Test 0 exit status is returned correctly. -func TestExitStatusZero(t *testing.T) { - conn := dial(exitStatusZeroHandler, t) - defer conn.Close() - session, err := conn.NewSession() - if err != nil { - t.Fatalf("Unable to request new session: %v", err) - } - defer session.Close() - - if err := session.Shell(); err != nil { - t.Fatalf("Unable to execute command: %v", err) - } - err = session.Wait() - if err != nil { - t.Fatalf("expected nil but got %v", err) - } -} - -// Test exit signal and status are both returned correctly. -func TestExitSignalAndStatus(t *testing.T) { - conn := dial(exitSignalAndStatusHandler, t) - defer conn.Close() - session, err := conn.NewSession() - if err != nil { - t.Fatalf("Unable to request new session: %v", err) - } - defer session.Close() - if err := session.Shell(); err != nil { - t.Fatalf("Unable to execute command: %v", err) - } - err = session.Wait() - if err == nil { - t.Fatalf("expected command to fail but it didn't") - } - e, ok := err.(*ExitError) - if !ok { - t.Fatalf("expected *ExitError but got %T", err) - } - if e.Signal() != "TERM" || e.ExitStatus() != 15 { - t.Fatalf("expected command to exit with signal TERM and status 15 but got signal %s and status %v", e.Signal(), e.ExitStatus()) - } -} - -// Test exit signal and status are both returned correctly. -func TestKnownExitSignalOnly(t *testing.T) { - conn := dial(exitSignalHandler, t) - defer conn.Close() - session, err := conn.NewSession() - if err != nil { - t.Fatalf("Unable to request new session: %v", err) - } - defer session.Close() - if err := session.Shell(); err != nil { - t.Fatalf("Unable to execute command: %v", err) - } - err = session.Wait() - if err == nil { - t.Fatalf("expected command to fail but it didn't") - } - e, ok := err.(*ExitError) - if !ok { - t.Fatalf("expected *ExitError but got %T", err) - } - if e.Signal() != "TERM" || e.ExitStatus() != 143 { - t.Fatalf("expected command to exit with signal TERM and status 143 but got signal %s and status %v", e.Signal(), e.ExitStatus()) - } -} - -// Test exit signal and status are both returned correctly. -func TestUnknownExitSignal(t *testing.T) { - conn := dial(exitSignalUnknownHandler, t) - defer conn.Close() - session, err := conn.NewSession() - if err != nil { - t.Fatalf("Unable to request new session: %v", err) - } - defer session.Close() - if err := session.Shell(); err != nil { - t.Fatalf("Unable to execute command: %v", err) - } - err = session.Wait() - if err == nil { - t.Fatalf("expected command to fail but it didn't") - } - e, ok := err.(*ExitError) - if !ok { - t.Fatalf("expected *ExitError but got %T", err) - } - if e.Signal() != "SYS" || e.ExitStatus() != 128 { - t.Fatalf("expected command to exit with signal SYS and status 128 but got signal %s and status %v", e.Signal(), e.ExitStatus()) - } -} - -// Test WaitMsg is not returned if the channel closes abruptly. -func TestExitWithoutStatusOrSignal(t *testing.T) { - conn := dial(exitWithoutSignalOrStatus, t) - defer conn.Close() - session, err := conn.NewSession() - if err != nil { - t.Fatalf("Unable to request new session: %v", err) - } - defer session.Close() - if err := session.Shell(); err != nil { - t.Fatalf("Unable to execute command: %v", err) - } - err = session.Wait() - if err == nil { - t.Fatalf("expected command to fail but it didn't") - } - _, ok := err.(*ExitError) - if ok { - // you can't actually test for errors.errorString - // because it's not exported. - t.Fatalf("expected *errorString but got %T", err) - } -} - -// windowTestBytes is the number of bytes that we'll send to the SSH server. -const windowTestBytes = 16000 * 200 - -// TestServerWindow writes random data to the server. The server is expected to echo -// the same data back, which is compared against the original. -func TestServerWindow(t *testing.T) { - origBuf := bytes.NewBuffer(make([]byte, 0, windowTestBytes)) - io.CopyN(origBuf, crypto_rand.Reader, windowTestBytes) - origBytes := origBuf.Bytes() - - conn := dial(echoHandler, t) - defer conn.Close() - session, err := conn.NewSession() - if err != nil { - t.Fatal(err) - } - defer session.Close() - result := make(chan []byte) - - go func() { - defer close(result) - echoedBuf := bytes.NewBuffer(make([]byte, 0, windowTestBytes)) - serverStdout, err := session.StdoutPipe() - if err != nil { - t.Errorf("StdoutPipe failed: %v", err) - return - } - n, err := copyNRandomly("stdout", echoedBuf, serverStdout, windowTestBytes) - if err != nil && err != io.EOF { - t.Errorf("Read only %d bytes from server, expected %d: %v", n, windowTestBytes, err) - } - result <- echoedBuf.Bytes() - }() - - serverStdin, err := session.StdinPipe() - if err != nil { - t.Fatalf("StdinPipe failed: %v", err) - } - written, err := copyNRandomly("stdin", serverStdin, origBuf, windowTestBytes) - if err != nil { - t.Fatalf("failed to copy origBuf to serverStdin: %v", err) - } - if written != windowTestBytes { - t.Fatalf("Wrote only %d of %d bytes to server", written, windowTestBytes) - } - - echoedBytes := <-result - - if !bytes.Equal(origBytes, echoedBytes) { - t.Fatalf("Echoed buffer differed from original, orig %d, echoed %d", len(origBytes), len(echoedBytes)) - } -} - -// Verify the client can handle a keepalive packet from the server. -func TestClientHandlesKeepalives(t *testing.T) { - conn := dial(channelKeepaliveSender, t) - defer conn.Close() - session, err := conn.NewSession() - if err != nil { - t.Fatal(err) - } - defer session.Close() - if err := session.Shell(); err != nil { - t.Fatalf("Unable to execute command: %v", err) - } - err = session.Wait() - if err != nil { - t.Fatalf("expected nil but got: %v", err) - } -} - -type exitStatusMsg struct { - Status uint32 -} - -type exitSignalMsg struct { - Signal string - CoreDumped bool - Errmsg string - Lang string -} - -func handleTerminalRequests(in <-chan *Request) { - for req := range in { - ok := false - switch req.Type { - case "shell": - ok = true - if len(req.Payload) > 0 { - // We don't accept any commands, only the default shell. - ok = false - } - case "env": - ok = true - } - req.Reply(ok, nil) - } -} - -func newServerShell(ch Channel, in <-chan *Request, prompt string) *terminal.Terminal { - term := terminal.NewTerminal(ch, prompt) - go handleTerminalRequests(in) - return term -} - -func exitStatusZeroHandler(ch Channel, in <-chan *Request, t *testing.T) { - defer ch.Close() - // this string is returned to stdout - shell := newServerShell(ch, in, "> ") - readLine(shell, t) - sendStatus(0, ch, t) -} - -func exitStatusNonZeroHandler(ch Channel, in <-chan *Request, t *testing.T) { - defer ch.Close() - shell := newServerShell(ch, in, "> ") - readLine(shell, t) - sendStatus(15, ch, t) -} - -func exitSignalAndStatusHandler(ch Channel, in <-chan *Request, t *testing.T) { - defer ch.Close() - shell := newServerShell(ch, in, "> ") - readLine(shell, t) - sendStatus(15, ch, t) - sendSignal("TERM", ch, t) -} - -func exitSignalHandler(ch Channel, in <-chan *Request, t *testing.T) { - defer ch.Close() - shell := newServerShell(ch, in, "> ") - readLine(shell, t) - sendSignal("TERM", ch, t) -} - -func exitSignalUnknownHandler(ch Channel, in <-chan *Request, t *testing.T) { - defer ch.Close() - shell := newServerShell(ch, in, "> ") - readLine(shell, t) - sendSignal("SYS", ch, t) -} - -func exitWithoutSignalOrStatus(ch Channel, in <-chan *Request, t *testing.T) { - defer ch.Close() - shell := newServerShell(ch, in, "> ") - readLine(shell, t) -} - -func shellHandler(ch Channel, in <-chan *Request, t *testing.T) { - defer ch.Close() - // this string is returned to stdout - shell := newServerShell(ch, in, "golang") - readLine(shell, t) - sendStatus(0, ch, t) -} - -// Ignores the command, writes fixed strings to stderr and stdout. -// Strings are "this-is-stdout." and "this-is-stderr.". -func fixedOutputHandler(ch Channel, in <-chan *Request, t *testing.T) { - defer ch.Close() - _, err := ch.Read(nil) - - req, ok := <-in - if !ok { - t.Fatalf("error: expected channel request, got: %#v", err) - return - } - - // ignore request, always send some text - req.Reply(true, nil) - - _, err = io.WriteString(ch, "this-is-stdout.") - if err != nil { - t.Fatalf("error writing on server: %v", err) - } - _, err = io.WriteString(ch.Stderr(), "this-is-stderr.") - if err != nil { - t.Fatalf("error writing on server: %v", err) - } - sendStatus(0, ch, t) -} - -func readLine(shell *terminal.Terminal, t *testing.T) { - if _, err := shell.ReadLine(); err != nil && err != io.EOF { - t.Errorf("unable to read line: %v", err) - } -} - -func sendStatus(status uint32, ch Channel, t *testing.T) { - msg := exitStatusMsg{ - Status: status, - } - if _, err := ch.SendRequest("exit-status", false, Marshal(&msg)); err != nil { - t.Errorf("unable to send status: %v", err) - } -} - -func sendSignal(signal string, ch Channel, t *testing.T) { - sig := exitSignalMsg{ - Signal: signal, - CoreDumped: false, - Errmsg: "Process terminated", - Lang: "en-GB-oed", - } - if _, err := ch.SendRequest("exit-signal", false, Marshal(&sig)); err != nil { - t.Errorf("unable to send signal: %v", err) - } -} - -func discardHandler(ch Channel, t *testing.T) { - defer ch.Close() - io.Copy(ioutil.Discard, ch) -} - -func echoHandler(ch Channel, in <-chan *Request, t *testing.T) { - defer ch.Close() - if n, err := copyNRandomly("echohandler", ch, ch, windowTestBytes); err != nil { - t.Errorf("short write, wrote %d, expected %d: %v ", n, windowTestBytes, err) - } -} - -// copyNRandomly copies n bytes from src to dst. It uses a variable, and random, -// buffer size to exercise more code paths. -func copyNRandomly(title string, dst io.Writer, src io.Reader, n int) (int, error) { - var ( - buf = make([]byte, 32*1024) - written int - remaining = n - ) - for remaining > 0 { - l := rand.Intn(1 << 15) - if remaining < l { - l = remaining - } - nr, er := src.Read(buf[:l]) - nw, ew := dst.Write(buf[:nr]) - remaining -= nw - written += nw - if ew != nil { - return written, ew - } - if nr != nw { - return written, io.ErrShortWrite - } - if er != nil && er != io.EOF { - return written, er - } - } - return written, nil -} - -func channelKeepaliveSender(ch Channel, in <-chan *Request, t *testing.T) { - defer ch.Close() - shell := newServerShell(ch, in, "> ") - readLine(shell, t) - if _, err := ch.SendRequest("keepalive@openssh.com", true, nil); err != nil { - t.Errorf("unable to send channel keepalive request: %v", err) - } - sendStatus(0, ch, t) -} - -func TestClientWriteEOF(t *testing.T) { - conn := dial(simpleEchoHandler, t) - defer conn.Close() - - session, err := conn.NewSession() - if err != nil { - t.Fatal(err) - } - defer session.Close() - stdin, err := session.StdinPipe() - if err != nil { - t.Fatalf("StdinPipe failed: %v", err) - } - stdout, err := session.StdoutPipe() - if err != nil { - t.Fatalf("StdoutPipe failed: %v", err) - } - - data := []byte(`0000`) - _, err = stdin.Write(data) - if err != nil { - t.Fatalf("Write failed: %v", err) - } - stdin.Close() - - res, err := ioutil.ReadAll(stdout) - if err != nil { - t.Fatalf("Read failed: %v", err) - } - - if !bytes.Equal(data, res) { - t.Fatalf("Read differed from write, wrote: %v, read: %v", data, res) - } -} - -func simpleEchoHandler(ch Channel, in <-chan *Request, t *testing.T) { - defer ch.Close() - data, err := ioutil.ReadAll(ch) - if err != nil { - t.Errorf("handler read error: %v", err) - } - _, err = ch.Write(data) - if err != nil { - t.Errorf("handler write error: %v", err) - } -} - -func TestSessionID(t *testing.T) { - c1, c2, err := netPipe() - if err != nil { - t.Fatalf("netPipe: %v", err) - } - defer c1.Close() - defer c2.Close() - - serverID := make(chan []byte, 1) - clientID := make(chan []byte, 1) - - serverConf := &ServerConfig{ - NoClientAuth: true, - } - serverConf.AddHostKey(testSigners["ecdsa"]) - clientConf := &ClientConfig{ - User: "user", - } - - go func() { - conn, chans, reqs, err := NewServerConn(c1, serverConf) - if err != nil { - t.Fatalf("server handshake: %v", err) - } - serverID <- conn.SessionID() - go DiscardRequests(reqs) - for ch := range chans { - ch.Reject(Prohibited, "") - } - }() - - go func() { - conn, chans, reqs, err := NewClientConn(c2, "", clientConf) - if err != nil { - t.Fatalf("client handshake: %v", err) - } - clientID <- conn.SessionID() - go DiscardRequests(reqs) - for ch := range chans { - ch.Reject(Prohibited, "") - } - }() - - s := <-serverID - c := <-clientID - if bytes.Compare(s, c) != 0 { - t.Errorf("server session ID (%x) != client session ID (%x)", s, c) - } else if len(s) == 0 { - t.Errorf("client and server SessionID were empty.") - } -} - -type noReadConn struct { - readSeen bool - net.Conn -} - -func (c *noReadConn) Close() error { - return nil -} - -func (c *noReadConn) Read(b []byte) (int, error) { - c.readSeen = true - return 0, errors.New("noReadConn error") -} - -func TestInvalidServerConfiguration(t *testing.T) { - c1, c2, err := netPipe() - if err != nil { - t.Fatalf("netPipe: %v", err) - } - defer c1.Close() - defer c2.Close() - - serveConn := noReadConn{Conn: c1} - serverConf := &ServerConfig{} - - NewServerConn(&serveConn, serverConf) - if serveConn.readSeen { - t.Fatalf("NewServerConn attempted to Read() from Conn while configuration is missing host key") - } - - serverConf.AddHostKey(testSigners["ecdsa"]) - - NewServerConn(&serveConn, serverConf) - if serveConn.readSeen { - t.Fatalf("NewServerConn attempted to Read() from Conn while configuration is missing authentication method") - } -} - -func TestHostKeyAlgorithms(t *testing.T) { - serverConf := &ServerConfig{ - NoClientAuth: true, - } - serverConf.AddHostKey(testSigners["rsa"]) - serverConf.AddHostKey(testSigners["ecdsa"]) - - connect := func(clientConf *ClientConfig, want string) { - var alg string - clientConf.HostKeyCallback = func(h string, a net.Addr, key PublicKey) error { - alg = key.Type() - return nil - } - c1, c2, err := netPipe() - if err != nil { - t.Fatalf("netPipe: %v", err) - } - defer c1.Close() - defer c2.Close() - - go NewServerConn(c1, serverConf) - _, _, _, err = NewClientConn(c2, "", clientConf) - if err != nil { - t.Fatalf("NewClientConn: %v", err) - } - if alg != want { - t.Errorf("selected key algorithm %s, want %s", alg, want) - } - } - - // By default, we get the preferred algorithm, which is ECDSA 256. - - clientConf := &ClientConfig{} - connect(clientConf, KeyAlgoECDSA256) - - // Client asks for RSA explicitly. - clientConf.HostKeyAlgorithms = []string{KeyAlgoRSA} - connect(clientConf, KeyAlgoRSA) - - c1, c2, err := netPipe() - if err != nil { - t.Fatalf("netPipe: %v", err) - } - defer c1.Close() - defer c2.Close() - - go NewServerConn(c1, serverConf) - clientConf.HostKeyAlgorithms = []string{"nonexistent-hostkey-algo"} - _, _, _, err = NewClientConn(c2, "", clientConf) - if err == nil { - t.Fatal("succeeded connecting with unknown hostkey algorithm") - } -} diff --git a/vendor/golang.org/x/crypto/ssh/tcpip_test.go b/vendor/golang.org/x/crypto/ssh/tcpip_test.go deleted file mode 100644 index f1265cb496..0000000000 --- a/vendor/golang.org/x/crypto/ssh/tcpip_test.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssh - -import ( - "testing" -) - -func TestAutoPortListenBroken(t *testing.T) { - broken := "SSH-2.0-OpenSSH_5.9hh11" - works := "SSH-2.0-OpenSSH_6.1" - if !isBrokenOpenSSHVersion(broken) { - t.Errorf("version %q not marked as broken", broken) - } - if isBrokenOpenSSHVersion(works) { - t.Errorf("version %q marked as broken", works) - } -} diff --git a/vendor/golang.org/x/crypto/ssh/terminal/terminal_test.go b/vendor/golang.org/x/crypto/ssh/terminal/terminal_test.go deleted file mode 100644 index a663fe41b7..0000000000 --- a/vendor/golang.org/x/crypto/ssh/terminal/terminal_test.go +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package terminal - -import ( - "io" - "testing" -) - -type MockTerminal struct { - toSend []byte - bytesPerRead int - received []byte -} - -func (c *MockTerminal) Read(data []byte) (n int, err error) { - n = len(data) - if n == 0 { - return - } - if n > len(c.toSend) { - n = len(c.toSend) - } - if n == 0 { - return 0, io.EOF - } - if c.bytesPerRead > 0 && n > c.bytesPerRead { - n = c.bytesPerRead - } - copy(data, c.toSend[:n]) - c.toSend = c.toSend[n:] - return -} - -func (c *MockTerminal) Write(data []byte) (n int, err error) { - c.received = append(c.received, data...) - return len(data), nil -} - -func TestClose(t *testing.T) { - c := &MockTerminal{} - ss := NewTerminal(c, "> ") - line, err := ss.ReadLine() - if line != "" { - t.Errorf("Expected empty line but got: %s", line) - } - if err != io.EOF { - t.Errorf("Error should have been EOF but got: %s", err) - } -} - -var keyPressTests = []struct { - in string - line string - err error - throwAwayLines int -}{ - { - err: io.EOF, - }, - { - in: "\r", - line: "", - }, - { - in: "foo\r", - line: "foo", - }, - { - in: "a\x1b[Cb\r", // right - line: "ab", - }, - { - in: "a\x1b[Db\r", // left - line: "ba", - }, - { - in: "a\177b\r", // backspace - line: "b", - }, - { - in: "\x1b[A\r", // up - }, - { - in: "\x1b[B\r", // down - }, - { - in: "line\x1b[A\x1b[B\r", // up then down - line: "line", - }, - { - in: "line1\rline2\x1b[A\r", // recall previous line. - line: "line1", - throwAwayLines: 1, - }, - { - // recall two previous lines and append. - in: "line1\rline2\rline3\x1b[A\x1b[Axxx\r", - line: "line1xxx", - throwAwayLines: 2, - }, - { - // Ctrl-A to move to beginning of line followed by ^K to kill - // line. - in: "a b \001\013\r", - line: "", - }, - { - // Ctrl-A to move to beginning of line, Ctrl-E to move to end, - // finally ^K to kill nothing. - in: "a b \001\005\013\r", - line: "a b ", - }, - { - in: "\027\r", - line: "", - }, - { - in: "a\027\r", - line: "", - }, - { - in: "a \027\r", - line: "", - }, - { - in: "a b\027\r", - line: "a ", - }, - { - in: "a b \027\r", - line: "a ", - }, - { - in: "one two thr\x1b[D\027\r", - line: "one two r", - }, - { - in: "\013\r", - line: "", - }, - { - in: "a\013\r", - line: "a", - }, - { - in: "ab\x1b[D\013\r", - line: "a", - }, - { - in: "Ξεσκεπάζω\r", - line: "Ξεσκεπάζω", - }, - { - in: "£\r\x1b[A\177\r", // non-ASCII char, enter, up, backspace. - line: "", - throwAwayLines: 1, - }, - { - in: "£\r££\x1b[A\x1b[B\177\r", // non-ASCII char, enter, 2x non-ASCII, up, down, backspace, enter. - line: "£", - throwAwayLines: 1, - }, - { - // Ctrl-D at the end of the line should be ignored. - in: "a\004\r", - line: "a", - }, - { - // a, b, left, Ctrl-D should erase the b. - in: "ab\x1b[D\004\r", - line: "a", - }, - { - // a, b, c, d, left, left, ^U should erase to the beginning of - // the line. - in: "abcd\x1b[D\x1b[D\025\r", - line: "cd", - }, - { - // Bracketed paste mode: control sequences should be returned - // verbatim in paste mode. - in: "abc\x1b[200~de\177f\x1b[201~\177\r", - line: "abcde\177", - }, - { - // Enter in bracketed paste mode should still work. - in: "abc\x1b[200~d\refg\x1b[201~h\r", - line: "efgh", - throwAwayLines: 1, - }, - { - // Lines consisting entirely of pasted data should be indicated as such. - in: "\x1b[200~a\r", - line: "a", - err: ErrPasteIndicator, - }, -} - -func TestKeyPresses(t *testing.T) { - for i, test := range keyPressTests { - for j := 1; j < len(test.in); j++ { - c := &MockTerminal{ - toSend: []byte(test.in), - bytesPerRead: j, - } - ss := NewTerminal(c, "> ") - for k := 0; k < test.throwAwayLines; k++ { - _, err := ss.ReadLine() - if err != nil { - t.Errorf("Throwaway line %d from test %d resulted in error: %s", k, i, err) - } - } - line, err := ss.ReadLine() - if line != test.line { - t.Errorf("Line resulting from test %d (%d bytes per read) was '%s', expected '%s'", i, j, line, test.line) - break - } - if err != test.err { - t.Errorf("Error resulting from test %d (%d bytes per read) was '%v', expected '%v'", i, j, err, test.err) - break - } - } - } -} - -func TestPasswordNotSaved(t *testing.T) { - c := &MockTerminal{ - toSend: []byte("password\r\x1b[A\r"), - bytesPerRead: 1, - } - ss := NewTerminal(c, "> ") - pw, _ := ss.ReadPassword("> ") - if pw != "password" { - t.Fatalf("failed to read password, got %s", pw) - } - line, _ := ss.ReadLine() - if len(line) > 0 { - t.Fatalf("password was saved in history") - } -} - -var setSizeTests = []struct { - width, height int -}{ - {40, 13}, - {80, 24}, - {132, 43}, -} - -func TestTerminalSetSize(t *testing.T) { - for _, setSize := range setSizeTests { - c := &MockTerminal{ - toSend: []byte("password\r\x1b[A\r"), - bytesPerRead: 1, - } - ss := NewTerminal(c, "> ") - ss.SetSize(setSize.width, setSize.height) - pw, _ := ss.ReadPassword("Password: ") - if pw != "password" { - t.Fatalf("failed to read password, got %s", pw) - } - if string(c.received) != "Password: \r\n" { - t.Errorf("failed to set the temporary prompt expected %q, got %q", "Password: ", c.received) - } - } -} diff --git a/vendor/golang.org/x/crypto/ssh/test/agent_unix_test.go b/vendor/golang.org/x/crypto/ssh/test/agent_unix_test.go deleted file mode 100644 index f481253c9e..0000000000 --- a/vendor/golang.org/x/crypto/ssh/test/agent_unix_test.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux netbsd openbsd - -package test - -import ( - "bytes" - "testing" - - "golang.org/x/crypto/ssh" - "golang.org/x/crypto/ssh/agent" -) - -func TestAgentForward(t *testing.T) { - server := newServer(t) - defer server.Shutdown() - conn := server.Dial(clientConfig()) - defer conn.Close() - - keyring := agent.NewKeyring() - if err := keyring.Add(agent.AddedKey{PrivateKey: testPrivateKeys["dsa"]}); err != nil { - t.Fatalf("Error adding key: %s", err) - } - if err := keyring.Add(agent.AddedKey{ - PrivateKey: testPrivateKeys["dsa"], - ConfirmBeforeUse: true, - LifetimeSecs: 3600, - }); err != nil { - t.Fatalf("Error adding key with constraints: %s", err) - } - pub := testPublicKeys["dsa"] - - sess, err := conn.NewSession() - if err != nil { - t.Fatalf("NewSession: %v", err) - } - if err := agent.RequestAgentForwarding(sess); err != nil { - t.Fatalf("RequestAgentForwarding: %v", err) - } - - if err := agent.ForwardToAgent(conn, keyring); err != nil { - t.Fatalf("SetupForwardKeyring: %v", err) - } - out, err := sess.CombinedOutput("ssh-add -L") - if err != nil { - t.Fatalf("running ssh-add: %v, out %s", err, out) - } - key, _, _, _, err := ssh.ParseAuthorizedKey(out) - if err != nil { - t.Fatalf("ParseAuthorizedKey(%q): %v", out, err) - } - - if !bytes.Equal(key.Marshal(), pub.Marshal()) { - t.Fatalf("got key %s, want %s", ssh.MarshalAuthorizedKey(key), ssh.MarshalAuthorizedKey(pub)) - } -} diff --git a/vendor/golang.org/x/crypto/ssh/test/cert_test.go b/vendor/golang.org/x/crypto/ssh/test/cert_test.go deleted file mode 100644 index 364790f17d..0000000000 --- a/vendor/golang.org/x/crypto/ssh/test/cert_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux netbsd openbsd - -package test - -import ( - "crypto/rand" - "testing" - - "golang.org/x/crypto/ssh" -) - -func TestCertLogin(t *testing.T) { - s := newServer(t) - defer s.Shutdown() - - // Use a key different from the default. - clientKey := testSigners["dsa"] - caAuthKey := testSigners["ecdsa"] - cert := &ssh.Certificate{ - Key: clientKey.PublicKey(), - ValidPrincipals: []string{username()}, - CertType: ssh.UserCert, - ValidBefore: ssh.CertTimeInfinity, - } - if err := cert.SignCert(rand.Reader, caAuthKey); err != nil { - t.Fatalf("SetSignature: %v", err) - } - - certSigner, err := ssh.NewCertSigner(cert, clientKey) - if err != nil { - t.Fatalf("NewCertSigner: %v", err) - } - - conf := &ssh.ClientConfig{ - User: username(), - } - conf.Auth = append(conf.Auth, ssh.PublicKeys(certSigner)) - client, err := s.TryDial(conf) - if err != nil { - t.Fatalf("TryDial: %v", err) - } - client.Close() -} diff --git a/vendor/golang.org/x/crypto/ssh/test/forward_unix_test.go b/vendor/golang.org/x/crypto/ssh/test/forward_unix_test.go deleted file mode 100644 index 877a88cde3..0000000000 --- a/vendor/golang.org/x/crypto/ssh/test/forward_unix_test.go +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux netbsd openbsd - -package test - -import ( - "bytes" - "io" - "io/ioutil" - "math/rand" - "net" - "testing" - "time" -) - -func TestPortForward(t *testing.T) { - server := newServer(t) - defer server.Shutdown() - conn := server.Dial(clientConfig()) - defer conn.Close() - - sshListener, err := conn.Listen("tcp", "localhost:0") - if err != nil { - t.Fatal(err) - } - - go func() { - sshConn, err := sshListener.Accept() - if err != nil { - t.Fatalf("listen.Accept failed: %v", err) - } - - _, err = io.Copy(sshConn, sshConn) - if err != nil && err != io.EOF { - t.Fatalf("ssh client copy: %v", err) - } - sshConn.Close() - }() - - forwardedAddr := sshListener.Addr().String() - tcpConn, err := net.Dial("tcp", forwardedAddr) - if err != nil { - t.Fatalf("TCP dial failed: %v", err) - } - - readChan := make(chan []byte) - go func() { - data, _ := ioutil.ReadAll(tcpConn) - readChan <- data - }() - - // Invent some data. - data := make([]byte, 100*1000) - for i := range data { - data[i] = byte(i % 255) - } - - var sent []byte - for len(sent) < 1000*1000 { - // Send random sized chunks - m := rand.Intn(len(data)) - n, err := tcpConn.Write(data[:m]) - if err != nil { - break - } - sent = append(sent, data[:n]...) - } - if err := tcpConn.(*net.TCPConn).CloseWrite(); err != nil { - t.Errorf("tcpConn.CloseWrite: %v", err) - } - - read := <-readChan - - if len(sent) != len(read) { - t.Fatalf("got %d bytes, want %d", len(read), len(sent)) - } - if bytes.Compare(sent, read) != 0 { - t.Fatalf("read back data does not match") - } - - if err := sshListener.Close(); err != nil { - t.Fatalf("sshListener.Close: %v", err) - } - - // Check that the forward disappeared. - tcpConn, err = net.Dial("tcp", forwardedAddr) - if err == nil { - tcpConn.Close() - t.Errorf("still listening to %s after closing", forwardedAddr) - } -} - -func TestAcceptClose(t *testing.T) { - server := newServer(t) - defer server.Shutdown() - conn := server.Dial(clientConfig()) - - sshListener, err := conn.Listen("tcp", "localhost:0") - if err != nil { - t.Fatal(err) - } - - quit := make(chan error, 1) - go func() { - for { - c, err := sshListener.Accept() - if err != nil { - quit <- err - break - } - c.Close() - } - }() - sshListener.Close() - - select { - case <-time.After(1 * time.Second): - t.Errorf("timeout: listener did not close.") - case err := <-quit: - t.Logf("quit as expected (error %v)", err) - } -} - -// Check that listeners exit if the underlying client transport dies. -func TestPortForwardConnectionClose(t *testing.T) { - server := newServer(t) - defer server.Shutdown() - conn := server.Dial(clientConfig()) - - sshListener, err := conn.Listen("tcp", "localhost:0") - if err != nil { - t.Fatal(err) - } - - quit := make(chan error, 1) - go func() { - for { - c, err := sshListener.Accept() - if err != nil { - quit <- err - break - } - c.Close() - } - }() - - // It would be even nicer if we closed the server side, but it - // is more involved as the fd for that side is dup()ed. - server.clientConn.Close() - - select { - case <-time.After(1 * time.Second): - t.Errorf("timeout: listener did not close.") - case err := <-quit: - t.Logf("quit as expected (error %v)", err) - } -} diff --git a/vendor/golang.org/x/crypto/ssh/test/session_test.go b/vendor/golang.org/x/crypto/ssh/test/session_test.go deleted file mode 100644 index c0e714ba90..0000000000 --- a/vendor/golang.org/x/crypto/ssh/test/session_test.go +++ /dev/null @@ -1,340 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !windows - -package test - -// Session functional tests. - -import ( - "bytes" - "errors" - "io" - "strings" - "testing" - - "golang.org/x/crypto/ssh" -) - -func TestRunCommandSuccess(t *testing.T) { - server := newServer(t) - defer server.Shutdown() - conn := server.Dial(clientConfig()) - defer conn.Close() - - session, err := conn.NewSession() - if err != nil { - t.Fatalf("session failed: %v", err) - } - defer session.Close() - err = session.Run("true") - if err != nil { - t.Fatalf("session failed: %v", err) - } -} - -func TestHostKeyCheck(t *testing.T) { - server := newServer(t) - defer server.Shutdown() - - conf := clientConfig() - hostDB := hostKeyDB() - conf.HostKeyCallback = hostDB.Check - - // change the keys. - hostDB.keys[ssh.KeyAlgoRSA][25]++ - hostDB.keys[ssh.KeyAlgoDSA][25]++ - hostDB.keys[ssh.KeyAlgoECDSA256][25]++ - - conn, err := server.TryDial(conf) - if err == nil { - conn.Close() - t.Fatalf("dial should have failed.") - } else if !strings.Contains(err.Error(), "host key mismatch") { - t.Fatalf("'host key mismatch' not found in %v", err) - } -} - -func TestRunCommandStdin(t *testing.T) { - server := newServer(t) - defer server.Shutdown() - conn := server.Dial(clientConfig()) - defer conn.Close() - - session, err := conn.NewSession() - if err != nil { - t.Fatalf("session failed: %v", err) - } - defer session.Close() - - r, w := io.Pipe() - defer r.Close() - defer w.Close() - session.Stdin = r - - err = session.Run("true") - if err != nil { - t.Fatalf("session failed: %v", err) - } -} - -func TestRunCommandStdinError(t *testing.T) { - server := newServer(t) - defer server.Shutdown() - conn := server.Dial(clientConfig()) - defer conn.Close() - - session, err := conn.NewSession() - if err != nil { - t.Fatalf("session failed: %v", err) - } - defer session.Close() - - r, w := io.Pipe() - defer r.Close() - session.Stdin = r - pipeErr := errors.New("closing write end of pipe") - w.CloseWithError(pipeErr) - - err = session.Run("true") - if err != pipeErr { - t.Fatalf("expected %v, found %v", pipeErr, err) - } -} - -func TestRunCommandFailed(t *testing.T) { - server := newServer(t) - defer server.Shutdown() - conn := server.Dial(clientConfig()) - defer conn.Close() - - session, err := conn.NewSession() - if err != nil { - t.Fatalf("session failed: %v", err) - } - defer session.Close() - err = session.Run(`bash -c "kill -9 $$"`) - if err == nil { - t.Fatalf("session succeeded: %v", err) - } -} - -func TestRunCommandWeClosed(t *testing.T) { - server := newServer(t) - defer server.Shutdown() - conn := server.Dial(clientConfig()) - defer conn.Close() - - session, err := conn.NewSession() - if err != nil { - t.Fatalf("session failed: %v", err) - } - err = session.Shell() - if err != nil { - t.Fatalf("shell failed: %v", err) - } - err = session.Close() - if err != nil { - t.Fatalf("shell failed: %v", err) - } -} - -func TestFuncLargeRead(t *testing.T) { - server := newServer(t) - defer server.Shutdown() - conn := server.Dial(clientConfig()) - defer conn.Close() - - session, err := conn.NewSession() - if err != nil { - t.Fatalf("unable to create new session: %s", err) - } - - stdout, err := session.StdoutPipe() - if err != nil { - t.Fatalf("unable to acquire stdout pipe: %s", err) - } - - err = session.Start("dd if=/dev/urandom bs=2048 count=1024") - if err != nil { - t.Fatalf("unable to execute remote command: %s", err) - } - - buf := new(bytes.Buffer) - n, err := io.Copy(buf, stdout) - if err != nil { - t.Fatalf("error reading from remote stdout: %s", err) - } - - if n != 2048*1024 { - t.Fatalf("Expected %d bytes but read only %d from remote command", 2048, n) - } -} - -func TestKeyChange(t *testing.T) { - server := newServer(t) - defer server.Shutdown() - conf := clientConfig() - hostDB := hostKeyDB() - conf.HostKeyCallback = hostDB.Check - conf.RekeyThreshold = 1024 - conn := server.Dial(conf) - defer conn.Close() - - for i := 0; i < 4; i++ { - session, err := conn.NewSession() - if err != nil { - t.Fatalf("unable to create new session: %s", err) - } - - stdout, err := session.StdoutPipe() - if err != nil { - t.Fatalf("unable to acquire stdout pipe: %s", err) - } - - err = session.Start("dd if=/dev/urandom bs=1024 count=1") - if err != nil { - t.Fatalf("unable to execute remote command: %s", err) - } - buf := new(bytes.Buffer) - n, err := io.Copy(buf, stdout) - if err != nil { - t.Fatalf("error reading from remote stdout: %s", err) - } - - want := int64(1024) - if n != want { - t.Fatalf("Expected %d bytes but read only %d from remote command", want, n) - } - } - - if changes := hostDB.checkCount; changes < 4 { - t.Errorf("got %d key changes, want 4", changes) - } -} - -func TestInvalidTerminalMode(t *testing.T) { - server := newServer(t) - defer server.Shutdown() - conn := server.Dial(clientConfig()) - defer conn.Close() - - session, err := conn.NewSession() - if err != nil { - t.Fatalf("session failed: %v", err) - } - defer session.Close() - - if err = session.RequestPty("vt100", 80, 40, ssh.TerminalModes{255: 1984}); err == nil { - t.Fatalf("req-pty failed: successful request with invalid mode") - } -} - -func TestValidTerminalMode(t *testing.T) { - server := newServer(t) - defer server.Shutdown() - conn := server.Dial(clientConfig()) - defer conn.Close() - - session, err := conn.NewSession() - if err != nil { - t.Fatalf("session failed: %v", err) - } - defer session.Close() - - stdout, err := session.StdoutPipe() - if err != nil { - t.Fatalf("unable to acquire stdout pipe: %s", err) - } - - stdin, err := session.StdinPipe() - if err != nil { - t.Fatalf("unable to acquire stdin pipe: %s", err) - } - - tm := ssh.TerminalModes{ssh.ECHO: 0} - if err = session.RequestPty("xterm", 80, 40, tm); err != nil { - t.Fatalf("req-pty failed: %s", err) - } - - err = session.Shell() - if err != nil { - t.Fatalf("session failed: %s", err) - } - - stdin.Write([]byte("stty -a && exit\n")) - - var buf bytes.Buffer - if _, err := io.Copy(&buf, stdout); err != nil { - t.Fatalf("reading failed: %s", err) - } - - if sttyOutput := buf.String(); !strings.Contains(sttyOutput, "-echo ") { - t.Fatalf("terminal mode failure: expected -echo in stty output, got %s", sttyOutput) - } -} - -func TestCiphers(t *testing.T) { - var config ssh.Config - config.SetDefaults() - cipherOrder := config.Ciphers - // This cipher will not be tested when commented out in cipher.go it will - // fallback to the next available as per line 292. - cipherOrder = append(cipherOrder, "aes128-cbc") - - for _, ciph := range cipherOrder { - server := newServer(t) - defer server.Shutdown() - conf := clientConfig() - conf.Ciphers = []string{ciph} - // Don't fail if sshd doesnt have the cipher. - conf.Ciphers = append(conf.Ciphers, cipherOrder...) - conn, err := server.TryDial(conf) - if err == nil { - conn.Close() - } else { - t.Fatalf("failed for cipher %q", ciph) - } - } -} - -func TestMACs(t *testing.T) { - var config ssh.Config - config.SetDefaults() - macOrder := config.MACs - - for _, mac := range macOrder { - server := newServer(t) - defer server.Shutdown() - conf := clientConfig() - conf.MACs = []string{mac} - // Don't fail if sshd doesnt have the MAC. - conf.MACs = append(conf.MACs, macOrder...) - if conn, err := server.TryDial(conf); err == nil { - conn.Close() - } else { - t.Fatalf("failed for MAC %q", mac) - } - } -} - -func TestKeyExchanges(t *testing.T) { - var config ssh.Config - config.SetDefaults() - kexOrder := config.KeyExchanges - for _, kex := range kexOrder { - server := newServer(t) - defer server.Shutdown() - conf := clientConfig() - // Don't fail if sshd doesnt have the kex. - conf.KeyExchanges = append([]string{kex}, kexOrder...) - conn, err := server.TryDial(conf) - if err == nil { - conn.Close() - } else { - t.Errorf("failed for kex %q", kex) - } - } -} diff --git a/vendor/golang.org/x/crypto/ssh/test/tcpip_test.go b/vendor/golang.org/x/crypto/ssh/test/tcpip_test.go deleted file mode 100644 index a2eb9358d0..0000000000 --- a/vendor/golang.org/x/crypto/ssh/test/tcpip_test.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !windows - -package test - -// direct-tcpip functional tests - -import ( - "io" - "net" - "testing" -) - -func TestDial(t *testing.T) { - server := newServer(t) - defer server.Shutdown() - sshConn := server.Dial(clientConfig()) - defer sshConn.Close() - - l, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - t.Fatalf("Listen: %v", err) - } - defer l.Close() - - go func() { - for { - c, err := l.Accept() - if err != nil { - break - } - - io.WriteString(c, c.RemoteAddr().String()) - c.Close() - } - }() - - conn, err := sshConn.Dial("tcp", l.Addr().String()) - if err != nil { - t.Fatalf("Dial: %v", err) - } - defer conn.Close() -} diff --git a/vendor/golang.org/x/crypto/ssh/test/test_unix_test.go b/vendor/golang.org/x/crypto/ssh/test/test_unix_test.go deleted file mode 100644 index f1fc50b2e4..0000000000 --- a/vendor/golang.org/x/crypto/ssh/test/test_unix_test.go +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux netbsd openbsd plan9 - -package test - -// functional test harness for unix. - -import ( - "bytes" - "fmt" - "io/ioutil" - "log" - "net" - "os" - "os/exec" - "os/user" - "path/filepath" - "testing" - "text/template" - - "golang.org/x/crypto/ssh" - "golang.org/x/crypto/ssh/testdata" -) - -const sshd_config = ` -Protocol 2 -HostKey {{.Dir}}/id_rsa -HostKey {{.Dir}}/id_dsa -HostKey {{.Dir}}/id_ecdsa -Pidfile {{.Dir}}/sshd.pid -#UsePrivilegeSeparation no -KeyRegenerationInterval 3600 -ServerKeyBits 768 -SyslogFacility AUTH -LogLevel DEBUG2 -LoginGraceTime 120 -PermitRootLogin no -StrictModes no -RSAAuthentication yes -PubkeyAuthentication yes -AuthorizedKeysFile {{.Dir}}/id_user.pub -TrustedUserCAKeys {{.Dir}}/id_ecdsa.pub -IgnoreRhosts yes -RhostsRSAAuthentication no -HostbasedAuthentication no -` - -var configTmpl = template.Must(template.New("").Parse(sshd_config)) - -type server struct { - t *testing.T - cleanup func() // executed during Shutdown - configfile string - cmd *exec.Cmd - output bytes.Buffer // holds stderr from sshd process - - // Client half of the network connection. - clientConn net.Conn -} - -func username() string { - var username string - if user, err := user.Current(); err == nil { - username = user.Username - } else { - // user.Current() currently requires cgo. If an error is - // returned attempt to get the username from the environment. - log.Printf("user.Current: %v; falling back on $USER", err) - username = os.Getenv("USER") - } - if username == "" { - panic("Unable to get username") - } - return username -} - -type storedHostKey struct { - // keys map from an algorithm string to binary key data. - keys map[string][]byte - - // checkCount counts the Check calls. Used for testing - // rekeying. - checkCount int -} - -func (k *storedHostKey) Add(key ssh.PublicKey) { - if k.keys == nil { - k.keys = map[string][]byte{} - } - k.keys[key.Type()] = key.Marshal() -} - -func (k *storedHostKey) Check(addr string, remote net.Addr, key ssh.PublicKey) error { - k.checkCount++ - algo := key.Type() - - if k.keys == nil || bytes.Compare(key.Marshal(), k.keys[algo]) != 0 { - return fmt.Errorf("host key mismatch. Got %q, want %q", key, k.keys[algo]) - } - return nil -} - -func hostKeyDB() *storedHostKey { - keyChecker := &storedHostKey{} - keyChecker.Add(testPublicKeys["ecdsa"]) - keyChecker.Add(testPublicKeys["rsa"]) - keyChecker.Add(testPublicKeys["dsa"]) - return keyChecker -} - -func clientConfig() *ssh.ClientConfig { - config := &ssh.ClientConfig{ - User: username(), - Auth: []ssh.AuthMethod{ - ssh.PublicKeys(testSigners["user"]), - }, - HostKeyCallback: hostKeyDB().Check, - } - return config -} - -// unixConnection creates two halves of a connected net.UnixConn. It -// is used for connecting the Go SSH client with sshd without opening -// ports. -func unixConnection() (*net.UnixConn, *net.UnixConn, error) { - dir, err := ioutil.TempDir("", "unixConnection") - if err != nil { - return nil, nil, err - } - defer os.Remove(dir) - - addr := filepath.Join(dir, "ssh") - listener, err := net.Listen("unix", addr) - if err != nil { - return nil, nil, err - } - defer listener.Close() - c1, err := net.Dial("unix", addr) - if err != nil { - return nil, nil, err - } - - c2, err := listener.Accept() - if err != nil { - c1.Close() - return nil, nil, err - } - - return c1.(*net.UnixConn), c2.(*net.UnixConn), nil -} - -func (s *server) TryDial(config *ssh.ClientConfig) (*ssh.Client, error) { - sshd, err := exec.LookPath("sshd") - if err != nil { - s.t.Skipf("skipping test: %v", err) - } - - c1, c2, err := unixConnection() - if err != nil { - s.t.Fatalf("unixConnection: %v", err) - } - - s.cmd = exec.Command(sshd, "-f", s.configfile, "-i", "-e") - f, err := c2.File() - if err != nil { - s.t.Fatalf("UnixConn.File: %v", err) - } - defer f.Close() - s.cmd.Stdin = f - s.cmd.Stdout = f - s.cmd.Stderr = &s.output - if err := s.cmd.Start(); err != nil { - s.t.Fail() - s.Shutdown() - s.t.Fatalf("s.cmd.Start: %v", err) - } - s.clientConn = c1 - conn, chans, reqs, err := ssh.NewClientConn(c1, "", config) - if err != nil { - return nil, err - } - return ssh.NewClient(conn, chans, reqs), nil -} - -func (s *server) Dial(config *ssh.ClientConfig) *ssh.Client { - conn, err := s.TryDial(config) - if err != nil { - s.t.Fail() - s.Shutdown() - s.t.Fatalf("ssh.Client: %v", err) - } - return conn -} - -func (s *server) Shutdown() { - if s.cmd != nil && s.cmd.Process != nil { - // Don't check for errors; if it fails it's most - // likely "os: process already finished", and we don't - // care about that. Use os.Interrupt, so child - // processes are killed too. - s.cmd.Process.Signal(os.Interrupt) - s.cmd.Wait() - } - if s.t.Failed() { - // log any output from sshd process - s.t.Logf("sshd: %s", s.output.String()) - } - s.cleanup() -} - -func writeFile(path string, contents []byte) { - f, err := os.OpenFile(path, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0600) - if err != nil { - panic(err) - } - defer f.Close() - if _, err := f.Write(contents); err != nil { - panic(err) - } -} - -// newServer returns a new mock ssh server. -func newServer(t *testing.T) *server { - if testing.Short() { - t.Skip("skipping test due to -short") - } - dir, err := ioutil.TempDir("", "sshtest") - if err != nil { - t.Fatal(err) - } - f, err := os.Create(filepath.Join(dir, "sshd_config")) - if err != nil { - t.Fatal(err) - } - err = configTmpl.Execute(f, map[string]string{ - "Dir": dir, - }) - if err != nil { - t.Fatal(err) - } - f.Close() - - for k, v := range testdata.PEMBytes { - filename := "id_" + k - writeFile(filepath.Join(dir, filename), v) - writeFile(filepath.Join(dir, filename+".pub"), ssh.MarshalAuthorizedKey(testPublicKeys[k])) - } - - return &server{ - t: t, - configfile: f.Name(), - cleanup: func() { - if err := os.RemoveAll(dir); err != nil { - t.Error(err) - } - }, - } -} diff --git a/vendor/golang.org/x/crypto/ssh/test/testdata_test.go b/vendor/golang.org/x/crypto/ssh/test/testdata_test.go deleted file mode 100644 index ae48c7516c..0000000000 --- a/vendor/golang.org/x/crypto/ssh/test/testdata_test.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// IMPLEMENTOR NOTE: To avoid a package loop, this file is in three places: -// ssh/, ssh/agent, and ssh/test/. It should be kept in sync across all three -// instances. - -package test - -import ( - "crypto/rand" - "fmt" - - "golang.org/x/crypto/ssh" - "golang.org/x/crypto/ssh/testdata" -) - -var ( - testPrivateKeys map[string]interface{} - testSigners map[string]ssh.Signer - testPublicKeys map[string]ssh.PublicKey -) - -func init() { - var err error - - n := len(testdata.PEMBytes) - testPrivateKeys = make(map[string]interface{}, n) - testSigners = make(map[string]ssh.Signer, n) - testPublicKeys = make(map[string]ssh.PublicKey, n) - for t, k := range testdata.PEMBytes { - testPrivateKeys[t], err = ssh.ParseRawPrivateKey(k) - if err != nil { - panic(fmt.Sprintf("Unable to parse test key %s: %v", t, err)) - } - testSigners[t], err = ssh.NewSignerFromKey(testPrivateKeys[t]) - if err != nil { - panic(fmt.Sprintf("Unable to create signer for test key %s: %v", t, err)) - } - testPublicKeys[t] = testSigners[t].PublicKey() - } - - // Create a cert and sign it for use in tests. - testCert := &ssh.Certificate{ - Nonce: []byte{}, // To pass reflect.DeepEqual after marshal & parse, this must be non-nil - ValidPrincipals: []string{"gopher1", "gopher2"}, // increases test coverage - ValidAfter: 0, // unix epoch - ValidBefore: ssh.CertTimeInfinity, // The end of currently representable time. - Reserved: []byte{}, // To pass reflect.DeepEqual after marshal & parse, this must be non-nil - Key: testPublicKeys["ecdsa"], - SignatureKey: testPublicKeys["rsa"], - Permissions: ssh.Permissions{ - CriticalOptions: map[string]string{}, - Extensions: map[string]string{}, - }, - } - testCert.SignCert(rand.Reader, testSigners["rsa"]) - testPrivateKeys["cert"] = testPrivateKeys["ecdsa"] - testSigners["cert"], err = ssh.NewCertSigner(testCert, testSigners["ecdsa"]) - if err != nil { - panic(fmt.Sprintf("Unable to create certificate signer: %v", err)) - } -} diff --git a/vendor/golang.org/x/crypto/ssh/testdata/doc.go b/vendor/golang.org/x/crypto/ssh/testdata/doc.go deleted file mode 100644 index ae7bd8b89e..0000000000 --- a/vendor/golang.org/x/crypto/ssh/testdata/doc.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This package contains test data shared between the various subpackages of -// the golang.org/x/crypto/ssh package. Under no circumstance should -// this data be used for production code. -package testdata diff --git a/vendor/golang.org/x/crypto/ssh/testdata/keys.go b/vendor/golang.org/x/crypto/ssh/testdata/keys.go deleted file mode 100644 index 5ff1c0e035..0000000000 --- a/vendor/golang.org/x/crypto/ssh/testdata/keys.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package testdata - -var PEMBytes = map[string][]byte{ - "dsa": []byte(`-----BEGIN DSA PRIVATE KEY----- -MIIBuwIBAAKBgQD6PDSEyXiI9jfNs97WuM46MSDCYlOqWw80ajN16AohtBncs1YB -lHk//dQOvCYOsYaE+gNix2jtoRjwXhDsc25/IqQbU1ahb7mB8/rsaILRGIbA5WH3 -EgFtJmXFovDz3if6F6TzvhFpHgJRmLYVR8cqsezL3hEZOvvs2iH7MorkxwIVAJHD -nD82+lxh2fb4PMsIiaXudAsBAoGAQRf7Q/iaPRn43ZquUhd6WwvirqUj+tkIu6eV -2nZWYmXLlqFQKEy4Tejl7Wkyzr2OSYvbXLzo7TNxLKoWor6ips0phYPPMyXld14r -juhT24CrhOzuLMhDduMDi032wDIZG4Y+K7ElU8Oufn8Sj5Wge8r6ANmmVgmFfynr -FhdYCngCgYEA3ucGJ93/Mx4q4eKRDxcWD3QzWyqpbRVRRV1Vmih9Ha/qC994nJFz -DQIdjxDIT2Rk2AGzMqFEB68Zc3O+Wcsmz5eWWzEwFxaTwOGWTyDqsDRLm3fD+QYj -nOwuxb0Kce+gWI8voWcqC9cyRm09jGzu2Ab3Bhtpg8JJ8L7gS3MRZK4CFEx4UAfY -Fmsr0W6fHB9nhS4/UXM8 ------END DSA PRIVATE KEY----- -`), - "ecdsa": []byte(`-----BEGIN EC PRIVATE KEY----- -MHcCAQEEINGWx0zo6fhJ/0EAfrPzVFyFC9s18lBt3cRoEDhS3ARooAoGCCqGSM49 -AwEHoUQDQgAEi9Hdw6KvZcWxfg2IDhA7UkpDtzzt6ZqJXSsFdLd+Kx4S3Sx4cVO+ -6/ZOXRnPmNAlLUqjShUsUBBngG0u2fqEqA== ------END EC PRIVATE KEY----- -`), - "rsa": []byte(`-----BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBALdGZxkXDAjsYk10ihwU6Id2KeILz1TAJuoq4tOgDWxEEGeTrcld -r/ZwVaFzjWzxaf6zQIJbfaSEAhqD5yo72+sCAwEAAQJBAK8PEVU23Wj8mV0QjwcJ -tZ4GcTUYQL7cF4+ezTCE9a1NrGnCP2RuQkHEKxuTVrxXt+6OF15/1/fuXnxKjmJC -nxkCIQDaXvPPBi0c7vAxGwNY9726x01/dNbHCE0CBtcotobxpwIhANbbQbh3JHVW -2haQh4fAG5mhesZKAGcxTyv4mQ7uMSQdAiAj+4dzMpJWdSzQ+qGHlHMIBvVHLkqB -y2VdEyF7DPCZewIhAI7GOI/6LDIFOvtPo6Bj2nNmyQ1HU6k/LRtNIXi4c9NJAiAr -rrxx26itVhJmcvoUhOjwuzSlP2bE5VHAvkGB352YBg== ------END RSA PRIVATE KEY----- -`), - "user": []byte(`-----BEGIN EC PRIVATE KEY----- -MHcCAQEEILYCAeq8f7V4vSSypRw7pxy8yz3V5W4qg8kSC3zJhqpQoAoGCCqGSM49 -AwEHoUQDQgAEYcO2xNKiRUYOLEHM7VYAp57HNyKbOdYtHD83Z4hzNPVC4tM5mdGD -PLL8IEwvYu2wq+lpXfGQnNMbzYf9gspG0w== ------END EC PRIVATE KEY----- -`), -} diff --git a/vendor/golang.org/x/crypto/ssh/testdata_test.go b/vendor/golang.org/x/crypto/ssh/testdata_test.go deleted file mode 100644 index f2828c1b5f..0000000000 --- a/vendor/golang.org/x/crypto/ssh/testdata_test.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// IMPLEMENTOR NOTE: To avoid a package loop, this file is in three places: -// ssh/, ssh/agent, and ssh/test/. It should be kept in sync across all three -// instances. - -package ssh - -import ( - "crypto/rand" - "fmt" - - "golang.org/x/crypto/ssh/testdata" -) - -var ( - testPrivateKeys map[string]interface{} - testSigners map[string]Signer - testPublicKeys map[string]PublicKey -) - -func init() { - var err error - - n := len(testdata.PEMBytes) - testPrivateKeys = make(map[string]interface{}, n) - testSigners = make(map[string]Signer, n) - testPublicKeys = make(map[string]PublicKey, n) - for t, k := range testdata.PEMBytes { - testPrivateKeys[t], err = ParseRawPrivateKey(k) - if err != nil { - panic(fmt.Sprintf("Unable to parse test key %s: %v", t, err)) - } - testSigners[t], err = NewSignerFromKey(testPrivateKeys[t]) - if err != nil { - panic(fmt.Sprintf("Unable to create signer for test key %s: %v", t, err)) - } - testPublicKeys[t] = testSigners[t].PublicKey() - } - - // Create a cert and sign it for use in tests. - testCert := &Certificate{ - Nonce: []byte{}, // To pass reflect.DeepEqual after marshal & parse, this must be non-nil - ValidPrincipals: []string{"gopher1", "gopher2"}, // increases test coverage - ValidAfter: 0, // unix epoch - ValidBefore: CertTimeInfinity, // The end of currently representable time. - Reserved: []byte{}, // To pass reflect.DeepEqual after marshal & parse, this must be non-nil - Key: testPublicKeys["ecdsa"], - SignatureKey: testPublicKeys["rsa"], - Permissions: Permissions{ - CriticalOptions: map[string]string{}, - Extensions: map[string]string{}, - }, - } - testCert.SignCert(rand.Reader, testSigners["rsa"]) - testPrivateKeys["cert"] = testPrivateKeys["ecdsa"] - testSigners["cert"], err = NewCertSigner(testCert, testSigners["ecdsa"]) - if err != nil { - panic(fmt.Sprintf("Unable to create certificate signer: %v", err)) - } -} diff --git a/vendor/golang.org/x/crypto/ssh/transport_test.go b/vendor/golang.org/x/crypto/ssh/transport_test.go deleted file mode 100644 index 92d83abf93..0000000000 --- a/vendor/golang.org/x/crypto/ssh/transport_test.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssh - -import ( - "bytes" - "crypto/rand" - "encoding/binary" - "strings" - "testing" -) - -func TestReadVersion(t *testing.T) { - longversion := strings.Repeat("SSH-2.0-bla", 50)[:253] - cases := map[string]string{ - "SSH-2.0-bla\r\n": "SSH-2.0-bla", - "SSH-2.0-bla\n": "SSH-2.0-bla", - longversion + "\r\n": longversion, - } - - for in, want := range cases { - result, err := readVersion(bytes.NewBufferString(in)) - if err != nil { - t.Errorf("readVersion(%q): %s", in, err) - } - got := string(result) - if got != want { - t.Errorf("got %q, want %q", got, want) - } - } -} - -func TestReadVersionError(t *testing.T) { - longversion := strings.Repeat("SSH-2.0-bla", 50)[:253] - cases := []string{ - longversion + "too-long\r\n", - } - for _, in := range cases { - if _, err := readVersion(bytes.NewBufferString(in)); err == nil { - t.Errorf("readVersion(%q) should have failed", in) - } - } -} - -func TestExchangeVersionsBasic(t *testing.T) { - v := "SSH-2.0-bla" - buf := bytes.NewBufferString(v + "\r\n") - them, err := exchangeVersions(buf, []byte("xyz")) - if err != nil { - t.Errorf("exchangeVersions: %v", err) - } - - if want := "SSH-2.0-bla"; string(them) != want { - t.Errorf("got %q want %q for our version", them, want) - } -} - -func TestExchangeVersions(t *testing.T) { - cases := []string{ - "not\x000allowed", - "not allowed\n", - } - for _, c := range cases { - buf := bytes.NewBufferString("SSH-2.0-bla\r\n") - if _, err := exchangeVersions(buf, []byte(c)); err == nil { - t.Errorf("exchangeVersions(%q): should have failed", c) - } - } -} - -type closerBuffer struct { - bytes.Buffer -} - -func (b *closerBuffer) Close() error { - return nil -} - -func TestTransportMaxPacketWrite(t *testing.T) { - buf := &closerBuffer{} - tr := newTransport(buf, rand.Reader, true) - huge := make([]byte, maxPacket+1) - err := tr.writePacket(huge) - if err == nil { - t.Errorf("transport accepted write for a huge packet.") - } -} - -func TestTransportMaxPacketReader(t *testing.T) { - var header [5]byte - huge := make([]byte, maxPacket+128) - binary.BigEndian.PutUint32(header[0:], uint32(len(huge))) - // padding. - header[4] = 0 - - buf := &closerBuffer{} - buf.Write(header[:]) - buf.Write(huge) - - tr := newTransport(buf, rand.Reader, true) - _, err := tr.readPacket() - if err == nil { - t.Errorf("transport succeeded reading huge packet.") - } else if !strings.Contains(err.Error(), "large") { - t.Errorf("got %q, should mention %q", err.Error(), "large") - } -} diff --git a/vendor/golang.org/x/net/LICENSE b/vendor/golang.org/x/net/LICENSE new file mode 100644 index 0000000000..6a66aea5ea --- /dev/null +++ b/vendor/golang.org/x/net/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/net/PATENTS b/vendor/golang.org/x/net/PATENTS new file mode 100644 index 0000000000..733099041f --- /dev/null +++ b/vendor/golang.org/x/net/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/net/context/context_test.go b/vendor/golang.org/x/net/context/context_test.go deleted file mode 100644 index 05345fc5e5..0000000000 --- a/vendor/golang.org/x/net/context/context_test.go +++ /dev/null @@ -1,575 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package context - -import ( - "fmt" - "math/rand" - "runtime" - "strings" - "sync" - "testing" - "time" -) - -// otherContext is a Context that's not one of the types defined in context.go. -// This lets us test code paths that differ based on the underlying type of the -// Context. -type otherContext struct { - Context -} - -func TestBackground(t *testing.T) { - c := Background() - if c == nil { - t.Fatalf("Background returned nil") - } - select { - case x := <-c.Done(): - t.Errorf("<-c.Done() == %v want nothing (it should block)", x) - default: - } - if got, want := fmt.Sprint(c), "context.Background"; got != want { - t.Errorf("Background().String() = %q want %q", got, want) - } -} - -func TestTODO(t *testing.T) { - c := TODO() - if c == nil { - t.Fatalf("TODO returned nil") - } - select { - case x := <-c.Done(): - t.Errorf("<-c.Done() == %v want nothing (it should block)", x) - default: - } - if got, want := fmt.Sprint(c), "context.TODO"; got != want { - t.Errorf("TODO().String() = %q want %q", got, want) - } -} - -func TestWithCancel(t *testing.T) { - c1, cancel := WithCancel(Background()) - - if got, want := fmt.Sprint(c1), "context.Background.WithCancel"; got != want { - t.Errorf("c1.String() = %q want %q", got, want) - } - - o := otherContext{c1} - c2, _ := WithCancel(o) - contexts := []Context{c1, o, c2} - - for i, c := range contexts { - if d := c.Done(); d == nil { - t.Errorf("c[%d].Done() == %v want non-nil", i, d) - } - if e := c.Err(); e != nil { - t.Errorf("c[%d].Err() == %v want nil", i, e) - } - - select { - case x := <-c.Done(): - t.Errorf("<-c.Done() == %v want nothing (it should block)", x) - default: - } - } - - cancel() - time.Sleep(100 * time.Millisecond) // let cancelation propagate - - for i, c := range contexts { - select { - case <-c.Done(): - default: - t.Errorf("<-c[%d].Done() blocked, but shouldn't have", i) - } - if e := c.Err(); e != Canceled { - t.Errorf("c[%d].Err() == %v want %v", i, e, Canceled) - } - } -} - -func TestParentFinishesChild(t *testing.T) { - // Context tree: - // parent -> cancelChild - // parent -> valueChild -> timerChild - parent, cancel := WithCancel(Background()) - cancelChild, stop := WithCancel(parent) - defer stop() - valueChild := WithValue(parent, "key", "value") - timerChild, stop := WithTimeout(valueChild, 10000*time.Hour) - defer stop() - - select { - case x := <-parent.Done(): - t.Errorf("<-parent.Done() == %v want nothing (it should block)", x) - case x := <-cancelChild.Done(): - t.Errorf("<-cancelChild.Done() == %v want nothing (it should block)", x) - case x := <-timerChild.Done(): - t.Errorf("<-timerChild.Done() == %v want nothing (it should block)", x) - case x := <-valueChild.Done(): - t.Errorf("<-valueChild.Done() == %v want nothing (it should block)", x) - default: - } - - // The parent's children should contain the two cancelable children. - pc := parent.(*cancelCtx) - cc := cancelChild.(*cancelCtx) - tc := timerChild.(*timerCtx) - pc.mu.Lock() - if len(pc.children) != 2 || !pc.children[cc] || !pc.children[tc] { - t.Errorf("bad linkage: pc.children = %v, want %v and %v", - pc.children, cc, tc) - } - pc.mu.Unlock() - - if p, ok := parentCancelCtx(cc.Context); !ok || p != pc { - t.Errorf("bad linkage: parentCancelCtx(cancelChild.Context) = %v, %v want %v, true", p, ok, pc) - } - if p, ok := parentCancelCtx(tc.Context); !ok || p != pc { - t.Errorf("bad linkage: parentCancelCtx(timerChild.Context) = %v, %v want %v, true", p, ok, pc) - } - - cancel() - - pc.mu.Lock() - if len(pc.children) != 0 { - t.Errorf("pc.cancel didn't clear pc.children = %v", pc.children) - } - pc.mu.Unlock() - - // parent and children should all be finished. - check := func(ctx Context, name string) { - select { - case <-ctx.Done(): - default: - t.Errorf("<-%s.Done() blocked, but shouldn't have", name) - } - if e := ctx.Err(); e != Canceled { - t.Errorf("%s.Err() == %v want %v", name, e, Canceled) - } - } - check(parent, "parent") - check(cancelChild, "cancelChild") - check(valueChild, "valueChild") - check(timerChild, "timerChild") - - // WithCancel should return a canceled context on a canceled parent. - precanceledChild := WithValue(parent, "key", "value") - select { - case <-precanceledChild.Done(): - default: - t.Errorf("<-precanceledChild.Done() blocked, but shouldn't have") - } - if e := precanceledChild.Err(); e != Canceled { - t.Errorf("precanceledChild.Err() == %v want %v", e, Canceled) - } -} - -func TestChildFinishesFirst(t *testing.T) { - cancelable, stop := WithCancel(Background()) - defer stop() - for _, parent := range []Context{Background(), cancelable} { - child, cancel := WithCancel(parent) - - select { - case x := <-parent.Done(): - t.Errorf("<-parent.Done() == %v want nothing (it should block)", x) - case x := <-child.Done(): - t.Errorf("<-child.Done() == %v want nothing (it should block)", x) - default: - } - - cc := child.(*cancelCtx) - pc, pcok := parent.(*cancelCtx) // pcok == false when parent == Background() - if p, ok := parentCancelCtx(cc.Context); ok != pcok || (ok && pc != p) { - t.Errorf("bad linkage: parentCancelCtx(cc.Context) = %v, %v want %v, %v", p, ok, pc, pcok) - } - - if pcok { - pc.mu.Lock() - if len(pc.children) != 1 || !pc.children[cc] { - t.Errorf("bad linkage: pc.children = %v, cc = %v", pc.children, cc) - } - pc.mu.Unlock() - } - - cancel() - - if pcok { - pc.mu.Lock() - if len(pc.children) != 0 { - t.Errorf("child's cancel didn't remove self from pc.children = %v", pc.children) - } - pc.mu.Unlock() - } - - // child should be finished. - select { - case <-child.Done(): - default: - t.Errorf("<-child.Done() blocked, but shouldn't have") - } - if e := child.Err(); e != Canceled { - t.Errorf("child.Err() == %v want %v", e, Canceled) - } - - // parent should not be finished. - select { - case x := <-parent.Done(): - t.Errorf("<-parent.Done() == %v want nothing (it should block)", x) - default: - } - if e := parent.Err(); e != nil { - t.Errorf("parent.Err() == %v want nil", e) - } - } -} - -func testDeadline(c Context, wait time.Duration, t *testing.T) { - select { - case <-time.After(wait): - t.Fatalf("context should have timed out") - case <-c.Done(): - } - if e := c.Err(); e != DeadlineExceeded { - t.Errorf("c.Err() == %v want %v", e, DeadlineExceeded) - } -} - -func TestDeadline(t *testing.T) { - c, _ := WithDeadline(Background(), time.Now().Add(100*time.Millisecond)) - if got, prefix := fmt.Sprint(c), "context.Background.WithDeadline("; !strings.HasPrefix(got, prefix) { - t.Errorf("c.String() = %q want prefix %q", got, prefix) - } - testDeadline(c, 200*time.Millisecond, t) - - c, _ = WithDeadline(Background(), time.Now().Add(100*time.Millisecond)) - o := otherContext{c} - testDeadline(o, 200*time.Millisecond, t) - - c, _ = WithDeadline(Background(), time.Now().Add(100*time.Millisecond)) - o = otherContext{c} - c, _ = WithDeadline(o, time.Now().Add(300*time.Millisecond)) - testDeadline(c, 200*time.Millisecond, t) -} - -func TestTimeout(t *testing.T) { - c, _ := WithTimeout(Background(), 100*time.Millisecond) - if got, prefix := fmt.Sprint(c), "context.Background.WithDeadline("; !strings.HasPrefix(got, prefix) { - t.Errorf("c.String() = %q want prefix %q", got, prefix) - } - testDeadline(c, 200*time.Millisecond, t) - - c, _ = WithTimeout(Background(), 100*time.Millisecond) - o := otherContext{c} - testDeadline(o, 200*time.Millisecond, t) - - c, _ = WithTimeout(Background(), 100*time.Millisecond) - o = otherContext{c} - c, _ = WithTimeout(o, 300*time.Millisecond) - testDeadline(c, 200*time.Millisecond, t) -} - -func TestCanceledTimeout(t *testing.T) { - c, _ := WithTimeout(Background(), 200*time.Millisecond) - o := otherContext{c} - c, cancel := WithTimeout(o, 400*time.Millisecond) - cancel() - time.Sleep(100 * time.Millisecond) // let cancelation propagate - select { - case <-c.Done(): - default: - t.Errorf("<-c.Done() blocked, but shouldn't have") - } - if e := c.Err(); e != Canceled { - t.Errorf("c.Err() == %v want %v", e, Canceled) - } -} - -type key1 int -type key2 int - -var k1 = key1(1) -var k2 = key2(1) // same int as k1, different type -var k3 = key2(3) // same type as k2, different int - -func TestValues(t *testing.T) { - check := func(c Context, nm, v1, v2, v3 string) { - if v, ok := c.Value(k1).(string); ok == (len(v1) == 0) || v != v1 { - t.Errorf(`%s.Value(k1).(string) = %q, %t want %q, %t`, nm, v, ok, v1, len(v1) != 0) - } - if v, ok := c.Value(k2).(string); ok == (len(v2) == 0) || v != v2 { - t.Errorf(`%s.Value(k2).(string) = %q, %t want %q, %t`, nm, v, ok, v2, len(v2) != 0) - } - if v, ok := c.Value(k3).(string); ok == (len(v3) == 0) || v != v3 { - t.Errorf(`%s.Value(k3).(string) = %q, %t want %q, %t`, nm, v, ok, v3, len(v3) != 0) - } - } - - c0 := Background() - check(c0, "c0", "", "", "") - - c1 := WithValue(Background(), k1, "c1k1") - check(c1, "c1", "c1k1", "", "") - - if got, want := fmt.Sprint(c1), `context.Background.WithValue(1, "c1k1")`; got != want { - t.Errorf("c.String() = %q want %q", got, want) - } - - c2 := WithValue(c1, k2, "c2k2") - check(c2, "c2", "c1k1", "c2k2", "") - - c3 := WithValue(c2, k3, "c3k3") - check(c3, "c2", "c1k1", "c2k2", "c3k3") - - c4 := WithValue(c3, k1, nil) - check(c4, "c4", "", "c2k2", "c3k3") - - o0 := otherContext{Background()} - check(o0, "o0", "", "", "") - - o1 := otherContext{WithValue(Background(), k1, "c1k1")} - check(o1, "o1", "c1k1", "", "") - - o2 := WithValue(o1, k2, "o2k2") - check(o2, "o2", "c1k1", "o2k2", "") - - o3 := otherContext{c4} - check(o3, "o3", "", "c2k2", "c3k3") - - o4 := WithValue(o3, k3, nil) - check(o4, "o4", "", "c2k2", "") -} - -func TestAllocs(t *testing.T) { - bg := Background() - for _, test := range []struct { - desc string - f func() - limit float64 - gccgoLimit float64 - }{ - { - desc: "Background()", - f: func() { Background() }, - limit: 0, - gccgoLimit: 0, - }, - { - desc: fmt.Sprintf("WithValue(bg, %v, nil)", k1), - f: func() { - c := WithValue(bg, k1, nil) - c.Value(k1) - }, - limit: 3, - gccgoLimit: 3, - }, - { - desc: "WithTimeout(bg, 15*time.Millisecond)", - f: func() { - c, _ := WithTimeout(bg, 15*time.Millisecond) - <-c.Done() - }, - limit: 8, - gccgoLimit: 15, - }, - { - desc: "WithCancel(bg)", - f: func() { - c, cancel := WithCancel(bg) - cancel() - <-c.Done() - }, - limit: 5, - gccgoLimit: 8, - }, - { - desc: "WithTimeout(bg, 100*time.Millisecond)", - f: func() { - c, cancel := WithTimeout(bg, 100*time.Millisecond) - cancel() - <-c.Done() - }, - limit: 8, - gccgoLimit: 25, - }, - } { - limit := test.limit - if runtime.Compiler == "gccgo" { - // gccgo does not yet do escape analysis. - // TOOD(iant): Remove this when gccgo does do escape analysis. - limit = test.gccgoLimit - } - if n := testing.AllocsPerRun(100, test.f); n > limit { - t.Errorf("%s allocs = %f want %d", test.desc, n, int(limit)) - } - } -} - -func TestSimultaneousCancels(t *testing.T) { - root, cancel := WithCancel(Background()) - m := map[Context]CancelFunc{root: cancel} - q := []Context{root} - // Create a tree of contexts. - for len(q) != 0 && len(m) < 100 { - parent := q[0] - q = q[1:] - for i := 0; i < 4; i++ { - ctx, cancel := WithCancel(parent) - m[ctx] = cancel - q = append(q, ctx) - } - } - // Start all the cancels in a random order. - var wg sync.WaitGroup - wg.Add(len(m)) - for _, cancel := range m { - go func(cancel CancelFunc) { - cancel() - wg.Done() - }(cancel) - } - // Wait on all the contexts in a random order. - for ctx := range m { - select { - case <-ctx.Done(): - case <-time.After(1 * time.Second): - buf := make([]byte, 10<<10) - n := runtime.Stack(buf, true) - t.Fatalf("timed out waiting for <-ctx.Done(); stacks:\n%s", buf[:n]) - } - } - // Wait for all the cancel functions to return. - done := make(chan struct{}) - go func() { - wg.Wait() - close(done) - }() - select { - case <-done: - case <-time.After(1 * time.Second): - buf := make([]byte, 10<<10) - n := runtime.Stack(buf, true) - t.Fatalf("timed out waiting for cancel functions; stacks:\n%s", buf[:n]) - } -} - -func TestInterlockedCancels(t *testing.T) { - parent, cancelParent := WithCancel(Background()) - child, cancelChild := WithCancel(parent) - go func() { - parent.Done() - cancelChild() - }() - cancelParent() - select { - case <-child.Done(): - case <-time.After(1 * time.Second): - buf := make([]byte, 10<<10) - n := runtime.Stack(buf, true) - t.Fatalf("timed out waiting for child.Done(); stacks:\n%s", buf[:n]) - } -} - -func TestLayersCancel(t *testing.T) { - testLayers(t, time.Now().UnixNano(), false) -} - -func TestLayersTimeout(t *testing.T) { - testLayers(t, time.Now().UnixNano(), true) -} - -func testLayers(t *testing.T, seed int64, testTimeout bool) { - rand.Seed(seed) - errorf := func(format string, a ...interface{}) { - t.Errorf(fmt.Sprintf("seed=%d: %s", seed, format), a...) - } - const ( - timeout = 200 * time.Millisecond - minLayers = 30 - ) - type value int - var ( - vals []*value - cancels []CancelFunc - numTimers int - ctx = Background() - ) - for i := 0; i < minLayers || numTimers == 0 || len(cancels) == 0 || len(vals) == 0; i++ { - switch rand.Intn(3) { - case 0: - v := new(value) - ctx = WithValue(ctx, v, v) - vals = append(vals, v) - case 1: - var cancel CancelFunc - ctx, cancel = WithCancel(ctx) - cancels = append(cancels, cancel) - case 2: - var cancel CancelFunc - ctx, cancel = WithTimeout(ctx, timeout) - cancels = append(cancels, cancel) - numTimers++ - } - } - checkValues := func(when string) { - for _, key := range vals { - if val := ctx.Value(key).(*value); key != val { - errorf("%s: ctx.Value(%p) = %p want %p", when, key, val, key) - } - } - } - select { - case <-ctx.Done(): - errorf("ctx should not be canceled yet") - default: - } - if s, prefix := fmt.Sprint(ctx), "context.Background."; !strings.HasPrefix(s, prefix) { - t.Errorf("ctx.String() = %q want prefix %q", s, prefix) - } - t.Log(ctx) - checkValues("before cancel") - if testTimeout { - select { - case <-ctx.Done(): - case <-time.After(timeout + 100*time.Millisecond): - errorf("ctx should have timed out") - } - checkValues("after timeout") - } else { - cancel := cancels[rand.Intn(len(cancels))] - cancel() - select { - case <-ctx.Done(): - default: - errorf("ctx should be canceled") - } - checkValues("after cancel") - } -} - -func TestCancelRemoves(t *testing.T) { - checkChildren := func(when string, ctx Context, want int) { - if got := len(ctx.(*cancelCtx).children); got != want { - t.Errorf("%s: context has %d children, want %d", when, got, want) - } - } - - ctx, _ := WithCancel(Background()) - checkChildren("after creation", ctx, 0) - _, cancel := WithCancel(ctx) - checkChildren("with WithCancel child ", ctx, 1) - cancel() - checkChildren("after cancelling WithCancel child", ctx, 0) - - ctx, _ = WithCancel(Background()) - checkChildren("after creation", ctx, 0) - _, cancel = WithTimeout(ctx, 60*time.Minute) - checkChildren("with WithTimeout child ", ctx, 1) - cancel() - checkChildren("after cancelling WithTimeout child", ctx, 0) -} diff --git a/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_test.go b/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_test.go deleted file mode 100644 index 77c25ba7ee..0000000000 --- a/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_test.go +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !plan9 - -package ctxhttp - -import ( - "io/ioutil" - "net" - "net/http" - "net/http/httptest" - "sync" - "testing" - "time" - - "golang.org/x/net/context" -) - -const ( - requestDuration = 100 * time.Millisecond - requestBody = "ok" -) - -func TestNoTimeout(t *testing.T) { - ctx := context.Background() - resp, err := doRequest(ctx) - - if resp == nil || err != nil { - t.Fatalf("error received from client: %v %v", err, resp) - } -} - -func TestCancel(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - go func() { - time.Sleep(requestDuration / 2) - cancel() - }() - - resp, err := doRequest(ctx) - - if resp != nil || err == nil { - t.Fatalf("expected error, didn't get one. resp: %v", resp) - } - if err != ctx.Err() { - t.Fatalf("expected error from context but got: %v", err) - } -} - -func TestCancelAfterRequest(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - - resp, err := doRequest(ctx) - - // Cancel before reading the body. - // Request.Body should still be readable after the context is canceled. - cancel() - - b, err := ioutil.ReadAll(resp.Body) - if err != nil || string(b) != requestBody { - t.Fatalf("could not read body: %q %v", b, err) - } -} - -func TestCancelAfterHangingRequest(t *testing.T) { - handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - w.(http.Flusher).Flush() - <-w.(http.CloseNotifier).CloseNotify() - }) - - serv := httptest.NewServer(handler) - defer serv.Close() - - ctx, cancel := context.WithCancel(context.Background()) - resp, err := Get(ctx, nil, serv.URL) - if err != nil { - t.Fatalf("unexpected error in Get: %v", err) - } - - // Cancel befer reading the body. - // Reading Request.Body should fail, since the request was - // canceled before anything was written. - cancel() - - done := make(chan struct{}) - - go func() { - b, err := ioutil.ReadAll(resp.Body) - if len(b) != 0 || err == nil { - t.Errorf(`Read got (%q, %v); want ("", error)`, b, err) - } - close(done) - }() - - select { - case <-time.After(1 * time.Second): - t.Errorf("Test timed out") - case <-done: - } -} - -func doRequest(ctx context.Context) (*http.Response, error) { - var okHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - time.Sleep(requestDuration) - w.Write([]byte(requestBody)) - }) - - serv := httptest.NewServer(okHandler) - defer serv.Close() - - return Get(ctx, nil, serv.URL) -} - -// golang.org/issue/14065 -func TestClosesResponseBodyOnCancel(t *testing.T) { - defer func() { testHookContextDoneBeforeHeaders = nop }() - defer func() { testHookDoReturned = nop }() - defer func() { testHookDidBodyClose = nop }() - - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})) - defer ts.Close() - - ctx, cancel := context.WithCancel(context.Background()) - - // closed when Do enters select case <-ctx.Done() - enteredDonePath := make(chan struct{}) - - testHookContextDoneBeforeHeaders = func() { - close(enteredDonePath) - } - - testHookDoReturned = func() { - // We now have the result (the Flush'd headers) at least, - // so we can cancel the request. - cancel() - - // But block the client.Do goroutine from sending - // until Do enters into the <-ctx.Done() path, since - // otherwise if both channels are readable, select - // picks a random one. - <-enteredDonePath - } - - sawBodyClose := make(chan struct{}) - testHookDidBodyClose = func() { close(sawBodyClose) } - - tr := &http.Transport{} - defer tr.CloseIdleConnections() - c := &http.Client{Transport: tr} - req, _ := http.NewRequest("GET", ts.URL, nil) - _, doErr := Do(ctx, c, req) - - select { - case <-sawBodyClose: - case <-time.After(5 * time.Second): - t.Fatal("timeout waiting for body to close") - } - - if doErr != ctx.Err() { - t.Errorf("Do error = %v; want %v", doErr, ctx.Err()) - } -} - -type noteCloseConn struct { - net.Conn - onceClose sync.Once - closefn func() -} - -func (c *noteCloseConn) Close() error { - c.onceClose.Do(c.closefn) - return c.Conn.Close() -} diff --git a/vendor/golang.org/x/net/context/withtimeout_test.go b/vendor/golang.org/x/net/context/withtimeout_test.go deleted file mode 100644 index a6754dc368..0000000000 --- a/vendor/golang.org/x/net/context/withtimeout_test.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package context_test - -import ( - "fmt" - "time" - - "golang.org/x/net/context" -) - -func ExampleWithTimeout() { - // Pass a context with a timeout to tell a blocking function that it - // should abandon its work after the timeout elapses. - ctx, _ := context.WithTimeout(context.Background(), 100*time.Millisecond) - select { - case <-time.After(200 * time.Millisecond): - fmt.Println("overslept") - case <-ctx.Done(): - fmt.Println(ctx.Err()) // prints "context deadline exceeded" - } - // Output: - // context deadline exceeded -} diff --git a/vendor/golang.org/x/oauth2/clientcredentials/clientcredentials_test.go b/vendor/golang.org/x/oauth2/clientcredentials/clientcredentials_test.go deleted file mode 100644 index 5a0170a95f..0000000000 --- a/vendor/golang.org/x/oauth2/clientcredentials/clientcredentials_test.go +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package clientcredentials - -import ( - "io/ioutil" - "net/http" - "net/http/httptest" - "testing" - - "golang.org/x/oauth2" -) - -func newConf(url string) *Config { - return &Config{ - ClientID: "CLIENT_ID", - ClientSecret: "CLIENT_SECRET", - Scopes: []string{"scope1", "scope2"}, - TokenURL: url + "/token", - } -} - -type mockTransport struct { - rt func(req *http.Request) (resp *http.Response, err error) -} - -func (t *mockTransport) RoundTrip(req *http.Request) (resp *http.Response, err error) { - return t.rt(req) -} - -func TestTokenRequest(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.URL.String() != "/token" { - t.Errorf("authenticate client request URL = %q; want %q", r.URL, "/token") - } - headerAuth := r.Header.Get("Authorization") - if headerAuth != "Basic Q0xJRU5UX0lEOkNMSUVOVF9TRUNSRVQ=" { - t.Errorf("Unexpected authorization header, %v is found.", headerAuth) - } - if got, want := r.Header.Get("Content-Type"), "application/x-www-form-urlencoded"; got != want { - t.Errorf("Content-Type header = %q; want %q", got, want) - } - body, err := ioutil.ReadAll(r.Body) - if err != nil { - r.Body.Close() - } - if err != nil { - t.Errorf("failed reading request body: %s.", err) - } - if string(body) != "client_id=CLIENT_ID&grant_type=client_credentials&scope=scope1+scope2" { - t.Errorf("payload = %q; want %q", string(body), "client_id=CLIENT_ID&grant_type=client_credentials&scope=scope1+scope2") - } - w.Header().Set("Content-Type", "application/x-www-form-urlencoded") - w.Write([]byte("access_token=90d64460d14870c08c81352a05dedd3465940a7c&token_type=bearer")) - })) - defer ts.Close() - conf := newConf(ts.URL) - tok, err := conf.Token(oauth2.NoContext) - if err != nil { - t.Error(err) - } - if !tok.Valid() { - t.Fatalf("token invalid. got: %#v", tok) - } - if tok.AccessToken != "90d64460d14870c08c81352a05dedd3465940a7c" { - t.Errorf("Access token = %q; want %q", tok.AccessToken, "90d64460d14870c08c81352a05dedd3465940a7c") - } - if tok.TokenType != "bearer" { - t.Errorf("token type = %q; want %q", tok.TokenType, "bearer") - } -} - -func TestTokenRefreshRequest(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.URL.String() == "/somethingelse" { - return - } - if r.URL.String() != "/token" { - t.Errorf("Unexpected token refresh request URL, %v is found.", r.URL) - } - headerContentType := r.Header.Get("Content-Type") - if headerContentType != "application/x-www-form-urlencoded" { - t.Errorf("Unexpected Content-Type header, %v is found.", headerContentType) - } - body, _ := ioutil.ReadAll(r.Body) - if string(body) != "client_id=CLIENT_ID&grant_type=client_credentials&scope=scope1+scope2" { - t.Errorf("Unexpected refresh token payload, %v is found.", string(body)) - } - })) - defer ts.Close() - conf := newConf(ts.URL) - c := conf.Client(oauth2.NoContext) - c.Get(ts.URL + "/somethingelse") -} diff --git a/vendor/golang.org/x/oauth2/example_test.go b/vendor/golang.org/x/oauth2/example_test.go deleted file mode 100644 index 33b305c628..0000000000 --- a/vendor/golang.org/x/oauth2/example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package oauth2_test - -import ( - "fmt" - "log" - - "golang.org/x/oauth2" -) - -func ExampleConfig() { - conf := &oauth2.Config{ - ClientID: "YOUR_CLIENT_ID", - ClientSecret: "YOUR_CLIENT_SECRET", - Scopes: []string{"SCOPE1", "SCOPE2"}, - Endpoint: oauth2.Endpoint{ - AuthURL: "https://provider.com/o/oauth2/auth", - TokenURL: "https://provider.com/o/oauth2/token", - }, - } - - // Redirect user to consent page to ask for permission - // for the scopes specified above. - url := conf.AuthCodeURL("state", oauth2.AccessTypeOffline) - fmt.Printf("Visit the URL for the auth dialog: %v", url) - - // Use the authorization code that is pushed to the redirect URL. - // NewTransportWithCode will do the handshake to retrieve - // an access token and initiate a Transport that is - // authorized and authenticated by the retrieved token. - var code string - if _, err := fmt.Scan(&code); err != nil { - log.Fatal(err) - } - tok, err := conf.Exchange(oauth2.NoContext, code) - if err != nil { - log.Fatal(err) - } - - client := conf.Client(oauth2.NoContext, tok) - client.Get("...") -} diff --git a/vendor/golang.org/x/oauth2/google/example_test.go b/vendor/golang.org/x/oauth2/google/example_test.go deleted file mode 100644 index 9745be1929..0000000000 --- a/vendor/golang.org/x/oauth2/google/example_test.go +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build appenginevm !appengine - -package google_test - -import ( - "fmt" - "io/ioutil" - "log" - "net/http" - - "golang.org/x/oauth2" - "golang.org/x/oauth2/google" - "golang.org/x/oauth2/jwt" - "google.golang.org/appengine" - "google.golang.org/appengine/urlfetch" -) - -func ExampleDefaultClient() { - client, err := google.DefaultClient(oauth2.NoContext, - "https://www.googleapis.com/auth/devstorage.full_control") - if err != nil { - log.Fatal(err) - } - client.Get("...") -} - -func Example_webServer() { - // Your credentials should be obtained from the Google - // Developer Console (https://console.developers.google.com). - conf := &oauth2.Config{ - ClientID: "YOUR_CLIENT_ID", - ClientSecret: "YOUR_CLIENT_SECRET", - RedirectURL: "YOUR_REDIRECT_URL", - Scopes: []string{ - "https://www.googleapis.com/auth/bigquery", - "https://www.googleapis.com/auth/blogger", - }, - Endpoint: google.Endpoint, - } - // Redirect user to Google's consent page to ask for permission - // for the scopes specified above. - url := conf.AuthCodeURL("state") - fmt.Printf("Visit the URL for the auth dialog: %v", url) - - // Handle the exchange code to initiate a transport. - tok, err := conf.Exchange(oauth2.NoContext, "authorization-code") - if err != nil { - log.Fatal(err) - } - client := conf.Client(oauth2.NoContext, tok) - client.Get("...") -} - -func ExampleJWTConfigFromJSON() { - // Your credentials should be obtained from the Google - // Developer Console (https://console.developers.google.com). - // Navigate to your project, then see the "Credentials" page - // under "APIs & Auth". - // To create a service account client, click "Create new Client ID", - // select "Service Account", and click "Create Client ID". A JSON - // key file will then be downloaded to your computer. - data, err := ioutil.ReadFile("/path/to/your-project-key.json") - if err != nil { - log.Fatal(err) - } - conf, err := google.JWTConfigFromJSON(data, "https://www.googleapis.com/auth/bigquery") - if err != nil { - log.Fatal(err) - } - // Initiate an http.Client. The following GET request will be - // authorized and authenticated on the behalf of - // your service account. - client := conf.Client(oauth2.NoContext) - client.Get("...") -} - -func ExampleSDKConfig() { - // The credentials will be obtained from the first account that - // has been authorized with `gcloud auth login`. - conf, err := google.NewSDKConfig("") - if err != nil { - log.Fatal(err) - } - // Initiate an http.Client. The following GET request will be - // authorized and authenticated on the behalf of the SDK user. - client := conf.Client(oauth2.NoContext) - client.Get("...") -} - -func Example_serviceAccount() { - // Your credentials should be obtained from the Google - // Developer Console (https://console.developers.google.com). - conf := &jwt.Config{ - Email: "xxx@developer.gserviceaccount.com", - // The contents of your RSA private key or your PEM file - // that contains a private key. - // If you have a p12 file instead, you - // can use `openssl` to export the private key into a pem file. - // - // $ openssl pkcs12 -in key.p12 -passin pass:notasecret -out key.pem -nodes - // - // The field only supports PEM containers with no passphrase. - // The openssl command will convert p12 keys to passphrase-less PEM containers. - PrivateKey: []byte("-----BEGIN RSA PRIVATE KEY-----..."), - Scopes: []string{ - "https://www.googleapis.com/auth/bigquery", - "https://www.googleapis.com/auth/blogger", - }, - TokenURL: google.JWTTokenURL, - // If you would like to impersonate a user, you can - // create a transport with a subject. The following GET - // request will be made on the behalf of user@example.com. - // Optional. - Subject: "user@example.com", - } - // Initiate an http.Client, the following GET request will be - // authorized and authenticated on the behalf of user@example.com. - client := conf.Client(oauth2.NoContext) - client.Get("...") -} - -func ExampleAppEngineTokenSource() { - var req *http.Request // from the ServeHTTP handler - ctx := appengine.NewContext(req) - client := &http.Client{ - Transport: &oauth2.Transport{ - Source: google.AppEngineTokenSource(ctx, "https://www.googleapis.com/auth/bigquery"), - Base: &urlfetch.Transport{ - Context: ctx, - }, - }, - } - client.Get("...") -} - -func ExampleComputeTokenSource() { - client := &http.Client{ - Transport: &oauth2.Transport{ - // Fetch from Google Compute Engine's metadata server to retrieve - // an access token for the provided account. - // If no account is specified, "default" is used. - Source: google.ComputeTokenSource(""), - }, - } - client.Get("...") -} diff --git a/vendor/golang.org/x/oauth2/google/google_test.go b/vendor/golang.org/x/oauth2/google/google_test.go deleted file mode 100644 index 74080edea3..0000000000 --- a/vendor/golang.org/x/oauth2/google/google_test.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package google - -import ( - "strings" - "testing" -) - -var webJSONKey = []byte(` -{ - "web": { - "auth_uri": "https://google.com/o/oauth2/auth", - "client_secret": "3Oknc4jS_wA2r9i", - "token_uri": "https://google.com/o/oauth2/token", - "client_email": "222-nprqovg5k43uum874cs9osjt2koe97g8@developer.gserviceaccount.com", - "redirect_uris": ["https://www.example.com/oauth2callback"], - "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/222-nprqovg5k43uum874cs9osjt2koe97g8@developer.gserviceaccount.com", - "client_id": "222-nprqovg5k43uum874cs9osjt2koe97g8.apps.googleusercontent.com", - "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", - "javascript_origins": ["https://www.example.com"] - } -}`) - -var installedJSONKey = []byte(`{ - "installed": { - "client_id": "222-installed.apps.googleusercontent.com", - "redirect_uris": ["https://www.example.com/oauth2callback"] - } -}`) - -func TestConfigFromJSON(t *testing.T) { - conf, err := ConfigFromJSON(webJSONKey, "scope1", "scope2") - if err != nil { - t.Error(err) - } - if got, want := conf.ClientID, "222-nprqovg5k43uum874cs9osjt2koe97g8.apps.googleusercontent.com"; got != want { - t.Errorf("ClientID = %q; want %q", got, want) - } - if got, want := conf.ClientSecret, "3Oknc4jS_wA2r9i"; got != want { - t.Errorf("ClientSecret = %q; want %q", got, want) - } - if got, want := conf.RedirectURL, "https://www.example.com/oauth2callback"; got != want { - t.Errorf("RedictURL = %q; want %q", got, want) - } - if got, want := strings.Join(conf.Scopes, ","), "scope1,scope2"; got != want { - t.Errorf("Scopes = %q; want %q", got, want) - } - if got, want := conf.Endpoint.AuthURL, "https://google.com/o/oauth2/auth"; got != want { - t.Errorf("AuthURL = %q; want %q", got, want) - } - if got, want := conf.Endpoint.TokenURL, "https://google.com/o/oauth2/token"; got != want { - t.Errorf("TokenURL = %q; want %q", got, want) - } -} - -func TestConfigFromJSON_Installed(t *testing.T) { - conf, err := ConfigFromJSON(installedJSONKey) - if err != nil { - t.Error(err) - } - if got, want := conf.ClientID, "222-installed.apps.googleusercontent.com"; got != want { - t.Errorf("ClientID = %q; want %q", got, want) - } -} diff --git a/vendor/golang.org/x/oauth2/google/sdk_test.go b/vendor/golang.org/x/oauth2/google/sdk_test.go deleted file mode 100644 index a5aa2a6466..0000000000 --- a/vendor/golang.org/x/oauth2/google/sdk_test.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package google - -import "testing" - -func TestSDKConfig(t *testing.T) { - sdkConfigPath = func() (string, error) { - return "testdata/gcloud", nil - } - - tests := []struct { - account string - accessToken string - err bool - }{ - {"", "bar_access_token", false}, - {"foo@example.com", "foo_access_token", false}, - {"bar@example.com", "bar_access_token", false}, - {"baz@serviceaccount.example.com", "", true}, - } - for _, tt := range tests { - c, err := NewSDKConfig(tt.account) - if got, want := err != nil, tt.err; got != want { - if !tt.err { - t.Errorf("expected no error, got error: %v", tt.err, err) - } else { - t.Errorf("expected error, got none") - } - continue - } - if err != nil { - continue - } - tok := c.initialToken - if tok == nil { - t.Errorf("expected token %q, got: nil", tt.accessToken) - continue - } - if tok.AccessToken != tt.accessToken { - t.Errorf("expected token %q, got: %q", tt.accessToken, tok.AccessToken) - } - } -} diff --git a/vendor/golang.org/x/oauth2/google/testdata/gcloud/credentials b/vendor/golang.org/x/oauth2/google/testdata/gcloud/credentials deleted file mode 100644 index ff5eefbd0a..0000000000 --- a/vendor/golang.org/x/oauth2/google/testdata/gcloud/credentials +++ /dev/null @@ -1,122 +0,0 @@ -{ - "data": [ - { - "credential": { - "_class": "OAuth2Credentials", - "_module": "oauth2client.client", - "access_token": "foo_access_token", - "client_id": "foo_client_id", - "client_secret": "foo_client_secret", - "id_token": { - "at_hash": "foo_at_hash", - "aud": "foo_aud", - "azp": "foo_azp", - "cid": "foo_cid", - "email": "foo@example.com", - "email_verified": true, - "exp": 1420573614, - "iat": 1420569714, - "id": "1337", - "iss": "accounts.google.com", - "sub": "1337", - "token_hash": "foo_token_hash", - "verified_email": true - }, - "invalid": false, - "refresh_token": "foo_refresh_token", - "revoke_uri": "https://accounts.google.com/o/oauth2/revoke", - "token_expiry": "2015-01-09T00:51:51Z", - "token_response": { - "access_token": "foo_access_token", - "expires_in": 3600, - "id_token": "foo_id_token", - "token_type": "Bearer" - }, - "token_uri": "https://accounts.google.com/o/oauth2/token", - "user_agent": "Cloud SDK Command Line Tool" - }, - "key": { - "account": "foo@example.com", - "clientId": "foo_client_id", - "scope": "https://www.googleapis.com/auth/appengine.admin https://www.googleapis.com/auth/bigquery https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/ndev.cloudman https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/sqlservice.admin https://www.googleapis.com/auth/prediction https://www.googleapis.com/auth/projecthosting", - "type": "google-cloud-sdk" - } - }, - { - "credential": { - "_class": "OAuth2Credentials", - "_module": "oauth2client.client", - "access_token": "bar_access_token", - "client_id": "bar_client_id", - "client_secret": "bar_client_secret", - "id_token": { - "at_hash": "bar_at_hash", - "aud": "bar_aud", - "azp": "bar_azp", - "cid": "bar_cid", - "email": "bar@example.com", - "email_verified": true, - "exp": 1420573614, - "iat": 1420569714, - "id": "1337", - "iss": "accounts.google.com", - "sub": "1337", - "token_hash": "bar_token_hash", - "verified_email": true - }, - "invalid": false, - "refresh_token": "bar_refresh_token", - "revoke_uri": "https://accounts.google.com/o/oauth2/revoke", - "token_expiry": "2015-01-09T00:51:51Z", - "token_response": { - "access_token": "bar_access_token", - "expires_in": 3600, - "id_token": "bar_id_token", - "token_type": "Bearer" - }, - "token_uri": "https://accounts.google.com/o/oauth2/token", - "user_agent": "Cloud SDK Command Line Tool" - }, - "key": { - "account": "bar@example.com", - "clientId": "bar_client_id", - "scope": "https://www.googleapis.com/auth/appengine.admin https://www.googleapis.com/auth/bigquery https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/ndev.cloudman https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/sqlservice.admin https://www.googleapis.com/auth/prediction https://www.googleapis.com/auth/projecthosting", - "type": "google-cloud-sdk" - } - }, - { - "credential": { - "_class": "ServiceAccountCredentials", - "_kwargs": {}, - "_module": "oauth2client.client", - "_private_key_id": "00000000000000000000000000000000", - "_private_key_pkcs8_text": "-----BEGIN RSA PRIVATE KEY-----\nMIICWwIBAAKBgQCt3fpiynPSaUhWSIKMGV331zudwJ6GkGmvQtwsoK2S2LbvnSwU\nNxgj4fp08kIDR5p26wF4+t/HrKydMwzftXBfZ9UmLVJgRdSswmS5SmChCrfDS5OE\nvFFcN5+6w1w8/Nu657PF/dse8T0bV95YrqyoR0Osy8WHrUOMSIIbC3hRuwIDAQAB\nAoGAJrGE/KFjn0sQ7yrZ6sXmdLawrM3mObo/2uI9T60+k7SpGbBX0/Pi6nFrJMWZ\nTVONG7P3Mu5aCPzzuVRYJB0j8aldSfzABTY3HKoWCczqw1OztJiEseXGiYz4QOyr\nYU3qDyEpdhS6q6wcoLKGH+hqRmz6pcSEsc8XzOOu7s4xW8kCQQDkc75HjhbarCnd\nJJGMe3U76+6UGmdK67ltZj6k6xoB5WbTNChY9TAyI2JC+ppYV89zv3ssj4L+02u3\nHIHFGxsHAkEAwtU1qYb1tScpchPobnYUFiVKJ7KA8EZaHVaJJODW/cghTCV7BxcJ\nbgVvlmk4lFKn3lPKAgWw7PdQsBTVBUcCrQJATPwoIirizrv3u5soJUQxZIkENAqV\nxmybZx9uetrzP7JTrVbFRf0SScMcyN90hdLJiQL8+i4+gaszgFht7sNMnwJAAbfj\nq0UXcauQwALQ7/h2oONfTg5S+MuGC/AxcXPSMZbMRGGoPh3D5YaCv27aIuS/ukQ+\n6dmm/9AGlCb64fsIWQJAPaokbjIifo+LwC5gyK73Mc4t8nAOSZDenzd/2f6TCq76\nS1dcnKiPxaED7W/y6LJiuBT2rbZiQ2L93NJpFZD/UA==\n-----END RSA PRIVATE KEY-----\n", - "_revoke_uri": "https://accounts.google.com/o/oauth2/revoke", - "_scopes": "https://www.googleapis.com/auth/appengine.admin https://www.googleapis.com/auth/bigquery https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/ndev.cloudman https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/sqlservice.admin https://www.googleapis.com/auth/prediction https://www.googleapis.com/auth/projecthosting", - "_service_account_email": "baz@serviceaccount.example.com", - "_service_account_id": "baz.serviceaccount.example.com", - "_token_uri": "https://accounts.google.com/o/oauth2/token", - "_user_agent": "Cloud SDK Command Line Tool", - "access_token": null, - "assertion_type": null, - "client_id": null, - "client_secret": null, - "id_token": null, - "invalid": false, - "refresh_token": null, - "revoke_uri": "https://accounts.google.com/o/oauth2/revoke", - "service_account_name": "baz@serviceaccount.example.com", - "token_expiry": null, - "token_response": null, - "user_agent": "Cloud SDK Command Line Tool" - }, - "key": { - "account": "baz@serviceaccount.example.com", - "clientId": "baz_client_id", - "scope": "https://www.googleapis.com/auth/appengine.admin https://www.googleapis.com/auth/bigquery https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/ndev.cloudman https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/sqlservice.admin https://www.googleapis.com/auth/prediction https://www.googleapis.com/auth/projecthosting", - "type": "google-cloud-sdk" - } - } - ], - "file_version": 1 -} diff --git a/vendor/golang.org/x/oauth2/google/testdata/gcloud/properties b/vendor/golang.org/x/oauth2/google/testdata/gcloud/properties deleted file mode 100644 index 025de886cf..0000000000 --- a/vendor/golang.org/x/oauth2/google/testdata/gcloud/properties +++ /dev/null @@ -1,2 +0,0 @@ -[core] -account = bar@example.com \ No newline at end of file diff --git a/vendor/golang.org/x/oauth2/internal/oauth2_test.go b/vendor/golang.org/x/oauth2/internal/oauth2_test.go deleted file mode 100644 index c61585542d..0000000000 --- a/vendor/golang.org/x/oauth2/internal/oauth2_test.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package internal contains support packages for oauth2 package. -package internal - -import ( - "reflect" - "strings" - "testing" -) - -func TestParseINI(t *testing.T) { - tests := []struct { - ini string - want map[string]map[string]string - }{ - { - `root = toor -[foo] -bar = hop -ini = nin -`, - map[string]map[string]string{ - "": map[string]string{"root": "toor"}, - "foo": map[string]string{"bar": "hop", "ini": "nin"}, - }, - }, - { - `[empty] -[section] -empty= -`, - map[string]map[string]string{ - "": map[string]string{}, - "empty": map[string]string{}, - "section": map[string]string{"empty": ""}, - }, - }, - { - `ignore -[invalid -=stuff -;comment=true -`, - map[string]map[string]string{ - "": map[string]string{}, - }, - }, - } - for _, tt := range tests { - result, err := ParseINI(strings.NewReader(tt.ini)) - if err != nil { - t.Errorf("ParseINI(%q) error %v, want: no error", tt.ini, err) - continue - } - if !reflect.DeepEqual(result, tt.want) { - t.Errorf("ParseINI(%q) = %#v, want: %#v", tt.ini, result, tt.want) - } - } -} diff --git a/vendor/golang.org/x/oauth2/internal/token_test.go b/vendor/golang.org/x/oauth2/internal/token_test.go deleted file mode 100644 index d8d1e989f9..0000000000 --- a/vendor/golang.org/x/oauth2/internal/token_test.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package internal contains support packages for oauth2 package. -package internal - -import ( - "fmt" - "testing" -) - -func TestRegisterBrokenAuthHeaderProvider(t *testing.T) { - RegisterBrokenAuthHeaderProvider("https://aaa.com/") - tokenURL := "https://aaa.com/token" - if providerAuthHeaderWorks(tokenURL) { - t.Errorf("URL: %s is a broken provider", tokenURL) - } -} - -func Test_providerAuthHeaderWorks(t *testing.T) { - for _, p := range brokenAuthHeaderProviders { - if providerAuthHeaderWorks(p) { - t.Errorf("URL: %s not found in list", p) - } - p := fmt.Sprintf("%ssomesuffix", p) - if providerAuthHeaderWorks(p) { - t.Errorf("URL: %s not found in list", p) - } - } - p := "https://api.not-in-the-list-example.com/" - if !providerAuthHeaderWorks(p) { - t.Errorf("URL: %s found in list", p) - } - -} diff --git a/vendor/golang.org/x/oauth2/internal/transport_test.go b/vendor/golang.org/x/oauth2/internal/transport_test.go deleted file mode 100644 index 313f637cd8..0000000000 --- a/vendor/golang.org/x/oauth2/internal/transport_test.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package internal - -import ( - "net/http" - "testing" - - "golang.org/x/net/context" -) - -func TestContextClient(t *testing.T) { - rc := &http.Client{} - RegisterContextClientFunc(func(context.Context) (*http.Client, error) { - return rc, nil - }) - - c := &http.Client{} - ctx := context.WithValue(nil, HTTPClient, c) - - hc, err := ContextClient(ctx) - if err != nil { - t.Fatalf("want valid client; got err = %v", err) - } - if hc != c { - t.Fatalf("want context client = %p; got = %p", c, hc) - } - - hc, err = ContextClient(context.TODO()) - if err != nil { - t.Fatalf("want valid client; got err = %v", err) - } - if hc != rc { - t.Fatalf("want registered client = %p; got = %p", c, hc) - } -} diff --git a/vendor/golang.org/x/oauth2/jwt/example_test.go b/vendor/golang.org/x/oauth2/jwt/example_test.go deleted file mode 100644 index a9533e85f0..0000000000 --- a/vendor/golang.org/x/oauth2/jwt/example_test.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package jwt_test - -import ( - "golang.org/x/oauth2" - "golang.org/x/oauth2/jwt" -) - -func ExampleJWTConfig() { - conf := &jwt.Config{ - Email: "xxx@developer.com", - // The contents of your RSA private key or your PEM file - // that contains a private key. - // If you have a p12 file instead, you - // can use `openssl` to export the private key into a pem file. - // - // $ openssl pkcs12 -in key.p12 -out key.pem -nodes - // - // It only supports PEM containers with no passphrase. - PrivateKey: []byte("-----BEGIN RSA PRIVATE KEY-----..."), - Subject: "user@example.com", - TokenURL: "https://provider.com/o/oauth2/token", - } - // Initiate an http.Client, the following GET request will be - // authorized and authenticated on the behalf of user@example.com. - client := conf.Client(oauth2.NoContext) - client.Get("...") -} diff --git a/vendor/golang.org/x/oauth2/jwt/jwt_test.go b/vendor/golang.org/x/oauth2/jwt/jwt_test.go deleted file mode 100644 index a9c126b47a..0000000000 --- a/vendor/golang.org/x/oauth2/jwt/jwt_test.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package jwt - -import ( - "net/http" - "net/http/httptest" - "testing" - - "golang.org/x/oauth2" -) - -var dummyPrivateKey = []byte(`-----BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEAx4fm7dngEmOULNmAs1IGZ9Apfzh+BkaQ1dzkmbUgpcoghucE -DZRnAGd2aPyB6skGMXUytWQvNYav0WTR00wFtX1ohWTfv68HGXJ8QXCpyoSKSSFY -fuP9X36wBSkSX9J5DVgiuzD5VBdzUISSmapjKm+DcbRALjz6OUIPEWi1Tjl6p5RK -1w41qdbmt7E5/kGhKLDuT7+M83g4VWhgIvaAXtnhklDAggilPPa8ZJ1IFe31lNlr -k4DRk38nc6sEutdf3RL7QoH7FBusI7uXV03DC6dwN1kP4GE7bjJhcRb/7jYt7CQ9 -/E9Exz3c0yAp0yrTg0Fwh+qxfH9dKwN52S7SBwIDAQABAoIBAQCaCs26K07WY5Jt -3a2Cw3y2gPrIgTCqX6hJs7O5ByEhXZ8nBwsWANBUe4vrGaajQHdLj5OKfsIDrOvn -2NI1MqflqeAbu/kR32q3tq8/Rl+PPiwUsW3E6Pcf1orGMSNCXxeducF2iySySzh3 -nSIhCG5uwJDWI7a4+9KiieFgK1pt/Iv30q1SQS8IEntTfXYwANQrfKUVMmVF9aIK -6/WZE2yd5+q3wVVIJ6jsmTzoDCX6QQkkJICIYwCkglmVy5AeTckOVwcXL0jqw5Kf -5/soZJQwLEyBoQq7Kbpa26QHq+CJONetPP8Ssy8MJJXBT+u/bSseMb3Zsr5cr43e -DJOhwsThAoGBAPY6rPKl2NT/K7XfRCGm1sbWjUQyDShscwuWJ5+kD0yudnT/ZEJ1 -M3+KS/iOOAoHDdEDi9crRvMl0UfNa8MAcDKHflzxg2jg/QI+fTBjPP5GOX0lkZ9g -z6VePoVoQw2gpPFVNPPTxKfk27tEzbaffvOLGBEih0Kb7HTINkW8rIlzAoGBAM9y -1yr+jvfS1cGFtNU+Gotoihw2eMKtIqR03Yn3n0PK1nVCDKqwdUqCypz4+ml6cxRK -J8+Pfdh7D+ZJd4LEG6Y4QRDLuv5OA700tUoSHxMSNn3q9As4+T3MUyYxWKvTeu3U -f2NWP9ePU0lV8ttk7YlpVRaPQmc1qwooBA/z/8AdAoGAW9x0HWqmRICWTBnpjyxx -QGlW9rQ9mHEtUotIaRSJ6K/F3cxSGUEkX1a3FRnp6kPLcckC6NlqdNgNBd6rb2rA -cPl/uSkZP42Als+9YMoFPU/xrrDPbUhu72EDrj3Bllnyb168jKLa4VBOccUvggxr -Dm08I1hgYgdN5huzs7y6GeUCgYEAj+AZJSOJ6o1aXS6rfV3mMRve9bQ9yt8jcKXw -5HhOCEmMtaSKfnOF1Ziih34Sxsb7O2428DiX0mV/YHtBnPsAJidL0SdLWIapBzeg -KHArByIRkwE6IvJvwpGMdaex1PIGhx5i/3VZL9qiq/ElT05PhIb+UXgoWMabCp84 -OgxDK20CgYAeaFo8BdQ7FmVX2+EEejF+8xSge6WVLtkaon8bqcn6P0O8lLypoOhd -mJAYH8WU+UAy9pecUnDZj14LAGNVmYcse8HFX71MoshnvCTFEPVo4rZxIAGwMpeJ -5jgQ3slYLpqrGlcbLgUXBUgzEO684Wk/UV9DFPlHALVqCfXQ9dpJPg== ------END RSA PRIVATE KEY-----`) - -func TestJWTFetch_JSONResponse(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") - w.Write([]byte(`{ - "access_token": "90d64460d14870c08c81352a05dedd3465940a7c", - "scope": "user", - "token_type": "bearer", - "expires_in": 3600 - }`)) - })) - defer ts.Close() - - conf := &Config{ - Email: "aaa@xxx.com", - PrivateKey: dummyPrivateKey, - TokenURL: ts.URL, - } - tok, err := conf.TokenSource(oauth2.NoContext).Token() - if err != nil { - t.Fatal(err) - } - if !tok.Valid() { - t.Errorf("Token invalid") - } - if tok.AccessToken != "90d64460d14870c08c81352a05dedd3465940a7c" { - t.Errorf("Unexpected access token, %#v", tok.AccessToken) - } - if tok.TokenType != "bearer" { - t.Errorf("Unexpected token type, %#v", tok.TokenType) - } - if tok.Expiry.IsZero() { - t.Errorf("Unexpected token expiry, %#v", tok.Expiry) - } - scope := tok.Extra("scope") - if scope != "user" { - t.Errorf("Unexpected value for scope: %v", scope) - } -} - -func TestJWTFetch_BadResponse(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") - w.Write([]byte(`{"scope": "user", "token_type": "bearer"}`)) - })) - defer ts.Close() - - conf := &Config{ - Email: "aaa@xxx.com", - PrivateKey: dummyPrivateKey, - TokenURL: ts.URL, - } - tok, err := conf.TokenSource(oauth2.NoContext).Token() - if err != nil { - t.Fatal(err) - } - if tok == nil { - t.Fatalf("token is nil") - } - if tok.Valid() { - t.Errorf("token is valid. want invalid.") - } - if tok.AccessToken != "" { - t.Errorf("Unexpected non-empty access token %q.", tok.AccessToken) - } - if want := "bearer"; tok.TokenType != want { - t.Errorf("TokenType = %q; want %q", tok.TokenType, want) - } - scope := tok.Extra("scope") - if want := "user"; scope != want { - t.Errorf("token scope = %q; want %q", scope, want) - } -} - -func TestJWTFetch_BadResponseType(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") - w.Write([]byte(`{"access_token":123, "scope": "user", "token_type": "bearer"}`)) - })) - defer ts.Close() - conf := &Config{ - Email: "aaa@xxx.com", - PrivateKey: dummyPrivateKey, - TokenURL: ts.URL, - } - tok, err := conf.TokenSource(oauth2.NoContext).Token() - if err == nil { - t.Error("got a token; expected error") - if tok.AccessToken != "" { - t.Errorf("Unexpected access token, %#v.", tok.AccessToken) - } - } -} diff --git a/vendor/golang.org/x/oauth2/oauth2_test.go b/vendor/golang.org/x/oauth2/oauth2_test.go deleted file mode 100644 index 448673b51c..0000000000 --- a/vendor/golang.org/x/oauth2/oauth2_test.go +++ /dev/null @@ -1,471 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package oauth2 - -import ( - "encoding/json" - "errors" - "fmt" - "io/ioutil" - "net/http" - "net/http/httptest" - "net/url" - "reflect" - "strconv" - "testing" - "time" - - "golang.org/x/net/context" -) - -type mockTransport struct { - rt func(req *http.Request) (resp *http.Response, err error) -} - -func (t *mockTransport) RoundTrip(req *http.Request) (resp *http.Response, err error) { - return t.rt(req) -} - -type mockCache struct { - token *Token - readErr error -} - -func (c *mockCache) ReadToken() (*Token, error) { - return c.token, c.readErr -} - -func (c *mockCache) WriteToken(*Token) { - // do nothing -} - -func newConf(url string) *Config { - return &Config{ - ClientID: "CLIENT_ID", - ClientSecret: "CLIENT_SECRET", - RedirectURL: "REDIRECT_URL", - Scopes: []string{"scope1", "scope2"}, - Endpoint: Endpoint{ - AuthURL: url + "/auth", - TokenURL: url + "/token", - }, - } -} - -func TestAuthCodeURL(t *testing.T) { - conf := newConf("server") - url := conf.AuthCodeURL("foo", AccessTypeOffline, ApprovalForce) - if url != "server/auth?access_type=offline&approval_prompt=force&client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=scope1+scope2&state=foo" { - t.Errorf("Auth code URL doesn't match the expected, found: %v", url) - } -} - -func TestAuthCodeURL_CustomParam(t *testing.T) { - conf := newConf("server") - param := SetAuthURLParam("foo", "bar") - url := conf.AuthCodeURL("baz", param) - if url != "server/auth?client_id=CLIENT_ID&foo=bar&redirect_uri=REDIRECT_URL&response_type=code&scope=scope1+scope2&state=baz" { - t.Errorf("Auth code URL doesn't match the expected, found: %v", url) - } -} - -func TestAuthCodeURL_Optional(t *testing.T) { - conf := &Config{ - ClientID: "CLIENT_ID", - Endpoint: Endpoint{ - AuthURL: "/auth-url", - TokenURL: "/token-url", - }, - } - url := conf.AuthCodeURL("") - if url != "/auth-url?client_id=CLIENT_ID&response_type=code" { - t.Fatalf("Auth code URL doesn't match the expected, found: %v", url) - } -} - -func TestExchangeRequest(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.URL.String() != "/token" { - t.Errorf("Unexpected exchange request URL, %v is found.", r.URL) - } - headerAuth := r.Header.Get("Authorization") - if headerAuth != "Basic Q0xJRU5UX0lEOkNMSUVOVF9TRUNSRVQ=" { - t.Errorf("Unexpected authorization header, %v is found.", headerAuth) - } - headerContentType := r.Header.Get("Content-Type") - if headerContentType != "application/x-www-form-urlencoded" { - t.Errorf("Unexpected Content-Type header, %v is found.", headerContentType) - } - body, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Errorf("Failed reading request body: %s.", err) - } - if string(body) != "client_id=CLIENT_ID&code=exchange-code&grant_type=authorization_code&redirect_uri=REDIRECT_URL&scope=scope1+scope2" { - t.Errorf("Unexpected exchange payload, %v is found.", string(body)) - } - w.Header().Set("Content-Type", "application/x-www-form-urlencoded") - w.Write([]byte("access_token=90d64460d14870c08c81352a05dedd3465940a7c&scope=user&token_type=bearer")) - })) - defer ts.Close() - conf := newConf(ts.URL) - tok, err := conf.Exchange(NoContext, "exchange-code") - if err != nil { - t.Error(err) - } - if !tok.Valid() { - t.Fatalf("Token invalid. Got: %#v", tok) - } - if tok.AccessToken != "90d64460d14870c08c81352a05dedd3465940a7c" { - t.Errorf("Unexpected access token, %#v.", tok.AccessToken) - } - if tok.TokenType != "bearer" { - t.Errorf("Unexpected token type, %#v.", tok.TokenType) - } - scope := tok.Extra("scope") - if scope != "user" { - t.Errorf("Unexpected value for scope: %v", scope) - } -} - -func TestExchangeRequest_JSONResponse(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.URL.String() != "/token" { - t.Errorf("Unexpected exchange request URL, %v is found.", r.URL) - } - headerAuth := r.Header.Get("Authorization") - if headerAuth != "Basic Q0xJRU5UX0lEOkNMSUVOVF9TRUNSRVQ=" { - t.Errorf("Unexpected authorization header, %v is found.", headerAuth) - } - headerContentType := r.Header.Get("Content-Type") - if headerContentType != "application/x-www-form-urlencoded" { - t.Errorf("Unexpected Content-Type header, %v is found.", headerContentType) - } - body, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Errorf("Failed reading request body: %s.", err) - } - if string(body) != "client_id=CLIENT_ID&code=exchange-code&grant_type=authorization_code&redirect_uri=REDIRECT_URL&scope=scope1+scope2" { - t.Errorf("Unexpected exchange payload, %v is found.", string(body)) - } - w.Header().Set("Content-Type", "application/json") - w.Write([]byte(`{"access_token": "90d64460d14870c08c81352a05dedd3465940a7c", "scope": "user", "token_type": "bearer", "expires_in": 86400}`)) - })) - defer ts.Close() - conf := newConf(ts.URL) - tok, err := conf.Exchange(NoContext, "exchange-code") - if err != nil { - t.Error(err) - } - if !tok.Valid() { - t.Fatalf("Token invalid. Got: %#v", tok) - } - if tok.AccessToken != "90d64460d14870c08c81352a05dedd3465940a7c" { - t.Errorf("Unexpected access token, %#v.", tok.AccessToken) - } - if tok.TokenType != "bearer" { - t.Errorf("Unexpected token type, %#v.", tok.TokenType) - } - scope := tok.Extra("scope") - if scope != "user" { - t.Errorf("Unexpected value for scope: %v", scope) - } - expiresIn := tok.Extra("expires_in") - if expiresIn != float64(86400) { - t.Errorf("Unexpected non-numeric value for expires_in: %v", expiresIn) - } -} - -func TestExtraValueRetrieval(t *testing.T) { - values := url.Values{} - - kvmap := map[string]string{ - "scope": "user", "token_type": "bearer", "expires_in": "86400.92", - "server_time": "1443571905.5606415", "referer_ip": "10.0.0.1", - "etag": "\"afZYj912P4alikMz_P11982\"", "request_id": "86400", - "untrimmed": " untrimmed ", - } - - for key, value := range kvmap { - values.Set(key, value) - } - - tok := Token{ - raw: values, - } - - scope := tok.Extra("scope") - if scope != "user" { - t.Errorf("Unexpected scope %v wanted \"user\"", scope) - } - serverTime := tok.Extra("server_time") - if serverTime != 1443571905.5606415 { - t.Errorf("Unexpected non-float64 value for server_time: %v", serverTime) - } - refererIp := tok.Extra("referer_ip") - if refererIp != "10.0.0.1" { - t.Errorf("Unexpected non-string value for referer_ip: %v", refererIp) - } - expires_in := tok.Extra("expires_in") - if expires_in != 86400.92 { - t.Errorf("Unexpected value for expires_in, wanted 86400 got %v", expires_in) - } - requestId := tok.Extra("request_id") - if requestId != int64(86400) { - t.Errorf("Unexpected non-int64 value for request_id: %v", requestId) - } - untrimmed := tok.Extra("untrimmed") - if untrimmed != " untrimmed " { - t.Errorf("Unexpected value for untrimmed, got %q expected \" untrimmed \"", untrimmed) - } -} - -const day = 24 * time.Hour - -func TestExchangeRequest_JSONResponse_Expiry(t *testing.T) { - seconds := int32(day.Seconds()) - jsonNumberType := reflect.TypeOf(json.Number("0")) - for _, c := range []struct { - expires string - expect error - }{ - {fmt.Sprintf(`"expires_in": %d`, seconds), nil}, - {fmt.Sprintf(`"expires_in": "%d"`, seconds), nil}, // PayPal case - {fmt.Sprintf(`"expires": %d`, seconds), nil}, // Facebook case - {`"expires": false`, &json.UnmarshalTypeError{Value: "bool", Type: jsonNumberType}}, // wrong type - {`"expires": {}`, &json.UnmarshalTypeError{Value: "object", Type: jsonNumberType}}, // wrong type - {`"expires": "zzz"`, &strconv.NumError{Func: "ParseInt", Num: "zzz", Err: strconv.ErrSyntax}}, // wrong value - } { - testExchangeRequest_JSONResponse_expiry(t, c.expires, c.expect) - } -} - -func testExchangeRequest_JSONResponse_expiry(t *testing.T, exp string, expect error) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") - w.Write([]byte(fmt.Sprintf(`{"access_token": "90d", "scope": "user", "token_type": "bearer", %s}`, exp))) - })) - defer ts.Close() - conf := newConf(ts.URL) - t1 := time.Now().Add(day) - tok, err := conf.Exchange(NoContext, "exchange-code") - t2 := time.Now().Add(day) - // Do a fmt.Sprint comparison so either side can be - // nil. fmt.Sprint just stringifies them to "", and no - // non-nil expected error ever stringifies as "", so this - // isn't terribly disgusting. We do this because Go 1.4 and - // Go 1.5 return a different deep value for - // json.UnmarshalTypeError. In Go 1.5, the - // json.UnmarshalTypeError contains a new field with a new - // non-zero value. Rather than ignore it here with reflect or - // add new files and +build tags, just look at the strings. - if fmt.Sprint(err) != fmt.Sprint(expect) { - t.Errorf("Error = %v; want %v", err, expect) - } - if err != nil { - return - } - if !tok.Valid() { - t.Fatalf("Token invalid. Got: %#v", tok) - } - expiry := tok.Expiry - if expiry.Before(t1) || expiry.After(t2) { - t.Errorf("Unexpected value for Expiry: %v (shold be between %v and %v)", expiry, t1, t2) - } -} - -func TestExchangeRequest_BadResponse(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") - w.Write([]byte(`{"scope": "user", "token_type": "bearer"}`)) - })) - defer ts.Close() - conf := newConf(ts.URL) - tok, err := conf.Exchange(NoContext, "code") - if err != nil { - t.Fatal(err) - } - if tok.AccessToken != "" { - t.Errorf("Unexpected access token, %#v.", tok.AccessToken) - } -} - -func TestExchangeRequest_BadResponseType(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") - w.Write([]byte(`{"access_token":123, "scope": "user", "token_type": "bearer"}`)) - })) - defer ts.Close() - conf := newConf(ts.URL) - _, err := conf.Exchange(NoContext, "exchange-code") - if err == nil { - t.Error("expected error from invalid access_token type") - } -} - -func TestExchangeRequest_NonBasicAuth(t *testing.T) { - tr := &mockTransport{ - rt: func(r *http.Request) (w *http.Response, err error) { - headerAuth := r.Header.Get("Authorization") - if headerAuth != "" { - t.Errorf("Unexpected authorization header, %v is found.", headerAuth) - } - return nil, errors.New("no response") - }, - } - c := &http.Client{Transport: tr} - conf := &Config{ - ClientID: "CLIENT_ID", - Endpoint: Endpoint{ - AuthURL: "https://accounts.google.com/auth", - TokenURL: "https://accounts.google.com/token", - }, - } - - ctx := context.WithValue(context.Background(), HTTPClient, c) - conf.Exchange(ctx, "code") -} - -func TestPasswordCredentialsTokenRequest(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - defer r.Body.Close() - expected := "/token" - if r.URL.String() != expected { - t.Errorf("URL = %q; want %q", r.URL, expected) - } - headerAuth := r.Header.Get("Authorization") - expected = "Basic Q0xJRU5UX0lEOkNMSUVOVF9TRUNSRVQ=" - if headerAuth != expected { - t.Errorf("Authorization header = %q; want %q", headerAuth, expected) - } - headerContentType := r.Header.Get("Content-Type") - expected = "application/x-www-form-urlencoded" - if headerContentType != expected { - t.Errorf("Content-Type header = %q; want %q", headerContentType, expected) - } - body, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Errorf("Failed reading request body: %s.", err) - } - expected = "client_id=CLIENT_ID&grant_type=password&password=password1&scope=scope1+scope2&username=user1" - if string(body) != expected { - t.Errorf("res.Body = %q; want %q", string(body), expected) - } - w.Header().Set("Content-Type", "application/x-www-form-urlencoded") - w.Write([]byte("access_token=90d64460d14870c08c81352a05dedd3465940a7c&scope=user&token_type=bearer")) - })) - defer ts.Close() - conf := newConf(ts.URL) - tok, err := conf.PasswordCredentialsToken(NoContext, "user1", "password1") - if err != nil { - t.Error(err) - } - if !tok.Valid() { - t.Fatalf("Token invalid. Got: %#v", tok) - } - expected := "90d64460d14870c08c81352a05dedd3465940a7c" - if tok.AccessToken != expected { - t.Errorf("AccessToken = %q; want %q", tok.AccessToken, expected) - } - expected = "bearer" - if tok.TokenType != expected { - t.Errorf("TokenType = %q; want %q", tok.TokenType, expected) - } -} - -func TestTokenRefreshRequest(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.URL.String() == "/somethingelse" { - return - } - if r.URL.String() != "/token" { - t.Errorf("Unexpected token refresh request URL, %v is found.", r.URL) - } - headerContentType := r.Header.Get("Content-Type") - if headerContentType != "application/x-www-form-urlencoded" { - t.Errorf("Unexpected Content-Type header, %v is found.", headerContentType) - } - body, _ := ioutil.ReadAll(r.Body) - if string(body) != "client_id=CLIENT_ID&grant_type=refresh_token&refresh_token=REFRESH_TOKEN" { - t.Errorf("Unexpected refresh token payload, %v is found.", string(body)) - } - })) - defer ts.Close() - conf := newConf(ts.URL) - c := conf.Client(NoContext, &Token{RefreshToken: "REFRESH_TOKEN"}) - c.Get(ts.URL + "/somethingelse") -} - -func TestFetchWithNoRefreshToken(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.URL.String() == "/somethingelse" { - return - } - if r.URL.String() != "/token" { - t.Errorf("Unexpected token refresh request URL, %v is found.", r.URL) - } - headerContentType := r.Header.Get("Content-Type") - if headerContentType != "application/x-www-form-urlencoded" { - t.Errorf("Unexpected Content-Type header, %v is found.", headerContentType) - } - body, _ := ioutil.ReadAll(r.Body) - if string(body) != "client_id=CLIENT_ID&grant_type=refresh_token&refresh_token=REFRESH_TOKEN" { - t.Errorf("Unexpected refresh token payload, %v is found.", string(body)) - } - })) - defer ts.Close() - conf := newConf(ts.URL) - c := conf.Client(NoContext, nil) - _, err := c.Get(ts.URL + "/somethingelse") - if err == nil { - t.Errorf("Fetch should return an error if no refresh token is set") - } -} - -func TestRefreshToken_RefreshTokenReplacement(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") - w.Write([]byte(`{"access_token":"ACCESS TOKEN", "scope": "user", "token_type": "bearer", "refresh_token": "NEW REFRESH TOKEN"}`)) - return - })) - defer ts.Close() - conf := newConf(ts.URL) - tkr := tokenRefresher{ - conf: conf, - ctx: NoContext, - refreshToken: "OLD REFRESH TOKEN", - } - tk, err := tkr.Token() - if err != nil { - t.Errorf("Unexpected refreshToken error returned: %v", err) - return - } - if tk.RefreshToken != tkr.refreshToken { - t.Errorf("tokenRefresher.refresh_token = %s; want %s", tkr.refreshToken, tk.RefreshToken) - } -} - -func TestConfigClientWithToken(t *testing.T) { - tok := &Token{ - AccessToken: "abc123", - } - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if got, want := r.Header.Get("Authorization"), fmt.Sprintf("Bearer %s", tok.AccessToken); got != want { - t.Errorf("Authorization header = %q; want %q", got, want) - } - return - })) - defer ts.Close() - conf := newConf(ts.URL) - - c := conf.Client(NoContext, tok) - req, err := http.NewRequest("GET", ts.URL, nil) - if err != nil { - t.Error(err) - } - _, err = c.Do(req) - if err != nil { - t.Error(err) - } -} diff --git a/vendor/golang.org/x/oauth2/token_test.go b/vendor/golang.org/x/oauth2/token_test.go deleted file mode 100644 index 80db83c29c..0000000000 --- a/vendor/golang.org/x/oauth2/token_test.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package oauth2 - -import ( - "testing" - "time" -) - -func TestTokenExtra(t *testing.T) { - type testCase struct { - key string - val interface{} - want interface{} - } - const key = "extra-key" - cases := []testCase{ - {key: key, val: "abc", want: "abc"}, - {key: key, val: 123, want: 123}, - {key: key, val: "", want: ""}, - {key: "other-key", val: "def", want: nil}, - } - for _, tc := range cases { - extra := make(map[string]interface{}) - extra[tc.key] = tc.val - tok := &Token{raw: extra} - if got, want := tok.Extra(key), tc.want; got != want { - t.Errorf("Extra(%q) = %q; want %q", key, got, want) - } - } -} - -func TestTokenExpiry(t *testing.T) { - now := time.Now() - cases := []struct { - name string - tok *Token - want bool - }{ - {name: "12 seconds", tok: &Token{Expiry: now.Add(12 * time.Second)}, want: false}, - {name: "10 seconds", tok: &Token{Expiry: now.Add(expiryDelta)}, want: true}, - {name: "-1 hour", tok: &Token{Expiry: now.Add(-1 * time.Hour)}, want: true}, - } - for _, tc := range cases { - if got, want := tc.tok.expired(), tc.want; got != want { - t.Errorf("expired (%q) = %v; want %v", tc.name, got, want) - } - } -} - -func TestTokenTypeMethod(t *testing.T) { - cases := []struct { - name string - tok *Token - want string - }{ - {name: "bearer-mixed_case", tok: &Token{TokenType: "beAREr"}, want: "Bearer"}, - {name: "default-bearer", tok: &Token{}, want: "Bearer"}, - {name: "basic", tok: &Token{TokenType: "basic"}, want: "Basic"}, - {name: "basic-capitalized", tok: &Token{TokenType: "Basic"}, want: "Basic"}, - {name: "mac", tok: &Token{TokenType: "mac"}, want: "MAC"}, - {name: "mac-caps", tok: &Token{TokenType: "MAC"}, want: "MAC"}, - {name: "mac-mixed_case", tok: &Token{TokenType: "mAc"}, want: "MAC"}, - } - for _, tc := range cases { - if got, want := tc.tok.Type(), tc.want; got != want { - t.Errorf("TokenType(%q) = %v; want %v", tc.name, got, want) - } - } -} diff --git a/vendor/golang.org/x/oauth2/transport_test.go b/vendor/golang.org/x/oauth2/transport_test.go deleted file mode 100644 index 9bb1383f04..0000000000 --- a/vendor/golang.org/x/oauth2/transport_test.go +++ /dev/null @@ -1,108 +0,0 @@ -package oauth2 - -import ( - "net/http" - "net/http/httptest" - "testing" - "time" -) - -type tokenSource struct{ token *Token } - -func (t *tokenSource) Token() (*Token, error) { - return t.token, nil -} - -func TestTransportNilTokenSource(t *testing.T) { - tr := &Transport{} - server := newMockServer(func(w http.ResponseWriter, r *http.Request) {}) - defer server.Close() - client := &http.Client{Transport: tr} - res, err := client.Get(server.URL) - if err == nil { - t.Errorf("a nil Source was passed into the transport expected an error") - } - if res != nil { - t.Errorf("expected a nil response, got %v", res) - } -} - -func TestTransportTokenSource(t *testing.T) { - ts := &tokenSource{ - token: &Token{ - AccessToken: "abc", - }, - } - tr := &Transport{ - Source: ts, - } - server := newMockServer(func(w http.ResponseWriter, r *http.Request) { - if r.Header.Get("Authorization") != "Bearer abc" { - t.Errorf("Transport doesn't set the Authorization header from the fetched token") - } - }) - defer server.Close() - client := &http.Client{Transport: tr} - res, err := client.Get(server.URL) - if err != nil { - t.Fatal(err) - } - res.Body.Close() -} - -// Test for case-sensitive token types, per https://github.com/golang/oauth2/issues/113 -func TestTransportTokenSourceTypes(t *testing.T) { - const val = "abc" - tests := []struct { - key string - val string - want string - }{ - {key: "bearer", val: val, want: "Bearer abc"}, - {key: "mac", val: val, want: "MAC abc"}, - {key: "basic", val: val, want: "Basic abc"}, - } - for _, tc := range tests { - ts := &tokenSource{ - token: &Token{ - AccessToken: tc.val, - TokenType: tc.key, - }, - } - tr := &Transport{ - Source: ts, - } - server := newMockServer(func(w http.ResponseWriter, r *http.Request) { - if got, want := r.Header.Get("Authorization"), tc.want; got != want { - t.Errorf("Authorization header (%q) = %q; want %q", val, got, want) - } - }) - defer server.Close() - client := &http.Client{Transport: tr} - res, err := client.Get(server.URL) - if err != nil { - t.Fatal(err) - } - res.Body.Close() - } -} - -func TestTokenValidNoAccessToken(t *testing.T) { - token := &Token{} - if token.Valid() { - t.Errorf("Token should not be valid with no access token") - } -} - -func TestExpiredWithExpiry(t *testing.T) { - token := &Token{ - Expiry: time.Now().Add(-5 * time.Hour), - } - if token.Valid() { - t.Errorf("Token should not be valid if it expired in the past") - } -} - -func newMockServer(handler func(w http.ResponseWriter, r *http.Request)) *httptest.Server { - return httptest.NewServer(http.HandlerFunc(handler)) -} diff --git a/vendor/golang.org/x/sys/unix/.gitignore b/vendor/golang.org/x/sys/unix/.gitignore deleted file mode 100644 index e482715909..0000000000 --- a/vendor/golang.org/x/sys/unix/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_obj/ diff --git a/vendor/golang.org/x/sys/unix/asm.s b/vendor/golang.org/x/sys/unix/asm.s index 8ed2fdb94b..d4ca868f17 100644 --- a/vendor/golang.org/x/sys/unix/asm.s +++ b/vendor/golang.org/x/sys/unix/asm.s @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - #include "textflag.h" TEXT ·use(SB),NOSPLIT,$0 diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_386.s b/vendor/golang.org/x/sys/unix/asm_darwin_386.s index 8a7278319e..f9338dad7d 100644 --- a/vendor/golang.org/x/sys/unix/asm_darwin_386.s +++ b/vendor/golang.org/x/sys/unix/asm_darwin_386.s @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - #include "textflag.h" // diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s b/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s index 6321421f27..9adb6523ce 100644 --- a/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - #include "textflag.h" // @@ -19,10 +17,7 @@ TEXT ·Syscall(SB),NOSPLIT,$0-56 TEXT ·Syscall6(SB),NOSPLIT,$0-80 JMP syscall·Syscall6(SB) -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 +TEXT ·RawSyscall(SB),NOSPLIT,$0-56 JMP syscall·RawSyscall(SB) TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_arm.s b/vendor/golang.org/x/sys/unix/asm_darwin_arm.s deleted file mode 100644 index 333242d506..0000000000 --- a/vendor/golang.org/x/sys/unix/asm_darwin_arm.s +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo -// +build arm,darwin - -#include "textflag.h" - -// -// System call support for ARM, Darwin -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-28 - B syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-40 - B syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-52 - B syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-28 - B syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 - B syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s b/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s deleted file mode 100644 index 97e0174371..0000000000 --- a/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo -// +build arm64,darwin - -#include "textflag.h" - -// -// System call support for AMD64, Darwin -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - B syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - B syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - B syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - B syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - B syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_dragonfly_386.s b/vendor/golang.org/x/sys/unix/asm_dragonfly_386.s index 7e55e0d317..68aa5e4dcb 100644 --- a/vendor/golang.org/x/sys/unix/asm_dragonfly_386.s +++ b/vendor/golang.org/x/sys/unix/asm_dragonfly_386.s @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - #include "textflag.h" // diff --git a/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s b/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s index d5ed6726cc..77b1bf9268 100644 --- a/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - #include "textflag.h" // diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_386.s b/vendor/golang.org/x/sys/unix/asm_freebsd_386.s index c9a0a26015..1146f0bca4 100644 --- a/vendor/golang.org/x/sys/unix/asm_freebsd_386.s +++ b/vendor/golang.org/x/sys/unix/asm_freebsd_386.s @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - #include "textflag.h" // diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s index 35172477c8..d80fd12ab6 100644 --- a/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - #include "textflag.h" // diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s b/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s index 9227c875bf..aca3f3f768 100644 --- a/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s +++ b/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - #include "textflag.h" // diff --git a/vendor/golang.org/x/sys/unix/asm_linux_386.s b/vendor/golang.org/x/sys/unix/asm_linux_386.s index 4db2909323..5d3ad9ad1e 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_386.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_386.s @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - #include "textflag.h" // diff --git a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s b/vendor/golang.org/x/sys/unix/asm_linux_amd64.s index 44e25c62f9..0c8c7786f5 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_amd64.s @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - #include "textflag.h" // diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm.s b/vendor/golang.org/x/sys/unix/asm_linux_arm.s index cf0b574658..4137b58f31 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_arm.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_arm.s @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - #include "textflag.h" // diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s b/vendor/golang.org/x/sys/unix/asm_linux_arm64.s deleted file mode 100644 index 4be9bfedea..0000000000 --- a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux -// +build arm64 -// +build !gccgo - -#include "textflag.h" - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - B syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - B syscall·Syscall6(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - B syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - B syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s deleted file mode 100644 index 8d231feb4b..0000000000 --- a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux -// +build ppc64 ppc64le -// +build !gccgo - -#include "textflag.h" - -// -// System calls for ppc64, Linux -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - BR syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - BR syscall·Syscall6(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - BR syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - BR syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_386.s b/vendor/golang.org/x/sys/unix/asm_netbsd_386.s index 48bdcd7632..682e4bd5b4 100644 --- a/vendor/golang.org/x/sys/unix/asm_netbsd_386.s +++ b/vendor/golang.org/x/sys/unix/asm_netbsd_386.s @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - #include "textflag.h" // diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s index 2ede05c72f..e80eaddbd8 100644 --- a/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - #include "textflag.h" // diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s b/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s index e8928571c4..0b673a32e2 100644 --- a/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s +++ b/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - #include "textflag.h" // diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_386.s b/vendor/golang.org/x/sys/unix/asm_openbsd_386.s index 00576f3c83..65b0e42f9f 100644 --- a/vendor/golang.org/x/sys/unix/asm_openbsd_386.s +++ b/vendor/golang.org/x/sys/unix/asm_openbsd_386.s @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - #include "textflag.h" // diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s index 790ef77f86..55aada1945 100644 --- a/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - #include "textflag.h" // diff --git a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s b/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s index 43ed17a05f..f61213185a 100644 --- a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s @@ -2,16 +2,21 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo - -#include "textflag.h" - // -// System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go +// System calls for amd64, Solaris are implemented in runtime/syscall_solaris.goc // -TEXT ·sysvicall6(SB),NOSPLIT,$0-64 +TEXT ·sysvicall6(SB), 7, $0-64 JMP syscall·sysvicall6(SB) -TEXT ·rawSysvicall6(SB),NOSPLIT,$0-64 +TEXT ·rawSysvicall6(SB), 7, $0-64 JMP syscall·rawSysvicall6(SB) + +TEXT ·dlopen(SB), 7, $0-16 + JMP syscall·dlopen(SB) + +TEXT ·dlclose(SB), 7, $0-8 + JMP syscall·dlclose(SB) + +TEXT ·dlsym(SB), 7, $0-16 + JMP syscall·dlsym(SB) diff --git a/vendor/golang.org/x/sys/unix/bpf_bsd.go b/vendor/golang.org/x/sys/unix/bpf_bsd.go new file mode 100644 index 0000000000..df33e86d4e --- /dev/null +++ b/vendor/golang.org/x/sys/unix/bpf_bsd.go @@ -0,0 +1,170 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build darwin dragonfly freebsd netbsd openbsd + +// Berkeley packet filter for BSD variants + +package unix + +import ( + "syscall" + "unsafe" +) + +func BpfStmt(code, k int) *BpfInsn { + return &BpfInsn{Code: uint16(code), K: uint32(k)} +} + +func BpfJump(code, k, jt, jf int) *BpfInsn { + return &BpfInsn{Code: uint16(code), Jt: uint8(jt), Jf: uint8(jf), K: uint32(k)} +} + +func BpfBuflen(fd int) (int, error) { + var l int + _, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGBLEN, uintptr(unsafe.Pointer(&l))) + if err != 0 { + return 0, syscall.Errno(err) + } + return l, nil +} + +func SetBpfBuflen(fd, l int) (int, error) { + _, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSBLEN, uintptr(unsafe.Pointer(&l))) + if err != 0 { + return 0, syscall.Errno(err) + } + return l, nil +} + +func BpfDatalink(fd int) (int, error) { + var t int + _, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGDLT, uintptr(unsafe.Pointer(&t))) + if err != 0 { + return 0, syscall.Errno(err) + } + return t, nil +} + +func SetBpfDatalink(fd, t int) (int, error) { + _, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSDLT, uintptr(unsafe.Pointer(&t))) + if err != 0 { + return 0, syscall.Errno(err) + } + return t, nil +} + +func SetBpfPromisc(fd, m int) error { + _, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCPROMISC, uintptr(unsafe.Pointer(&m))) + if err != 0 { + return syscall.Errno(err) + } + return nil +} + +func FlushBpf(fd int) error { + _, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCFLUSH, 0) + if err != 0 { + return syscall.Errno(err) + } + return nil +} + +type ivalue struct { + name [IFNAMSIZ]byte + value int16 +} + +func BpfInterface(fd int, name string) (string, error) { + var iv ivalue + _, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGETIF, uintptr(unsafe.Pointer(&iv))) + if err != 0 { + return "", syscall.Errno(err) + } + return name, nil +} + +func SetBpfInterface(fd int, name string) error { + var iv ivalue + copy(iv.name[:], []byte(name)) + _, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSETIF, uintptr(unsafe.Pointer(&iv))) + if err != 0 { + return syscall.Errno(err) + } + return nil +} + +func BpfTimeout(fd int) (*Timeval, error) { + var tv Timeval + _, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGRTIMEOUT, uintptr(unsafe.Pointer(&tv))) + if err != 0 { + return nil, syscall.Errno(err) + } + return &tv, nil +} + +func SetBpfTimeout(fd int, tv *Timeval) error { + _, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSRTIMEOUT, uintptr(unsafe.Pointer(tv))) + if err != 0 { + return syscall.Errno(err) + } + return nil +} + +func BpfStats(fd int) (*BpfStat, error) { + var s BpfStat + _, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGSTATS, uintptr(unsafe.Pointer(&s))) + if err != 0 { + return nil, syscall.Errno(err) + } + return &s, nil +} + +func SetBpfImmediate(fd, m int) error { + _, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCIMMEDIATE, uintptr(unsafe.Pointer(&m))) + if err != 0 { + return syscall.Errno(err) + } + return nil +} + +func SetBpf(fd int, i []BpfInsn) error { + var p BpfProgram + p.Len = uint32(len(i)) + p.Insns = (*BpfInsn)(unsafe.Pointer(&i[0])) + _, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSETF, uintptr(unsafe.Pointer(&p))) + if err != 0 { + return syscall.Errno(err) + } + return nil +} + +func CheckBpfVersion(fd int) error { + var v BpfVersion + _, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCVERSION, uintptr(unsafe.Pointer(&v))) + if err != 0 { + return syscall.Errno(err) + } + if v.Major != BPF_MAJOR_VERSION || v.Minor != BPF_MINOR_VERSION { + return EINVAL + } + return nil +} + +func BpfHeadercmpl(fd int) (int, error) { + var f int + _, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGHDRCMPLT, uintptr(unsafe.Pointer(&f))) + if err != 0 { + return 0, syscall.Errno(err) + } + return f, nil +} + +func SetBpfHeadercmpl(fd, f int) error { + _, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSHDRCMPLT, uintptr(unsafe.Pointer(&f))) + if err != 0 { + return syscall.Errno(err) + } + return nil +} diff --git a/vendor/golang.org/x/sys/unix/constants.go b/vendor/golang.org/x/sys/unix/constants.go deleted file mode 100644 index a96f0ebc26..0000000000 --- a/vendor/golang.org/x/sys/unix/constants.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux netbsd openbsd solaris - -package unix - -const ( - R_OK = 0x4 - W_OK = 0x2 - X_OK = 0x1 -) diff --git a/vendor/golang.org/x/sys/unix/creds_test.go b/vendor/golang.org/x/sys/unix/creds_test.go deleted file mode 100644 index eaae7c367f..0000000000 --- a/vendor/golang.org/x/sys/unix/creds_test.go +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux - -package unix_test - -import ( - "bytes" - "net" - "os" - "syscall" - "testing" - - "golang.org/x/sys/unix" -) - -// TestSCMCredentials tests the sending and receiving of credentials -// (PID, UID, GID) in an ancillary message between two UNIX -// sockets. The SO_PASSCRED socket option is enabled on the sending -// socket for this to work. -func TestSCMCredentials(t *testing.T) { - fds, err := unix.Socketpair(unix.AF_LOCAL, unix.SOCK_STREAM, 0) - if err != nil { - t.Fatalf("Socketpair: %v", err) - } - defer unix.Close(fds[0]) - defer unix.Close(fds[1]) - - err = unix.SetsockoptInt(fds[0], unix.SOL_SOCKET, unix.SO_PASSCRED, 1) - if err != nil { - t.Fatalf("SetsockoptInt: %v", err) - } - - srvFile := os.NewFile(uintptr(fds[0]), "server") - defer srvFile.Close() - srv, err := net.FileConn(srvFile) - if err != nil { - t.Errorf("FileConn: %v", err) - return - } - defer srv.Close() - - cliFile := os.NewFile(uintptr(fds[1]), "client") - defer cliFile.Close() - cli, err := net.FileConn(cliFile) - if err != nil { - t.Errorf("FileConn: %v", err) - return - } - defer cli.Close() - - var ucred unix.Ucred - if os.Getuid() != 0 { - ucred.Pid = int32(os.Getpid()) - ucred.Uid = 0 - ucred.Gid = 0 - oob := unix.UnixCredentials(&ucred) - _, _, err := cli.(*net.UnixConn).WriteMsgUnix(nil, oob, nil) - if op, ok := err.(*net.OpError); ok { - err = op.Err - } - if sys, ok := err.(*os.SyscallError); ok { - err = sys.Err - } - if err != syscall.EPERM { - t.Fatalf("WriteMsgUnix failed with %v, want EPERM", err) - } - } - - ucred.Pid = int32(os.Getpid()) - ucred.Uid = uint32(os.Getuid()) - ucred.Gid = uint32(os.Getgid()) - oob := unix.UnixCredentials(&ucred) - - // this is going to send a dummy byte - n, oobn, err := cli.(*net.UnixConn).WriteMsgUnix(nil, oob, nil) - if err != nil { - t.Fatalf("WriteMsgUnix: %v", err) - } - if n != 0 { - t.Fatalf("WriteMsgUnix n = %d, want 0", n) - } - if oobn != len(oob) { - t.Fatalf("WriteMsgUnix oobn = %d, want %d", oobn, len(oob)) - } - - oob2 := make([]byte, 10*len(oob)) - n, oobn2, flags, _, err := srv.(*net.UnixConn).ReadMsgUnix(nil, oob2) - if err != nil { - t.Fatalf("ReadMsgUnix: %v", err) - } - if flags != 0 { - t.Fatalf("ReadMsgUnix flags = 0x%x, want 0", flags) - } - if n != 1 { - t.Fatalf("ReadMsgUnix n = %d, want 1 (dummy byte)", n) - } - if oobn2 != oobn { - // without SO_PASSCRED set on the socket, ReadMsgUnix will - // return zero oob bytes - t.Fatalf("ReadMsgUnix oobn = %d, want %d", oobn2, oobn) - } - oob2 = oob2[:oobn2] - if !bytes.Equal(oob, oob2) { - t.Fatal("ReadMsgUnix oob bytes don't match") - } - - scm, err := unix.ParseSocketControlMessage(oob2) - if err != nil { - t.Fatalf("ParseSocketControlMessage: %v", err) - } - newUcred, err := unix.ParseUnixCredentials(&scm[0]) - if err != nil { - t.Fatalf("ParseUnixCredentials: %v", err) - } - if *newUcred != ucred { - t.Fatalf("ParseUnixCredentials = %+v, want %+v", newUcred, ucred) - } -} diff --git a/vendor/golang.org/x/sys/unix/export_test.go b/vendor/golang.org/x/sys/unix/export_test.go deleted file mode 100644 index b4fdd970b6..0000000000 --- a/vendor/golang.org/x/sys/unix/export_test.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux netbsd openbsd solaris - -package unix - -var Itoa = itoa diff --git a/vendor/golang.org/x/sys/unix/gccgo.go b/vendor/golang.org/x/sys/unix/gccgo.go deleted file mode 100644 index 94c8232124..0000000000 --- a/vendor/golang.org/x/sys/unix/gccgo.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build gccgo - -package unix - -import "syscall" - -// We can't use the gc-syntax .s files for gccgo. On the plus side -// much of the functionality can be written directly in Go. - -//extern gccgoRealSyscall -func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) - -func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { - syscall.Entersyscall() - r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) - syscall.Exitsyscall() - return r, 0, syscall.Errno(errno) -} - -func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { - syscall.Entersyscall() - r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) - syscall.Exitsyscall() - return r, 0, syscall.Errno(errno) -} - -func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) { - syscall.Entersyscall() - r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) - syscall.Exitsyscall() - return r, 0, syscall.Errno(errno) -} - -func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { - r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) - return r, 0, syscall.Errno(errno) -} - -func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { - r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) - return r, 0, syscall.Errno(errno) -} diff --git a/vendor/golang.org/x/sys/unix/gccgo_c.c b/vendor/golang.org/x/sys/unix/gccgo_c.c deleted file mode 100644 index 07f6be0392..0000000000 --- a/vendor/golang.org/x/sys/unix/gccgo_c.c +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build gccgo - -#include -#include -#include - -#define _STRINGIFY2_(x) #x -#define _STRINGIFY_(x) _STRINGIFY2_(x) -#define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) - -// Call syscall from C code because the gccgo support for calling from -// Go to C does not support varargs functions. - -struct ret { - uintptr_t r; - uintptr_t err; -}; - -struct ret -gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) -{ - struct ret r; - - errno = 0; - r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); - r.err = errno; - return r; -} - -// Define the use function in C so that it is not inlined. - -extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline)); - -void -use(void *p __attribute__ ((unused))) -{ -} diff --git a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go b/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go deleted file mode 100644 index bffe1a77db..0000000000 --- a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build gccgo,linux,amd64 - -package unix - -import "syscall" - -//extern gettimeofday -func realGettimeofday(*Timeval, *byte) int32 - -func gettimeofday(tv *Timeval) (err syscall.Errno) { - r := realGettimeofday(tv, nil) - if r < 0 { - return syscall.GetErrno() - } - return 0 -} diff --git a/vendor/golang.org/x/sys/unix/lsf_linux.go b/vendor/golang.org/x/sys/unix/lsf_linux.go new file mode 100644 index 0000000000..377808d1ab --- /dev/null +++ b/vendor/golang.org/x/sys/unix/lsf_linux.go @@ -0,0 +1,79 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Linux socket filter + +package unix + +import ( + "syscall" + "unsafe" +) + +func LsfStmt(code, k int) *SockFilter { + return &SockFilter{Code: uint16(code), K: uint32(k)} +} + +func LsfJump(code, k, jt, jf int) *SockFilter { + return &SockFilter{Code: uint16(code), Jt: uint8(jt), Jf: uint8(jf), K: uint32(k)} +} + +func LsfSocket(ifindex, proto int) (int, error) { + var lsall SockaddrLinklayer + s, e := Socket(AF_PACKET, SOCK_RAW, proto) + if e != nil { + return 0, e + } + p := (*[2]byte)(unsafe.Pointer(&lsall.Protocol)) + p[0] = byte(proto >> 8) + p[1] = byte(proto) + lsall.Ifindex = ifindex + e = Bind(s, &lsall) + if e != nil { + Close(s) + return 0, e + } + return s, nil +} + +type iflags struct { + name [IFNAMSIZ]byte + flags uint16 +} + +func SetLsfPromisc(name string, m bool) error { + s, e := Socket(AF_INET, SOCK_DGRAM, 0) + if e != nil { + return e + } + defer Close(s) + var ifl iflags + copy(ifl.name[:], []byte(name)) + _, _, ep := Syscall(SYS_IOCTL, uintptr(s), SIOCGIFFLAGS, uintptr(unsafe.Pointer(&ifl))) + if ep != 0 { + return syscall.Errno(ep) + } + if m { + ifl.flags |= uint16(IFF_PROMISC) + } else { + ifl.flags &= ^uint16(IFF_PROMISC) + } + _, _, ep = Syscall(SYS_IOCTL, uintptr(s), SIOCSIFFLAGS, uintptr(unsafe.Pointer(&ifl))) + if ep != 0 { + return syscall.Errno(ep) + } + return nil +} + +func AttachLsf(fd int, i []SockFilter) error { + var p SockFprog + p.Len = uint16(len(i)) + p.Filter = (*SockFilter)(unsafe.Pointer(&i[0])) + return setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, unsafe.Pointer(&p), unsafe.Sizeof(p)) +} + +func DetachLsf(fd int) error { + var dummy int + return setsockopt(fd, SOL_SOCKET, SO_DETACH_FILTER, unsafe.Pointer(&dummy), unsafe.Sizeof(dummy)) +} diff --git a/vendor/golang.org/x/sys/unix/mkall.sh b/vendor/golang.org/x/sys/unix/mkall.sh old mode 100755 new mode 100644 index de95a4bbcf..5fb4166a49 --- a/vendor/golang.org/x/sys/unix/mkall.sh +++ b/vendor/golang.org/x/sys/unix/mkall.sh @@ -107,7 +107,6 @@ case "$#" in exit 2 esac -GOOSARCH_in=syscall_$GOOSARCH.go case "$GOOSARCH" in _* | *_ | _) echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2 @@ -116,22 +115,12 @@ _* | *_ | _) darwin_386) mkerrors="$mkerrors -m32" mksyscall="./mksyscall.pl -l32" - mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h" + mksysnum="./mksysnum_darwin.pl /usr/include/sys/syscall.h" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; darwin_amd64) mkerrors="$mkerrors -m64" - mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h" - mktypes="GOARCH=$GOARCH go tool cgo -godefs" - ;; -darwin_arm) - mkerrors="$mkerrors" - mksysnum="./mksysnum_darwin.pl /usr/include/sys/syscall.h" - mktypes="GOARCH=$GOARCH go tool cgo -godefs" - ;; -darwin_arm64) - mkerrors="$mkerrors -m64" - mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h" + mksysnum="./mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/sys/syscall.h" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; dragonfly_386) @@ -184,32 +173,7 @@ linux_amd64) linux_arm) mkerrors="$mkerrors" mksyscall="./mksyscall.pl -l32 -arm" - mksysnum="curl -s 'http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/arch/arm/include/uapi/asm/unistd.h' | ./mksysnum_linux.pl -" - mktypes="GOARCH=$GOARCH go tool cgo -godefs" - ;; -linux_arm64) - unistd_h=$(ls -1 /usr/include/asm/unistd.h /usr/include/asm-generic/unistd.h 2>/dev/null | head -1) - if [ "$unistd_h" = "" ]; then - echo >&2 cannot find unistd_64.h - exit 1 - fi - mksysnum="./mksysnum_linux.pl $unistd_h" - # Let the type of C char be singed for making the bare syscall - # API consistent across over platforms. - mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" - ;; -linux_ppc64) - GOOSARCH_in=syscall_linux_ppc64x.go - unistd_h=/usr/include/asm/unistd.h - mkerrors="$mkerrors -m64" - mksysnum="./mksysnum_linux.pl $unistd_h" - mktypes="GOARCH=$GOARCH go tool cgo -godefs" - ;; -linux_ppc64le) - GOOSARCH_in=syscall_linux_ppc64x.go - unistd_h=/usr/include/powerpc64le-linux-gnu/asm/unistd.h - mkerrors="$mkerrors -m64" - mksysnum="./mksysnum_linux.pl $unistd_h" + mksysnum="curl -s 'http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/arch/arm/include/uapi/asm/unistd.h' | ./mksysnum_linux.pl" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; netbsd_386) @@ -229,7 +193,7 @@ openbsd_386) mksyscall="./mksyscall.pl -l32 -openbsd" mksysctl="./mksysctl_openbsd.pl" zsysctl="zsysctl_openbsd.go" - mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl" + mksysnum="curl -s 'http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; openbsd_amd64) @@ -237,7 +201,7 @@ openbsd_amd64) mksyscall="./mksyscall.pl -openbsd" mksysctl="./mksysctl_openbsd.pl" zsysctl="zsysctl_openbsd.go" - mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl" + mksysnum="curl -s 'http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; solaris_amd64) @@ -262,13 +226,10 @@ esac syscall_goos="syscall_bsd.go $syscall_goos" ;; esac - if [ -n "$mksyscall" ]; then echo "$mksyscall $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; fi + if [ -n "$mksyscall" ]; then echo "$mksyscall $syscall_goos syscall_$GOOSARCH.go |gofmt >zsyscall_$GOOSARCH.go"; fi ;; esac if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi - if [ -n "$mktypes" ]; then - echo "echo // +build $GOARCH,$GOOS > ztypes_$GOOSARCH.go"; - echo "$mktypes types_$GOOS.go | gofmt >>ztypes_$GOOSARCH.go"; - fi + if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go |gofmt >ztypes_$GOOSARCH.go"; fi ) | $run diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh old mode 100755 new mode 100644 index c40d788c4a..0f4043f992 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -11,17 +11,7 @@ unset LANG export LC_ALL=C export LC_CTYPE=C -if test -z "$GOARCH" -o -z "$GOOS"; then - echo 1>&2 "GOARCH or GOOS not defined in environment" - exit 1 -fi - -CC=${CC:-cc} - -if [[ "$GOOS" -eq "solaris" ]]; then - # Assumes GNU versions of utilities in PATH. - export PATH=/usr/gnu/bin:$PATH -fi +CC=${CC:-gcc} uname=$(uname) @@ -43,6 +33,7 @@ includes_Darwin=' #include #include #include +#include #include ' @@ -83,7 +74,6 @@ includes_FreeBSD=' #include #include #include -#include #if __FreeBSD__ >= 10 #define IFT_CARP 0xf8 // IFT_CARP is deprecated in FreeBSD 10 @@ -97,9 +87,7 @@ includes_FreeBSD=' includes_Linux=' #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE -#ifndef __LP64__ #define _FILE_OFFSET_BITS 64 -#endif #define _GNU_SOURCE #include @@ -128,19 +116,11 @@ includes_Linux=' #include #include #include -#include +#include #ifndef MSG_FASTOPEN #define MSG_FASTOPEN 0x20000000 #endif - -#ifndef PTRACE_GETREGS -#define PTRACE_GETREGS 0xc -#endif - -#ifndef PTRACE_SETREGS -#define PTRACE_SETREGS 0xd -#endif ' includes_NetBSD=' @@ -205,7 +185,6 @@ includes_OpenBSD=' ' includes_SunOS=' -#include #include #include #include @@ -238,7 +217,6 @@ includes=' #include #include #include -#include ' ccflags="$@" @@ -265,10 +243,6 @@ ccflags="$@" $2 ~ /^(SIGEV_|SIGSTKSZ|SIGRT(MIN|MAX))/ {next} $2 ~ /^(SCM_SRCRT)$/ {next} $2 ~ /^(MAP_FAILED)$/ {next} - $2 ~ /^ELF_.*$/ {next}# contains ELF_ARCH, etc. - - $2 ~ /^EXTATTR_NAMESPACE_NAMES/ || - $2 ~ /^EXTATTR_NAMESPACE_[A-Z]+_STRING/ {next} $2 !~ /^ETH_/ && $2 !~ /^EPROC_/ && @@ -276,31 +250,21 @@ ccflags="$@" $2 !~ /^EXPR_/ && $2 ~ /^E[A-Z0-9_]+$/ || $2 ~ /^B[0-9_]+$/ || - $2 == "BOTHER" || - $2 ~ /^CI?BAUD(EX)?$/ || - $2 == "IBSHIFT" || $2 ~ /^V[A-Z0-9]+$/ || $2 ~ /^CS[A-Z0-9]/ || - $2 ~ /^I(SIG|CANON|CRNL|UCLC|EXTEN|MAXBEL|STRIP|UTF8)$/ || + $2 ~ /^I(SIG|CANON|CRNL|EXTEN|MAXBEL|STRIP|UTF8)$/ || $2 ~ /^IGN/ || $2 ~ /^IX(ON|ANY|OFF)$/ || $2 ~ /^IN(LCR|PCK)$/ || $2 ~ /(^FLU?SH)|(FLU?SH$)/ || - $2 ~ /^C(LOCAL|READ|MSPAR|RTSCTS)$/ || + $2 ~ /^C(LOCAL|READ)$/ || $2 == "BRKINT" || $2 == "HUPCL" || $2 == "PENDIN" || $2 == "TOSTOP" || - $2 == "XCASE" || - $2 == "ALTWERASE" || - $2 == "NOKERNINFO" || $2 ~ /^PAR/ || $2 ~ /^SIG[^_]/ || - $2 ~ /^O[CNPFPL][A-Z]+[^_][A-Z]+$/ || - $2 ~ /^(NL|CR|TAB|BS|VT|FF)DLY$/ || - $2 ~ /^(NL|CR|TAB|BS|VT|FF)[0-9]$/ || - $2 ~ /^O?XTABS$/ || - $2 ~ /^TC[IO](ON|OFF)$/ || + $2 ~ /^O[CNPFP][A-Z]+[^_][A-Z]+$/ || $2 ~ /^IN_/ || $2 ~ /^LOCK_(SH|EX|NB|UN)$/ || $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ || @@ -319,9 +283,6 @@ ccflags="$@" $2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P)_/ || $2 ~ /^SIOC/ || $2 ~ /^TIOC/ || - $2 ~ /^TCGET/ || - $2 ~ /^TCSET/ || - $2 ~ /^TC(FLSH|SBRKP?|XONC)$/ || $2 !~ "RTF_BITS" && $2 ~ /^(IFF|IFT|NET_RT|RTM|RTF|RTV|RTA|RTAX)_/ || $2 ~ /^BIOC/ || @@ -331,7 +292,6 @@ ccflags="$@" $2 ~ /^CLONE_[A-Z_]+/ || $2 !~ /^(BPF_TIMEVAL)$/ && $2 ~ /^(BPF|DLT)_/ || - $2 ~ /^CLOCK_/ || $2 !~ "WMESGLEN" && $2 ~ /^W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", $2, $2)} $2 ~ /^__WCOREFLAG$/ {next} @@ -370,8 +330,6 @@ echo '#include ' | $CC -x c - -E -dM $ccflags | echo '// mkerrors.sh' "$@" echo '// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT' echo -echo "// +build ${GOARCH},${GOOS}" -echo go tool cgo -godefs -- "$@" _const.go >_error.out cat _error.out | grep -vf _error.grep | grep -vf _signal.grep echo diff --git a/vendor/golang.org/x/sys/unix/mksyscall.pl b/vendor/golang.org/x/sys/unix/mksyscall.pl old mode 100755 new mode 100644 index b1e7766dae..c5465a7451 --- a/vendor/golang.org/x/sys/unix/mksyscall.pl +++ b/vendor/golang.org/x/sys/unix/mksyscall.pl @@ -63,11 +63,6 @@ if($ARGV[0] =~ /^-/) { exit 1; } -if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { - print STDERR "GOARCH or GOOS not defined in environment\n"; - exit 1; -} - sub parseparamlist($) { my ($list) = @_; $list =~ s/^\s*//; @@ -289,7 +284,7 @@ while(<>) { $text .= "\t}\n"; } elsif ($do_errno) { $text .= "\tif e1 != 0 {\n"; - $text .= "\t\terr = errnoErr(e1)\n"; + $text .= "\t\terr = e1\n"; $text .= "\t}\n"; } $text .= "\treturn\n"; @@ -307,16 +302,9 @@ print <) { chomp; s/\s+/ /g; @@ -95,6 +90,11 @@ while(<>) { if($modname eq "") { $modname = "libc"; } + my $modvname = "mod$modname"; + if($modnames !~ /$modname/) { + $modnames .= ".$modname"; + $mods .= "\t$modvname = newLazySO(\"$modname.so\")\n"; + } # System call name. if($sysname eq "") { @@ -107,14 +107,9 @@ while(<>) { my $strconvfunc = "BytePtrFromString"; my $strconvtype = "*byte"; - $sysname =~ y/A-Z/a-z/; # All libc functions are lowercase. - - # Runtime import of function to allow cross-platform builds. - $dynimports .= "//go:cgo_import_dynamic libc_${sysname} ${sysname} \"$modname.so\"\n"; - # Link symbol to proc address variable. - $linknames .= "//go:linkname ${sysvarname} libc_${sysname}\n"; # Library proc address variable. - push @vars, $sysvarname; + $sysname =~ y/A-Z/a-z/; # All libc functions are lowercase. + $vars .= "\t$sysvarname = $modvname.NewProc(\"$sysname\")\n"; # Go function header. $out = join(', ', @out); @@ -198,7 +193,7 @@ while(<>) { # Actual call. my $args = join(', ', @args); - my $call = "$asm(uintptr(unsafe.Pointer(&$sysvarname)), $nargs, $args)"; + my $call = "$asm($sysvarname.Addr(), $nargs, $args)"; # Assign return values. my $body = ""; @@ -265,30 +260,21 @@ print < 999){ - # ignore deprecated syscalls that are no longer implemented - # https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/asm-generic/unistd.h?id=refs/heads/master#n716 - return; - } $name =~ y/a-z/A-Z/; print " SYS_$name = $num;\n"; } my $prev; -open(GCC, "gcc -E -dD $ARGV[0] |") || die "can't run gcc"; -while(){ - if(/^#define __NR_syscalls\s+/) { - # ignore redefinitions of __NR_syscalls - } - elsif(/^#define __NR_(\w+)\s+([0-9]+)/){ - $prev = $2; - fmt($1, $2); - } - elsif(/^#define __NR3264_(\w+)\s+([0-9]+)/){ +while(<>){ + if(/^#define __NR_(\w+)\s+([0-9]+)/){ $prev = $2; fmt($1, $2); } diff --git a/vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl b/vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl old mode 100755 new mode 100644 index e74616a65a..fc16fccb03 --- a/vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl +++ b/vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl @@ -8,19 +8,12 @@ use strict; -if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { - print STDERR "GOARCH or GOOS not defined in environment\n"; - exit 1; -} - my $command = "mksysnum_netbsd.pl " . join(' ', @ARGV); print <= NLMSG_HDRLEN { + h, dbuf, dlen, err := netlinkMessageHeaderAndData(b) + if err != nil { + return nil, err + } + m := NetlinkMessage{Header: *h, Data: dbuf[:int(h.Len)-NLMSG_HDRLEN]} + msgs = append(msgs, m) + b = b[dlen:] + } + return msgs, nil +} + +func netlinkMessageHeaderAndData(b []byte) (*NlMsghdr, []byte, int, error) { + h := (*NlMsghdr)(unsafe.Pointer(&b[0])) + if int(h.Len) < NLMSG_HDRLEN || int(h.Len) > len(b) { + return nil, nil, 0, EINVAL + } + return h, b[NLMSG_HDRLEN:], nlmAlignOf(int(h.Len)), nil +} + +// NetlinkRouteAttr represents a netlink route attribute. +type NetlinkRouteAttr struct { + Attr RtAttr + Value []byte +} + +// ParseNetlinkRouteAttr parses m's payload as an array of netlink +// route attributes and returns the slice containing the +// NetlinkRouteAttr structures. +func ParseNetlinkRouteAttr(m *NetlinkMessage) ([]NetlinkRouteAttr, error) { + var b []byte + switch m.Header.Type { + case RTM_NEWLINK, RTM_DELLINK: + b = m.Data[SizeofIfInfomsg:] + case RTM_NEWADDR, RTM_DELADDR: + b = m.Data[SizeofIfAddrmsg:] + case RTM_NEWROUTE, RTM_DELROUTE: + b = m.Data[SizeofRtMsg:] + default: + return nil, EINVAL + } + var attrs []NetlinkRouteAttr + for len(b) >= SizeofRtAttr { + a, vbuf, alen, err := netlinkRouteAttrAndValue(b) + if err != nil { + return nil, err + } + ra := NetlinkRouteAttr{Attr: *a, Value: vbuf[:int(a.Len)-SizeofRtAttr]} + attrs = append(attrs, ra) + b = b[alen:] + } + return attrs, nil +} + +func netlinkRouteAttrAndValue(b []byte) (*RtAttr, []byte, int, error) { + a := (*RtAttr)(unsafe.Pointer(&b[0])) + if int(a.Len) < SizeofRtAttr || int(a.Len) > len(b) { + return nil, nil, 0, EINVAL + } + return a, b[SizeofRtAttr:], rtaAlignOf(int(a.Len)), nil +} diff --git a/vendor/golang.org/x/sys/unix/route_bsd.go b/vendor/golang.org/x/sys/unix/route_bsd.go new file mode 100644 index 0000000000..7684a89926 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/route_bsd.go @@ -0,0 +1,224 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build darwin dragonfly freebsd netbsd openbsd + +// Routing sockets and messages + +package unix + +import "unsafe" + +// Round the length of a raw sockaddr up to align it properly. +func rsaAlignOf(salen int) int { + salign := sizeofPtr + // NOTE: It seems like 64-bit Darwin kernel still requires + // 32-bit aligned access to BSD subsystem. Also NetBSD 6 + // kernel and beyond require 64-bit aligned access to routing + // facilities. + if darwin64Bit { + salign = 4 + } else if netbsd32Bit { + salign = 8 + } + if salen == 0 { + return salign + } + return (salen + salign - 1) & ^(salign - 1) +} + +// RouteRIB returns routing information base, as known as RIB, +// which consists of network facility information, states and +// parameters. +func RouteRIB(facility, param int) ([]byte, error) { + mib := []_C_int{CTL_NET, AF_ROUTE, 0, 0, _C_int(facility), _C_int(param)} + // Find size. + n := uintptr(0) + if err := sysctl(mib, nil, &n, nil, 0); err != nil { + return nil, err + } + if n == 0 { + return nil, nil + } + tab := make([]byte, n) + if err := sysctl(mib, &tab[0], &n, nil, 0); err != nil { + return nil, err + } + return tab[:n], nil +} + +// RoutingMessage represents a routing message. +type RoutingMessage interface { + sockaddr() []Sockaddr +} + +const anyMessageLen = int(unsafe.Sizeof(anyMessage{})) + +type anyMessage struct { + Msglen uint16 + Version uint8 + Type uint8 +} + +// RouteMessage represents a routing message containing routing +// entries. +type RouteMessage struct { + Header RtMsghdr + Data []byte +} + +const rtaRtMask = RTA_DST | RTA_GATEWAY | RTA_NETMASK | RTA_GENMASK + +func (m *RouteMessage) sockaddr() []Sockaddr { + var ( + af int + sas [4]Sockaddr + ) + b := m.Data[:] + for i := uint(0); i < RTAX_MAX; i++ { + if m.Header.Addrs&rtaRtMask&(1< 0 && j < int(rsa4.Len)-int(unsafe.Offsetof(rsa4.Addr)); j++ { + sa.Addr[j] = rsa4.Addr[j] + } + sas[i] = sa + case AF_INET6: + rsa6 := (*RawSockaddrInet6)(unsafe.Pointer(&b[0])) + sa := new(SockaddrInet6) + for j := 0; rsa6.Len > 0 && j < int(rsa6.Len)-int(unsafe.Offsetof(rsa6.Addr)); j++ { + sa.Addr[j] = rsa6.Addr[j] + } + sas[i] = sa + } + } + b = b[rsaAlignOf(int(rsa.Len)):] + } + return sas[:] +} + +// InterfaceMessage represents a routing message containing +// network interface entries. +type InterfaceMessage struct { + Header IfMsghdr + Data []byte +} + +func (m *InterfaceMessage) sockaddr() (sas []Sockaddr) { + if m.Header.Addrs&RTA_IFP == 0 { + return nil + } + sa, err := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointer(&m.Data[0]))) + if err != nil { + return nil + } + return append(sas, sa) +} + +// InterfaceAddrMessage represents a routing message containing +// network interface address entries. +type InterfaceAddrMessage struct { + Header IfaMsghdr + Data []byte +} + +const rtaIfaMask = RTA_IFA | RTA_NETMASK | RTA_BRD + +func (m *InterfaceAddrMessage) sockaddr() (sas []Sockaddr) { + if m.Header.Addrs&rtaIfaMask == 0 { + return nil + } + b := m.Data[:] + // We still see AF_UNSPEC in socket addresses on some + // platforms. To identify each address family correctly, we + // will use the address family of RTAX_NETMASK as a preferred + // one on the 32-bit NetBSD kernel, also use the length of + // RTAX_NETMASK socket address on the FreeBSD kernel. + preferredFamily := uint8(AF_UNSPEC) + for i := uint(0); i < RTAX_MAX; i++ { + if m.Header.Addrs&rtaIfaMask&(1<= anyMessageLen { + msgCount++ + any := (*anyMessage)(unsafe.Pointer(&b[0])) + if any.Version != RTM_VERSION { + b = b[any.Msglen:] + continue + } + msgs = append(msgs, any.toRoutingMessage(b)) + b = b[any.Msglen:] + } + // We failed to parse any of the messages - version mismatch? + if msgCount > 0 && len(msgs) == 0 { + return nil, EINVAL + } + return msgs, nil +} + +// ParseRoutingMessage parses msg's payload as raw sockaddrs and +// returns the slice containing the Sockaddr interfaces. +func ParseRoutingSockaddr(msg RoutingMessage) (sas []Sockaddr, err error) { + return append(sas, msg.sockaddr()...), nil +} diff --git a/vendor/golang.org/x/sys/unix/route_darwin.go b/vendor/golang.org/x/sys/unix/route_darwin.go new file mode 100644 index 0000000000..3cff5463bf --- /dev/null +++ b/vendor/golang.org/x/sys/unix/route_darwin.go @@ -0,0 +1,61 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Routing sockets and messages for Darwin + +package unix + +import "unsafe" + +func (any *anyMessage) toRoutingMessage(b []byte) RoutingMessage { + switch any.Type { + case RTM_ADD, RTM_DELETE, RTM_CHANGE, RTM_GET, RTM_LOSING, RTM_REDIRECT, RTM_MISS, RTM_LOCK, RTM_RESOLVE: + p := (*RouteMessage)(unsafe.Pointer(any)) + return &RouteMessage{Header: p.Header, Data: b[SizeofRtMsghdr:any.Msglen]} + case RTM_IFINFO: + p := (*InterfaceMessage)(unsafe.Pointer(any)) + return &InterfaceMessage{Header: p.Header, Data: b[SizeofIfMsghdr:any.Msglen]} + case RTM_NEWADDR, RTM_DELADDR: + p := (*InterfaceAddrMessage)(unsafe.Pointer(any)) + return &InterfaceAddrMessage{Header: p.Header, Data: b[SizeofIfaMsghdr:any.Msglen]} + case RTM_NEWMADDR2, RTM_DELMADDR: + p := (*InterfaceMulticastAddrMessage)(unsafe.Pointer(any)) + return &InterfaceMulticastAddrMessage{Header: p.Header, Data: b[SizeofIfmaMsghdr2:any.Msglen]} + } + return nil +} + +// InterfaceMulticastAddrMessage represents a routing message +// containing network interface address entries. +type InterfaceMulticastAddrMessage struct { + Header IfmaMsghdr2 + Data []byte +} + +const rtaIfmaMask = RTA_GATEWAY | RTA_IFP | RTA_IFA + +func (m *InterfaceMulticastAddrMessage) sockaddr() (sas []Sockaddr) { + if m.Header.Addrs&rtaIfmaMask == 0 { + return nil + } + b := m.Data[:] + for i := uint(0); i < RTAX_MAX; i++ { + if m.Header.Addrs&rtaIfmaMask&(1<= 1000000 { + m := (*ifMsghdr)(unsafe.Pointer(any)) + p.Header.Data.Hwassist = uint32(m.Data.Hwassist) + p.Header.Data.Epoch = m.Data.Epoch + p.Header.Data.Lastchange = m.Data.Lastchange + return &InterfaceMessage{Header: p.Header, Data: b[sizeofIfMsghdr:any.Msglen]} + } + return &InterfaceMessage{Header: p.Header, Data: b[SizeofIfMsghdr:any.Msglen]} +} diff --git a/vendor/golang.org/x/sys/unix/route_freebsd_64bit.go b/vendor/golang.org/x/sys/unix/route_freebsd_64bit.go new file mode 100644 index 0000000000..5f386384a8 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/route_freebsd_64bit.go @@ -0,0 +1,14 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build freebsd,amd64 + +package unix + +import "unsafe" + +func (any *anyMessage) parseInterfaceMessage(b []byte) *InterfaceMessage { + p := (*InterfaceMessage)(unsafe.Pointer(any)) + return &InterfaceMessage{Header: p.Header, Data: b[SizeofIfMsghdr:any.Msglen]} +} diff --git a/vendor/golang.org/x/sys/unix/route_netbsd.go b/vendor/golang.org/x/sys/unix/route_netbsd.go new file mode 100644 index 0000000000..0c6cb2d0f3 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/route_netbsd.go @@ -0,0 +1,35 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Routing sockets and messages for NetBSD + +package unix + +import "unsafe" + +func (any *anyMessage) toRoutingMessage(b []byte) RoutingMessage { + switch any.Type { + case RTM_ADD, RTM_DELETE, RTM_CHANGE, RTM_GET, RTM_LOSING, RTM_REDIRECT, RTM_MISS, RTM_LOCK, RTM_RESOLVE: + p := (*RouteMessage)(unsafe.Pointer(any)) + return &RouteMessage{Header: p.Header, Data: b[SizeofRtMsghdr:any.Msglen]} + case RTM_IFINFO: + p := (*InterfaceMessage)(unsafe.Pointer(any)) + return &InterfaceMessage{Header: p.Header, Data: b[SizeofIfMsghdr:any.Msglen]} + case RTM_IFANNOUNCE: + p := (*InterfaceAnnounceMessage)(unsafe.Pointer(any)) + return &InterfaceAnnounceMessage{Header: p.Header} + case RTM_NEWADDR, RTM_DELADDR: + p := (*InterfaceAddrMessage)(unsafe.Pointer(any)) + return &InterfaceAddrMessage{Header: p.Header, Data: b[SizeofIfaMsghdr:any.Msglen]} + } + return nil +} + +// InterfaceAnnounceMessage represents a routing message containing +// network interface arrival and departure information. +type InterfaceAnnounceMessage struct { + Header IfAnnounceMsghdr +} + +func (m *InterfaceAnnounceMessage) sockaddr() (sas []Sockaddr) { return nil } diff --git a/vendor/golang.org/x/sys/unix/route_openbsd.go b/vendor/golang.org/x/sys/unix/route_openbsd.go new file mode 100644 index 0000000000..f70e7e7c06 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/route_openbsd.go @@ -0,0 +1,35 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Routing sockets and messages for OpenBSD + +package unix + +import "unsafe" + +func (any *anyMessage) toRoutingMessage(b []byte) RoutingMessage { + switch any.Type { + case RTM_ADD, RTM_DELETE, RTM_CHANGE, RTM_GET, RTM_LOSING, RTM_REDIRECT, RTM_MISS, RTM_LOCK, RTM_RESOLVE: + p := (*RouteMessage)(unsafe.Pointer(any)) + return &RouteMessage{Header: p.Header, Data: b[SizeofRtMsghdr:any.Msglen]} + case RTM_IFINFO: + p := (*InterfaceMessage)(unsafe.Pointer(any)) + return &InterfaceMessage{Header: p.Header, Data: b[SizeofIfMsghdr:any.Msglen]} + case RTM_IFANNOUNCE: + p := (*InterfaceAnnounceMessage)(unsafe.Pointer(any)) + return &InterfaceAnnounceMessage{Header: p.Header} + case RTM_NEWADDR, RTM_DELADDR: + p := (*InterfaceAddrMessage)(unsafe.Pointer(any)) + return &InterfaceAddrMessage{Header: p.Header, Data: b[SizeofIfaMsghdr:any.Msglen]} + } + return nil +} + +// InterfaceAnnounceMessage represents a routing message containing +// network interface arrival and departure information. +type InterfaceAnnounceMessage struct { + Header IfAnnounceMsghdr +} + +func (m *InterfaceAnnounceMessage) sockaddr() (sas []Sockaddr) { return nil } diff --git a/vendor/golang.org/x/sys/unix/so_solaris.go b/vendor/golang.org/x/sys/unix/so_solaris.go new file mode 100644 index 0000000000..9bd0b266a7 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/so_solaris.go @@ -0,0 +1,261 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package unix + +import ( + "sync" + "sync/atomic" + "syscall" + "unsafe" +) + +// soError describes reasons for shared library load failures. +type soError struct { + Err error + ObjName string + Msg string +} + +func (e *soError) Error() string { return e.Msg } + +// Implemented in runtime/syscall_solaris.goc. +func rawSysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) +func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) +func dlclose(handle uintptr) (err syscall.Errno) +func dlopen(name *uint8, mode uintptr) (handle uintptr, err syscall.Errno) +func dlsym(handle uintptr, name *uint8) (proc uintptr, err syscall.Errno) + +// A so implements access to a single shared library object. +type so struct { + Name string + Handle uintptr +} + +// loadSO loads shared library file into memory. +func loadSO(name string) (*so, error) { + namep, err := BytePtrFromString(name) + if err != nil { + return nil, err + } + h, e := dlopen(namep, 1) // RTLD_LAZY + if e != 0 { + return nil, &soError{ + Err: e, + ObjName: name, + Msg: "Failed to load " + name + ": " + e.Error(), + } + } + d := &so{ + Name: name, + Handle: uintptr(h), + } + return d, nil +} + +// mustLoadSO is like loadSO but panics if load operation fails. +func mustLoadSO(name string) *so { + d, e := loadSO(name) + if e != nil { + panic(e) + } + return d +} + +// FindProc searches shared library d for procedure named name and returns +// *proc if found. It returns an error if the search fails. +func (d *so) FindProc(name string) (*proc, error) { + namep, err := BytePtrFromString(name) + if err != nil { + return nil, err + } + a, _ := dlsym(uintptr(d.Handle), namep) + if a == 0 { + return nil, &soError{ + Err: ENOSYS, + ObjName: name, + Msg: "Failed to find " + name + " procedure in " + d.Name, + } + } + p := &proc{ + SO: d, + Name: name, + addr: a, + } + return p, nil +} + +// MustFindProc is like FindProc but panics if search fails. +func (d *so) MustFindProc(name string) *proc { + p, e := d.FindProc(name) + if e != nil { + panic(e) + } + return p +} + +// Release unloads shared library d from memory. +func (d *so) Release() (err error) { + return dlclose(d.Handle) +} + +// A proc implements access to a procedure inside a shared library. +type proc struct { + SO *so + Name string + addr uintptr +} + +// Addr returns the address of the procedure represented by p. +// The return value can be passed to Syscall to run the procedure. +func (p *proc) Addr() uintptr { + return p.addr +} + +// Call executes procedure p with arguments a. It will panic, if more then +// 6 arguments are supplied. +// +// The returned error is always non-nil, constructed from the result of +// GetLastError. Callers must inspect the primary return value to decide +// whether an error occurred (according to the semantics of the specific +// function being called) before consulting the error. The error will be +// guaranteed to contain syscall.Errno. +func (p *proc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) { + switch len(a) { + case 0: + return sysvicall6(p.Addr(), uintptr(len(a)), 0, 0, 0, 0, 0, 0) + case 1: + return sysvicall6(p.Addr(), uintptr(len(a)), a[0], 0, 0, 0, 0, 0) + case 2: + return sysvicall6(p.Addr(), uintptr(len(a)), a[0], a[1], 0, 0, 0, 0) + case 3: + return sysvicall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], 0, 0, 0) + case 4: + return sysvicall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], 0, 0) + case 5: + return sysvicall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], 0) + case 6: + return sysvicall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5]) + default: + panic("Call " + p.Name + " with too many arguments " + itoa(len(a)) + ".") + } + return +} + +// A lazySO implements access to a single shared library. It will delay +// the load of the shared library until the first call to its Handle method +// or to one of its lazyProc's Addr method. +type lazySO struct { + mu sync.Mutex + so *so // non nil once SO is loaded + Name string +} + +// Load loads single shared file d.Name into memory. It returns an error if +// fails. Load will not try to load SO, if it is already loaded into memory. +func (d *lazySO) Load() error { + // Non-racy version of: + // if d.so == nil { + if atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&d.so))) == nil { + d.mu.Lock() + defer d.mu.Unlock() + if d.so == nil { + so, e := loadSO(d.Name) + if e != nil { + return e + } + // Non-racy version of: + // d.so = so + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&d.so)), unsafe.Pointer(so)) + } + } + return nil +} + +// mustLoad is like Load but panics if search fails. +func (d *lazySO) mustLoad() { + e := d.Load() + if e != nil { + panic(e) + } +} + +// Handle returns d's module handle. +func (d *lazySO) Handle() uintptr { + d.mustLoad() + return uintptr(d.so.Handle) +} + +// NewProc returns a lazyProc for accessing the named procedure in the SO d. +func (d *lazySO) NewProc(name string) *lazyProc { + return &lazyProc{l: d, Name: name} +} + +// newLazySO creates new lazySO associated with SO file. +func newLazySO(name string) *lazySO { + return &lazySO{Name: name} +} + +// A lazyProc implements access to a procedure inside a lazySO. +// It delays the lookup until the Addr method is called. +type lazyProc struct { + mu sync.Mutex + Name string + l *lazySO + proc *proc +} + +// Find searches the shared library for procedure named p.Name. It returns an +// error if search fails. Find will not search procedure, if it is already +// found and loaded into memory. +func (p *lazyProc) Find() error { + // Non-racy version of: + // if p.proc == nil { + if atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&p.proc))) == nil { + p.mu.Lock() + defer p.mu.Unlock() + if p.proc == nil { + e := p.l.Load() + if e != nil { + return e + } + proc, e := p.l.so.FindProc(p.Name) + if e != nil { + return e + } + // Non-racy version of: + // p.proc = proc + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&p.proc)), unsafe.Pointer(proc)) + } + } + return nil +} + +// mustFind is like Find but panics if search fails. +func (p *lazyProc) mustFind() { + e := p.Find() + if e != nil { + panic(e) + } +} + +// Addr returns the address of the procedure represented by p. +// The return value can be passed to Syscall to run the procedure. +func (p *lazyProc) Addr() uintptr { + p.mustFind() + return p.proc.Addr() +} + +// Call executes procedure p with arguments a. It will panic, if more then +// 6 arguments are supplied. +// +// The returned error is always non-nil, constructed from the result of +// GetLastError. Callers must inspect the primary return value to decide +// whether an error occurred (according to the semantics of the specific +// function being called) before consulting the error. The error will be +// guaranteed to contain syscall.Errno. +func (p *lazyProc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) { + p.mustFind() + return p.proc.Call(a...) +} diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_unix.go b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go index 70af5a728e..6668bec711 100644 --- a/vendor/golang.org/x/sys/unix/sockcmsg_unix.go +++ b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go @@ -77,10 +77,10 @@ func UnixRights(fds ...int) []byte { h.Level = SOL_SOCKET h.Type = SCM_RIGHTS h.SetLen(CmsgLen(datalen)) - data := cmsgData(h) + data := uintptr(cmsgData(h)) for _, fd := range fds { - *(*int32)(data) = int32(fd) - data = unsafe.Pointer(uintptr(data) + 4) + *(*int32)(unsafe.Pointer(data)) = int32(fd) + data += 4 } return b } diff --git a/vendor/golang.org/x/sys/unix/str.go b/vendor/golang.org/x/sys/unix/str.go index 35ed664353..f873edecc7 100644 --- a/vendor/golang.org/x/sys/unix/str.go +++ b/vendor/golang.org/x/sys/unix/str.go @@ -8,12 +8,8 @@ package unix func itoa(val int) string { // do it here rather than with fmt to avoid dependency if val < 0 { - return "-" + uitoa(uint(-val)) + return "-" + itoa(-val) } - return uitoa(uint(val)) -} - -func uitoa(val uint) string { var buf [32]byte // big enough for int64 i := len(buf) - 1 for val >= 10 { diff --git a/vendor/golang.org/x/sys/unix/syscall.go b/vendor/golang.org/x/sys/unix/syscall.go index 6442a9939e..a48d47cff8 100644 --- a/vendor/golang.org/x/sys/unix/syscall.go +++ b/vendor/golang.org/x/sys/unix/syscall.go @@ -19,7 +19,7 @@ // These calls return err == nil to indicate success; otherwise // err represents an operating system error describing the failure and // holds a value of type syscall.Errno. -package unix // import "golang.org/x/sys/unix" +package unix import "unsafe" diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd.go b/vendor/golang.org/x/sys/unix/syscall_bsd.go index e9671764cc..7b08113bf3 100644 --- a/vendor/golang.org/x/sys/unix/syscall_bsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_bsd.go @@ -450,34 +450,16 @@ func Kevent(kq int, changes, events []Kevent_t, timeout *Timespec) (n int, err e //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL -// sysctlmib translates name to mib number and appends any additional args. -func sysctlmib(name string, args ...int) ([]_C_int, error) { +func Sysctl(name string) (value string, err error) { // Translate name to mib number. mib, err := nametomib(name) - if err != nil { - return nil, err - } - - for _, a := range args { - mib = append(mib, _C_int(a)) - } - - return mib, nil -} - -func Sysctl(name string) (string, error) { - return SysctlArgs(name) -} - -func SysctlArgs(name string, args ...int) (string, error) { - mib, err := sysctlmib(name, args...) if err != nil { return "", err } // Find size. n := uintptr(0) - if err := sysctl(mib, nil, &n, nil, 0); err != nil { + if err = sysctl(mib, nil, &n, nil, 0); err != nil { return "", err } if n == 0 { @@ -486,7 +468,7 @@ func SysctlArgs(name string, args ...int) (string, error) { // Read into buffer of that size. buf := make([]byte, n) - if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil { + if err = sysctl(mib, &buf[0], &n, nil, 0); err != nil { return "", err } @@ -497,19 +479,17 @@ func SysctlArgs(name string, args ...int) (string, error) { return string(buf[0:n]), nil } -func SysctlUint32(name string) (uint32, error) { - return SysctlUint32Args(name) -} - -func SysctlUint32Args(name string, args ...int) (uint32, error) { - mib, err := sysctlmib(name, args...) +func SysctlUint32(name string) (value uint32, err error) { + // Translate name to mib number. + mib, err := nametomib(name) if err != nil { return 0, err } + // Read into buffer of that size. n := uintptr(4) buf := make([]byte, 4) - if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil { + if err = sysctl(mib, &buf[0], &n, nil, 0); err != nil { return 0, err } if n != 4 { @@ -518,55 +498,9 @@ func SysctlUint32Args(name string, args ...int) (uint32, error) { return *(*uint32)(unsafe.Pointer(&buf[0])), nil } -func SysctlUint64(name string, args ...int) (uint64, error) { - mib, err := sysctlmib(name, args...) - if err != nil { - return 0, err - } - - n := uintptr(8) - buf := make([]byte, 8) - if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil { - return 0, err - } - if n != 8 { - return 0, EIO - } - return *(*uint64)(unsafe.Pointer(&buf[0])), nil -} - -func SysctlRaw(name string, args ...int) ([]byte, error) { - mib, err := sysctlmib(name, args...) - if err != nil { - return nil, err - } - - // Find size. - n := uintptr(0) - if err := sysctl(mib, nil, &n, nil, 0); err != nil { - return nil, err - } - if n == 0 { - return nil, nil - } - - // Read into buffer of that size. - buf := make([]byte, n) - if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil { - return nil, err - } - - // The actual call may return less than the original reported required - // size so ensure we deal with that. - return buf[:n], nil -} - //sys utimes(path string, timeval *[2]Timeval) (err error) -func Utimes(path string, tv []Timeval) error { - if tv == nil { - return utimes(path, nil) - } +func Utimes(path string, tv []Timeval) (err error) { if len(tv) != 2 { return EINVAL } @@ -574,9 +508,6 @@ func Utimes(path string, tv []Timeval) error { } func UtimesNano(path string, ts []Timespec) error { - if ts == nil { - return utimes(path, nil) - } // TODO: The BSDs can do utimensat with SYS_UTIMENSAT but it // isn't supported by darwin so this uses utimes instead if len(ts) != 2 { @@ -593,10 +524,7 @@ func UtimesNano(path string, ts []Timespec) error { //sys futimes(fd int, timeval *[2]Timeval) (err error) -func Futimes(fd int, tv []Timeval) error { - if tv == nil { - return futimes(fd, nil) - } +func Futimes(fd int, tv []Timeval) (err error) { if len(tv) != 2 { return EINVAL } diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd_test.go b/vendor/golang.org/x/sys/unix/syscall_bsd_test.go deleted file mode 100644 index 0bcd741f77..0000000000 --- a/vendor/golang.org/x/sys/unix/syscall_bsd_test.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd openbsd - -package unix_test - -import ( - "testing" - - "golang.org/x/sys/unix" -) - -const MNT_WAIT = 1 - -func TestGetfsstat(t *testing.T) { - n, err := unix.Getfsstat(nil, MNT_WAIT) - if err != nil { - t.Fatal(err) - } - - data := make([]unix.Statfs_t, n) - n, err = unix.Getfsstat(data, MNT_WAIT) - if err != nil { - t.Fatal(err) - } - - empty := unix.Statfs_t{} - for _, stat := range data { - if stat == empty { - t.Fatal("an empty Statfs_t struct was returned") - } - } -} - -func TestSysctlRaw(t *testing.T) { - _, err := unix.SysctlRaw("kern.proc.pid", unix.Getpid()) - if err != nil { - t.Fatal(err) - } -} diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 0d1771c3fc..eb8bea650a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -222,8 +222,8 @@ func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(sig //sys Chown(path string, uid int, gid int) (err error) //sys Chroot(path string) (err error) //sys Close(fd int) (err error) -//sys Dup(fd int) (nfd int, err error) -//sys Dup2(from int, to int) (err error) +//sysnb Dup(fd int) (nfd int, err error) +//sysnb Dup2(from int, to int) (err error) //sys Exchangedata(path1 string, path2 string, options int) (err error) //sys Exit(code int) //sys Fchdir(fd int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_386.go b/vendor/golang.org/x/sys/unix/syscall_darwin_386.go index 3195c8bf5c..40bef13ce0 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_386.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build 386,darwin - package unix import ( @@ -73,7 +71,3 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e } func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) - -// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions -// of darwin/386 the syscall is called sysctl instead of __sysctl. -const SYS___SYSCTL = SYS_SYSCTL diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go index 7adb98ded5..57bd190319 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64,darwin - package unix import ( @@ -11,8 +9,6 @@ import ( "unsafe" ) -//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) - func Getpagesize() int { return 4096 } func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } @@ -75,7 +71,3 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e } func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) - -// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions -// of darwin/amd64 the syscall is called sysctl instead of __sysctl. -const SYS___SYSCTL = SYS_SYSCTL diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go deleted file mode 100644 index e47ffd7396..0000000000 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package unix - -import ( - "syscall" - "unsafe" -) - -func Getpagesize() int { return 4096 } - -func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } - -func NsecToTimespec(nsec int64) (ts Timespec) { - ts.Sec = int32(nsec / 1e9) - ts.Nsec = int32(nsec % 1e9) - return -} - -func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } - -func NsecToTimeval(nsec int64) (tv Timeval) { - nsec += 999 // round up to microsecond - tv.Usec = int32(nsec % 1e9 / 1e3) - tv.Sec = int32(nsec / 1e9) - return -} - -//sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) -func Gettimeofday(tv *Timeval) (err error) { - // The tv passed to gettimeofday must be non-nil - // but is otherwise unused. The answers come back - // in the two registers. - sec, usec, err := gettimeofday(tv) - tv.Sec = int32(sec) - tv.Usec = int32(usec) - return err -} - -func SetKevent(k *Kevent_t, fd, mode, flags int) { - k.Ident = uint32(fd) - k.Filter = int16(mode) - k.Flags = uint16(flags) -} - -func (iov *Iovec) SetLen(length int) { - iov.Len = uint32(length) -} - -func (msghdr *Msghdr) SetControllen(length int) { - msghdr.Controllen = uint32(length) -} - -func (cmsg *Cmsghdr) SetLen(length int) { - cmsg.Len = uint32(length) -} - -func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - var length = uint64(count) - - _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) - - written = int(length) - - if e1 != 0 { - err = e1 - } - return -} - -func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go deleted file mode 100644 index 2560a95998..0000000000 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build arm64,darwin - -package unix - -import ( - "syscall" - "unsafe" -) - -func Getpagesize() int { return 16384 } - -func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } - -func NsecToTimespec(nsec int64) (ts Timespec) { - ts.Sec = nsec / 1e9 - ts.Nsec = nsec % 1e9 - return -} - -func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } - -func NsecToTimeval(nsec int64) (tv Timeval) { - nsec += 999 // round up to microsecond - tv.Usec = int32(nsec % 1e9 / 1e3) - tv.Sec = int64(nsec / 1e9) - return -} - -//sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) -func Gettimeofday(tv *Timeval) (err error) { - // The tv passed to gettimeofday must be non-nil - // but is otherwise unused. The answers come back - // in the two registers. - sec, usec, err := gettimeofday(tv) - tv.Sec = sec - tv.Usec = usec - return err -} - -func SetKevent(k *Kevent_t, fd, mode, flags int) { - k.Ident = uint64(fd) - k.Filter = int16(mode) - k.Flags = uint16(flags) -} - -func (iov *Iovec) SetLen(length int) { - iov.Len = uint64(length) -} - -func (msghdr *Msghdr) SetControllen(length int) { - msghdr.Controllen = uint32(length) -} - -func (cmsg *Cmsghdr) SetLen(length int) { - cmsg.Len = uint32(length) -} - -func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - var length = uint64(count) - - _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) - - written = int(length) - - if e1 != 0 { - err = e1 - } - return -} - -func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic - -// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions -// of darwin/arm64 the syscall is called sysctl instead of __sysctl. -const SYS___SYSCTL = SYS_SYSCTL diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go index fbbe0dce25..851a54b049 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go @@ -127,8 +127,8 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { //sys Chown(path string, uid int, gid int) (err error) //sys Chroot(path string) (err error) //sys Close(fd int) (err error) -//sys Dup(fd int) (nfd int, err error) -//sys Dup2(from int, to int) (err error) +//sysnb Dup(fd int) (nfd int, err error) +//sysnb Dup2(from int, to int) (err error) //sys Exit(code int) //sys Fchdir(fd int) (err error) //sys Fchflags(fd int, flags int) (err error) @@ -165,11 +165,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { //sys Mkdir(path string, mode uint32) (err error) //sys Mkfifo(path string, mode uint32) (err error) //sys Mknod(path string, mode uint32, dev int) (err error) -//sys Mlock(b []byte) (err error) -//sys Mlockall(flags int) (err error) -//sys Mprotect(b []byte, prot int) (err error) -//sys Munlock(b []byte) (err error) -//sys Munlockall() (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Open(path string, mode int, perm uint32) (fd int, err error) //sys Pathconf(path string, name int) (val int, err error) @@ -243,6 +238,8 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { // Kdebug_trace // Sigreturn // Mmap +// Mlock +// Munlock // Atsocket // Kqueue_from_portset_np // Kqueue_portset @@ -335,6 +332,8 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { // Lio_listio // __pthread_cond_wait // Iopolicysys +// Mlockall +// Munlockall // __pthread_kill // __pthread_sigmask // __sigwait diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly_386.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly_386.go index 41c2e69782..b3b02d4dbc 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly_386.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build 386,dragonfly - package unix import ( diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go index 2ed92590e2..568ada119b 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64,dragonfly - package unix import ( diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go index ec56ed608a..506a20e403 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go @@ -136,238 +136,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { return } -// Derive extattr namespace and attribute name - -func xattrnamespace(fullattr string) (ns int, attr string, err error) { - s := -1 - for idx, val := range fullattr { - if val == '.' { - s = idx - break - } - } - - if s == -1 { - return -1, "", ENOATTR - } - - namespace := fullattr[0:s] - attr = fullattr[s+1:] - - switch namespace { - case "user": - return EXTATTR_NAMESPACE_USER, attr, nil - case "system": - return EXTATTR_NAMESPACE_SYSTEM, attr, nil - default: - return -1, "", ENOATTR - } -} - -func initxattrdest(dest []byte, idx int) (d unsafe.Pointer) { - if len(dest) > idx { - return unsafe.Pointer(&dest[idx]) - } else { - return unsafe.Pointer(_zero) - } -} - -// FreeBSD implements its own syscalls to handle extended attributes - -func Getxattr(file string, attr string, dest []byte) (sz int, err error) { - d := initxattrdest(dest, 0) - destsize := len(dest) - - nsid, a, err := xattrnamespace(attr) - if err != nil { - return -1, err - } - - return ExtattrGetFile(file, nsid, a, uintptr(d), destsize) -} - -func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { - d := initxattrdest(dest, 0) - destsize := len(dest) - - nsid, a, err := xattrnamespace(attr) - if err != nil { - return -1, err - } - - return ExtattrGetFd(fd, nsid, a, uintptr(d), destsize) -} - -func Lgetxattr(link string, attr string, dest []byte) (sz int, err error) { - d := initxattrdest(dest, 0) - destsize := len(dest) - - nsid, a, err := xattrnamespace(attr) - if err != nil { - return -1, err - } - - return ExtattrGetLink(link, nsid, a, uintptr(d), destsize) -} - -// flags are unused on FreeBSD - -func Fsetxattr(fd int, attr string, data []byte, flags int) (err error) { - d := unsafe.Pointer(&data[0]) - datasiz := len(data) - - nsid, a, err := xattrnamespace(attr) - if err != nil { - return - } - - _, err = ExtattrSetFd(fd, nsid, a, uintptr(d), datasiz) - return -} - -func Setxattr(file string, attr string, data []byte, flags int) (err error) { - d := unsafe.Pointer(&data[0]) - datasiz := len(data) - - nsid, a, err := xattrnamespace(attr) - if err != nil { - return - } - - _, err = ExtattrSetFile(file, nsid, a, uintptr(d), datasiz) - return -} - -func Lsetxattr(link string, attr string, data []byte, flags int) (err error) { - d := unsafe.Pointer(&data[0]) - datasiz := len(data) - - nsid, a, err := xattrnamespace(attr) - if err != nil { - return - } - - _, err = ExtattrSetLink(link, nsid, a, uintptr(d), datasiz) - return -} - -func Removexattr(file string, attr string) (err error) { - nsid, a, err := xattrnamespace(attr) - if err != nil { - return - } - - err = ExtattrDeleteFile(file, nsid, a) - return -} - -func Fremovexattr(fd int, attr string) (err error) { - nsid, a, err := xattrnamespace(attr) - if err != nil { - return - } - - err = ExtattrDeleteFd(fd, nsid, a) - return -} - -func Lremovexattr(link string, attr string) (err error) { - nsid, a, err := xattrnamespace(attr) - if err != nil { - return - } - - err = ExtattrDeleteLink(link, nsid, a) - return -} - -func Listxattr(file string, dest []byte) (sz int, err error) { - d := initxattrdest(dest, 0) - destsiz := len(dest) - - // FreeBSD won't allow you to list xattrs from multiple namespaces - s := 0 - var e error - for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} { - stmp, e := ExtattrListFile(file, nsid, uintptr(d), destsiz) - - /* Errors accessing system attrs are ignored so that - * we can implement the Linux-like behavior of omitting errors that - * we don't have read permissions on - * - * Linux will still error if we ask for user attributes on a file that - * we don't have read permissions on, so don't ignore those errors - */ - if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER { - e = nil - continue - } else if e != nil { - return s, e - } - - s += stmp - destsiz -= s - if destsiz < 0 { - destsiz = 0 - } - d = initxattrdest(dest, s) - } - - return s, e -} - -func Flistxattr(fd int, dest []byte) (sz int, err error) { - d := initxattrdest(dest, 0) - destsiz := len(dest) - - s := 0 - var e error - for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} { - stmp, e := ExtattrListFd(fd, nsid, uintptr(d), destsiz) - if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER { - e = nil - continue - } else if e != nil { - return s, e - } - - s += stmp - destsiz -= s - if destsiz < 0 { - destsiz = 0 - } - d = initxattrdest(dest, s) - } - - return s, e -} - -func Llistxattr(link string, dest []byte) (sz int, err error) { - d := initxattrdest(dest, 0) - destsiz := len(dest) - - s := 0 - var e error - for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} { - stmp, e := ExtattrListLink(link, nsid, uintptr(d), destsiz) - if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER { - e = nil - continue - } else if e != nil { - return s, e - } - - s += stmp - destsiz -= s - if destsiz < 0 { - destsiz = 0 - } - d = initxattrdest(dest, s) - } - - return s, e -} - /* * Exposed directly */ @@ -379,22 +147,9 @@ func Llistxattr(link string, dest []byte) (sz int, err error) { //sys Chown(path string, uid int, gid int) (err error) //sys Chroot(path string) (err error) //sys Close(fd int) (err error) -//sys Dup(fd int) (nfd int, err error) -//sys Dup2(from int, to int) (err error) +//sysnb Dup(fd int) (nfd int, err error) +//sysnb Dup2(from int, to int) (err error) //sys Exit(code int) -//sys ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) -//sys ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) -//sys ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error) -//sys ExtattrListFd(fd int, attrnamespace int, data uintptr, nbytes int) (ret int, err error) -//sys ExtattrGetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) -//sys ExtattrSetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) -//sys ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err error) -//sys ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) -//sys ExtattrGetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) -//sys ExtattrSetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) -//sys ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err error) -//sys ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) -//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_POSIX_FADVISE //sys Fchdir(fd int) (err error) //sys Fchflags(fd int, flags int) (err error) //sys Fchmod(fd int, mode uint32) (err error) @@ -430,11 +185,6 @@ func Llistxattr(link string, dest []byte) (sz int, err error) { //sys Mkdir(path string, mode uint32) (err error) //sys Mkfifo(path string, mode uint32) (err error) //sys Mknod(path string, mode uint32, dev int) (err error) -//sys Mlock(b []byte) (err error) -//sys Mlockall(flags int) (err error) -//sys Mprotect(b []byte, prot int) (err error) -//sys Munlock(b []byte) (err error) -//sys Munlockall() (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Open(path string, mode int, perm uint32) (fd int, err error) //sys Pathconf(path string, name int) (val int, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go index 6255d40ff8..b3b02d4dbc 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build 386,freebsd - package unix import ( diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go index 8b395d596d..568ada119b 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64,freebsd - package unix import ( diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go index 4e72d46a81..4cf79fb43a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build arm,freebsd - package unix import ( diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go deleted file mode 100644 index 6171a01766..0000000000 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build freebsd - -package unix_test - -import ( - "testing" - - "golang.org/x/sys/unix" -) - -func TestSysctUint64(t *testing.T) { - _, err := unix.SysctlUint64("vm.max_kernel_address") - if err != nil { - t.Fatal(err) - } -} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 5048e563b6..a6e93ca0b9 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -20,38 +20,10 @@ import ( * Wrapped */ -func Access(path string, mode uint32) (err error) { - return Faccessat(AT_FDCWD, path, mode, 0) -} - -func Chmod(path string, mode uint32) (err error) { - return Fchmodat(AT_FDCWD, path, mode, 0) -} - -func Chown(path string, uid int, gid int) (err error) { - return Fchownat(AT_FDCWD, path, uid, gid, 0) -} - -func Creat(path string, mode uint32) (fd int, err error) { - return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode) -} - -//sys linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) - -func Link(oldpath string, newpath string) (err error) { - return linkat(AT_FDCWD, oldpath, AT_FDCWD, newpath, 0) -} - -func Mkdir(path string, mode uint32) (err error) { - return Mkdirat(AT_FDCWD, path, mode) -} - -func Mknod(path string, mode uint32, dev int) (err error) { - return Mknodat(AT_FDCWD, path, mode, dev) -} +//sys open(path string, mode int, perm uint32) (fd int, err error) func Open(path string, mode int, perm uint32) (fd int, err error) { - return openat(AT_FDCWD, path, mode|O_LARGEFILE, perm) + return open(path, mode|O_LARGEFILE, perm) } //sys openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) @@ -60,62 +32,48 @@ func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) return openat(dirfd, path, flags|O_LARGEFILE, mode) } -//sys readlinkat(dirfd int, path string, buf []byte) (n int, err error) +//sysnb pipe(p *[2]_C_int) (err error) -func Readlink(path string, buf []byte) (n int, err error) { - return readlinkat(AT_FDCWD, path, buf) +func Pipe(p []int) (err error) { + if len(p) != 2 { + return EINVAL + } + var pp [2]_C_int + err = pipe(&pp) + p[0] = int(pp[0]) + p[1] = int(pp[1]) + return } -func Rename(oldpath string, newpath string) (err error) { - return Renameat(AT_FDCWD, oldpath, AT_FDCWD, newpath) -} +//sysnb pipe2(p *[2]_C_int, flags int) (err error) -func Rmdir(path string) error { - return unlinkat(AT_FDCWD, path, AT_REMOVEDIR) -} - -//sys symlinkat(oldpath string, newdirfd int, newpath string) (err error) - -func Symlink(oldpath string, newpath string) (err error) { - return symlinkat(oldpath, AT_FDCWD, newpath) -} - -func Unlink(path string) error { - return unlinkat(AT_FDCWD, path, 0) -} - -//sys unlinkat(dirfd int, path string, flags int) (err error) - -func Unlinkat(dirfd int, path string, flags int) error { - return unlinkat(dirfd, path, flags) +func Pipe2(p []int, flags int) (err error) { + if len(p) != 2 { + return EINVAL + } + var pp [2]_C_int + err = pipe2(&pp, flags) + p[0] = int(pp[0]) + p[1] = int(pp[1]) + return } //sys utimes(path string, times *[2]Timeval) (err error) func Utimes(path string, tv []Timeval) (err error) { - if tv == nil { - return utimes(path, nil) - } if len(tv) != 2 { return EINVAL } return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) } -//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) +//sys utimensat(dirfd int, path string, times *[2]Timespec) (err error) -func UtimesNano(path string, ts []Timespec) error { - if ts == nil { - err := utimensat(AT_FDCWD, path, nil, 0) - if err != ENOSYS { - return err - } - return utimes(path, nil) - } +func UtimesNano(path string, ts []Timespec) (err error) { if len(ts) != 2 { return EINVAL } - err := utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) + err = utimensat(_AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0]))) if err != ENOSYS { return err } @@ -129,29 +87,16 @@ func UtimesNano(path string, ts []Timespec) error { return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) } -func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error { - if ts == nil { - return utimensat(dirfd, path, nil, flags) - } - if len(ts) != 2 { - return EINVAL - } - return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags) -} - //sys futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) -func Futimesat(dirfd int, path string, tv []Timeval) error { +func Futimesat(dirfd int, path string, tv []Timeval) (err error) { + if len(tv) != 2 { + return EINVAL + } pathp, err := BytePtrFromString(path) if err != nil { return err } - if tv == nil { - return futimesat(dirfd, pathp, nil) - } - if len(tv) != 2 { - return EINVAL - } return futimesat(dirfd, pathp, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) } @@ -837,14 +782,17 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri /* * Direct access */ +//sys Access(path string, mode uint32) (err error) //sys Acct(path string) (err error) //sys Adjtimex(buf *Timex) (state int, err error) //sys Chdir(path string) (err error) +//sys Chmod(path string, mode uint32) (err error) //sys Chroot(path string) (err error) -//sys ClockGettime(clockid int32, time *Timespec) (err error) //sys Close(fd int) (err error) -//sys Dup(oldfd int) (fd int, err error) -//sys Dup3(oldfd int, newfd int, flags int) (err error) +//sys Creat(path string, mode uint32) (fd int, err error) +//sysnb Dup(oldfd int) (fd int, err error) +//sysnb Dup2(oldfd int, newfd int) (err error) +//sysnb Dup3(oldfd int, newfd int, flags int) (err error) //sysnb EpollCreate(size int) (fd int, err error) //sysnb EpollCreate1(flag int) (fd int, err error) //sysnb EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) @@ -862,12 +810,7 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri //sys Fsync(fd int) (err error) //sys Getdents(fd int, buf []byte) (n int, err error) = SYS_GETDENTS64 //sysnb Getpgid(pid int) (pgid int, err error) - -func Getpgrp() (pid int) { - pid, _ = Getpgid(0) - return -} - +//sysnb Getpgrp() (pid int) //sysnb Getpid() (pid int) //sysnb Getppid() (ppid int) //sys Getpriority(which int, who int) (prio int, err error) @@ -875,21 +818,27 @@ func Getpgrp() (pid int) { //sysnb Gettid() (tid int) //sys Getxattr(path string, attr string, dest []byte) (sz int, err error) //sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) +//sysnb InotifyInit() (fd int, err error) //sysnb InotifyInit1(flags int) (fd int, err error) //sysnb InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) //sysnb Kill(pid int, sig syscall.Signal) (err error) //sys Klogctl(typ int, buf []byte) (n int, err error) = SYS_SYSLOG +//sys Link(oldpath string, newpath string) (err error) //sys Listxattr(path string, dest []byte) (sz int, err error) +//sys Mkdir(path string, mode uint32) (err error) //sys Mkdirat(dirfd int, path string, mode uint32) (err error) +//sys Mknod(path string, mode uint32, dev int) (err error) //sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Pause() (err error) //sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT //sysnb prlimit(pid int, resource int, old *Rlimit, newlimit *Rlimit) (err error) = SYS_PRLIMIT64 -//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) //sys read(fd int, p []byte) (n int, err error) +//sys Readlink(path string, buf []byte) (n int, err error) //sys Removexattr(path string, attr string) (err error) +//sys Rename(oldpath string, newpath string) (err error) //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) +//sys Rmdir(path string) (err error) //sys Setdomainname(p []byte) (err error) //sys Sethostname(p []byte) (err error) //sysnb Setpgid(pid int, pgid int) (err error) @@ -911,6 +860,7 @@ func Setgid(uid int) (err error) { //sys Setpriority(which int, who int, prio int) (err error) //sys Setxattr(path string, attr string, data []byte, flags int) (err error) +//sys Symlink(oldpath string, newpath string) (err error) //sys Sync() //sysnb Sysinfo(info *Sysinfo_t) (err error) //sys Tee(rfd int, wfd int, len int, flags int) (n int64, err error) @@ -918,6 +868,8 @@ func Setgid(uid int) (err error) { //sysnb Times(tms *Tms) (ticks uintptr, err error) //sysnb Umask(mask int) (oldmask int) //sysnb Uname(buf *Utsname) (err error) +//sys Unlink(path string) (err error) +//sys Unlinkat(dirfd int, path string) (err error) //sys Unmount(target string, flags int) (err error) = SYS_UMOUNT2 //sys Unshare(flags int) (err error) //sys Ustat(dev int, ubuf *Ustat_t) (err error) @@ -962,6 +914,7 @@ func Munmap(b []byte) (err error) { // Capget // Capset // ClockGetres +// ClockGettime // ClockNanosleep // ClockSettime // Clone @@ -972,6 +925,7 @@ func Munmap(b []byte) (err error) { // EpollWaitOld // Eventfd // Execve +// Fadvise64 // Fgetxattr // Flistxattr // Fork @@ -1023,6 +977,7 @@ func Munmap(b []byte) (err error) { // Personality // Poll // Ppoll +// Prctl // Pselect6 // Ptrace // Putpmsg diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_386.go index 7171219af7..2ab897485d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_386.go @@ -5,8 +5,6 @@ // TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP) // so that go vet can check that they are correct. -// +build 386,linux - package unix import ( @@ -33,36 +31,9 @@ func NsecToTimeval(nsec int64) (tv Timeval) { return } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - // 64-bit file system and 32-bit uid calls // (386 default is 32-bit file system and 16-bit uid). -//sys Dup2(oldfd int, newfd int) (err error) -//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64_64 +//sys Chown(path string, uid int, gid int) (err error) = SYS_CHOWN32 //sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32 //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 //sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64 @@ -70,7 +41,6 @@ func Pipe2(p []int, flags int) (err error) { //sysnb Geteuid() (euid int) = SYS_GETEUID32 //sysnb Getgid() (gid int) = SYS_GETGID32 //sysnb Getuid() (uid int) = SYS_GETUID32 -//sysnb InotifyInit() (fd int, err error) //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) //sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32 diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go index ae70c2afca..6690e0d58a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go @@ -2,14 +2,11 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64,linux - package unix import "syscall" -//sys Dup2(oldfd int, newfd int) (err error) -//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 +//sys Chown(path string, uid int, gid int) (err error) //sys Fchown(fd int, uid int, gid int) (err error) //sys Fstat(fd int, stat *Stat_t) (err error) //sys Fstatfs(fd int, buf *Statfs_t) (err error) @@ -19,7 +16,6 @@ import "syscall" //sysnb Getgid() (gid int) //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) //sysnb Getuid() (uid int) -//sysnb InotifyInit() (fd int, err error) //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) //sys Lchown(path string, uid int, gid int) (err error) @@ -61,6 +57,8 @@ import "syscall" //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) +func Getpagesize() int { return 4096 } + //go:noescape func gettimeofday(tv *Timeval) (err syscall.Errno) @@ -72,8 +70,6 @@ func Gettimeofday(tv *Timeval) (err error) { return nil } -func Getpagesize() int { return 4096 } - func Time(t *Time_t) (tt Time_t, err error) { var tv Timeval errno := gettimeofday(&tv) @@ -103,32 +99,6 @@ func NsecToTimeval(nsec int64) (tv Timeval) { return } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - func (r *PtraceRegs) PC() uint64 { return r.Rip } func (r *PtraceRegs) SetPC(pc uint64) { r.Rip = pc } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go index abc41c3ea5..b5da9e35a3 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build arm,linux - package unix import ( @@ -28,30 +26,6 @@ func NsecToTimeval(nsec int64) (tv Timeval) { return } -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, 0) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - // Underlying system call writes to newoffset via pointer. // Implemented in assembly to avoid allocation. func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) @@ -83,14 +57,13 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { // 64-bit file system and 32-bit uid calls // (16-bit uid calls are not always supported in newer kernels) -//sys Dup2(oldfd int, newfd int) (err error) +//sys Chown(path string, uid int, gid int) (err error) = SYS_CHOWN32 //sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32 //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 //sysnb Getegid() (egid int) = SYS_GETEGID32 //sysnb Geteuid() (euid int) = SYS_GETEUID32 //sysnb Getgid() (gid int) = SYS_GETGID32 //sysnb Getuid() (uid int) = SYS_GETUID32 -//sysnb InotifyInit() (fd int, err error) //sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32 //sys Listen(s int, n int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 @@ -115,14 +88,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { //sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64 //sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64 -func Fadvise(fd int, offset int64, length int64, advice int) (err error) { - _, _, e1 := Syscall6(SYS_ARM_FADVISE64_64, uintptr(fd), uintptr(advice), uintptr(offset), uintptr(offset>>32), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - //sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) func Fstatfs(fd int, buf *Statfs_t) (err error) { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go deleted file mode 100644 index f3d72dfd30..0000000000 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build arm64,linux - -package unix - -const _SYS_dup = SYS_DUP3 - -//sys Fchown(fd int, uid int, gid int) (err error) -//sys Fstat(fd int, stat *Stat_t) (err error) -//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) -//sys Fstatfs(fd int, buf *Statfs_t) (err error) -//sys Ftruncate(fd int, length int64) (err error) -//sysnb Getegid() (egid int) -//sysnb Geteuid() (euid int) -//sysnb Getgid() (gid int) -//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) -//sysnb Getuid() (uid int) -//sys Listen(s int, n int) (err error) -//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 -//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 -//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK -//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS_PSELECT6 -//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) -//sys Setfsgid(gid int) (err error) -//sys Setfsuid(uid int) (err error) -//sysnb Setregid(rgid int, egid int) (err error) -//sysnb Setresgid(rgid int, egid int, sgid int) (err error) -//sysnb Setresuid(ruid int, euid int, suid int) (err error) -//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) -//sysnb Setreuid(ruid int, euid int) (err error) -//sys Shutdown(fd int, how int) (err error) -//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) - -func Stat(path string, stat *Stat_t) (err error) { - return Fstatat(AT_FDCWD, path, stat, 0) -} - -func Lchown(path string, uid int, gid int) (err error) { - return Fchownat(AT_FDCWD, path, uid, gid, AT_SYMLINK_NOFOLLOW) -} - -func Lstat(path string, stat *Stat_t) (err error) { - return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW) -} - -//sys Statfs(path string, buf *Statfs_t) (err error) -//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) -//sys Truncate(path string, length int64) (err error) -//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) -//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) -//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) -//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) -//sysnb getgroups(n int, list *_Gid_t) (nn int, err error) -//sysnb setgroups(n int, list *_Gid_t) (err error) -//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) -//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) -//sysnb socket(domain int, typ int, proto int) (fd int, err error) -//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) -//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) -//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) -//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) -//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) -//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) -//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) -//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) - -func Getpagesize() int { return 65536 } - -//sysnb Gettimeofday(tv *Timeval) (err error) -//sysnb Time(t *Time_t) (tt Time_t, err error) - -func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } - -func NsecToTimespec(nsec int64) (ts Timespec) { - ts.Sec = nsec / 1e9 - ts.Nsec = nsec % 1e9 - return -} - -func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } - -func NsecToTimeval(nsec int64) (tv Timeval) { - nsec += 999 // round up to microsecond - tv.Sec = nsec / 1e9 - tv.Usec = nsec % 1e9 / 1e3 - return -} - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, 0) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -func (r *PtraceRegs) PC() uint64 { return r.Pc } - -func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc } - -func (iov *Iovec) SetLen(length int) { - iov.Len = uint64(length) -} - -func (msghdr *Msghdr) SetControllen(length int) { - msghdr.Controllen = uint64(length) -} - -func (cmsg *Cmsghdr) SetLen(length int) { - cmsg.Len = uint64(length) -} - -func InotifyInit() (fd int, err error) { - return InotifyInit1(0) -} - -// TODO(dfc): constants that should be in zsysnum_linux_arm64.go, remove -// these when the deprecated syscalls that the syscall package relies on -// are removed. -const ( - SYS_GETPGRP = 1060 - SYS_UTIMES = 1037 - SYS_FUTIMESAT = 1066 - SYS_PAUSE = 1061 - SYS_USTAT = 1070 - SYS_UTIME = 1063 - SYS_LCHOWN = 1032 - SYS_TIME = 1062 - SYS_EPOLL_CREATE = 1042 - SYS_EPOLL_WAIT = 1069 -) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go deleted file mode 100644 index 67eed6334c..0000000000 --- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux -// +build ppc64 ppc64le - -package unix - -//sys Fchown(fd int, uid int, gid int) (err error) -//sys Fstat(fd int, stat *Stat_t) (err error) -//sys Fstatfs(fd int, buf *Statfs_t) (err error) -//sys Ftruncate(fd int, length int64) (err error) -//sysnb Getegid() (egid int) -//sysnb Geteuid() (euid int) -//sysnb Getgid() (gid int) -//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_UGETRLIMIT -//sysnb Getuid() (uid int) -//sys Ioperm(from int, num int, on int) (err error) -//sys Iopl(level int) (err error) -//sys Lchown(path string, uid int, gid int) (err error) -//sys Listen(s int, n int) (err error) -//sys Lstat(path string, stat *Stat_t) (err error) -//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 -//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 -//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK -//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) -//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) -//sys Setfsgid(gid int) (err error) -//sys Setfsuid(uid int) (err error) -//sysnb Setregid(rgid int, egid int) (err error) -//sysnb Setresgid(rgid int, egid int, sgid int) (err error) -//sysnb Setresuid(ruid int, euid int, suid int) (err error) -//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) -//sysnb Setreuid(ruid int, euid int) (err error) -//sys Shutdown(fd int, how int) (err error) -//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) -//sys Stat(path string, stat *Stat_t) (err error) -//sys Statfs(path string, buf *Statfs_t) (err error) -//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) = SYS_SYNC_FILE_RANGE2 -//sys Truncate(path string, length int64) (err error) -//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) -//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) -//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) -//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) -//sysnb getgroups(n int, list *_Gid_t) (nn int, err error) -//sysnb setgroups(n int, list *_Gid_t) (err error) -//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) -//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) -//sysnb socket(domain int, typ int, proto int) (fd int, err error) -//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) -//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) -//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) -//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) -//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) -//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) -//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) -//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) - -func Getpagesize() int { return 65536 } - -//sysnb Gettimeofday(tv *Timeval) (err error) -//sysnb Time(t *Time_t) (tt Time_t, err error) - -func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } - -func NsecToTimespec(nsec int64) (ts Timespec) { - ts.Sec = nsec / 1e9 - ts.Nsec = nsec % 1e9 - return -} - -func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } - -func NsecToTimeval(nsec int64) (tv Timeval) { - nsec += 999 // round up to microsecond - tv.Sec = nsec / 1e9 - tv.Usec = nsec % 1e9 / 1e3 - return -} - -func (r *PtraceRegs) PC() uint64 { return r.Nip } - -func (r *PtraceRegs) SetPC(pc uint64) { r.Nip = pc } - -func (iov *Iovec) SetLen(length int) { - iov.Len = uint64(length) -} - -func (msghdr *Msghdr) SetControllen(length int) { - msghdr.Controllen = uint64(length) -} - -func (cmsg *Cmsghdr) SetLen(length int) { - cmsg.Len = uint64(length) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go index c4e945cd69..5fad6a5cf9 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -151,8 +151,8 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Chown(path string, uid int, gid int) (err error) //sys Chroot(path string) (err error) //sys Close(fd int) (err error) -//sys Dup(fd int) (nfd int, err error) -//sys Dup2(from int, to int) (err error) +//sysnb Dup(fd int) (nfd int, err error) +//sysnb Dup2(from int, to int) (err error) //sys Exit(code int) //sys Fchdir(fd int) (err error) //sys Fchflags(fd int, flags int) (err error) @@ -186,11 +186,6 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Mkdir(path string, mode uint32) (err error) //sys Mkfifo(path string, mode uint32) (err error) //sys Mknod(path string, mode uint32, dev int) (err error) -//sys Mlock(b []byte) (err error) -//sys Mlockall(flags int) (err error) -//sys Mprotect(b []byte, prot int) (err error) -//sys Munlock(b []byte) (err error) -//sys Munlockall() (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Open(path string, mode int, perm uint32) (fd int, err error) //sys Pathconf(path string, name int) (val int, err error) @@ -423,7 +418,10 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e // madvise // mincore // minherit +// mlock +// mlockall // modctl +// mprotect // mq_close // mq_getattr // mq_notify @@ -438,6 +436,8 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e // msgget // msgrcv // msgsnd +// munlock +// munlockall // nfssvc // ntp_adjtime // pmc_control diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go index 1b0e1af125..bf73fff2e9 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build 386,netbsd - package unix func Getpagesize() int { return 4096 } diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go index 1b6dcbe35d..474a092cbd 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64,netbsd - package unix func Getpagesize() int { return 4096 } diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go index 87d1d6fed1..3c6755b3ed 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build arm,netbsd - package unix func Getpagesize() int { return 4096 } diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index 246131d2af..9a6617db09 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -129,8 +129,8 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { //sys Chown(path string, uid int, gid int) (err error) //sys Chroot(path string) (err error) //sys Close(fd int) (err error) -//sys Dup(fd int) (nfd int, err error) -//sys Dup2(from int, to int) (err error) +//sysnb Dup(fd int) (nfd int, err error) +//sysnb Dup2(from int, to int) (err error) //sys Exit(code int) //sys Fchdir(fd int) (err error) //sys Fchflags(fd int, flags int) (err error) @@ -165,11 +165,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { //sys Mkdir(path string, mode uint32) (err error) //sys Mkfifo(path string, mode uint32) (err error) //sys Mknod(path string, mode uint32, dev int) (err error) -//sys Mlock(b []byte) (err error) -//sys Mlockall(flags int) (err error) -//sys Mprotect(b []byte, prot int) (err error) -//sys Munlock(b []byte) (err error) -//sys Munlockall() (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Open(path string, mode int, perm uint32) (fd int, err error) //sys Pathconf(path string, name int) (val int, err error) @@ -254,12 +249,16 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { // mkdirat // mkfifoat // mknodat +// mlock +// mlockall // mount // mquery // msgctl // msgget // msgrcv // msgsnd +// munlock +// munlockall // nfssvc // nnpfspioctl // openat diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go index 9529b20e82..23b665c069 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build 386,openbsd - package unix func Getpagesize() int { return 4096 } diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go index fc6402946e..e5513534da 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64,openbsd - package unix func Getpagesize() int { return 4096 } diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index eb489b159f..7e9626ad0d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -13,17 +13,10 @@ package unix import ( - "sync/atomic" "syscall" "unsafe" ) -// Implemented in runtime/syscall_solaris.go. -type syscallFunc uintptr - -func rawSysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) -func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) - type SockaddrDatalink struct { Family uint16 Index uint16 @@ -139,8 +132,6 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) { return unsafe.Pointer(&sa.raw), sl, nil } -//sys getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = libsocket.getsockname - func Getsockname(fd int) (sa Sockaddr, err error) { var rsa RawSockaddrAny var len _Socklen = SizeofSockaddrAny @@ -150,23 +141,12 @@ func Getsockname(fd int) (sa Sockaddr, err error) { return anyToSockaddr(&rsa) } -const ImplementsGetwd = true +// The const provides a compile-time constant so clients +// can adjust to whether there is a working Getwd and avoid +// even linking this function into the binary. See ../os/getwd.go. +const ImplementsGetwd = false -//sys Getcwd(buf []byte) (n int, err error) - -func Getwd() (wd string, err error) { - var buf [PathMax]byte - // Getcwd will return an error if it failed for any reason. - _, err = Getcwd(buf[0:]) - if err != nil { - return "", err - } - n := clen(buf[:]) - if n < 1 { - return "", EINVAL - } - return string(buf[:n]), nil -} +func Getwd() (string, error) { return "", ENOTSUP } /* * Wrapped @@ -177,20 +157,21 @@ func Getwd() (wd string, err error) { func Getgroups() (gids []int, err error) { n, err := getgroups(0, nil) - // Check for error and sanity check group count. Newer versions of - // Solaris allow up to 1024 (NGROUPS_MAX). - if n < 0 || n > 1024 { - if err != nil { - return nil, err - } - return nil, EINVAL - } else if n == 0 { + if err != nil { + return nil, err + } + if n == 0 { return nil, nil } + // Sanity check group count. Max is 16 on BSD. + if n < 0 || n > 1000 { + return nil, EINVAL + } + a := make([]_Gid_t, n) n, err = getgroups(n, &a[0]) - if n == -1 { + if err != nil { return nil, err } gids = make([]int, n) @@ -289,80 +270,29 @@ func Gethostname() (name string, err error) { return name, err } -//sys utimes(path string, times *[2]Timeval) (err error) - -func Utimes(path string, tv []Timeval) (err error) { - if tv == nil { - return utimes(path, nil) - } - if len(tv) != 2 { - return EINVAL - } - return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) -} - -//sys utimensat(fd int, path string, times *[2]Timespec, flag int) (err error) - -func UtimesNano(path string, ts []Timespec) error { - if ts == nil { - return utimensat(AT_FDCWD, path, nil, 0) - } +func UtimesNano(path string, ts []Timespec) (err error) { if len(ts) != 2 { return EINVAL } - return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) -} - -func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error { - if ts == nil { - return utimensat(dirfd, path, nil, flags) + var tv [2]Timeval + for i := 0; i < 2; i++ { + tv[i].Sec = ts[i].Sec + tv[i].Usec = ts[i].Nsec / 1000 } - if len(ts) != 2 { - return EINVAL - } - return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags) + return Utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) } //sys fcntl(fd int, cmd int, arg int) (val int, err error) // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procfcntl)), 3, uintptr(fd), uintptr(cmd), uintptr(unsafe.Pointer(lk)), 0, 0, 0) + _, _, e1 := sysvicall6(procfcntl.Addr(), 3, uintptr(fd), uintptr(cmd), uintptr(unsafe.Pointer(lk)), 0, 0, 0) if e1 != 0 { return e1 } return nil } -//sys futimesat(fildes int, path *byte, times *[2]Timeval) (err error) - -func Futimesat(dirfd int, path string, tv []Timeval) error { - pathp, err := BytePtrFromString(path) - if err != nil { - return err - } - if tv == nil { - return futimesat(dirfd, pathp, nil) - } - if len(tv) != 2 { - return EINVAL - } - return futimesat(dirfd, pathp, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) -} - -// Solaris doesn't have an futimes function because it allows NULL to be -// specified as the path for futimesat. However, Go doesn't like -// NULL-style string interfaces, so this simple wrapper is provided. -func Futimes(fd int, tv []Timeval) error { - if tv == nil { - return futimesat(fd, nil, nil) - } - if len(tv) != 2 { - return EINVAL - } - return futimesat(fd, nil, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) -} - func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) { switch rsa.Addr.Family { case AF_UNIX: @@ -411,7 +341,7 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) { var rsa RawSockaddrAny var len _Socklen = SizeofSockaddrAny nfd, err = accept(fd, &rsa, &len) - if nfd == -1 { + if err != nil { return } sa, err = anyToSockaddr(&rsa) @@ -422,8 +352,6 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) { return } -//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = libsocket.recvmsg - func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) { var msg Msghdr var rsa RawSockaddrAny @@ -445,7 +373,7 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from } msg.Iov = &iov msg.Iovlen = 1 - if n, err = recvmsg(fd, &msg, flags); n == -1 { + if n, err = recvmsg(fd, &msg, flags); err != nil { return } oobn = int(msg.Accrightslen) @@ -500,67 +428,6 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) return n, nil } -//sys acct(path *byte) (err error) - -func Acct(path string) (err error) { - if len(path) == 0 { - // Assume caller wants to disable accounting. - return acct(nil) - } - - pathp, err := BytePtrFromString(path) - if err != nil { - return err - } - return acct(pathp) -} - -/* - * Expose the ioctl function - */ - -//sys ioctl(fd int, req int, arg uintptr) (err error) - -func IoctlSetInt(fd int, req int, value int) (err error) { - return ioctl(fd, req, uintptr(value)) -} - -func IoctlSetWinsize(fd int, req int, value *Winsize) (err error) { - return ioctl(fd, req, uintptr(unsafe.Pointer(value))) -} - -func IoctlSetTermios(fd int, req int, value *Termios) (err error) { - return ioctl(fd, req, uintptr(unsafe.Pointer(value))) -} - -func IoctlSetTermio(fd int, req int, value *Termio) (err error) { - return ioctl(fd, req, uintptr(unsafe.Pointer(value))) -} - -func IoctlGetInt(fd int, req int) (int, error) { - var value int - err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) - return value, err -} - -func IoctlGetWinsize(fd int, req int) (*Winsize, error) { - var value Winsize - err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) - return &value, err -} - -func IoctlGetTermios(fd int, req int) (*Termios, error) { - var value Termios - err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) - return &value, err -} - -func IoctlGetTermio(fd int, req int) (*Termio, error) { - var value Termio - err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) - return &value, err -} - /* * Exposed directly */ @@ -571,29 +438,21 @@ func IoctlGetTermio(fd int, req int) (*Termio, error) { //sys Chown(path string, uid int, gid int) (err error) //sys Chroot(path string) (err error) //sys Close(fd int) (err error) -//sys Creat(path string, mode uint32) (fd int, err error) //sys Dup(fd int) (nfd int, err error) -//sys Dup2(oldfd int, newfd int) (err error) //sys Exit(code int) //sys Fchdir(fd int) (err error) //sys Fchmod(fd int, mode uint32) (err error) -//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) //sys Fchown(fd int, uid int, gid int) (err error) -//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) -//sys Fdatasync(fd int) (err error) //sys Fpathconf(fd int, name int) (val int, err error) //sys Fstat(fd int, stat *Stat_t) (err error) //sys Getdents(fd int, buf []byte, basep *uintptr) (n int, err error) //sysnb Getgid() (gid int) //sysnb Getpid() (pid int) -//sysnb Getpgid(pid int) (pgid int, err error) -//sysnb Getpgrp() (pgid int, err error) //sys Geteuid() (euid int) //sys Getegid() (egid int) //sys Getppid() (ppid int) //sys Getpriority(which int, who int) (n int, err error) //sysnb Getrlimit(which int, lim *Rlimit) (err error) -//sysnb Getrusage(who int, rusage *Rusage) (err error) //sysnb Gettimeofday(tv *Timeval) (err error) //sysnb Getuid() (uid int) //sys Kill(pid int, signum syscall.Signal) (err error) @@ -601,35 +460,21 @@ func IoctlGetTermio(fd int, req int) (*Termio, error) { //sys Link(path string, link string) (err error) //sys Listen(s int, backlog int) (err error) = libsocket.listen //sys Lstat(path string, stat *Stat_t) (err error) -//sys Madvise(b []byte, advice int) (err error) //sys Mkdir(path string, mode uint32) (err error) -//sys Mkdirat(dirfd int, path string, mode uint32) (err error) -//sys Mkfifo(path string, mode uint32) (err error) -//sys Mkfifoat(dirfd int, path string, mode uint32) (err error) //sys Mknod(path string, mode uint32, dev int) (err error) -//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error) -//sys Mlock(b []byte) (err error) -//sys Mlockall(flags int) (err error) -//sys Mprotect(b []byte, prot int) (err error) -//sys Munlock(b []byte) (err error) -//sys Munlockall() (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Open(path string, mode int, perm uint32) (fd int, err error) -//sys Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) //sys Pathconf(path string, name int) (val int, err error) -//sys Pause() (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) //sys read(fd int, p []byte) (n int, err error) //sys Readlink(path string, buf []byte) (n int, err error) //sys Rename(from string, to string) (err error) -//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys Rmdir(path string) (err error) //sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = lseek //sysnb Setegid(egid int) (err error) //sysnb Seteuid(euid int) (err error) //sysnb Setgid(gid int) (err error) -//sys Sethostname(p []byte) (err error) //sysnb Setpgid(pid int, pgid int) (err error) //sys Setpriority(which int, who int, prio int) (err error) //sysnb Setregid(rgid int, egid int) (err error) @@ -641,17 +486,12 @@ func IoctlGetTermio(fd int, req int) (*Termio, error) { //sys Stat(path string, stat *Stat_t) (err error) //sys Symlink(path string, link string) (err error) //sys Sync() (err error) -//sysnb Times(tms *Tms) (ticks uintptr, err error) //sys Truncate(path string, length int64) (err error) //sys Fsync(fd int) (err error) //sys Ftruncate(fd int, length int64) (err error) -//sys Umask(mask int) (oldmask int) -//sysnb Uname(buf *Utsname) (err error) -//sys Unmount(target string, flags int) (err error) = libc.umount +//sys Umask(newmask int) (oldmask int) //sys Unlink(path string) (err error) -//sys Unlinkat(dirfd int, path string, flags int) (err error) -//sys Ustat(dev int, ubuf *Ustat_t) (err error) -//sys Utime(path string, buf *Utimbuf) (err error) +//sys Utimes(path string, times *[2]Timeval) (err error) //sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.bind //sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.connect //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) @@ -662,11 +502,13 @@ func IoctlGetTermio(fd int, req int) (*Termio, error) { //sys write(fd int, p []byte) (n int, err error) //sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) = libsocket.getsockopt //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = libsocket.getpeername +//sys getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = libsocket.getsockname //sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) = libsocket.setsockopt //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) = libsocket.recvfrom +//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = libsocket.recvmsg func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procread)), 3, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf), 0, 0, 0) + r0, _, e1 := sysvicall6(procread.Addr(), 3, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf), 0, 0, 0) n = int(r0) if e1 != 0 { err = e1 @@ -675,39 +517,10 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { } func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwrite)), 3, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf), 0, 0, 0) + r0, _, e1 := sysvicall6(procwrite.Addr(), 3, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf), 0, 0, 0) n = int(r0) if e1 != 0 { err = e1 } return } - -var mapper = &mmapper{ - active: make(map[*byte][]byte), - mmap: mmap, - munmap: munmap, -} - -func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { - return mapper.Mmap(fd, offset, length, prot, flags) -} - -func Munmap(b []byte) (err error) { - return mapper.Munmap(b) -} - -//sys sysconf(name int) (n int64, err error) - -// pageSize caches the value of Getpagesize, since it can't change -// once the system is booted. -var pageSize int64 // accessed atomically - -func Getpagesize() int { - n := atomic.LoadInt64(&pageSize) - if n == 0 { - n, _ = sysconf(_SC_PAGESIZE) - atomic.StoreInt64(&pageSize, n) - } - return int(n) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go index 2e44630cd0..4795f524a4 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64,solaris - package unix +func Getpagesize() int { return 4096 } + func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } func NsecToTimespec(nsec int64) (ts Timespec) { diff --git a/vendor/golang.org/x/sys/unix/syscall_test.go b/vendor/golang.org/x/sys/unix/syscall_test.go deleted file mode 100644 index 95eac92aca..0000000000 --- a/vendor/golang.org/x/sys/unix/syscall_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux netbsd openbsd solaris - -package unix_test - -import ( - "fmt" - "testing" - - "golang.org/x/sys/unix" -) - -func testSetGetenv(t *testing.T, key, value string) { - err := unix.Setenv(key, value) - if err != nil { - t.Fatalf("Setenv failed to set %q: %v", value, err) - } - newvalue, found := unix.Getenv(key) - if !found { - t.Fatalf("Getenv failed to find %v variable (want value %q)", key, value) - } - if newvalue != value { - t.Fatalf("Getenv(%v) = %q; want %q", key, newvalue, value) - } -} - -func TestEnv(t *testing.T) { - testSetGetenv(t, "TESTENV", "AVALUE") - // make sure TESTENV gets set to "", not deleted - testSetGetenv(t, "TESTENV", "") -} - -func TestItoa(t *testing.T) { - // Make most negative integer: 0x8000... - i := 1 - for i<<1 != 0 { - i <<= 1 - } - if i >= 0 { - t.Fatal("bad math") - } - s := unix.Itoa(i) - f := fmt.Sprint(i) - if s != f { - t.Fatalf("itoa(%d) = %s, want %s", i, s, f) - } -} diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index b46b25028c..70b65f4400 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -25,30 +25,6 @@ const ( netbsd32Bit = runtime.GOOS == "netbsd" && sizeofPtr == 4 ) -// Do the interface allocations only once for common -// Errno values. -var ( - errEAGAIN error = syscall.EAGAIN - errEINVAL error = syscall.EINVAL - errENOENT error = syscall.ENOENT -) - -// errnoErr returns common boxed Errno values, to prevent -// allocations at runtime. -func errnoErr(e syscall.Errno) error { - switch e { - case 0: - return nil - case EAGAIN: - return errEAGAIN - case EINVAL: - return errEINVAL - case ENOENT: - return errENOENT - } - return e -} - func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_test.go b/vendor/golang.org/x/sys/unix/syscall_unix_test.go deleted file mode 100644 index bcc79d19ca..0000000000 --- a/vendor/golang.org/x/sys/unix/syscall_unix_test.go +++ /dev/null @@ -1,318 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux netbsd openbsd solaris - -package unix_test - -import ( - "flag" - "fmt" - "io/ioutil" - "net" - "os" - "os/exec" - "path/filepath" - "runtime" - "testing" - "time" - - "golang.org/x/sys/unix" -) - -// Tests that below functions, structures and constants are consistent -// on all Unix-like systems. -func _() { - // program scheduling priority functions and constants - var ( - _ func(int, int, int) error = unix.Setpriority - _ func(int, int) (int, error) = unix.Getpriority - ) - const ( - _ int = unix.PRIO_USER - _ int = unix.PRIO_PROCESS - _ int = unix.PRIO_PGRP - ) - - // termios constants - const ( - _ int = unix.TCIFLUSH - _ int = unix.TCIOFLUSH - _ int = unix.TCOFLUSH - ) - - // fcntl file locking structure and constants - var ( - _ = unix.Flock_t{ - Type: int16(0), - Whence: int16(0), - Start: int64(0), - Len: int64(0), - Pid: int32(0), - } - ) - const ( - _ = unix.F_GETLK - _ = unix.F_SETLK - _ = unix.F_SETLKW - ) -} - -// TestFcntlFlock tests whether the file locking structure matches -// the calling convention of each kernel. -func TestFcntlFlock(t *testing.T) { - name := filepath.Join(os.TempDir(), "TestFcntlFlock") - fd, err := unix.Open(name, unix.O_CREAT|unix.O_RDWR|unix.O_CLOEXEC, 0) - if err != nil { - t.Fatalf("Open failed: %v", err) - } - defer unix.Unlink(name) - defer unix.Close(fd) - flock := unix.Flock_t{ - Type: unix.F_RDLCK, - Start: 0, Len: 0, Whence: 1, - } - if err := unix.FcntlFlock(uintptr(fd), unix.F_GETLK, &flock); err != nil { - t.Fatalf("FcntlFlock failed: %v", err) - } -} - -// TestPassFD tests passing a file descriptor over a Unix socket. -// -// This test involved both a parent and child process. The parent -// process is invoked as a normal test, with "go test", which then -// runs the child process by running the current test binary with args -// "-test.run=^TestPassFD$" and an environment variable used to signal -// that the test should become the child process instead. -func TestPassFD(t *testing.T) { - switch runtime.GOOS { - case "dragonfly": - // TODO(jsing): Figure out why sendmsg is returning EINVAL. - t.Skip("skipping test on dragonfly") - case "solaris": - // TODO(aram): Figure out why ReadMsgUnix is returning empty message. - t.Skip("skipping test on solaris, see issue 7402") - } - if os.Getenv("GO_WANT_HELPER_PROCESS") == "1" { - passFDChild() - return - } - - tempDir, err := ioutil.TempDir("", "TestPassFD") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tempDir) - - fds, err := unix.Socketpair(unix.AF_LOCAL, unix.SOCK_STREAM, 0) - if err != nil { - t.Fatalf("Socketpair: %v", err) - } - defer unix.Close(fds[0]) - defer unix.Close(fds[1]) - writeFile := os.NewFile(uintptr(fds[0]), "child-writes") - readFile := os.NewFile(uintptr(fds[1]), "parent-reads") - defer writeFile.Close() - defer readFile.Close() - - cmd := exec.Command(os.Args[0], "-test.run=^TestPassFD$", "--", tempDir) - cmd.Env = []string{"GO_WANT_HELPER_PROCESS=1"} - if lp := os.Getenv("LD_LIBRARY_PATH"); lp != "" { - cmd.Env = append(cmd.Env, "LD_LIBRARY_PATH="+lp) - } - cmd.ExtraFiles = []*os.File{writeFile} - - out, err := cmd.CombinedOutput() - if len(out) > 0 || err != nil { - t.Fatalf("child process: %q, %v", out, err) - } - - c, err := net.FileConn(readFile) - if err != nil { - t.Fatalf("FileConn: %v", err) - } - defer c.Close() - - uc, ok := c.(*net.UnixConn) - if !ok { - t.Fatalf("unexpected FileConn type; expected UnixConn, got %T", c) - } - - buf := make([]byte, 32) // expect 1 byte - oob := make([]byte, 32) // expect 24 bytes - closeUnix := time.AfterFunc(5*time.Second, func() { - t.Logf("timeout reading from unix socket") - uc.Close() - }) - _, oobn, _, _, err := uc.ReadMsgUnix(buf, oob) - closeUnix.Stop() - - scms, err := unix.ParseSocketControlMessage(oob[:oobn]) - if err != nil { - t.Fatalf("ParseSocketControlMessage: %v", err) - } - if len(scms) != 1 { - t.Fatalf("expected 1 SocketControlMessage; got scms = %#v", scms) - } - scm := scms[0] - gotFds, err := unix.ParseUnixRights(&scm) - if err != nil { - t.Fatalf("unix.ParseUnixRights: %v", err) - } - if len(gotFds) != 1 { - t.Fatalf("wanted 1 fd; got %#v", gotFds) - } - - f := os.NewFile(uintptr(gotFds[0]), "fd-from-child") - defer f.Close() - - got, err := ioutil.ReadAll(f) - want := "Hello from child process!\n" - if string(got) != want { - t.Errorf("child process ReadAll: %q, %v; want %q", got, err, want) - } -} - -// passFDChild is the child process used by TestPassFD. -func passFDChild() { - defer os.Exit(0) - - // Look for our fd. It should be fd 3, but we work around an fd leak - // bug here (http://golang.org/issue/2603) to let it be elsewhere. - var uc *net.UnixConn - for fd := uintptr(3); fd <= 10; fd++ { - f := os.NewFile(fd, "unix-conn") - var ok bool - netc, _ := net.FileConn(f) - uc, ok = netc.(*net.UnixConn) - if ok { - break - } - } - if uc == nil { - fmt.Println("failed to find unix fd") - return - } - - // Make a file f to send to our parent process on uc. - // We make it in tempDir, which our parent will clean up. - flag.Parse() - tempDir := flag.Arg(0) - f, err := ioutil.TempFile(tempDir, "") - if err != nil { - fmt.Printf("TempFile: %v", err) - return - } - - f.Write([]byte("Hello from child process!\n")) - f.Seek(0, 0) - - rights := unix.UnixRights(int(f.Fd())) - dummyByte := []byte("x") - n, oobn, err := uc.WriteMsgUnix(dummyByte, rights, nil) - if err != nil { - fmt.Printf("WriteMsgUnix: %v", err) - return - } - if n != 1 || oobn != len(rights) { - fmt.Printf("WriteMsgUnix = %d, %d; want 1, %d", n, oobn, len(rights)) - return - } -} - -// TestUnixRightsRoundtrip tests that UnixRights, ParseSocketControlMessage, -// and ParseUnixRights are able to successfully round-trip lists of file descriptors. -func TestUnixRightsRoundtrip(t *testing.T) { - testCases := [...][][]int{ - {{42}}, - {{1, 2}}, - {{3, 4, 5}}, - {{}}, - {{1, 2}, {3, 4, 5}, {}, {7}}, - } - for _, testCase := range testCases { - b := []byte{} - var n int - for _, fds := range testCase { - // Last assignment to n wins - n = len(b) + unix.CmsgLen(4*len(fds)) - b = append(b, unix.UnixRights(fds...)...) - } - // Truncate b - b = b[:n] - - scms, err := unix.ParseSocketControlMessage(b) - if err != nil { - t.Fatalf("ParseSocketControlMessage: %v", err) - } - if len(scms) != len(testCase) { - t.Fatalf("expected %v SocketControlMessage; got scms = %#v", len(testCase), scms) - } - for i, scm := range scms { - gotFds, err := unix.ParseUnixRights(&scm) - if err != nil { - t.Fatalf("ParseUnixRights: %v", err) - } - wantFds := testCase[i] - if len(gotFds) != len(wantFds) { - t.Fatalf("expected %v fds, got %#v", len(wantFds), gotFds) - } - for j, fd := range gotFds { - if fd != wantFds[j] { - t.Fatalf("expected fd %v, got %v", wantFds[j], fd) - } - } - } - } -} - -func TestRlimit(t *testing.T) { - var rlimit, zero unix.Rlimit - err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlimit) - if err != nil { - t.Fatalf("Getrlimit: save failed: %v", err) - } - if zero == rlimit { - t.Fatalf("Getrlimit: save failed: got zero value %#v", rlimit) - } - set := rlimit - set.Cur = set.Max - 1 - err = unix.Setrlimit(unix.RLIMIT_NOFILE, &set) - if err != nil { - t.Fatalf("Setrlimit: set failed: %#v %v", set, err) - } - var get unix.Rlimit - err = unix.Getrlimit(unix.RLIMIT_NOFILE, &get) - if err != nil { - t.Fatalf("Getrlimit: get failed: %v", err) - } - set = rlimit - set.Cur = set.Max - 1 - if set != get { - // Seems like Darwin requires some privilege to - // increase the soft limit of rlimit sandbox, though - // Setrlimit never reports an error. - switch runtime.GOOS { - case "darwin": - default: - t.Fatalf("Rlimit: change failed: wanted %#v got %#v", set, get) - } - } - err = unix.Setrlimit(unix.RLIMIT_NOFILE, &rlimit) - if err != nil { - t.Fatalf("Setrlimit: restore failed: %#v %v", rlimit, err) - } -} - -func TestSeekFailure(t *testing.T) { - _, err := unix.Seek(-1, 0, 0) - if err == nil { - t.Fatalf("Seek(-1, 0, 0) did not fail") - } - str := err.Error() // used to crash on Linux - t.Logf("Seek: %v", str) - if str == "" { - t.Fatalf("Seek(-1, 0, 0) return error with empty message") - } -} diff --git a/vendor/golang.org/x/sys/unix/types_darwin.go b/vendor/golang.org/x/sys/unix/types_darwin.go index 1153261822..2bb15cb8b7 100644 --- a/vendor/golang.org/x/sys/unix/types_darwin.go +++ b/vendor/golang.org/x/sys/unix/types_darwin.go @@ -241,10 +241,3 @@ type BpfHdr C.struct_bpf_hdr // Terminal handling type Termios C.struct_termios - -// fchmodat-like syscalls. - -const ( - AT_FDCWD = C.AT_FDCWD - AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW -) diff --git a/vendor/golang.org/x/sys/unix/types_freebsd.go b/vendor/golang.org/x/sys/unix/types_freebsd.go index ae24557ad1..20c84a50bb 100644 --- a/vendor/golang.org/x/sys/unix/types_freebsd.go +++ b/vendor/golang.org/x/sys/unix/types_freebsd.go @@ -210,17 +210,6 @@ type Dirent C.struct_dirent type Fsid C.struct_fsid -// Advice to Fadvise - -const ( - FADV_NORMAL = C.POSIX_FADV_NORMAL - FADV_RANDOM = C.POSIX_FADV_RANDOM - FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL - FADV_WILLNEED = C.POSIX_FADV_WILLNEED - FADV_DONTNEED = C.POSIX_FADV_DONTNEED - FADV_NOREUSE = C.POSIX_FADV_NOREUSE -) - // Sockets type RawSockaddrInet4 C.struct_sockaddr_in diff --git a/vendor/golang.org/x/sys/unix/types_linux.go b/vendor/golang.org/x/sys/unix/types_linux.go index d5275875f8..fc64e75eee 100644 --- a/vendor/golang.org/x/sys/unix/types_linux.go +++ b/vendor/golang.org/x/sys/unix/types_linux.go @@ -50,19 +50,12 @@ package unix #include #include #include -#include +#include #include #include #include #include -#ifdef TCSETS2 -// On systems that have "struct termios2" use this as type Termios. -typedef struct termios2 termios_t; -#else -typedef struct termios termios_t; -#endif - enum { sizeofPtr = sizeof(void*), }; @@ -84,7 +77,7 @@ struct sockaddr_any { // copied from /usr/include/linux/un.h struct my_sockaddr_un { sa_family_t sun_family; -#if defined(__ARM_EABI__) || defined(__powerpc64__) +#ifdef __ARM_EABI__ // on ARM char is by default unsigned signed char sun_path[108]; #else @@ -94,10 +87,6 @@ struct my_sockaddr_un { #ifdef __ARM_EABI__ typedef struct user_regs PtraceRegs; -#elif defined(__aarch64__) -typedef struct user_pt_regs PtraceRegs; -#elif defined(__powerpc64__) -typedef struct pt_regs PtraceRegs; #else typedef struct user_regs_struct PtraceRegs; #endif @@ -171,17 +160,6 @@ type Fsid C.fsid_t type Flock_t C.struct_flock -// Advice to Fadvise - -const ( - FADV_NORMAL = C.POSIX_FADV_NORMAL - FADV_RANDOM = C.POSIX_FADV_RANDOM - FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL - FADV_WILLNEED = C.POSIX_FADV_WILLNEED - FADV_DONTNEED = C.POSIX_FADV_DONTNEED - FADV_NOREUSE = C.POSIX_FADV_NOREUSE -) - // Sockets type RawSockaddrInet4 C.struct_sockaddr_in @@ -396,11 +374,111 @@ type Ustat_t C.struct_ustat type EpollEvent C.struct_my_epoll_event const ( - AT_FDCWD = C.AT_FDCWD - AT_REMOVEDIR = C.AT_REMOVEDIR - AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW + _AT_FDCWD = C.AT_FDCWD ) // Terminal handling -type Termios C.termios_t +type Termios C.struct_termios + +const ( + VINTR = C.VINTR + VQUIT = C.VQUIT + VERASE = C.VERASE + VKILL = C.VKILL + VEOF = C.VEOF + VTIME = C.VTIME + VMIN = C.VMIN + VSWTC = C.VSWTC + VSTART = C.VSTART + VSTOP = C.VSTOP + VSUSP = C.VSUSP + VEOL = C.VEOL + VREPRINT = C.VREPRINT + VDISCARD = C.VDISCARD + VWERASE = C.VWERASE + VLNEXT = C.VLNEXT + VEOL2 = C.VEOL2 + IGNBRK = C.IGNBRK + BRKINT = C.BRKINT + IGNPAR = C.IGNPAR + PARMRK = C.PARMRK + INPCK = C.INPCK + ISTRIP = C.ISTRIP + INLCR = C.INLCR + IGNCR = C.IGNCR + ICRNL = C.ICRNL + IUCLC = C.IUCLC + IXON = C.IXON + IXANY = C.IXANY + IXOFF = C.IXOFF + IMAXBEL = C.IMAXBEL + IUTF8 = C.IUTF8 + OPOST = C.OPOST + OLCUC = C.OLCUC + ONLCR = C.ONLCR + OCRNL = C.OCRNL + ONOCR = C.ONOCR + ONLRET = C.ONLRET + OFILL = C.OFILL + OFDEL = C.OFDEL + B0 = C.B0 + B50 = C.B50 + B75 = C.B75 + B110 = C.B110 + B134 = C.B134 + B150 = C.B150 + B200 = C.B200 + B300 = C.B300 + B600 = C.B600 + B1200 = C.B1200 + B1800 = C.B1800 + B2400 = C.B2400 + B4800 = C.B4800 + B9600 = C.B9600 + B19200 = C.B19200 + B38400 = C.B38400 + CSIZE = C.CSIZE + CS5 = C.CS5 + CS6 = C.CS6 + CS7 = C.CS7 + CS8 = C.CS8 + CSTOPB = C.CSTOPB + CREAD = C.CREAD + PARENB = C.PARENB + PARODD = C.PARODD + HUPCL = C.HUPCL + CLOCAL = C.CLOCAL + B57600 = C.B57600 + B115200 = C.B115200 + B230400 = C.B230400 + B460800 = C.B460800 + B500000 = C.B500000 + B576000 = C.B576000 + B921600 = C.B921600 + B1000000 = C.B1000000 + B1152000 = C.B1152000 + B1500000 = C.B1500000 + B2000000 = C.B2000000 + B2500000 = C.B2500000 + B3000000 = C.B3000000 + B3500000 = C.B3500000 + B4000000 = C.B4000000 + ISIG = C.ISIG + ICANON = C.ICANON + XCASE = C.XCASE + ECHO = C.ECHO + ECHOE = C.ECHOE + ECHOK = C.ECHOK + ECHONL = C.ECHONL + NOFLSH = C.NOFLSH + TOSTOP = C.TOSTOP + ECHOCTL = C.ECHOCTL + ECHOPRT = C.ECHOPRT + ECHOKE = C.ECHOKE + FLUSHO = C.FLUSHO + PENDIN = C.PENDIN + IEXTEN = C.IEXTEN + TCGETS = C.TCGETS + TCSETS = C.TCSETS +) diff --git a/vendor/golang.org/x/sys/unix/types_solaris.go b/vendor/golang.org/x/sys/unix/types_solaris.go index 6ad50eaba6..753c7996b1 100644 --- a/vendor/golang.org/x/sys/unix/types_solaris.go +++ b/vendor/golang.org/x/sys/unix/types_solaris.go @@ -15,17 +15,10 @@ package unix /* #define KERNEL -// These defines ensure that builds done on newer versions of Solaris are -// backwards-compatible with older versions of Solaris and -// OpenSolaris-based derivatives. -#define __USE_SUNOS_SOCKETS__ // msghdr -#define __USE_LEGACY_PROTOTYPES__ // iovec #include #include -#include #include #include -#include #include #include #include @@ -37,9 +30,7 @@ package unix #include #include #include -#include #include -#include #include #include #include @@ -49,8 +40,6 @@ package unix #include #include #include -#include -#include enum { sizeofPtr = sizeof(void*), @@ -80,7 +69,6 @@ const ( sizeofInt = C.sizeof_int sizeofLong = C.sizeof_long sizeofLongLong = C.sizeof_longlong - PathMax = C.PATH_MAX ) // Basic types @@ -100,10 +88,6 @@ type Timeval C.struct_timeval type Timeval32 C.struct_timeval32 -type Tms C.struct_tms - -type Utimbuf C.struct_utimbuf - // Processes type Rusage C.struct_rusage @@ -191,20 +175,6 @@ const ( type FdSet C.fd_set -// Misc - -type Utsname C.struct_utsname - -type Ustat_t C.struct_ustat - -const ( - AT_FDCWD = C.AT_FDCWD - AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW - AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW - AT_REMOVEDIR = C.AT_REMOVEDIR - AT_EACCESS = C.AT_EACCESS -) - // Routing and interface messages const ( @@ -247,14 +217,6 @@ type BpfTimeval C.struct_bpf_timeval type BpfHdr C.struct_bpf_hdr -// sysconf information - -const _SC_PAGESIZE = C._SC_PAGESIZE - // Terminal handling type Termios C.struct_termios - -type Termio C.struct_termio - -type Winsize C.struct_winsize diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go index 8e63888351..15204b9c7d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go @@ -1,8 +1,6 @@ // mkerrors.sh -m32 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build 386,darwin - // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -m32 _const.go @@ -32,7 +30,7 @@ const ( AF_LAT = 0xe AF_LINK = 0x12 AF_LOCAL = 0x1 - AF_MAX = 0x28 + AF_MAX = 0x26 AF_NATM = 0x1f AF_NDRV = 0x1b AF_NETBIOS = 0x21 @@ -47,7 +45,6 @@ const ( AF_SYSTEM = 0x20 AF_UNIX = 0x1 AF_UNSPEC = 0x0 - AF_UTUN = 0x26 B0 = 0x0 B110 = 0x6e B115200 = 0x1c200 @@ -86,7 +83,6 @@ const ( BIOCSBLEN = 0xc0044266 BIOCSDLT = 0x80044278 BIOCSETF = 0x80084267 - BIOCSETFNR = 0x8008427e BIOCSETIF = 0x8020426c BIOCSHDRCMPLT = 0x80044275 BIOCSRSIG = 0x80044273 @@ -153,168 +149,33 @@ const ( CSUSP = 0x1a CTL_MAXNAME = 0xc CTL_NET = 0x4 - DLT_A429 = 0xb8 - DLT_A653_ICM = 0xb9 - DLT_AIRONET_HEADER = 0x78 - DLT_AOS = 0xde DLT_APPLE_IP_OVER_IEEE1394 = 0x8a DLT_ARCNET = 0x7 - DLT_ARCNET_LINUX = 0x81 DLT_ATM_CLIP = 0x13 DLT_ATM_RFC1483 = 0xb - DLT_AURORA = 0x7e DLT_AX25 = 0x3 - DLT_AX25_KISS = 0xca - DLT_BACNET_MS_TP = 0xa5 - DLT_BLUETOOTH_HCI_H4 = 0xbb - DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 - DLT_CAN20B = 0xbe - DLT_CAN_SOCKETCAN = 0xe3 DLT_CHAOS = 0x5 DLT_CHDLC = 0x68 - DLT_CISCO_IOS = 0x76 DLT_C_HDLC = 0x68 - DLT_C_HDLC_WITH_DIR = 0xcd - DLT_DBUS = 0xe7 - DLT_DECT = 0xdd - DLT_DOCSIS = 0x8f - DLT_DVB_CI = 0xeb - DLT_ECONET = 0x73 DLT_EN10MB = 0x1 DLT_EN3MB = 0x2 - DLT_ENC = 0x6d - DLT_ERF = 0xc5 - DLT_ERF_ETH = 0xaf - DLT_ERF_POS = 0xb0 - DLT_FC_2 = 0xe0 - DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 DLT_FDDI = 0xa - DLT_FLEXRAY = 0xd2 - DLT_FRELAY = 0x6b - DLT_FRELAY_WITH_DIR = 0xce - DLT_GCOM_SERIAL = 0xad - DLT_GCOM_T1E1 = 0xac - DLT_GPF_F = 0xab - DLT_GPF_T = 0xaa - DLT_GPRS_LLC = 0xa9 - DLT_GSMTAP_ABIS = 0xda - DLT_GSMTAP_UM = 0xd9 - DLT_HHDLC = 0x79 - DLT_IBM_SN = 0x92 - DLT_IBM_SP = 0x91 DLT_IEEE802 = 0x6 DLT_IEEE802_11 = 0x69 DLT_IEEE802_11_RADIO = 0x7f DLT_IEEE802_11_RADIO_AVS = 0xa3 - DLT_IEEE802_15_4 = 0xc3 - DLT_IEEE802_15_4_LINUX = 0xbf - DLT_IEEE802_15_4_NOFCS = 0xe6 - DLT_IEEE802_15_4_NONASK_PHY = 0xd7 - DLT_IEEE802_16_MAC_CPS = 0xbc - DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 - DLT_IPFILTER = 0x74 - DLT_IPMB = 0xc7 - DLT_IPMB_LINUX = 0xd1 - DLT_IPNET = 0xe2 - DLT_IPOIB = 0xf2 - DLT_IPV4 = 0xe4 - DLT_IPV6 = 0xe5 - DLT_IP_OVER_FC = 0x7a - DLT_JUNIPER_ATM1 = 0x89 - DLT_JUNIPER_ATM2 = 0x87 - DLT_JUNIPER_ATM_CEMIC = 0xee - DLT_JUNIPER_CHDLC = 0xb5 - DLT_JUNIPER_ES = 0x84 - DLT_JUNIPER_ETHER = 0xb2 - DLT_JUNIPER_FIBRECHANNEL = 0xea - DLT_JUNIPER_FRELAY = 0xb4 - DLT_JUNIPER_GGSN = 0x85 - DLT_JUNIPER_ISM = 0xc2 - DLT_JUNIPER_MFR = 0x86 - DLT_JUNIPER_MLFR = 0x83 - DLT_JUNIPER_MLPPP = 0x82 - DLT_JUNIPER_MONITOR = 0xa4 - DLT_JUNIPER_PIC_PEER = 0xae - DLT_JUNIPER_PPP = 0xb3 - DLT_JUNIPER_PPPOE = 0xa7 - DLT_JUNIPER_PPPOE_ATM = 0xa8 - DLT_JUNIPER_SERVICES = 0x88 - DLT_JUNIPER_SRX_E2E = 0xe9 - DLT_JUNIPER_ST = 0xc8 - DLT_JUNIPER_VP = 0xb7 - DLT_JUNIPER_VS = 0xe8 - DLT_LAPB_WITH_DIR = 0xcf - DLT_LAPD = 0xcb - DLT_LIN = 0xd4 - DLT_LINUX_EVDEV = 0xd8 - DLT_LINUX_IRDA = 0x90 - DLT_LINUX_LAPD = 0xb1 - DLT_LINUX_PPP_WITHDIRECTION = 0xa6 DLT_LINUX_SLL = 0x71 DLT_LOOP = 0x6c - DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0xf5 - DLT_MATCHING_MIN = 0x68 - DLT_MFR = 0xb6 - DLT_MOST = 0xd3 - DLT_MPEG_2_TS = 0xf3 - DLT_MPLS = 0xdb - DLT_MTP2 = 0x8c - DLT_MTP2_WITH_PHDR = 0x8b - DLT_MTP3 = 0x8d - DLT_MUX27010 = 0xec - DLT_NETANALYZER = 0xf0 - DLT_NETANALYZER_TRANSPARENT = 0xf1 - DLT_NFC_LLCP = 0xf5 - DLT_NFLOG = 0xef - DLT_NG40 = 0xf4 DLT_NULL = 0x0 - DLT_PCI_EXP = 0x7d DLT_PFLOG = 0x75 DLT_PFSYNC = 0x12 - DLT_PPI = 0xc0 DLT_PPP = 0x9 DLT_PPP_BSDOS = 0x10 - DLT_PPP_ETHER = 0x33 - DLT_PPP_PPPD = 0xa6 DLT_PPP_SERIAL = 0x32 - DLT_PPP_WITH_DIR = 0xcc - DLT_PPP_WITH_DIRECTION = 0xa6 - DLT_PRISM_HEADER = 0x77 DLT_PRONET = 0x4 - DLT_RAIF1 = 0xc6 DLT_RAW = 0xc - DLT_RIO = 0x7c - DLT_SCCP = 0x8e - DLT_SITA = 0xc4 DLT_SLIP = 0x8 DLT_SLIP_BSDOS = 0xf - DLT_STANAG_5066_D_PDU = 0xed - DLT_SUNATM = 0x7b - DLT_SYMANTEC_FIREWALL = 0x63 - DLT_TZSP = 0x80 - DLT_USB = 0xba - DLT_USB_LINUX = 0xbd - DLT_USB_LINUX_MMAPPED = 0xdc - DLT_USER0 = 0x93 - DLT_USER1 = 0x94 - DLT_USER10 = 0x9d - DLT_USER11 = 0x9e - DLT_USER12 = 0x9f - DLT_USER13 = 0xa0 - DLT_USER14 = 0xa1 - DLT_USER15 = 0xa2 - DLT_USER2 = 0x95 - DLT_USER3 = 0x96 - DLT_USER4 = 0x97 - DLT_USER5 = 0x98 - DLT_USER6 = 0x99 - DLT_USER7 = 0x9a - DLT_USER8 = 0x9b - DLT_USER9 = 0x9c - DLT_WIHART = 0xdf - DLT_X2E_SERIAL = 0xd5 - DLT_X2E_XORAYA = 0xd6 DT_BLK = 0x6 DT_CHR = 0x2 DT_DIR = 0x4 @@ -337,8 +198,8 @@ const ( EVFILT_PROC = -0x5 EVFILT_READ = -0x1 EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0xe - EVFILT_THREADMARKER = 0xe + EVFILT_SYSCOUNT = 0xc + EVFILT_THREADMARKER = 0xc EVFILT_TIMER = -0x7 EVFILT_USER = -0xa EVFILT_VM = -0xc @@ -372,11 +233,9 @@ const ( F_CHKCLEAN = 0x29 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x43 - F_FINDSIGS = 0x4e F_FLUSH_DATA = 0x28 F_FREEZE_FS = 0x35 F_FULLFSYNC = 0x33 - F_GETCODEDIR = 0x48 F_GETFD = 0x1 F_GETFL = 0x3 F_GETLK = 0x7 @@ -386,10 +245,10 @@ const ( F_GETPATH = 0x32 F_GETPATH_MTMINFO = 0x47 F_GETPROTECTIONCLASS = 0x3f - F_GETPROTECTIONLEVEL = 0x4d F_GLOBAL_NOCACHE = 0x37 F_LOG2PHYS = 0x31 F_LOG2PHYS_EXT = 0x41 + F_MARKDEPENDENCY = 0x3c F_NOCACHE = 0x30 F_NODIRECT = 0x3e F_OK = 0x0 @@ -399,21 +258,20 @@ const ( F_RDADVISE = 0x2c F_RDAHEAD = 0x2d F_RDLCK = 0x1 + F_READBOOTSTRAP = 0x2e F_SETBACKINGSTORE = 0x46 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLK = 0x8 F_SETLKW = 0x9 - F_SETLKWTIMEOUT = 0xa F_SETNOSIGPIPE = 0x49 F_SETOWN = 0x6 F_SETPROTECTIONCLASS = 0x40 F_SETSIZE = 0x2b - F_SINGLE_WRITER = 0x4c F_THAW_FS = 0x36 - F_TRANSCODEKEY = 0x4b F_UNLCK = 0x2 F_VOLPOSMODE = 0x4 + F_WRITEBOOTSTRAP = 0x2f F_WRLCK = 0x3 HUPCL = 0x4000 ICANON = 0x100 @@ -483,7 +341,6 @@ const ( IFT_PDP = 0xff IFT_PFLOG = 0xf5 IFT_PFSYNC = 0xf6 - IFT_PKTAP = 0xfe IFT_PPP = 0x17 IFT_PROPMUX = 0x36 IFT_PROPVIRTUAL = 0x35 @@ -652,7 +509,7 @@ const ( IPV6_FAITH = 0x1d IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWLABEL_MASK = 0xffff0f00 - IPV6_FRAGTTL = 0x3c + IPV6_FRAGTTL = 0x78 IPV6_FW_ADD = 0x1e IPV6_FW_DEL = 0x1f IPV6_FW_FLUSH = 0x20 @@ -822,19 +679,11 @@ const ( NOFLSH = 0x80000000 NOTE_ABSOLUTE = 0x8 NOTE_ATTRIB = 0x8 - NOTE_BACKGROUND = 0x40 NOTE_CHILD = 0x4 - NOTE_CRITICAL = 0x20 NOTE_DELETE = 0x1 NOTE_EXEC = 0x20000000 NOTE_EXIT = 0x80000000 NOTE_EXITSTATUS = 0x4000000 - NOTE_EXIT_CSERROR = 0x40000 - NOTE_EXIT_DECRYPTFAIL = 0x10000 - NOTE_EXIT_DETAIL = 0x2000000 - NOTE_EXIT_DETAIL_MASK = 0x70000 - NOTE_EXIT_MEMORY = 0x20000 - NOTE_EXIT_REPARENTED = 0x80000 NOTE_EXTEND = 0x4 NOTE_FFAND = 0x40000000 NOTE_FFCOPY = 0xc0000000 @@ -843,7 +692,6 @@ const ( NOTE_FFNOP = 0x0 NOTE_FFOR = 0x80000000 NOTE_FORK = 0x40000000 - NOTE_LEEWAY = 0x10 NOTE_LINK = 0x10 NOTE_LOWAT = 0x1 NOTE_NONE = 0x80 @@ -852,6 +700,7 @@ const ( NOTE_PDATAMASK = 0xfffff NOTE_REAP = 0x10000000 NOTE_RENAME = 0x20 + NOTE_RESOURCEEND = 0x2000000 NOTE_REVOKE = 0x40 NOTE_SECONDS = 0x1 NOTE_SIGNAL = 0x8000000 @@ -879,7 +728,6 @@ const ( O_CLOEXEC = 0x1000000 O_CREAT = 0x200 O_DIRECTORY = 0x100000 - O_DP_GETRAWENCRYPTED = 0x1 O_DSYNC = 0x400000 O_EVTONLY = 0x8000 O_EXCL = 0x800 @@ -929,7 +777,6 @@ const ( RLIMIT_AS = 0x5 RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 - RLIMIT_CPU_USAGE_MONITOR = 0x2 RLIMIT_DATA = 0x2 RLIMIT_FSIZE = 0x1 RLIMIT_NOFILE = 0x8 @@ -967,15 +814,12 @@ const ( RTF_LOCAL = 0x200000 RTF_MODIFIED = 0x20 RTF_MULTICAST = 0x800000 - RTF_NOIFREF = 0x2000 RTF_PINNED = 0x100000 RTF_PRCLONING = 0x10000 RTF_PROTO1 = 0x8000 RTF_PROTO2 = 0x4000 RTF_PROTO3 = 0x40000 - RTF_PROXY = 0x8000000 RTF_REJECT = 0x8 - RTF_ROUTER = 0x10000000 RTF_STATIC = 0x800 RTF_UP = 0x1 RTF_WASCLONED = 0x20000 @@ -1020,6 +864,7 @@ const ( SHUT_WR = 0x1 SIOCADDMULTI = 0x80206931 SIOCAIFADDR = 0x8040691a + SIOCALIFADDR = 0x8118691d SIOCARPIPLL = 0xc0206928 SIOCATMARK = 0x40047307 SIOCAUTOADDR = 0xc0206926 @@ -1027,7 +872,10 @@ const ( SIOCDELMULTI = 0x80206932 SIOCDIFADDR = 0x80206919 SIOCDIFPHYADDR = 0x80206941 + SIOCDLIFADDR = 0x8118691f SIOCGDRVSPEC = 0xc01c697b + SIOCGETSGCNT = 0xc014721c + SIOCGETVIFCNT = 0xc014721b SIOCGETVLAN = 0xc020697f SIOCGHIWAT = 0x40047301 SIOCGIFADDR = 0xc0206921 @@ -1053,12 +901,13 @@ const ( SIOCGIFSTATUS = 0xc331693d SIOCGIFVLAN = 0xc020697f SIOCGIFWAKEFLAGS = 0xc0206988 + SIOCGLIFADDR = 0xc118691e + SIOCGLIFPHYADDR = 0xc1186943 SIOCGLOWAT = 0x40047303 SIOCGPGRP = 0x40047309 SIOCIFCREATE = 0xc0206978 SIOCIFCREATE2 = 0xc020697a SIOCIFDESTROY = 0x80206979 - SIOCIFGCLONERS = 0xc00c6981 SIOCRSLVMULTI = 0xc008693b SIOCSDRVSPEC = 0x801c697b SIOCSETVLAN = 0x8020697e @@ -1082,6 +931,7 @@ const ( SIOCSIFPHYADDR = 0x8040693e SIOCSIFPHYS = 0x80206936 SIOCSIFVLAN = 0x8020697e + SIOCSLIFPHYADDR = 0x81186942 SIOCSLOWAT = 0x80047302 SIOCSPGRP = 0x80047308 SOCK_DGRAM = 0x2 @@ -1108,7 +958,6 @@ const ( SO_NOTIFYCONFLICT = 0x1026 SO_NP_EXTENSIONS = 0x1083 SO_NREAD = 0x1020 - SO_NUMRCVPKT = 0x1112 SO_NWRITE = 0x1024 SO_OOBINLINE = 0x100 SO_PEERLABEL = 0x1011 @@ -1116,6 +965,10 @@ const ( SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 + SO_RESTRICTIONS = 0x1081 + SO_RESTRICT_DENYIN = 0x1 + SO_RESTRICT_DENYOUT = 0x2 + SO_RESTRICT_DENYSET = 0x80000000 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_REUSESHAREUID = 0x1025 @@ -1161,25 +1014,21 @@ const ( TCIOFLUSH = 0x3 TCOFLUSH = 0x2 TCP_CONNECTIONTIMEOUT = 0x20 - TCP_ENABLE_ECN = 0x104 TCP_KEEPALIVE = 0x10 - TCP_KEEPCNT = 0x102 - TCP_KEEPINTVL = 0x101 TCP_MAXHLEN = 0x3c TCP_MAXOLEN = 0x28 TCP_MAXSEG = 0x2 TCP_MAXWIN = 0xffff - TCP_MAX_SACK = 0x4 + TCP_MAX_SACK = 0x3 TCP_MAX_WINSHIFT = 0xe TCP_MINMSS = 0xd8 + TCP_MINMSSOVERLOAD = 0x3e8 TCP_MSS = 0x200 TCP_NODELAY = 0x1 TCP_NOOPT = 0x8 TCP_NOPUSH = 0x4 - TCP_NOTSENT_LOWAT = 0x201 TCP_RXT_CONNDROPTIME = 0x80 TCP_RXT_FINDROP = 0x100 - TCP_SENDMOREACKS = 0x103 TCSAFLUSH = 0x2 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 @@ -1323,7 +1172,7 @@ const ( EIO = syscall.Errno(0x5) EISCONN = syscall.Errno(0x38) EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x6a) + ELAST = syscall.Errno(0x69) ELOOP = syscall.Errno(0x3e) EMFILE = syscall.Errno(0x18) EMLINK = syscall.Errno(0x1f) @@ -1374,7 +1223,6 @@ const ( EPROTONOSUPPORT = syscall.Errno(0x2b) EPROTOTYPE = syscall.Errno(0x29) EPWROFF = syscall.Errno(0x52) - EQFULL = syscall.Errno(0x6a) ERANGE = syscall.Errno(0x22) EREMOTE = syscall.Errno(0x47) EROFS = syscall.Errno(0x1e) @@ -1537,7 +1385,6 @@ var errors = [...]string{ 103: "policy not found", 104: "state not recoverable", 105: "previous owner died", - 106: "interface output queue is full", } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index 9594f93817..095b6f3a5c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -1,8 +1,6 @@ // mkerrors.sh -m64 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build amd64,darwin - // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -m64 _const.go @@ -376,7 +374,6 @@ const ( F_FLUSH_DATA = 0x28 F_FREEZE_FS = 0x35 F_FULLFSYNC = 0x33 - F_GETCODEDIR = 0x48 F_GETFD = 0x1 F_GETFL = 0x3 F_GETLK = 0x7 @@ -1020,6 +1017,7 @@ const ( SHUT_WR = 0x1 SIOCADDMULTI = 0x80206931 SIOCAIFADDR = 0x8040691a + SIOCALIFADDR = 0x8118691d SIOCARPIPLL = 0xc0206928 SIOCATMARK = 0x40047307 SIOCAUTOADDR = 0xc0206926 @@ -1027,7 +1025,10 @@ const ( SIOCDELMULTI = 0x80206932 SIOCDIFADDR = 0x80206919 SIOCDIFPHYADDR = 0x80206941 + SIOCDLIFADDR = 0x8118691f SIOCGDRVSPEC = 0xc028697b + SIOCGETSGCNT = 0xc014721c + SIOCGETVIFCNT = 0xc014721b SIOCGETVLAN = 0xc020697f SIOCGHIWAT = 0x40047301 SIOCGIFADDR = 0xc0206921 @@ -1053,6 +1054,8 @@ const ( SIOCGIFSTATUS = 0xc331693d SIOCGIFVLAN = 0xc020697f SIOCGIFWAKEFLAGS = 0xc0206988 + SIOCGLIFADDR = 0xc118691e + SIOCGLIFPHYADDR = 0xc1186943 SIOCGLOWAT = 0x40047303 SIOCGPGRP = 0x40047309 SIOCIFCREATE = 0xc0206978 @@ -1082,6 +1085,7 @@ const ( SIOCSIFPHYADDR = 0x8040693e SIOCSIFPHYS = 0x80206936 SIOCSIFVLAN = 0x8020697e + SIOCSLIFPHYADDR = 0x81186942 SIOCSLOWAT = 0x80047302 SIOCSPGRP = 0x80047308 SOCK_DGRAM = 0x2 @@ -1108,7 +1112,6 @@ const ( SO_NOTIFYCONFLICT = 0x1026 SO_NP_EXTENSIONS = 0x1083 SO_NREAD = 0x1020 - SO_NUMRCVPKT = 0x1112 SO_NWRITE = 0x1024 SO_OOBINLINE = 0x100 SO_PEERLABEL = 0x1011 @@ -1161,7 +1164,6 @@ const ( TCIOFLUSH = 0x3 TCOFLUSH = 0x2 TCP_CONNECTIONTIMEOUT = 0x20 - TCP_ENABLE_ECN = 0x104 TCP_KEEPALIVE = 0x10 TCP_KEEPCNT = 0x102 TCP_KEEPINTVL = 0x101 @@ -1169,14 +1171,13 @@ const ( TCP_MAXOLEN = 0x28 TCP_MAXSEG = 0x2 TCP_MAXWIN = 0xffff - TCP_MAX_SACK = 0x4 + TCP_MAX_SACK = 0x3 TCP_MAX_WINSHIFT = 0xe TCP_MINMSS = 0xd8 TCP_MSS = 0x200 TCP_NODELAY = 0x1 TCP_NOOPT = 0x8 TCP_NOPUSH = 0x4 - TCP_NOTSENT_LOWAT = 0x201 TCP_RXT_CONNDROPTIME = 0x80 TCP_RXT_FINDROP = 0x100 TCP_SENDMOREACKS = 0x103 diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go deleted file mode 100644 index a410e88edd..0000000000 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go +++ /dev/null @@ -1,1293 +0,0 @@ -// mkerrors.sh -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs -- _const.go - -// +build arm,darwin - -package unix - -import "syscall" - -const ( - AF_APPLETALK = 0x10 - AF_CCITT = 0xa - AF_CHAOS = 0x5 - AF_CNT = 0x15 - AF_COIP = 0x14 - AF_DATAKIT = 0x9 - AF_DECnet = 0xc - AF_DLI = 0xd - AF_E164 = 0x1c - AF_ECMA = 0x8 - AF_HYLINK = 0xf - AF_IEEE80211 = 0x25 - AF_IMPLINK = 0x3 - AF_INET = 0x2 - AF_INET6 = 0x1e - AF_IPX = 0x17 - AF_ISDN = 0x1c - AF_ISO = 0x7 - AF_LAT = 0xe - AF_LINK = 0x12 - AF_LOCAL = 0x1 - AF_MAX = 0x28 - AF_NATM = 0x1f - AF_NDRV = 0x1b - AF_NETBIOS = 0x21 - AF_NS = 0x6 - AF_OSI = 0x7 - AF_PPP = 0x22 - AF_PUP = 0x4 - AF_RESERVED_36 = 0x24 - AF_ROUTE = 0x11 - AF_SIP = 0x18 - AF_SNA = 0xb - AF_SYSTEM = 0x20 - AF_UNIX = 0x1 - AF_UNSPEC = 0x0 - AF_UTUN = 0x26 - B0 = 0x0 - B110 = 0x6e - B115200 = 0x1c200 - B1200 = 0x4b0 - B134 = 0x86 - B14400 = 0x3840 - B150 = 0x96 - B1800 = 0x708 - B19200 = 0x4b00 - B200 = 0xc8 - B230400 = 0x38400 - B2400 = 0x960 - B28800 = 0x7080 - B300 = 0x12c - B38400 = 0x9600 - B4800 = 0x12c0 - B50 = 0x32 - B57600 = 0xe100 - B600 = 0x258 - B7200 = 0x1c20 - B75 = 0x4b - B76800 = 0x12c00 - B9600 = 0x2580 - BIOCFLUSH = 0x20004268 - BIOCGBLEN = 0x40044266 - BIOCGDLT = 0x4004426a - BIOCGDLTLIST = 0xc00c4279 - BIOCGETIF = 0x4020426b - BIOCGHDRCMPLT = 0x40044274 - BIOCGRSIG = 0x40044272 - BIOCGRTIMEOUT = 0x4010426e - BIOCGSEESENT = 0x40044276 - BIOCGSTATS = 0x4008426f - BIOCIMMEDIATE = 0x80044270 - BIOCPROMISC = 0x20004269 - BIOCSBLEN = 0xc0044266 - BIOCSDLT = 0x80044278 - BIOCSETF = 0x80104267 - BIOCSETIF = 0x8020426c - BIOCSHDRCMPLT = 0x80044275 - BIOCSRSIG = 0x80044273 - BIOCSRTIMEOUT = 0x8010426d - BIOCSSEESENT = 0x80044277 - BIOCVERSION = 0x40044271 - BPF_A = 0x10 - BPF_ABS = 0x20 - BPF_ADD = 0x0 - BPF_ALIGNMENT = 0x4 - BPF_ALU = 0x4 - BPF_AND = 0x50 - BPF_B = 0x10 - BPF_DIV = 0x30 - BPF_H = 0x8 - BPF_IMM = 0x0 - BPF_IND = 0x40 - BPF_JA = 0x0 - BPF_JEQ = 0x10 - BPF_JGE = 0x30 - BPF_JGT = 0x20 - BPF_JMP = 0x5 - BPF_JSET = 0x40 - BPF_K = 0x0 - BPF_LD = 0x0 - BPF_LDX = 0x1 - BPF_LEN = 0x80 - BPF_LSH = 0x60 - BPF_MAJOR_VERSION = 0x1 - BPF_MAXBUFSIZE = 0x80000 - BPF_MAXINSNS = 0x200 - BPF_MEM = 0x60 - BPF_MEMWORDS = 0x10 - BPF_MINBUFSIZE = 0x20 - BPF_MINOR_VERSION = 0x1 - BPF_MISC = 0x7 - BPF_MSH = 0xa0 - BPF_MUL = 0x20 - BPF_NEG = 0x80 - BPF_OR = 0x40 - BPF_RELEASE = 0x30bb6 - BPF_RET = 0x6 - BPF_RSH = 0x70 - BPF_ST = 0x2 - BPF_STX = 0x3 - BPF_SUB = 0x10 - BPF_TAX = 0x0 - BPF_TXA = 0x80 - BPF_W = 0x0 - BPF_X = 0x8 - BRKINT = 0x2 - CFLUSH = 0xf - CLOCAL = 0x8000 - CREAD = 0x800 - CS5 = 0x0 - CS6 = 0x100 - CS7 = 0x200 - CS8 = 0x300 - CSIZE = 0x300 - CSTART = 0x11 - CSTATUS = 0x14 - CSTOP = 0x13 - CSTOPB = 0x400 - CSUSP = 0x1a - CTL_MAXNAME = 0xc - CTL_NET = 0x4 - DLT_APPLE_IP_OVER_IEEE1394 = 0x8a - DLT_ARCNET = 0x7 - DLT_ATM_CLIP = 0x13 - DLT_ATM_RFC1483 = 0xb - DLT_AX25 = 0x3 - DLT_CHAOS = 0x5 - DLT_CHDLC = 0x68 - DLT_C_HDLC = 0x68 - DLT_EN10MB = 0x1 - DLT_EN3MB = 0x2 - DLT_FDDI = 0xa - DLT_IEEE802 = 0x6 - DLT_IEEE802_11 = 0x69 - DLT_IEEE802_11_RADIO = 0x7f - DLT_IEEE802_11_RADIO_AVS = 0xa3 - DLT_LINUX_SLL = 0x71 - DLT_LOOP = 0x6c - DLT_NULL = 0x0 - DLT_PFLOG = 0x75 - DLT_PFSYNC = 0x12 - DLT_PPP = 0x9 - DLT_PPP_BSDOS = 0x10 - DLT_PPP_SERIAL = 0x32 - DLT_PRONET = 0x4 - DLT_RAW = 0xc - DLT_SLIP = 0x8 - DLT_SLIP_BSDOS = 0xf - DT_BLK = 0x6 - DT_CHR = 0x2 - DT_DIR = 0x4 - DT_FIFO = 0x1 - DT_LNK = 0xa - DT_REG = 0x8 - DT_SOCK = 0xc - DT_UNKNOWN = 0x0 - DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x40 - ECHOE = 0x2 - ECHOK = 0x4 - ECHOKE = 0x1 - ECHONL = 0x10 - ECHOPRT = 0x20 - EVFILT_AIO = -0x3 - EVFILT_FS = -0x9 - EVFILT_MACHPORT = -0x8 - EVFILT_PROC = -0x5 - EVFILT_READ = -0x1 - EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0xe - EVFILT_THREADMARKER = 0xe - EVFILT_TIMER = -0x7 - EVFILT_USER = -0xa - EVFILT_VM = -0xc - EVFILT_VNODE = -0x4 - EVFILT_WRITE = -0x2 - EV_ADD = 0x1 - EV_CLEAR = 0x20 - EV_DELETE = 0x2 - EV_DISABLE = 0x8 - EV_DISPATCH = 0x80 - EV_ENABLE = 0x4 - EV_EOF = 0x8000 - EV_ERROR = 0x4000 - EV_FLAG0 = 0x1000 - EV_FLAG1 = 0x2000 - EV_ONESHOT = 0x10 - EV_OOBAND = 0x2000 - EV_POLL = 0x1000 - EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf000 - EXTA = 0x4b00 - EXTB = 0x9600 - EXTPROC = 0x800 - FD_CLOEXEC = 0x1 - FD_SETSIZE = 0x400 - FLUSHO = 0x800000 - F_ADDFILESIGS = 0x3d - F_ADDSIGS = 0x3b - F_ALLOCATEALL = 0x4 - F_ALLOCATECONTIG = 0x2 - F_CHKCLEAN = 0x29 - F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0x43 - F_FINDSIGS = 0x4e - F_FLUSH_DATA = 0x28 - F_FREEZE_FS = 0x35 - F_FULLFSYNC = 0x33 - F_GETCODEDIR = 0x48 - F_GETFD = 0x1 - F_GETFL = 0x3 - F_GETLK = 0x7 - F_GETLKPID = 0x42 - F_GETNOSIGPIPE = 0x4a - F_GETOWN = 0x5 - F_GETPATH = 0x32 - F_GETPATH_MTMINFO = 0x47 - F_GETPROTECTIONCLASS = 0x3f - F_GETPROTECTIONLEVEL = 0x4d - F_GLOBAL_NOCACHE = 0x37 - F_LOG2PHYS = 0x31 - F_LOG2PHYS_EXT = 0x41 - F_NOCACHE = 0x30 - F_NODIRECT = 0x3e - F_OK = 0x0 - F_PATHPKG_CHECK = 0x34 - F_PEOFPOSMODE = 0x3 - F_PREALLOCATE = 0x2a - F_RDADVISE = 0x2c - F_RDAHEAD = 0x2d - F_RDLCK = 0x1 - F_SETBACKINGSTORE = 0x46 - F_SETFD = 0x2 - F_SETFL = 0x4 - F_SETLK = 0x8 - F_SETLKW = 0x9 - F_SETLKWTIMEOUT = 0xa - F_SETNOSIGPIPE = 0x49 - F_SETOWN = 0x6 - F_SETPROTECTIONCLASS = 0x40 - F_SETSIZE = 0x2b - F_SINGLE_WRITER = 0x4c - F_THAW_FS = 0x36 - F_TRANSCODEKEY = 0x4b - F_UNLCK = 0x2 - F_VOLPOSMODE = 0x4 - F_WRLCK = 0x3 - HUPCL = 0x4000 - ICANON = 0x100 - ICMP6_FILTER = 0x12 - ICRNL = 0x100 - IEXTEN = 0x400 - IFF_ALLMULTI = 0x200 - IFF_ALTPHYS = 0x4000 - IFF_BROADCAST = 0x2 - IFF_DEBUG = 0x4 - IFF_LINK0 = 0x1000 - IFF_LINK1 = 0x2000 - IFF_LINK2 = 0x4000 - IFF_LOOPBACK = 0x8 - IFF_MULTICAST = 0x8000 - IFF_NOARP = 0x80 - IFF_NOTRAILERS = 0x20 - IFF_OACTIVE = 0x400 - IFF_POINTOPOINT = 0x10 - IFF_PROMISC = 0x100 - IFF_RUNNING = 0x40 - IFF_SIMPLEX = 0x800 - IFF_UP = 0x1 - IFNAMSIZ = 0x10 - IFT_1822 = 0x2 - IFT_AAL5 = 0x31 - IFT_ARCNET = 0x23 - IFT_ARCNETPLUS = 0x24 - IFT_ATM = 0x25 - IFT_BRIDGE = 0xd1 - IFT_CARP = 0xf8 - IFT_CELLULAR = 0xff - IFT_CEPT = 0x13 - IFT_DS3 = 0x1e - IFT_ENC = 0xf4 - IFT_EON = 0x19 - IFT_ETHER = 0x6 - IFT_FAITH = 0x38 - IFT_FDDI = 0xf - IFT_FRELAY = 0x20 - IFT_FRELAYDCE = 0x2c - IFT_GIF = 0x37 - IFT_HDH1822 = 0x3 - IFT_HIPPI = 0x2f - IFT_HSSI = 0x2e - IFT_HY = 0xe - IFT_IEEE1394 = 0x90 - IFT_IEEE8023ADLAG = 0x88 - IFT_ISDNBASIC = 0x14 - IFT_ISDNPRIMARY = 0x15 - IFT_ISO88022LLC = 0x29 - IFT_ISO88023 = 0x7 - IFT_ISO88024 = 0x8 - IFT_ISO88025 = 0x9 - IFT_ISO88026 = 0xa - IFT_L2VLAN = 0x87 - IFT_LAPB = 0x10 - IFT_LOCALTALK = 0x2a - IFT_LOOP = 0x18 - IFT_MIOX25 = 0x26 - IFT_MODEM = 0x30 - IFT_NSIP = 0x1b - IFT_OTHER = 0x1 - IFT_P10 = 0xc - IFT_P80 = 0xd - IFT_PARA = 0x22 - IFT_PDP = 0xff - IFT_PFLOG = 0xf5 - IFT_PFSYNC = 0xf6 - IFT_PPP = 0x17 - IFT_PROPMUX = 0x36 - IFT_PROPVIRTUAL = 0x35 - IFT_PTPSERIAL = 0x16 - IFT_RS232 = 0x21 - IFT_SDLC = 0x11 - IFT_SIP = 0x1f - IFT_SLIP = 0x1c - IFT_SMDSDXI = 0x2b - IFT_SMDSICIP = 0x34 - IFT_SONET = 0x27 - IFT_SONETPATH = 0x32 - IFT_SONETVT = 0x33 - IFT_STARLAN = 0xb - IFT_STF = 0x39 - IFT_T1 = 0x12 - IFT_ULTRA = 0x1d - IFT_V35 = 0x2d - IFT_X25 = 0x5 - IFT_X25DDN = 0x4 - IFT_X25PLE = 0x28 - IFT_XETHER = 0x1a - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 - IN_CLASSA_HOST = 0xffffff - IN_CLASSA_MAX = 0x80 - IN_CLASSA_NET = 0xff000000 - IN_CLASSA_NSHIFT = 0x18 - IN_CLASSB_HOST = 0xffff - IN_CLASSB_MAX = 0x10000 - IN_CLASSB_NET = 0xffff0000 - IN_CLASSB_NSHIFT = 0x10 - IN_CLASSC_HOST = 0xff - IN_CLASSC_NET = 0xffffff00 - IN_CLASSC_NSHIFT = 0x8 - IN_CLASSD_HOST = 0xfffffff - IN_CLASSD_NET = 0xf0000000 - IN_CLASSD_NSHIFT = 0x1c - IN_LINKLOCALNETNUM = 0xa9fe0000 - IN_LOOPBACKNET = 0x7f - IPPROTO_3PC = 0x22 - IPPROTO_ADFS = 0x44 - IPPROTO_AH = 0x33 - IPPROTO_AHIP = 0x3d - IPPROTO_APES = 0x63 - IPPROTO_ARGUS = 0xd - IPPROTO_AX25 = 0x5d - IPPROTO_BHA = 0x31 - IPPROTO_BLT = 0x1e - IPPROTO_BRSATMON = 0x4c - IPPROTO_CFTP = 0x3e - IPPROTO_CHAOS = 0x10 - IPPROTO_CMTP = 0x26 - IPPROTO_CPHB = 0x49 - IPPROTO_CPNX = 0x48 - IPPROTO_DDP = 0x25 - IPPROTO_DGP = 0x56 - IPPROTO_DIVERT = 0xfe - IPPROTO_DONE = 0x101 - IPPROTO_DSTOPTS = 0x3c - IPPROTO_EGP = 0x8 - IPPROTO_EMCON = 0xe - IPPROTO_ENCAP = 0x62 - IPPROTO_EON = 0x50 - IPPROTO_ESP = 0x32 - IPPROTO_ETHERIP = 0x61 - IPPROTO_FRAGMENT = 0x2c - IPPROTO_GGP = 0x3 - IPPROTO_GMTP = 0x64 - IPPROTO_GRE = 0x2f - IPPROTO_HELLO = 0x3f - IPPROTO_HMP = 0x14 - IPPROTO_HOPOPTS = 0x0 - IPPROTO_ICMP = 0x1 - IPPROTO_ICMPV6 = 0x3a - IPPROTO_IDP = 0x16 - IPPROTO_IDPR = 0x23 - IPPROTO_IDRP = 0x2d - IPPROTO_IGMP = 0x2 - IPPROTO_IGP = 0x55 - IPPROTO_IGRP = 0x58 - IPPROTO_IL = 0x28 - IPPROTO_INLSP = 0x34 - IPPROTO_INP = 0x20 - IPPROTO_IP = 0x0 - IPPROTO_IPCOMP = 0x6c - IPPROTO_IPCV = 0x47 - IPPROTO_IPEIP = 0x5e - IPPROTO_IPIP = 0x4 - IPPROTO_IPPC = 0x43 - IPPROTO_IPV4 = 0x4 - IPPROTO_IPV6 = 0x29 - IPPROTO_IRTP = 0x1c - IPPROTO_KRYPTOLAN = 0x41 - IPPROTO_LARP = 0x5b - IPPROTO_LEAF1 = 0x19 - IPPROTO_LEAF2 = 0x1a - IPPROTO_MAX = 0x100 - IPPROTO_MAXID = 0x34 - IPPROTO_MEAS = 0x13 - IPPROTO_MHRP = 0x30 - IPPROTO_MICP = 0x5f - IPPROTO_MTP = 0x5c - IPPROTO_MUX = 0x12 - IPPROTO_ND = 0x4d - IPPROTO_NHRP = 0x36 - IPPROTO_NONE = 0x3b - IPPROTO_NSP = 0x1f - IPPROTO_NVPII = 0xb - IPPROTO_OSPFIGP = 0x59 - IPPROTO_PGM = 0x71 - IPPROTO_PIGP = 0x9 - IPPROTO_PIM = 0x67 - IPPROTO_PRM = 0x15 - IPPROTO_PUP = 0xc - IPPROTO_PVP = 0x4b - IPPROTO_RAW = 0xff - IPPROTO_RCCMON = 0xa - IPPROTO_RDP = 0x1b - IPPROTO_ROUTING = 0x2b - IPPROTO_RSVP = 0x2e - IPPROTO_RVD = 0x42 - IPPROTO_SATEXPAK = 0x40 - IPPROTO_SATMON = 0x45 - IPPROTO_SCCSP = 0x60 - IPPROTO_SCTP = 0x84 - IPPROTO_SDRP = 0x2a - IPPROTO_SEP = 0x21 - IPPROTO_SRPC = 0x5a - IPPROTO_ST = 0x7 - IPPROTO_SVMTP = 0x52 - IPPROTO_SWIPE = 0x35 - IPPROTO_TCF = 0x57 - IPPROTO_TCP = 0x6 - IPPROTO_TP = 0x1d - IPPROTO_TPXX = 0x27 - IPPROTO_TRUNK1 = 0x17 - IPPROTO_TRUNK2 = 0x18 - IPPROTO_TTP = 0x54 - IPPROTO_UDP = 0x11 - IPPROTO_VINES = 0x53 - IPPROTO_VISA = 0x46 - IPPROTO_VMTP = 0x51 - IPPROTO_WBEXPAK = 0x4f - IPPROTO_WBMON = 0x4e - IPPROTO_WSN = 0x4a - IPPROTO_XNET = 0xf - IPPROTO_XTP = 0x24 - IPV6_2292DSTOPTS = 0x17 - IPV6_2292HOPLIMIT = 0x14 - IPV6_2292HOPOPTS = 0x16 - IPV6_2292NEXTHOP = 0x15 - IPV6_2292PKTINFO = 0x13 - IPV6_2292PKTOPTIONS = 0x19 - IPV6_2292RTHDR = 0x18 - IPV6_BINDV6ONLY = 0x1b - IPV6_BOUND_IF = 0x7d - IPV6_CHECKSUM = 0x1a - IPV6_DEFAULT_MULTICAST_HOPS = 0x1 - IPV6_DEFAULT_MULTICAST_LOOP = 0x1 - IPV6_DEFHLIM = 0x40 - IPV6_FAITH = 0x1d - IPV6_FLOWINFO_MASK = 0xffffff0f - IPV6_FLOWLABEL_MASK = 0xffff0f00 - IPV6_FRAGTTL = 0x78 - IPV6_FW_ADD = 0x1e - IPV6_FW_DEL = 0x1f - IPV6_FW_FLUSH = 0x20 - IPV6_FW_GET = 0x22 - IPV6_FW_ZERO = 0x21 - IPV6_HLIMDEC = 0x1 - IPV6_IPSEC_POLICY = 0x1c - IPV6_JOIN_GROUP = 0xc - IPV6_LEAVE_GROUP = 0xd - IPV6_MAXHLIM = 0xff - IPV6_MAXOPTHDR = 0x800 - IPV6_MAXPACKET = 0xffff - IPV6_MAX_GROUP_SRC_FILTER = 0x200 - IPV6_MAX_MEMBERSHIPS = 0xfff - IPV6_MAX_SOCK_SRC_FILTER = 0x80 - IPV6_MIN_MEMBERSHIPS = 0x1f - IPV6_MMTU = 0x500 - IPV6_MULTICAST_HOPS = 0xa - IPV6_MULTICAST_IF = 0x9 - IPV6_MULTICAST_LOOP = 0xb - IPV6_PORTRANGE = 0xe - IPV6_PORTRANGE_DEFAULT = 0x0 - IPV6_PORTRANGE_HIGH = 0x1 - IPV6_PORTRANGE_LOW = 0x2 - IPV6_RECVTCLASS = 0x23 - IPV6_RTHDR_LOOSE = 0x0 - IPV6_RTHDR_STRICT = 0x1 - IPV6_RTHDR_TYPE_0 = 0x0 - IPV6_SOCKOPT_RESERVED1 = 0x3 - IPV6_TCLASS = 0x24 - IPV6_UNICAST_HOPS = 0x4 - IPV6_V6ONLY = 0x1b - IPV6_VERSION = 0x60 - IPV6_VERSION_MASK = 0xf0 - IP_ADD_MEMBERSHIP = 0xc - IP_ADD_SOURCE_MEMBERSHIP = 0x46 - IP_BLOCK_SOURCE = 0x48 - IP_BOUND_IF = 0x19 - IP_DEFAULT_MULTICAST_LOOP = 0x1 - IP_DEFAULT_MULTICAST_TTL = 0x1 - IP_DF = 0x4000 - IP_DROP_MEMBERSHIP = 0xd - IP_DROP_SOURCE_MEMBERSHIP = 0x47 - IP_DUMMYNET_CONFIGURE = 0x3c - IP_DUMMYNET_DEL = 0x3d - IP_DUMMYNET_FLUSH = 0x3e - IP_DUMMYNET_GET = 0x40 - IP_FAITH = 0x16 - IP_FW_ADD = 0x28 - IP_FW_DEL = 0x29 - IP_FW_FLUSH = 0x2a - IP_FW_GET = 0x2c - IP_FW_RESETLOG = 0x2d - IP_FW_ZERO = 0x2b - IP_HDRINCL = 0x2 - IP_IPSEC_POLICY = 0x15 - IP_MAXPACKET = 0xffff - IP_MAX_GROUP_SRC_FILTER = 0x200 - IP_MAX_MEMBERSHIPS = 0xfff - IP_MAX_SOCK_MUTE_FILTER = 0x80 - IP_MAX_SOCK_SRC_FILTER = 0x80 - IP_MF = 0x2000 - IP_MIN_MEMBERSHIPS = 0x1f - IP_MSFILTER = 0x4a - IP_MSS = 0x240 - IP_MULTICAST_IF = 0x9 - IP_MULTICAST_IFINDEX = 0x42 - IP_MULTICAST_LOOP = 0xb - IP_MULTICAST_TTL = 0xa - IP_MULTICAST_VIF = 0xe - IP_NAT__XXX = 0x37 - IP_OFFMASK = 0x1fff - IP_OLD_FW_ADD = 0x32 - IP_OLD_FW_DEL = 0x33 - IP_OLD_FW_FLUSH = 0x34 - IP_OLD_FW_GET = 0x36 - IP_OLD_FW_RESETLOG = 0x38 - IP_OLD_FW_ZERO = 0x35 - IP_OPTIONS = 0x1 - IP_PKTINFO = 0x1a - IP_PORTRANGE = 0x13 - IP_PORTRANGE_DEFAULT = 0x0 - IP_PORTRANGE_HIGH = 0x1 - IP_PORTRANGE_LOW = 0x2 - IP_RECVDSTADDR = 0x7 - IP_RECVIF = 0x14 - IP_RECVOPTS = 0x5 - IP_RECVPKTINFO = 0x1a - IP_RECVRETOPTS = 0x6 - IP_RECVTTL = 0x18 - IP_RETOPTS = 0x8 - IP_RF = 0x8000 - IP_RSVP_OFF = 0x10 - IP_RSVP_ON = 0xf - IP_RSVP_VIF_OFF = 0x12 - IP_RSVP_VIF_ON = 0x11 - IP_STRIPHDR = 0x17 - IP_TOS = 0x3 - IP_TRAFFIC_MGT_BACKGROUND = 0x41 - IP_TTL = 0x4 - IP_UNBLOCK_SOURCE = 0x49 - ISIG = 0x80 - ISTRIP = 0x20 - IUTF8 = 0x4000 - IXANY = 0x800 - IXOFF = 0x400 - IXON = 0x200 - LOCK_EX = 0x2 - LOCK_NB = 0x4 - LOCK_SH = 0x1 - LOCK_UN = 0x8 - MADV_CAN_REUSE = 0x9 - MADV_DONTNEED = 0x4 - MADV_FREE = 0x5 - MADV_FREE_REUSABLE = 0x7 - MADV_FREE_REUSE = 0x8 - MADV_NORMAL = 0x0 - MADV_RANDOM = 0x1 - MADV_SEQUENTIAL = 0x2 - MADV_WILLNEED = 0x3 - MADV_ZERO_WIRED_PAGES = 0x6 - MAP_ANON = 0x1000 - MAP_COPY = 0x2 - MAP_FILE = 0x0 - MAP_FIXED = 0x10 - MAP_HASSEMAPHORE = 0x200 - MAP_JIT = 0x800 - MAP_NOCACHE = 0x400 - MAP_NOEXTEND = 0x100 - MAP_NORESERVE = 0x40 - MAP_PRIVATE = 0x2 - MAP_RENAME = 0x20 - MAP_RESERVED0080 = 0x80 - MAP_SHARED = 0x1 - MCL_CURRENT = 0x1 - MCL_FUTURE = 0x2 - MSG_CTRUNC = 0x20 - MSG_DONTROUTE = 0x4 - MSG_DONTWAIT = 0x80 - MSG_EOF = 0x100 - MSG_EOR = 0x8 - MSG_FLUSH = 0x400 - MSG_HAVEMORE = 0x2000 - MSG_HOLD = 0x800 - MSG_NEEDSA = 0x10000 - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_RCVMORE = 0x4000 - MSG_SEND = 0x1000 - MSG_TRUNC = 0x10 - MSG_WAITALL = 0x40 - MSG_WAITSTREAM = 0x200 - MS_ASYNC = 0x1 - MS_DEACTIVATE = 0x8 - MS_INVALIDATE = 0x2 - MS_KILLPAGES = 0x4 - MS_SYNC = 0x10 - NAME_MAX = 0xff - NET_RT_DUMP = 0x1 - NET_RT_DUMP2 = 0x7 - NET_RT_FLAGS = 0x2 - NET_RT_IFLIST = 0x3 - NET_RT_IFLIST2 = 0x6 - NET_RT_MAXID = 0xa - NET_RT_STAT = 0x4 - NET_RT_TRASH = 0x5 - NOFLSH = 0x80000000 - NOTE_ABSOLUTE = 0x8 - NOTE_ATTRIB = 0x8 - NOTE_BACKGROUND = 0x40 - NOTE_CHILD = 0x4 - NOTE_CRITICAL = 0x20 - NOTE_DELETE = 0x1 - NOTE_EXEC = 0x20000000 - NOTE_EXIT = 0x80000000 - NOTE_EXITSTATUS = 0x4000000 - NOTE_EXIT_CSERROR = 0x40000 - NOTE_EXIT_DECRYPTFAIL = 0x10000 - NOTE_EXIT_DETAIL = 0x2000000 - NOTE_EXIT_DETAIL_MASK = 0x70000 - NOTE_EXIT_MEMORY = 0x20000 - NOTE_EXIT_REPARENTED = 0x80000 - NOTE_EXTEND = 0x4 - NOTE_FFAND = 0x40000000 - NOTE_FFCOPY = 0xc0000000 - NOTE_FFCTRLMASK = 0xc0000000 - NOTE_FFLAGSMASK = 0xffffff - NOTE_FFNOP = 0x0 - NOTE_FFOR = 0x80000000 - NOTE_FORK = 0x40000000 - NOTE_LEEWAY = 0x10 - NOTE_LINK = 0x10 - NOTE_LOWAT = 0x1 - NOTE_NONE = 0x80 - NOTE_NSECONDS = 0x4 - NOTE_PCTRLMASK = -0x100000 - NOTE_PDATAMASK = 0xfffff - NOTE_REAP = 0x10000000 - NOTE_RENAME = 0x20 - NOTE_REVOKE = 0x40 - NOTE_SECONDS = 0x1 - NOTE_SIGNAL = 0x8000000 - NOTE_TRACK = 0x1 - NOTE_TRACKERR = 0x2 - NOTE_TRIGGER = 0x1000000 - NOTE_USECONDS = 0x2 - NOTE_VM_ERROR = 0x10000000 - NOTE_VM_PRESSURE = 0x80000000 - NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000 - NOTE_VM_PRESSURE_TERMINATE = 0x40000000 - NOTE_WRITE = 0x2 - OCRNL = 0x10 - OFDEL = 0x20000 - OFILL = 0x80 - ONLCR = 0x2 - ONLRET = 0x40 - ONOCR = 0x20 - ONOEOT = 0x8 - OPOST = 0x1 - O_ACCMODE = 0x3 - O_ALERT = 0x20000000 - O_APPEND = 0x8 - O_ASYNC = 0x40 - O_CLOEXEC = 0x1000000 - O_CREAT = 0x200 - O_DIRECTORY = 0x100000 - O_DP_GETRAWENCRYPTED = 0x1 - O_DSYNC = 0x400000 - O_EVTONLY = 0x8000 - O_EXCL = 0x800 - O_EXLOCK = 0x20 - O_FSYNC = 0x80 - O_NDELAY = 0x4 - O_NOCTTY = 0x20000 - O_NOFOLLOW = 0x100 - O_NONBLOCK = 0x4 - O_POPUP = 0x80000000 - O_RDONLY = 0x0 - O_RDWR = 0x2 - O_SHLOCK = 0x10 - O_SYMLINK = 0x200000 - O_SYNC = 0x80 - O_TRUNC = 0x400 - O_WRONLY = 0x1 - PARENB = 0x1000 - PARMRK = 0x8 - PARODD = 0x2000 - PENDIN = 0x20000000 - PRIO_PGRP = 0x1 - PRIO_PROCESS = 0x0 - PRIO_USER = 0x2 - PROT_EXEC = 0x4 - PROT_NONE = 0x0 - PROT_READ = 0x1 - PROT_WRITE = 0x2 - PT_ATTACH = 0xa - PT_ATTACHEXC = 0xe - PT_CONTINUE = 0x7 - PT_DENY_ATTACH = 0x1f - PT_DETACH = 0xb - PT_FIRSTMACH = 0x20 - PT_FORCEQUOTA = 0x1e - PT_KILL = 0x8 - PT_READ_D = 0x2 - PT_READ_I = 0x1 - PT_READ_U = 0x3 - PT_SIGEXC = 0xc - PT_STEP = 0x9 - PT_THUPDATE = 0xd - PT_TRACE_ME = 0x0 - PT_WRITE_D = 0x5 - PT_WRITE_I = 0x4 - PT_WRITE_U = 0x6 - RLIMIT_AS = 0x5 - RLIMIT_CORE = 0x4 - RLIMIT_CPU = 0x0 - RLIMIT_CPU_USAGE_MONITOR = 0x2 - RLIMIT_DATA = 0x2 - RLIMIT_FSIZE = 0x1 - RLIMIT_NOFILE = 0x8 - RLIMIT_STACK = 0x3 - RLIM_INFINITY = 0x7fffffffffffffff - RTAX_AUTHOR = 0x6 - RTAX_BRD = 0x7 - RTAX_DST = 0x0 - RTAX_GATEWAY = 0x1 - RTAX_GENMASK = 0x3 - RTAX_IFA = 0x5 - RTAX_IFP = 0x4 - RTAX_MAX = 0x8 - RTAX_NETMASK = 0x2 - RTA_AUTHOR = 0x40 - RTA_BRD = 0x80 - RTA_DST = 0x1 - RTA_GATEWAY = 0x2 - RTA_GENMASK = 0x8 - RTA_IFA = 0x20 - RTA_IFP = 0x10 - RTA_NETMASK = 0x4 - RTF_BLACKHOLE = 0x1000 - RTF_BROADCAST = 0x400000 - RTF_CLONING = 0x100 - RTF_CONDEMNED = 0x2000000 - RTF_DELCLONE = 0x80 - RTF_DONE = 0x40 - RTF_DYNAMIC = 0x10 - RTF_GATEWAY = 0x2 - RTF_HOST = 0x4 - RTF_IFREF = 0x4000000 - RTF_IFSCOPE = 0x1000000 - RTF_LLINFO = 0x400 - RTF_LOCAL = 0x200000 - RTF_MODIFIED = 0x20 - RTF_MULTICAST = 0x800000 - RTF_PINNED = 0x100000 - RTF_PRCLONING = 0x10000 - RTF_PROTO1 = 0x8000 - RTF_PROTO2 = 0x4000 - RTF_PROTO3 = 0x40000 - RTF_PROXY = 0x8000000 - RTF_REJECT = 0x8 - RTF_ROUTER = 0x10000000 - RTF_STATIC = 0x800 - RTF_UP = 0x1 - RTF_WASCLONED = 0x20000 - RTF_XRESOLVE = 0x200 - RTM_ADD = 0x1 - RTM_CHANGE = 0x3 - RTM_DELADDR = 0xd - RTM_DELETE = 0x2 - RTM_DELMADDR = 0x10 - RTM_GET = 0x4 - RTM_GET2 = 0x14 - RTM_IFINFO = 0xe - RTM_IFINFO2 = 0x12 - RTM_LOCK = 0x8 - RTM_LOSING = 0x5 - RTM_MISS = 0x7 - RTM_NEWADDR = 0xc - RTM_NEWMADDR = 0xf - RTM_NEWMADDR2 = 0x13 - RTM_OLDADD = 0x9 - RTM_OLDDEL = 0xa - RTM_REDIRECT = 0x6 - RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 - RTM_VERSION = 0x5 - RTV_EXPIRE = 0x4 - RTV_HOPCOUNT = 0x2 - RTV_MTU = 0x1 - RTV_RPIPE = 0x8 - RTV_RTT = 0x40 - RTV_RTTVAR = 0x80 - RTV_SPIPE = 0x10 - RTV_SSTHRESH = 0x20 - RUSAGE_CHILDREN = -0x1 - RUSAGE_SELF = 0x0 - SCM_CREDS = 0x3 - SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x2 - SCM_TIMESTAMP_MONOTONIC = 0x4 - SHUT_RD = 0x0 - SHUT_RDWR = 0x2 - SHUT_WR = 0x1 - SIOCADDMULTI = 0x80206931 - SIOCAIFADDR = 0x8040691a - SIOCARPIPLL = 0xc0206928 - SIOCATMARK = 0x40047307 - SIOCAUTOADDR = 0xc0206926 - SIOCAUTONETMASK = 0x80206927 - SIOCDELMULTI = 0x80206932 - SIOCDIFADDR = 0x80206919 - SIOCDIFPHYADDR = 0x80206941 - SIOCGDRVSPEC = 0xc028697b - SIOCGETVLAN = 0xc020697f - SIOCGHIWAT = 0x40047301 - SIOCGIFADDR = 0xc0206921 - SIOCGIFALTMTU = 0xc0206948 - SIOCGIFASYNCMAP = 0xc020697c - SIOCGIFBOND = 0xc0206947 - SIOCGIFBRDADDR = 0xc0206923 - SIOCGIFCAP = 0xc020695b - SIOCGIFCONF = 0xc00c6924 - SIOCGIFDEVMTU = 0xc0206944 - SIOCGIFDSTADDR = 0xc0206922 - SIOCGIFFLAGS = 0xc0206911 - SIOCGIFGENERIC = 0xc020693a - SIOCGIFKPI = 0xc0206987 - SIOCGIFMAC = 0xc0206982 - SIOCGIFMEDIA = 0xc02c6938 - SIOCGIFMETRIC = 0xc0206917 - SIOCGIFMTU = 0xc0206933 - SIOCGIFNETMASK = 0xc0206925 - SIOCGIFPDSTADDR = 0xc0206940 - SIOCGIFPHYS = 0xc0206935 - SIOCGIFPSRCADDR = 0xc020693f - SIOCGIFSTATUS = 0xc331693d - SIOCGIFVLAN = 0xc020697f - SIOCGIFWAKEFLAGS = 0xc0206988 - SIOCGLOWAT = 0x40047303 - SIOCGPGRP = 0x40047309 - SIOCIFCREATE = 0xc0206978 - SIOCIFCREATE2 = 0xc020697a - SIOCIFDESTROY = 0x80206979 - SIOCIFGCLONERS = 0xc0106981 - SIOCRSLVMULTI = 0xc010693b - SIOCSDRVSPEC = 0x8028697b - SIOCSETVLAN = 0x8020697e - SIOCSHIWAT = 0x80047300 - SIOCSIFADDR = 0x8020690c - SIOCSIFALTMTU = 0x80206945 - SIOCSIFASYNCMAP = 0x8020697d - SIOCSIFBOND = 0x80206946 - SIOCSIFBRDADDR = 0x80206913 - SIOCSIFCAP = 0x8020695a - SIOCSIFDSTADDR = 0x8020690e - SIOCSIFFLAGS = 0x80206910 - SIOCSIFGENERIC = 0x80206939 - SIOCSIFKPI = 0x80206986 - SIOCSIFLLADDR = 0x8020693c - SIOCSIFMAC = 0x80206983 - SIOCSIFMEDIA = 0xc0206937 - SIOCSIFMETRIC = 0x80206918 - SIOCSIFMTU = 0x80206934 - SIOCSIFNETMASK = 0x80206916 - SIOCSIFPHYADDR = 0x8040693e - SIOCSIFPHYS = 0x80206936 - SIOCSIFVLAN = 0x8020697e - SIOCSLOWAT = 0x80047302 - SIOCSPGRP = 0x80047308 - SOCK_DGRAM = 0x2 - SOCK_MAXADDRLEN = 0xff - SOCK_RAW = 0x3 - SOCK_RDM = 0x4 - SOCK_SEQPACKET = 0x5 - SOCK_STREAM = 0x1 - SOL_SOCKET = 0xffff - SOMAXCONN = 0x80 - SO_ACCEPTCONN = 0x2 - SO_BROADCAST = 0x20 - SO_DEBUG = 0x1 - SO_DONTROUTE = 0x10 - SO_DONTTRUNC = 0x2000 - SO_ERROR = 0x1007 - SO_KEEPALIVE = 0x8 - SO_LABEL = 0x1010 - SO_LINGER = 0x80 - SO_LINGER_SEC = 0x1080 - SO_NKE = 0x1021 - SO_NOADDRERR = 0x1023 - SO_NOSIGPIPE = 0x1022 - SO_NOTIFYCONFLICT = 0x1026 - SO_NP_EXTENSIONS = 0x1083 - SO_NREAD = 0x1020 - SO_NUMRCVPKT = 0x1112 - SO_NWRITE = 0x1024 - SO_OOBINLINE = 0x100 - SO_PEERLABEL = 0x1011 - SO_RANDOMPORT = 0x1082 - SO_RCVBUF = 0x1002 - SO_RCVLOWAT = 0x1004 - SO_RCVTIMEO = 0x1006 - SO_REUSEADDR = 0x4 - SO_REUSEPORT = 0x200 - SO_REUSESHAREUID = 0x1025 - SO_SNDBUF = 0x1001 - SO_SNDLOWAT = 0x1003 - SO_SNDTIMEO = 0x1005 - SO_TIMESTAMP = 0x400 - SO_TIMESTAMP_MONOTONIC = 0x800 - SO_TYPE = 0x1008 - SO_UPCALLCLOSEWAIT = 0x1027 - SO_USELOOPBACK = 0x40 - SO_WANTMORE = 0x4000 - SO_WANTOOBFLAG = 0x8000 - S_IEXEC = 0x40 - S_IFBLK = 0x6000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFIFO = 0x1000 - S_IFLNK = 0xa000 - S_IFMT = 0xf000 - S_IFREG = 0x8000 - S_IFSOCK = 0xc000 - S_IFWHT = 0xe000 - S_IREAD = 0x100 - S_IRGRP = 0x20 - S_IROTH = 0x4 - S_IRUSR = 0x100 - S_IRWXG = 0x38 - S_IRWXO = 0x7 - S_IRWXU = 0x1c0 - S_ISGID = 0x400 - S_ISTXT = 0x200 - S_ISUID = 0x800 - S_ISVTX = 0x200 - S_IWGRP = 0x10 - S_IWOTH = 0x2 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXGRP = 0x8 - S_IXOTH = 0x1 - S_IXUSR = 0x40 - TCIFLUSH = 0x1 - TCIOFLUSH = 0x3 - TCOFLUSH = 0x2 - TCP_CONNECTIONTIMEOUT = 0x20 - TCP_ENABLE_ECN = 0x104 - TCP_KEEPALIVE = 0x10 - TCP_KEEPCNT = 0x102 - TCP_KEEPINTVL = 0x101 - TCP_MAXHLEN = 0x3c - TCP_MAXOLEN = 0x28 - TCP_MAXSEG = 0x2 - TCP_MAXWIN = 0xffff - TCP_MAX_SACK = 0x4 - TCP_MAX_WINSHIFT = 0xe - TCP_MINMSS = 0xd8 - TCP_MSS = 0x200 - TCP_NODELAY = 0x1 - TCP_NOOPT = 0x8 - TCP_NOPUSH = 0x4 - TCP_NOTSENT_LOWAT = 0x201 - TCP_RXT_CONNDROPTIME = 0x80 - TCP_RXT_FINDROP = 0x100 - TCP_SENDMOREACKS = 0x103 - TCSAFLUSH = 0x2 - TIOCCBRK = 0x2000747a - TIOCCDTR = 0x20007478 - TIOCCONS = 0x80047462 - TIOCDCDTIMESTAMP = 0x40107458 - TIOCDRAIN = 0x2000745e - TIOCDSIMICROCODE = 0x20007455 - TIOCEXCL = 0x2000740d - TIOCEXT = 0x80047460 - TIOCFLUSH = 0x80047410 - TIOCGDRAINWAIT = 0x40047456 - TIOCGETA = 0x40487413 - TIOCGETD = 0x4004741a - TIOCGPGRP = 0x40047477 - TIOCGWINSZ = 0x40087468 - TIOCIXOFF = 0x20007480 - TIOCIXON = 0x20007481 - TIOCMBIC = 0x8004746b - TIOCMBIS = 0x8004746c - TIOCMGDTRWAIT = 0x4004745a - TIOCMGET = 0x4004746a - TIOCMODG = 0x40047403 - TIOCMODS = 0x80047404 - TIOCMSDTRWAIT = 0x8004745b - TIOCMSET = 0x8004746d - TIOCM_CAR = 0x40 - TIOCM_CD = 0x40 - TIOCM_CTS = 0x20 - TIOCM_DSR = 0x100 - TIOCM_DTR = 0x2 - TIOCM_LE = 0x1 - TIOCM_RI = 0x80 - TIOCM_RNG = 0x80 - TIOCM_RTS = 0x4 - TIOCM_SR = 0x10 - TIOCM_ST = 0x8 - TIOCNOTTY = 0x20007471 - TIOCNXCL = 0x2000740e - TIOCOUTQ = 0x40047473 - TIOCPKT = 0x80047470 - TIOCPKT_DATA = 0x0 - TIOCPKT_DOSTOP = 0x20 - TIOCPKT_FLUSHREAD = 0x1 - TIOCPKT_FLUSHWRITE = 0x2 - TIOCPKT_IOCTL = 0x40 - TIOCPKT_NOSTOP = 0x10 - TIOCPKT_START = 0x8 - TIOCPKT_STOP = 0x4 - TIOCPTYGNAME = 0x40807453 - TIOCPTYGRANT = 0x20007454 - TIOCPTYUNLK = 0x20007452 - TIOCREMOTE = 0x80047469 - TIOCSBRK = 0x2000747b - TIOCSCONS = 0x20007463 - TIOCSCTTY = 0x20007461 - TIOCSDRAINWAIT = 0x80047457 - TIOCSDTR = 0x20007479 - TIOCSETA = 0x80487414 - TIOCSETAF = 0x80487416 - TIOCSETAW = 0x80487415 - TIOCSETD = 0x8004741b - TIOCSIG = 0x2000745f - TIOCSPGRP = 0x80047476 - TIOCSTART = 0x2000746e - TIOCSTAT = 0x20007465 - TIOCSTI = 0x80017472 - TIOCSTOP = 0x2000746f - TIOCSWINSZ = 0x80087467 - TIOCTIMESTAMP = 0x40107459 - TIOCUCNTL = 0x80047466 - TOSTOP = 0x400000 - VDISCARD = 0xf - VDSUSP = 0xb - VEOF = 0x0 - VEOL = 0x1 - VEOL2 = 0x2 - VERASE = 0x3 - VINTR = 0x8 - VKILL = 0x5 - VLNEXT = 0xe - VMIN = 0x10 - VQUIT = 0x9 - VREPRINT = 0x6 - VSTART = 0xc - VSTATUS = 0x12 - VSTOP = 0xd - VSUSP = 0xa - VT0 = 0x0 - VT1 = 0x10000 - VTDLY = 0x10000 - VTIME = 0x11 - VWERASE = 0x4 - WCONTINUED = 0x10 - WCOREFLAG = 0x80 - WEXITED = 0x4 - WNOHANG = 0x1 - WNOWAIT = 0x20 - WORDSIZE = 0x40 - WSTOPPED = 0x8 - WUNTRACED = 0x2 -) - -// Errors -const ( - E2BIG = syscall.Errno(0x7) - EACCES = syscall.Errno(0xd) - EADDRINUSE = syscall.Errno(0x30) - EADDRNOTAVAIL = syscall.Errno(0x31) - EAFNOSUPPORT = syscall.Errno(0x2f) - EAGAIN = syscall.Errno(0x23) - EALREADY = syscall.Errno(0x25) - EAUTH = syscall.Errno(0x50) - EBADARCH = syscall.Errno(0x56) - EBADEXEC = syscall.Errno(0x55) - EBADF = syscall.Errno(0x9) - EBADMACHO = syscall.Errno(0x58) - EBADMSG = syscall.Errno(0x5e) - EBADRPC = syscall.Errno(0x48) - EBUSY = syscall.Errno(0x10) - ECANCELED = syscall.Errno(0x59) - ECHILD = syscall.Errno(0xa) - ECONNABORTED = syscall.Errno(0x35) - ECONNREFUSED = syscall.Errno(0x3d) - ECONNRESET = syscall.Errno(0x36) - EDEADLK = syscall.Errno(0xb) - EDESTADDRREQ = syscall.Errno(0x27) - EDEVERR = syscall.Errno(0x53) - EDOM = syscall.Errno(0x21) - EDQUOT = syscall.Errno(0x45) - EEXIST = syscall.Errno(0x11) - EFAULT = syscall.Errno(0xe) - EFBIG = syscall.Errno(0x1b) - EFTYPE = syscall.Errno(0x4f) - EHOSTDOWN = syscall.Errno(0x40) - EHOSTUNREACH = syscall.Errno(0x41) - EIDRM = syscall.Errno(0x5a) - EILSEQ = syscall.Errno(0x5c) - EINPROGRESS = syscall.Errno(0x24) - EINTR = syscall.Errno(0x4) - EINVAL = syscall.Errno(0x16) - EIO = syscall.Errno(0x5) - EISCONN = syscall.Errno(0x38) - EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x6a) - ELOOP = syscall.Errno(0x3e) - EMFILE = syscall.Errno(0x18) - EMLINK = syscall.Errno(0x1f) - EMSGSIZE = syscall.Errno(0x28) - EMULTIHOP = syscall.Errno(0x5f) - ENAMETOOLONG = syscall.Errno(0x3f) - ENEEDAUTH = syscall.Errno(0x51) - ENETDOWN = syscall.Errno(0x32) - ENETRESET = syscall.Errno(0x34) - ENETUNREACH = syscall.Errno(0x33) - ENFILE = syscall.Errno(0x17) - ENOATTR = syscall.Errno(0x5d) - ENOBUFS = syscall.Errno(0x37) - ENODATA = syscall.Errno(0x60) - ENODEV = syscall.Errno(0x13) - ENOENT = syscall.Errno(0x2) - ENOEXEC = syscall.Errno(0x8) - ENOLCK = syscall.Errno(0x4d) - ENOLINK = syscall.Errno(0x61) - ENOMEM = syscall.Errno(0xc) - ENOMSG = syscall.Errno(0x5b) - ENOPOLICY = syscall.Errno(0x67) - ENOPROTOOPT = syscall.Errno(0x2a) - ENOSPC = syscall.Errno(0x1c) - ENOSR = syscall.Errno(0x62) - ENOSTR = syscall.Errno(0x63) - ENOSYS = syscall.Errno(0x4e) - ENOTBLK = syscall.Errno(0xf) - ENOTCONN = syscall.Errno(0x39) - ENOTDIR = syscall.Errno(0x14) - ENOTEMPTY = syscall.Errno(0x42) - ENOTRECOVERABLE = syscall.Errno(0x68) - ENOTSOCK = syscall.Errno(0x26) - ENOTSUP = syscall.Errno(0x2d) - ENOTTY = syscall.Errno(0x19) - ENXIO = syscall.Errno(0x6) - EOPNOTSUPP = syscall.Errno(0x66) - EOVERFLOW = syscall.Errno(0x54) - EOWNERDEAD = syscall.Errno(0x69) - EPERM = syscall.Errno(0x1) - EPFNOSUPPORT = syscall.Errno(0x2e) - EPIPE = syscall.Errno(0x20) - EPROCLIM = syscall.Errno(0x43) - EPROCUNAVAIL = syscall.Errno(0x4c) - EPROGMISMATCH = syscall.Errno(0x4b) - EPROGUNAVAIL = syscall.Errno(0x4a) - EPROTO = syscall.Errno(0x64) - EPROTONOSUPPORT = syscall.Errno(0x2b) - EPROTOTYPE = syscall.Errno(0x29) - EPWROFF = syscall.Errno(0x52) - EQFULL = syscall.Errno(0x6a) - ERANGE = syscall.Errno(0x22) - EREMOTE = syscall.Errno(0x47) - EROFS = syscall.Errno(0x1e) - ERPCMISMATCH = syscall.Errno(0x49) - ESHLIBVERS = syscall.Errno(0x57) - ESHUTDOWN = syscall.Errno(0x3a) - ESOCKTNOSUPPORT = syscall.Errno(0x2c) - ESPIPE = syscall.Errno(0x1d) - ESRCH = syscall.Errno(0x3) - ESTALE = syscall.Errno(0x46) - ETIME = syscall.Errno(0x65) - ETIMEDOUT = syscall.Errno(0x3c) - ETOOMANYREFS = syscall.Errno(0x3b) - ETXTBSY = syscall.Errno(0x1a) - EUSERS = syscall.Errno(0x44) - EWOULDBLOCK = syscall.Errno(0x23) - EXDEV = syscall.Errno(0x12) -) - -// Signals -const ( - SIGABRT = syscall.Signal(0x6) - SIGALRM = syscall.Signal(0xe) - SIGBUS = syscall.Signal(0xa) - SIGCHLD = syscall.Signal(0x14) - SIGCONT = syscall.Signal(0x13) - SIGEMT = syscall.Signal(0x7) - SIGFPE = syscall.Signal(0x8) - SIGHUP = syscall.Signal(0x1) - SIGILL = syscall.Signal(0x4) - SIGINFO = syscall.Signal(0x1d) - SIGINT = syscall.Signal(0x2) - SIGIO = syscall.Signal(0x17) - SIGIOT = syscall.Signal(0x6) - SIGKILL = syscall.Signal(0x9) - SIGPIPE = syscall.Signal(0xd) - SIGPROF = syscall.Signal(0x1b) - SIGQUIT = syscall.Signal(0x3) - SIGSEGV = syscall.Signal(0xb) - SIGSTOP = syscall.Signal(0x11) - SIGSYS = syscall.Signal(0xc) - SIGTERM = syscall.Signal(0xf) - SIGTRAP = syscall.Signal(0x5) - SIGTSTP = syscall.Signal(0x12) - SIGTTIN = syscall.Signal(0x15) - SIGTTOU = syscall.Signal(0x16) - SIGURG = syscall.Signal(0x10) - SIGUSR1 = syscall.Signal(0x1e) - SIGUSR2 = syscall.Signal(0x1f) - SIGVTALRM = syscall.Signal(0x1a) - SIGWINCH = syscall.Signal(0x1c) - SIGXCPU = syscall.Signal(0x18) - SIGXFSZ = syscall.Signal(0x19) -) diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go deleted file mode 100644 index 3189c6b345..0000000000 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ /dev/null @@ -1,1576 +0,0 @@ -// mkerrors.sh -m64 -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -// +build arm64,darwin - -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs -- -m64 _const.go - -package unix - -import "syscall" - -const ( - AF_APPLETALK = 0x10 - AF_CCITT = 0xa - AF_CHAOS = 0x5 - AF_CNT = 0x15 - AF_COIP = 0x14 - AF_DATAKIT = 0x9 - AF_DECnet = 0xc - AF_DLI = 0xd - AF_E164 = 0x1c - AF_ECMA = 0x8 - AF_HYLINK = 0xf - AF_IEEE80211 = 0x25 - AF_IMPLINK = 0x3 - AF_INET = 0x2 - AF_INET6 = 0x1e - AF_IPX = 0x17 - AF_ISDN = 0x1c - AF_ISO = 0x7 - AF_LAT = 0xe - AF_LINK = 0x12 - AF_LOCAL = 0x1 - AF_MAX = 0x28 - AF_NATM = 0x1f - AF_NDRV = 0x1b - AF_NETBIOS = 0x21 - AF_NS = 0x6 - AF_OSI = 0x7 - AF_PPP = 0x22 - AF_PUP = 0x4 - AF_RESERVED_36 = 0x24 - AF_ROUTE = 0x11 - AF_SIP = 0x18 - AF_SNA = 0xb - AF_SYSTEM = 0x20 - AF_UNIX = 0x1 - AF_UNSPEC = 0x0 - AF_UTUN = 0x26 - B0 = 0x0 - B110 = 0x6e - B115200 = 0x1c200 - B1200 = 0x4b0 - B134 = 0x86 - B14400 = 0x3840 - B150 = 0x96 - B1800 = 0x708 - B19200 = 0x4b00 - B200 = 0xc8 - B230400 = 0x38400 - B2400 = 0x960 - B28800 = 0x7080 - B300 = 0x12c - B38400 = 0x9600 - B4800 = 0x12c0 - B50 = 0x32 - B57600 = 0xe100 - B600 = 0x258 - B7200 = 0x1c20 - B75 = 0x4b - B76800 = 0x12c00 - B9600 = 0x2580 - BIOCFLUSH = 0x20004268 - BIOCGBLEN = 0x40044266 - BIOCGDLT = 0x4004426a - BIOCGDLTLIST = 0xc00c4279 - BIOCGETIF = 0x4020426b - BIOCGHDRCMPLT = 0x40044274 - BIOCGRSIG = 0x40044272 - BIOCGRTIMEOUT = 0x4010426e - BIOCGSEESENT = 0x40044276 - BIOCGSTATS = 0x4008426f - BIOCIMMEDIATE = 0x80044270 - BIOCPROMISC = 0x20004269 - BIOCSBLEN = 0xc0044266 - BIOCSDLT = 0x80044278 - BIOCSETF = 0x80104267 - BIOCSETFNR = 0x8010427e - BIOCSETIF = 0x8020426c - BIOCSHDRCMPLT = 0x80044275 - BIOCSRSIG = 0x80044273 - BIOCSRTIMEOUT = 0x8010426d - BIOCSSEESENT = 0x80044277 - BIOCVERSION = 0x40044271 - BPF_A = 0x10 - BPF_ABS = 0x20 - BPF_ADD = 0x0 - BPF_ALIGNMENT = 0x4 - BPF_ALU = 0x4 - BPF_AND = 0x50 - BPF_B = 0x10 - BPF_DIV = 0x30 - BPF_H = 0x8 - BPF_IMM = 0x0 - BPF_IND = 0x40 - BPF_JA = 0x0 - BPF_JEQ = 0x10 - BPF_JGE = 0x30 - BPF_JGT = 0x20 - BPF_JMP = 0x5 - BPF_JSET = 0x40 - BPF_K = 0x0 - BPF_LD = 0x0 - BPF_LDX = 0x1 - BPF_LEN = 0x80 - BPF_LSH = 0x60 - BPF_MAJOR_VERSION = 0x1 - BPF_MAXBUFSIZE = 0x80000 - BPF_MAXINSNS = 0x200 - BPF_MEM = 0x60 - BPF_MEMWORDS = 0x10 - BPF_MINBUFSIZE = 0x20 - BPF_MINOR_VERSION = 0x1 - BPF_MISC = 0x7 - BPF_MSH = 0xa0 - BPF_MUL = 0x20 - BPF_NEG = 0x80 - BPF_OR = 0x40 - BPF_RELEASE = 0x30bb6 - BPF_RET = 0x6 - BPF_RSH = 0x70 - BPF_ST = 0x2 - BPF_STX = 0x3 - BPF_SUB = 0x10 - BPF_TAX = 0x0 - BPF_TXA = 0x80 - BPF_W = 0x0 - BPF_X = 0x8 - BRKINT = 0x2 - CFLUSH = 0xf - CLOCAL = 0x8000 - CREAD = 0x800 - CS5 = 0x0 - CS6 = 0x100 - CS7 = 0x200 - CS8 = 0x300 - CSIZE = 0x300 - CSTART = 0x11 - CSTATUS = 0x14 - CSTOP = 0x13 - CSTOPB = 0x400 - CSUSP = 0x1a - CTL_MAXNAME = 0xc - CTL_NET = 0x4 - DLT_A429 = 0xb8 - DLT_A653_ICM = 0xb9 - DLT_AIRONET_HEADER = 0x78 - DLT_AOS = 0xde - DLT_APPLE_IP_OVER_IEEE1394 = 0x8a - DLT_ARCNET = 0x7 - DLT_ARCNET_LINUX = 0x81 - DLT_ATM_CLIP = 0x13 - DLT_ATM_RFC1483 = 0xb - DLT_AURORA = 0x7e - DLT_AX25 = 0x3 - DLT_AX25_KISS = 0xca - DLT_BACNET_MS_TP = 0xa5 - DLT_BLUETOOTH_HCI_H4 = 0xbb - DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 - DLT_CAN20B = 0xbe - DLT_CAN_SOCKETCAN = 0xe3 - DLT_CHAOS = 0x5 - DLT_CHDLC = 0x68 - DLT_CISCO_IOS = 0x76 - DLT_C_HDLC = 0x68 - DLT_C_HDLC_WITH_DIR = 0xcd - DLT_DBUS = 0xe7 - DLT_DECT = 0xdd - DLT_DOCSIS = 0x8f - DLT_DVB_CI = 0xeb - DLT_ECONET = 0x73 - DLT_EN10MB = 0x1 - DLT_EN3MB = 0x2 - DLT_ENC = 0x6d - DLT_ERF = 0xc5 - DLT_ERF_ETH = 0xaf - DLT_ERF_POS = 0xb0 - DLT_FC_2 = 0xe0 - DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 - DLT_FDDI = 0xa - DLT_FLEXRAY = 0xd2 - DLT_FRELAY = 0x6b - DLT_FRELAY_WITH_DIR = 0xce - DLT_GCOM_SERIAL = 0xad - DLT_GCOM_T1E1 = 0xac - DLT_GPF_F = 0xab - DLT_GPF_T = 0xaa - DLT_GPRS_LLC = 0xa9 - DLT_GSMTAP_ABIS = 0xda - DLT_GSMTAP_UM = 0xd9 - DLT_HHDLC = 0x79 - DLT_IBM_SN = 0x92 - DLT_IBM_SP = 0x91 - DLT_IEEE802 = 0x6 - DLT_IEEE802_11 = 0x69 - DLT_IEEE802_11_RADIO = 0x7f - DLT_IEEE802_11_RADIO_AVS = 0xa3 - DLT_IEEE802_15_4 = 0xc3 - DLT_IEEE802_15_4_LINUX = 0xbf - DLT_IEEE802_15_4_NOFCS = 0xe6 - DLT_IEEE802_15_4_NONASK_PHY = 0xd7 - DLT_IEEE802_16_MAC_CPS = 0xbc - DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 - DLT_IPFILTER = 0x74 - DLT_IPMB = 0xc7 - DLT_IPMB_LINUX = 0xd1 - DLT_IPNET = 0xe2 - DLT_IPOIB = 0xf2 - DLT_IPV4 = 0xe4 - DLT_IPV6 = 0xe5 - DLT_IP_OVER_FC = 0x7a - DLT_JUNIPER_ATM1 = 0x89 - DLT_JUNIPER_ATM2 = 0x87 - DLT_JUNIPER_ATM_CEMIC = 0xee - DLT_JUNIPER_CHDLC = 0xb5 - DLT_JUNIPER_ES = 0x84 - DLT_JUNIPER_ETHER = 0xb2 - DLT_JUNIPER_FIBRECHANNEL = 0xea - DLT_JUNIPER_FRELAY = 0xb4 - DLT_JUNIPER_GGSN = 0x85 - DLT_JUNIPER_ISM = 0xc2 - DLT_JUNIPER_MFR = 0x86 - DLT_JUNIPER_MLFR = 0x83 - DLT_JUNIPER_MLPPP = 0x82 - DLT_JUNIPER_MONITOR = 0xa4 - DLT_JUNIPER_PIC_PEER = 0xae - DLT_JUNIPER_PPP = 0xb3 - DLT_JUNIPER_PPPOE = 0xa7 - DLT_JUNIPER_PPPOE_ATM = 0xa8 - DLT_JUNIPER_SERVICES = 0x88 - DLT_JUNIPER_SRX_E2E = 0xe9 - DLT_JUNIPER_ST = 0xc8 - DLT_JUNIPER_VP = 0xb7 - DLT_JUNIPER_VS = 0xe8 - DLT_LAPB_WITH_DIR = 0xcf - DLT_LAPD = 0xcb - DLT_LIN = 0xd4 - DLT_LINUX_EVDEV = 0xd8 - DLT_LINUX_IRDA = 0x90 - DLT_LINUX_LAPD = 0xb1 - DLT_LINUX_PPP_WITHDIRECTION = 0xa6 - DLT_LINUX_SLL = 0x71 - DLT_LOOP = 0x6c - DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0xf5 - DLT_MATCHING_MIN = 0x68 - DLT_MFR = 0xb6 - DLT_MOST = 0xd3 - DLT_MPEG_2_TS = 0xf3 - DLT_MPLS = 0xdb - DLT_MTP2 = 0x8c - DLT_MTP2_WITH_PHDR = 0x8b - DLT_MTP3 = 0x8d - DLT_MUX27010 = 0xec - DLT_NETANALYZER = 0xf0 - DLT_NETANALYZER_TRANSPARENT = 0xf1 - DLT_NFC_LLCP = 0xf5 - DLT_NFLOG = 0xef - DLT_NG40 = 0xf4 - DLT_NULL = 0x0 - DLT_PCI_EXP = 0x7d - DLT_PFLOG = 0x75 - DLT_PFSYNC = 0x12 - DLT_PPI = 0xc0 - DLT_PPP = 0x9 - DLT_PPP_BSDOS = 0x10 - DLT_PPP_ETHER = 0x33 - DLT_PPP_PPPD = 0xa6 - DLT_PPP_SERIAL = 0x32 - DLT_PPP_WITH_DIR = 0xcc - DLT_PPP_WITH_DIRECTION = 0xa6 - DLT_PRISM_HEADER = 0x77 - DLT_PRONET = 0x4 - DLT_RAIF1 = 0xc6 - DLT_RAW = 0xc - DLT_RIO = 0x7c - DLT_SCCP = 0x8e - DLT_SITA = 0xc4 - DLT_SLIP = 0x8 - DLT_SLIP_BSDOS = 0xf - DLT_STANAG_5066_D_PDU = 0xed - DLT_SUNATM = 0x7b - DLT_SYMANTEC_FIREWALL = 0x63 - DLT_TZSP = 0x80 - DLT_USB = 0xba - DLT_USB_LINUX = 0xbd - DLT_USB_LINUX_MMAPPED = 0xdc - DLT_USER0 = 0x93 - DLT_USER1 = 0x94 - DLT_USER10 = 0x9d - DLT_USER11 = 0x9e - DLT_USER12 = 0x9f - DLT_USER13 = 0xa0 - DLT_USER14 = 0xa1 - DLT_USER15 = 0xa2 - DLT_USER2 = 0x95 - DLT_USER3 = 0x96 - DLT_USER4 = 0x97 - DLT_USER5 = 0x98 - DLT_USER6 = 0x99 - DLT_USER7 = 0x9a - DLT_USER8 = 0x9b - DLT_USER9 = 0x9c - DLT_WIHART = 0xdf - DLT_X2E_SERIAL = 0xd5 - DLT_X2E_XORAYA = 0xd6 - DT_BLK = 0x6 - DT_CHR = 0x2 - DT_DIR = 0x4 - DT_FIFO = 0x1 - DT_LNK = 0xa - DT_REG = 0x8 - DT_SOCK = 0xc - DT_UNKNOWN = 0x0 - DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x40 - ECHOE = 0x2 - ECHOK = 0x4 - ECHOKE = 0x1 - ECHONL = 0x10 - ECHOPRT = 0x20 - EVFILT_AIO = -0x3 - EVFILT_FS = -0x9 - EVFILT_MACHPORT = -0x8 - EVFILT_PROC = -0x5 - EVFILT_READ = -0x1 - EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0xe - EVFILT_THREADMARKER = 0xe - EVFILT_TIMER = -0x7 - EVFILT_USER = -0xa - EVFILT_VM = -0xc - EVFILT_VNODE = -0x4 - EVFILT_WRITE = -0x2 - EV_ADD = 0x1 - EV_CLEAR = 0x20 - EV_DELETE = 0x2 - EV_DISABLE = 0x8 - EV_DISPATCH = 0x80 - EV_ENABLE = 0x4 - EV_EOF = 0x8000 - EV_ERROR = 0x4000 - EV_FLAG0 = 0x1000 - EV_FLAG1 = 0x2000 - EV_ONESHOT = 0x10 - EV_OOBAND = 0x2000 - EV_POLL = 0x1000 - EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf000 - EXTA = 0x4b00 - EXTB = 0x9600 - EXTPROC = 0x800 - FD_CLOEXEC = 0x1 - FD_SETSIZE = 0x400 - FLUSHO = 0x800000 - F_ADDFILESIGS = 0x3d - F_ADDSIGS = 0x3b - F_ALLOCATEALL = 0x4 - F_ALLOCATECONTIG = 0x2 - F_CHKCLEAN = 0x29 - F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0x43 - F_FINDSIGS = 0x4e - F_FLUSH_DATA = 0x28 - F_FREEZE_FS = 0x35 - F_FULLFSYNC = 0x33 - F_GETCODEDIR = 0x48 - F_GETFD = 0x1 - F_GETFL = 0x3 - F_GETLK = 0x7 - F_GETLKPID = 0x42 - F_GETNOSIGPIPE = 0x4a - F_GETOWN = 0x5 - F_GETPATH = 0x32 - F_GETPATH_MTMINFO = 0x47 - F_GETPROTECTIONCLASS = 0x3f - F_GETPROTECTIONLEVEL = 0x4d - F_GLOBAL_NOCACHE = 0x37 - F_LOG2PHYS = 0x31 - F_LOG2PHYS_EXT = 0x41 - F_NOCACHE = 0x30 - F_NODIRECT = 0x3e - F_OK = 0x0 - F_PATHPKG_CHECK = 0x34 - F_PEOFPOSMODE = 0x3 - F_PREALLOCATE = 0x2a - F_RDADVISE = 0x2c - F_RDAHEAD = 0x2d - F_RDLCK = 0x1 - F_SETBACKINGSTORE = 0x46 - F_SETFD = 0x2 - F_SETFL = 0x4 - F_SETLK = 0x8 - F_SETLKW = 0x9 - F_SETLKWTIMEOUT = 0xa - F_SETNOSIGPIPE = 0x49 - F_SETOWN = 0x6 - F_SETPROTECTIONCLASS = 0x40 - F_SETSIZE = 0x2b - F_SINGLE_WRITER = 0x4c - F_THAW_FS = 0x36 - F_TRANSCODEKEY = 0x4b - F_UNLCK = 0x2 - F_VOLPOSMODE = 0x4 - F_WRLCK = 0x3 - HUPCL = 0x4000 - ICANON = 0x100 - ICMP6_FILTER = 0x12 - ICRNL = 0x100 - IEXTEN = 0x400 - IFF_ALLMULTI = 0x200 - IFF_ALTPHYS = 0x4000 - IFF_BROADCAST = 0x2 - IFF_DEBUG = 0x4 - IFF_LINK0 = 0x1000 - IFF_LINK1 = 0x2000 - IFF_LINK2 = 0x4000 - IFF_LOOPBACK = 0x8 - IFF_MULTICAST = 0x8000 - IFF_NOARP = 0x80 - IFF_NOTRAILERS = 0x20 - IFF_OACTIVE = 0x400 - IFF_POINTOPOINT = 0x10 - IFF_PROMISC = 0x100 - IFF_RUNNING = 0x40 - IFF_SIMPLEX = 0x800 - IFF_UP = 0x1 - IFNAMSIZ = 0x10 - IFT_1822 = 0x2 - IFT_AAL5 = 0x31 - IFT_ARCNET = 0x23 - IFT_ARCNETPLUS = 0x24 - IFT_ATM = 0x25 - IFT_BRIDGE = 0xd1 - IFT_CARP = 0xf8 - IFT_CELLULAR = 0xff - IFT_CEPT = 0x13 - IFT_DS3 = 0x1e - IFT_ENC = 0xf4 - IFT_EON = 0x19 - IFT_ETHER = 0x6 - IFT_FAITH = 0x38 - IFT_FDDI = 0xf - IFT_FRELAY = 0x20 - IFT_FRELAYDCE = 0x2c - IFT_GIF = 0x37 - IFT_HDH1822 = 0x3 - IFT_HIPPI = 0x2f - IFT_HSSI = 0x2e - IFT_HY = 0xe - IFT_IEEE1394 = 0x90 - IFT_IEEE8023ADLAG = 0x88 - IFT_ISDNBASIC = 0x14 - IFT_ISDNPRIMARY = 0x15 - IFT_ISO88022LLC = 0x29 - IFT_ISO88023 = 0x7 - IFT_ISO88024 = 0x8 - IFT_ISO88025 = 0x9 - IFT_ISO88026 = 0xa - IFT_L2VLAN = 0x87 - IFT_LAPB = 0x10 - IFT_LOCALTALK = 0x2a - IFT_LOOP = 0x18 - IFT_MIOX25 = 0x26 - IFT_MODEM = 0x30 - IFT_NSIP = 0x1b - IFT_OTHER = 0x1 - IFT_P10 = 0xc - IFT_P80 = 0xd - IFT_PARA = 0x22 - IFT_PDP = 0xff - IFT_PFLOG = 0xf5 - IFT_PFSYNC = 0xf6 - IFT_PKTAP = 0xfe - IFT_PPP = 0x17 - IFT_PROPMUX = 0x36 - IFT_PROPVIRTUAL = 0x35 - IFT_PTPSERIAL = 0x16 - IFT_RS232 = 0x21 - IFT_SDLC = 0x11 - IFT_SIP = 0x1f - IFT_SLIP = 0x1c - IFT_SMDSDXI = 0x2b - IFT_SMDSICIP = 0x34 - IFT_SONET = 0x27 - IFT_SONETPATH = 0x32 - IFT_SONETVT = 0x33 - IFT_STARLAN = 0xb - IFT_STF = 0x39 - IFT_T1 = 0x12 - IFT_ULTRA = 0x1d - IFT_V35 = 0x2d - IFT_X25 = 0x5 - IFT_X25DDN = 0x4 - IFT_X25PLE = 0x28 - IFT_XETHER = 0x1a - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 - IN_CLASSA_HOST = 0xffffff - IN_CLASSA_MAX = 0x80 - IN_CLASSA_NET = 0xff000000 - IN_CLASSA_NSHIFT = 0x18 - IN_CLASSB_HOST = 0xffff - IN_CLASSB_MAX = 0x10000 - IN_CLASSB_NET = 0xffff0000 - IN_CLASSB_NSHIFT = 0x10 - IN_CLASSC_HOST = 0xff - IN_CLASSC_NET = 0xffffff00 - IN_CLASSC_NSHIFT = 0x8 - IN_CLASSD_HOST = 0xfffffff - IN_CLASSD_NET = 0xf0000000 - IN_CLASSD_NSHIFT = 0x1c - IN_LINKLOCALNETNUM = 0xa9fe0000 - IN_LOOPBACKNET = 0x7f - IPPROTO_3PC = 0x22 - IPPROTO_ADFS = 0x44 - IPPROTO_AH = 0x33 - IPPROTO_AHIP = 0x3d - IPPROTO_APES = 0x63 - IPPROTO_ARGUS = 0xd - IPPROTO_AX25 = 0x5d - IPPROTO_BHA = 0x31 - IPPROTO_BLT = 0x1e - IPPROTO_BRSATMON = 0x4c - IPPROTO_CFTP = 0x3e - IPPROTO_CHAOS = 0x10 - IPPROTO_CMTP = 0x26 - IPPROTO_CPHB = 0x49 - IPPROTO_CPNX = 0x48 - IPPROTO_DDP = 0x25 - IPPROTO_DGP = 0x56 - IPPROTO_DIVERT = 0xfe - IPPROTO_DONE = 0x101 - IPPROTO_DSTOPTS = 0x3c - IPPROTO_EGP = 0x8 - IPPROTO_EMCON = 0xe - IPPROTO_ENCAP = 0x62 - IPPROTO_EON = 0x50 - IPPROTO_ESP = 0x32 - IPPROTO_ETHERIP = 0x61 - IPPROTO_FRAGMENT = 0x2c - IPPROTO_GGP = 0x3 - IPPROTO_GMTP = 0x64 - IPPROTO_GRE = 0x2f - IPPROTO_HELLO = 0x3f - IPPROTO_HMP = 0x14 - IPPROTO_HOPOPTS = 0x0 - IPPROTO_ICMP = 0x1 - IPPROTO_ICMPV6 = 0x3a - IPPROTO_IDP = 0x16 - IPPROTO_IDPR = 0x23 - IPPROTO_IDRP = 0x2d - IPPROTO_IGMP = 0x2 - IPPROTO_IGP = 0x55 - IPPROTO_IGRP = 0x58 - IPPROTO_IL = 0x28 - IPPROTO_INLSP = 0x34 - IPPROTO_INP = 0x20 - IPPROTO_IP = 0x0 - IPPROTO_IPCOMP = 0x6c - IPPROTO_IPCV = 0x47 - IPPROTO_IPEIP = 0x5e - IPPROTO_IPIP = 0x4 - IPPROTO_IPPC = 0x43 - IPPROTO_IPV4 = 0x4 - IPPROTO_IPV6 = 0x29 - IPPROTO_IRTP = 0x1c - IPPROTO_KRYPTOLAN = 0x41 - IPPROTO_LARP = 0x5b - IPPROTO_LEAF1 = 0x19 - IPPROTO_LEAF2 = 0x1a - IPPROTO_MAX = 0x100 - IPPROTO_MAXID = 0x34 - IPPROTO_MEAS = 0x13 - IPPROTO_MHRP = 0x30 - IPPROTO_MICP = 0x5f - IPPROTO_MTP = 0x5c - IPPROTO_MUX = 0x12 - IPPROTO_ND = 0x4d - IPPROTO_NHRP = 0x36 - IPPROTO_NONE = 0x3b - IPPROTO_NSP = 0x1f - IPPROTO_NVPII = 0xb - IPPROTO_OSPFIGP = 0x59 - IPPROTO_PGM = 0x71 - IPPROTO_PIGP = 0x9 - IPPROTO_PIM = 0x67 - IPPROTO_PRM = 0x15 - IPPROTO_PUP = 0xc - IPPROTO_PVP = 0x4b - IPPROTO_RAW = 0xff - IPPROTO_RCCMON = 0xa - IPPROTO_RDP = 0x1b - IPPROTO_ROUTING = 0x2b - IPPROTO_RSVP = 0x2e - IPPROTO_RVD = 0x42 - IPPROTO_SATEXPAK = 0x40 - IPPROTO_SATMON = 0x45 - IPPROTO_SCCSP = 0x60 - IPPROTO_SCTP = 0x84 - IPPROTO_SDRP = 0x2a - IPPROTO_SEP = 0x21 - IPPROTO_SRPC = 0x5a - IPPROTO_ST = 0x7 - IPPROTO_SVMTP = 0x52 - IPPROTO_SWIPE = 0x35 - IPPROTO_TCF = 0x57 - IPPROTO_TCP = 0x6 - IPPROTO_TP = 0x1d - IPPROTO_TPXX = 0x27 - IPPROTO_TRUNK1 = 0x17 - IPPROTO_TRUNK2 = 0x18 - IPPROTO_TTP = 0x54 - IPPROTO_UDP = 0x11 - IPPROTO_VINES = 0x53 - IPPROTO_VISA = 0x46 - IPPROTO_VMTP = 0x51 - IPPROTO_WBEXPAK = 0x4f - IPPROTO_WBMON = 0x4e - IPPROTO_WSN = 0x4a - IPPROTO_XNET = 0xf - IPPROTO_XTP = 0x24 - IPV6_2292DSTOPTS = 0x17 - IPV6_2292HOPLIMIT = 0x14 - IPV6_2292HOPOPTS = 0x16 - IPV6_2292NEXTHOP = 0x15 - IPV6_2292PKTINFO = 0x13 - IPV6_2292PKTOPTIONS = 0x19 - IPV6_2292RTHDR = 0x18 - IPV6_BINDV6ONLY = 0x1b - IPV6_BOUND_IF = 0x7d - IPV6_CHECKSUM = 0x1a - IPV6_DEFAULT_MULTICAST_HOPS = 0x1 - IPV6_DEFAULT_MULTICAST_LOOP = 0x1 - IPV6_DEFHLIM = 0x40 - IPV6_FAITH = 0x1d - IPV6_FLOWINFO_MASK = 0xffffff0f - IPV6_FLOWLABEL_MASK = 0xffff0f00 - IPV6_FRAGTTL = 0x3c - IPV6_FW_ADD = 0x1e - IPV6_FW_DEL = 0x1f - IPV6_FW_FLUSH = 0x20 - IPV6_FW_GET = 0x22 - IPV6_FW_ZERO = 0x21 - IPV6_HLIMDEC = 0x1 - IPV6_IPSEC_POLICY = 0x1c - IPV6_JOIN_GROUP = 0xc - IPV6_LEAVE_GROUP = 0xd - IPV6_MAXHLIM = 0xff - IPV6_MAXOPTHDR = 0x800 - IPV6_MAXPACKET = 0xffff - IPV6_MAX_GROUP_SRC_FILTER = 0x200 - IPV6_MAX_MEMBERSHIPS = 0xfff - IPV6_MAX_SOCK_SRC_FILTER = 0x80 - IPV6_MIN_MEMBERSHIPS = 0x1f - IPV6_MMTU = 0x500 - IPV6_MULTICAST_HOPS = 0xa - IPV6_MULTICAST_IF = 0x9 - IPV6_MULTICAST_LOOP = 0xb - IPV6_PORTRANGE = 0xe - IPV6_PORTRANGE_DEFAULT = 0x0 - IPV6_PORTRANGE_HIGH = 0x1 - IPV6_PORTRANGE_LOW = 0x2 - IPV6_RECVTCLASS = 0x23 - IPV6_RTHDR_LOOSE = 0x0 - IPV6_RTHDR_STRICT = 0x1 - IPV6_RTHDR_TYPE_0 = 0x0 - IPV6_SOCKOPT_RESERVED1 = 0x3 - IPV6_TCLASS = 0x24 - IPV6_UNICAST_HOPS = 0x4 - IPV6_V6ONLY = 0x1b - IPV6_VERSION = 0x60 - IPV6_VERSION_MASK = 0xf0 - IP_ADD_MEMBERSHIP = 0xc - IP_ADD_SOURCE_MEMBERSHIP = 0x46 - IP_BLOCK_SOURCE = 0x48 - IP_BOUND_IF = 0x19 - IP_DEFAULT_MULTICAST_LOOP = 0x1 - IP_DEFAULT_MULTICAST_TTL = 0x1 - IP_DF = 0x4000 - IP_DROP_MEMBERSHIP = 0xd - IP_DROP_SOURCE_MEMBERSHIP = 0x47 - IP_DUMMYNET_CONFIGURE = 0x3c - IP_DUMMYNET_DEL = 0x3d - IP_DUMMYNET_FLUSH = 0x3e - IP_DUMMYNET_GET = 0x40 - IP_FAITH = 0x16 - IP_FW_ADD = 0x28 - IP_FW_DEL = 0x29 - IP_FW_FLUSH = 0x2a - IP_FW_GET = 0x2c - IP_FW_RESETLOG = 0x2d - IP_FW_ZERO = 0x2b - IP_HDRINCL = 0x2 - IP_IPSEC_POLICY = 0x15 - IP_MAXPACKET = 0xffff - IP_MAX_GROUP_SRC_FILTER = 0x200 - IP_MAX_MEMBERSHIPS = 0xfff - IP_MAX_SOCK_MUTE_FILTER = 0x80 - IP_MAX_SOCK_SRC_FILTER = 0x80 - IP_MF = 0x2000 - IP_MIN_MEMBERSHIPS = 0x1f - IP_MSFILTER = 0x4a - IP_MSS = 0x240 - IP_MULTICAST_IF = 0x9 - IP_MULTICAST_IFINDEX = 0x42 - IP_MULTICAST_LOOP = 0xb - IP_MULTICAST_TTL = 0xa - IP_MULTICAST_VIF = 0xe - IP_NAT__XXX = 0x37 - IP_OFFMASK = 0x1fff - IP_OLD_FW_ADD = 0x32 - IP_OLD_FW_DEL = 0x33 - IP_OLD_FW_FLUSH = 0x34 - IP_OLD_FW_GET = 0x36 - IP_OLD_FW_RESETLOG = 0x38 - IP_OLD_FW_ZERO = 0x35 - IP_OPTIONS = 0x1 - IP_PKTINFO = 0x1a - IP_PORTRANGE = 0x13 - IP_PORTRANGE_DEFAULT = 0x0 - IP_PORTRANGE_HIGH = 0x1 - IP_PORTRANGE_LOW = 0x2 - IP_RECVDSTADDR = 0x7 - IP_RECVIF = 0x14 - IP_RECVOPTS = 0x5 - IP_RECVPKTINFO = 0x1a - IP_RECVRETOPTS = 0x6 - IP_RECVTTL = 0x18 - IP_RETOPTS = 0x8 - IP_RF = 0x8000 - IP_RSVP_OFF = 0x10 - IP_RSVP_ON = 0xf - IP_RSVP_VIF_OFF = 0x12 - IP_RSVP_VIF_ON = 0x11 - IP_STRIPHDR = 0x17 - IP_TOS = 0x3 - IP_TRAFFIC_MGT_BACKGROUND = 0x41 - IP_TTL = 0x4 - IP_UNBLOCK_SOURCE = 0x49 - ISIG = 0x80 - ISTRIP = 0x20 - IUTF8 = 0x4000 - IXANY = 0x800 - IXOFF = 0x400 - IXON = 0x200 - LOCK_EX = 0x2 - LOCK_NB = 0x4 - LOCK_SH = 0x1 - LOCK_UN = 0x8 - MADV_CAN_REUSE = 0x9 - MADV_DONTNEED = 0x4 - MADV_FREE = 0x5 - MADV_FREE_REUSABLE = 0x7 - MADV_FREE_REUSE = 0x8 - MADV_NORMAL = 0x0 - MADV_RANDOM = 0x1 - MADV_SEQUENTIAL = 0x2 - MADV_WILLNEED = 0x3 - MADV_ZERO_WIRED_PAGES = 0x6 - MAP_ANON = 0x1000 - MAP_COPY = 0x2 - MAP_FILE = 0x0 - MAP_FIXED = 0x10 - MAP_HASSEMAPHORE = 0x200 - MAP_JIT = 0x800 - MAP_NOCACHE = 0x400 - MAP_NOEXTEND = 0x100 - MAP_NORESERVE = 0x40 - MAP_PRIVATE = 0x2 - MAP_RENAME = 0x20 - MAP_RESERVED0080 = 0x80 - MAP_SHARED = 0x1 - MCL_CURRENT = 0x1 - MCL_FUTURE = 0x2 - MSG_CTRUNC = 0x20 - MSG_DONTROUTE = 0x4 - MSG_DONTWAIT = 0x80 - MSG_EOF = 0x100 - MSG_EOR = 0x8 - MSG_FLUSH = 0x400 - MSG_HAVEMORE = 0x2000 - MSG_HOLD = 0x800 - MSG_NEEDSA = 0x10000 - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_RCVMORE = 0x4000 - MSG_SEND = 0x1000 - MSG_TRUNC = 0x10 - MSG_WAITALL = 0x40 - MSG_WAITSTREAM = 0x200 - MS_ASYNC = 0x1 - MS_DEACTIVATE = 0x8 - MS_INVALIDATE = 0x2 - MS_KILLPAGES = 0x4 - MS_SYNC = 0x10 - NAME_MAX = 0xff - NET_RT_DUMP = 0x1 - NET_RT_DUMP2 = 0x7 - NET_RT_FLAGS = 0x2 - NET_RT_IFLIST = 0x3 - NET_RT_IFLIST2 = 0x6 - NET_RT_MAXID = 0xa - NET_RT_STAT = 0x4 - NET_RT_TRASH = 0x5 - NOFLSH = 0x80000000 - NOTE_ABSOLUTE = 0x8 - NOTE_ATTRIB = 0x8 - NOTE_BACKGROUND = 0x40 - NOTE_CHILD = 0x4 - NOTE_CRITICAL = 0x20 - NOTE_DELETE = 0x1 - NOTE_EXEC = 0x20000000 - NOTE_EXIT = 0x80000000 - NOTE_EXITSTATUS = 0x4000000 - NOTE_EXIT_CSERROR = 0x40000 - NOTE_EXIT_DECRYPTFAIL = 0x10000 - NOTE_EXIT_DETAIL = 0x2000000 - NOTE_EXIT_DETAIL_MASK = 0x70000 - NOTE_EXIT_MEMORY = 0x20000 - NOTE_EXIT_REPARENTED = 0x80000 - NOTE_EXTEND = 0x4 - NOTE_FFAND = 0x40000000 - NOTE_FFCOPY = 0xc0000000 - NOTE_FFCTRLMASK = 0xc0000000 - NOTE_FFLAGSMASK = 0xffffff - NOTE_FFNOP = 0x0 - NOTE_FFOR = 0x80000000 - NOTE_FORK = 0x40000000 - NOTE_LEEWAY = 0x10 - NOTE_LINK = 0x10 - NOTE_LOWAT = 0x1 - NOTE_NONE = 0x80 - NOTE_NSECONDS = 0x4 - NOTE_PCTRLMASK = -0x100000 - NOTE_PDATAMASK = 0xfffff - NOTE_REAP = 0x10000000 - NOTE_RENAME = 0x20 - NOTE_REVOKE = 0x40 - NOTE_SECONDS = 0x1 - NOTE_SIGNAL = 0x8000000 - NOTE_TRACK = 0x1 - NOTE_TRACKERR = 0x2 - NOTE_TRIGGER = 0x1000000 - NOTE_USECONDS = 0x2 - NOTE_VM_ERROR = 0x10000000 - NOTE_VM_PRESSURE = 0x80000000 - NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000 - NOTE_VM_PRESSURE_TERMINATE = 0x40000000 - NOTE_WRITE = 0x2 - OCRNL = 0x10 - OFDEL = 0x20000 - OFILL = 0x80 - ONLCR = 0x2 - ONLRET = 0x40 - ONOCR = 0x20 - ONOEOT = 0x8 - OPOST = 0x1 - O_ACCMODE = 0x3 - O_ALERT = 0x20000000 - O_APPEND = 0x8 - O_ASYNC = 0x40 - O_CLOEXEC = 0x1000000 - O_CREAT = 0x200 - O_DIRECTORY = 0x100000 - O_DP_GETRAWENCRYPTED = 0x1 - O_DSYNC = 0x400000 - O_EVTONLY = 0x8000 - O_EXCL = 0x800 - O_EXLOCK = 0x20 - O_FSYNC = 0x80 - O_NDELAY = 0x4 - O_NOCTTY = 0x20000 - O_NOFOLLOW = 0x100 - O_NONBLOCK = 0x4 - O_POPUP = 0x80000000 - O_RDONLY = 0x0 - O_RDWR = 0x2 - O_SHLOCK = 0x10 - O_SYMLINK = 0x200000 - O_SYNC = 0x80 - O_TRUNC = 0x400 - O_WRONLY = 0x1 - PARENB = 0x1000 - PARMRK = 0x8 - PARODD = 0x2000 - PENDIN = 0x20000000 - PRIO_PGRP = 0x1 - PRIO_PROCESS = 0x0 - PRIO_USER = 0x2 - PROT_EXEC = 0x4 - PROT_NONE = 0x0 - PROT_READ = 0x1 - PROT_WRITE = 0x2 - PT_ATTACH = 0xa - PT_ATTACHEXC = 0xe - PT_CONTINUE = 0x7 - PT_DENY_ATTACH = 0x1f - PT_DETACH = 0xb - PT_FIRSTMACH = 0x20 - PT_FORCEQUOTA = 0x1e - PT_KILL = 0x8 - PT_READ_D = 0x2 - PT_READ_I = 0x1 - PT_READ_U = 0x3 - PT_SIGEXC = 0xc - PT_STEP = 0x9 - PT_THUPDATE = 0xd - PT_TRACE_ME = 0x0 - PT_WRITE_D = 0x5 - PT_WRITE_I = 0x4 - PT_WRITE_U = 0x6 - RLIMIT_AS = 0x5 - RLIMIT_CORE = 0x4 - RLIMIT_CPU = 0x0 - RLIMIT_CPU_USAGE_MONITOR = 0x2 - RLIMIT_DATA = 0x2 - RLIMIT_FSIZE = 0x1 - RLIMIT_NOFILE = 0x8 - RLIMIT_STACK = 0x3 - RLIM_INFINITY = 0x7fffffffffffffff - RTAX_AUTHOR = 0x6 - RTAX_BRD = 0x7 - RTAX_DST = 0x0 - RTAX_GATEWAY = 0x1 - RTAX_GENMASK = 0x3 - RTAX_IFA = 0x5 - RTAX_IFP = 0x4 - RTAX_MAX = 0x8 - RTAX_NETMASK = 0x2 - RTA_AUTHOR = 0x40 - RTA_BRD = 0x80 - RTA_DST = 0x1 - RTA_GATEWAY = 0x2 - RTA_GENMASK = 0x8 - RTA_IFA = 0x20 - RTA_IFP = 0x10 - RTA_NETMASK = 0x4 - RTF_BLACKHOLE = 0x1000 - RTF_BROADCAST = 0x400000 - RTF_CLONING = 0x100 - RTF_CONDEMNED = 0x2000000 - RTF_DELCLONE = 0x80 - RTF_DONE = 0x40 - RTF_DYNAMIC = 0x10 - RTF_GATEWAY = 0x2 - RTF_HOST = 0x4 - RTF_IFREF = 0x4000000 - RTF_IFSCOPE = 0x1000000 - RTF_LLINFO = 0x400 - RTF_LOCAL = 0x200000 - RTF_MODIFIED = 0x20 - RTF_MULTICAST = 0x800000 - RTF_NOIFREF = 0x2000 - RTF_PINNED = 0x100000 - RTF_PRCLONING = 0x10000 - RTF_PROTO1 = 0x8000 - RTF_PROTO2 = 0x4000 - RTF_PROTO3 = 0x40000 - RTF_PROXY = 0x8000000 - RTF_REJECT = 0x8 - RTF_ROUTER = 0x10000000 - RTF_STATIC = 0x800 - RTF_UP = 0x1 - RTF_WASCLONED = 0x20000 - RTF_XRESOLVE = 0x200 - RTM_ADD = 0x1 - RTM_CHANGE = 0x3 - RTM_DELADDR = 0xd - RTM_DELETE = 0x2 - RTM_DELMADDR = 0x10 - RTM_GET = 0x4 - RTM_GET2 = 0x14 - RTM_IFINFO = 0xe - RTM_IFINFO2 = 0x12 - RTM_LOCK = 0x8 - RTM_LOSING = 0x5 - RTM_MISS = 0x7 - RTM_NEWADDR = 0xc - RTM_NEWMADDR = 0xf - RTM_NEWMADDR2 = 0x13 - RTM_OLDADD = 0x9 - RTM_OLDDEL = 0xa - RTM_REDIRECT = 0x6 - RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 - RTM_VERSION = 0x5 - RTV_EXPIRE = 0x4 - RTV_HOPCOUNT = 0x2 - RTV_MTU = 0x1 - RTV_RPIPE = 0x8 - RTV_RTT = 0x40 - RTV_RTTVAR = 0x80 - RTV_SPIPE = 0x10 - RTV_SSTHRESH = 0x20 - RUSAGE_CHILDREN = -0x1 - RUSAGE_SELF = 0x0 - SCM_CREDS = 0x3 - SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x2 - SCM_TIMESTAMP_MONOTONIC = 0x4 - SHUT_RD = 0x0 - SHUT_RDWR = 0x2 - SHUT_WR = 0x1 - SIOCADDMULTI = 0x80206931 - SIOCAIFADDR = 0x8040691a - SIOCARPIPLL = 0xc0206928 - SIOCATMARK = 0x40047307 - SIOCAUTOADDR = 0xc0206926 - SIOCAUTONETMASK = 0x80206927 - SIOCDELMULTI = 0x80206932 - SIOCDIFADDR = 0x80206919 - SIOCDIFPHYADDR = 0x80206941 - SIOCGDRVSPEC = 0xc028697b - SIOCGETVLAN = 0xc020697f - SIOCGHIWAT = 0x40047301 - SIOCGIFADDR = 0xc0206921 - SIOCGIFALTMTU = 0xc0206948 - SIOCGIFASYNCMAP = 0xc020697c - SIOCGIFBOND = 0xc0206947 - SIOCGIFBRDADDR = 0xc0206923 - SIOCGIFCAP = 0xc020695b - SIOCGIFCONF = 0xc00c6924 - SIOCGIFDEVMTU = 0xc0206944 - SIOCGIFDSTADDR = 0xc0206922 - SIOCGIFFLAGS = 0xc0206911 - SIOCGIFGENERIC = 0xc020693a - SIOCGIFKPI = 0xc0206987 - SIOCGIFMAC = 0xc0206982 - SIOCGIFMEDIA = 0xc02c6938 - SIOCGIFMETRIC = 0xc0206917 - SIOCGIFMTU = 0xc0206933 - SIOCGIFNETMASK = 0xc0206925 - SIOCGIFPDSTADDR = 0xc0206940 - SIOCGIFPHYS = 0xc0206935 - SIOCGIFPSRCADDR = 0xc020693f - SIOCGIFSTATUS = 0xc331693d - SIOCGIFVLAN = 0xc020697f - SIOCGIFWAKEFLAGS = 0xc0206988 - SIOCGLOWAT = 0x40047303 - SIOCGPGRP = 0x40047309 - SIOCIFCREATE = 0xc0206978 - SIOCIFCREATE2 = 0xc020697a - SIOCIFDESTROY = 0x80206979 - SIOCIFGCLONERS = 0xc0106981 - SIOCRSLVMULTI = 0xc010693b - SIOCSDRVSPEC = 0x8028697b - SIOCSETVLAN = 0x8020697e - SIOCSHIWAT = 0x80047300 - SIOCSIFADDR = 0x8020690c - SIOCSIFALTMTU = 0x80206945 - SIOCSIFASYNCMAP = 0x8020697d - SIOCSIFBOND = 0x80206946 - SIOCSIFBRDADDR = 0x80206913 - SIOCSIFCAP = 0x8020695a - SIOCSIFDSTADDR = 0x8020690e - SIOCSIFFLAGS = 0x80206910 - SIOCSIFGENERIC = 0x80206939 - SIOCSIFKPI = 0x80206986 - SIOCSIFLLADDR = 0x8020693c - SIOCSIFMAC = 0x80206983 - SIOCSIFMEDIA = 0xc0206937 - SIOCSIFMETRIC = 0x80206918 - SIOCSIFMTU = 0x80206934 - SIOCSIFNETMASK = 0x80206916 - SIOCSIFPHYADDR = 0x8040693e - SIOCSIFPHYS = 0x80206936 - SIOCSIFVLAN = 0x8020697e - SIOCSLOWAT = 0x80047302 - SIOCSPGRP = 0x80047308 - SOCK_DGRAM = 0x2 - SOCK_MAXADDRLEN = 0xff - SOCK_RAW = 0x3 - SOCK_RDM = 0x4 - SOCK_SEQPACKET = 0x5 - SOCK_STREAM = 0x1 - SOL_SOCKET = 0xffff - SOMAXCONN = 0x80 - SO_ACCEPTCONN = 0x2 - SO_BROADCAST = 0x20 - SO_DEBUG = 0x1 - SO_DONTROUTE = 0x10 - SO_DONTTRUNC = 0x2000 - SO_ERROR = 0x1007 - SO_KEEPALIVE = 0x8 - SO_LABEL = 0x1010 - SO_LINGER = 0x80 - SO_LINGER_SEC = 0x1080 - SO_NKE = 0x1021 - SO_NOADDRERR = 0x1023 - SO_NOSIGPIPE = 0x1022 - SO_NOTIFYCONFLICT = 0x1026 - SO_NP_EXTENSIONS = 0x1083 - SO_NREAD = 0x1020 - SO_NUMRCVPKT = 0x1112 - SO_NWRITE = 0x1024 - SO_OOBINLINE = 0x100 - SO_PEERLABEL = 0x1011 - SO_RANDOMPORT = 0x1082 - SO_RCVBUF = 0x1002 - SO_RCVLOWAT = 0x1004 - SO_RCVTIMEO = 0x1006 - SO_REUSEADDR = 0x4 - SO_REUSEPORT = 0x200 - SO_REUSESHAREUID = 0x1025 - SO_SNDBUF = 0x1001 - SO_SNDLOWAT = 0x1003 - SO_SNDTIMEO = 0x1005 - SO_TIMESTAMP = 0x400 - SO_TIMESTAMP_MONOTONIC = 0x800 - SO_TYPE = 0x1008 - SO_UPCALLCLOSEWAIT = 0x1027 - SO_USELOOPBACK = 0x40 - SO_WANTMORE = 0x4000 - SO_WANTOOBFLAG = 0x8000 - S_IEXEC = 0x40 - S_IFBLK = 0x6000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFIFO = 0x1000 - S_IFLNK = 0xa000 - S_IFMT = 0xf000 - S_IFREG = 0x8000 - S_IFSOCK = 0xc000 - S_IFWHT = 0xe000 - S_IREAD = 0x100 - S_IRGRP = 0x20 - S_IROTH = 0x4 - S_IRUSR = 0x100 - S_IRWXG = 0x38 - S_IRWXO = 0x7 - S_IRWXU = 0x1c0 - S_ISGID = 0x400 - S_ISTXT = 0x200 - S_ISUID = 0x800 - S_ISVTX = 0x200 - S_IWGRP = 0x10 - S_IWOTH = 0x2 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXGRP = 0x8 - S_IXOTH = 0x1 - S_IXUSR = 0x40 - TCIFLUSH = 0x1 - TCIOFLUSH = 0x3 - TCOFLUSH = 0x2 - TCP_CONNECTIONTIMEOUT = 0x20 - TCP_ENABLE_ECN = 0x104 - TCP_KEEPALIVE = 0x10 - TCP_KEEPCNT = 0x102 - TCP_KEEPINTVL = 0x101 - TCP_MAXHLEN = 0x3c - TCP_MAXOLEN = 0x28 - TCP_MAXSEG = 0x2 - TCP_MAXWIN = 0xffff - TCP_MAX_SACK = 0x4 - TCP_MAX_WINSHIFT = 0xe - TCP_MINMSS = 0xd8 - TCP_MSS = 0x200 - TCP_NODELAY = 0x1 - TCP_NOOPT = 0x8 - TCP_NOPUSH = 0x4 - TCP_NOTSENT_LOWAT = 0x201 - TCP_RXT_CONNDROPTIME = 0x80 - TCP_RXT_FINDROP = 0x100 - TCP_SENDMOREACKS = 0x103 - TCSAFLUSH = 0x2 - TIOCCBRK = 0x2000747a - TIOCCDTR = 0x20007478 - TIOCCONS = 0x80047462 - TIOCDCDTIMESTAMP = 0x40107458 - TIOCDRAIN = 0x2000745e - TIOCDSIMICROCODE = 0x20007455 - TIOCEXCL = 0x2000740d - TIOCEXT = 0x80047460 - TIOCFLUSH = 0x80047410 - TIOCGDRAINWAIT = 0x40047456 - TIOCGETA = 0x40487413 - TIOCGETD = 0x4004741a - TIOCGPGRP = 0x40047477 - TIOCGWINSZ = 0x40087468 - TIOCIXOFF = 0x20007480 - TIOCIXON = 0x20007481 - TIOCMBIC = 0x8004746b - TIOCMBIS = 0x8004746c - TIOCMGDTRWAIT = 0x4004745a - TIOCMGET = 0x4004746a - TIOCMODG = 0x40047403 - TIOCMODS = 0x80047404 - TIOCMSDTRWAIT = 0x8004745b - TIOCMSET = 0x8004746d - TIOCM_CAR = 0x40 - TIOCM_CD = 0x40 - TIOCM_CTS = 0x20 - TIOCM_DSR = 0x100 - TIOCM_DTR = 0x2 - TIOCM_LE = 0x1 - TIOCM_RI = 0x80 - TIOCM_RNG = 0x80 - TIOCM_RTS = 0x4 - TIOCM_SR = 0x10 - TIOCM_ST = 0x8 - TIOCNOTTY = 0x20007471 - TIOCNXCL = 0x2000740e - TIOCOUTQ = 0x40047473 - TIOCPKT = 0x80047470 - TIOCPKT_DATA = 0x0 - TIOCPKT_DOSTOP = 0x20 - TIOCPKT_FLUSHREAD = 0x1 - TIOCPKT_FLUSHWRITE = 0x2 - TIOCPKT_IOCTL = 0x40 - TIOCPKT_NOSTOP = 0x10 - TIOCPKT_START = 0x8 - TIOCPKT_STOP = 0x4 - TIOCPTYGNAME = 0x40807453 - TIOCPTYGRANT = 0x20007454 - TIOCPTYUNLK = 0x20007452 - TIOCREMOTE = 0x80047469 - TIOCSBRK = 0x2000747b - TIOCSCONS = 0x20007463 - TIOCSCTTY = 0x20007461 - TIOCSDRAINWAIT = 0x80047457 - TIOCSDTR = 0x20007479 - TIOCSETA = 0x80487414 - TIOCSETAF = 0x80487416 - TIOCSETAW = 0x80487415 - TIOCSETD = 0x8004741b - TIOCSIG = 0x2000745f - TIOCSPGRP = 0x80047476 - TIOCSTART = 0x2000746e - TIOCSTAT = 0x20007465 - TIOCSTI = 0x80017472 - TIOCSTOP = 0x2000746f - TIOCSWINSZ = 0x80087467 - TIOCTIMESTAMP = 0x40107459 - TIOCUCNTL = 0x80047466 - TOSTOP = 0x400000 - VDISCARD = 0xf - VDSUSP = 0xb - VEOF = 0x0 - VEOL = 0x1 - VEOL2 = 0x2 - VERASE = 0x3 - VINTR = 0x8 - VKILL = 0x5 - VLNEXT = 0xe - VMIN = 0x10 - VQUIT = 0x9 - VREPRINT = 0x6 - VSTART = 0xc - VSTATUS = 0x12 - VSTOP = 0xd - VSUSP = 0xa - VT0 = 0x0 - VT1 = 0x10000 - VTDLY = 0x10000 - VTIME = 0x11 - VWERASE = 0x4 - WCONTINUED = 0x10 - WCOREFLAG = 0x80 - WEXITED = 0x4 - WNOHANG = 0x1 - WNOWAIT = 0x20 - WORDSIZE = 0x40 - WSTOPPED = 0x8 - WUNTRACED = 0x2 -) - -// Errors -const ( - E2BIG = syscall.Errno(0x7) - EACCES = syscall.Errno(0xd) - EADDRINUSE = syscall.Errno(0x30) - EADDRNOTAVAIL = syscall.Errno(0x31) - EAFNOSUPPORT = syscall.Errno(0x2f) - EAGAIN = syscall.Errno(0x23) - EALREADY = syscall.Errno(0x25) - EAUTH = syscall.Errno(0x50) - EBADARCH = syscall.Errno(0x56) - EBADEXEC = syscall.Errno(0x55) - EBADF = syscall.Errno(0x9) - EBADMACHO = syscall.Errno(0x58) - EBADMSG = syscall.Errno(0x5e) - EBADRPC = syscall.Errno(0x48) - EBUSY = syscall.Errno(0x10) - ECANCELED = syscall.Errno(0x59) - ECHILD = syscall.Errno(0xa) - ECONNABORTED = syscall.Errno(0x35) - ECONNREFUSED = syscall.Errno(0x3d) - ECONNRESET = syscall.Errno(0x36) - EDEADLK = syscall.Errno(0xb) - EDESTADDRREQ = syscall.Errno(0x27) - EDEVERR = syscall.Errno(0x53) - EDOM = syscall.Errno(0x21) - EDQUOT = syscall.Errno(0x45) - EEXIST = syscall.Errno(0x11) - EFAULT = syscall.Errno(0xe) - EFBIG = syscall.Errno(0x1b) - EFTYPE = syscall.Errno(0x4f) - EHOSTDOWN = syscall.Errno(0x40) - EHOSTUNREACH = syscall.Errno(0x41) - EIDRM = syscall.Errno(0x5a) - EILSEQ = syscall.Errno(0x5c) - EINPROGRESS = syscall.Errno(0x24) - EINTR = syscall.Errno(0x4) - EINVAL = syscall.Errno(0x16) - EIO = syscall.Errno(0x5) - EISCONN = syscall.Errno(0x38) - EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x6a) - ELOOP = syscall.Errno(0x3e) - EMFILE = syscall.Errno(0x18) - EMLINK = syscall.Errno(0x1f) - EMSGSIZE = syscall.Errno(0x28) - EMULTIHOP = syscall.Errno(0x5f) - ENAMETOOLONG = syscall.Errno(0x3f) - ENEEDAUTH = syscall.Errno(0x51) - ENETDOWN = syscall.Errno(0x32) - ENETRESET = syscall.Errno(0x34) - ENETUNREACH = syscall.Errno(0x33) - ENFILE = syscall.Errno(0x17) - ENOATTR = syscall.Errno(0x5d) - ENOBUFS = syscall.Errno(0x37) - ENODATA = syscall.Errno(0x60) - ENODEV = syscall.Errno(0x13) - ENOENT = syscall.Errno(0x2) - ENOEXEC = syscall.Errno(0x8) - ENOLCK = syscall.Errno(0x4d) - ENOLINK = syscall.Errno(0x61) - ENOMEM = syscall.Errno(0xc) - ENOMSG = syscall.Errno(0x5b) - ENOPOLICY = syscall.Errno(0x67) - ENOPROTOOPT = syscall.Errno(0x2a) - ENOSPC = syscall.Errno(0x1c) - ENOSR = syscall.Errno(0x62) - ENOSTR = syscall.Errno(0x63) - ENOSYS = syscall.Errno(0x4e) - ENOTBLK = syscall.Errno(0xf) - ENOTCONN = syscall.Errno(0x39) - ENOTDIR = syscall.Errno(0x14) - ENOTEMPTY = syscall.Errno(0x42) - ENOTRECOVERABLE = syscall.Errno(0x68) - ENOTSOCK = syscall.Errno(0x26) - ENOTSUP = syscall.Errno(0x2d) - ENOTTY = syscall.Errno(0x19) - ENXIO = syscall.Errno(0x6) - EOPNOTSUPP = syscall.Errno(0x66) - EOVERFLOW = syscall.Errno(0x54) - EOWNERDEAD = syscall.Errno(0x69) - EPERM = syscall.Errno(0x1) - EPFNOSUPPORT = syscall.Errno(0x2e) - EPIPE = syscall.Errno(0x20) - EPROCLIM = syscall.Errno(0x43) - EPROCUNAVAIL = syscall.Errno(0x4c) - EPROGMISMATCH = syscall.Errno(0x4b) - EPROGUNAVAIL = syscall.Errno(0x4a) - EPROTO = syscall.Errno(0x64) - EPROTONOSUPPORT = syscall.Errno(0x2b) - EPROTOTYPE = syscall.Errno(0x29) - EPWROFF = syscall.Errno(0x52) - EQFULL = syscall.Errno(0x6a) - ERANGE = syscall.Errno(0x22) - EREMOTE = syscall.Errno(0x47) - EROFS = syscall.Errno(0x1e) - ERPCMISMATCH = syscall.Errno(0x49) - ESHLIBVERS = syscall.Errno(0x57) - ESHUTDOWN = syscall.Errno(0x3a) - ESOCKTNOSUPPORT = syscall.Errno(0x2c) - ESPIPE = syscall.Errno(0x1d) - ESRCH = syscall.Errno(0x3) - ESTALE = syscall.Errno(0x46) - ETIME = syscall.Errno(0x65) - ETIMEDOUT = syscall.Errno(0x3c) - ETOOMANYREFS = syscall.Errno(0x3b) - ETXTBSY = syscall.Errno(0x1a) - EUSERS = syscall.Errno(0x44) - EWOULDBLOCK = syscall.Errno(0x23) - EXDEV = syscall.Errno(0x12) -) - -// Signals -const ( - SIGABRT = syscall.Signal(0x6) - SIGALRM = syscall.Signal(0xe) - SIGBUS = syscall.Signal(0xa) - SIGCHLD = syscall.Signal(0x14) - SIGCONT = syscall.Signal(0x13) - SIGEMT = syscall.Signal(0x7) - SIGFPE = syscall.Signal(0x8) - SIGHUP = syscall.Signal(0x1) - SIGILL = syscall.Signal(0x4) - SIGINFO = syscall.Signal(0x1d) - SIGINT = syscall.Signal(0x2) - SIGIO = syscall.Signal(0x17) - SIGIOT = syscall.Signal(0x6) - SIGKILL = syscall.Signal(0x9) - SIGPIPE = syscall.Signal(0xd) - SIGPROF = syscall.Signal(0x1b) - SIGQUIT = syscall.Signal(0x3) - SIGSEGV = syscall.Signal(0xb) - SIGSTOP = syscall.Signal(0x11) - SIGSYS = syscall.Signal(0xc) - SIGTERM = syscall.Signal(0xf) - SIGTRAP = syscall.Signal(0x5) - SIGTSTP = syscall.Signal(0x12) - SIGTTIN = syscall.Signal(0x15) - SIGTTOU = syscall.Signal(0x16) - SIGURG = syscall.Signal(0x10) - SIGUSR1 = syscall.Signal(0x1e) - SIGUSR2 = syscall.Signal(0x1f) - SIGVTALRM = syscall.Signal(0x1a) - SIGWINCH = syscall.Signal(0x1c) - SIGXCPU = syscall.Signal(0x18) - SIGXFSZ = syscall.Signal(0x19) -) - -// Error table -var errors = [...]string{ - 1: "operation not permitted", - 2: "no such file or directory", - 3: "no such process", - 4: "interrupted system call", - 5: "input/output error", - 6: "device not configured", - 7: "argument list too long", - 8: "exec format error", - 9: "bad file descriptor", - 10: "no child processes", - 11: "resource deadlock avoided", - 12: "cannot allocate memory", - 13: "permission denied", - 14: "bad address", - 15: "block device required", - 16: "resource busy", - 17: "file exists", - 18: "cross-device link", - 19: "operation not supported by device", - 20: "not a directory", - 21: "is a directory", - 22: "invalid argument", - 23: "too many open files in system", - 24: "too many open files", - 25: "inappropriate ioctl for device", - 26: "text file busy", - 27: "file too large", - 28: "no space left on device", - 29: "illegal seek", - 30: "read-only file system", - 31: "too many links", - 32: "broken pipe", - 33: "numerical argument out of domain", - 34: "result too large", - 35: "resource temporarily unavailable", - 36: "operation now in progress", - 37: "operation already in progress", - 38: "socket operation on non-socket", - 39: "destination address required", - 40: "message too long", - 41: "protocol wrong type for socket", - 42: "protocol not available", - 43: "protocol not supported", - 44: "socket type not supported", - 45: "operation not supported", - 46: "protocol family not supported", - 47: "address family not supported by protocol family", - 48: "address already in use", - 49: "can't assign requested address", - 50: "network is down", - 51: "network is unreachable", - 52: "network dropped connection on reset", - 53: "software caused connection abort", - 54: "connection reset by peer", - 55: "no buffer space available", - 56: "socket is already connected", - 57: "socket is not connected", - 58: "can't send after socket shutdown", - 59: "too many references: can't splice", - 60: "operation timed out", - 61: "connection refused", - 62: "too many levels of symbolic links", - 63: "file name too long", - 64: "host is down", - 65: "no route to host", - 66: "directory not empty", - 67: "too many processes", - 68: "too many users", - 69: "disc quota exceeded", - 70: "stale NFS file handle", - 71: "too many levels of remote in path", - 72: "RPC struct is bad", - 73: "RPC version wrong", - 74: "RPC prog. not avail", - 75: "program version wrong", - 76: "bad procedure for program", - 77: "no locks available", - 78: "function not implemented", - 79: "inappropriate file type or format", - 80: "authentication error", - 81: "need authenticator", - 82: "device power is off", - 83: "device error", - 84: "value too large to be stored in data type", - 85: "bad executable (or shared library)", - 86: "bad CPU type in executable", - 87: "shared library version mismatch", - 88: "malformed Mach-o file", - 89: "operation canceled", - 90: "identifier removed", - 91: "no message of desired type", - 92: "illegal byte sequence", - 93: "attribute not found", - 94: "bad message", - 95: "EMULTIHOP (Reserved)", - 96: "no message available on STREAM", - 97: "ENOLINK (Reserved)", - 98: "no STREAM resources", - 99: "not a STREAM", - 100: "protocol error", - 101: "STREAM ioctl timeout", - 102: "operation not supported on socket", - 103: "policy not found", - 104: "state not recoverable", - 105: "previous owner died", - 106: "interface output queue is full", -} - -// Signal table -var signals = [...]string{ - 1: "hangup", - 2: "interrupt", - 3: "quit", - 4: "illegal instruction", - 5: "trace/BPT trap", - 6: "abort trap", - 7: "EMT trap", - 8: "floating point exception", - 9: "killed", - 10: "bus error", - 11: "segmentation fault", - 12: "bad system call", - 13: "broken pipe", - 14: "alarm clock", - 15: "terminated", - 16: "urgent I/O condition", - 17: "suspended (signal)", - 18: "suspended", - 19: "continued", - 20: "child exited", - 21: "stopped (tty input)", - 22: "stopped (tty output)", - 23: "I/O possible", - 24: "cputime limit exceeded", - 25: "filesize limit exceeded", - 26: "virtual timer expired", - 27: "profiling timer expired", - 28: "window size changes", - 29: "information request", - 30: "user defined signal 1", - 31: "user defined signal 2", -} diff --git a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_386.go b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_386.go index 2a329f06e2..85988c0eaf 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_386.go @@ -1,8 +1,6 @@ // mkerrors.sh -m32 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build 386,dragonfly - // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -m32 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go index 0feceee151..914fa96a78 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go @@ -1,8 +1,6 @@ // mkerrors.sh -m64 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build amd64,dragonfly - // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go index 7b95751c3d..047aad4b7c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go @@ -1,8 +1,6 @@ // mkerrors.sh -m32 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build 386,freebsd - // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -m32 _const.go @@ -225,20 +223,6 @@ const ( BRKINT = 0x2 CFLUSH = 0xf CLOCAL = 0x8000 - CLOCK_MONOTONIC = 0x4 - CLOCK_MONOTONIC_FAST = 0xc - CLOCK_MONOTONIC_PRECISE = 0xb - CLOCK_PROCESS_CPUTIME_ID = 0xf - CLOCK_PROF = 0x2 - CLOCK_REALTIME = 0x0 - CLOCK_REALTIME_FAST = 0xa - CLOCK_REALTIME_PRECISE = 0x9 - CLOCK_SECOND = 0xd - CLOCK_THREAD_CPUTIME_ID = 0xe - CLOCK_UPTIME = 0x5 - CLOCK_UPTIME_FAST = 0x8 - CLOCK_UPTIME_PRECISE = 0x7 - CLOCK_VIRTUAL = 0x1 CREAD = 0x800 CS5 = 0x0 CS6 = 0x100 @@ -455,9 +439,6 @@ const ( EV_RECEIPT = 0x40 EV_SYSFLAGS = 0xf000 EXTA = 0x4b00 - EXTATTR_NAMESPACE_EMPTY = 0x0 - EXTATTR_NAMESPACE_SYSTEM = 0x2 - EXTATTR_NAMESPACE_USER = 0x1 EXTB = 0x9600 EXTPROC = 0x800 FD_CLOEXEC = 0x1 @@ -783,7 +764,6 @@ const ( IPPROTO_GMTP = 0x64 IPPROTO_GRE = 0x2f IPPROTO_HELLO = 0x3f - IPPROTO_HIP = 0x8b IPPROTO_HMP = 0x14 IPPROTO_HOPOPTS = 0x0 IPPROTO_ICMP = 0x1 @@ -837,8 +817,6 @@ const ( IPPROTO_RAW = 0xff IPPROTO_RCCMON = 0xa IPPROTO_RDP = 0x1b - IPPROTO_RESERVED_253 = 0xfd - IPPROTO_RESERVED_254 = 0xfe IPPROTO_ROUTING = 0x2b IPPROTO_RSVP = 0x2e IPPROTO_RVD = 0x42 @@ -849,7 +827,6 @@ const ( IPPROTO_SDRP = 0x2a IPPROTO_SEND = 0x103 IPPROTO_SEP = 0x21 - IPPROTO_SHIM6 = 0x8c IPPROTO_SKIP = 0x39 IPPROTO_SPACER = 0x7fff IPPROTO_SRPC = 0x5a @@ -865,7 +842,6 @@ const ( IPPROTO_TRUNK2 = 0x18 IPPROTO_TTP = 0x54 IPPROTO_UDP = 0x11 - IPPROTO_UDPLITE = 0x88 IPPROTO_VINES = 0x53 IPPROTO_VISA = 0x46 IPPROTO_VMTP = 0x51 @@ -1035,7 +1011,6 @@ const ( MAP_ANON = 0x1000 MAP_ANONYMOUS = 0x1000 MAP_COPY = 0x2 - MAP_EXCL = 0x4000 MAP_FILE = 0x0 MAP_FIXED = 0x10 MAP_HASSEMAPHORE = 0x200 @@ -1216,7 +1191,6 @@ const ( RTV_SPIPE = 0x10 RTV_SSTHRESH = 0x20 RTV_WEIGHT = 0x100 - RT_ALL_FIBS = -0x1 RT_CACHING_CONTEXT = 0x1 RT_DEFAULT_FIB = 0x0 RT_NORTREF = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go index e48e7799a1..7c9411b465 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go @@ -1,8 +1,6 @@ // mkerrors.sh -m64 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build amd64,freebsd - // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -m64 _const.go @@ -225,20 +223,6 @@ const ( BRKINT = 0x2 CFLUSH = 0xf CLOCAL = 0x8000 - CLOCK_MONOTONIC = 0x4 - CLOCK_MONOTONIC_FAST = 0xc - CLOCK_MONOTONIC_PRECISE = 0xb - CLOCK_PROCESS_CPUTIME_ID = 0xf - CLOCK_PROF = 0x2 - CLOCK_REALTIME = 0x0 - CLOCK_REALTIME_FAST = 0xa - CLOCK_REALTIME_PRECISE = 0x9 - CLOCK_SECOND = 0xd - CLOCK_THREAD_CPUTIME_ID = 0xe - CLOCK_UPTIME = 0x5 - CLOCK_UPTIME_FAST = 0x8 - CLOCK_UPTIME_PRECISE = 0x7 - CLOCK_VIRTUAL = 0x1 CREAD = 0x800 CS5 = 0x0 CS6 = 0x100 @@ -455,9 +439,6 @@ const ( EV_RECEIPT = 0x40 EV_SYSFLAGS = 0xf000 EXTA = 0x4b00 - EXTATTR_NAMESPACE_EMPTY = 0x0 - EXTATTR_NAMESPACE_SYSTEM = 0x2 - EXTATTR_NAMESPACE_USER = 0x1 EXTB = 0x9600 EXTPROC = 0x800 FD_CLOEXEC = 0x1 @@ -783,7 +764,6 @@ const ( IPPROTO_GMTP = 0x64 IPPROTO_GRE = 0x2f IPPROTO_HELLO = 0x3f - IPPROTO_HIP = 0x8b IPPROTO_HMP = 0x14 IPPROTO_HOPOPTS = 0x0 IPPROTO_ICMP = 0x1 @@ -837,8 +817,6 @@ const ( IPPROTO_RAW = 0xff IPPROTO_RCCMON = 0xa IPPROTO_RDP = 0x1b - IPPROTO_RESERVED_253 = 0xfd - IPPROTO_RESERVED_254 = 0xfe IPPROTO_ROUTING = 0x2b IPPROTO_RSVP = 0x2e IPPROTO_RVD = 0x42 @@ -849,7 +827,6 @@ const ( IPPROTO_SDRP = 0x2a IPPROTO_SEND = 0x103 IPPROTO_SEP = 0x21 - IPPROTO_SHIM6 = 0x8c IPPROTO_SKIP = 0x39 IPPROTO_SPACER = 0x7fff IPPROTO_SRPC = 0x5a @@ -865,7 +842,6 @@ const ( IPPROTO_TRUNK2 = 0x18 IPPROTO_TTP = 0x54 IPPROTO_UDP = 0x11 - IPPROTO_UDPLITE = 0x88 IPPROTO_VINES = 0x53 IPPROTO_VISA = 0x46 IPPROTO_VMTP = 0x51 @@ -1036,7 +1012,6 @@ const ( MAP_ANON = 0x1000 MAP_ANONYMOUS = 0x1000 MAP_COPY = 0x2 - MAP_EXCL = 0x4000 MAP_FILE = 0x0 MAP_FIXED = 0x10 MAP_HASSEMAPHORE = 0x200 @@ -1092,17 +1067,13 @@ const ( NOTE_FORK = 0x40000000 NOTE_LINK = 0x10 NOTE_LOWAT = 0x1 - NOTE_MSECONDS = 0x2 - NOTE_NSECONDS = 0x8 NOTE_PCTRLMASK = 0xf0000000 NOTE_PDATAMASK = 0xfffff NOTE_RENAME = 0x20 NOTE_REVOKE = 0x40 - NOTE_SECONDS = 0x1 NOTE_TRACK = 0x1 NOTE_TRACKERR = 0x2 NOTE_TRIGGER = 0x1000000 - NOTE_USECONDS = 0x4 NOTE_WRITE = 0x2 OCRNL = 0x10 ONLCR = 0x2 @@ -1221,7 +1192,6 @@ const ( RTV_SPIPE = 0x10 RTV_SSTHRESH = 0x20 RTV_WEIGHT = 0x100 - RT_ALL_FIBS = -0x1 RT_CACHING_CONTEXT = 0x1 RT_DEFAULT_FIB = 0x0 RT_NORTREF = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go index 2afbe2d5ed..f63775b6ac 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go @@ -1,8 +1,6 @@ // mkerrors.sh // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build arm,freebsd - // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- _const.go @@ -134,7 +132,7 @@ const ( BIOCGETZMAX = 0x4004427f BIOCGHDRCMPLT = 0x40044274 BIOCGRSIG = 0x40044272 - BIOCGRTIMEOUT = 0x4008426e + BIOCGRTIMEOUT = 0x4010426e BIOCGSEESENT = 0x40044276 BIOCGSTATS = 0x4008426f BIOCGTSTAMP = 0x40044283 @@ -153,7 +151,7 @@ const ( BIOCSETZBUF = 0x800c4281 BIOCSHDRCMPLT = 0x80044275 BIOCSRSIG = 0x80044273 - BIOCSRTIMEOUT = 0x8008426d + BIOCSRTIMEOUT = 0x8010426d BIOCSSEESENT = 0x80044277 BIOCSTSTAMP = 0x80044284 BIOCVERSION = 0x40044271 @@ -441,9 +439,6 @@ const ( EV_RECEIPT = 0x40 EV_SYSFLAGS = 0xf000 EXTA = 0x4b00 - EXTATTR_NAMESPACE_EMPTY = 0x0 - EXTATTR_NAMESPACE_SYSTEM = 0x2 - EXTATTR_NAMESPACE_USER = 0x1 EXTB = 0x9600 EXTPROC = 0x800 FD_CLOEXEC = 0x1 @@ -769,7 +764,6 @@ const ( IPPROTO_GMTP = 0x64 IPPROTO_GRE = 0x2f IPPROTO_HELLO = 0x3f - IPPROTO_HIP = 0x8b IPPROTO_HMP = 0x14 IPPROTO_HOPOPTS = 0x0 IPPROTO_ICMP = 0x1 @@ -823,8 +817,6 @@ const ( IPPROTO_RAW = 0xff IPPROTO_RCCMON = 0xa IPPROTO_RDP = 0x1b - IPPROTO_RESERVED_253 = 0xfd - IPPROTO_RESERVED_254 = 0xfe IPPROTO_ROUTING = 0x2b IPPROTO_RSVP = 0x2e IPPROTO_RVD = 0x42 @@ -835,7 +827,6 @@ const ( IPPROTO_SDRP = 0x2a IPPROTO_SEND = 0x103 IPPROTO_SEP = 0x21 - IPPROTO_SHIM6 = 0x8c IPPROTO_SKIP = 0x39 IPPROTO_SPACER = 0x7fff IPPROTO_SRPC = 0x5a @@ -851,7 +842,6 @@ const ( IPPROTO_TRUNK2 = 0x18 IPPROTO_TTP = 0x54 IPPROTO_UDP = 0x11 - IPPROTO_UDPLITE = 0x88 IPPROTO_VINES = 0x53 IPPROTO_VISA = 0x46 IPPROTO_VMTP = 0x51 @@ -1021,7 +1011,6 @@ const ( MAP_ANON = 0x1000 MAP_ANONYMOUS = 0x1000 MAP_COPY = 0x2 - MAP_EXCL = 0x4000 MAP_FILE = 0x0 MAP_FIXED = 0x10 MAP_HASSEMAPHORE = 0x200 @@ -1202,7 +1191,6 @@ const ( RTV_SPIPE = 0x10 RTV_SSTHRESH = 0x20 RTV_WEIGHT = 0x100 - RT_ALL_FIBS = -0x1 RT_CACHING_CONTEXT = 0x1 RT_DEFAULT_FIB = 0x0 RT_NORTREF = 0x2 @@ -1416,7 +1404,7 @@ const ( TIOCSTI = 0x80017472 TIOCSTOP = 0x2000746f TIOCSWINSZ = 0x80087467 - TIOCTIMESTAMP = 0x40087459 + TIOCTIMESTAMP = 0x40107459 TIOCUCNTL = 0x80047466 TOSTOP = 0x400000 VDISCARD = 0xf diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index d370be0ecb..e9babdd792 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -1,8 +1,6 @@ // mkerrors.sh -m32 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build 386,linux - // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -m32 _const.go @@ -34,11 +32,10 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x28 + AF_MAX = 0x27 AF_NETBEUI = 0xd AF_NETLINK = 0x10 AF_NETROM = 0x6 - AF_NFC = 0x27 AF_PACKET = 0x11 AF_PHONET = 0x23 AF_PPPOX = 0x18 @@ -60,8 +57,6 @@ const ( ARPHRD_ATM = 0x13 ARPHRD_AX25 = 0x3 ARPHRD_BIF = 0x307 - ARPHRD_CAIF = 0x336 - ARPHRD_CAN = 0x118 ARPHRD_CHAOS = 0x5 ARPHRD_CISCO = 0x201 ARPHRD_CSLIP = 0x101 @@ -87,6 +82,7 @@ const ( ARPHRD_IEEE80211_PRISM = 0x322 ARPHRD_IEEE80211_RADIOTAP = 0x323 ARPHRD_IEEE802154 = 0x324 + ARPHRD_IEEE802154_PHY = 0x325 ARPHRD_IEEE802_TR = 0x320 ARPHRD_INFINIBAND = 0x20 ARPHRD_IPDDP = 0x309 @@ -98,8 +94,6 @@ const ( ARPHRD_METRICOM = 0x17 ARPHRD_NETROM = 0x0 ARPHRD_NONE = 0xfffe - ARPHRD_PHONET = 0x334 - ARPHRD_PHONET_PIPE = 0x335 ARPHRD_PIMREG = 0x30b ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 @@ -114,38 +108,6 @@ const ( ARPHRD_TUNNEL6 = 0x301 ARPHRD_VOID = 0xffff ARPHRD_X25 = 0x10f - B0 = 0x0 - B1000000 = 0x1008 - B110 = 0x3 - B115200 = 0x1002 - B1152000 = 0x1009 - B1200 = 0x9 - B134 = 0x4 - B150 = 0x5 - B1500000 = 0x100a - B1800 = 0xa - B19200 = 0xe - B200 = 0x6 - B2000000 = 0x100b - B230400 = 0x1003 - B2400 = 0xb - B2500000 = 0x100c - B300 = 0x7 - B3000000 = 0x100d - B3500000 = 0x100e - B38400 = 0xf - B4000000 = 0x100f - B460800 = 0x1004 - B4800 = 0xc - B50 = 0x1 - B500000 = 0x1005 - B57600 = 0x1001 - B576000 = 0x1006 - B600 = 0x8 - B75 = 0x2 - B921600 = 0x1007 - B9600 = 0xd - BOTHER = 0x1000 BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 @@ -186,30 +148,6 @@ const ( BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 - BRKINT = 0x2 - BS0 = 0x0 - BS1 = 0x2000 - BSDLY = 0x2000 - CBAUD = 0x100f - CBAUDEX = 0x1000 - CFLUSH = 0xf - CIBAUD = 0x100f0000 - CLOCAL = 0x800 - CLOCK_BOOTTIME = 0x7 - CLOCK_BOOTTIME_ALARM = 0x9 - CLOCK_DEFAULT = 0x0 - CLOCK_EXT = 0x1 - CLOCK_INT = 0x2 - CLOCK_MONOTONIC = 0x1 - CLOCK_MONOTONIC_COARSE = 0x6 - CLOCK_MONOTONIC_RAW = 0x4 - CLOCK_PROCESS_CPUTIME_ID = 0x2 - CLOCK_REALTIME = 0x0 - CLOCK_REALTIME_ALARM = 0x8 - CLOCK_REALTIME_COARSE = 0x5 - CLOCK_THREAD_CPUTIME_ID = 0x3 - CLOCK_TXFROMRX = 0x4 - CLOCK_TXINT = 0x3 CLONE_CHILD_CLEARTID = 0x200000 CLONE_CHILD_SETTID = 0x1000000 CLONE_DETACHED = 0x400000 @@ -232,25 +170,6 @@ const ( CLONE_UNTRACED = 0x800000 CLONE_VFORK = 0x4000 CLONE_VM = 0x100 - CMSPAR = 0x40000000 - CR0 = 0x0 - CR1 = 0x200 - CR2 = 0x400 - CR3 = 0x600 - CRDLY = 0x600 - CREAD = 0x80 - CRTSCTS = 0x80000000 - CS5 = 0x0 - CS6 = 0x10 - CS7 = 0x20 - CS8 = 0x30 - CSIGNAL = 0xff - CSIZE = 0x30 - CSTART = 0x11 - CSTATUS = 0x0 - CSTOP = 0x13 - CSTOPB = 0x40 - CSUSP = 0x1a DT_BLK = 0x6 DT_CHR = 0x2 DT_DIR = 0x4 @@ -260,21 +179,8 @@ const ( DT_SOCK = 0xc DT_UNKNOWN = 0x0 DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x200 - ECHOE = 0x10 - ECHOK = 0x20 - ECHOKE = 0x800 - ECHONL = 0x40 - ECHOPRT = 0x400 - ENCODING_DEFAULT = 0x0 - ENCODING_FM_MARK = 0x3 - ENCODING_FM_SPACE = 0x4 - ENCODING_MANCHESTER = 0x5 - ENCODING_NRZ = 0x1 - ENCODING_NRZI = 0x2 EPOLLERR = 0x8 - EPOLLET = 0x80000000 + EPOLLET = -0x80000000 EPOLLHUP = 0x10 EPOLLIN = 0x1 EPOLLMSG = 0x400 @@ -292,13 +198,10 @@ const ( EPOLL_CTL_MOD = 0x3 EPOLL_NONBLOCK = 0x800 ETH_P_1588 = 0x88f7 - ETH_P_8021AD = 0x88a8 - ETH_P_8021AH = 0x88e7 ETH_P_8021Q = 0x8100 ETH_P_802_2 = 0x4 ETH_P_802_3 = 0x1 ETH_P_AARP = 0x80f3 - ETH_P_AF_IUCV = 0xfbfb ETH_P_ALL = 0x3 ETH_P_AOE = 0x88a2 ETH_P_ARCNET = 0x1a @@ -347,14 +250,10 @@ const ( ETH_P_PPP_SES = 0x8864 ETH_P_PUP = 0x200 ETH_P_PUPAT = 0x201 - ETH_P_QINQ1 = 0x9100 - ETH_P_QINQ2 = 0x9200 - ETH_P_QINQ3 = 0x9300 ETH_P_RARP = 0x8035 ETH_P_SCA = 0x6007 ETH_P_SLOW = 0x8809 ETH_P_SNAP = 0x5 - ETH_P_TDLS = 0x890d ETH_P_TEB = 0x6558 ETH_P_TIPC = 0x88ca ETH_P_TRAILER = 0x1c @@ -362,15 +261,8 @@ const ( ETH_P_WAN_PPP = 0x7 ETH_P_WCCP = 0x883e ETH_P_X25 = 0x805 - EXTA = 0xe - EXTB = 0xf - EXTPROC = 0x10000 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 - FF0 = 0x0 - FF1 = 0x8000 - FFDLY = 0x8000 - FLUSHO = 0x1000 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -404,12 +296,7 @@ const ( F_ULOCK = 0x0 F_UNLCK = 0x2 F_WRLCK = 0x1 - HUPCL = 0x400 - IBSHIFT = 0x10 - ICANON = 0x2 ICMPV6_FILTER = 0x1 - ICRNL = 0x100 - IEXTEN = 0x8000 IFA_F_DADFAILED = 0x8 IFA_F_DEPRECATED = 0x20 IFA_F_HOMEADDRESS = 0x10 @@ -420,57 +307,29 @@ const ( IFA_F_TEMPORARY = 0x1 IFA_F_TENTATIVE = 0x40 IFA_MAX = 0x7 - IFF_802_1Q_VLAN = 0x1 IFF_ALLMULTI = 0x200 IFF_AUTOMEDIA = 0x4000 - IFF_BONDING = 0x20 - IFF_BRIDGE_PORT = 0x4000 IFF_BROADCAST = 0x2 IFF_DEBUG = 0x4 - IFF_DISABLE_NETPOLL = 0x1000 - IFF_DONT_BRIDGE = 0x800 - IFF_DORMANT = 0x20000 IFF_DYNAMIC = 0x8000 - IFF_EBRIDGE = 0x2 - IFF_ECHO = 0x40000 - IFF_ISATAP = 0x80 IFF_LOOPBACK = 0x8 - IFF_LOWER_UP = 0x10000 - IFF_MACVLAN_PORT = 0x2000 IFF_MASTER = 0x400 - IFF_MASTER_8023AD = 0x8 - IFF_MASTER_ALB = 0x10 - IFF_MASTER_ARPMON = 0x100 IFF_MULTICAST = 0x1000 IFF_NOARP = 0x80 IFF_NOTRAILERS = 0x20 IFF_NO_PI = 0x1000 IFF_ONE_QUEUE = 0x2000 - IFF_OVS_DATAPATH = 0x8000 IFF_POINTOPOINT = 0x10 IFF_PORTSEL = 0x2000 IFF_PROMISC = 0x100 IFF_RUNNING = 0x40 IFF_SLAVE = 0x800 - IFF_SLAVE_INACTIVE = 0x4 - IFF_SLAVE_NEEDARP = 0x40 IFF_TAP = 0x2 IFF_TUN = 0x1 IFF_TUN_EXCL = 0x8000 - IFF_TX_SKB_SHARING = 0x10000 - IFF_UNICAST_FLT = 0x20000 IFF_UP = 0x1 IFF_VNET_HDR = 0x4000 - IFF_VOLATILE = 0x70c5a - IFF_WAN_HDLC = 0x200 - IFF_XMIT_DST_RELEASE = 0x400 IFNAMSIZ = 0x10 - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 IN_ACCESS = 0x1 IN_ALL_EVENTS = 0xfff IN_ATTRIB = 0x4 @@ -606,7 +465,6 @@ const ( IP_MSS = 0x240 IP_MTU = 0xe IP_MTU_DISCOVER = 0xa - IP_MULTICAST_ALL = 0x31 IP_MULTICAST_IF = 0x20 IP_MULTICAST_LOOP = 0x22 IP_MULTICAST_TTL = 0x21 @@ -635,13 +493,6 @@ const ( IP_TTL = 0x2 IP_UNBLOCK_SOURCE = 0x25 IP_XFRM_POLICY = 0x11 - ISIG = 0x1 - ISTRIP = 0x20 - IUCLC = 0x200 - IUTF8 = 0x4000 - IXANY = 0x800 - IXOFF = 0x1000 - IXON = 0x400 LINUX_REBOOT_CMD_CAD_OFF = 0x0 LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef LINUX_REBOOT_CMD_HALT = 0xcdef0123 @@ -747,7 +598,6 @@ const ( NETLINK_AUDIT = 0x9 NETLINK_BROADCAST_ERROR = 0x4 NETLINK_CONNECTOR = 0xb - NETLINK_CRYPTO = 0x15 NETLINK_DNRTMSG = 0xe NETLINK_DROP_MEMBERSHIP = 0x2 NETLINK_ECRYPTFS = 0x13 @@ -762,20 +612,16 @@ const ( NETLINK_NFLOG = 0x5 NETLINK_NO_ENOBUFS = 0x5 NETLINK_PKTINFO = 0x3 - NETLINK_RDMA = 0x14 NETLINK_ROUTE = 0x0 NETLINK_SCSITRANSPORT = 0x12 NETLINK_SELINUX = 0x7 NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 - NL0 = 0x0 - NL1 = 0x100 NLA_ALIGNTO = 0x4 NLA_F_NESTED = 0x8000 NLA_F_NET_BYTEORDER = 0x4000 NLA_HDRLEN = 0x4 - NLDLY = 0x100 NLMSG_ALIGNTO = 0x4 NLMSG_DONE = 0x3 NLMSG_ERROR = 0x2 @@ -788,7 +634,6 @@ const ( NLM_F_ATOMIC = 0x400 NLM_F_CREATE = 0x400 NLM_F_DUMP = 0x300 - NLM_F_DUMP_INTR = 0x10 NLM_F_ECHO = 0x8 NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 @@ -796,15 +641,6 @@ const ( NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 - NOFLSH = 0x80 - OCRNL = 0x8 - OFDEL = 0x80 - OFILL = 0x40 - OLCUC = 0x2 - ONLCR = 0x4 - ONLRET = 0x20 - ONOCR = 0x10 - OPOST = 0x1 O_ACCMODE = 0x3 O_APPEND = 0x400 O_ASYNC = 0x2000 @@ -821,7 +657,6 @@ const ( O_NOCTTY = 0x100 O_NOFOLLOW = 0x20000 O_NONBLOCK = 0x800 - O_PATH = 0x200000 O_RDONLY = 0x0 O_RDWR = 0x2 O_RSYNC = 0x101000 @@ -829,49 +664,20 @@ const ( O_TRUNC = 0x200 O_WRONLY = 0x1 PACKET_ADD_MEMBERSHIP = 0x1 - PACKET_AUXDATA = 0x8 PACKET_BROADCAST = 0x1 - PACKET_COPY_THRESH = 0x7 PACKET_DROP_MEMBERSHIP = 0x2 - PACKET_FANOUT = 0x12 - PACKET_FANOUT_CPU = 0x2 - PACKET_FANOUT_FLAG_DEFRAG = 0x8000 - PACKET_FANOUT_HASH = 0x0 - PACKET_FANOUT_LB = 0x1 PACKET_FASTROUTE = 0x6 - PACKET_HDRLEN = 0xb PACKET_HOST = 0x0 PACKET_LOOPBACK = 0x5 - PACKET_LOSS = 0xe PACKET_MR_ALLMULTI = 0x2 PACKET_MR_MULTICAST = 0x0 PACKET_MR_PROMISC = 0x1 - PACKET_MR_UNICAST = 0x3 PACKET_MULTICAST = 0x2 - PACKET_ORIGDEV = 0x9 PACKET_OTHERHOST = 0x3 PACKET_OUTGOING = 0x4 PACKET_RECV_OUTPUT = 0x3 - PACKET_RESERVE = 0xc PACKET_RX_RING = 0x5 PACKET_STATISTICS = 0x6 - PACKET_TIMESTAMP = 0x11 - PACKET_TX_RING = 0xd - PACKET_TX_TIMESTAMP = 0x10 - PACKET_VERSION = 0xa - PACKET_VNET_HDR = 0xf - PARENB = 0x100 - PARITY_CRC16_PR0 = 0x2 - PARITY_CRC16_PR0_CCITT = 0x4 - PARITY_CRC16_PR1 = 0x3 - PARITY_CRC16_PR1_CCITT = 0x5 - PARITY_CRC32_PR0_CCITT = 0x6 - PARITY_CRC32_PR1_CCITT = 0x7 - PARITY_DEFAULT = 0x0 - PARITY_NONE = 0x1 - PARMRK = 0x8 - PARODD = 0x200 - PENDIN = 0x4000 PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -904,7 +710,6 @@ const ( PR_GET_FPEXC = 0xb PR_GET_KEEPCAPS = 0x7 PR_GET_NAME = 0x10 - PR_GET_NO_NEW_PRIVS = 0x27 PR_GET_PDEATHSIG = 0x2 PR_GET_SECCOMP = 0x15 PR_GET_SECUREBITS = 0x1b @@ -924,19 +729,9 @@ const ( PR_SET_FPEMU = 0xa PR_SET_FPEXC = 0xc PR_SET_KEEPCAPS = 0x8 - PR_SET_MM = 0x23 - PR_SET_MM_BRK = 0x7 - PR_SET_MM_END_CODE = 0x2 - PR_SET_MM_END_DATA = 0x4 - PR_SET_MM_START_BRK = 0x6 - PR_SET_MM_START_CODE = 0x1 - PR_SET_MM_START_DATA = 0x3 - PR_SET_MM_START_STACK = 0x5 PR_SET_NAME = 0xf - PR_SET_NO_NEW_PRIVS = 0x26 PR_SET_PDEATHSIG = 0x1 PR_SET_PTRACER = 0x59616d61 - PR_SET_PTRACER_ANY = 0xffffffff PR_SET_SECCOMP = 0x16 PR_SET_SECUREBITS = 0x1c PR_SET_TIMERSLACK = 0x1d @@ -958,8 +753,6 @@ const ( PTRACE_EVENT_EXEC = 0x4 PTRACE_EVENT_EXIT = 0x6 PTRACE_EVENT_FORK = 0x1 - PTRACE_EVENT_SECCOMP = 0x7 - PTRACE_EVENT_STOP = 0x80 PTRACE_EVENT_VFORK = 0x2 PTRACE_EVENT_VFORK_DONE = 0x5 PTRACE_GETEVENTMSG = 0x4201 @@ -969,16 +762,13 @@ const ( PTRACE_GETREGSET = 0x4204 PTRACE_GETSIGINFO = 0x4202 PTRACE_GET_THREAD_AREA = 0x19 - PTRACE_INTERRUPT = 0x4207 PTRACE_KILL = 0x8 - PTRACE_LISTEN = 0x4208 PTRACE_OLDSETOPTIONS = 0x15 - PTRACE_O_MASK = 0xff + PTRACE_O_MASK = 0x7f PTRACE_O_TRACECLONE = 0x8 PTRACE_O_TRACEEXEC = 0x10 PTRACE_O_TRACEEXIT = 0x40 PTRACE_O_TRACEFORK = 0x2 - PTRACE_O_TRACESECCOMP = 0x80 PTRACE_O_TRACESYSGOOD = 0x1 PTRACE_O_TRACEVFORK = 0x4 PTRACE_O_TRACEVFORKDONE = 0x20 @@ -988,8 +778,6 @@ const ( PTRACE_POKEDATA = 0x5 PTRACE_POKETEXT = 0x4 PTRACE_POKEUSR = 0x6 - PTRACE_SEIZE = 0x4206 - PTRACE_SEIZE_DEVEL = 0x80000000 PTRACE_SETFPREGS = 0xf PTRACE_SETFPXREGS = 0x13 PTRACE_SETOPTIONS = 0x4200 @@ -1298,23 +1086,9 @@ const ( S_IXGRP = 0x8 S_IXOTH = 0x1 S_IXUSR = 0x40 - TAB0 = 0x0 - TAB1 = 0x800 - TAB2 = 0x1000 - TAB3 = 0x1800 - TABDLY = 0x1800 - TCFLSH = 0x540b - TCGETA = 0x5405 - TCGETS = 0x5401 - TCGETS2 = 0x802c542a - TCGETX = 0x5432 TCIFLUSH = 0x0 - TCIOFF = 0x2 TCIOFLUSH = 0x2 - TCION = 0x3 TCOFLUSH = 0x1 - TCOOFF = 0x0 - TCOON = 0x1 TCP_CONGESTION = 0xd TCP_CORK = 0x3 TCP_DEFER_ACCEPT = 0x9 @@ -1333,33 +1107,14 @@ const ( TCP_QUICKACK = 0xc TCP_SYNCNT = 0x7 TCP_WINDOW_CLAMP = 0xa - TCSAFLUSH = 0x2 - TCSBRK = 0x5409 - TCSBRKP = 0x5425 - TCSETA = 0x5406 - TCSETAF = 0x5408 - TCSETAW = 0x5407 - TCSETS = 0x5402 - TCSETS2 = 0x402c542b - TCSETSF = 0x5404 - TCSETSF2 = 0x402c542d - TCSETSW = 0x5403 - TCSETSW2 = 0x402c542c - TCSETX = 0x5433 - TCSETXF = 0x5434 - TCSETXW = 0x5435 - TCXONC = 0x540a TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c TIOCGDEV = 0x80045432 TIOCGETD = 0x5424 - TIOCGEXCL = 0x80045440 TIOCGICOUNT = 0x545d TIOCGLCKTRMIOS = 0x5456 TIOCGPGRP = 0x540f - TIOCGPKT = 0x80045438 - TIOCGPTLCK = 0x80045439 TIOCGPTN = 0x80045430 TIOCGRS485 = 0x542e TIOCGSERIAL = 0x541e @@ -1416,8 +1171,6 @@ const ( TIOCSSOFTCAR = 0x541a TIOCSTI = 0x5412 TIOCSWINSZ = 0x5414 - TIOCVHANGUP = 0x5437 - TOSTOP = 0x100 TUNATTACHFILTER = 0x400854d5 TUNDETACHFILTER = 0x400854d6 TUNGETFEATURES = 0x800454cf @@ -1435,26 +1188,6 @@ const ( TUNSETSNDBUF = 0x400454d4 TUNSETTXFILTER = 0x400454d1 TUNSETVNETHDRSZ = 0x400454d8 - VDISCARD = 0xd - VEOF = 0x4 - VEOL = 0xb - VEOL2 = 0x10 - VERASE = 0x2 - VINTR = 0x0 - VKILL = 0x3 - VLNEXT = 0xf - VMIN = 0x6 - VQUIT = 0x1 - VREPRINT = 0xc - VSTART = 0x8 - VSTOP = 0x9 - VSUSP = 0xa - VSWTC = 0x7 - VT0 = 0x0 - VT1 = 0x4000 - VTDLY = 0x4000 - VTIME = 0x5 - VWERASE = 0xe WALL = 0x40000000 WCLONE = 0x80000000 WCONTINUED = 0x8 @@ -1465,8 +1198,6 @@ const ( WORDSIZE = 0x20 WSTOPPED = 0x2 WUNTRACED = 0x2 - XCASE = 0x4 - XTABS = 0x1800 ) // Errors @@ -1506,7 +1237,6 @@ const ( EFBIG = syscall.Errno(0x1b) EHOSTDOWN = syscall.Errno(0x70) EHOSTUNREACH = syscall.Errno(0x71) - EHWPOISON = syscall.Errno(0x85) EIDRM = syscall.Errno(0x2b) EILSEQ = syscall.Errno(0x54) EINPROGRESS = syscall.Errno(0x73) @@ -1778,7 +1508,6 @@ var errors = [...]string{ 130: "owner died", 131: "state not recoverable", 132: "operation not possible due to RF-kill", - 133: "unknown error 133", } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index b83fb40b39..f9718c594c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -1,8 +1,6 @@ // mkerrors.sh -m64 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build amd64,linux - // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -m64 _const.go @@ -34,11 +32,10 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x28 + AF_MAX = 0x27 AF_NETBEUI = 0xd AF_NETLINK = 0x10 AF_NETROM = 0x6 - AF_NFC = 0x27 AF_PACKET = 0x11 AF_PHONET = 0x23 AF_PPPOX = 0x18 @@ -60,8 +57,6 @@ const ( ARPHRD_ATM = 0x13 ARPHRD_AX25 = 0x3 ARPHRD_BIF = 0x307 - ARPHRD_CAIF = 0x336 - ARPHRD_CAN = 0x118 ARPHRD_CHAOS = 0x5 ARPHRD_CISCO = 0x201 ARPHRD_CSLIP = 0x101 @@ -87,6 +82,7 @@ const ( ARPHRD_IEEE80211_PRISM = 0x322 ARPHRD_IEEE80211_RADIOTAP = 0x323 ARPHRD_IEEE802154 = 0x324 + ARPHRD_IEEE802154_PHY = 0x325 ARPHRD_IEEE802_TR = 0x320 ARPHRD_INFINIBAND = 0x20 ARPHRD_IPDDP = 0x309 @@ -98,8 +94,6 @@ const ( ARPHRD_METRICOM = 0x17 ARPHRD_NETROM = 0x0 ARPHRD_NONE = 0xfffe - ARPHRD_PHONET = 0x334 - ARPHRD_PHONET_PIPE = 0x335 ARPHRD_PIMREG = 0x30b ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 @@ -114,38 +108,6 @@ const ( ARPHRD_TUNNEL6 = 0x301 ARPHRD_VOID = 0xffff ARPHRD_X25 = 0x10f - B0 = 0x0 - B1000000 = 0x1008 - B110 = 0x3 - B115200 = 0x1002 - B1152000 = 0x1009 - B1200 = 0x9 - B134 = 0x4 - B150 = 0x5 - B1500000 = 0x100a - B1800 = 0xa - B19200 = 0xe - B200 = 0x6 - B2000000 = 0x100b - B230400 = 0x1003 - B2400 = 0xb - B2500000 = 0x100c - B300 = 0x7 - B3000000 = 0x100d - B3500000 = 0x100e - B38400 = 0xf - B4000000 = 0x100f - B460800 = 0x1004 - B4800 = 0xc - B50 = 0x1 - B500000 = 0x1005 - B57600 = 0x1001 - B576000 = 0x1006 - B600 = 0x8 - B75 = 0x2 - B921600 = 0x1007 - B9600 = 0xd - BOTHER = 0x1000 BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 @@ -186,30 +148,6 @@ const ( BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 - BRKINT = 0x2 - BS0 = 0x0 - BS1 = 0x2000 - BSDLY = 0x2000 - CBAUD = 0x100f - CBAUDEX = 0x1000 - CFLUSH = 0xf - CIBAUD = 0x100f0000 - CLOCAL = 0x800 - CLOCK_BOOTTIME = 0x7 - CLOCK_BOOTTIME_ALARM = 0x9 - CLOCK_DEFAULT = 0x0 - CLOCK_EXT = 0x1 - CLOCK_INT = 0x2 - CLOCK_MONOTONIC = 0x1 - CLOCK_MONOTONIC_COARSE = 0x6 - CLOCK_MONOTONIC_RAW = 0x4 - CLOCK_PROCESS_CPUTIME_ID = 0x2 - CLOCK_REALTIME = 0x0 - CLOCK_REALTIME_ALARM = 0x8 - CLOCK_REALTIME_COARSE = 0x5 - CLOCK_THREAD_CPUTIME_ID = 0x3 - CLOCK_TXFROMRX = 0x4 - CLOCK_TXINT = 0x3 CLONE_CHILD_CLEARTID = 0x200000 CLONE_CHILD_SETTID = 0x1000000 CLONE_DETACHED = 0x400000 @@ -232,25 +170,6 @@ const ( CLONE_UNTRACED = 0x800000 CLONE_VFORK = 0x4000 CLONE_VM = 0x100 - CMSPAR = 0x40000000 - CR0 = 0x0 - CR1 = 0x200 - CR2 = 0x400 - CR3 = 0x600 - CRDLY = 0x600 - CREAD = 0x80 - CRTSCTS = 0x80000000 - CS5 = 0x0 - CS6 = 0x10 - CS7 = 0x20 - CS8 = 0x30 - CSIGNAL = 0xff - CSIZE = 0x30 - CSTART = 0x11 - CSTATUS = 0x0 - CSTOP = 0x13 - CSTOPB = 0x40 - CSUSP = 0x1a DT_BLK = 0x6 DT_CHR = 0x2 DT_DIR = 0x4 @@ -260,21 +179,8 @@ const ( DT_SOCK = 0xc DT_UNKNOWN = 0x0 DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x200 - ECHOE = 0x10 - ECHOK = 0x20 - ECHOKE = 0x800 - ECHONL = 0x40 - ECHOPRT = 0x400 - ENCODING_DEFAULT = 0x0 - ENCODING_FM_MARK = 0x3 - ENCODING_FM_SPACE = 0x4 - ENCODING_MANCHESTER = 0x5 - ENCODING_NRZ = 0x1 - ENCODING_NRZI = 0x2 EPOLLERR = 0x8 - EPOLLET = 0x80000000 + EPOLLET = -0x80000000 EPOLLHUP = 0x10 EPOLLIN = 0x1 EPOLLMSG = 0x400 @@ -292,13 +198,10 @@ const ( EPOLL_CTL_MOD = 0x3 EPOLL_NONBLOCK = 0x800 ETH_P_1588 = 0x88f7 - ETH_P_8021AD = 0x88a8 - ETH_P_8021AH = 0x88e7 ETH_P_8021Q = 0x8100 ETH_P_802_2 = 0x4 ETH_P_802_3 = 0x1 ETH_P_AARP = 0x80f3 - ETH_P_AF_IUCV = 0xfbfb ETH_P_ALL = 0x3 ETH_P_AOE = 0x88a2 ETH_P_ARCNET = 0x1a @@ -347,14 +250,10 @@ const ( ETH_P_PPP_SES = 0x8864 ETH_P_PUP = 0x200 ETH_P_PUPAT = 0x201 - ETH_P_QINQ1 = 0x9100 - ETH_P_QINQ2 = 0x9200 - ETH_P_QINQ3 = 0x9300 ETH_P_RARP = 0x8035 ETH_P_SCA = 0x6007 ETH_P_SLOW = 0x8809 ETH_P_SNAP = 0x5 - ETH_P_TDLS = 0x890d ETH_P_TEB = 0x6558 ETH_P_TIPC = 0x88ca ETH_P_TRAILER = 0x1c @@ -362,15 +261,8 @@ const ( ETH_P_WAN_PPP = 0x7 ETH_P_WCCP = 0x883e ETH_P_X25 = 0x805 - EXTA = 0xe - EXTB = 0xf - EXTPROC = 0x10000 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 - FF0 = 0x0 - FF1 = 0x8000 - FFDLY = 0x8000 - FLUSHO = 0x1000 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -404,12 +296,7 @@ const ( F_ULOCK = 0x0 F_UNLCK = 0x2 F_WRLCK = 0x1 - HUPCL = 0x400 - IBSHIFT = 0x10 - ICANON = 0x2 ICMPV6_FILTER = 0x1 - ICRNL = 0x100 - IEXTEN = 0x8000 IFA_F_DADFAILED = 0x8 IFA_F_DEPRECATED = 0x20 IFA_F_HOMEADDRESS = 0x10 @@ -420,57 +307,29 @@ const ( IFA_F_TEMPORARY = 0x1 IFA_F_TENTATIVE = 0x40 IFA_MAX = 0x7 - IFF_802_1Q_VLAN = 0x1 IFF_ALLMULTI = 0x200 IFF_AUTOMEDIA = 0x4000 - IFF_BONDING = 0x20 - IFF_BRIDGE_PORT = 0x4000 IFF_BROADCAST = 0x2 IFF_DEBUG = 0x4 - IFF_DISABLE_NETPOLL = 0x1000 - IFF_DONT_BRIDGE = 0x800 - IFF_DORMANT = 0x20000 IFF_DYNAMIC = 0x8000 - IFF_EBRIDGE = 0x2 - IFF_ECHO = 0x40000 - IFF_ISATAP = 0x80 IFF_LOOPBACK = 0x8 - IFF_LOWER_UP = 0x10000 - IFF_MACVLAN_PORT = 0x2000 IFF_MASTER = 0x400 - IFF_MASTER_8023AD = 0x8 - IFF_MASTER_ALB = 0x10 - IFF_MASTER_ARPMON = 0x100 IFF_MULTICAST = 0x1000 IFF_NOARP = 0x80 IFF_NOTRAILERS = 0x20 IFF_NO_PI = 0x1000 IFF_ONE_QUEUE = 0x2000 - IFF_OVS_DATAPATH = 0x8000 IFF_POINTOPOINT = 0x10 IFF_PORTSEL = 0x2000 IFF_PROMISC = 0x100 IFF_RUNNING = 0x40 IFF_SLAVE = 0x800 - IFF_SLAVE_INACTIVE = 0x4 - IFF_SLAVE_NEEDARP = 0x40 IFF_TAP = 0x2 IFF_TUN = 0x1 IFF_TUN_EXCL = 0x8000 - IFF_TX_SKB_SHARING = 0x10000 - IFF_UNICAST_FLT = 0x20000 IFF_UP = 0x1 IFF_VNET_HDR = 0x4000 - IFF_VOLATILE = 0x70c5a - IFF_WAN_HDLC = 0x200 - IFF_XMIT_DST_RELEASE = 0x400 IFNAMSIZ = 0x10 - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 IN_ACCESS = 0x1 IN_ALL_EVENTS = 0xfff IN_ATTRIB = 0x4 @@ -606,7 +465,6 @@ const ( IP_MSS = 0x240 IP_MTU = 0xe IP_MTU_DISCOVER = 0xa - IP_MULTICAST_ALL = 0x31 IP_MULTICAST_IF = 0x20 IP_MULTICAST_LOOP = 0x22 IP_MULTICAST_TTL = 0x21 @@ -635,13 +493,6 @@ const ( IP_TTL = 0x2 IP_UNBLOCK_SOURCE = 0x25 IP_XFRM_POLICY = 0x11 - ISIG = 0x1 - ISTRIP = 0x20 - IUCLC = 0x200 - IUTF8 = 0x4000 - IXANY = 0x800 - IXOFF = 0x1000 - IXON = 0x400 LINUX_REBOOT_CMD_CAD_OFF = 0x0 LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef LINUX_REBOOT_CMD_HALT = 0xcdef0123 @@ -747,7 +598,6 @@ const ( NETLINK_AUDIT = 0x9 NETLINK_BROADCAST_ERROR = 0x4 NETLINK_CONNECTOR = 0xb - NETLINK_CRYPTO = 0x15 NETLINK_DNRTMSG = 0xe NETLINK_DROP_MEMBERSHIP = 0x2 NETLINK_ECRYPTFS = 0x13 @@ -762,20 +612,16 @@ const ( NETLINK_NFLOG = 0x5 NETLINK_NO_ENOBUFS = 0x5 NETLINK_PKTINFO = 0x3 - NETLINK_RDMA = 0x14 NETLINK_ROUTE = 0x0 NETLINK_SCSITRANSPORT = 0x12 NETLINK_SELINUX = 0x7 NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 - NL0 = 0x0 - NL1 = 0x100 NLA_ALIGNTO = 0x4 NLA_F_NESTED = 0x8000 NLA_F_NET_BYTEORDER = 0x4000 NLA_HDRLEN = 0x4 - NLDLY = 0x100 NLMSG_ALIGNTO = 0x4 NLMSG_DONE = 0x3 NLMSG_ERROR = 0x2 @@ -788,7 +634,6 @@ const ( NLM_F_ATOMIC = 0x400 NLM_F_CREATE = 0x400 NLM_F_DUMP = 0x300 - NLM_F_DUMP_INTR = 0x10 NLM_F_ECHO = 0x8 NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 @@ -796,15 +641,6 @@ const ( NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 - NOFLSH = 0x80 - OCRNL = 0x8 - OFDEL = 0x80 - OFILL = 0x40 - OLCUC = 0x2 - ONLCR = 0x4 - ONLRET = 0x20 - ONOCR = 0x10 - OPOST = 0x1 O_ACCMODE = 0x3 O_APPEND = 0x400 O_ASYNC = 0x2000 @@ -821,7 +657,6 @@ const ( O_NOCTTY = 0x100 O_NOFOLLOW = 0x20000 O_NONBLOCK = 0x800 - O_PATH = 0x200000 O_RDONLY = 0x0 O_RDWR = 0x2 O_RSYNC = 0x101000 @@ -829,49 +664,20 @@ const ( O_TRUNC = 0x200 O_WRONLY = 0x1 PACKET_ADD_MEMBERSHIP = 0x1 - PACKET_AUXDATA = 0x8 PACKET_BROADCAST = 0x1 - PACKET_COPY_THRESH = 0x7 PACKET_DROP_MEMBERSHIP = 0x2 - PACKET_FANOUT = 0x12 - PACKET_FANOUT_CPU = 0x2 - PACKET_FANOUT_FLAG_DEFRAG = 0x8000 - PACKET_FANOUT_HASH = 0x0 - PACKET_FANOUT_LB = 0x1 PACKET_FASTROUTE = 0x6 - PACKET_HDRLEN = 0xb PACKET_HOST = 0x0 PACKET_LOOPBACK = 0x5 - PACKET_LOSS = 0xe PACKET_MR_ALLMULTI = 0x2 PACKET_MR_MULTICAST = 0x0 PACKET_MR_PROMISC = 0x1 - PACKET_MR_UNICAST = 0x3 PACKET_MULTICAST = 0x2 - PACKET_ORIGDEV = 0x9 PACKET_OTHERHOST = 0x3 PACKET_OUTGOING = 0x4 PACKET_RECV_OUTPUT = 0x3 - PACKET_RESERVE = 0xc PACKET_RX_RING = 0x5 PACKET_STATISTICS = 0x6 - PACKET_TIMESTAMP = 0x11 - PACKET_TX_RING = 0xd - PACKET_TX_TIMESTAMP = 0x10 - PACKET_VERSION = 0xa - PACKET_VNET_HDR = 0xf - PARENB = 0x100 - PARITY_CRC16_PR0 = 0x2 - PARITY_CRC16_PR0_CCITT = 0x4 - PARITY_CRC16_PR1 = 0x3 - PARITY_CRC16_PR1_CCITT = 0x5 - PARITY_CRC32_PR0_CCITT = 0x6 - PARITY_CRC32_PR1_CCITT = 0x7 - PARITY_DEFAULT = 0x0 - PARITY_NONE = 0x1 - PARMRK = 0x8 - PARODD = 0x200 - PENDIN = 0x4000 PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -904,7 +710,6 @@ const ( PR_GET_FPEXC = 0xb PR_GET_KEEPCAPS = 0x7 PR_GET_NAME = 0x10 - PR_GET_NO_NEW_PRIVS = 0x27 PR_GET_PDEATHSIG = 0x2 PR_GET_SECCOMP = 0x15 PR_GET_SECUREBITS = 0x1b @@ -924,19 +729,9 @@ const ( PR_SET_FPEMU = 0xa PR_SET_FPEXC = 0xc PR_SET_KEEPCAPS = 0x8 - PR_SET_MM = 0x23 - PR_SET_MM_BRK = 0x7 - PR_SET_MM_END_CODE = 0x2 - PR_SET_MM_END_DATA = 0x4 - PR_SET_MM_START_BRK = 0x6 - PR_SET_MM_START_CODE = 0x1 - PR_SET_MM_START_DATA = 0x3 - PR_SET_MM_START_STACK = 0x5 PR_SET_NAME = 0xf - PR_SET_NO_NEW_PRIVS = 0x26 PR_SET_PDEATHSIG = 0x1 PR_SET_PTRACER = 0x59616d61 - PR_SET_PTRACER_ANY = -0x1 PR_SET_SECCOMP = 0x16 PR_SET_SECUREBITS = 0x1c PR_SET_TIMERSLACK = 0x1d @@ -959,8 +754,6 @@ const ( PTRACE_EVENT_EXEC = 0x4 PTRACE_EVENT_EXIT = 0x6 PTRACE_EVENT_FORK = 0x1 - PTRACE_EVENT_SECCOMP = 0x7 - PTRACE_EVENT_STOP = 0x80 PTRACE_EVENT_VFORK = 0x2 PTRACE_EVENT_VFORK_DONE = 0x5 PTRACE_GETEVENTMSG = 0x4201 @@ -970,16 +763,13 @@ const ( PTRACE_GETREGSET = 0x4204 PTRACE_GETSIGINFO = 0x4202 PTRACE_GET_THREAD_AREA = 0x19 - PTRACE_INTERRUPT = 0x4207 PTRACE_KILL = 0x8 - PTRACE_LISTEN = 0x4208 PTRACE_OLDSETOPTIONS = 0x15 - PTRACE_O_MASK = 0xff + PTRACE_O_MASK = 0x7f PTRACE_O_TRACECLONE = 0x8 PTRACE_O_TRACEEXEC = 0x10 PTRACE_O_TRACEEXIT = 0x40 PTRACE_O_TRACEFORK = 0x2 - PTRACE_O_TRACESECCOMP = 0x80 PTRACE_O_TRACESYSGOOD = 0x1 PTRACE_O_TRACEVFORK = 0x4 PTRACE_O_TRACEVFORKDONE = 0x20 @@ -989,8 +779,6 @@ const ( PTRACE_POKEDATA = 0x5 PTRACE_POKETEXT = 0x4 PTRACE_POKEUSR = 0x6 - PTRACE_SEIZE = 0x4206 - PTRACE_SEIZE_DEVEL = 0x80000000 PTRACE_SETFPREGS = 0xf PTRACE_SETFPXREGS = 0x13 PTRACE_SETOPTIONS = 0x4200 @@ -1299,23 +1087,9 @@ const ( S_IXGRP = 0x8 S_IXOTH = 0x1 S_IXUSR = 0x40 - TAB0 = 0x0 - TAB1 = 0x800 - TAB2 = 0x1000 - TAB3 = 0x1800 - TABDLY = 0x1800 - TCFLSH = 0x540b - TCGETA = 0x5405 - TCGETS = 0x5401 - TCGETS2 = 0x802c542a - TCGETX = 0x5432 TCIFLUSH = 0x0 - TCIOFF = 0x2 TCIOFLUSH = 0x2 - TCION = 0x3 TCOFLUSH = 0x1 - TCOOFF = 0x0 - TCOON = 0x1 TCP_CONGESTION = 0xd TCP_CORK = 0x3 TCP_DEFER_ACCEPT = 0x9 @@ -1334,33 +1108,14 @@ const ( TCP_QUICKACK = 0xc TCP_SYNCNT = 0x7 TCP_WINDOW_CLAMP = 0xa - TCSAFLUSH = 0x2 - TCSBRK = 0x5409 - TCSBRKP = 0x5425 - TCSETA = 0x5406 - TCSETAF = 0x5408 - TCSETAW = 0x5407 - TCSETS = 0x5402 - TCSETS2 = 0x402c542b - TCSETSF = 0x5404 - TCSETSF2 = 0x402c542d - TCSETSW = 0x5403 - TCSETSW2 = 0x402c542c - TCSETX = 0x5433 - TCSETXF = 0x5434 - TCSETXW = 0x5435 - TCXONC = 0x540a TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c TIOCGDEV = 0x80045432 TIOCGETD = 0x5424 - TIOCGEXCL = 0x80045440 TIOCGICOUNT = 0x545d TIOCGLCKTRMIOS = 0x5456 TIOCGPGRP = 0x540f - TIOCGPKT = 0x80045438 - TIOCGPTLCK = 0x80045439 TIOCGPTN = 0x80045430 TIOCGRS485 = 0x542e TIOCGSERIAL = 0x541e @@ -1417,8 +1172,6 @@ const ( TIOCSSOFTCAR = 0x541a TIOCSTI = 0x5412 TIOCSWINSZ = 0x5414 - TIOCVHANGUP = 0x5437 - TOSTOP = 0x100 TUNATTACHFILTER = 0x401054d5 TUNDETACHFILTER = 0x401054d6 TUNGETFEATURES = 0x800454cf @@ -1436,26 +1189,6 @@ const ( TUNSETSNDBUF = 0x400454d4 TUNSETTXFILTER = 0x400454d1 TUNSETVNETHDRSZ = 0x400454d8 - VDISCARD = 0xd - VEOF = 0x4 - VEOL = 0xb - VEOL2 = 0x10 - VERASE = 0x2 - VINTR = 0x0 - VKILL = 0x3 - VLNEXT = 0xf - VMIN = 0x6 - VQUIT = 0x1 - VREPRINT = 0xc - VSTART = 0x8 - VSTOP = 0x9 - VSUSP = 0xa - VSWTC = 0x7 - VT0 = 0x0 - VT1 = 0x4000 - VTDLY = 0x4000 - VTIME = 0x5 - VWERASE = 0xe WALL = 0x40000000 WCLONE = 0x80000000 WCONTINUED = 0x8 @@ -1466,8 +1199,6 @@ const ( WORDSIZE = 0x40 WSTOPPED = 0x2 WUNTRACED = 0x2 - XCASE = 0x4 - XTABS = 0x1800 ) // Errors @@ -1507,7 +1238,6 @@ const ( EFBIG = syscall.Errno(0x1b) EHOSTDOWN = syscall.Errno(0x70) EHOSTUNREACH = syscall.Errno(0x71) - EHWPOISON = syscall.Errno(0x85) EIDRM = syscall.Errno(0x2b) EILSEQ = syscall.Errno(0x54) EINPROGRESS = syscall.Errno(0x73) @@ -1779,7 +1509,6 @@ var errors = [...]string{ 130: "owner died", 131: "state not recoverable", 132: "operation not possible due to RF-kill", - 133: "unknown error 133", } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 1cc76a78cf..b9ea3b7b76 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -1,8 +1,6 @@ // mkerrors.sh // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build arm,linux - // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- _const.go @@ -110,38 +108,6 @@ const ( ARPHRD_TUNNEL6 = 0x301 ARPHRD_VOID = 0xffff ARPHRD_X25 = 0x10f - B0 = 0x0 - B1000000 = 0x1008 - B110 = 0x3 - B115200 = 0x1002 - B1152000 = 0x1009 - B1200 = 0x9 - B134 = 0x4 - B150 = 0x5 - B1500000 = 0x100a - B1800 = 0xa - B19200 = 0xe - B200 = 0x6 - B2000000 = 0x100b - B230400 = 0x1003 - B2400 = 0xb - B2500000 = 0x100c - B300 = 0x7 - B3000000 = 0x100d - B3500000 = 0x100e - B38400 = 0xf - B4000000 = 0x100f - B460800 = 0x1004 - B4800 = 0xc - B50 = 0x1 - B500000 = 0x1005 - B57600 = 0x1001 - B576000 = 0x1006 - B600 = 0x8 - B75 = 0x2 - B921600 = 0x1007 - B9600 = 0xd - BOTHER = 0x1000 BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 @@ -182,30 +148,6 @@ const ( BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 - BRKINT = 0x2 - BS0 = 0x0 - BS1 = 0x2000 - BSDLY = 0x2000 - CBAUD = 0x100f - CBAUDEX = 0x1000 - CFLUSH = 0xf - CIBAUD = 0x100f0000 - CLOCAL = 0x800 - CLOCK_BOOTTIME = 0x7 - CLOCK_BOOTTIME_ALARM = 0x9 - CLOCK_DEFAULT = 0x0 - CLOCK_EXT = 0x1 - CLOCK_INT = 0x2 - CLOCK_MONOTONIC = 0x1 - CLOCK_MONOTONIC_COARSE = 0x6 - CLOCK_MONOTONIC_RAW = 0x4 - CLOCK_PROCESS_CPUTIME_ID = 0x2 - CLOCK_REALTIME = 0x0 - CLOCK_REALTIME_ALARM = 0x8 - CLOCK_REALTIME_COARSE = 0x5 - CLOCK_THREAD_CPUTIME_ID = 0x3 - CLOCK_TXFROMRX = 0x4 - CLOCK_TXINT = 0x3 CLONE_CHILD_CLEARTID = 0x200000 CLONE_CHILD_SETTID = 0x1000000 CLONE_DETACHED = 0x400000 @@ -228,25 +170,6 @@ const ( CLONE_UNTRACED = 0x800000 CLONE_VFORK = 0x4000 CLONE_VM = 0x100 - CMSPAR = 0x40000000 - CR0 = 0x0 - CR1 = 0x200 - CR2 = 0x400 - CR3 = 0x600 - CRDLY = 0x600 - CREAD = 0x80 - CRTSCTS = 0x80000000 - CS5 = 0x0 - CS6 = 0x10 - CS7 = 0x20 - CS8 = 0x30 - CSIGNAL = 0xff - CSIZE = 0x30 - CSTART = 0x11 - CSTATUS = 0x0 - CSTOP = 0x13 - CSTOPB = 0x40 - CSUSP = 0x1a DT_BLK = 0x6 DT_CHR = 0x2 DT_DIR = 0x4 @@ -258,13 +181,6 @@ const ( DT_WHT = 0xe ELF_NGREG = 0x12 ELF_PRARGSZ = 0x50 - ECHO = 0x8 - ECHOCTL = 0x200 - ECHOE = 0x10 - ECHOK = 0x20 - ECHOKE = 0x800 - ECHONL = 0x40 - ECHOPRT = 0x400 EPOLLERR = 0x8 EPOLLET = -0x80000000 EPOLLHUP = 0x10 @@ -347,15 +263,8 @@ const ( ETH_P_WAN_PPP = 0x7 ETH_P_WCCP = 0x883e ETH_P_X25 = 0x805 - EXTA = 0xe - EXTB = 0xf - EXTPROC = 0x10000 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 - FF0 = 0x0 - FF1 = 0x8000 - FFDLY = 0x8000 - FLUSHO = 0x1000 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -389,12 +298,7 @@ const ( F_ULOCK = 0x0 F_UNLCK = 0x2 F_WRLCK = 0x1 - HUPCL = 0x400 - IBSHIFT = 0x10 - ICANON = 0x2 ICMPV6_FILTER = 0x1 - ICRNL = 0x100 - IEXTEN = 0x8000 IFA_F_DADFAILED = 0x8 IFA_F_DEPRECATED = 0x20 IFA_F_HOMEADDRESS = 0x10 @@ -428,12 +332,6 @@ const ( IFF_UP = 0x1 IFF_VNET_HDR = 0x4000 IFNAMSIZ = 0x10 - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 IN_ACCESS = 0x1 IN_ALL_EVENTS = 0xfff IN_ATTRIB = 0x4 @@ -597,13 +495,6 @@ const ( IP_TTL = 0x2 IP_UNBLOCK_SOURCE = 0x25 IP_XFRM_POLICY = 0x11 - ISIG = 0x1 - ISTRIP = 0x20 - IUCLC = 0x200 - IUTF8 = 0x4000 - IXANY = 0x800 - IXOFF = 0x1000 - IXON = 0x400 LINUX_REBOOT_CMD_CAD_OFF = 0x0 LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef LINUX_REBOOT_CMD_HALT = 0xcdef0123 @@ -727,13 +618,10 @@ const ( NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 - NL0 = 0x0 - NL1 = 0x100 NLA_ALIGNTO = 0x4 NLA_F_NESTED = 0x8000 NLA_F_NET_BYTEORDER = 0x4000 NLA_HDRLEN = 0x4 - NLDLY = 0x100 NLMSG_ALIGNTO = 0x4 NLMSG_DONE = 0x3 NLMSG_ERROR = 0x2 @@ -753,15 +641,6 @@ const ( NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 - NOFLSH = 0x80 - OCRNL = 0x8 - OFDEL = 0x80 - OFILL = 0x40 - OLCUC = 0x2 - ONLCR = 0x4 - ONLRET = 0x20 - ONOCR = 0x10 - OPOST = 0x1 O_ACCMODE = 0x3 O_APPEND = 0x400 O_ASYNC = 0x2000 @@ -778,7 +657,6 @@ const ( O_NOCTTY = 0x100 O_NOFOLLOW = 0x8000 O_NONBLOCK = 0x800 - O_PATH = 0x200000 O_RDONLY = 0x0 O_RDWR = 0x2 O_RSYNC = 0x1000 @@ -800,10 +678,6 @@ const ( PACKET_RECV_OUTPUT = 0x3 PACKET_RX_RING = 0x5 PACKET_STATISTICS = 0x6 - PARENB = 0x100 - PARMRK = 0x8 - PARODD = 0x200 - PENDIN = 0x4000 PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1223,23 +1097,9 @@ const ( S_IXGRP = 0x8 S_IXOTH = 0x1 S_IXUSR = 0x40 - TAB0 = 0x0 - TAB1 = 0x800 - TAB2 = 0x1000 - TAB3 = 0x1800 - TABDLY = 0x1800 - TCFLSH = 0x540b - TCGETA = 0x5405 - TCGETS = 0x5401 - TCGETS2 = 0x802c542a - TCGETX = 0x5432 TCIFLUSH = 0x0 - TCIOFF = 0x2 TCIOFLUSH = 0x2 - TCION = 0x3 TCOFLUSH = 0x1 - TCOOFF = 0x0 - TCOON = 0x1 TCP_CONGESTION = 0xd TCP_CORK = 0x3 TCP_DEFER_ACCEPT = 0x9 @@ -1258,33 +1118,14 @@ const ( TCP_QUICKACK = 0xc TCP_SYNCNT = 0x7 TCP_WINDOW_CLAMP = 0xa - TCSAFLUSH = 0x2 - TCSBRK = 0x5409 - TCSBRKP = 0x5425 - TCSETA = 0x5406 - TCSETAF = 0x5408 - TCSETAW = 0x5407 - TCSETS = 0x5402 - TCSETS2 = 0x402c542b - TCSETSF = 0x5404 - TCSETSF2 = 0x402c542d - TCSETSW = 0x5403 - TCSETSW2 = 0x402c542c - TCSETX = 0x5433 - TCSETXF = 0x5434 - TCSETXW = 0x5435 - TCXONC = 0x540a TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c TIOCGDEV = 0x80045432 TIOCGETD = 0x5424 - TIOCGEXCL = 0x80045440 TIOCGICOUNT = 0x545d TIOCGLCKTRMIOS = 0x5456 TIOCGPGRP = 0x540f - TIOCGPKT = 0x80045438 - TIOCGPTLCK = 0x80045439 TIOCGPTN = 0x80045430 TIOCGRS485 = 0x542e TIOCGSERIAL = 0x541e @@ -1342,7 +1183,6 @@ const ( TIOCSTI = 0x5412 TIOCSWINSZ = 0x5414 TIOCVHANGUP = 0x5437 - TOSTOP = 0x100 TUNATTACHFILTER = 0x400854d5 TUNDETACHFILTER = 0x400854d6 TUNGETFEATURES = 0x800454cf @@ -1360,26 +1200,6 @@ const ( TUNSETSNDBUF = 0x400454d4 TUNSETTXFILTER = 0x400454d1 TUNSETVNETHDRSZ = 0x400454d8 - VDISCARD = 0xd - VEOF = 0x4 - VEOL = 0xb - VEOL2 = 0x10 - VERASE = 0x2 - VINTR = 0x0 - VKILL = 0x3 - VLNEXT = 0xf - VMIN = 0x6 - VQUIT = 0x1 - VREPRINT = 0xc - VSTART = 0x8 - VSTOP = 0x9 - VSUSP = 0xa - VSWTC = 0x7 - VT0 = 0x0 - VT1 = 0x4000 - VTDLY = 0x4000 - VTIME = 0x5 - VWERASE = 0xe WALL = 0x40000000 WCLONE = 0x80000000 WCONTINUED = 0x8 @@ -1390,8 +1210,6 @@ const ( WORDSIZE = 0x20 WSTOPPED = 0x2 WUNTRACED = 0x2 - XCASE = 0x4 - XTABS = 0x1800 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go deleted file mode 100644 index 47027b79c9..0000000000 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ /dev/null @@ -1,1896 +0,0 @@ -// mkerrors.sh -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -// +build arm64,linux - -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs -- _const.go - -package unix - -import "syscall" - -const ( - AF_ALG = 0x26 - AF_APPLETALK = 0x5 - AF_ASH = 0x12 - AF_ATMPVC = 0x8 - AF_ATMSVC = 0x14 - AF_AX25 = 0x3 - AF_BLUETOOTH = 0x1f - AF_BRIDGE = 0x7 - AF_CAIF = 0x25 - AF_CAN = 0x1d - AF_DECnet = 0xc - AF_ECONET = 0x13 - AF_FILE = 0x1 - AF_IEEE802154 = 0x24 - AF_INET = 0x2 - AF_INET6 = 0xa - AF_IPX = 0x4 - AF_IRDA = 0x17 - AF_ISDN = 0x22 - AF_IUCV = 0x20 - AF_KEY = 0xf - AF_LLC = 0x1a - AF_LOCAL = 0x1 - AF_MAX = 0x29 - AF_NETBEUI = 0xd - AF_NETLINK = 0x10 - AF_NETROM = 0x6 - AF_NFC = 0x27 - AF_PACKET = 0x11 - AF_PHONET = 0x23 - AF_PPPOX = 0x18 - AF_RDS = 0x15 - AF_ROSE = 0xb - AF_ROUTE = 0x10 - AF_RXRPC = 0x21 - AF_SECURITY = 0xe - AF_SNA = 0x16 - AF_TIPC = 0x1e - AF_UNIX = 0x1 - AF_UNSPEC = 0x0 - AF_VSOCK = 0x28 - AF_WANPIPE = 0x19 - AF_X25 = 0x9 - ARPHRD_ADAPT = 0x108 - ARPHRD_APPLETLK = 0x8 - ARPHRD_ARCNET = 0x7 - ARPHRD_ASH = 0x30d - ARPHRD_ATM = 0x13 - ARPHRD_AX25 = 0x3 - ARPHRD_BIF = 0x307 - ARPHRD_CAIF = 0x336 - ARPHRD_CAN = 0x118 - ARPHRD_CHAOS = 0x5 - ARPHRD_CISCO = 0x201 - ARPHRD_CSLIP = 0x101 - ARPHRD_CSLIP6 = 0x103 - ARPHRD_DDCMP = 0x205 - ARPHRD_DLCI = 0xf - ARPHRD_ECONET = 0x30e - ARPHRD_EETHER = 0x2 - ARPHRD_ETHER = 0x1 - ARPHRD_EUI64 = 0x1b - ARPHRD_FCAL = 0x311 - ARPHRD_FCFABRIC = 0x313 - ARPHRD_FCPL = 0x312 - ARPHRD_FCPP = 0x310 - ARPHRD_FDDI = 0x306 - ARPHRD_FRAD = 0x302 - ARPHRD_HDLC = 0x201 - ARPHRD_HIPPI = 0x30c - ARPHRD_HWX25 = 0x110 - ARPHRD_IEEE1394 = 0x18 - ARPHRD_IEEE802 = 0x6 - ARPHRD_IEEE80211 = 0x321 - ARPHRD_IEEE80211_PRISM = 0x322 - ARPHRD_IEEE80211_RADIOTAP = 0x323 - ARPHRD_IEEE802154 = 0x324 - ARPHRD_IEEE802154_MONITOR = 0x325 - ARPHRD_IEEE802_TR = 0x320 - ARPHRD_INFINIBAND = 0x20 - ARPHRD_IP6GRE = 0x337 - ARPHRD_IPDDP = 0x309 - ARPHRD_IPGRE = 0x30a - ARPHRD_IRDA = 0x30f - ARPHRD_LAPB = 0x204 - ARPHRD_LOCALTLK = 0x305 - ARPHRD_LOOPBACK = 0x304 - ARPHRD_METRICOM = 0x17 - ARPHRD_NETLINK = 0x338 - ARPHRD_NETROM = 0x0 - ARPHRD_NONE = 0xfffe - ARPHRD_PHONET = 0x334 - ARPHRD_PHONET_PIPE = 0x335 - ARPHRD_PIMREG = 0x30b - ARPHRD_PPP = 0x200 - ARPHRD_PRONET = 0x4 - ARPHRD_RAWHDLC = 0x206 - ARPHRD_ROSE = 0x10e - ARPHRD_RSRVD = 0x104 - ARPHRD_SIT = 0x308 - ARPHRD_SKIP = 0x303 - ARPHRD_SLIP = 0x100 - ARPHRD_SLIP6 = 0x102 - ARPHRD_TUNNEL = 0x300 - ARPHRD_TUNNEL6 = 0x301 - ARPHRD_VOID = 0xffff - ARPHRD_X25 = 0x10f - B0 = 0x0 - B1000000 = 0x1008 - B110 = 0x3 - B115200 = 0x1002 - B1152000 = 0x1009 - B1200 = 0x9 - B134 = 0x4 - B150 = 0x5 - B1500000 = 0x100a - B1800 = 0xa - B19200 = 0xe - B200 = 0x6 - B2000000 = 0x100b - B230400 = 0x1003 - B2400 = 0xb - B2500000 = 0x100c - B300 = 0x7 - B3000000 = 0x100d - B3500000 = 0x100e - B38400 = 0xf - B4000000 = 0x100f - B460800 = 0x1004 - B4800 = 0xc - B50 = 0x1 - B500000 = 0x1005 - B57600 = 0x1001 - B576000 = 0x1006 - B600 = 0x8 - B75 = 0x2 - B921600 = 0x1007 - B9600 = 0xd - BOTHER = 0x1000 - BPF_A = 0x10 - BPF_ABS = 0x20 - BPF_ADD = 0x0 - BPF_ALU = 0x4 - BPF_AND = 0x50 - BPF_B = 0x10 - BPF_DIV = 0x30 - BPF_H = 0x8 - BPF_IMM = 0x0 - BPF_IND = 0x40 - BPF_JA = 0x0 - BPF_JEQ = 0x10 - BPF_JGE = 0x30 - BPF_JGT = 0x20 - BPF_JMP = 0x5 - BPF_JSET = 0x40 - BPF_K = 0x0 - BPF_LD = 0x0 - BPF_LDX = 0x1 - BPF_LEN = 0x80 - BPF_LSH = 0x60 - BPF_MAJOR_VERSION = 0x1 - BPF_MAXINSNS = 0x1000 - BPF_MEM = 0x60 - BPF_MEMWORDS = 0x10 - BPF_MINOR_VERSION = 0x1 - BPF_MISC = 0x7 - BPF_MOD = 0x90 - BPF_MSH = 0xa0 - BPF_MUL = 0x20 - BPF_NEG = 0x80 - BPF_OR = 0x40 - BPF_RET = 0x6 - BPF_RSH = 0x70 - BPF_ST = 0x2 - BPF_STX = 0x3 - BPF_SUB = 0x10 - BPF_TAX = 0x0 - BPF_TXA = 0x80 - BPF_W = 0x0 - BPF_X = 0x8 - BPF_XOR = 0xa0 - BRKINT = 0x2 - BS0 = 0x0 - BS1 = 0x2000 - BSDLY = 0x2000 - CBAUD = 0x100f - CBAUDEX = 0x1000 - CFLUSH = 0xf - CIBAUD = 0x100f0000 - CLOCAL = 0x800 - CLOCK_BOOTTIME = 0x7 - CLOCK_BOOTTIME_ALARM = 0x9 - CLOCK_DEFAULT = 0x0 - CLOCK_EXT = 0x1 - CLOCK_INT = 0x2 - CLOCK_MONOTONIC = 0x1 - CLOCK_MONOTONIC_COARSE = 0x6 - CLOCK_MONOTONIC_RAW = 0x4 - CLOCK_PROCESS_CPUTIME_ID = 0x2 - CLOCK_REALTIME = 0x0 - CLOCK_REALTIME_ALARM = 0x8 - CLOCK_REALTIME_COARSE = 0x5 - CLOCK_THREAD_CPUTIME_ID = 0x3 - CLOCK_TXFROMRX = 0x4 - CLOCK_TXINT = 0x3 - CLONE_CHILD_CLEARTID = 0x200000 - CLONE_CHILD_SETTID = 0x1000000 - CLONE_DETACHED = 0x400000 - CLONE_FILES = 0x400 - CLONE_FS = 0x200 - CLONE_IO = 0x80000000 - CLONE_NEWIPC = 0x8000000 - CLONE_NEWNET = 0x40000000 - CLONE_NEWNS = 0x20000 - CLONE_NEWPID = 0x20000000 - CLONE_NEWUSER = 0x10000000 - CLONE_NEWUTS = 0x4000000 - CLONE_PARENT = 0x8000 - CLONE_PARENT_SETTID = 0x100000 - CLONE_PTRACE = 0x2000 - CLONE_SETTLS = 0x80000 - CLONE_SIGHAND = 0x800 - CLONE_SYSVSEM = 0x40000 - CLONE_THREAD = 0x10000 - CLONE_UNTRACED = 0x800000 - CLONE_VFORK = 0x4000 - CLONE_VM = 0x100 - CMSPAR = 0x40000000 - CR0 = 0x0 - CR1 = 0x200 - CR2 = 0x400 - CR3 = 0x600 - CRDLY = 0x600 - CREAD = 0x80 - CRTSCTS = 0x80000000 - CS5 = 0x0 - CS6 = 0x10 - CS7 = 0x20 - CS8 = 0x30 - CSIGNAL = 0xff - CSIZE = 0x30 - CSTART = 0x11 - CSTATUS = 0x0 - CSTOP = 0x13 - CSTOPB = 0x40 - CSUSP = 0x1a - DT_BLK = 0x6 - DT_CHR = 0x2 - DT_DIR = 0x4 - DT_FIFO = 0x1 - DT_LNK = 0xa - DT_REG = 0x8 - DT_SOCK = 0xc - DT_UNKNOWN = 0x0 - DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x200 - ECHOE = 0x10 - ECHOK = 0x20 - ECHOKE = 0x800 - ECHONL = 0x40 - ECHOPRT = 0x400 - ELF_NGREG = 0x22 - ELF_PRARGSZ = 0x50 - ENCODING_DEFAULT = 0x0 - ENCODING_FM_MARK = 0x3 - ENCODING_FM_SPACE = 0x4 - ENCODING_MANCHESTER = 0x5 - ENCODING_NRZ = 0x1 - ENCODING_NRZI = 0x2 - EPOLLERR = 0x8 - EPOLLET = 0x80000000 - EPOLLHUP = 0x10 - EPOLLIN = 0x1 - EPOLLMSG = 0x400 - EPOLLONESHOT = 0x40000000 - EPOLLOUT = 0x4 - EPOLLPRI = 0x2 - EPOLLRDBAND = 0x80 - EPOLLRDHUP = 0x2000 - EPOLLRDNORM = 0x40 - EPOLLWAKEUP = 0x20000000 - EPOLLWRBAND = 0x200 - EPOLLWRNORM = 0x100 - EPOLL_CLOEXEC = 0x80000 - EPOLL_CTL_ADD = 0x1 - EPOLL_CTL_DEL = 0x2 - EPOLL_CTL_MOD = 0x3 - ETH_P_1588 = 0x88f7 - ETH_P_8021AD = 0x88a8 - ETH_P_8021AH = 0x88e7 - ETH_P_8021Q = 0x8100 - ETH_P_802_2 = 0x4 - ETH_P_802_3 = 0x1 - ETH_P_802_3_MIN = 0x600 - ETH_P_802_EX1 = 0x88b5 - ETH_P_AARP = 0x80f3 - ETH_P_AF_IUCV = 0xfbfb - ETH_P_ALL = 0x3 - ETH_P_AOE = 0x88a2 - ETH_P_ARCNET = 0x1a - ETH_P_ARP = 0x806 - ETH_P_ATALK = 0x809b - ETH_P_ATMFATE = 0x8884 - ETH_P_ATMMPOA = 0x884c - ETH_P_AX25 = 0x2 - ETH_P_BATMAN = 0x4305 - ETH_P_BPQ = 0x8ff - ETH_P_CAIF = 0xf7 - ETH_P_CAN = 0xc - ETH_P_CANFD = 0xd - ETH_P_CONTROL = 0x16 - ETH_P_CUST = 0x6006 - ETH_P_DDCMP = 0x6 - ETH_P_DEC = 0x6000 - ETH_P_DIAG = 0x6005 - ETH_P_DNA_DL = 0x6001 - ETH_P_DNA_RC = 0x6002 - ETH_P_DNA_RT = 0x6003 - ETH_P_DSA = 0x1b - ETH_P_ECONET = 0x18 - ETH_P_EDSA = 0xdada - ETH_P_FCOE = 0x8906 - ETH_P_FIP = 0x8914 - ETH_P_HDLC = 0x19 - ETH_P_IEEE802154 = 0xf6 - ETH_P_IEEEPUP = 0xa00 - ETH_P_IEEEPUPAT = 0xa01 - ETH_P_IP = 0x800 - ETH_P_IPV6 = 0x86dd - ETH_P_IPX = 0x8137 - ETH_P_IRDA = 0x17 - ETH_P_LAT = 0x6004 - ETH_P_LINK_CTL = 0x886c - ETH_P_LOCALTALK = 0x9 - ETH_P_LOOP = 0x60 - ETH_P_MOBITEX = 0x15 - ETH_P_MPLS_MC = 0x8848 - ETH_P_MPLS_UC = 0x8847 - ETH_P_MVRP = 0x88f5 - ETH_P_PAE = 0x888e - ETH_P_PAUSE = 0x8808 - ETH_P_PHONET = 0xf5 - ETH_P_PPPTALK = 0x10 - ETH_P_PPP_DISC = 0x8863 - ETH_P_PPP_MP = 0x8 - ETH_P_PPP_SES = 0x8864 - ETH_P_PRP = 0x88fb - ETH_P_PUP = 0x200 - ETH_P_PUPAT = 0x201 - ETH_P_QINQ1 = 0x9100 - ETH_P_QINQ2 = 0x9200 - ETH_P_QINQ3 = 0x9300 - ETH_P_RARP = 0x8035 - ETH_P_SCA = 0x6007 - ETH_P_SLOW = 0x8809 - ETH_P_SNAP = 0x5 - ETH_P_TDLS = 0x890d - ETH_P_TEB = 0x6558 - ETH_P_TIPC = 0x88ca - ETH_P_TRAILER = 0x1c - ETH_P_TR_802_2 = 0x11 - ETH_P_WAN_PPP = 0x7 - ETH_P_WCCP = 0x883e - ETH_P_X25 = 0x805 - EXTA = 0xe - EXTB = 0xf - EXTPROC = 0x10000 - FD_CLOEXEC = 0x1 - FD_SETSIZE = 0x400 - FF0 = 0x0 - FF1 = 0x8000 - FFDLY = 0x8000 - FLUSHO = 0x1000 - F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0x406 - F_EXLCK = 0x4 - F_GETFD = 0x1 - F_GETFL = 0x3 - F_GETLEASE = 0x401 - F_GETLK = 0x5 - F_GETLK64 = 0x5 - F_GETOWN = 0x9 - F_GETOWN_EX = 0x10 - F_GETPIPE_SZ = 0x408 - F_GETSIG = 0xb - F_LOCK = 0x1 - F_NOTIFY = 0x402 - F_OK = 0x0 - F_RDLCK = 0x0 - F_SETFD = 0x2 - F_SETFL = 0x4 - F_SETLEASE = 0x400 - F_SETLK = 0x6 - F_SETLK64 = 0x6 - F_SETLKW = 0x7 - F_SETLKW64 = 0x7 - F_SETOWN = 0x8 - F_SETOWN_EX = 0xf - F_SETPIPE_SZ = 0x407 - F_SETSIG = 0xa - F_SHLCK = 0x8 - F_TEST = 0x3 - F_TLOCK = 0x2 - F_ULOCK = 0x0 - F_UNLCK = 0x2 - F_WRLCK = 0x1 - HUPCL = 0x400 - IBSHIFT = 0x10 - ICANON = 0x2 - ICMPV6_FILTER = 0x1 - ICRNL = 0x100 - IEXTEN = 0x8000 - IFA_F_DADFAILED = 0x8 - IFA_F_DEPRECATED = 0x20 - IFA_F_HOMEADDRESS = 0x10 - IFA_F_NODAD = 0x2 - IFA_F_OPTIMISTIC = 0x4 - IFA_F_PERMANENT = 0x80 - IFA_F_SECONDARY = 0x1 - IFA_F_TEMPORARY = 0x1 - IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0x7 - IFF_802_1Q_VLAN = 0x1 - IFF_ALLMULTI = 0x200 - IFF_ATTACH_QUEUE = 0x200 - IFF_AUTOMEDIA = 0x4000 - IFF_BONDING = 0x20 - IFF_BRIDGE_PORT = 0x4000 - IFF_BROADCAST = 0x2 - IFF_DEBUG = 0x4 - IFF_DETACH_QUEUE = 0x400 - IFF_DISABLE_NETPOLL = 0x1000 - IFF_DONT_BRIDGE = 0x800 - IFF_DORMANT = 0x20000 - IFF_DYNAMIC = 0x8000 - IFF_EBRIDGE = 0x2 - IFF_ECHO = 0x40000 - IFF_ISATAP = 0x80 - IFF_LIVE_ADDR_CHANGE = 0x100000 - IFF_LOOPBACK = 0x8 - IFF_LOWER_UP = 0x10000 - IFF_MACVLAN = 0x200000 - IFF_MACVLAN_PORT = 0x2000 - IFF_MASTER = 0x400 - IFF_MASTER_8023AD = 0x8 - IFF_MASTER_ALB = 0x10 - IFF_MASTER_ARPMON = 0x100 - IFF_MULTICAST = 0x1000 - IFF_MULTI_QUEUE = 0x100 - IFF_NOARP = 0x80 - IFF_NOFILTER = 0x1000 - IFF_NOTRAILERS = 0x20 - IFF_NO_PI = 0x1000 - IFF_ONE_QUEUE = 0x2000 - IFF_OVS_DATAPATH = 0x8000 - IFF_PERSIST = 0x800 - IFF_POINTOPOINT = 0x10 - IFF_PORTSEL = 0x2000 - IFF_PROMISC = 0x100 - IFF_RUNNING = 0x40 - IFF_SLAVE = 0x800 - IFF_SLAVE_INACTIVE = 0x4 - IFF_SLAVE_NEEDARP = 0x40 - IFF_SUPP_NOFCS = 0x80000 - IFF_TAP = 0x2 - IFF_TEAM_PORT = 0x40000 - IFF_TUN = 0x1 - IFF_TUN_EXCL = 0x8000 - IFF_TX_SKB_SHARING = 0x10000 - IFF_UNICAST_FLT = 0x20000 - IFF_UP = 0x1 - IFF_VNET_HDR = 0x4000 - IFF_VOLATILE = 0x70c5a - IFF_WAN_HDLC = 0x200 - IFF_XMIT_DST_RELEASE = 0x400 - IFNAMSIZ = 0x10 - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 - IN_ACCESS = 0x1 - IN_ALL_EVENTS = 0xfff - IN_ATTRIB = 0x4 - IN_CLASSA_HOST = 0xffffff - IN_CLASSA_MAX = 0x80 - IN_CLASSA_NET = 0xff000000 - IN_CLASSA_NSHIFT = 0x18 - IN_CLASSB_HOST = 0xffff - IN_CLASSB_MAX = 0x10000 - IN_CLASSB_NET = 0xffff0000 - IN_CLASSB_NSHIFT = 0x10 - IN_CLASSC_HOST = 0xff - IN_CLASSC_NET = 0xffffff00 - IN_CLASSC_NSHIFT = 0x8 - IN_CLOEXEC = 0x80000 - IN_CLOSE = 0x18 - IN_CLOSE_NOWRITE = 0x10 - IN_CLOSE_WRITE = 0x8 - IN_CREATE = 0x100 - IN_DELETE = 0x200 - IN_DELETE_SELF = 0x400 - IN_DONT_FOLLOW = 0x2000000 - IN_EXCL_UNLINK = 0x4000000 - IN_IGNORED = 0x8000 - IN_ISDIR = 0x40000000 - IN_LOOPBACKNET = 0x7f - IN_MASK_ADD = 0x20000000 - IN_MODIFY = 0x2 - IN_MOVE = 0xc0 - IN_MOVED_FROM = 0x40 - IN_MOVED_TO = 0x80 - IN_MOVE_SELF = 0x800 - IN_NONBLOCK = 0x800 - IN_ONESHOT = 0x80000000 - IN_ONLYDIR = 0x1000000 - IN_OPEN = 0x20 - IN_Q_OVERFLOW = 0x4000 - IN_UNMOUNT = 0x2000 - IPPROTO_AH = 0x33 - IPPROTO_BEETPH = 0x5e - IPPROTO_COMP = 0x6c - IPPROTO_DCCP = 0x21 - IPPROTO_DSTOPTS = 0x3c - IPPROTO_EGP = 0x8 - IPPROTO_ENCAP = 0x62 - IPPROTO_ESP = 0x32 - IPPROTO_FRAGMENT = 0x2c - IPPROTO_GRE = 0x2f - IPPROTO_HOPOPTS = 0x0 - IPPROTO_ICMP = 0x1 - IPPROTO_ICMPV6 = 0x3a - IPPROTO_IDP = 0x16 - IPPROTO_IGMP = 0x2 - IPPROTO_IP = 0x0 - IPPROTO_IPIP = 0x4 - IPPROTO_IPV6 = 0x29 - IPPROTO_MH = 0x87 - IPPROTO_MTP = 0x5c - IPPROTO_NONE = 0x3b - IPPROTO_PIM = 0x67 - IPPROTO_PUP = 0xc - IPPROTO_RAW = 0xff - IPPROTO_ROUTING = 0x2b - IPPROTO_RSVP = 0x2e - IPPROTO_SCTP = 0x84 - IPPROTO_TCP = 0x6 - IPPROTO_TP = 0x1d - IPPROTO_UDP = 0x11 - IPPROTO_UDPLITE = 0x88 - IPV6_2292DSTOPTS = 0x4 - IPV6_2292HOPLIMIT = 0x8 - IPV6_2292HOPOPTS = 0x3 - IPV6_2292PKTINFO = 0x2 - IPV6_2292PKTOPTIONS = 0x6 - IPV6_2292RTHDR = 0x5 - IPV6_ADDRFORM = 0x1 - IPV6_ADD_MEMBERSHIP = 0x14 - IPV6_AUTHHDR = 0xa - IPV6_CHECKSUM = 0x7 - IPV6_DROP_MEMBERSHIP = 0x15 - IPV6_DSTOPTS = 0x3b - IPV6_HOPLIMIT = 0x34 - IPV6_HOPOPTS = 0x36 - IPV6_IPSEC_POLICY = 0x22 - IPV6_JOIN_ANYCAST = 0x1b - IPV6_JOIN_GROUP = 0x14 - IPV6_LEAVE_ANYCAST = 0x1c - IPV6_LEAVE_GROUP = 0x15 - IPV6_MTU = 0x18 - IPV6_MTU_DISCOVER = 0x17 - IPV6_MULTICAST_HOPS = 0x12 - IPV6_MULTICAST_IF = 0x11 - IPV6_MULTICAST_LOOP = 0x13 - IPV6_NEXTHOP = 0x9 - IPV6_PKTINFO = 0x32 - IPV6_PMTUDISC_DO = 0x2 - IPV6_PMTUDISC_DONT = 0x0 - IPV6_PMTUDISC_PROBE = 0x3 - IPV6_PMTUDISC_WANT = 0x1 - IPV6_RECVDSTOPTS = 0x3a - IPV6_RECVERR = 0x19 - IPV6_RECVHOPLIMIT = 0x33 - IPV6_RECVHOPOPTS = 0x35 - IPV6_RECVPKTINFO = 0x31 - IPV6_RECVRTHDR = 0x38 - IPV6_RECVTCLASS = 0x42 - IPV6_ROUTER_ALERT = 0x16 - IPV6_RTHDR = 0x39 - IPV6_RTHDRDSTOPTS = 0x37 - IPV6_RTHDR_LOOSE = 0x0 - IPV6_RTHDR_STRICT = 0x1 - IPV6_RTHDR_TYPE_0 = 0x0 - IPV6_RXDSTOPTS = 0x3b - IPV6_RXHOPOPTS = 0x36 - IPV6_TCLASS = 0x43 - IPV6_UNICAST_HOPS = 0x10 - IPV6_V6ONLY = 0x1a - IPV6_XFRM_POLICY = 0x23 - IP_ADD_MEMBERSHIP = 0x23 - IP_ADD_SOURCE_MEMBERSHIP = 0x27 - IP_BLOCK_SOURCE = 0x26 - IP_DEFAULT_MULTICAST_LOOP = 0x1 - IP_DEFAULT_MULTICAST_TTL = 0x1 - IP_DF = 0x4000 - IP_DROP_MEMBERSHIP = 0x24 - IP_DROP_SOURCE_MEMBERSHIP = 0x28 - IP_FREEBIND = 0xf - IP_HDRINCL = 0x3 - IP_IPSEC_POLICY = 0x10 - IP_MAXPACKET = 0xffff - IP_MAX_MEMBERSHIPS = 0x14 - IP_MF = 0x2000 - IP_MINTTL = 0x15 - IP_MSFILTER = 0x29 - IP_MSS = 0x240 - IP_MTU = 0xe - IP_MTU_DISCOVER = 0xa - IP_MULTICAST_ALL = 0x31 - IP_MULTICAST_IF = 0x20 - IP_MULTICAST_LOOP = 0x22 - IP_MULTICAST_TTL = 0x21 - IP_OFFMASK = 0x1fff - IP_OPTIONS = 0x4 - IP_ORIGDSTADDR = 0x14 - IP_PASSSEC = 0x12 - IP_PKTINFO = 0x8 - IP_PKTOPTIONS = 0x9 - IP_PMTUDISC = 0xa - IP_PMTUDISC_DO = 0x2 - IP_PMTUDISC_DONT = 0x0 - IP_PMTUDISC_PROBE = 0x3 - IP_PMTUDISC_WANT = 0x1 - IP_RECVERR = 0xb - IP_RECVOPTS = 0x6 - IP_RECVORIGDSTADDR = 0x14 - IP_RECVRETOPTS = 0x7 - IP_RECVTOS = 0xd - IP_RECVTTL = 0xc - IP_RETOPTS = 0x7 - IP_RF = 0x8000 - IP_ROUTER_ALERT = 0x5 - IP_TOS = 0x1 - IP_TRANSPARENT = 0x13 - IP_TTL = 0x2 - IP_UNBLOCK_SOURCE = 0x25 - IP_UNICAST_IF = 0x32 - IP_XFRM_POLICY = 0x11 - ISIG = 0x1 - ISTRIP = 0x20 - IUCLC = 0x200 - IUTF8 = 0x4000 - IXANY = 0x800 - IXOFF = 0x1000 - IXON = 0x400 - LINUX_REBOOT_CMD_CAD_OFF = 0x0 - LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef - LINUX_REBOOT_CMD_HALT = 0xcdef0123 - LINUX_REBOOT_CMD_KEXEC = 0x45584543 - LINUX_REBOOT_CMD_POWER_OFF = 0x4321fedc - LINUX_REBOOT_CMD_RESTART = 0x1234567 - LINUX_REBOOT_CMD_RESTART2 = 0xa1b2c3d4 - LINUX_REBOOT_CMD_SW_SUSPEND = 0xd000fce2 - LINUX_REBOOT_MAGIC1 = 0xfee1dead - LINUX_REBOOT_MAGIC2 = 0x28121969 - LOCK_EX = 0x2 - LOCK_NB = 0x4 - LOCK_SH = 0x1 - LOCK_UN = 0x8 - MADV_DODUMP = 0x11 - MADV_DOFORK = 0xb - MADV_DONTDUMP = 0x10 - MADV_DONTFORK = 0xa - MADV_DONTNEED = 0x4 - MADV_HUGEPAGE = 0xe - MADV_HWPOISON = 0x64 - MADV_MERGEABLE = 0xc - MADV_NOHUGEPAGE = 0xf - MADV_NORMAL = 0x0 - MADV_RANDOM = 0x1 - MADV_REMOVE = 0x9 - MADV_SEQUENTIAL = 0x2 - MADV_UNMERGEABLE = 0xd - MADV_WILLNEED = 0x3 - MAP_ANON = 0x20 - MAP_ANONYMOUS = 0x20 - MAP_DENYWRITE = 0x800 - MAP_EXECUTABLE = 0x1000 - MAP_FILE = 0x0 - MAP_FIXED = 0x10 - MAP_GROWSDOWN = 0x100 - MAP_HUGETLB = 0x40000 - MAP_HUGE_MASK = 0x3f - MAP_HUGE_SHIFT = 0x1a - MAP_LOCKED = 0x2000 - MAP_NONBLOCK = 0x10000 - MAP_NORESERVE = 0x4000 - MAP_POPULATE = 0x8000 - MAP_PRIVATE = 0x2 - MAP_SHARED = 0x1 - MAP_STACK = 0x20000 - MAP_TYPE = 0xf - MCL_CURRENT = 0x1 - MCL_FUTURE = 0x2 - MNT_DETACH = 0x2 - MNT_EXPIRE = 0x4 - MNT_FORCE = 0x1 - MSG_CMSG_CLOEXEC = 0x40000000 - MSG_CONFIRM = 0x800 - MSG_CTRUNC = 0x8 - MSG_DONTROUTE = 0x4 - MSG_DONTWAIT = 0x40 - MSG_EOR = 0x80 - MSG_ERRQUEUE = 0x2000 - MSG_FASTOPEN = 0x20000000 - MSG_FIN = 0x200 - MSG_MORE = 0x8000 - MSG_NOSIGNAL = 0x4000 - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_PROXY = 0x10 - MSG_RST = 0x1000 - MSG_SYN = 0x400 - MSG_TRUNC = 0x20 - MSG_TRYHARD = 0x4 - MSG_WAITALL = 0x100 - MSG_WAITFORONE = 0x10000 - MS_ACTIVE = 0x40000000 - MS_ASYNC = 0x1 - MS_BIND = 0x1000 - MS_DIRSYNC = 0x80 - MS_INVALIDATE = 0x2 - MS_I_VERSION = 0x800000 - MS_KERNMOUNT = 0x400000 - MS_MANDLOCK = 0x40 - MS_MGC_MSK = 0xffff0000 - MS_MGC_VAL = 0xc0ed0000 - MS_MOVE = 0x2000 - MS_NOATIME = 0x400 - MS_NODEV = 0x4 - MS_NODIRATIME = 0x800 - MS_NOEXEC = 0x8 - MS_NOSUID = 0x2 - MS_NOUSER = -0x80000000 - MS_POSIXACL = 0x10000 - MS_PRIVATE = 0x40000 - MS_RDONLY = 0x1 - MS_REC = 0x4000 - MS_RELATIME = 0x200000 - MS_REMOUNT = 0x20 - MS_RMT_MASK = 0x800051 - MS_SHARED = 0x100000 - MS_SILENT = 0x8000 - MS_SLAVE = 0x80000 - MS_STRICTATIME = 0x1000000 - MS_SYNC = 0x4 - MS_SYNCHRONOUS = 0x10 - MS_UNBINDABLE = 0x20000 - NAME_MAX = 0xff - NETLINK_ADD_MEMBERSHIP = 0x1 - NETLINK_AUDIT = 0x9 - NETLINK_BROADCAST_ERROR = 0x4 - NETLINK_CONNECTOR = 0xb - NETLINK_CRYPTO = 0x15 - NETLINK_DNRTMSG = 0xe - NETLINK_DROP_MEMBERSHIP = 0x2 - NETLINK_ECRYPTFS = 0x13 - NETLINK_FIB_LOOKUP = 0xa - NETLINK_FIREWALL = 0x3 - NETLINK_GENERIC = 0x10 - NETLINK_INET_DIAG = 0x4 - NETLINK_IP6_FW = 0xd - NETLINK_ISCSI = 0x8 - NETLINK_KOBJECT_UEVENT = 0xf - NETLINK_NETFILTER = 0xc - NETLINK_NFLOG = 0x5 - NETLINK_NO_ENOBUFS = 0x5 - NETLINK_PKTINFO = 0x3 - NETLINK_RDMA = 0x14 - NETLINK_ROUTE = 0x0 - NETLINK_RX_RING = 0x6 - NETLINK_SCSITRANSPORT = 0x12 - NETLINK_SELINUX = 0x7 - NETLINK_SOCK_DIAG = 0x4 - NETLINK_TX_RING = 0x7 - NETLINK_UNUSED = 0x1 - NETLINK_USERSOCK = 0x2 - NETLINK_XFRM = 0x6 - NL0 = 0x0 - NL1 = 0x100 - NLA_ALIGNTO = 0x4 - NLA_F_NESTED = 0x8000 - NLA_F_NET_BYTEORDER = 0x4000 - NLA_HDRLEN = 0x4 - NLDLY = 0x100 - NLMSG_ALIGNTO = 0x4 - NLMSG_DONE = 0x3 - NLMSG_ERROR = 0x2 - NLMSG_HDRLEN = 0x10 - NLMSG_MIN_TYPE = 0x10 - NLMSG_NOOP = 0x1 - NLMSG_OVERRUN = 0x4 - NLM_F_ACK = 0x4 - NLM_F_APPEND = 0x800 - NLM_F_ATOMIC = 0x400 - NLM_F_CREATE = 0x400 - NLM_F_DUMP = 0x300 - NLM_F_DUMP_INTR = 0x10 - NLM_F_ECHO = 0x8 - NLM_F_EXCL = 0x200 - NLM_F_MATCH = 0x200 - NLM_F_MULTI = 0x2 - NLM_F_REPLACE = 0x100 - NLM_F_REQUEST = 0x1 - NLM_F_ROOT = 0x100 - NOFLSH = 0x80 - OCRNL = 0x8 - OFDEL = 0x80 - OFILL = 0x40 - OLCUC = 0x2 - ONLCR = 0x4 - ONLRET = 0x20 - ONOCR = 0x10 - OPOST = 0x1 - O_ACCMODE = 0x3 - O_APPEND = 0x400 - O_ASYNC = 0x2000 - O_CLOEXEC = 0x80000 - O_CREAT = 0x40 - O_DIRECT = 0x10000 - O_DIRECTORY = 0x4000 - O_DSYNC = 0x1000 - O_EXCL = 0x80 - O_FSYNC = 0x101000 - O_LARGEFILE = 0x0 - O_NDELAY = 0x800 - O_NOATIME = 0x40000 - O_NOCTTY = 0x100 - O_NOFOLLOW = 0x8000 - O_NONBLOCK = 0x800 - O_PATH = 0x200000 - O_RDONLY = 0x0 - O_RDWR = 0x2 - O_RSYNC = 0x101000 - O_SYNC = 0x101000 - O_TMPFILE = 0x410000 - O_TRUNC = 0x200 - O_WRONLY = 0x1 - PACKET_ADD_MEMBERSHIP = 0x1 - PACKET_AUXDATA = 0x8 - PACKET_BROADCAST = 0x1 - PACKET_COPY_THRESH = 0x7 - PACKET_DROP_MEMBERSHIP = 0x2 - PACKET_FANOUT = 0x12 - PACKET_FANOUT_CPU = 0x2 - PACKET_FANOUT_FLAG_DEFRAG = 0x8000 - PACKET_FANOUT_FLAG_ROLLOVER = 0x1000 - PACKET_FANOUT_HASH = 0x0 - PACKET_FANOUT_LB = 0x1 - PACKET_FANOUT_RND = 0x4 - PACKET_FANOUT_ROLLOVER = 0x3 - PACKET_FASTROUTE = 0x6 - PACKET_HDRLEN = 0xb - PACKET_HOST = 0x0 - PACKET_LOOPBACK = 0x5 - PACKET_LOSS = 0xe - PACKET_MR_ALLMULTI = 0x2 - PACKET_MR_MULTICAST = 0x0 - PACKET_MR_PROMISC = 0x1 - PACKET_MR_UNICAST = 0x3 - PACKET_MULTICAST = 0x2 - PACKET_ORIGDEV = 0x9 - PACKET_OTHERHOST = 0x3 - PACKET_OUTGOING = 0x4 - PACKET_RECV_OUTPUT = 0x3 - PACKET_RESERVE = 0xc - PACKET_RX_RING = 0x5 - PACKET_STATISTICS = 0x6 - PACKET_TIMESTAMP = 0x11 - PACKET_TX_HAS_OFF = 0x13 - PACKET_TX_RING = 0xd - PACKET_TX_TIMESTAMP = 0x10 - PACKET_VERSION = 0xa - PACKET_VNET_HDR = 0xf - PARENB = 0x100 - PARITY_CRC16_PR0 = 0x2 - PARITY_CRC16_PR0_CCITT = 0x4 - PARITY_CRC16_PR1 = 0x3 - PARITY_CRC16_PR1_CCITT = 0x5 - PARITY_CRC32_PR0_CCITT = 0x6 - PARITY_CRC32_PR1_CCITT = 0x7 - PARITY_DEFAULT = 0x0 - PARITY_NONE = 0x1 - PARMRK = 0x8 - PARODD = 0x200 - PENDIN = 0x4000 - PRIO_PGRP = 0x1 - PRIO_PROCESS = 0x0 - PRIO_USER = 0x2 - PROT_EXEC = 0x4 - PROT_GROWSDOWN = 0x1000000 - PROT_GROWSUP = 0x2000000 - PROT_NONE = 0x0 - PROT_READ = 0x1 - PROT_WRITE = 0x2 - PR_CAPBSET_DROP = 0x18 - PR_CAPBSET_READ = 0x17 - PR_ENDIAN_BIG = 0x0 - PR_ENDIAN_LITTLE = 0x1 - PR_ENDIAN_PPC_LITTLE = 0x2 - PR_FPEMU_NOPRINT = 0x1 - PR_FPEMU_SIGFPE = 0x2 - PR_FP_EXC_ASYNC = 0x2 - PR_FP_EXC_DISABLED = 0x0 - PR_FP_EXC_DIV = 0x10000 - PR_FP_EXC_INV = 0x100000 - PR_FP_EXC_NONRECOV = 0x1 - PR_FP_EXC_OVF = 0x20000 - PR_FP_EXC_PRECISE = 0x3 - PR_FP_EXC_RES = 0x80000 - PR_FP_EXC_SW_ENABLE = 0x80 - PR_FP_EXC_UND = 0x40000 - PR_GET_CHILD_SUBREAPER = 0x25 - PR_GET_DUMPABLE = 0x3 - PR_GET_ENDIAN = 0x13 - PR_GET_FPEMU = 0x9 - PR_GET_FPEXC = 0xb - PR_GET_KEEPCAPS = 0x7 - PR_GET_NAME = 0x10 - PR_GET_NO_NEW_PRIVS = 0x27 - PR_GET_PDEATHSIG = 0x2 - PR_GET_SECCOMP = 0x15 - PR_GET_SECUREBITS = 0x1b - PR_GET_TID_ADDRESS = 0x28 - PR_GET_TIMERSLACK = 0x1e - PR_GET_TIMING = 0xd - PR_GET_TSC = 0x19 - PR_GET_UNALIGN = 0x5 - PR_MCE_KILL = 0x21 - PR_MCE_KILL_CLEAR = 0x0 - PR_MCE_KILL_DEFAULT = 0x2 - PR_MCE_KILL_EARLY = 0x1 - PR_MCE_KILL_GET = 0x22 - PR_MCE_KILL_LATE = 0x0 - PR_MCE_KILL_SET = 0x1 - PR_SET_CHILD_SUBREAPER = 0x24 - PR_SET_DUMPABLE = 0x4 - PR_SET_ENDIAN = 0x14 - PR_SET_FPEMU = 0xa - PR_SET_FPEXC = 0xc - PR_SET_KEEPCAPS = 0x8 - PR_SET_MM = 0x23 - PR_SET_MM_ARG_END = 0x9 - PR_SET_MM_ARG_START = 0x8 - PR_SET_MM_AUXV = 0xc - PR_SET_MM_BRK = 0x7 - PR_SET_MM_END_CODE = 0x2 - PR_SET_MM_END_DATA = 0x4 - PR_SET_MM_ENV_END = 0xb - PR_SET_MM_ENV_START = 0xa - PR_SET_MM_EXE_FILE = 0xd - PR_SET_MM_START_BRK = 0x6 - PR_SET_MM_START_CODE = 0x1 - PR_SET_MM_START_DATA = 0x3 - PR_SET_MM_START_STACK = 0x5 - PR_SET_NAME = 0xf - PR_SET_NO_NEW_PRIVS = 0x26 - PR_SET_PDEATHSIG = 0x1 - PR_SET_PTRACER = 0x59616d61 - PR_SET_PTRACER_ANY = -0x1 - PR_SET_SECCOMP = 0x16 - PR_SET_SECUREBITS = 0x1c - PR_SET_TIMERSLACK = 0x1d - PR_SET_TIMING = 0xe - PR_SET_TSC = 0x1a - PR_SET_UNALIGN = 0x6 - PR_TASK_PERF_EVENTS_DISABLE = 0x1f - PR_TASK_PERF_EVENTS_ENABLE = 0x20 - PR_TIMING_STATISTICAL = 0x0 - PR_TIMING_TIMESTAMP = 0x1 - PR_TSC_ENABLE = 0x1 - PR_TSC_SIGSEGV = 0x2 - PR_UNALIGN_NOPRINT = 0x1 - PR_UNALIGN_SIGBUS = 0x2 - PTRACE_ATTACH = 0x10 - PTRACE_CONT = 0x7 - PTRACE_DETACH = 0x11 - PTRACE_EVENT_CLONE = 0x3 - PTRACE_EVENT_EXEC = 0x4 - PTRACE_EVENT_EXIT = 0x6 - PTRACE_EVENT_FORK = 0x1 - PTRACE_EVENT_SECCOMP = 0x7 - PTRACE_EVENT_STOP = 0x80 - PTRACE_EVENT_VFORK = 0x2 - PTRACE_EVENT_VFORK_DONE = 0x5 - PTRACE_GETEVENTMSG = 0x4201 - PTRACE_GETREGS = 0xc - PTRACE_GETREGSET = 0x4204 - PTRACE_GETSIGINFO = 0x4202 - PTRACE_GETSIGMASK = 0x420a - PTRACE_INTERRUPT = 0x4207 - PTRACE_KILL = 0x8 - PTRACE_LISTEN = 0x4208 - PTRACE_O_EXITKILL = 0x100000 - PTRACE_O_MASK = 0x1000ff - PTRACE_O_TRACECLONE = 0x8 - PTRACE_O_TRACEEXEC = 0x10 - PTRACE_O_TRACEEXIT = 0x40 - PTRACE_O_TRACEFORK = 0x2 - PTRACE_O_TRACESECCOMP = 0x80 - PTRACE_O_TRACESYSGOOD = 0x1 - PTRACE_O_TRACEVFORK = 0x4 - PTRACE_O_TRACEVFORKDONE = 0x20 - PTRACE_PEEKDATA = 0x2 - PTRACE_PEEKSIGINFO = 0x4209 - PTRACE_PEEKSIGINFO_SHARED = 0x1 - PTRACE_PEEKTEXT = 0x1 - PTRACE_PEEKUSR = 0x3 - PTRACE_POKEDATA = 0x5 - PTRACE_POKETEXT = 0x4 - PTRACE_POKEUSR = 0x6 - PTRACE_SEIZE = 0x4206 - PTRACE_SETOPTIONS = 0x4200 - PTRACE_SETREGS = 0xd - PTRACE_SETREGSET = 0x4205 - PTRACE_SETSIGINFO = 0x4203 - PTRACE_SETSIGMASK = 0x420b - PTRACE_SINGLESTEP = 0x9 - PTRACE_SYSCALL = 0x18 - PTRACE_TRACEME = 0x0 - RLIMIT_AS = 0x9 - RLIMIT_CORE = 0x4 - RLIMIT_CPU = 0x0 - RLIMIT_DATA = 0x2 - RLIMIT_FSIZE = 0x1 - RLIMIT_NOFILE = 0x7 - RLIMIT_STACK = 0x3 - RLIM_INFINITY = -0x1 - RTAX_ADVMSS = 0x8 - RTAX_CWND = 0x7 - RTAX_FEATURES = 0xc - RTAX_FEATURE_ALLFRAG = 0x8 - RTAX_FEATURE_ECN = 0x1 - RTAX_FEATURE_SACK = 0x2 - RTAX_FEATURE_TIMESTAMP = 0x4 - RTAX_HOPLIMIT = 0xa - RTAX_INITCWND = 0xb - RTAX_INITRWND = 0xe - RTAX_LOCK = 0x1 - RTAX_MAX = 0xf - RTAX_MTU = 0x2 - RTAX_QUICKACK = 0xf - RTAX_REORDERING = 0x9 - RTAX_RTO_MIN = 0xd - RTAX_RTT = 0x4 - RTAX_RTTVAR = 0x5 - RTAX_SSTHRESH = 0x6 - RTAX_UNSPEC = 0x0 - RTAX_WINDOW = 0x3 - RTA_ALIGNTO = 0x4 - RTA_MAX = 0x11 - RTCF_DIRECTSRC = 0x4000000 - RTCF_DOREDIRECT = 0x1000000 - RTCF_LOG = 0x2000000 - RTCF_MASQ = 0x400000 - RTCF_NAT = 0x800000 - RTCF_VALVE = 0x200000 - RTF_ADDRCLASSMASK = 0xf8000000 - RTF_ADDRCONF = 0x40000 - RTF_ALLONLINK = 0x20000 - RTF_BROADCAST = 0x10000000 - RTF_CACHE = 0x1000000 - RTF_DEFAULT = 0x10000 - RTF_DYNAMIC = 0x10 - RTF_FLOW = 0x2000000 - RTF_GATEWAY = 0x2 - RTF_HOST = 0x4 - RTF_INTERFACE = 0x40000000 - RTF_IRTT = 0x100 - RTF_LINKRT = 0x100000 - RTF_LOCAL = 0x80000000 - RTF_MODIFIED = 0x20 - RTF_MSS = 0x40 - RTF_MTU = 0x40 - RTF_MULTICAST = 0x20000000 - RTF_NAT = 0x8000000 - RTF_NOFORWARD = 0x1000 - RTF_NONEXTHOP = 0x200000 - RTF_NOPMTUDISC = 0x4000 - RTF_POLICY = 0x4000000 - RTF_REINSTATE = 0x8 - RTF_REJECT = 0x200 - RTF_STATIC = 0x400 - RTF_THROW = 0x2000 - RTF_UP = 0x1 - RTF_WINDOW = 0x80 - RTF_XRESOLVE = 0x800 - RTM_BASE = 0x10 - RTM_DELACTION = 0x31 - RTM_DELADDR = 0x15 - RTM_DELADDRLABEL = 0x49 - RTM_DELLINK = 0x11 - RTM_DELMDB = 0x55 - RTM_DELNEIGH = 0x1d - RTM_DELQDISC = 0x25 - RTM_DELROUTE = 0x19 - RTM_DELRULE = 0x21 - RTM_DELTCLASS = 0x29 - RTM_DELTFILTER = 0x2d - RTM_F_CLONED = 0x200 - RTM_F_EQUALIZE = 0x400 - RTM_F_NOTIFY = 0x100 - RTM_F_PREFIX = 0x800 - RTM_GETACTION = 0x32 - RTM_GETADDR = 0x16 - RTM_GETADDRLABEL = 0x4a - RTM_GETANYCAST = 0x3e - RTM_GETDCB = 0x4e - RTM_GETLINK = 0x12 - RTM_GETMDB = 0x56 - RTM_GETMULTICAST = 0x3a - RTM_GETNEIGH = 0x1e - RTM_GETNEIGHTBL = 0x42 - RTM_GETNETCONF = 0x52 - RTM_GETQDISC = 0x26 - RTM_GETROUTE = 0x1a - RTM_GETRULE = 0x22 - RTM_GETTCLASS = 0x2a - RTM_GETTFILTER = 0x2e - RTM_MAX = 0x57 - RTM_NEWACTION = 0x30 - RTM_NEWADDR = 0x14 - RTM_NEWADDRLABEL = 0x48 - RTM_NEWLINK = 0x10 - RTM_NEWMDB = 0x54 - RTM_NEWNDUSEROPT = 0x44 - RTM_NEWNEIGH = 0x1c - RTM_NEWNEIGHTBL = 0x40 - RTM_NEWNETCONF = 0x50 - RTM_NEWPREFIX = 0x34 - RTM_NEWQDISC = 0x24 - RTM_NEWROUTE = 0x18 - RTM_NEWRULE = 0x20 - RTM_NEWTCLASS = 0x28 - RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x12 - RTM_NR_MSGTYPES = 0x48 - RTM_SETDCB = 0x4f - RTM_SETLINK = 0x13 - RTM_SETNEIGHTBL = 0x43 - RTNH_ALIGNTO = 0x4 - RTNH_F_DEAD = 0x1 - RTNH_F_ONLINK = 0x4 - RTNH_F_PERVASIVE = 0x2 - RTN_MAX = 0xb - RTPROT_BIRD = 0xc - RTPROT_BOOT = 0x3 - RTPROT_DHCP = 0x10 - RTPROT_DNROUTED = 0xd - RTPROT_GATED = 0x8 - RTPROT_KERNEL = 0x2 - RTPROT_MROUTED = 0x11 - RTPROT_MRT = 0xa - RTPROT_NTK = 0xf - RTPROT_RA = 0x9 - RTPROT_REDIRECT = 0x1 - RTPROT_STATIC = 0x4 - RTPROT_UNSPEC = 0x0 - RTPROT_XORP = 0xe - RTPROT_ZEBRA = 0xb - RT_CLASS_DEFAULT = 0xfd - RT_CLASS_LOCAL = 0xff - RT_CLASS_MAIN = 0xfe - RT_CLASS_MAX = 0xff - RT_CLASS_UNSPEC = 0x0 - RUSAGE_CHILDREN = -0x1 - RUSAGE_SELF = 0x0 - RUSAGE_THREAD = 0x1 - SCM_CREDENTIALS = 0x2 - SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x1d - SCM_TIMESTAMPING = 0x25 - SCM_TIMESTAMPNS = 0x23 - SCM_WIFI_STATUS = 0x29 - SHUT_RD = 0x0 - SHUT_RDWR = 0x2 - SHUT_WR = 0x1 - SIOCADDDLCI = 0x8980 - SIOCADDMULTI = 0x8931 - SIOCADDRT = 0x890b - SIOCATMARK = 0x8905 - SIOCDARP = 0x8953 - SIOCDELDLCI = 0x8981 - SIOCDELMULTI = 0x8932 - SIOCDELRT = 0x890c - SIOCDEVPRIVATE = 0x89f0 - SIOCDIFADDR = 0x8936 - SIOCDRARP = 0x8960 - SIOCGARP = 0x8954 - SIOCGIFADDR = 0x8915 - SIOCGIFBR = 0x8940 - SIOCGIFBRDADDR = 0x8919 - SIOCGIFCONF = 0x8912 - SIOCGIFCOUNT = 0x8938 - SIOCGIFDSTADDR = 0x8917 - SIOCGIFENCAP = 0x8925 - SIOCGIFFLAGS = 0x8913 - SIOCGIFHWADDR = 0x8927 - SIOCGIFINDEX = 0x8933 - SIOCGIFMAP = 0x8970 - SIOCGIFMEM = 0x891f - SIOCGIFMETRIC = 0x891d - SIOCGIFMTU = 0x8921 - SIOCGIFNAME = 0x8910 - SIOCGIFNETMASK = 0x891b - SIOCGIFPFLAGS = 0x8935 - SIOCGIFSLAVE = 0x8929 - SIOCGIFTXQLEN = 0x8942 - SIOCGPGRP = 0x8904 - SIOCGRARP = 0x8961 - SIOCGSTAMP = 0x8906 - SIOCGSTAMPNS = 0x8907 - SIOCPROTOPRIVATE = 0x89e0 - SIOCRTMSG = 0x890d - SIOCSARP = 0x8955 - SIOCSIFADDR = 0x8916 - SIOCSIFBR = 0x8941 - SIOCSIFBRDADDR = 0x891a - SIOCSIFDSTADDR = 0x8918 - SIOCSIFENCAP = 0x8926 - SIOCSIFFLAGS = 0x8914 - SIOCSIFHWADDR = 0x8924 - SIOCSIFHWBROADCAST = 0x8937 - SIOCSIFLINK = 0x8911 - SIOCSIFMAP = 0x8971 - SIOCSIFMEM = 0x8920 - SIOCSIFMETRIC = 0x891e - SIOCSIFMTU = 0x8922 - SIOCSIFNAME = 0x8923 - SIOCSIFNETMASK = 0x891c - SIOCSIFPFLAGS = 0x8934 - SIOCSIFSLAVE = 0x8930 - SIOCSIFTXQLEN = 0x8943 - SIOCSPGRP = 0x8902 - SIOCSRARP = 0x8962 - SOCK_CLOEXEC = 0x80000 - SOCK_DCCP = 0x6 - SOCK_DGRAM = 0x2 - SOCK_NONBLOCK = 0x800 - SOCK_PACKET = 0xa - SOCK_RAW = 0x3 - SOCK_RDM = 0x4 - SOCK_SEQPACKET = 0x5 - SOCK_STREAM = 0x1 - SOL_AAL = 0x109 - SOL_ATM = 0x108 - SOL_DECNET = 0x105 - SOL_ICMPV6 = 0x3a - SOL_IP = 0x0 - SOL_IPV6 = 0x29 - SOL_IRDA = 0x10a - SOL_PACKET = 0x107 - SOL_RAW = 0xff - SOL_SOCKET = 0x1 - SOL_TCP = 0x6 - SOL_X25 = 0x106 - SOMAXCONN = 0x80 - SO_ACCEPTCONN = 0x1e - SO_ATTACH_FILTER = 0x1a - SO_BINDTODEVICE = 0x19 - SO_BROADCAST = 0x6 - SO_BSDCOMPAT = 0xe - SO_BUSY_POLL = 0x2e - SO_DEBUG = 0x1 - SO_DETACH_FILTER = 0x1b - SO_DOMAIN = 0x27 - SO_DONTROUTE = 0x5 - SO_ERROR = 0x4 - SO_GET_FILTER = 0x1a - SO_KEEPALIVE = 0x9 - SO_LINGER = 0xd - SO_LOCK_FILTER = 0x2c - SO_MARK = 0x24 - SO_MAX_PACING_RATE = 0x2f - SO_NOFCS = 0x2b - SO_NO_CHECK = 0xb - SO_OOBINLINE = 0xa - SO_PASSCRED = 0x10 - SO_PASSSEC = 0x22 - SO_PEEK_OFF = 0x2a - SO_PEERCRED = 0x11 - SO_PEERNAME = 0x1c - SO_PEERSEC = 0x1f - SO_PRIORITY = 0xc - SO_PROTOCOL = 0x26 - SO_RCVBUF = 0x8 - SO_RCVBUFFORCE = 0x21 - SO_RCVLOWAT = 0x12 - SO_RCVTIMEO = 0x14 - SO_REUSEADDR = 0x2 - SO_REUSEPORT = 0xf - SO_RXQ_OVFL = 0x28 - SO_SECURITY_AUTHENTICATION = 0x16 - SO_SECURITY_ENCRYPTION_NETWORK = 0x18 - SO_SECURITY_ENCRYPTION_TRANSPORT = 0x17 - SO_SELECT_ERR_QUEUE = 0x2d - SO_SNDBUF = 0x7 - SO_SNDBUFFORCE = 0x20 - SO_SNDLOWAT = 0x13 - SO_SNDTIMEO = 0x15 - SO_TIMESTAMP = 0x1d - SO_TIMESTAMPING = 0x25 - SO_TIMESTAMPNS = 0x23 - SO_TYPE = 0x3 - SO_WIFI_STATUS = 0x29 - S_BLKSIZE = 0x200 - S_IEXEC = 0x40 - S_IFBLK = 0x6000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFIFO = 0x1000 - S_IFLNK = 0xa000 - S_IFMT = 0xf000 - S_IFREG = 0x8000 - S_IFSOCK = 0xc000 - S_IREAD = 0x100 - S_IRGRP = 0x20 - S_IROTH = 0x4 - S_IRUSR = 0x100 - S_IRWXG = 0x38 - S_IRWXO = 0x7 - S_IRWXU = 0x1c0 - S_ISGID = 0x400 - S_ISUID = 0x800 - S_ISVTX = 0x200 - S_IWGRP = 0x10 - S_IWOTH = 0x2 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXGRP = 0x8 - S_IXOTH = 0x1 - S_IXUSR = 0x40 - TAB0 = 0x0 - TAB1 = 0x800 - TAB2 = 0x1000 - TAB3 = 0x1800 - TABDLY = 0x1800 - TCFLSH = 0x540b - TCGETA = 0x5405 - TCGETS = 0x5401 - TCGETS2 = 0x802c542a - TCGETX = 0x5432 - TCIFLUSH = 0x0 - TCIOFF = 0x2 - TCIOFLUSH = 0x2 - TCION = 0x3 - TCOFLUSH = 0x1 - TCOOFF = 0x0 - TCOON = 0x1 - TCP_CONGESTION = 0xd - TCP_COOKIE_IN_ALWAYS = 0x1 - TCP_COOKIE_MAX = 0x10 - TCP_COOKIE_MIN = 0x8 - TCP_COOKIE_OUT_NEVER = 0x2 - TCP_COOKIE_PAIR_SIZE = 0x20 - TCP_COOKIE_TRANSACTIONS = 0xf - TCP_CORK = 0x3 - TCP_DEFER_ACCEPT = 0x9 - TCP_FASTOPEN = 0x17 - TCP_INFO = 0xb - TCP_KEEPCNT = 0x6 - TCP_KEEPIDLE = 0x4 - TCP_KEEPINTVL = 0x5 - TCP_LINGER2 = 0x8 - TCP_MAXSEG = 0x2 - TCP_MAXWIN = 0xffff - TCP_MAX_WINSHIFT = 0xe - TCP_MD5SIG = 0xe - TCP_MD5SIG_MAXKEYLEN = 0x50 - TCP_MSS = 0x200 - TCP_MSS_DEFAULT = 0x218 - TCP_MSS_DESIRED = 0x4c4 - TCP_NODELAY = 0x1 - TCP_QUEUE_SEQ = 0x15 - TCP_QUICKACK = 0xc - TCP_REPAIR = 0x13 - TCP_REPAIR_OPTIONS = 0x16 - TCP_REPAIR_QUEUE = 0x14 - TCP_SYNCNT = 0x7 - TCP_S_DATA_IN = 0x4 - TCP_S_DATA_OUT = 0x8 - TCP_THIN_DUPACK = 0x11 - TCP_THIN_LINEAR_TIMEOUTS = 0x10 - TCP_TIMESTAMP = 0x18 - TCP_USER_TIMEOUT = 0x12 - TCP_WINDOW_CLAMP = 0xa - TCSAFLUSH = 0x2 - TCSBRK = 0x5409 - TCSBRKP = 0x5425 - TCSETA = 0x5406 - TCSETAF = 0x5408 - TCSETAW = 0x5407 - TCSETS = 0x5402 - TCSETS2 = 0x402c542b - TCSETSF = 0x5404 - TCSETSF2 = 0x402c542d - TCSETSW = 0x5403 - TCSETSW2 = 0x402c542c - TCSETX = 0x5433 - TCSETXF = 0x5434 - TCSETXW = 0x5435 - TCXONC = 0x540a - TIOCCBRK = 0x5428 - TIOCCONS = 0x541d - TIOCEXCL = 0x540c - TIOCGDEV = 0x80045432 - TIOCGETD = 0x5424 - TIOCGEXCL = 0x80045440 - TIOCGICOUNT = 0x545d - TIOCGLCKTRMIOS = 0x5456 - TIOCGPGRP = 0x540f - TIOCGPKT = 0x80045438 - TIOCGPTLCK = 0x80045439 - TIOCGPTN = 0x80045430 - TIOCGRS485 = 0x542e - TIOCGSERIAL = 0x541e - TIOCGSID = 0x5429 - TIOCGSOFTCAR = 0x5419 - TIOCGWINSZ = 0x5413 - TIOCINQ = 0x541b - TIOCLINUX = 0x541c - TIOCMBIC = 0x5417 - TIOCMBIS = 0x5416 - TIOCMGET = 0x5415 - TIOCMIWAIT = 0x545c - TIOCMSET = 0x5418 - TIOCM_CAR = 0x40 - TIOCM_CD = 0x40 - TIOCM_CTS = 0x20 - TIOCM_DSR = 0x100 - TIOCM_DTR = 0x2 - TIOCM_LE = 0x1 - TIOCM_RI = 0x80 - TIOCM_RNG = 0x80 - TIOCM_RTS = 0x4 - TIOCM_SR = 0x10 - TIOCM_ST = 0x8 - TIOCNOTTY = 0x5422 - TIOCNXCL = 0x540d - TIOCOUTQ = 0x5411 - TIOCPKT = 0x5420 - TIOCPKT_DATA = 0x0 - TIOCPKT_DOSTOP = 0x20 - TIOCPKT_FLUSHREAD = 0x1 - TIOCPKT_FLUSHWRITE = 0x2 - TIOCPKT_IOCTL = 0x40 - TIOCPKT_NOSTOP = 0x10 - TIOCPKT_START = 0x8 - TIOCPKT_STOP = 0x4 - TIOCSBRK = 0x5427 - TIOCSCTTY = 0x540e - TIOCSERCONFIG = 0x5453 - TIOCSERGETLSR = 0x5459 - TIOCSERGETMULTI = 0x545a - TIOCSERGSTRUCT = 0x5458 - TIOCSERGWILD = 0x5454 - TIOCSERSETMULTI = 0x545b - TIOCSERSWILD = 0x5455 - TIOCSER_TEMT = 0x1 - TIOCSETD = 0x5423 - TIOCSIG = 0x40045436 - TIOCSLCKTRMIOS = 0x5457 - TIOCSPGRP = 0x5410 - TIOCSPTLCK = 0x40045431 - TIOCSRS485 = 0x542f - TIOCSSERIAL = 0x541f - TIOCSSOFTCAR = 0x541a - TIOCSTI = 0x5412 - TIOCSWINSZ = 0x5414 - TIOCVHANGUP = 0x5437 - TOSTOP = 0x100 - TUNATTACHFILTER = 0x401054d5 - TUNDETACHFILTER = 0x401054d6 - TUNGETFEATURES = 0x800454cf - TUNGETFILTER = 0x801054db - TUNGETIFF = 0x800454d2 - TUNGETSNDBUF = 0x800454d3 - TUNGETVNETHDRSZ = 0x800454d7 - TUNSETDEBUG = 0x400454c9 - TUNSETGROUP = 0x400454ce - TUNSETIFF = 0x400454ca - TUNSETIFINDEX = 0x400454da - TUNSETLINK = 0x400454cd - TUNSETNOCSUM = 0x400454c8 - TUNSETOFFLOAD = 0x400454d0 - TUNSETOWNER = 0x400454cc - TUNSETPERSIST = 0x400454cb - TUNSETQUEUE = 0x400454d9 - TUNSETSNDBUF = 0x400454d4 - TUNSETTXFILTER = 0x400454d1 - TUNSETVNETHDRSZ = 0x400454d8 - VDISCARD = 0xd - VEOF = 0x4 - VEOL = 0xb - VEOL2 = 0x10 - VERASE = 0x2 - VINTR = 0x0 - VKILL = 0x3 - VLNEXT = 0xf - VMIN = 0x6 - VQUIT = 0x1 - VREPRINT = 0xc - VSTART = 0x8 - VSTOP = 0x9 - VSUSP = 0xa - VSWTC = 0x7 - VT0 = 0x0 - VT1 = 0x4000 - VTDLY = 0x4000 - VTIME = 0x5 - VWERASE = 0xe - WALL = 0x40000000 - WCLONE = 0x80000000 - WCONTINUED = 0x8 - WEXITED = 0x4 - WNOHANG = 0x1 - WNOTHREAD = 0x20000000 - WNOWAIT = 0x1000000 - WORDSIZE = 0x40 - WSTOPPED = 0x2 - WUNTRACED = 0x2 - XCASE = 0x4 - XTABS = 0x1800 -) - -// Errors -const ( - E2BIG = syscall.Errno(0x7) - EACCES = syscall.Errno(0xd) - EADDRINUSE = syscall.Errno(0x62) - EADDRNOTAVAIL = syscall.Errno(0x63) - EADV = syscall.Errno(0x44) - EAFNOSUPPORT = syscall.Errno(0x61) - EAGAIN = syscall.Errno(0xb) - EALREADY = syscall.Errno(0x72) - EBADE = syscall.Errno(0x34) - EBADF = syscall.Errno(0x9) - EBADFD = syscall.Errno(0x4d) - EBADMSG = syscall.Errno(0x4a) - EBADR = syscall.Errno(0x35) - EBADRQC = syscall.Errno(0x38) - EBADSLT = syscall.Errno(0x39) - EBFONT = syscall.Errno(0x3b) - EBUSY = syscall.Errno(0x10) - ECANCELED = syscall.Errno(0x7d) - ECHILD = syscall.Errno(0xa) - ECHRNG = syscall.Errno(0x2c) - ECOMM = syscall.Errno(0x46) - ECONNABORTED = syscall.Errno(0x67) - ECONNREFUSED = syscall.Errno(0x6f) - ECONNRESET = syscall.Errno(0x68) - EDEADLK = syscall.Errno(0x23) - EDEADLOCK = syscall.Errno(0x23) - EDESTADDRREQ = syscall.Errno(0x59) - EDOM = syscall.Errno(0x21) - EDOTDOT = syscall.Errno(0x49) - EDQUOT = syscall.Errno(0x7a) - EEXIST = syscall.Errno(0x11) - EFAULT = syscall.Errno(0xe) - EFBIG = syscall.Errno(0x1b) - EHOSTDOWN = syscall.Errno(0x70) - EHOSTUNREACH = syscall.Errno(0x71) - EHWPOISON = syscall.Errno(0x85) - EIDRM = syscall.Errno(0x2b) - EILSEQ = syscall.Errno(0x54) - EINPROGRESS = syscall.Errno(0x73) - EINTR = syscall.Errno(0x4) - EINVAL = syscall.Errno(0x16) - EIO = syscall.Errno(0x5) - EISCONN = syscall.Errno(0x6a) - EISDIR = syscall.Errno(0x15) - EISNAM = syscall.Errno(0x78) - EKEYEXPIRED = syscall.Errno(0x7f) - EKEYREJECTED = syscall.Errno(0x81) - EKEYREVOKED = syscall.Errno(0x80) - EL2HLT = syscall.Errno(0x33) - EL2NSYNC = syscall.Errno(0x2d) - EL3HLT = syscall.Errno(0x2e) - EL3RST = syscall.Errno(0x2f) - ELIBACC = syscall.Errno(0x4f) - ELIBBAD = syscall.Errno(0x50) - ELIBEXEC = syscall.Errno(0x53) - ELIBMAX = syscall.Errno(0x52) - ELIBSCN = syscall.Errno(0x51) - ELNRNG = syscall.Errno(0x30) - ELOOP = syscall.Errno(0x28) - EMEDIUMTYPE = syscall.Errno(0x7c) - EMFILE = syscall.Errno(0x18) - EMLINK = syscall.Errno(0x1f) - EMSGSIZE = syscall.Errno(0x5a) - EMULTIHOP = syscall.Errno(0x48) - ENAMETOOLONG = syscall.Errno(0x24) - ENAVAIL = syscall.Errno(0x77) - ENETDOWN = syscall.Errno(0x64) - ENETRESET = syscall.Errno(0x66) - ENETUNREACH = syscall.Errno(0x65) - ENFILE = syscall.Errno(0x17) - ENOANO = syscall.Errno(0x37) - ENOBUFS = syscall.Errno(0x69) - ENOCSI = syscall.Errno(0x32) - ENODATA = syscall.Errno(0x3d) - ENODEV = syscall.Errno(0x13) - ENOENT = syscall.Errno(0x2) - ENOEXEC = syscall.Errno(0x8) - ENOKEY = syscall.Errno(0x7e) - ENOLCK = syscall.Errno(0x25) - ENOLINK = syscall.Errno(0x43) - ENOMEDIUM = syscall.Errno(0x7b) - ENOMEM = syscall.Errno(0xc) - ENOMSG = syscall.Errno(0x2a) - ENONET = syscall.Errno(0x40) - ENOPKG = syscall.Errno(0x41) - ENOPROTOOPT = syscall.Errno(0x5c) - ENOSPC = syscall.Errno(0x1c) - ENOSR = syscall.Errno(0x3f) - ENOSTR = syscall.Errno(0x3c) - ENOSYS = syscall.Errno(0x26) - ENOTBLK = syscall.Errno(0xf) - ENOTCONN = syscall.Errno(0x6b) - ENOTDIR = syscall.Errno(0x14) - ENOTEMPTY = syscall.Errno(0x27) - ENOTNAM = syscall.Errno(0x76) - ENOTRECOVERABLE = syscall.Errno(0x83) - ENOTSOCK = syscall.Errno(0x58) - ENOTSUP = syscall.Errno(0x5f) - ENOTTY = syscall.Errno(0x19) - ENOTUNIQ = syscall.Errno(0x4c) - ENXIO = syscall.Errno(0x6) - EOPNOTSUPP = syscall.Errno(0x5f) - EOVERFLOW = syscall.Errno(0x4b) - EOWNERDEAD = syscall.Errno(0x82) - EPERM = syscall.Errno(0x1) - EPFNOSUPPORT = syscall.Errno(0x60) - EPIPE = syscall.Errno(0x20) - EPROTO = syscall.Errno(0x47) - EPROTONOSUPPORT = syscall.Errno(0x5d) - EPROTOTYPE = syscall.Errno(0x5b) - ERANGE = syscall.Errno(0x22) - EREMCHG = syscall.Errno(0x4e) - EREMOTE = syscall.Errno(0x42) - EREMOTEIO = syscall.Errno(0x79) - ERESTART = syscall.Errno(0x55) - ERFKILL = syscall.Errno(0x84) - EROFS = syscall.Errno(0x1e) - ESHUTDOWN = syscall.Errno(0x6c) - ESOCKTNOSUPPORT = syscall.Errno(0x5e) - ESPIPE = syscall.Errno(0x1d) - ESRCH = syscall.Errno(0x3) - ESRMNT = syscall.Errno(0x45) - ESTALE = syscall.Errno(0x74) - ESTRPIPE = syscall.Errno(0x56) - ETIME = syscall.Errno(0x3e) - ETIMEDOUT = syscall.Errno(0x6e) - ETOOMANYREFS = syscall.Errno(0x6d) - ETXTBSY = syscall.Errno(0x1a) - EUCLEAN = syscall.Errno(0x75) - EUNATCH = syscall.Errno(0x31) - EUSERS = syscall.Errno(0x57) - EWOULDBLOCK = syscall.Errno(0xb) - EXDEV = syscall.Errno(0x12) - EXFULL = syscall.Errno(0x36) -) - -// Signals -const ( - SIGABRT = syscall.Signal(0x6) - SIGALRM = syscall.Signal(0xe) - SIGBUS = syscall.Signal(0x7) - SIGCHLD = syscall.Signal(0x11) - SIGCLD = syscall.Signal(0x11) - SIGCONT = syscall.Signal(0x12) - SIGFPE = syscall.Signal(0x8) - SIGHUP = syscall.Signal(0x1) - SIGILL = syscall.Signal(0x4) - SIGINT = syscall.Signal(0x2) - SIGIO = syscall.Signal(0x1d) - SIGIOT = syscall.Signal(0x6) - SIGKILL = syscall.Signal(0x9) - SIGPIPE = syscall.Signal(0xd) - SIGPOLL = syscall.Signal(0x1d) - SIGPROF = syscall.Signal(0x1b) - SIGPWR = syscall.Signal(0x1e) - SIGQUIT = syscall.Signal(0x3) - SIGSEGV = syscall.Signal(0xb) - SIGSTKFLT = syscall.Signal(0x10) - SIGSTOP = syscall.Signal(0x13) - SIGSYS = syscall.Signal(0x1f) - SIGTERM = syscall.Signal(0xf) - SIGTRAP = syscall.Signal(0x5) - SIGTSTP = syscall.Signal(0x14) - SIGTTIN = syscall.Signal(0x15) - SIGTTOU = syscall.Signal(0x16) - SIGUNUSED = syscall.Signal(0x1f) - SIGURG = syscall.Signal(0x17) - SIGUSR1 = syscall.Signal(0xa) - SIGUSR2 = syscall.Signal(0xc) - SIGVTALRM = syscall.Signal(0x1a) - SIGWINCH = syscall.Signal(0x1c) - SIGXCPU = syscall.Signal(0x18) - SIGXFSZ = syscall.Signal(0x19) -) - -// Error table -var errors = [...]string{ - 1: "operation not permitted", - 2: "no such file or directory", - 3: "no such process", - 4: "interrupted system call", - 5: "input/output error", - 6: "no such device or address", - 7: "argument list too long", - 8: "exec format error", - 9: "bad file descriptor", - 10: "no child processes", - 11: "resource temporarily unavailable", - 12: "cannot allocate memory", - 13: "permission denied", - 14: "bad address", - 15: "block device required", - 16: "device or resource busy", - 17: "file exists", - 18: "invalid cross-device link", - 19: "no such device", - 20: "not a directory", - 21: "is a directory", - 22: "invalid argument", - 23: "too many open files in system", - 24: "too many open files", - 25: "inappropriate ioctl for device", - 26: "text file busy", - 27: "file too large", - 28: "no space left on device", - 29: "illegal seek", - 30: "read-only file system", - 31: "too many links", - 32: "broken pipe", - 33: "numerical argument out of domain", - 34: "numerical result out of range", - 35: "resource deadlock avoided", - 36: "file name too long", - 37: "no locks available", - 38: "function not implemented", - 39: "directory not empty", - 40: "too many levels of symbolic links", - 42: "no message of desired type", - 43: "identifier removed", - 44: "channel number out of range", - 45: "level 2 not synchronized", - 46: "level 3 halted", - 47: "level 3 reset", - 48: "link number out of range", - 49: "protocol driver not attached", - 50: "no CSI structure available", - 51: "level 2 halted", - 52: "invalid exchange", - 53: "invalid request descriptor", - 54: "exchange full", - 55: "no anode", - 56: "invalid request code", - 57: "invalid slot", - 59: "bad font file format", - 60: "device not a stream", - 61: "no data available", - 62: "timer expired", - 63: "out of streams resources", - 64: "machine is not on the network", - 65: "package not installed", - 66: "object is remote", - 67: "link has been severed", - 68: "advertise error", - 69: "srmount error", - 70: "communication error on send", - 71: "protocol error", - 72: "multihop attempted", - 73: "RFS specific error", - 74: "bad message", - 75: "value too large for defined data type", - 76: "name not unique on network", - 77: "file descriptor in bad state", - 78: "remote address changed", - 79: "can not access a needed shared library", - 80: "accessing a corrupted shared library", - 81: ".lib section in a.out corrupted", - 82: "attempting to link in too many shared libraries", - 83: "cannot exec a shared library directly", - 84: "invalid or incomplete multibyte or wide character", - 85: "interrupted system call should be restarted", - 86: "streams pipe error", - 87: "too many users", - 88: "socket operation on non-socket", - 89: "destination address required", - 90: "message too long", - 91: "protocol wrong type for socket", - 92: "protocol not available", - 93: "protocol not supported", - 94: "socket type not supported", - 95: "operation not supported", - 96: "protocol family not supported", - 97: "address family not supported by protocol", - 98: "address already in use", - 99: "cannot assign requested address", - 100: "network is down", - 101: "network is unreachable", - 102: "network dropped connection on reset", - 103: "software caused connection abort", - 104: "connection reset by peer", - 105: "no buffer space available", - 106: "transport endpoint is already connected", - 107: "transport endpoint is not connected", - 108: "cannot send after transport endpoint shutdown", - 109: "too many references: cannot splice", - 110: "connection timed out", - 111: "connection refused", - 112: "host is down", - 113: "no route to host", - 114: "operation already in progress", - 115: "operation now in progress", - 116: "stale file handle", - 117: "structure needs cleaning", - 118: "not a XENIX named type file", - 119: "no XENIX semaphores available", - 120: "is a named type file", - 121: "remote I/O error", - 122: "disk quota exceeded", - 123: "no medium found", - 124: "wrong medium type", - 125: "operation canceled", - 126: "required key not available", - 127: "key has expired", - 128: "key has been revoked", - 129: "key was rejected by service", - 130: "owner died", - 131: "state not recoverable", - 132: "operation not possible due to RF-kill", - 133: "memory page has hardware error", -} - -// Signal table -var signals = [...]string{ - 1: "hangup", - 2: "interrupt", - 3: "quit", - 4: "illegal instruction", - 5: "trace/breakpoint trap", - 6: "aborted", - 7: "bus error", - 8: "floating point exception", - 9: "killed", - 10: "user defined signal 1", - 11: "segmentation fault", - 12: "user defined signal 2", - 13: "broken pipe", - 14: "alarm clock", - 15: "terminated", - 16: "stack fault", - 17: "child exited", - 18: "continued", - 19: "stopped (signal)", - 20: "stopped", - 21: "stopped (tty input)", - 22: "stopped (tty output)", - 23: "urgent I/O condition", - 24: "CPU time limit exceeded", - 25: "file size limit exceeded", - 26: "virtual timer expired", - 27: "profiling timer expired", - 28: "window changed", - 29: "I/O possible", - 30: "power failure", - 31: "bad system call", -} diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go deleted file mode 100644 index 5b90d07ed2..0000000000 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ /dev/null @@ -1,1969 +0,0 @@ -// mkerrors.sh -m64 -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -// +build ppc64,linux - -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs -- -m64 _const.go - -package unix - -import "syscall" - -const ( - AF_ALG = 0x26 - AF_APPLETALK = 0x5 - AF_ASH = 0x12 - AF_ATMPVC = 0x8 - AF_ATMSVC = 0x14 - AF_AX25 = 0x3 - AF_BLUETOOTH = 0x1f - AF_BRIDGE = 0x7 - AF_CAIF = 0x25 - AF_CAN = 0x1d - AF_DECnet = 0xc - AF_ECONET = 0x13 - AF_FILE = 0x1 - AF_IEEE802154 = 0x24 - AF_INET = 0x2 - AF_INET6 = 0xa - AF_IPX = 0x4 - AF_IRDA = 0x17 - AF_ISDN = 0x22 - AF_IUCV = 0x20 - AF_KEY = 0xf - AF_LLC = 0x1a - AF_LOCAL = 0x1 - AF_MAX = 0x29 - AF_NETBEUI = 0xd - AF_NETLINK = 0x10 - AF_NETROM = 0x6 - AF_NFC = 0x27 - AF_PACKET = 0x11 - AF_PHONET = 0x23 - AF_PPPOX = 0x18 - AF_RDS = 0x15 - AF_ROSE = 0xb - AF_ROUTE = 0x10 - AF_RXRPC = 0x21 - AF_SECURITY = 0xe - AF_SNA = 0x16 - AF_TIPC = 0x1e - AF_UNIX = 0x1 - AF_UNSPEC = 0x0 - AF_VSOCK = 0x28 - AF_WANPIPE = 0x19 - AF_X25 = 0x9 - ARPHRD_6LOWPAN = 0x339 - ARPHRD_ADAPT = 0x108 - ARPHRD_APPLETLK = 0x8 - ARPHRD_ARCNET = 0x7 - ARPHRD_ASH = 0x30d - ARPHRD_ATM = 0x13 - ARPHRD_AX25 = 0x3 - ARPHRD_BIF = 0x307 - ARPHRD_CAIF = 0x336 - ARPHRD_CAN = 0x118 - ARPHRD_CHAOS = 0x5 - ARPHRD_CISCO = 0x201 - ARPHRD_CSLIP = 0x101 - ARPHRD_CSLIP6 = 0x103 - ARPHRD_DDCMP = 0x205 - ARPHRD_DLCI = 0xf - ARPHRD_ECONET = 0x30e - ARPHRD_EETHER = 0x2 - ARPHRD_ETHER = 0x1 - ARPHRD_EUI64 = 0x1b - ARPHRD_FCAL = 0x311 - ARPHRD_FCFABRIC = 0x313 - ARPHRD_FCPL = 0x312 - ARPHRD_FCPP = 0x310 - ARPHRD_FDDI = 0x306 - ARPHRD_FRAD = 0x302 - ARPHRD_HDLC = 0x201 - ARPHRD_HIPPI = 0x30c - ARPHRD_HWX25 = 0x110 - ARPHRD_IEEE1394 = 0x18 - ARPHRD_IEEE802 = 0x6 - ARPHRD_IEEE80211 = 0x321 - ARPHRD_IEEE80211_PRISM = 0x322 - ARPHRD_IEEE80211_RADIOTAP = 0x323 - ARPHRD_IEEE802154 = 0x324 - ARPHRD_IEEE802154_MONITOR = 0x325 - ARPHRD_IEEE802_TR = 0x320 - ARPHRD_INFINIBAND = 0x20 - ARPHRD_IP6GRE = 0x337 - ARPHRD_IPDDP = 0x309 - ARPHRD_IPGRE = 0x30a - ARPHRD_IRDA = 0x30f - ARPHRD_LAPB = 0x204 - ARPHRD_LOCALTLK = 0x305 - ARPHRD_LOOPBACK = 0x304 - ARPHRD_METRICOM = 0x17 - ARPHRD_NETLINK = 0x338 - ARPHRD_NETROM = 0x0 - ARPHRD_NONE = 0xfffe - ARPHRD_PHONET = 0x334 - ARPHRD_PHONET_PIPE = 0x335 - ARPHRD_PIMREG = 0x30b - ARPHRD_PPP = 0x200 - ARPHRD_PRONET = 0x4 - ARPHRD_RAWHDLC = 0x206 - ARPHRD_ROSE = 0x10e - ARPHRD_RSRVD = 0x104 - ARPHRD_SIT = 0x308 - ARPHRD_SKIP = 0x303 - ARPHRD_SLIP = 0x100 - ARPHRD_SLIP6 = 0x102 - ARPHRD_TUNNEL = 0x300 - ARPHRD_TUNNEL6 = 0x301 - ARPHRD_VOID = 0xffff - ARPHRD_X25 = 0x10f - B0 = 0x0 - B1000000 = 0x17 - B110 = 0x3 - B115200 = 0x11 - B1152000 = 0x18 - B1200 = 0x9 - B134 = 0x4 - B150 = 0x5 - B1500000 = 0x19 - B1800 = 0xa - B19200 = 0xe - B200 = 0x6 - B2000000 = 0x1a - B230400 = 0x12 - B2400 = 0xb - B2500000 = 0x1b - B300 = 0x7 - B3000000 = 0x1c - B3500000 = 0x1d - B38400 = 0xf - B4000000 = 0x1e - B460800 = 0x13 - B4800 = 0xc - B50 = 0x1 - B500000 = 0x14 - B57600 = 0x10 - B576000 = 0x15 - B600 = 0x8 - B75 = 0x2 - B921600 = 0x16 - B9600 = 0xd - BOTHER = 0x1f - BPF_A = 0x10 - BPF_ABS = 0x20 - BPF_ADD = 0x0 - BPF_ALU = 0x4 - BPF_AND = 0x50 - BPF_B = 0x10 - BPF_DIV = 0x30 - BPF_H = 0x8 - BPF_IMM = 0x0 - BPF_IND = 0x40 - BPF_JA = 0x0 - BPF_JEQ = 0x10 - BPF_JGE = 0x30 - BPF_JGT = 0x20 - BPF_JMP = 0x5 - BPF_JSET = 0x40 - BPF_K = 0x0 - BPF_LD = 0x0 - BPF_LDX = 0x1 - BPF_LEN = 0x80 - BPF_LSH = 0x60 - BPF_MAJOR_VERSION = 0x1 - BPF_MAXINSNS = 0x1000 - BPF_MEM = 0x60 - BPF_MEMWORDS = 0x10 - BPF_MINOR_VERSION = 0x1 - BPF_MISC = 0x7 - BPF_MOD = 0x90 - BPF_MSH = 0xa0 - BPF_MUL = 0x20 - BPF_NEG = 0x80 - BPF_OR = 0x40 - BPF_RET = 0x6 - BPF_RSH = 0x70 - BPF_ST = 0x2 - BPF_STX = 0x3 - BPF_SUB = 0x10 - BPF_TAX = 0x0 - BPF_TXA = 0x80 - BPF_W = 0x0 - BPF_X = 0x8 - BPF_XOR = 0xa0 - BRKINT = 0x2 - BS0 = 0x0 - BS1 = 0x8000 - BSDLY = 0x8000 - CBAUD = 0xff - CBAUDEX = 0x0 - CFLUSH = 0xf - CIBAUD = 0xff0000 - CLOCAL = 0x8000 - CLOCK_BOOTTIME = 0x7 - CLOCK_BOOTTIME_ALARM = 0x9 - CLOCK_DEFAULT = 0x0 - CLOCK_EXT = 0x1 - CLOCK_INT = 0x2 - CLOCK_MONOTONIC = 0x1 - CLOCK_MONOTONIC_COARSE = 0x6 - CLOCK_MONOTONIC_RAW = 0x4 - CLOCK_PROCESS_CPUTIME_ID = 0x2 - CLOCK_REALTIME = 0x0 - CLOCK_REALTIME_ALARM = 0x8 - CLOCK_REALTIME_COARSE = 0x5 - CLOCK_THREAD_CPUTIME_ID = 0x3 - CLOCK_TXFROMRX = 0x4 - CLOCK_TXINT = 0x3 - CLONE_CHILD_CLEARTID = 0x200000 - CLONE_CHILD_SETTID = 0x1000000 - CLONE_DETACHED = 0x400000 - CLONE_FILES = 0x400 - CLONE_FS = 0x200 - CLONE_IO = 0x80000000 - CLONE_NEWIPC = 0x8000000 - CLONE_NEWNET = 0x40000000 - CLONE_NEWNS = 0x20000 - CLONE_NEWPID = 0x20000000 - CLONE_NEWUSER = 0x10000000 - CLONE_NEWUTS = 0x4000000 - CLONE_PARENT = 0x8000 - CLONE_PARENT_SETTID = 0x100000 - CLONE_PTRACE = 0x2000 - CLONE_SETTLS = 0x80000 - CLONE_SIGHAND = 0x800 - CLONE_SYSVSEM = 0x40000 - CLONE_THREAD = 0x10000 - CLONE_UNTRACED = 0x800000 - CLONE_VFORK = 0x4000 - CLONE_VM = 0x100 - CMSPAR = 0x40000000 - CR0 = 0x0 - CR1 = 0x1000 - CR2 = 0x2000 - CR3 = 0x3000 - CRDLY = 0x3000 - CREAD = 0x800 - CRTSCTS = 0x80000000 - CS5 = 0x0 - CS6 = 0x100 - CS7 = 0x200 - CS8 = 0x300 - CSIGNAL = 0xff - CSIZE = 0x300 - CSTART = 0x11 - CSTATUS = 0x0 - CSTOP = 0x13 - CSTOPB = 0x400 - CSUSP = 0x1a - DT_BLK = 0x6 - DT_CHR = 0x2 - DT_DIR = 0x4 - DT_FIFO = 0x1 - DT_LNK = 0xa - DT_REG = 0x8 - DT_SOCK = 0xc - DT_UNKNOWN = 0x0 - DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x40 - ECHOE = 0x2 - ECHOK = 0x4 - ECHOKE = 0x1 - ECHONL = 0x10 - ECHOPRT = 0x20 - ENCODING_DEFAULT = 0x0 - ENCODING_FM_MARK = 0x3 - ENCODING_FM_SPACE = 0x4 - ENCODING_MANCHESTER = 0x5 - ENCODING_NRZ = 0x1 - ENCODING_NRZI = 0x2 - EPOLLERR = 0x8 - EPOLLET = 0x80000000 - EPOLLHUP = 0x10 - EPOLLIN = 0x1 - EPOLLMSG = 0x400 - EPOLLONESHOT = 0x40000000 - EPOLLOUT = 0x4 - EPOLLPRI = 0x2 - EPOLLRDBAND = 0x80 - EPOLLRDHUP = 0x2000 - EPOLLRDNORM = 0x40 - EPOLLWAKEUP = 0x20000000 - EPOLLWRBAND = 0x200 - EPOLLWRNORM = 0x100 - EPOLL_CLOEXEC = 0x80000 - EPOLL_CTL_ADD = 0x1 - EPOLL_CTL_DEL = 0x2 - EPOLL_CTL_MOD = 0x3 - ETH_P_1588 = 0x88f7 - ETH_P_8021AD = 0x88a8 - ETH_P_8021AH = 0x88e7 - ETH_P_8021Q = 0x8100 - ETH_P_80221 = 0x8917 - ETH_P_802_2 = 0x4 - ETH_P_802_3 = 0x1 - ETH_P_802_3_MIN = 0x600 - ETH_P_802_EX1 = 0x88b5 - ETH_P_AARP = 0x80f3 - ETH_P_AF_IUCV = 0xfbfb - ETH_P_ALL = 0x3 - ETH_P_AOE = 0x88a2 - ETH_P_ARCNET = 0x1a - ETH_P_ARP = 0x806 - ETH_P_ATALK = 0x809b - ETH_P_ATMFATE = 0x8884 - ETH_P_ATMMPOA = 0x884c - ETH_P_AX25 = 0x2 - ETH_P_BATMAN = 0x4305 - ETH_P_BPQ = 0x8ff - ETH_P_CAIF = 0xf7 - ETH_P_CAN = 0xc - ETH_P_CANFD = 0xd - ETH_P_CONTROL = 0x16 - ETH_P_CUST = 0x6006 - ETH_P_DDCMP = 0x6 - ETH_P_DEC = 0x6000 - ETH_P_DIAG = 0x6005 - ETH_P_DNA_DL = 0x6001 - ETH_P_DNA_RC = 0x6002 - ETH_P_DNA_RT = 0x6003 - ETH_P_DSA = 0x1b - ETH_P_ECONET = 0x18 - ETH_P_EDSA = 0xdada - ETH_P_FCOE = 0x8906 - ETH_P_FIP = 0x8914 - ETH_P_HDLC = 0x19 - ETH_P_IEEE802154 = 0xf6 - ETH_P_IEEEPUP = 0xa00 - ETH_P_IEEEPUPAT = 0xa01 - ETH_P_IP = 0x800 - ETH_P_IPV6 = 0x86dd - ETH_P_IPX = 0x8137 - ETH_P_IRDA = 0x17 - ETH_P_LAT = 0x6004 - ETH_P_LINK_CTL = 0x886c - ETH_P_LOCALTALK = 0x9 - ETH_P_LOOP = 0x60 - ETH_P_LOOPBACK = 0x9000 - ETH_P_MOBITEX = 0x15 - ETH_P_MPLS_MC = 0x8848 - ETH_P_MPLS_UC = 0x8847 - ETH_P_MVRP = 0x88f5 - ETH_P_PAE = 0x888e - ETH_P_PAUSE = 0x8808 - ETH_P_PHONET = 0xf5 - ETH_P_PPPTALK = 0x10 - ETH_P_PPP_DISC = 0x8863 - ETH_P_PPP_MP = 0x8 - ETH_P_PPP_SES = 0x8864 - ETH_P_PRP = 0x88fb - ETH_P_PUP = 0x200 - ETH_P_PUPAT = 0x201 - ETH_P_QINQ1 = 0x9100 - ETH_P_QINQ2 = 0x9200 - ETH_P_QINQ3 = 0x9300 - ETH_P_RARP = 0x8035 - ETH_P_SCA = 0x6007 - ETH_P_SLOW = 0x8809 - ETH_P_SNAP = 0x5 - ETH_P_TDLS = 0x890d - ETH_P_TEB = 0x6558 - ETH_P_TIPC = 0x88ca - ETH_P_TRAILER = 0x1c - ETH_P_TR_802_2 = 0x11 - ETH_P_WAN_PPP = 0x7 - ETH_P_WCCP = 0x883e - ETH_P_X25 = 0x805 - ETH_P_XDSA = 0xf8 - EXTA = 0xe - EXTB = 0xf - EXTPROC = 0x10000000 - FD_CLOEXEC = 0x1 - FD_SETSIZE = 0x400 - FF0 = 0x0 - FF1 = 0x4000 - FFDLY = 0x4000 - FLUSHO = 0x800000 - F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0x406 - F_EXLCK = 0x4 - F_GETFD = 0x1 - F_GETFL = 0x3 - F_GETLEASE = 0x401 - F_GETLK = 0x5 - F_GETLK64 = 0xc - F_GETOWN = 0x9 - F_GETOWN_EX = 0x10 - F_GETPIPE_SZ = 0x408 - F_GETSIG = 0xb - F_LOCK = 0x1 - F_NOTIFY = 0x402 - F_OFD_GETLK = 0x24 - F_OFD_SETLK = 0x25 - F_OFD_SETLKW = 0x26 - F_OK = 0x0 - F_RDLCK = 0x0 - F_SETFD = 0x2 - F_SETFL = 0x4 - F_SETLEASE = 0x400 - F_SETLK = 0x6 - F_SETLK64 = 0xd - F_SETLKW = 0x7 - F_SETLKW64 = 0xe - F_SETOWN = 0x8 - F_SETOWN_EX = 0xf - F_SETPIPE_SZ = 0x407 - F_SETSIG = 0xa - F_SHLCK = 0x8 - F_TEST = 0x3 - F_TLOCK = 0x2 - F_ULOCK = 0x0 - F_UNLCK = 0x2 - F_WRLCK = 0x1 - HUPCL = 0x4000 - IBSHIFT = 0x10 - ICANON = 0x100 - ICMPV6_FILTER = 0x1 - ICRNL = 0x100 - IEXTEN = 0x400 - IFA_F_DADFAILED = 0x8 - IFA_F_DEPRECATED = 0x20 - IFA_F_HOMEADDRESS = 0x10 - IFA_F_MANAGETEMPADDR = 0x100 - IFA_F_NODAD = 0x2 - IFA_F_NOPREFIXROUTE = 0x200 - IFA_F_OPTIMISTIC = 0x4 - IFA_F_PERMANENT = 0x80 - IFA_F_SECONDARY = 0x1 - IFA_F_TEMPORARY = 0x1 - IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0x8 - IFF_ALLMULTI = 0x200 - IFF_ATTACH_QUEUE = 0x200 - IFF_AUTOMEDIA = 0x4000 - IFF_BROADCAST = 0x2 - IFF_DEBUG = 0x4 - IFF_DETACH_QUEUE = 0x400 - IFF_DORMANT = 0x20000 - IFF_DYNAMIC = 0x8000 - IFF_ECHO = 0x40000 - IFF_LOOPBACK = 0x8 - IFF_LOWER_UP = 0x10000 - IFF_MASTER = 0x400 - IFF_MULTICAST = 0x1000 - IFF_MULTI_QUEUE = 0x100 - IFF_NOARP = 0x80 - IFF_NOFILTER = 0x1000 - IFF_NOTRAILERS = 0x20 - IFF_NO_PI = 0x1000 - IFF_ONE_QUEUE = 0x2000 - IFF_PERSIST = 0x800 - IFF_POINTOPOINT = 0x10 - IFF_PORTSEL = 0x2000 - IFF_PROMISC = 0x100 - IFF_RUNNING = 0x40 - IFF_SLAVE = 0x800 - IFF_TAP = 0x2 - IFF_TUN = 0x1 - IFF_TUN_EXCL = 0x8000 - IFF_UP = 0x1 - IFF_VNET_HDR = 0x4000 - IFF_VOLATILE = 0x70c5a - IFNAMSIZ = 0x10 - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 - IN_ACCESS = 0x1 - IN_ALL_EVENTS = 0xfff - IN_ATTRIB = 0x4 - IN_CLASSA_HOST = 0xffffff - IN_CLASSA_MAX = 0x80 - IN_CLASSA_NET = 0xff000000 - IN_CLASSA_NSHIFT = 0x18 - IN_CLASSB_HOST = 0xffff - IN_CLASSB_MAX = 0x10000 - IN_CLASSB_NET = 0xffff0000 - IN_CLASSB_NSHIFT = 0x10 - IN_CLASSC_HOST = 0xff - IN_CLASSC_NET = 0xffffff00 - IN_CLASSC_NSHIFT = 0x8 - IN_CLOEXEC = 0x80000 - IN_CLOSE = 0x18 - IN_CLOSE_NOWRITE = 0x10 - IN_CLOSE_WRITE = 0x8 - IN_CREATE = 0x100 - IN_DELETE = 0x200 - IN_DELETE_SELF = 0x400 - IN_DONT_FOLLOW = 0x2000000 - IN_EXCL_UNLINK = 0x4000000 - IN_IGNORED = 0x8000 - IN_ISDIR = 0x40000000 - IN_LOOPBACKNET = 0x7f - IN_MASK_ADD = 0x20000000 - IN_MODIFY = 0x2 - IN_MOVE = 0xc0 - IN_MOVED_FROM = 0x40 - IN_MOVED_TO = 0x80 - IN_MOVE_SELF = 0x800 - IN_NONBLOCK = 0x800 - IN_ONESHOT = 0x80000000 - IN_ONLYDIR = 0x1000000 - IN_OPEN = 0x20 - IN_Q_OVERFLOW = 0x4000 - IN_UNMOUNT = 0x2000 - IPPROTO_AH = 0x33 - IPPROTO_BEETPH = 0x5e - IPPROTO_COMP = 0x6c - IPPROTO_DCCP = 0x21 - IPPROTO_DSTOPTS = 0x3c - IPPROTO_EGP = 0x8 - IPPROTO_ENCAP = 0x62 - IPPROTO_ESP = 0x32 - IPPROTO_FRAGMENT = 0x2c - IPPROTO_GRE = 0x2f - IPPROTO_HOPOPTS = 0x0 - IPPROTO_ICMP = 0x1 - IPPROTO_ICMPV6 = 0x3a - IPPROTO_IDP = 0x16 - IPPROTO_IGMP = 0x2 - IPPROTO_IP = 0x0 - IPPROTO_IPIP = 0x4 - IPPROTO_IPV6 = 0x29 - IPPROTO_MH = 0x87 - IPPROTO_MTP = 0x5c - IPPROTO_NONE = 0x3b - IPPROTO_PIM = 0x67 - IPPROTO_PUP = 0xc - IPPROTO_RAW = 0xff - IPPROTO_ROUTING = 0x2b - IPPROTO_RSVP = 0x2e - IPPROTO_SCTP = 0x84 - IPPROTO_TCP = 0x6 - IPPROTO_TP = 0x1d - IPPROTO_UDP = 0x11 - IPPROTO_UDPLITE = 0x88 - IPV6_2292DSTOPTS = 0x4 - IPV6_2292HOPLIMIT = 0x8 - IPV6_2292HOPOPTS = 0x3 - IPV6_2292PKTINFO = 0x2 - IPV6_2292PKTOPTIONS = 0x6 - IPV6_2292RTHDR = 0x5 - IPV6_ADDRFORM = 0x1 - IPV6_ADD_MEMBERSHIP = 0x14 - IPV6_AUTHHDR = 0xa - IPV6_CHECKSUM = 0x7 - IPV6_DROP_MEMBERSHIP = 0x15 - IPV6_DSTOPTS = 0x3b - IPV6_HOPLIMIT = 0x34 - IPV6_HOPOPTS = 0x36 - IPV6_IPSEC_POLICY = 0x22 - IPV6_JOIN_ANYCAST = 0x1b - IPV6_JOIN_GROUP = 0x14 - IPV6_LEAVE_ANYCAST = 0x1c - IPV6_LEAVE_GROUP = 0x15 - IPV6_MTU = 0x18 - IPV6_MTU_DISCOVER = 0x17 - IPV6_MULTICAST_HOPS = 0x12 - IPV6_MULTICAST_IF = 0x11 - IPV6_MULTICAST_LOOP = 0x13 - IPV6_NEXTHOP = 0x9 - IPV6_PKTINFO = 0x32 - IPV6_PMTUDISC_DO = 0x2 - IPV6_PMTUDISC_DONT = 0x0 - IPV6_PMTUDISC_INTERFACE = 0x4 - IPV6_PMTUDISC_OMIT = 0x5 - IPV6_PMTUDISC_PROBE = 0x3 - IPV6_PMTUDISC_WANT = 0x1 - IPV6_RECVDSTOPTS = 0x3a - IPV6_RECVERR = 0x19 - IPV6_RECVHOPLIMIT = 0x33 - IPV6_RECVHOPOPTS = 0x35 - IPV6_RECVPKTINFO = 0x31 - IPV6_RECVRTHDR = 0x38 - IPV6_RECVTCLASS = 0x42 - IPV6_ROUTER_ALERT = 0x16 - IPV6_RTHDR = 0x39 - IPV6_RTHDRDSTOPTS = 0x37 - IPV6_RTHDR_LOOSE = 0x0 - IPV6_RTHDR_STRICT = 0x1 - IPV6_RTHDR_TYPE_0 = 0x0 - IPV6_RXDSTOPTS = 0x3b - IPV6_RXHOPOPTS = 0x36 - IPV6_TCLASS = 0x43 - IPV6_UNICAST_HOPS = 0x10 - IPV6_V6ONLY = 0x1a - IPV6_XFRM_POLICY = 0x23 - IP_ADD_MEMBERSHIP = 0x23 - IP_ADD_SOURCE_MEMBERSHIP = 0x27 - IP_BLOCK_SOURCE = 0x26 - IP_DEFAULT_MULTICAST_LOOP = 0x1 - IP_DEFAULT_MULTICAST_TTL = 0x1 - IP_DF = 0x4000 - IP_DROP_MEMBERSHIP = 0x24 - IP_DROP_SOURCE_MEMBERSHIP = 0x28 - IP_FREEBIND = 0xf - IP_HDRINCL = 0x3 - IP_IPSEC_POLICY = 0x10 - IP_MAXPACKET = 0xffff - IP_MAX_MEMBERSHIPS = 0x14 - IP_MF = 0x2000 - IP_MINTTL = 0x15 - IP_MSFILTER = 0x29 - IP_MSS = 0x240 - IP_MTU = 0xe - IP_MTU_DISCOVER = 0xa - IP_MULTICAST_ALL = 0x31 - IP_MULTICAST_IF = 0x20 - IP_MULTICAST_LOOP = 0x22 - IP_MULTICAST_TTL = 0x21 - IP_NODEFRAG = 0x16 - IP_OFFMASK = 0x1fff - IP_OPTIONS = 0x4 - IP_ORIGDSTADDR = 0x14 - IP_PASSSEC = 0x12 - IP_PKTINFO = 0x8 - IP_PKTOPTIONS = 0x9 - IP_PMTUDISC = 0xa - IP_PMTUDISC_DO = 0x2 - IP_PMTUDISC_DONT = 0x0 - IP_PMTUDISC_INTERFACE = 0x4 - IP_PMTUDISC_OMIT = 0x5 - IP_PMTUDISC_PROBE = 0x3 - IP_PMTUDISC_WANT = 0x1 - IP_RECVERR = 0xb - IP_RECVOPTS = 0x6 - IP_RECVORIGDSTADDR = 0x14 - IP_RECVRETOPTS = 0x7 - IP_RECVTOS = 0xd - IP_RECVTTL = 0xc - IP_RETOPTS = 0x7 - IP_RF = 0x8000 - IP_ROUTER_ALERT = 0x5 - IP_TOS = 0x1 - IP_TRANSPARENT = 0x13 - IP_TTL = 0x2 - IP_UNBLOCK_SOURCE = 0x25 - IP_UNICAST_IF = 0x32 - IP_XFRM_POLICY = 0x11 - ISIG = 0x80 - ISTRIP = 0x20 - IUCLC = 0x1000 - IUTF8 = 0x4000 - IXANY = 0x800 - IXOFF = 0x400 - IXON = 0x200 - LINUX_REBOOT_CMD_CAD_OFF = 0x0 - LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef - LINUX_REBOOT_CMD_HALT = 0xcdef0123 - LINUX_REBOOT_CMD_KEXEC = 0x45584543 - LINUX_REBOOT_CMD_POWER_OFF = 0x4321fedc - LINUX_REBOOT_CMD_RESTART = 0x1234567 - LINUX_REBOOT_CMD_RESTART2 = 0xa1b2c3d4 - LINUX_REBOOT_CMD_SW_SUSPEND = 0xd000fce2 - LINUX_REBOOT_MAGIC1 = 0xfee1dead - LINUX_REBOOT_MAGIC2 = 0x28121969 - LOCK_EX = 0x2 - LOCK_NB = 0x4 - LOCK_SH = 0x1 - LOCK_UN = 0x8 - MADV_DODUMP = 0x11 - MADV_DOFORK = 0xb - MADV_DONTDUMP = 0x10 - MADV_DONTFORK = 0xa - MADV_DONTNEED = 0x4 - MADV_HUGEPAGE = 0xe - MADV_HWPOISON = 0x64 - MADV_MERGEABLE = 0xc - MADV_NOHUGEPAGE = 0xf - MADV_NORMAL = 0x0 - MADV_RANDOM = 0x1 - MADV_REMOVE = 0x9 - MADV_SEQUENTIAL = 0x2 - MADV_UNMERGEABLE = 0xd - MADV_WILLNEED = 0x3 - MAP_ANON = 0x20 - MAP_ANONYMOUS = 0x20 - MAP_DENYWRITE = 0x800 - MAP_EXECUTABLE = 0x1000 - MAP_FILE = 0x0 - MAP_FIXED = 0x10 - MAP_GROWSDOWN = 0x100 - MAP_HUGETLB = 0x40000 - MAP_HUGE_MASK = 0x3f - MAP_HUGE_SHIFT = 0x1a - MAP_LOCKED = 0x80 - MAP_NONBLOCK = 0x10000 - MAP_NORESERVE = 0x40 - MAP_POPULATE = 0x8000 - MAP_PRIVATE = 0x2 - MAP_SHARED = 0x1 - MAP_STACK = 0x20000 - MAP_TYPE = 0xf - MCL_CURRENT = 0x2000 - MCL_FUTURE = 0x4000 - MNT_DETACH = 0x2 - MNT_EXPIRE = 0x4 - MNT_FORCE = 0x1 - MSG_CMSG_CLOEXEC = 0x40000000 - MSG_CONFIRM = 0x800 - MSG_CTRUNC = 0x8 - MSG_DONTROUTE = 0x4 - MSG_DONTWAIT = 0x40 - MSG_EOR = 0x80 - MSG_ERRQUEUE = 0x2000 - MSG_FASTOPEN = 0x20000000 - MSG_FIN = 0x200 - MSG_MORE = 0x8000 - MSG_NOSIGNAL = 0x4000 - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_PROXY = 0x10 - MSG_RST = 0x1000 - MSG_SYN = 0x400 - MSG_TRUNC = 0x20 - MSG_TRYHARD = 0x4 - MSG_WAITALL = 0x100 - MSG_WAITFORONE = 0x10000 - MS_ACTIVE = 0x40000000 - MS_ASYNC = 0x1 - MS_BIND = 0x1000 - MS_DIRSYNC = 0x80 - MS_INVALIDATE = 0x2 - MS_I_VERSION = 0x800000 - MS_KERNMOUNT = 0x400000 - MS_MANDLOCK = 0x40 - MS_MGC_MSK = 0xffff0000 - MS_MGC_VAL = 0xc0ed0000 - MS_MOVE = 0x2000 - MS_NOATIME = 0x400 - MS_NODEV = 0x4 - MS_NODIRATIME = 0x800 - MS_NOEXEC = 0x8 - MS_NOSUID = 0x2 - MS_NOUSER = -0x80000000 - MS_POSIXACL = 0x10000 - MS_PRIVATE = 0x40000 - MS_RDONLY = 0x1 - MS_REC = 0x4000 - MS_RELATIME = 0x200000 - MS_REMOUNT = 0x20 - MS_RMT_MASK = 0x800051 - MS_SHARED = 0x100000 - MS_SILENT = 0x8000 - MS_SLAVE = 0x80000 - MS_STRICTATIME = 0x1000000 - MS_SYNC = 0x4 - MS_SYNCHRONOUS = 0x10 - MS_UNBINDABLE = 0x20000 - NAME_MAX = 0xff - NETLINK_ADD_MEMBERSHIP = 0x1 - NETLINK_AUDIT = 0x9 - NETLINK_BROADCAST_ERROR = 0x4 - NETLINK_CONNECTOR = 0xb - NETLINK_CRYPTO = 0x15 - NETLINK_DNRTMSG = 0xe - NETLINK_DROP_MEMBERSHIP = 0x2 - NETLINK_ECRYPTFS = 0x13 - NETLINK_FIB_LOOKUP = 0xa - NETLINK_FIREWALL = 0x3 - NETLINK_GENERIC = 0x10 - NETLINK_INET_DIAG = 0x4 - NETLINK_IP6_FW = 0xd - NETLINK_ISCSI = 0x8 - NETLINK_KOBJECT_UEVENT = 0xf - NETLINK_NETFILTER = 0xc - NETLINK_NFLOG = 0x5 - NETLINK_NO_ENOBUFS = 0x5 - NETLINK_PKTINFO = 0x3 - NETLINK_RDMA = 0x14 - NETLINK_ROUTE = 0x0 - NETLINK_RX_RING = 0x6 - NETLINK_SCSITRANSPORT = 0x12 - NETLINK_SELINUX = 0x7 - NETLINK_SOCK_DIAG = 0x4 - NETLINK_TX_RING = 0x7 - NETLINK_UNUSED = 0x1 - NETLINK_USERSOCK = 0x2 - NETLINK_XFRM = 0x6 - NL0 = 0x0 - NL1 = 0x100 - NL2 = 0x200 - NL3 = 0x300 - NLA_ALIGNTO = 0x4 - NLA_F_NESTED = 0x8000 - NLA_F_NET_BYTEORDER = 0x4000 - NLA_HDRLEN = 0x4 - NLDLY = 0x300 - NLMSG_ALIGNTO = 0x4 - NLMSG_DONE = 0x3 - NLMSG_ERROR = 0x2 - NLMSG_HDRLEN = 0x10 - NLMSG_MIN_TYPE = 0x10 - NLMSG_NOOP = 0x1 - NLMSG_OVERRUN = 0x4 - NLM_F_ACK = 0x4 - NLM_F_APPEND = 0x800 - NLM_F_ATOMIC = 0x400 - NLM_F_CREATE = 0x400 - NLM_F_DUMP = 0x300 - NLM_F_DUMP_INTR = 0x10 - NLM_F_ECHO = 0x8 - NLM_F_EXCL = 0x200 - NLM_F_MATCH = 0x200 - NLM_F_MULTI = 0x2 - NLM_F_REPLACE = 0x100 - NLM_F_REQUEST = 0x1 - NLM_F_ROOT = 0x100 - NOFLSH = 0x80000000 - OCRNL = 0x8 - OFDEL = 0x80 - OFILL = 0x40 - OLCUC = 0x4 - ONLCR = 0x2 - ONLRET = 0x20 - ONOCR = 0x10 - OPOST = 0x1 - O_ACCMODE = 0x3 - O_APPEND = 0x400 - O_ASYNC = 0x2000 - O_CLOEXEC = 0x80000 - O_CREAT = 0x40 - O_DIRECT = 0x20000 - O_DIRECTORY = 0x4000 - O_DSYNC = 0x1000 - O_EXCL = 0x80 - O_FSYNC = 0x101000 - O_LARGEFILE = 0x0 - O_NDELAY = 0x800 - O_NOATIME = 0x40000 - O_NOCTTY = 0x100 - O_NOFOLLOW = 0x8000 - O_NONBLOCK = 0x800 - O_PATH = 0x200000 - O_RDONLY = 0x0 - O_RDWR = 0x2 - O_RSYNC = 0x101000 - O_SYNC = 0x101000 - O_TMPFILE = 0x410000 - O_TRUNC = 0x200 - O_WRONLY = 0x1 - PACKET_ADD_MEMBERSHIP = 0x1 - PACKET_AUXDATA = 0x8 - PACKET_BROADCAST = 0x1 - PACKET_COPY_THRESH = 0x7 - PACKET_DROP_MEMBERSHIP = 0x2 - PACKET_FANOUT = 0x12 - PACKET_FANOUT_CPU = 0x2 - PACKET_FANOUT_FLAG_DEFRAG = 0x8000 - PACKET_FANOUT_FLAG_ROLLOVER = 0x1000 - PACKET_FANOUT_HASH = 0x0 - PACKET_FANOUT_LB = 0x1 - PACKET_FANOUT_QM = 0x5 - PACKET_FANOUT_RND = 0x4 - PACKET_FANOUT_ROLLOVER = 0x3 - PACKET_FASTROUTE = 0x6 - PACKET_HDRLEN = 0xb - PACKET_HOST = 0x0 - PACKET_KERNEL = 0x7 - PACKET_LOOPBACK = 0x5 - PACKET_LOSS = 0xe - PACKET_MR_ALLMULTI = 0x2 - PACKET_MR_MULTICAST = 0x0 - PACKET_MR_PROMISC = 0x1 - PACKET_MR_UNICAST = 0x3 - PACKET_MULTICAST = 0x2 - PACKET_ORIGDEV = 0x9 - PACKET_OTHERHOST = 0x3 - PACKET_OUTGOING = 0x4 - PACKET_QDISC_BYPASS = 0x14 - PACKET_RECV_OUTPUT = 0x3 - PACKET_RESERVE = 0xc - PACKET_RX_RING = 0x5 - PACKET_STATISTICS = 0x6 - PACKET_TIMESTAMP = 0x11 - PACKET_TX_HAS_OFF = 0x13 - PACKET_TX_RING = 0xd - PACKET_TX_TIMESTAMP = 0x10 - PACKET_USER = 0x6 - PACKET_VERSION = 0xa - PACKET_VNET_HDR = 0xf - PARENB = 0x1000 - PARITY_CRC16_PR0 = 0x2 - PARITY_CRC16_PR0_CCITT = 0x4 - PARITY_CRC16_PR1 = 0x3 - PARITY_CRC16_PR1_CCITT = 0x5 - PARITY_CRC32_PR0_CCITT = 0x6 - PARITY_CRC32_PR1_CCITT = 0x7 - PARITY_DEFAULT = 0x0 - PARITY_NONE = 0x1 - PARMRK = 0x8 - PARODD = 0x2000 - PENDIN = 0x20000000 - PRIO_PGRP = 0x1 - PRIO_PROCESS = 0x0 - PRIO_USER = 0x2 - PROT_EXEC = 0x4 - PROT_GROWSDOWN = 0x1000000 - PROT_GROWSUP = 0x2000000 - PROT_NONE = 0x0 - PROT_READ = 0x1 - PROT_SAO = 0x10 - PROT_WRITE = 0x2 - PR_CAPBSET_DROP = 0x18 - PR_CAPBSET_READ = 0x17 - PR_ENDIAN_BIG = 0x0 - PR_ENDIAN_LITTLE = 0x1 - PR_ENDIAN_PPC_LITTLE = 0x2 - PR_FPEMU_NOPRINT = 0x1 - PR_FPEMU_SIGFPE = 0x2 - PR_FP_EXC_ASYNC = 0x2 - PR_FP_EXC_DISABLED = 0x0 - PR_FP_EXC_DIV = 0x10000 - PR_FP_EXC_INV = 0x100000 - PR_FP_EXC_NONRECOV = 0x1 - PR_FP_EXC_OVF = 0x20000 - PR_FP_EXC_PRECISE = 0x3 - PR_FP_EXC_RES = 0x80000 - PR_FP_EXC_SW_ENABLE = 0x80 - PR_FP_EXC_UND = 0x40000 - PR_GET_CHILD_SUBREAPER = 0x25 - PR_GET_DUMPABLE = 0x3 - PR_GET_ENDIAN = 0x13 - PR_GET_FPEMU = 0x9 - PR_GET_FPEXC = 0xb - PR_GET_KEEPCAPS = 0x7 - PR_GET_NAME = 0x10 - PR_GET_NO_NEW_PRIVS = 0x27 - PR_GET_PDEATHSIG = 0x2 - PR_GET_SECCOMP = 0x15 - PR_GET_SECUREBITS = 0x1b - PR_GET_THP_DISABLE = 0x2a - PR_GET_TID_ADDRESS = 0x28 - PR_GET_TIMERSLACK = 0x1e - PR_GET_TIMING = 0xd - PR_GET_TSC = 0x19 - PR_GET_UNALIGN = 0x5 - PR_MCE_KILL = 0x21 - PR_MCE_KILL_CLEAR = 0x0 - PR_MCE_KILL_DEFAULT = 0x2 - PR_MCE_KILL_EARLY = 0x1 - PR_MCE_KILL_GET = 0x22 - PR_MCE_KILL_LATE = 0x0 - PR_MCE_KILL_SET = 0x1 - PR_SET_CHILD_SUBREAPER = 0x24 - PR_SET_DUMPABLE = 0x4 - PR_SET_ENDIAN = 0x14 - PR_SET_FPEMU = 0xa - PR_SET_FPEXC = 0xc - PR_SET_KEEPCAPS = 0x8 - PR_SET_MM = 0x23 - PR_SET_MM_ARG_END = 0x9 - PR_SET_MM_ARG_START = 0x8 - PR_SET_MM_AUXV = 0xc - PR_SET_MM_BRK = 0x7 - PR_SET_MM_END_CODE = 0x2 - PR_SET_MM_END_DATA = 0x4 - PR_SET_MM_ENV_END = 0xb - PR_SET_MM_ENV_START = 0xa - PR_SET_MM_EXE_FILE = 0xd - PR_SET_MM_MAP = 0xe - PR_SET_MM_MAP_SIZE = 0xf - PR_SET_MM_START_BRK = 0x6 - PR_SET_MM_START_CODE = 0x1 - PR_SET_MM_START_DATA = 0x3 - PR_SET_MM_START_STACK = 0x5 - PR_SET_NAME = 0xf - PR_SET_NO_NEW_PRIVS = 0x26 - PR_SET_PDEATHSIG = 0x1 - PR_SET_PTRACER = 0x59616d61 - PR_SET_PTRACER_ANY = -0x1 - PR_SET_SECCOMP = 0x16 - PR_SET_SECUREBITS = 0x1c - PR_SET_THP_DISABLE = 0x29 - PR_SET_TIMERSLACK = 0x1d - PR_SET_TIMING = 0xe - PR_SET_TSC = 0x1a - PR_SET_UNALIGN = 0x6 - PR_TASK_PERF_EVENTS_DISABLE = 0x1f - PR_TASK_PERF_EVENTS_ENABLE = 0x20 - PR_TIMING_STATISTICAL = 0x0 - PR_TIMING_TIMESTAMP = 0x1 - PR_TSC_ENABLE = 0x1 - PR_TSC_SIGSEGV = 0x2 - PR_UNALIGN_NOPRINT = 0x1 - PR_UNALIGN_SIGBUS = 0x2 - PTRACE_ATTACH = 0x10 - PTRACE_CONT = 0x7 - PTRACE_DETACH = 0x11 - PTRACE_EVENT_CLONE = 0x3 - PTRACE_EVENT_EXEC = 0x4 - PTRACE_EVENT_EXIT = 0x6 - PTRACE_EVENT_FORK = 0x1 - PTRACE_EVENT_SECCOMP = 0x7 - PTRACE_EVENT_STOP = 0x80 - PTRACE_EVENT_VFORK = 0x2 - PTRACE_EVENT_VFORK_DONE = 0x5 - PTRACE_GETEVENTMSG = 0x4201 - PTRACE_GETEVRREGS = 0x14 - PTRACE_GETFPREGS = 0xe - PTRACE_GETREGS = 0xc - PTRACE_GETREGS64 = 0x16 - PTRACE_GETREGSET = 0x4204 - PTRACE_GETSIGINFO = 0x4202 - PTRACE_GETSIGMASK = 0x420a - PTRACE_GETVRREGS = 0x12 - PTRACE_GETVSRREGS = 0x1b - PTRACE_GET_DEBUGREG = 0x19 - PTRACE_INTERRUPT = 0x4207 - PTRACE_KILL = 0x8 - PTRACE_LISTEN = 0x4208 - PTRACE_O_EXITKILL = 0x100000 - PTRACE_O_MASK = 0x1000ff - PTRACE_O_TRACECLONE = 0x8 - PTRACE_O_TRACEEXEC = 0x10 - PTRACE_O_TRACEEXIT = 0x40 - PTRACE_O_TRACEFORK = 0x2 - PTRACE_O_TRACESECCOMP = 0x80 - PTRACE_O_TRACESYSGOOD = 0x1 - PTRACE_O_TRACEVFORK = 0x4 - PTRACE_O_TRACEVFORKDONE = 0x20 - PTRACE_PEEKDATA = 0x2 - PTRACE_PEEKSIGINFO = 0x4209 - PTRACE_PEEKSIGINFO_SHARED = 0x1 - PTRACE_PEEKTEXT = 0x1 - PTRACE_PEEKUSR = 0x3 - PTRACE_POKEDATA = 0x5 - PTRACE_POKETEXT = 0x4 - PTRACE_POKEUSR = 0x6 - PTRACE_SEIZE = 0x4206 - PTRACE_SETEVRREGS = 0x15 - PTRACE_SETFPREGS = 0xf - PTRACE_SETOPTIONS = 0x4200 - PTRACE_SETREGS = 0xd - PTRACE_SETREGS64 = 0x17 - PTRACE_SETREGSET = 0x4205 - PTRACE_SETSIGINFO = 0x4203 - PTRACE_SETSIGMASK = 0x420b - PTRACE_SETVRREGS = 0x13 - PTRACE_SETVSRREGS = 0x1c - PTRACE_SET_DEBUGREG = 0x1a - PTRACE_SINGLEBLOCK = 0x100 - PTRACE_SINGLESTEP = 0x9 - PTRACE_SYSCALL = 0x18 - PTRACE_TRACEME = 0x0 - PT_CCR = 0x26 - PT_CTR = 0x23 - PT_DAR = 0x29 - PT_DSCR = 0x2c - PT_DSISR = 0x2a - PT_FPR0 = 0x30 - PT_FPSCR = 0x50 - PT_LNK = 0x24 - PT_MSR = 0x21 - PT_NIP = 0x20 - PT_ORIG_R3 = 0x22 - PT_R0 = 0x0 - PT_R1 = 0x1 - PT_R10 = 0xa - PT_R11 = 0xb - PT_R12 = 0xc - PT_R13 = 0xd - PT_R14 = 0xe - PT_R15 = 0xf - PT_R16 = 0x10 - PT_R17 = 0x11 - PT_R18 = 0x12 - PT_R19 = 0x13 - PT_R2 = 0x2 - PT_R20 = 0x14 - PT_R21 = 0x15 - PT_R22 = 0x16 - PT_R23 = 0x17 - PT_R24 = 0x18 - PT_R25 = 0x19 - PT_R26 = 0x1a - PT_R27 = 0x1b - PT_R28 = 0x1c - PT_R29 = 0x1d - PT_R3 = 0x3 - PT_R30 = 0x1e - PT_R31 = 0x1f - PT_R4 = 0x4 - PT_R5 = 0x5 - PT_R6 = 0x6 - PT_R7 = 0x7 - PT_R8 = 0x8 - PT_R9 = 0x9 - PT_REGS_COUNT = 0x2c - PT_RESULT = 0x2b - PT_SOFTE = 0x27 - PT_TRAP = 0x28 - PT_VR0 = 0x52 - PT_VRSAVE = 0x94 - PT_VSCR = 0x93 - PT_VSR0 = 0x96 - PT_VSR31 = 0xd4 - PT_XER = 0x25 - RLIMIT_AS = 0x9 - RLIMIT_CORE = 0x4 - RLIMIT_CPU = 0x0 - RLIMIT_DATA = 0x2 - RLIMIT_FSIZE = 0x1 - RLIMIT_NOFILE = 0x7 - RLIMIT_STACK = 0x3 - RLIM_INFINITY = -0x1 - RTAX_ADVMSS = 0x8 - RTAX_CWND = 0x7 - RTAX_FEATURES = 0xc - RTAX_FEATURE_ALLFRAG = 0x8 - RTAX_FEATURE_ECN = 0x1 - RTAX_FEATURE_SACK = 0x2 - RTAX_FEATURE_TIMESTAMP = 0x4 - RTAX_HOPLIMIT = 0xa - RTAX_INITCWND = 0xb - RTAX_INITRWND = 0xe - RTAX_LOCK = 0x1 - RTAX_MAX = 0xf - RTAX_MTU = 0x2 - RTAX_QUICKACK = 0xf - RTAX_REORDERING = 0x9 - RTAX_RTO_MIN = 0xd - RTAX_RTT = 0x4 - RTAX_RTTVAR = 0x5 - RTAX_SSTHRESH = 0x6 - RTAX_UNSPEC = 0x0 - RTAX_WINDOW = 0x3 - RTA_ALIGNTO = 0x4 - RTA_MAX = 0x11 - RTCF_DIRECTSRC = 0x4000000 - RTCF_DOREDIRECT = 0x1000000 - RTCF_LOG = 0x2000000 - RTCF_MASQ = 0x400000 - RTCF_NAT = 0x800000 - RTCF_VALVE = 0x200000 - RTF_ADDRCLASSMASK = 0xf8000000 - RTF_ADDRCONF = 0x40000 - RTF_ALLONLINK = 0x20000 - RTF_BROADCAST = 0x10000000 - RTF_CACHE = 0x1000000 - RTF_DEFAULT = 0x10000 - RTF_DYNAMIC = 0x10 - RTF_FLOW = 0x2000000 - RTF_GATEWAY = 0x2 - RTF_HOST = 0x4 - RTF_INTERFACE = 0x40000000 - RTF_IRTT = 0x100 - RTF_LINKRT = 0x100000 - RTF_LOCAL = 0x80000000 - RTF_MODIFIED = 0x20 - RTF_MSS = 0x40 - RTF_MTU = 0x40 - RTF_MULTICAST = 0x20000000 - RTF_NAT = 0x8000000 - RTF_NOFORWARD = 0x1000 - RTF_NONEXTHOP = 0x200000 - RTF_NOPMTUDISC = 0x4000 - RTF_POLICY = 0x4000000 - RTF_REINSTATE = 0x8 - RTF_REJECT = 0x200 - RTF_STATIC = 0x400 - RTF_THROW = 0x2000 - RTF_UP = 0x1 - RTF_WINDOW = 0x80 - RTF_XRESOLVE = 0x800 - RTM_BASE = 0x10 - RTM_DELACTION = 0x31 - RTM_DELADDR = 0x15 - RTM_DELADDRLABEL = 0x49 - RTM_DELLINK = 0x11 - RTM_DELMDB = 0x55 - RTM_DELNEIGH = 0x1d - RTM_DELQDISC = 0x25 - RTM_DELROUTE = 0x19 - RTM_DELRULE = 0x21 - RTM_DELTCLASS = 0x29 - RTM_DELTFILTER = 0x2d - RTM_F_CLONED = 0x200 - RTM_F_EQUALIZE = 0x400 - RTM_F_NOTIFY = 0x100 - RTM_F_PREFIX = 0x800 - RTM_GETACTION = 0x32 - RTM_GETADDR = 0x16 - RTM_GETADDRLABEL = 0x4a - RTM_GETANYCAST = 0x3e - RTM_GETDCB = 0x4e - RTM_GETLINK = 0x12 - RTM_GETMDB = 0x56 - RTM_GETMULTICAST = 0x3a - RTM_GETNEIGH = 0x1e - RTM_GETNEIGHTBL = 0x42 - RTM_GETNETCONF = 0x52 - RTM_GETQDISC = 0x26 - RTM_GETROUTE = 0x1a - RTM_GETRULE = 0x22 - RTM_GETTCLASS = 0x2a - RTM_GETTFILTER = 0x2e - RTM_MAX = 0x57 - RTM_NEWACTION = 0x30 - RTM_NEWADDR = 0x14 - RTM_NEWADDRLABEL = 0x48 - RTM_NEWLINK = 0x10 - RTM_NEWMDB = 0x54 - RTM_NEWNDUSEROPT = 0x44 - RTM_NEWNEIGH = 0x1c - RTM_NEWNEIGHTBL = 0x40 - RTM_NEWNETCONF = 0x50 - RTM_NEWPREFIX = 0x34 - RTM_NEWQDISC = 0x24 - RTM_NEWROUTE = 0x18 - RTM_NEWRULE = 0x20 - RTM_NEWTCLASS = 0x28 - RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x12 - RTM_NR_MSGTYPES = 0x48 - RTM_SETDCB = 0x4f - RTM_SETLINK = 0x13 - RTM_SETNEIGHTBL = 0x43 - RTNH_ALIGNTO = 0x4 - RTNH_F_DEAD = 0x1 - RTNH_F_ONLINK = 0x4 - RTNH_F_PERVASIVE = 0x2 - RTN_MAX = 0xb - RTPROT_BIRD = 0xc - RTPROT_BOOT = 0x3 - RTPROT_DHCP = 0x10 - RTPROT_DNROUTED = 0xd - RTPROT_GATED = 0x8 - RTPROT_KERNEL = 0x2 - RTPROT_MROUTED = 0x11 - RTPROT_MRT = 0xa - RTPROT_NTK = 0xf - RTPROT_RA = 0x9 - RTPROT_REDIRECT = 0x1 - RTPROT_STATIC = 0x4 - RTPROT_UNSPEC = 0x0 - RTPROT_XORP = 0xe - RTPROT_ZEBRA = 0xb - RT_CLASS_DEFAULT = 0xfd - RT_CLASS_LOCAL = 0xff - RT_CLASS_MAIN = 0xfe - RT_CLASS_MAX = 0xff - RT_CLASS_UNSPEC = 0x0 - RUSAGE_CHILDREN = -0x1 - RUSAGE_SELF = 0x0 - RUSAGE_THREAD = 0x1 - SCM_CREDENTIALS = 0x2 - SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x1d - SCM_TIMESTAMPING = 0x25 - SCM_TIMESTAMPNS = 0x23 - SCM_WIFI_STATUS = 0x29 - SHUT_RD = 0x0 - SHUT_RDWR = 0x2 - SHUT_WR = 0x1 - SIOCADDDLCI = 0x8980 - SIOCADDMULTI = 0x8931 - SIOCADDRT = 0x890b - SIOCATMARK = 0x8905 - SIOCDARP = 0x8953 - SIOCDELDLCI = 0x8981 - SIOCDELMULTI = 0x8932 - SIOCDELRT = 0x890c - SIOCDEVPRIVATE = 0x89f0 - SIOCDIFADDR = 0x8936 - SIOCDRARP = 0x8960 - SIOCGARP = 0x8954 - SIOCGIFADDR = 0x8915 - SIOCGIFBR = 0x8940 - SIOCGIFBRDADDR = 0x8919 - SIOCGIFCONF = 0x8912 - SIOCGIFCOUNT = 0x8938 - SIOCGIFDSTADDR = 0x8917 - SIOCGIFENCAP = 0x8925 - SIOCGIFFLAGS = 0x8913 - SIOCGIFHWADDR = 0x8927 - SIOCGIFINDEX = 0x8933 - SIOCGIFMAP = 0x8970 - SIOCGIFMEM = 0x891f - SIOCGIFMETRIC = 0x891d - SIOCGIFMTU = 0x8921 - SIOCGIFNAME = 0x8910 - SIOCGIFNETMASK = 0x891b - SIOCGIFPFLAGS = 0x8935 - SIOCGIFSLAVE = 0x8929 - SIOCGIFTXQLEN = 0x8942 - SIOCGPGRP = 0x8904 - SIOCGRARP = 0x8961 - SIOCGSTAMP = 0x8906 - SIOCGSTAMPNS = 0x8907 - SIOCPROTOPRIVATE = 0x89e0 - SIOCRTMSG = 0x890d - SIOCSARP = 0x8955 - SIOCSIFADDR = 0x8916 - SIOCSIFBR = 0x8941 - SIOCSIFBRDADDR = 0x891a - SIOCSIFDSTADDR = 0x8918 - SIOCSIFENCAP = 0x8926 - SIOCSIFFLAGS = 0x8914 - SIOCSIFHWADDR = 0x8924 - SIOCSIFHWBROADCAST = 0x8937 - SIOCSIFLINK = 0x8911 - SIOCSIFMAP = 0x8971 - SIOCSIFMEM = 0x8920 - SIOCSIFMETRIC = 0x891e - SIOCSIFMTU = 0x8922 - SIOCSIFNAME = 0x8923 - SIOCSIFNETMASK = 0x891c - SIOCSIFPFLAGS = 0x8934 - SIOCSIFSLAVE = 0x8930 - SIOCSIFTXQLEN = 0x8943 - SIOCSPGRP = 0x8902 - SIOCSRARP = 0x8962 - SOCK_CLOEXEC = 0x80000 - SOCK_DCCP = 0x6 - SOCK_DGRAM = 0x2 - SOCK_NONBLOCK = 0x800 - SOCK_PACKET = 0xa - SOCK_RAW = 0x3 - SOCK_RDM = 0x4 - SOCK_SEQPACKET = 0x5 - SOCK_STREAM = 0x1 - SOL_AAL = 0x109 - SOL_ATM = 0x108 - SOL_DECNET = 0x105 - SOL_ICMPV6 = 0x3a - SOL_IP = 0x0 - SOL_IPV6 = 0x29 - SOL_IRDA = 0x10a - SOL_PACKET = 0x107 - SOL_RAW = 0xff - SOL_SOCKET = 0x1 - SOL_TCP = 0x6 - SOL_X25 = 0x106 - SOMAXCONN = 0x80 - SO_ACCEPTCONN = 0x1e - SO_ATTACH_FILTER = 0x1a - SO_BINDTODEVICE = 0x19 - SO_BPF_EXTENSIONS = 0x30 - SO_BROADCAST = 0x6 - SO_BSDCOMPAT = 0xe - SO_BUSY_POLL = 0x2e - SO_DEBUG = 0x1 - SO_DETACH_FILTER = 0x1b - SO_DOMAIN = 0x27 - SO_DONTROUTE = 0x5 - SO_ERROR = 0x4 - SO_GET_FILTER = 0x1a - SO_KEEPALIVE = 0x9 - SO_LINGER = 0xd - SO_LOCK_FILTER = 0x2c - SO_MARK = 0x24 - SO_MAX_PACING_RATE = 0x2f - SO_NOFCS = 0x2b - SO_NO_CHECK = 0xb - SO_OOBINLINE = 0xa - SO_PASSCRED = 0x14 - SO_PASSSEC = 0x22 - SO_PEEK_OFF = 0x2a - SO_PEERCRED = 0x15 - SO_PEERNAME = 0x1c - SO_PEERSEC = 0x1f - SO_PRIORITY = 0xc - SO_PROTOCOL = 0x26 - SO_RCVBUF = 0x8 - SO_RCVBUFFORCE = 0x21 - SO_RCVLOWAT = 0x10 - SO_RCVTIMEO = 0x12 - SO_REUSEADDR = 0x2 - SO_REUSEPORT = 0xf - SO_RXQ_OVFL = 0x28 - SO_SECURITY_AUTHENTICATION = 0x16 - SO_SECURITY_ENCRYPTION_NETWORK = 0x18 - SO_SECURITY_ENCRYPTION_TRANSPORT = 0x17 - SO_SELECT_ERR_QUEUE = 0x2d - SO_SNDBUF = 0x7 - SO_SNDBUFFORCE = 0x20 - SO_SNDLOWAT = 0x11 - SO_SNDTIMEO = 0x13 - SO_TIMESTAMP = 0x1d - SO_TIMESTAMPING = 0x25 - SO_TIMESTAMPNS = 0x23 - SO_TYPE = 0x3 - SO_WIFI_STATUS = 0x29 - S_BLKSIZE = 0x200 - S_IEXEC = 0x40 - S_IFBLK = 0x6000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFIFO = 0x1000 - S_IFLNK = 0xa000 - S_IFMT = 0xf000 - S_IFREG = 0x8000 - S_IFSOCK = 0xc000 - S_IREAD = 0x100 - S_IRGRP = 0x20 - S_IROTH = 0x4 - S_IRUSR = 0x100 - S_IRWXG = 0x38 - S_IRWXO = 0x7 - S_IRWXU = 0x1c0 - S_ISGID = 0x400 - S_ISUID = 0x800 - S_ISVTX = 0x200 - S_IWGRP = 0x10 - S_IWOTH = 0x2 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXGRP = 0x8 - S_IXOTH = 0x1 - S_IXUSR = 0x40 - TAB0 = 0x0 - TAB1 = 0x400 - TAB2 = 0x800 - TAB3 = 0xc00 - TABDLY = 0xc00 - TCFLSH = 0x2000741f - TCGETA = 0x40147417 - TCGETS = 0x402c7413 - TCIFLUSH = 0x0 - TCIOFF = 0x2 - TCIOFLUSH = 0x2 - TCION = 0x3 - TCOFLUSH = 0x1 - TCOOFF = 0x0 - TCOON = 0x1 - TCP_CONGESTION = 0xd - TCP_COOKIE_IN_ALWAYS = 0x1 - TCP_COOKIE_MAX = 0x10 - TCP_COOKIE_MIN = 0x8 - TCP_COOKIE_OUT_NEVER = 0x2 - TCP_COOKIE_PAIR_SIZE = 0x20 - TCP_COOKIE_TRANSACTIONS = 0xf - TCP_CORK = 0x3 - TCP_DEFER_ACCEPT = 0x9 - TCP_FASTOPEN = 0x17 - TCP_INFO = 0xb - TCP_KEEPCNT = 0x6 - TCP_KEEPIDLE = 0x4 - TCP_KEEPINTVL = 0x5 - TCP_LINGER2 = 0x8 - TCP_MAXSEG = 0x2 - TCP_MAXWIN = 0xffff - TCP_MAX_WINSHIFT = 0xe - TCP_MD5SIG = 0xe - TCP_MD5SIG_MAXKEYLEN = 0x50 - TCP_MSS = 0x200 - TCP_MSS_DEFAULT = 0x218 - TCP_MSS_DESIRED = 0x4c4 - TCP_NODELAY = 0x1 - TCP_QUEUE_SEQ = 0x15 - TCP_QUICKACK = 0xc - TCP_REPAIR = 0x13 - TCP_REPAIR_OPTIONS = 0x16 - TCP_REPAIR_QUEUE = 0x14 - TCP_SYNCNT = 0x7 - TCP_S_DATA_IN = 0x4 - TCP_S_DATA_OUT = 0x8 - TCP_THIN_DUPACK = 0x11 - TCP_THIN_LINEAR_TIMEOUTS = 0x10 - TCP_TIMESTAMP = 0x18 - TCP_USER_TIMEOUT = 0x12 - TCP_WINDOW_CLAMP = 0xa - TCSAFLUSH = 0x2 - TCSBRK = 0x2000741d - TCSBRKP = 0x5425 - TCSETA = 0x80147418 - TCSETAF = 0x8014741c - TCSETAW = 0x80147419 - TCSETS = 0x802c7414 - TCSETSF = 0x802c7416 - TCSETSW = 0x802c7415 - TCXONC = 0x2000741e - TIOCCBRK = 0x5428 - TIOCCONS = 0x541d - TIOCEXCL = 0x540c - TIOCGDEV = 0x40045432 - TIOCGETC = 0x40067412 - TIOCGETD = 0x5424 - TIOCGETP = 0x40067408 - TIOCGEXCL = 0x40045440 - TIOCGICOUNT = 0x545d - TIOCGLCKTRMIOS = 0x5456 - TIOCGLTC = 0x40067474 - TIOCGPGRP = 0x40047477 - TIOCGPKT = 0x40045438 - TIOCGPTLCK = 0x40045439 - TIOCGPTN = 0x40045430 - TIOCGRS485 = 0x542e - TIOCGSERIAL = 0x541e - TIOCGSID = 0x5429 - TIOCGSOFTCAR = 0x5419 - TIOCGWINSZ = 0x40087468 - TIOCINQ = 0x4004667f - TIOCLINUX = 0x541c - TIOCMBIC = 0x5417 - TIOCMBIS = 0x5416 - TIOCMGET = 0x5415 - TIOCMIWAIT = 0x545c - TIOCMSET = 0x5418 - TIOCM_CAR = 0x40 - TIOCM_CD = 0x40 - TIOCM_CTS = 0x20 - TIOCM_DSR = 0x100 - TIOCM_DTR = 0x2 - TIOCM_LE = 0x1 - TIOCM_LOOP = 0x8000 - TIOCM_OUT1 = 0x2000 - TIOCM_OUT2 = 0x4000 - TIOCM_RI = 0x80 - TIOCM_RNG = 0x80 - TIOCM_RTS = 0x4 - TIOCM_SR = 0x10 - TIOCM_ST = 0x8 - TIOCNOTTY = 0x5422 - TIOCNXCL = 0x540d - TIOCOUTQ = 0x40047473 - TIOCPKT = 0x5420 - TIOCPKT_DATA = 0x0 - TIOCPKT_DOSTOP = 0x20 - TIOCPKT_FLUSHREAD = 0x1 - TIOCPKT_FLUSHWRITE = 0x2 - TIOCPKT_IOCTL = 0x40 - TIOCPKT_NOSTOP = 0x10 - TIOCPKT_START = 0x8 - TIOCPKT_STOP = 0x4 - TIOCSBRK = 0x5427 - TIOCSCTTY = 0x540e - TIOCSERCONFIG = 0x5453 - TIOCSERGETLSR = 0x5459 - TIOCSERGETMULTI = 0x545a - TIOCSERGSTRUCT = 0x5458 - TIOCSERGWILD = 0x5454 - TIOCSERSETMULTI = 0x545b - TIOCSERSWILD = 0x5455 - TIOCSER_TEMT = 0x1 - TIOCSETC = 0x80067411 - TIOCSETD = 0x5423 - TIOCSETN = 0x8006740a - TIOCSETP = 0x80067409 - TIOCSIG = 0x80045436 - TIOCSLCKTRMIOS = 0x5457 - TIOCSLTC = 0x80067475 - TIOCSPGRP = 0x80047476 - TIOCSPTLCK = 0x80045431 - TIOCSRS485 = 0x542f - TIOCSSERIAL = 0x541f - TIOCSSOFTCAR = 0x541a - TIOCSTART = 0x2000746e - TIOCSTI = 0x5412 - TIOCSTOP = 0x2000746f - TIOCSWINSZ = 0x80087467 - TIOCVHANGUP = 0x5437 - TOSTOP = 0x400000 - TUNATTACHFILTER = 0x801054d5 - TUNDETACHFILTER = 0x801054d6 - TUNGETFEATURES = 0x400454cf - TUNGETFILTER = 0x401054db - TUNGETIFF = 0x400454d2 - TUNGETSNDBUF = 0x400454d3 - TUNGETVNETHDRSZ = 0x400454d7 - TUNSETDEBUG = 0x800454c9 - TUNSETGROUP = 0x800454ce - TUNSETIFF = 0x800454ca - TUNSETIFINDEX = 0x800454da - TUNSETLINK = 0x800454cd - TUNSETNOCSUM = 0x800454c8 - TUNSETOFFLOAD = 0x800454d0 - TUNSETOWNER = 0x800454cc - TUNSETPERSIST = 0x800454cb - TUNSETQUEUE = 0x800454d9 - TUNSETSNDBUF = 0x800454d4 - TUNSETTXFILTER = 0x800454d1 - TUNSETVNETHDRSZ = 0x800454d8 - VDISCARD = 0x10 - VEOF = 0x4 - VEOL = 0x6 - VEOL2 = 0x8 - VERASE = 0x2 - VINTR = 0x0 - VKILL = 0x3 - VLNEXT = 0xf - VMIN = 0x5 - VQUIT = 0x1 - VREPRINT = 0xb - VSTART = 0xd - VSTOP = 0xe - VSUSP = 0xc - VSWTC = 0x9 - VT0 = 0x0 - VT1 = 0x10000 - VTDLY = 0x10000 - VTIME = 0x7 - VWERASE = 0xa - WALL = 0x40000000 - WCLONE = 0x80000000 - WCONTINUED = 0x8 - WEXITED = 0x4 - WNOHANG = 0x1 - WNOTHREAD = 0x20000000 - WNOWAIT = 0x1000000 - WORDSIZE = 0x40 - WSTOPPED = 0x2 - WUNTRACED = 0x2 - XCASE = 0x4000 - XTABS = 0xc00 -) - -// Errors -const ( - E2BIG = syscall.Errno(0x7) - EACCES = syscall.Errno(0xd) - EADDRINUSE = syscall.Errno(0x62) - EADDRNOTAVAIL = syscall.Errno(0x63) - EADV = syscall.Errno(0x44) - EAFNOSUPPORT = syscall.Errno(0x61) - EAGAIN = syscall.Errno(0xb) - EALREADY = syscall.Errno(0x72) - EBADE = syscall.Errno(0x34) - EBADF = syscall.Errno(0x9) - EBADFD = syscall.Errno(0x4d) - EBADMSG = syscall.Errno(0x4a) - EBADR = syscall.Errno(0x35) - EBADRQC = syscall.Errno(0x38) - EBADSLT = syscall.Errno(0x39) - EBFONT = syscall.Errno(0x3b) - EBUSY = syscall.Errno(0x10) - ECANCELED = syscall.Errno(0x7d) - ECHILD = syscall.Errno(0xa) - ECHRNG = syscall.Errno(0x2c) - ECOMM = syscall.Errno(0x46) - ECONNABORTED = syscall.Errno(0x67) - ECONNREFUSED = syscall.Errno(0x6f) - ECONNRESET = syscall.Errno(0x68) - EDEADLK = syscall.Errno(0x23) - EDEADLOCK = syscall.Errno(0x3a) - EDESTADDRREQ = syscall.Errno(0x59) - EDOM = syscall.Errno(0x21) - EDOTDOT = syscall.Errno(0x49) - EDQUOT = syscall.Errno(0x7a) - EEXIST = syscall.Errno(0x11) - EFAULT = syscall.Errno(0xe) - EFBIG = syscall.Errno(0x1b) - EHOSTDOWN = syscall.Errno(0x70) - EHOSTUNREACH = syscall.Errno(0x71) - EHWPOISON = syscall.Errno(0x85) - EIDRM = syscall.Errno(0x2b) - EILSEQ = syscall.Errno(0x54) - EINPROGRESS = syscall.Errno(0x73) - EINTR = syscall.Errno(0x4) - EINVAL = syscall.Errno(0x16) - EIO = syscall.Errno(0x5) - EISCONN = syscall.Errno(0x6a) - EISDIR = syscall.Errno(0x15) - EISNAM = syscall.Errno(0x78) - EKEYEXPIRED = syscall.Errno(0x7f) - EKEYREJECTED = syscall.Errno(0x81) - EKEYREVOKED = syscall.Errno(0x80) - EL2HLT = syscall.Errno(0x33) - EL2NSYNC = syscall.Errno(0x2d) - EL3HLT = syscall.Errno(0x2e) - EL3RST = syscall.Errno(0x2f) - ELIBACC = syscall.Errno(0x4f) - ELIBBAD = syscall.Errno(0x50) - ELIBEXEC = syscall.Errno(0x53) - ELIBMAX = syscall.Errno(0x52) - ELIBSCN = syscall.Errno(0x51) - ELNRNG = syscall.Errno(0x30) - ELOOP = syscall.Errno(0x28) - EMEDIUMTYPE = syscall.Errno(0x7c) - EMFILE = syscall.Errno(0x18) - EMLINK = syscall.Errno(0x1f) - EMSGSIZE = syscall.Errno(0x5a) - EMULTIHOP = syscall.Errno(0x48) - ENAMETOOLONG = syscall.Errno(0x24) - ENAVAIL = syscall.Errno(0x77) - ENETDOWN = syscall.Errno(0x64) - ENETRESET = syscall.Errno(0x66) - ENETUNREACH = syscall.Errno(0x65) - ENFILE = syscall.Errno(0x17) - ENOANO = syscall.Errno(0x37) - ENOBUFS = syscall.Errno(0x69) - ENOCSI = syscall.Errno(0x32) - ENODATA = syscall.Errno(0x3d) - ENODEV = syscall.Errno(0x13) - ENOENT = syscall.Errno(0x2) - ENOEXEC = syscall.Errno(0x8) - ENOKEY = syscall.Errno(0x7e) - ENOLCK = syscall.Errno(0x25) - ENOLINK = syscall.Errno(0x43) - ENOMEDIUM = syscall.Errno(0x7b) - ENOMEM = syscall.Errno(0xc) - ENOMSG = syscall.Errno(0x2a) - ENONET = syscall.Errno(0x40) - ENOPKG = syscall.Errno(0x41) - ENOPROTOOPT = syscall.Errno(0x5c) - ENOSPC = syscall.Errno(0x1c) - ENOSR = syscall.Errno(0x3f) - ENOSTR = syscall.Errno(0x3c) - ENOSYS = syscall.Errno(0x26) - ENOTBLK = syscall.Errno(0xf) - ENOTCONN = syscall.Errno(0x6b) - ENOTDIR = syscall.Errno(0x14) - ENOTEMPTY = syscall.Errno(0x27) - ENOTNAM = syscall.Errno(0x76) - ENOTRECOVERABLE = syscall.Errno(0x83) - ENOTSOCK = syscall.Errno(0x58) - ENOTSUP = syscall.Errno(0x5f) - ENOTTY = syscall.Errno(0x19) - ENOTUNIQ = syscall.Errno(0x4c) - ENXIO = syscall.Errno(0x6) - EOPNOTSUPP = syscall.Errno(0x5f) - EOVERFLOW = syscall.Errno(0x4b) - EOWNERDEAD = syscall.Errno(0x82) - EPERM = syscall.Errno(0x1) - EPFNOSUPPORT = syscall.Errno(0x60) - EPIPE = syscall.Errno(0x20) - EPROTO = syscall.Errno(0x47) - EPROTONOSUPPORT = syscall.Errno(0x5d) - EPROTOTYPE = syscall.Errno(0x5b) - ERANGE = syscall.Errno(0x22) - EREMCHG = syscall.Errno(0x4e) - EREMOTE = syscall.Errno(0x42) - EREMOTEIO = syscall.Errno(0x79) - ERESTART = syscall.Errno(0x55) - ERFKILL = syscall.Errno(0x84) - EROFS = syscall.Errno(0x1e) - ESHUTDOWN = syscall.Errno(0x6c) - ESOCKTNOSUPPORT = syscall.Errno(0x5e) - ESPIPE = syscall.Errno(0x1d) - ESRCH = syscall.Errno(0x3) - ESRMNT = syscall.Errno(0x45) - ESTALE = syscall.Errno(0x74) - ESTRPIPE = syscall.Errno(0x56) - ETIME = syscall.Errno(0x3e) - ETIMEDOUT = syscall.Errno(0x6e) - ETOOMANYREFS = syscall.Errno(0x6d) - ETXTBSY = syscall.Errno(0x1a) - EUCLEAN = syscall.Errno(0x75) - EUNATCH = syscall.Errno(0x31) - EUSERS = syscall.Errno(0x57) - EWOULDBLOCK = syscall.Errno(0xb) - EXDEV = syscall.Errno(0x12) - EXFULL = syscall.Errno(0x36) -) - -// Signals -const ( - SIGABRT = syscall.Signal(0x6) - SIGALRM = syscall.Signal(0xe) - SIGBUS = syscall.Signal(0x7) - SIGCHLD = syscall.Signal(0x11) - SIGCLD = syscall.Signal(0x11) - SIGCONT = syscall.Signal(0x12) - SIGFPE = syscall.Signal(0x8) - SIGHUP = syscall.Signal(0x1) - SIGILL = syscall.Signal(0x4) - SIGINT = syscall.Signal(0x2) - SIGIO = syscall.Signal(0x1d) - SIGIOT = syscall.Signal(0x6) - SIGKILL = syscall.Signal(0x9) - SIGPIPE = syscall.Signal(0xd) - SIGPOLL = syscall.Signal(0x1d) - SIGPROF = syscall.Signal(0x1b) - SIGPWR = syscall.Signal(0x1e) - SIGQUIT = syscall.Signal(0x3) - SIGSEGV = syscall.Signal(0xb) - SIGSTKFLT = syscall.Signal(0x10) - SIGSTOP = syscall.Signal(0x13) - SIGSYS = syscall.Signal(0x1f) - SIGTERM = syscall.Signal(0xf) - SIGTRAP = syscall.Signal(0x5) - SIGTSTP = syscall.Signal(0x14) - SIGTTIN = syscall.Signal(0x15) - SIGTTOU = syscall.Signal(0x16) - SIGUNUSED = syscall.Signal(0x1f) - SIGURG = syscall.Signal(0x17) - SIGUSR1 = syscall.Signal(0xa) - SIGUSR2 = syscall.Signal(0xc) - SIGVTALRM = syscall.Signal(0x1a) - SIGWINCH = syscall.Signal(0x1c) - SIGXCPU = syscall.Signal(0x18) - SIGXFSZ = syscall.Signal(0x19) -) - -// Error table -var errors = [...]string{ - 1: "operation not permitted", - 2: "no such file or directory", - 3: "no such process", - 4: "interrupted system call", - 5: "input/output error", - 6: "no such device or address", - 7: "argument list too long", - 8: "exec format error", - 9: "bad file descriptor", - 10: "no child processes", - 11: "resource temporarily unavailable", - 12: "cannot allocate memory", - 13: "permission denied", - 14: "bad address", - 15: "block device required", - 16: "device or resource busy", - 17: "file exists", - 18: "invalid cross-device link", - 19: "no such device", - 20: "not a directory", - 21: "is a directory", - 22: "invalid argument", - 23: "too many open files in system", - 24: "too many open files", - 25: "inappropriate ioctl for device", - 26: "text file busy", - 27: "file too large", - 28: "no space left on device", - 29: "illegal seek", - 30: "read-only file system", - 31: "too many links", - 32: "broken pipe", - 33: "numerical argument out of domain", - 34: "numerical result out of range", - 35: "resource deadlock avoided", - 36: "file name too long", - 37: "no locks available", - 38: "function not implemented", - 39: "directory not empty", - 40: "too many levels of symbolic links", - 42: "no message of desired type", - 43: "identifier removed", - 44: "channel number out of range", - 45: "level 2 not synchronized", - 46: "level 3 halted", - 47: "level 3 reset", - 48: "link number out of range", - 49: "protocol driver not attached", - 50: "no CSI structure available", - 51: "level 2 halted", - 52: "invalid exchange", - 53: "invalid request descriptor", - 54: "exchange full", - 55: "no anode", - 56: "invalid request code", - 57: "invalid slot", - 58: "file locking deadlock error", - 59: "bad font file format", - 60: "device not a stream", - 61: "no data available", - 62: "timer expired", - 63: "out of streams resources", - 64: "machine is not on the network", - 65: "package not installed", - 66: "object is remote", - 67: "link has been severed", - 68: "advertise error", - 69: "srmount error", - 70: "communication error on send", - 71: "protocol error", - 72: "multihop attempted", - 73: "RFS specific error", - 74: "bad message", - 75: "value too large for defined data type", - 76: "name not unique on network", - 77: "file descriptor in bad state", - 78: "remote address changed", - 79: "can not access a needed shared library", - 80: "accessing a corrupted shared library", - 81: ".lib section in a.out corrupted", - 82: "attempting to link in too many shared libraries", - 83: "cannot exec a shared library directly", - 84: "invalid or incomplete multibyte or wide character", - 85: "interrupted system call should be restarted", - 86: "streams pipe error", - 87: "too many users", - 88: "socket operation on non-socket", - 89: "destination address required", - 90: "message too long", - 91: "protocol wrong type for socket", - 92: "protocol not available", - 93: "protocol not supported", - 94: "socket type not supported", - 95: "operation not supported", - 96: "protocol family not supported", - 97: "address family not supported by protocol", - 98: "address already in use", - 99: "cannot assign requested address", - 100: "network is down", - 101: "network is unreachable", - 102: "network dropped connection on reset", - 103: "software caused connection abort", - 104: "connection reset by peer", - 105: "no buffer space available", - 106: "transport endpoint is already connected", - 107: "transport endpoint is not connected", - 108: "cannot send after transport endpoint shutdown", - 109: "too many references: cannot splice", - 110: "connection timed out", - 111: "connection refused", - 112: "host is down", - 113: "no route to host", - 114: "operation already in progress", - 115: "operation now in progress", - 116: "stale file handle", - 117: "structure needs cleaning", - 118: "not a XENIX named type file", - 119: "no XENIX semaphores available", - 120: "is a named type file", - 121: "remote I/O error", - 122: "disk quota exceeded", - 123: "no medium found", - 124: "wrong medium type", - 125: "operation canceled", - 126: "required key not available", - 127: "key has expired", - 128: "key has been revoked", - 129: "key was rejected by service", - 130: "owner died", - 131: "state not recoverable", - 132: "operation not possible due to RF-kill", - 133: "memory page has hardware error", -} - -// Signal table -var signals = [...]string{ - 1: "hangup", - 2: "interrupt", - 3: "quit", - 4: "illegal instruction", - 5: "trace/breakpoint trap", - 6: "aborted", - 7: "bus error", - 8: "floating point exception", - 9: "killed", - 10: "user defined signal 1", - 11: "segmentation fault", - 12: "user defined signal 2", - 13: "broken pipe", - 14: "alarm clock", - 15: "terminated", - 16: "stack fault", - 17: "child exited", - 18: "continued", - 19: "stopped (signal)", - 20: "stopped", - 21: "stopped (tty input)", - 22: "stopped (tty output)", - 23: "urgent I/O condition", - 24: "CPU time limit exceeded", - 25: "file size limit exceeded", - 26: "virtual timer expired", - 27: "profiling timer expired", - 28: "window changed", - 29: "I/O possible", - 30: "power failure", - 31: "bad system call", -} diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go deleted file mode 100644 index 0861bd5666..0000000000 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ /dev/null @@ -1,1968 +0,0 @@ -// mkerrors.sh -m64 -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -// +build ppc64le,linux - -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs -- -m64 _const.go - -package unix - -import "syscall" - -const ( - AF_ALG = 0x26 - AF_APPLETALK = 0x5 - AF_ASH = 0x12 - AF_ATMPVC = 0x8 - AF_ATMSVC = 0x14 - AF_AX25 = 0x3 - AF_BLUETOOTH = 0x1f - AF_BRIDGE = 0x7 - AF_CAIF = 0x25 - AF_CAN = 0x1d - AF_DECnet = 0xc - AF_ECONET = 0x13 - AF_FILE = 0x1 - AF_IEEE802154 = 0x24 - AF_INET = 0x2 - AF_INET6 = 0xa - AF_IPX = 0x4 - AF_IRDA = 0x17 - AF_ISDN = 0x22 - AF_IUCV = 0x20 - AF_KEY = 0xf - AF_LLC = 0x1a - AF_LOCAL = 0x1 - AF_MAX = 0x29 - AF_NETBEUI = 0xd - AF_NETLINK = 0x10 - AF_NETROM = 0x6 - AF_NFC = 0x27 - AF_PACKET = 0x11 - AF_PHONET = 0x23 - AF_PPPOX = 0x18 - AF_RDS = 0x15 - AF_ROSE = 0xb - AF_ROUTE = 0x10 - AF_RXRPC = 0x21 - AF_SECURITY = 0xe - AF_SNA = 0x16 - AF_TIPC = 0x1e - AF_UNIX = 0x1 - AF_UNSPEC = 0x0 - AF_VSOCK = 0x28 - AF_WANPIPE = 0x19 - AF_X25 = 0x9 - ARPHRD_ADAPT = 0x108 - ARPHRD_APPLETLK = 0x8 - ARPHRD_ARCNET = 0x7 - ARPHRD_ASH = 0x30d - ARPHRD_ATM = 0x13 - ARPHRD_AX25 = 0x3 - ARPHRD_BIF = 0x307 - ARPHRD_CAIF = 0x336 - ARPHRD_CAN = 0x118 - ARPHRD_CHAOS = 0x5 - ARPHRD_CISCO = 0x201 - ARPHRD_CSLIP = 0x101 - ARPHRD_CSLIP6 = 0x103 - ARPHRD_DDCMP = 0x205 - ARPHRD_DLCI = 0xf - ARPHRD_ECONET = 0x30e - ARPHRD_EETHER = 0x2 - ARPHRD_ETHER = 0x1 - ARPHRD_EUI64 = 0x1b - ARPHRD_FCAL = 0x311 - ARPHRD_FCFABRIC = 0x313 - ARPHRD_FCPL = 0x312 - ARPHRD_FCPP = 0x310 - ARPHRD_FDDI = 0x306 - ARPHRD_FRAD = 0x302 - ARPHRD_HDLC = 0x201 - ARPHRD_HIPPI = 0x30c - ARPHRD_HWX25 = 0x110 - ARPHRD_IEEE1394 = 0x18 - ARPHRD_IEEE802 = 0x6 - ARPHRD_IEEE80211 = 0x321 - ARPHRD_IEEE80211_PRISM = 0x322 - ARPHRD_IEEE80211_RADIOTAP = 0x323 - ARPHRD_IEEE802154 = 0x324 - ARPHRD_IEEE802154_MONITOR = 0x325 - ARPHRD_IEEE802_TR = 0x320 - ARPHRD_INFINIBAND = 0x20 - ARPHRD_IP6GRE = 0x337 - ARPHRD_IPDDP = 0x309 - ARPHRD_IPGRE = 0x30a - ARPHRD_IRDA = 0x30f - ARPHRD_LAPB = 0x204 - ARPHRD_LOCALTLK = 0x305 - ARPHRD_LOOPBACK = 0x304 - ARPHRD_METRICOM = 0x17 - ARPHRD_NETLINK = 0x338 - ARPHRD_NETROM = 0x0 - ARPHRD_NONE = 0xfffe - ARPHRD_PHONET = 0x334 - ARPHRD_PHONET_PIPE = 0x335 - ARPHRD_PIMREG = 0x30b - ARPHRD_PPP = 0x200 - ARPHRD_PRONET = 0x4 - ARPHRD_RAWHDLC = 0x206 - ARPHRD_ROSE = 0x10e - ARPHRD_RSRVD = 0x104 - ARPHRD_SIT = 0x308 - ARPHRD_SKIP = 0x303 - ARPHRD_SLIP = 0x100 - ARPHRD_SLIP6 = 0x102 - ARPHRD_TUNNEL = 0x300 - ARPHRD_TUNNEL6 = 0x301 - ARPHRD_VOID = 0xffff - ARPHRD_X25 = 0x10f - B0 = 0x0 - B1000000 = 0x17 - B110 = 0x3 - B115200 = 0x11 - B1152000 = 0x18 - B1200 = 0x9 - B134 = 0x4 - B150 = 0x5 - B1500000 = 0x19 - B1800 = 0xa - B19200 = 0xe - B200 = 0x6 - B2000000 = 0x1a - B230400 = 0x12 - B2400 = 0xb - B2500000 = 0x1b - B300 = 0x7 - B3000000 = 0x1c - B3500000 = 0x1d - B38400 = 0xf - B4000000 = 0x1e - B460800 = 0x13 - B4800 = 0xc - B50 = 0x1 - B500000 = 0x14 - B57600 = 0x10 - B576000 = 0x15 - B600 = 0x8 - B75 = 0x2 - B921600 = 0x16 - B9600 = 0xd - BOTHER = 0x1f - BPF_A = 0x10 - BPF_ABS = 0x20 - BPF_ADD = 0x0 - BPF_ALU = 0x4 - BPF_AND = 0x50 - BPF_B = 0x10 - BPF_DIV = 0x30 - BPF_H = 0x8 - BPF_IMM = 0x0 - BPF_IND = 0x40 - BPF_JA = 0x0 - BPF_JEQ = 0x10 - BPF_JGE = 0x30 - BPF_JGT = 0x20 - BPF_JMP = 0x5 - BPF_JSET = 0x40 - BPF_K = 0x0 - BPF_LD = 0x0 - BPF_LDX = 0x1 - BPF_LEN = 0x80 - BPF_LSH = 0x60 - BPF_MAJOR_VERSION = 0x1 - BPF_MAXINSNS = 0x1000 - BPF_MEM = 0x60 - BPF_MEMWORDS = 0x10 - BPF_MINOR_VERSION = 0x1 - BPF_MISC = 0x7 - BPF_MOD = 0x90 - BPF_MSH = 0xa0 - BPF_MUL = 0x20 - BPF_NEG = 0x80 - BPF_OR = 0x40 - BPF_RET = 0x6 - BPF_RSH = 0x70 - BPF_ST = 0x2 - BPF_STX = 0x3 - BPF_SUB = 0x10 - BPF_TAX = 0x0 - BPF_TXA = 0x80 - BPF_W = 0x0 - BPF_X = 0x8 - BPF_XOR = 0xa0 - BRKINT = 0x2 - BS0 = 0x0 - BS1 = 0x8000 - BSDLY = 0x8000 - CBAUD = 0xff - CBAUDEX = 0x0 - CFLUSH = 0xf - CIBAUD = 0xff0000 - CLOCAL = 0x8000 - CLOCK_BOOTTIME = 0x7 - CLOCK_BOOTTIME_ALARM = 0x9 - CLOCK_DEFAULT = 0x0 - CLOCK_EXT = 0x1 - CLOCK_INT = 0x2 - CLOCK_MONOTONIC = 0x1 - CLOCK_MONOTONIC_COARSE = 0x6 - CLOCK_MONOTONIC_RAW = 0x4 - CLOCK_PROCESS_CPUTIME_ID = 0x2 - CLOCK_REALTIME = 0x0 - CLOCK_REALTIME_ALARM = 0x8 - CLOCK_REALTIME_COARSE = 0x5 - CLOCK_THREAD_CPUTIME_ID = 0x3 - CLOCK_TXFROMRX = 0x4 - CLOCK_TXINT = 0x3 - CLONE_CHILD_CLEARTID = 0x200000 - CLONE_CHILD_SETTID = 0x1000000 - CLONE_DETACHED = 0x400000 - CLONE_FILES = 0x400 - CLONE_FS = 0x200 - CLONE_IO = 0x80000000 - CLONE_NEWIPC = 0x8000000 - CLONE_NEWNET = 0x40000000 - CLONE_NEWNS = 0x20000 - CLONE_NEWPID = 0x20000000 - CLONE_NEWUSER = 0x10000000 - CLONE_NEWUTS = 0x4000000 - CLONE_PARENT = 0x8000 - CLONE_PARENT_SETTID = 0x100000 - CLONE_PTRACE = 0x2000 - CLONE_SETTLS = 0x80000 - CLONE_SIGHAND = 0x800 - CLONE_SYSVSEM = 0x40000 - CLONE_THREAD = 0x10000 - CLONE_UNTRACED = 0x800000 - CLONE_VFORK = 0x4000 - CLONE_VM = 0x100 - CMSPAR = 0x40000000 - CR0 = 0x0 - CR1 = 0x1000 - CR2 = 0x2000 - CR3 = 0x3000 - CRDLY = 0x3000 - CREAD = 0x800 - CRTSCTS = 0x80000000 - CS5 = 0x0 - CS6 = 0x100 - CS7 = 0x200 - CS8 = 0x300 - CSIGNAL = 0xff - CSIZE = 0x300 - CSTART = 0x11 - CSTATUS = 0x0 - CSTOP = 0x13 - CSTOPB = 0x400 - CSUSP = 0x1a - DT_BLK = 0x6 - DT_CHR = 0x2 - DT_DIR = 0x4 - DT_FIFO = 0x1 - DT_LNK = 0xa - DT_REG = 0x8 - DT_SOCK = 0xc - DT_UNKNOWN = 0x0 - DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x40 - ECHOE = 0x2 - ECHOK = 0x4 - ECHOKE = 0x1 - ECHONL = 0x10 - ECHOPRT = 0x20 - ENCODING_DEFAULT = 0x0 - ENCODING_FM_MARK = 0x3 - ENCODING_FM_SPACE = 0x4 - ENCODING_MANCHESTER = 0x5 - ENCODING_NRZ = 0x1 - ENCODING_NRZI = 0x2 - EPOLLERR = 0x8 - EPOLLET = 0x80000000 - EPOLLHUP = 0x10 - EPOLLIN = 0x1 - EPOLLMSG = 0x400 - EPOLLONESHOT = 0x40000000 - EPOLLOUT = 0x4 - EPOLLPRI = 0x2 - EPOLLRDBAND = 0x80 - EPOLLRDHUP = 0x2000 - EPOLLRDNORM = 0x40 - EPOLLWAKEUP = 0x20000000 - EPOLLWRBAND = 0x200 - EPOLLWRNORM = 0x100 - EPOLL_CLOEXEC = 0x80000 - EPOLL_CTL_ADD = 0x1 - EPOLL_CTL_DEL = 0x2 - EPOLL_CTL_MOD = 0x3 - ETH_P_1588 = 0x88f7 - ETH_P_8021AD = 0x88a8 - ETH_P_8021AH = 0x88e7 - ETH_P_8021Q = 0x8100 - ETH_P_802_2 = 0x4 - ETH_P_802_3 = 0x1 - ETH_P_802_3_MIN = 0x600 - ETH_P_802_EX1 = 0x88b5 - ETH_P_AARP = 0x80f3 - ETH_P_AF_IUCV = 0xfbfb - ETH_P_ALL = 0x3 - ETH_P_AOE = 0x88a2 - ETH_P_ARCNET = 0x1a - ETH_P_ARP = 0x806 - ETH_P_ATALK = 0x809b - ETH_P_ATMFATE = 0x8884 - ETH_P_ATMMPOA = 0x884c - ETH_P_AX25 = 0x2 - ETH_P_BATMAN = 0x4305 - ETH_P_BPQ = 0x8ff - ETH_P_CAIF = 0xf7 - ETH_P_CAN = 0xc - ETH_P_CANFD = 0xd - ETH_P_CONTROL = 0x16 - ETH_P_CUST = 0x6006 - ETH_P_DDCMP = 0x6 - ETH_P_DEC = 0x6000 - ETH_P_DIAG = 0x6005 - ETH_P_DNA_DL = 0x6001 - ETH_P_DNA_RC = 0x6002 - ETH_P_DNA_RT = 0x6003 - ETH_P_DSA = 0x1b - ETH_P_ECONET = 0x18 - ETH_P_EDSA = 0xdada - ETH_P_FCOE = 0x8906 - ETH_P_FIP = 0x8914 - ETH_P_HDLC = 0x19 - ETH_P_IEEE802154 = 0xf6 - ETH_P_IEEEPUP = 0xa00 - ETH_P_IEEEPUPAT = 0xa01 - ETH_P_IP = 0x800 - ETH_P_IPV6 = 0x86dd - ETH_P_IPX = 0x8137 - ETH_P_IRDA = 0x17 - ETH_P_LAT = 0x6004 - ETH_P_LINK_CTL = 0x886c - ETH_P_LOCALTALK = 0x9 - ETH_P_LOOP = 0x60 - ETH_P_MOBITEX = 0x15 - ETH_P_MPLS_MC = 0x8848 - ETH_P_MPLS_UC = 0x8847 - ETH_P_MVRP = 0x88f5 - ETH_P_PAE = 0x888e - ETH_P_PAUSE = 0x8808 - ETH_P_PHONET = 0xf5 - ETH_P_PPPTALK = 0x10 - ETH_P_PPP_DISC = 0x8863 - ETH_P_PPP_MP = 0x8 - ETH_P_PPP_SES = 0x8864 - ETH_P_PRP = 0x88fb - ETH_P_PUP = 0x200 - ETH_P_PUPAT = 0x201 - ETH_P_QINQ1 = 0x9100 - ETH_P_QINQ2 = 0x9200 - ETH_P_QINQ3 = 0x9300 - ETH_P_RARP = 0x8035 - ETH_P_SCA = 0x6007 - ETH_P_SLOW = 0x8809 - ETH_P_SNAP = 0x5 - ETH_P_TDLS = 0x890d - ETH_P_TEB = 0x6558 - ETH_P_TIPC = 0x88ca - ETH_P_TRAILER = 0x1c - ETH_P_TR_802_2 = 0x11 - ETH_P_WAN_PPP = 0x7 - ETH_P_WCCP = 0x883e - ETH_P_X25 = 0x805 - EXTA = 0xe - EXTB = 0xf - EXTPROC = 0x10000000 - FD_CLOEXEC = 0x1 - FD_SETSIZE = 0x400 - FF0 = 0x0 - FF1 = 0x4000 - FFDLY = 0x4000 - FLUSHO = 0x800000 - F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0x406 - F_EXLCK = 0x4 - F_GETFD = 0x1 - F_GETFL = 0x3 - F_GETLEASE = 0x401 - F_GETLK = 0x5 - F_GETLK64 = 0xc - F_GETOWN = 0x9 - F_GETOWN_EX = 0x10 - F_GETPIPE_SZ = 0x408 - F_GETSIG = 0xb - F_LOCK = 0x1 - F_NOTIFY = 0x402 - F_OK = 0x0 - F_RDLCK = 0x0 - F_SETFD = 0x2 - F_SETFL = 0x4 - F_SETLEASE = 0x400 - F_SETLK = 0x6 - F_SETLK64 = 0xd - F_SETLKW = 0x7 - F_SETLKW64 = 0xe - F_SETOWN = 0x8 - F_SETOWN_EX = 0xf - F_SETPIPE_SZ = 0x407 - F_SETSIG = 0xa - F_SHLCK = 0x8 - F_TEST = 0x3 - F_TLOCK = 0x2 - F_ULOCK = 0x0 - F_UNLCK = 0x2 - F_WRLCK = 0x1 - HUPCL = 0x4000 - IBSHIFT = 0x10 - ICANON = 0x100 - ICMPV6_FILTER = 0x1 - ICRNL = 0x100 - IEXTEN = 0x400 - IFA_F_DADFAILED = 0x8 - IFA_F_DEPRECATED = 0x20 - IFA_F_HOMEADDRESS = 0x10 - IFA_F_NODAD = 0x2 - IFA_F_OPTIMISTIC = 0x4 - IFA_F_PERMANENT = 0x80 - IFA_F_SECONDARY = 0x1 - IFA_F_TEMPORARY = 0x1 - IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0x7 - IFF_802_1Q_VLAN = 0x1 - IFF_ALLMULTI = 0x200 - IFF_ATTACH_QUEUE = 0x200 - IFF_AUTOMEDIA = 0x4000 - IFF_BONDING = 0x20 - IFF_BRIDGE_PORT = 0x4000 - IFF_BROADCAST = 0x2 - IFF_DEBUG = 0x4 - IFF_DETACH_QUEUE = 0x400 - IFF_DISABLE_NETPOLL = 0x1000 - IFF_DONT_BRIDGE = 0x800 - IFF_DORMANT = 0x20000 - IFF_DYNAMIC = 0x8000 - IFF_EBRIDGE = 0x2 - IFF_ECHO = 0x40000 - IFF_ISATAP = 0x80 - IFF_LIVE_ADDR_CHANGE = 0x100000 - IFF_LOOPBACK = 0x8 - IFF_LOWER_UP = 0x10000 - IFF_MACVLAN = 0x200000 - IFF_MACVLAN_PORT = 0x2000 - IFF_MASTER = 0x400 - IFF_MASTER_8023AD = 0x8 - IFF_MASTER_ALB = 0x10 - IFF_MASTER_ARPMON = 0x100 - IFF_MULTICAST = 0x1000 - IFF_MULTI_QUEUE = 0x100 - IFF_NOARP = 0x80 - IFF_NOFILTER = 0x1000 - IFF_NOTRAILERS = 0x20 - IFF_NO_PI = 0x1000 - IFF_ONE_QUEUE = 0x2000 - IFF_OVS_DATAPATH = 0x8000 - IFF_PERSIST = 0x800 - IFF_POINTOPOINT = 0x10 - IFF_PORTSEL = 0x2000 - IFF_PROMISC = 0x100 - IFF_RUNNING = 0x40 - IFF_SLAVE = 0x800 - IFF_SLAVE_INACTIVE = 0x4 - IFF_SLAVE_NEEDARP = 0x40 - IFF_SUPP_NOFCS = 0x80000 - IFF_TAP = 0x2 - IFF_TEAM_PORT = 0x40000 - IFF_TUN = 0x1 - IFF_TUN_EXCL = 0x8000 - IFF_TX_SKB_SHARING = 0x10000 - IFF_UNICAST_FLT = 0x20000 - IFF_UP = 0x1 - IFF_VNET_HDR = 0x4000 - IFF_VOLATILE = 0x70c5a - IFF_WAN_HDLC = 0x200 - IFF_XMIT_DST_RELEASE = 0x400 - IFNAMSIZ = 0x10 - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 - IN_ACCESS = 0x1 - IN_ALL_EVENTS = 0xfff - IN_ATTRIB = 0x4 - IN_CLASSA_HOST = 0xffffff - IN_CLASSA_MAX = 0x80 - IN_CLASSA_NET = 0xff000000 - IN_CLASSA_NSHIFT = 0x18 - IN_CLASSB_HOST = 0xffff - IN_CLASSB_MAX = 0x10000 - IN_CLASSB_NET = 0xffff0000 - IN_CLASSB_NSHIFT = 0x10 - IN_CLASSC_HOST = 0xff - IN_CLASSC_NET = 0xffffff00 - IN_CLASSC_NSHIFT = 0x8 - IN_CLOEXEC = 0x80000 - IN_CLOSE = 0x18 - IN_CLOSE_NOWRITE = 0x10 - IN_CLOSE_WRITE = 0x8 - IN_CREATE = 0x100 - IN_DELETE = 0x200 - IN_DELETE_SELF = 0x400 - IN_DONT_FOLLOW = 0x2000000 - IN_EXCL_UNLINK = 0x4000000 - IN_IGNORED = 0x8000 - IN_ISDIR = 0x40000000 - IN_LOOPBACKNET = 0x7f - IN_MASK_ADD = 0x20000000 - IN_MODIFY = 0x2 - IN_MOVE = 0xc0 - IN_MOVED_FROM = 0x40 - IN_MOVED_TO = 0x80 - IN_MOVE_SELF = 0x800 - IN_NONBLOCK = 0x800 - IN_ONESHOT = 0x80000000 - IN_ONLYDIR = 0x1000000 - IN_OPEN = 0x20 - IN_Q_OVERFLOW = 0x4000 - IN_UNMOUNT = 0x2000 - IPPROTO_AH = 0x33 - IPPROTO_BEETPH = 0x5e - IPPROTO_COMP = 0x6c - IPPROTO_DCCP = 0x21 - IPPROTO_DSTOPTS = 0x3c - IPPROTO_EGP = 0x8 - IPPROTO_ENCAP = 0x62 - IPPROTO_ESP = 0x32 - IPPROTO_FRAGMENT = 0x2c - IPPROTO_GRE = 0x2f - IPPROTO_HOPOPTS = 0x0 - IPPROTO_ICMP = 0x1 - IPPROTO_ICMPV6 = 0x3a - IPPROTO_IDP = 0x16 - IPPROTO_IGMP = 0x2 - IPPROTO_IP = 0x0 - IPPROTO_IPIP = 0x4 - IPPROTO_IPV6 = 0x29 - IPPROTO_MH = 0x87 - IPPROTO_MTP = 0x5c - IPPROTO_NONE = 0x3b - IPPROTO_PIM = 0x67 - IPPROTO_PUP = 0xc - IPPROTO_RAW = 0xff - IPPROTO_ROUTING = 0x2b - IPPROTO_RSVP = 0x2e - IPPROTO_SCTP = 0x84 - IPPROTO_TCP = 0x6 - IPPROTO_TP = 0x1d - IPPROTO_UDP = 0x11 - IPPROTO_UDPLITE = 0x88 - IPV6_2292DSTOPTS = 0x4 - IPV6_2292HOPLIMIT = 0x8 - IPV6_2292HOPOPTS = 0x3 - IPV6_2292PKTINFO = 0x2 - IPV6_2292PKTOPTIONS = 0x6 - IPV6_2292RTHDR = 0x5 - IPV6_ADDRFORM = 0x1 - IPV6_ADD_MEMBERSHIP = 0x14 - IPV6_AUTHHDR = 0xa - IPV6_CHECKSUM = 0x7 - IPV6_DROP_MEMBERSHIP = 0x15 - IPV6_DSTOPTS = 0x3b - IPV6_HOPLIMIT = 0x34 - IPV6_HOPOPTS = 0x36 - IPV6_IPSEC_POLICY = 0x22 - IPV6_JOIN_ANYCAST = 0x1b - IPV6_JOIN_GROUP = 0x14 - IPV6_LEAVE_ANYCAST = 0x1c - IPV6_LEAVE_GROUP = 0x15 - IPV6_MTU = 0x18 - IPV6_MTU_DISCOVER = 0x17 - IPV6_MULTICAST_HOPS = 0x12 - IPV6_MULTICAST_IF = 0x11 - IPV6_MULTICAST_LOOP = 0x13 - IPV6_NEXTHOP = 0x9 - IPV6_PKTINFO = 0x32 - IPV6_PMTUDISC_DO = 0x2 - IPV6_PMTUDISC_DONT = 0x0 - IPV6_PMTUDISC_PROBE = 0x3 - IPV6_PMTUDISC_WANT = 0x1 - IPV6_RECVDSTOPTS = 0x3a - IPV6_RECVERR = 0x19 - IPV6_RECVHOPLIMIT = 0x33 - IPV6_RECVHOPOPTS = 0x35 - IPV6_RECVPKTINFO = 0x31 - IPV6_RECVRTHDR = 0x38 - IPV6_RECVTCLASS = 0x42 - IPV6_ROUTER_ALERT = 0x16 - IPV6_RTHDR = 0x39 - IPV6_RTHDRDSTOPTS = 0x37 - IPV6_RTHDR_LOOSE = 0x0 - IPV6_RTHDR_STRICT = 0x1 - IPV6_RTHDR_TYPE_0 = 0x0 - IPV6_RXDSTOPTS = 0x3b - IPV6_RXHOPOPTS = 0x36 - IPV6_TCLASS = 0x43 - IPV6_UNICAST_HOPS = 0x10 - IPV6_V6ONLY = 0x1a - IPV6_XFRM_POLICY = 0x23 - IP_ADD_MEMBERSHIP = 0x23 - IP_ADD_SOURCE_MEMBERSHIP = 0x27 - IP_BLOCK_SOURCE = 0x26 - IP_DEFAULT_MULTICAST_LOOP = 0x1 - IP_DEFAULT_MULTICAST_TTL = 0x1 - IP_DF = 0x4000 - IP_DROP_MEMBERSHIP = 0x24 - IP_DROP_SOURCE_MEMBERSHIP = 0x28 - IP_FREEBIND = 0xf - IP_HDRINCL = 0x3 - IP_IPSEC_POLICY = 0x10 - IP_MAXPACKET = 0xffff - IP_MAX_MEMBERSHIPS = 0x14 - IP_MF = 0x2000 - IP_MINTTL = 0x15 - IP_MSFILTER = 0x29 - IP_MSS = 0x240 - IP_MTU = 0xe - IP_MTU_DISCOVER = 0xa - IP_MULTICAST_ALL = 0x31 - IP_MULTICAST_IF = 0x20 - IP_MULTICAST_LOOP = 0x22 - IP_MULTICAST_TTL = 0x21 - IP_OFFMASK = 0x1fff - IP_OPTIONS = 0x4 - IP_ORIGDSTADDR = 0x14 - IP_PASSSEC = 0x12 - IP_PKTINFO = 0x8 - IP_PKTOPTIONS = 0x9 - IP_PMTUDISC = 0xa - IP_PMTUDISC_DO = 0x2 - IP_PMTUDISC_DONT = 0x0 - IP_PMTUDISC_PROBE = 0x3 - IP_PMTUDISC_WANT = 0x1 - IP_RECVERR = 0xb - IP_RECVOPTS = 0x6 - IP_RECVORIGDSTADDR = 0x14 - IP_RECVRETOPTS = 0x7 - IP_RECVTOS = 0xd - IP_RECVTTL = 0xc - IP_RETOPTS = 0x7 - IP_RF = 0x8000 - IP_ROUTER_ALERT = 0x5 - IP_TOS = 0x1 - IP_TRANSPARENT = 0x13 - IP_TTL = 0x2 - IP_UNBLOCK_SOURCE = 0x25 - IP_UNICAST_IF = 0x32 - IP_XFRM_POLICY = 0x11 - ISIG = 0x80 - ISTRIP = 0x20 - IUCLC = 0x1000 - IUTF8 = 0x4000 - IXANY = 0x800 - IXOFF = 0x400 - IXON = 0x200 - LINUX_REBOOT_CMD_CAD_OFF = 0x0 - LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef - LINUX_REBOOT_CMD_HALT = 0xcdef0123 - LINUX_REBOOT_CMD_KEXEC = 0x45584543 - LINUX_REBOOT_CMD_POWER_OFF = 0x4321fedc - LINUX_REBOOT_CMD_RESTART = 0x1234567 - LINUX_REBOOT_CMD_RESTART2 = 0xa1b2c3d4 - LINUX_REBOOT_CMD_SW_SUSPEND = 0xd000fce2 - LINUX_REBOOT_MAGIC1 = 0xfee1dead - LINUX_REBOOT_MAGIC2 = 0x28121969 - LOCK_EX = 0x2 - LOCK_NB = 0x4 - LOCK_SH = 0x1 - LOCK_UN = 0x8 - MADV_DODUMP = 0x11 - MADV_DOFORK = 0xb - MADV_DONTDUMP = 0x10 - MADV_DONTFORK = 0xa - MADV_DONTNEED = 0x4 - MADV_HUGEPAGE = 0xe - MADV_HWPOISON = 0x64 - MADV_MERGEABLE = 0xc - MADV_NOHUGEPAGE = 0xf - MADV_NORMAL = 0x0 - MADV_RANDOM = 0x1 - MADV_REMOVE = 0x9 - MADV_SEQUENTIAL = 0x2 - MADV_UNMERGEABLE = 0xd - MADV_WILLNEED = 0x3 - MAP_ANON = 0x20 - MAP_ANONYMOUS = 0x20 - MAP_DENYWRITE = 0x800 - MAP_EXECUTABLE = 0x1000 - MAP_FILE = 0x0 - MAP_FIXED = 0x10 - MAP_GROWSDOWN = 0x100 - MAP_HUGETLB = 0x40000 - MAP_HUGE_MASK = 0x3f - MAP_HUGE_SHIFT = 0x1a - MAP_LOCKED = 0x80 - MAP_NONBLOCK = 0x10000 - MAP_NORESERVE = 0x40 - MAP_POPULATE = 0x8000 - MAP_PRIVATE = 0x2 - MAP_SHARED = 0x1 - MAP_STACK = 0x20000 - MAP_TYPE = 0xf - MCL_CURRENT = 0x2000 - MCL_FUTURE = 0x4000 - MNT_DETACH = 0x2 - MNT_EXPIRE = 0x4 - MNT_FORCE = 0x1 - MSG_CMSG_CLOEXEC = 0x40000000 - MSG_CONFIRM = 0x800 - MSG_CTRUNC = 0x8 - MSG_DONTROUTE = 0x4 - MSG_DONTWAIT = 0x40 - MSG_EOR = 0x80 - MSG_ERRQUEUE = 0x2000 - MSG_FASTOPEN = 0x20000000 - MSG_FIN = 0x200 - MSG_MORE = 0x8000 - MSG_NOSIGNAL = 0x4000 - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_PROXY = 0x10 - MSG_RST = 0x1000 - MSG_SYN = 0x400 - MSG_TRUNC = 0x20 - MSG_TRYHARD = 0x4 - MSG_WAITALL = 0x100 - MSG_WAITFORONE = 0x10000 - MS_ACTIVE = 0x40000000 - MS_ASYNC = 0x1 - MS_BIND = 0x1000 - MS_DIRSYNC = 0x80 - MS_INVALIDATE = 0x2 - MS_I_VERSION = 0x800000 - MS_KERNMOUNT = 0x400000 - MS_MANDLOCK = 0x40 - MS_MGC_MSK = 0xffff0000 - MS_MGC_VAL = 0xc0ed0000 - MS_MOVE = 0x2000 - MS_NOATIME = 0x400 - MS_NODEV = 0x4 - MS_NODIRATIME = 0x800 - MS_NOEXEC = 0x8 - MS_NOSUID = 0x2 - MS_NOUSER = -0x80000000 - MS_POSIXACL = 0x10000 - MS_PRIVATE = 0x40000 - MS_RDONLY = 0x1 - MS_REC = 0x4000 - MS_RELATIME = 0x200000 - MS_REMOUNT = 0x20 - MS_RMT_MASK = 0x800051 - MS_SHARED = 0x100000 - MS_SILENT = 0x8000 - MS_SLAVE = 0x80000 - MS_STRICTATIME = 0x1000000 - MS_SYNC = 0x4 - MS_SYNCHRONOUS = 0x10 - MS_UNBINDABLE = 0x20000 - NAME_MAX = 0xff - NETLINK_ADD_MEMBERSHIP = 0x1 - NETLINK_AUDIT = 0x9 - NETLINK_BROADCAST_ERROR = 0x4 - NETLINK_CONNECTOR = 0xb - NETLINK_CRYPTO = 0x15 - NETLINK_DNRTMSG = 0xe - NETLINK_DROP_MEMBERSHIP = 0x2 - NETLINK_ECRYPTFS = 0x13 - NETLINK_FIB_LOOKUP = 0xa - NETLINK_FIREWALL = 0x3 - NETLINK_GENERIC = 0x10 - NETLINK_INET_DIAG = 0x4 - NETLINK_IP6_FW = 0xd - NETLINK_ISCSI = 0x8 - NETLINK_KOBJECT_UEVENT = 0xf - NETLINK_NETFILTER = 0xc - NETLINK_NFLOG = 0x5 - NETLINK_NO_ENOBUFS = 0x5 - NETLINK_PKTINFO = 0x3 - NETLINK_RDMA = 0x14 - NETLINK_ROUTE = 0x0 - NETLINK_RX_RING = 0x6 - NETLINK_SCSITRANSPORT = 0x12 - NETLINK_SELINUX = 0x7 - NETLINK_SOCK_DIAG = 0x4 - NETLINK_TX_RING = 0x7 - NETLINK_UNUSED = 0x1 - NETLINK_USERSOCK = 0x2 - NETLINK_XFRM = 0x6 - NL0 = 0x0 - NL1 = 0x100 - NL2 = 0x200 - NL3 = 0x300 - NLA_ALIGNTO = 0x4 - NLA_F_NESTED = 0x8000 - NLA_F_NET_BYTEORDER = 0x4000 - NLA_HDRLEN = 0x4 - NLDLY = 0x300 - NLMSG_ALIGNTO = 0x4 - NLMSG_DONE = 0x3 - NLMSG_ERROR = 0x2 - NLMSG_HDRLEN = 0x10 - NLMSG_MIN_TYPE = 0x10 - NLMSG_NOOP = 0x1 - NLMSG_OVERRUN = 0x4 - NLM_F_ACK = 0x4 - NLM_F_APPEND = 0x800 - NLM_F_ATOMIC = 0x400 - NLM_F_CREATE = 0x400 - NLM_F_DUMP = 0x300 - NLM_F_DUMP_INTR = 0x10 - NLM_F_ECHO = 0x8 - NLM_F_EXCL = 0x200 - NLM_F_MATCH = 0x200 - NLM_F_MULTI = 0x2 - NLM_F_REPLACE = 0x100 - NLM_F_REQUEST = 0x1 - NLM_F_ROOT = 0x100 - NOFLSH = 0x80000000 - OCRNL = 0x8 - OFDEL = 0x80 - OFILL = 0x40 - OLCUC = 0x4 - ONLCR = 0x2 - ONLRET = 0x20 - ONOCR = 0x10 - OPOST = 0x1 - O_ACCMODE = 0x3 - O_APPEND = 0x400 - O_ASYNC = 0x2000 - O_CLOEXEC = 0x80000 - O_CREAT = 0x40 - O_DIRECT = 0x20000 - O_DIRECTORY = 0x4000 - O_DSYNC = 0x1000 - O_EXCL = 0x80 - O_FSYNC = 0x101000 - O_LARGEFILE = 0x0 - O_NDELAY = 0x800 - O_NOATIME = 0x40000 - O_NOCTTY = 0x100 - O_NOFOLLOW = 0x8000 - O_NONBLOCK = 0x800 - O_PATH = 0x200000 - O_RDONLY = 0x0 - O_RDWR = 0x2 - O_RSYNC = 0x101000 - O_SYNC = 0x101000 - O_TMPFILE = 0x410000 - O_TRUNC = 0x200 - O_WRONLY = 0x1 - PACKET_ADD_MEMBERSHIP = 0x1 - PACKET_AUXDATA = 0x8 - PACKET_BROADCAST = 0x1 - PACKET_COPY_THRESH = 0x7 - PACKET_DROP_MEMBERSHIP = 0x2 - PACKET_FANOUT = 0x12 - PACKET_FANOUT_CPU = 0x2 - PACKET_FANOUT_FLAG_DEFRAG = 0x8000 - PACKET_FANOUT_FLAG_ROLLOVER = 0x1000 - PACKET_FANOUT_HASH = 0x0 - PACKET_FANOUT_LB = 0x1 - PACKET_FANOUT_RND = 0x4 - PACKET_FANOUT_ROLLOVER = 0x3 - PACKET_FASTROUTE = 0x6 - PACKET_HDRLEN = 0xb - PACKET_HOST = 0x0 - PACKET_LOOPBACK = 0x5 - PACKET_LOSS = 0xe - PACKET_MR_ALLMULTI = 0x2 - PACKET_MR_MULTICAST = 0x0 - PACKET_MR_PROMISC = 0x1 - PACKET_MR_UNICAST = 0x3 - PACKET_MULTICAST = 0x2 - PACKET_ORIGDEV = 0x9 - PACKET_OTHERHOST = 0x3 - PACKET_OUTGOING = 0x4 - PACKET_RECV_OUTPUT = 0x3 - PACKET_RESERVE = 0xc - PACKET_RX_RING = 0x5 - PACKET_STATISTICS = 0x6 - PACKET_TIMESTAMP = 0x11 - PACKET_TX_HAS_OFF = 0x13 - PACKET_TX_RING = 0xd - PACKET_TX_TIMESTAMP = 0x10 - PACKET_VERSION = 0xa - PACKET_VNET_HDR = 0xf - PARENB = 0x1000 - PARITY_CRC16_PR0 = 0x2 - PARITY_CRC16_PR0_CCITT = 0x4 - PARITY_CRC16_PR1 = 0x3 - PARITY_CRC16_PR1_CCITT = 0x5 - PARITY_CRC32_PR0_CCITT = 0x6 - PARITY_CRC32_PR1_CCITT = 0x7 - PARITY_DEFAULT = 0x0 - PARITY_NONE = 0x1 - PARMRK = 0x8 - PARODD = 0x2000 - PENDIN = 0x20000000 - PRIO_PGRP = 0x1 - PRIO_PROCESS = 0x0 - PRIO_USER = 0x2 - PROT_EXEC = 0x4 - PROT_GROWSDOWN = 0x1000000 - PROT_GROWSUP = 0x2000000 - PROT_NONE = 0x0 - PROT_READ = 0x1 - PROT_SAO = 0x10 - PROT_WRITE = 0x2 - PR_CAPBSET_DROP = 0x18 - PR_CAPBSET_READ = 0x17 - PR_ENDIAN_BIG = 0x0 - PR_ENDIAN_LITTLE = 0x1 - PR_ENDIAN_PPC_LITTLE = 0x2 - PR_FPEMU_NOPRINT = 0x1 - PR_FPEMU_SIGFPE = 0x2 - PR_FP_EXC_ASYNC = 0x2 - PR_FP_EXC_DISABLED = 0x0 - PR_FP_EXC_DIV = 0x10000 - PR_FP_EXC_INV = 0x100000 - PR_FP_EXC_NONRECOV = 0x1 - PR_FP_EXC_OVF = 0x20000 - PR_FP_EXC_PRECISE = 0x3 - PR_FP_EXC_RES = 0x80000 - PR_FP_EXC_SW_ENABLE = 0x80 - PR_FP_EXC_UND = 0x40000 - PR_GET_CHILD_SUBREAPER = 0x25 - PR_GET_DUMPABLE = 0x3 - PR_GET_ENDIAN = 0x13 - PR_GET_FPEMU = 0x9 - PR_GET_FPEXC = 0xb - PR_GET_KEEPCAPS = 0x7 - PR_GET_NAME = 0x10 - PR_GET_NO_NEW_PRIVS = 0x27 - PR_GET_PDEATHSIG = 0x2 - PR_GET_SECCOMP = 0x15 - PR_GET_SECUREBITS = 0x1b - PR_GET_TID_ADDRESS = 0x28 - PR_GET_TIMERSLACK = 0x1e - PR_GET_TIMING = 0xd - PR_GET_TSC = 0x19 - PR_GET_UNALIGN = 0x5 - PR_MCE_KILL = 0x21 - PR_MCE_KILL_CLEAR = 0x0 - PR_MCE_KILL_DEFAULT = 0x2 - PR_MCE_KILL_EARLY = 0x1 - PR_MCE_KILL_GET = 0x22 - PR_MCE_KILL_LATE = 0x0 - PR_MCE_KILL_SET = 0x1 - PR_SET_CHILD_SUBREAPER = 0x24 - PR_SET_DUMPABLE = 0x4 - PR_SET_ENDIAN = 0x14 - PR_SET_FPEMU = 0xa - PR_SET_FPEXC = 0xc - PR_SET_KEEPCAPS = 0x8 - PR_SET_MM = 0x23 - PR_SET_MM_ARG_END = 0x9 - PR_SET_MM_ARG_START = 0x8 - PR_SET_MM_AUXV = 0xc - PR_SET_MM_BRK = 0x7 - PR_SET_MM_END_CODE = 0x2 - PR_SET_MM_END_DATA = 0x4 - PR_SET_MM_ENV_END = 0xb - PR_SET_MM_ENV_START = 0xa - PR_SET_MM_EXE_FILE = 0xd - PR_SET_MM_START_BRK = 0x6 - PR_SET_MM_START_CODE = 0x1 - PR_SET_MM_START_DATA = 0x3 - PR_SET_MM_START_STACK = 0x5 - PR_SET_NAME = 0xf - PR_SET_NO_NEW_PRIVS = 0x26 - PR_SET_PDEATHSIG = 0x1 - PR_SET_PTRACER = 0x59616d61 - PR_SET_PTRACER_ANY = -0x1 - PR_SET_SECCOMP = 0x16 - PR_SET_SECUREBITS = 0x1c - PR_SET_TIMERSLACK = 0x1d - PR_SET_TIMING = 0xe - PR_SET_TSC = 0x1a - PR_SET_UNALIGN = 0x6 - PR_TASK_PERF_EVENTS_DISABLE = 0x1f - PR_TASK_PERF_EVENTS_ENABLE = 0x20 - PR_TIMING_STATISTICAL = 0x0 - PR_TIMING_TIMESTAMP = 0x1 - PR_TSC_ENABLE = 0x1 - PR_TSC_SIGSEGV = 0x2 - PR_UNALIGN_NOPRINT = 0x1 - PR_UNALIGN_SIGBUS = 0x2 - PTRACE_ATTACH = 0x10 - PTRACE_CONT = 0x7 - PTRACE_DETACH = 0x11 - PTRACE_EVENT_CLONE = 0x3 - PTRACE_EVENT_EXEC = 0x4 - PTRACE_EVENT_EXIT = 0x6 - PTRACE_EVENT_FORK = 0x1 - PTRACE_EVENT_SECCOMP = 0x7 - PTRACE_EVENT_STOP = 0x80 - PTRACE_EVENT_VFORK = 0x2 - PTRACE_EVENT_VFORK_DONE = 0x5 - PTRACE_GETEVENTMSG = 0x4201 - PTRACE_GETEVRREGS = 0x14 - PTRACE_GETFPREGS = 0xe - PTRACE_GETREGS = 0xc - PTRACE_GETREGS64 = 0x16 - PTRACE_GETREGSET = 0x4204 - PTRACE_GETSIGINFO = 0x4202 - PTRACE_GETSIGMASK = 0x420a - PTRACE_GETVRREGS = 0x12 - PTRACE_GETVSRREGS = 0x1b - PTRACE_GET_DEBUGREG = 0x19 - PTRACE_INTERRUPT = 0x4207 - PTRACE_KILL = 0x8 - PTRACE_LISTEN = 0x4208 - PTRACE_O_EXITKILL = 0x100000 - PTRACE_O_MASK = 0x1000ff - PTRACE_O_TRACECLONE = 0x8 - PTRACE_O_TRACEEXEC = 0x10 - PTRACE_O_TRACEEXIT = 0x40 - PTRACE_O_TRACEFORK = 0x2 - PTRACE_O_TRACESECCOMP = 0x80 - PTRACE_O_TRACESYSGOOD = 0x1 - PTRACE_O_TRACEVFORK = 0x4 - PTRACE_O_TRACEVFORKDONE = 0x20 - PTRACE_PEEKDATA = 0x2 - PTRACE_PEEKSIGINFO = 0x4209 - PTRACE_PEEKSIGINFO_SHARED = 0x1 - PTRACE_PEEKTEXT = 0x1 - PTRACE_PEEKUSR = 0x3 - PTRACE_POKEDATA = 0x5 - PTRACE_POKETEXT = 0x4 - PTRACE_POKEUSR = 0x6 - PTRACE_SEIZE = 0x4206 - PTRACE_SETEVRREGS = 0x15 - PTRACE_SETFPREGS = 0xf - PTRACE_SETOPTIONS = 0x4200 - PTRACE_SETREGS = 0xd - PTRACE_SETREGS64 = 0x17 - PTRACE_SETREGSET = 0x4205 - PTRACE_SETSIGINFO = 0x4203 - PTRACE_SETSIGMASK = 0x420b - PTRACE_SETVRREGS = 0x13 - PTRACE_SETVSRREGS = 0x1c - PTRACE_SET_DEBUGREG = 0x1a - PTRACE_SINGLEBLOCK = 0x100 - PTRACE_SINGLESTEP = 0x9 - PTRACE_SYSCALL = 0x18 - PTRACE_TRACEME = 0x0 - PT_CCR = 0x26 - PT_CTR = 0x23 - PT_DAR = 0x29 - PT_DSCR = 0x2c - PT_DSISR = 0x2a - PT_FPR0 = 0x30 - PT_FPSCR = 0x50 - PT_LNK = 0x24 - PT_MSR = 0x21 - PT_NIP = 0x20 - PT_ORIG_R3 = 0x22 - PT_R0 = 0x0 - PT_R1 = 0x1 - PT_R10 = 0xa - PT_R11 = 0xb - PT_R12 = 0xc - PT_R13 = 0xd - PT_R14 = 0xe - PT_R15 = 0xf - PT_R16 = 0x10 - PT_R17 = 0x11 - PT_R18 = 0x12 - PT_R19 = 0x13 - PT_R2 = 0x2 - PT_R20 = 0x14 - PT_R21 = 0x15 - PT_R22 = 0x16 - PT_R23 = 0x17 - PT_R24 = 0x18 - PT_R25 = 0x19 - PT_R26 = 0x1a - PT_R27 = 0x1b - PT_R28 = 0x1c - PT_R29 = 0x1d - PT_R3 = 0x3 - PT_R30 = 0x1e - PT_R31 = 0x1f - PT_R4 = 0x4 - PT_R5 = 0x5 - PT_R6 = 0x6 - PT_R7 = 0x7 - PT_R8 = 0x8 - PT_R9 = 0x9 - PT_REGS_COUNT = 0x2c - PT_RESULT = 0x2b - PT_SOFTE = 0x27 - PT_TRAP = 0x28 - PT_VR0 = 0x52 - PT_VRSAVE = 0x94 - PT_VSCR = 0x93 - PT_VSR0 = 0x96 - PT_VSR31 = 0xd4 - PT_XER = 0x25 - RLIMIT_AS = 0x9 - RLIMIT_CORE = 0x4 - RLIMIT_CPU = 0x0 - RLIMIT_DATA = 0x2 - RLIMIT_FSIZE = 0x1 - RLIMIT_NOFILE = 0x7 - RLIMIT_STACK = 0x3 - RLIM_INFINITY = -0x1 - RTAX_ADVMSS = 0x8 - RTAX_CWND = 0x7 - RTAX_FEATURES = 0xc - RTAX_FEATURE_ALLFRAG = 0x8 - RTAX_FEATURE_ECN = 0x1 - RTAX_FEATURE_SACK = 0x2 - RTAX_FEATURE_TIMESTAMP = 0x4 - RTAX_HOPLIMIT = 0xa - RTAX_INITCWND = 0xb - RTAX_INITRWND = 0xe - RTAX_LOCK = 0x1 - RTAX_MAX = 0xf - RTAX_MTU = 0x2 - RTAX_QUICKACK = 0xf - RTAX_REORDERING = 0x9 - RTAX_RTO_MIN = 0xd - RTAX_RTT = 0x4 - RTAX_RTTVAR = 0x5 - RTAX_SSTHRESH = 0x6 - RTAX_UNSPEC = 0x0 - RTAX_WINDOW = 0x3 - RTA_ALIGNTO = 0x4 - RTA_MAX = 0x11 - RTCF_DIRECTSRC = 0x4000000 - RTCF_DOREDIRECT = 0x1000000 - RTCF_LOG = 0x2000000 - RTCF_MASQ = 0x400000 - RTCF_NAT = 0x800000 - RTCF_VALVE = 0x200000 - RTF_ADDRCLASSMASK = 0xf8000000 - RTF_ADDRCONF = 0x40000 - RTF_ALLONLINK = 0x20000 - RTF_BROADCAST = 0x10000000 - RTF_CACHE = 0x1000000 - RTF_DEFAULT = 0x10000 - RTF_DYNAMIC = 0x10 - RTF_FLOW = 0x2000000 - RTF_GATEWAY = 0x2 - RTF_HOST = 0x4 - RTF_INTERFACE = 0x40000000 - RTF_IRTT = 0x100 - RTF_LINKRT = 0x100000 - RTF_LOCAL = 0x80000000 - RTF_MODIFIED = 0x20 - RTF_MSS = 0x40 - RTF_MTU = 0x40 - RTF_MULTICAST = 0x20000000 - RTF_NAT = 0x8000000 - RTF_NOFORWARD = 0x1000 - RTF_NONEXTHOP = 0x200000 - RTF_NOPMTUDISC = 0x4000 - RTF_POLICY = 0x4000000 - RTF_REINSTATE = 0x8 - RTF_REJECT = 0x200 - RTF_STATIC = 0x400 - RTF_THROW = 0x2000 - RTF_UP = 0x1 - RTF_WINDOW = 0x80 - RTF_XRESOLVE = 0x800 - RTM_BASE = 0x10 - RTM_DELACTION = 0x31 - RTM_DELADDR = 0x15 - RTM_DELADDRLABEL = 0x49 - RTM_DELLINK = 0x11 - RTM_DELMDB = 0x55 - RTM_DELNEIGH = 0x1d - RTM_DELQDISC = 0x25 - RTM_DELROUTE = 0x19 - RTM_DELRULE = 0x21 - RTM_DELTCLASS = 0x29 - RTM_DELTFILTER = 0x2d - RTM_F_CLONED = 0x200 - RTM_F_EQUALIZE = 0x400 - RTM_F_NOTIFY = 0x100 - RTM_F_PREFIX = 0x800 - RTM_GETACTION = 0x32 - RTM_GETADDR = 0x16 - RTM_GETADDRLABEL = 0x4a - RTM_GETANYCAST = 0x3e - RTM_GETDCB = 0x4e - RTM_GETLINK = 0x12 - RTM_GETMDB = 0x56 - RTM_GETMULTICAST = 0x3a - RTM_GETNEIGH = 0x1e - RTM_GETNEIGHTBL = 0x42 - RTM_GETNETCONF = 0x52 - RTM_GETQDISC = 0x26 - RTM_GETROUTE = 0x1a - RTM_GETRULE = 0x22 - RTM_GETTCLASS = 0x2a - RTM_GETTFILTER = 0x2e - RTM_MAX = 0x57 - RTM_NEWACTION = 0x30 - RTM_NEWADDR = 0x14 - RTM_NEWADDRLABEL = 0x48 - RTM_NEWLINK = 0x10 - RTM_NEWMDB = 0x54 - RTM_NEWNDUSEROPT = 0x44 - RTM_NEWNEIGH = 0x1c - RTM_NEWNEIGHTBL = 0x40 - RTM_NEWNETCONF = 0x50 - RTM_NEWPREFIX = 0x34 - RTM_NEWQDISC = 0x24 - RTM_NEWROUTE = 0x18 - RTM_NEWRULE = 0x20 - RTM_NEWTCLASS = 0x28 - RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x12 - RTM_NR_MSGTYPES = 0x48 - RTM_SETDCB = 0x4f - RTM_SETLINK = 0x13 - RTM_SETNEIGHTBL = 0x43 - RTNH_ALIGNTO = 0x4 - RTNH_F_DEAD = 0x1 - RTNH_F_ONLINK = 0x4 - RTNH_F_PERVASIVE = 0x2 - RTN_MAX = 0xb - RTPROT_BIRD = 0xc - RTPROT_BOOT = 0x3 - RTPROT_DHCP = 0x10 - RTPROT_DNROUTED = 0xd - RTPROT_GATED = 0x8 - RTPROT_KERNEL = 0x2 - RTPROT_MROUTED = 0x11 - RTPROT_MRT = 0xa - RTPROT_NTK = 0xf - RTPROT_RA = 0x9 - RTPROT_REDIRECT = 0x1 - RTPROT_STATIC = 0x4 - RTPROT_UNSPEC = 0x0 - RTPROT_XORP = 0xe - RTPROT_ZEBRA = 0xb - RT_CLASS_DEFAULT = 0xfd - RT_CLASS_LOCAL = 0xff - RT_CLASS_MAIN = 0xfe - RT_CLASS_MAX = 0xff - RT_CLASS_UNSPEC = 0x0 - RUSAGE_CHILDREN = -0x1 - RUSAGE_SELF = 0x0 - RUSAGE_THREAD = 0x1 - SCM_CREDENTIALS = 0x2 - SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x1d - SCM_TIMESTAMPING = 0x25 - SCM_TIMESTAMPNS = 0x23 - SCM_WIFI_STATUS = 0x29 - SHUT_RD = 0x0 - SHUT_RDWR = 0x2 - SHUT_WR = 0x1 - SIOCADDDLCI = 0x8980 - SIOCADDMULTI = 0x8931 - SIOCADDRT = 0x890b - SIOCATMARK = 0x8905 - SIOCDARP = 0x8953 - SIOCDELDLCI = 0x8981 - SIOCDELMULTI = 0x8932 - SIOCDELRT = 0x890c - SIOCDEVPRIVATE = 0x89f0 - SIOCDIFADDR = 0x8936 - SIOCDRARP = 0x8960 - SIOCGARP = 0x8954 - SIOCGIFADDR = 0x8915 - SIOCGIFBR = 0x8940 - SIOCGIFBRDADDR = 0x8919 - SIOCGIFCONF = 0x8912 - SIOCGIFCOUNT = 0x8938 - SIOCGIFDSTADDR = 0x8917 - SIOCGIFENCAP = 0x8925 - SIOCGIFFLAGS = 0x8913 - SIOCGIFHWADDR = 0x8927 - SIOCGIFINDEX = 0x8933 - SIOCGIFMAP = 0x8970 - SIOCGIFMEM = 0x891f - SIOCGIFMETRIC = 0x891d - SIOCGIFMTU = 0x8921 - SIOCGIFNAME = 0x8910 - SIOCGIFNETMASK = 0x891b - SIOCGIFPFLAGS = 0x8935 - SIOCGIFSLAVE = 0x8929 - SIOCGIFTXQLEN = 0x8942 - SIOCGPGRP = 0x8904 - SIOCGRARP = 0x8961 - SIOCGSTAMP = 0x8906 - SIOCGSTAMPNS = 0x8907 - SIOCPROTOPRIVATE = 0x89e0 - SIOCRTMSG = 0x890d - SIOCSARP = 0x8955 - SIOCSIFADDR = 0x8916 - SIOCSIFBR = 0x8941 - SIOCSIFBRDADDR = 0x891a - SIOCSIFDSTADDR = 0x8918 - SIOCSIFENCAP = 0x8926 - SIOCSIFFLAGS = 0x8914 - SIOCSIFHWADDR = 0x8924 - SIOCSIFHWBROADCAST = 0x8937 - SIOCSIFLINK = 0x8911 - SIOCSIFMAP = 0x8971 - SIOCSIFMEM = 0x8920 - SIOCSIFMETRIC = 0x891e - SIOCSIFMTU = 0x8922 - SIOCSIFNAME = 0x8923 - SIOCSIFNETMASK = 0x891c - SIOCSIFPFLAGS = 0x8934 - SIOCSIFSLAVE = 0x8930 - SIOCSIFTXQLEN = 0x8943 - SIOCSPGRP = 0x8902 - SIOCSRARP = 0x8962 - SOCK_CLOEXEC = 0x80000 - SOCK_DCCP = 0x6 - SOCK_DGRAM = 0x2 - SOCK_NONBLOCK = 0x800 - SOCK_PACKET = 0xa - SOCK_RAW = 0x3 - SOCK_RDM = 0x4 - SOCK_SEQPACKET = 0x5 - SOCK_STREAM = 0x1 - SOL_AAL = 0x109 - SOL_ATM = 0x108 - SOL_DECNET = 0x105 - SOL_ICMPV6 = 0x3a - SOL_IP = 0x0 - SOL_IPV6 = 0x29 - SOL_IRDA = 0x10a - SOL_PACKET = 0x107 - SOL_RAW = 0xff - SOL_SOCKET = 0x1 - SOL_TCP = 0x6 - SOL_X25 = 0x106 - SOMAXCONN = 0x80 - SO_ACCEPTCONN = 0x1e - SO_ATTACH_FILTER = 0x1a - SO_BINDTODEVICE = 0x19 - SO_BROADCAST = 0x6 - SO_BSDCOMPAT = 0xe - SO_BUSY_POLL = 0x2e - SO_DEBUG = 0x1 - SO_DETACH_FILTER = 0x1b - SO_DOMAIN = 0x27 - SO_DONTROUTE = 0x5 - SO_ERROR = 0x4 - SO_GET_FILTER = 0x1a - SO_KEEPALIVE = 0x9 - SO_LINGER = 0xd - SO_LOCK_FILTER = 0x2c - SO_MARK = 0x24 - SO_MAX_PACING_RATE = 0x2f - SO_NOFCS = 0x2b - SO_NO_CHECK = 0xb - SO_OOBINLINE = 0xa - SO_PASSCRED = 0x14 - SO_PASSSEC = 0x22 - SO_PEEK_OFF = 0x2a - SO_PEERCRED = 0x15 - SO_PEERNAME = 0x1c - SO_PEERSEC = 0x1f - SO_PRIORITY = 0xc - SO_PROTOCOL = 0x26 - SO_RCVBUF = 0x8 - SO_RCVBUFFORCE = 0x21 - SO_RCVLOWAT = 0x10 - SO_RCVTIMEO = 0x12 - SO_REUSEADDR = 0x2 - SO_REUSEPORT = 0xf - SO_RXQ_OVFL = 0x28 - SO_SECURITY_AUTHENTICATION = 0x16 - SO_SECURITY_ENCRYPTION_NETWORK = 0x18 - SO_SECURITY_ENCRYPTION_TRANSPORT = 0x17 - SO_SELECT_ERR_QUEUE = 0x2d - SO_SNDBUF = 0x7 - SO_SNDBUFFORCE = 0x20 - SO_SNDLOWAT = 0x11 - SO_SNDTIMEO = 0x13 - SO_TIMESTAMP = 0x1d - SO_TIMESTAMPING = 0x25 - SO_TIMESTAMPNS = 0x23 - SO_TYPE = 0x3 - SO_WIFI_STATUS = 0x29 - S_BLKSIZE = 0x200 - S_IEXEC = 0x40 - S_IFBLK = 0x6000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFIFO = 0x1000 - S_IFLNK = 0xa000 - S_IFMT = 0xf000 - S_IFREG = 0x8000 - S_IFSOCK = 0xc000 - S_IREAD = 0x100 - S_IRGRP = 0x20 - S_IROTH = 0x4 - S_IRUSR = 0x100 - S_IRWXG = 0x38 - S_IRWXO = 0x7 - S_IRWXU = 0x1c0 - S_ISGID = 0x400 - S_ISUID = 0x800 - S_ISVTX = 0x200 - S_IWGRP = 0x10 - S_IWOTH = 0x2 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXGRP = 0x8 - S_IXOTH = 0x1 - S_IXUSR = 0x40 - TAB0 = 0x0 - TAB1 = 0x400 - TAB2 = 0x800 - TAB3 = 0xc00 - TABDLY = 0xc00 - TCFLSH = 0x2000741f - TCGETA = 0x40147417 - TCGETS = 0x402c7413 - TCIFLUSH = 0x0 - TCIOFF = 0x2 - TCIOFLUSH = 0x2 - TCION = 0x3 - TCOFLUSH = 0x1 - TCOOFF = 0x0 - TCOON = 0x1 - TCP_CONGESTION = 0xd - TCP_COOKIE_IN_ALWAYS = 0x1 - TCP_COOKIE_MAX = 0x10 - TCP_COOKIE_MIN = 0x8 - TCP_COOKIE_OUT_NEVER = 0x2 - TCP_COOKIE_PAIR_SIZE = 0x20 - TCP_COOKIE_TRANSACTIONS = 0xf - TCP_CORK = 0x3 - TCP_DEFER_ACCEPT = 0x9 - TCP_FASTOPEN = 0x17 - TCP_INFO = 0xb - TCP_KEEPCNT = 0x6 - TCP_KEEPIDLE = 0x4 - TCP_KEEPINTVL = 0x5 - TCP_LINGER2 = 0x8 - TCP_MAXSEG = 0x2 - TCP_MAXWIN = 0xffff - TCP_MAX_WINSHIFT = 0xe - TCP_MD5SIG = 0xe - TCP_MD5SIG_MAXKEYLEN = 0x50 - TCP_MSS = 0x200 - TCP_MSS_DEFAULT = 0x218 - TCP_MSS_DESIRED = 0x4c4 - TCP_NODELAY = 0x1 - TCP_QUEUE_SEQ = 0x15 - TCP_QUICKACK = 0xc - TCP_REPAIR = 0x13 - TCP_REPAIR_OPTIONS = 0x16 - TCP_REPAIR_QUEUE = 0x14 - TCP_SYNCNT = 0x7 - TCP_S_DATA_IN = 0x4 - TCP_S_DATA_OUT = 0x8 - TCP_THIN_DUPACK = 0x11 - TCP_THIN_LINEAR_TIMEOUTS = 0x10 - TCP_TIMESTAMP = 0x18 - TCP_USER_TIMEOUT = 0x12 - TCP_WINDOW_CLAMP = 0xa - TCSAFLUSH = 0x2 - TCSBRK = 0x2000741d - TCSBRKP = 0x5425 - TCSETA = 0x80147418 - TCSETAF = 0x8014741c - TCSETAW = 0x80147419 - TCSETS = 0x802c7414 - TCSETSF = 0x802c7416 - TCSETSW = 0x802c7415 - TCXONC = 0x2000741e - TIOCCBRK = 0x5428 - TIOCCONS = 0x541d - TIOCEXCL = 0x540c - TIOCGDEV = 0x40045432 - TIOCGETC = 0x40067412 - TIOCGETD = 0x5424 - TIOCGETP = 0x40067408 - TIOCGEXCL = 0x40045440 - TIOCGICOUNT = 0x545d - TIOCGLCKTRMIOS = 0x5456 - TIOCGLTC = 0x40067474 - TIOCGPGRP = 0x40047477 - TIOCGPKT = 0x40045438 - TIOCGPTLCK = 0x40045439 - TIOCGPTN = 0x40045430 - TIOCGRS485 = 0x542e - TIOCGSERIAL = 0x541e - TIOCGSID = 0x5429 - TIOCGSOFTCAR = 0x5419 - TIOCGWINSZ = 0x40087468 - TIOCINQ = 0x4004667f - TIOCLINUX = 0x541c - TIOCMBIC = 0x5417 - TIOCMBIS = 0x5416 - TIOCMGET = 0x5415 - TIOCMIWAIT = 0x545c - TIOCMSET = 0x5418 - TIOCM_CAR = 0x40 - TIOCM_CD = 0x40 - TIOCM_CTS = 0x20 - TIOCM_DSR = 0x100 - TIOCM_DTR = 0x2 - TIOCM_LE = 0x1 - TIOCM_LOOP = 0x8000 - TIOCM_OUT1 = 0x2000 - TIOCM_OUT2 = 0x4000 - TIOCM_RI = 0x80 - TIOCM_RNG = 0x80 - TIOCM_RTS = 0x4 - TIOCM_SR = 0x10 - TIOCM_ST = 0x8 - TIOCNOTTY = 0x5422 - TIOCNXCL = 0x540d - TIOCOUTQ = 0x40047473 - TIOCPKT = 0x5420 - TIOCPKT_DATA = 0x0 - TIOCPKT_DOSTOP = 0x20 - TIOCPKT_FLUSHREAD = 0x1 - TIOCPKT_FLUSHWRITE = 0x2 - TIOCPKT_IOCTL = 0x40 - TIOCPKT_NOSTOP = 0x10 - TIOCPKT_START = 0x8 - TIOCPKT_STOP = 0x4 - TIOCSBRK = 0x5427 - TIOCSCTTY = 0x540e - TIOCSERCONFIG = 0x5453 - TIOCSERGETLSR = 0x5459 - TIOCSERGETMULTI = 0x545a - TIOCSERGSTRUCT = 0x5458 - TIOCSERGWILD = 0x5454 - TIOCSERSETMULTI = 0x545b - TIOCSERSWILD = 0x5455 - TIOCSER_TEMT = 0x1 - TIOCSETC = 0x80067411 - TIOCSETD = 0x5423 - TIOCSETN = 0x8006740a - TIOCSETP = 0x80067409 - TIOCSIG = 0x80045436 - TIOCSLCKTRMIOS = 0x5457 - TIOCSLTC = 0x80067475 - TIOCSPGRP = 0x80047476 - TIOCSPTLCK = 0x80045431 - TIOCSRS485 = 0x542f - TIOCSSERIAL = 0x541f - TIOCSSOFTCAR = 0x541a - TIOCSTART = 0x2000746e - TIOCSTI = 0x5412 - TIOCSTOP = 0x2000746f - TIOCSWINSZ = 0x80087467 - TIOCVHANGUP = 0x5437 - TOSTOP = 0x400000 - TUNATTACHFILTER = 0x801054d5 - TUNDETACHFILTER = 0x801054d6 - TUNGETFEATURES = 0x400454cf - TUNGETFILTER = 0x401054db - TUNGETIFF = 0x400454d2 - TUNGETSNDBUF = 0x400454d3 - TUNGETVNETHDRSZ = 0x400454d7 - TUNSETDEBUG = 0x800454c9 - TUNSETGROUP = 0x800454ce - TUNSETIFF = 0x800454ca - TUNSETIFINDEX = 0x800454da - TUNSETLINK = 0x800454cd - TUNSETNOCSUM = 0x800454c8 - TUNSETOFFLOAD = 0x800454d0 - TUNSETOWNER = 0x800454cc - TUNSETPERSIST = 0x800454cb - TUNSETQUEUE = 0x800454d9 - TUNSETSNDBUF = 0x800454d4 - TUNSETTXFILTER = 0x800454d1 - TUNSETVNETHDRSZ = 0x800454d8 - VDISCARD = 0x10 - VEOF = 0x4 - VEOL = 0x6 - VEOL2 = 0x8 - VERASE = 0x2 - VINTR = 0x0 - VKILL = 0x3 - VLNEXT = 0xf - VMIN = 0x5 - VQUIT = 0x1 - VREPRINT = 0xb - VSTART = 0xd - VSTOP = 0xe - VSUSP = 0xc - VSWTC = 0x9 - VT0 = 0x0 - VT1 = 0x10000 - VTDLY = 0x10000 - VTIME = 0x7 - VWERASE = 0xa - WALL = 0x40000000 - WCLONE = 0x80000000 - WCONTINUED = 0x8 - WEXITED = 0x4 - WNOHANG = 0x1 - WNOTHREAD = 0x20000000 - WNOWAIT = 0x1000000 - WORDSIZE = 0x40 - WSTOPPED = 0x2 - WUNTRACED = 0x2 - XCASE = 0x4000 - XTABS = 0xc00 -) - -// Errors -const ( - E2BIG = syscall.Errno(0x7) - EACCES = syscall.Errno(0xd) - EADDRINUSE = syscall.Errno(0x62) - EADDRNOTAVAIL = syscall.Errno(0x63) - EADV = syscall.Errno(0x44) - EAFNOSUPPORT = syscall.Errno(0x61) - EAGAIN = syscall.Errno(0xb) - EALREADY = syscall.Errno(0x72) - EBADE = syscall.Errno(0x34) - EBADF = syscall.Errno(0x9) - EBADFD = syscall.Errno(0x4d) - EBADMSG = syscall.Errno(0x4a) - EBADR = syscall.Errno(0x35) - EBADRQC = syscall.Errno(0x38) - EBADSLT = syscall.Errno(0x39) - EBFONT = syscall.Errno(0x3b) - EBUSY = syscall.Errno(0x10) - ECANCELED = syscall.Errno(0x7d) - ECHILD = syscall.Errno(0xa) - ECHRNG = syscall.Errno(0x2c) - ECOMM = syscall.Errno(0x46) - ECONNABORTED = syscall.Errno(0x67) - ECONNREFUSED = syscall.Errno(0x6f) - ECONNRESET = syscall.Errno(0x68) - EDEADLK = syscall.Errno(0x23) - EDEADLOCK = syscall.Errno(0x3a) - EDESTADDRREQ = syscall.Errno(0x59) - EDOM = syscall.Errno(0x21) - EDOTDOT = syscall.Errno(0x49) - EDQUOT = syscall.Errno(0x7a) - EEXIST = syscall.Errno(0x11) - EFAULT = syscall.Errno(0xe) - EFBIG = syscall.Errno(0x1b) - EHOSTDOWN = syscall.Errno(0x70) - EHOSTUNREACH = syscall.Errno(0x71) - EHWPOISON = syscall.Errno(0x85) - EIDRM = syscall.Errno(0x2b) - EILSEQ = syscall.Errno(0x54) - EINPROGRESS = syscall.Errno(0x73) - EINTR = syscall.Errno(0x4) - EINVAL = syscall.Errno(0x16) - EIO = syscall.Errno(0x5) - EISCONN = syscall.Errno(0x6a) - EISDIR = syscall.Errno(0x15) - EISNAM = syscall.Errno(0x78) - EKEYEXPIRED = syscall.Errno(0x7f) - EKEYREJECTED = syscall.Errno(0x81) - EKEYREVOKED = syscall.Errno(0x80) - EL2HLT = syscall.Errno(0x33) - EL2NSYNC = syscall.Errno(0x2d) - EL3HLT = syscall.Errno(0x2e) - EL3RST = syscall.Errno(0x2f) - ELIBACC = syscall.Errno(0x4f) - ELIBBAD = syscall.Errno(0x50) - ELIBEXEC = syscall.Errno(0x53) - ELIBMAX = syscall.Errno(0x52) - ELIBSCN = syscall.Errno(0x51) - ELNRNG = syscall.Errno(0x30) - ELOOP = syscall.Errno(0x28) - EMEDIUMTYPE = syscall.Errno(0x7c) - EMFILE = syscall.Errno(0x18) - EMLINK = syscall.Errno(0x1f) - EMSGSIZE = syscall.Errno(0x5a) - EMULTIHOP = syscall.Errno(0x48) - ENAMETOOLONG = syscall.Errno(0x24) - ENAVAIL = syscall.Errno(0x77) - ENETDOWN = syscall.Errno(0x64) - ENETRESET = syscall.Errno(0x66) - ENETUNREACH = syscall.Errno(0x65) - ENFILE = syscall.Errno(0x17) - ENOANO = syscall.Errno(0x37) - ENOBUFS = syscall.Errno(0x69) - ENOCSI = syscall.Errno(0x32) - ENODATA = syscall.Errno(0x3d) - ENODEV = syscall.Errno(0x13) - ENOENT = syscall.Errno(0x2) - ENOEXEC = syscall.Errno(0x8) - ENOKEY = syscall.Errno(0x7e) - ENOLCK = syscall.Errno(0x25) - ENOLINK = syscall.Errno(0x43) - ENOMEDIUM = syscall.Errno(0x7b) - ENOMEM = syscall.Errno(0xc) - ENOMSG = syscall.Errno(0x2a) - ENONET = syscall.Errno(0x40) - ENOPKG = syscall.Errno(0x41) - ENOPROTOOPT = syscall.Errno(0x5c) - ENOSPC = syscall.Errno(0x1c) - ENOSR = syscall.Errno(0x3f) - ENOSTR = syscall.Errno(0x3c) - ENOSYS = syscall.Errno(0x26) - ENOTBLK = syscall.Errno(0xf) - ENOTCONN = syscall.Errno(0x6b) - ENOTDIR = syscall.Errno(0x14) - ENOTEMPTY = syscall.Errno(0x27) - ENOTNAM = syscall.Errno(0x76) - ENOTRECOVERABLE = syscall.Errno(0x83) - ENOTSOCK = syscall.Errno(0x58) - ENOTSUP = syscall.Errno(0x5f) - ENOTTY = syscall.Errno(0x19) - ENOTUNIQ = syscall.Errno(0x4c) - ENXIO = syscall.Errno(0x6) - EOPNOTSUPP = syscall.Errno(0x5f) - EOVERFLOW = syscall.Errno(0x4b) - EOWNERDEAD = syscall.Errno(0x82) - EPERM = syscall.Errno(0x1) - EPFNOSUPPORT = syscall.Errno(0x60) - EPIPE = syscall.Errno(0x20) - EPROTO = syscall.Errno(0x47) - EPROTONOSUPPORT = syscall.Errno(0x5d) - EPROTOTYPE = syscall.Errno(0x5b) - ERANGE = syscall.Errno(0x22) - EREMCHG = syscall.Errno(0x4e) - EREMOTE = syscall.Errno(0x42) - EREMOTEIO = syscall.Errno(0x79) - ERESTART = syscall.Errno(0x55) - ERFKILL = syscall.Errno(0x84) - EROFS = syscall.Errno(0x1e) - ESHUTDOWN = syscall.Errno(0x6c) - ESOCKTNOSUPPORT = syscall.Errno(0x5e) - ESPIPE = syscall.Errno(0x1d) - ESRCH = syscall.Errno(0x3) - ESRMNT = syscall.Errno(0x45) - ESTALE = syscall.Errno(0x74) - ESTRPIPE = syscall.Errno(0x56) - ETIME = syscall.Errno(0x3e) - ETIMEDOUT = syscall.Errno(0x6e) - ETOOMANYREFS = syscall.Errno(0x6d) - ETXTBSY = syscall.Errno(0x1a) - EUCLEAN = syscall.Errno(0x75) - EUNATCH = syscall.Errno(0x31) - EUSERS = syscall.Errno(0x57) - EWOULDBLOCK = syscall.Errno(0xb) - EXDEV = syscall.Errno(0x12) - EXFULL = syscall.Errno(0x36) -) - -// Signals -const ( - SIGABRT = syscall.Signal(0x6) - SIGALRM = syscall.Signal(0xe) - SIGBUS = syscall.Signal(0x7) - SIGCHLD = syscall.Signal(0x11) - SIGCLD = syscall.Signal(0x11) - SIGCONT = syscall.Signal(0x12) - SIGFPE = syscall.Signal(0x8) - SIGHUP = syscall.Signal(0x1) - SIGILL = syscall.Signal(0x4) - SIGINT = syscall.Signal(0x2) - SIGIO = syscall.Signal(0x1d) - SIGIOT = syscall.Signal(0x6) - SIGKILL = syscall.Signal(0x9) - SIGPIPE = syscall.Signal(0xd) - SIGPOLL = syscall.Signal(0x1d) - SIGPROF = syscall.Signal(0x1b) - SIGPWR = syscall.Signal(0x1e) - SIGQUIT = syscall.Signal(0x3) - SIGSEGV = syscall.Signal(0xb) - SIGSTKFLT = syscall.Signal(0x10) - SIGSTOP = syscall.Signal(0x13) - SIGSYS = syscall.Signal(0x1f) - SIGTERM = syscall.Signal(0xf) - SIGTRAP = syscall.Signal(0x5) - SIGTSTP = syscall.Signal(0x14) - SIGTTIN = syscall.Signal(0x15) - SIGTTOU = syscall.Signal(0x16) - SIGUNUSED = syscall.Signal(0x1f) - SIGURG = syscall.Signal(0x17) - SIGUSR1 = syscall.Signal(0xa) - SIGUSR2 = syscall.Signal(0xc) - SIGVTALRM = syscall.Signal(0x1a) - SIGWINCH = syscall.Signal(0x1c) - SIGXCPU = syscall.Signal(0x18) - SIGXFSZ = syscall.Signal(0x19) -) - -// Error table -var errors = [...]string{ - 1: "operation not permitted", - 2: "no such file or directory", - 3: "no such process", - 4: "interrupted system call", - 5: "input/output error", - 6: "no such device or address", - 7: "argument list too long", - 8: "exec format error", - 9: "bad file descriptor", - 10: "no child processes", - 11: "resource temporarily unavailable", - 12: "cannot allocate memory", - 13: "permission denied", - 14: "bad address", - 15: "block device required", - 16: "device or resource busy", - 17: "file exists", - 18: "invalid cross-device link", - 19: "no such device", - 20: "not a directory", - 21: "is a directory", - 22: "invalid argument", - 23: "too many open files in system", - 24: "too many open files", - 25: "inappropriate ioctl for device", - 26: "text file busy", - 27: "file too large", - 28: "no space left on device", - 29: "illegal seek", - 30: "read-only file system", - 31: "too many links", - 32: "broken pipe", - 33: "numerical argument out of domain", - 34: "numerical result out of range", - 35: "resource deadlock avoided", - 36: "file name too long", - 37: "no locks available", - 38: "function not implemented", - 39: "directory not empty", - 40: "too many levels of symbolic links", - 42: "no message of desired type", - 43: "identifier removed", - 44: "channel number out of range", - 45: "level 2 not synchronized", - 46: "level 3 halted", - 47: "level 3 reset", - 48: "link number out of range", - 49: "protocol driver not attached", - 50: "no CSI structure available", - 51: "level 2 halted", - 52: "invalid exchange", - 53: "invalid request descriptor", - 54: "exchange full", - 55: "no anode", - 56: "invalid request code", - 57: "invalid slot", - 58: "file locking deadlock error", - 59: "bad font file format", - 60: "device not a stream", - 61: "no data available", - 62: "timer expired", - 63: "out of streams resources", - 64: "machine is not on the network", - 65: "package not installed", - 66: "object is remote", - 67: "link has been severed", - 68: "advertise error", - 69: "srmount error", - 70: "communication error on send", - 71: "protocol error", - 72: "multihop attempted", - 73: "RFS specific error", - 74: "bad message", - 75: "value too large for defined data type", - 76: "name not unique on network", - 77: "file descriptor in bad state", - 78: "remote address changed", - 79: "can not access a needed shared library", - 80: "accessing a corrupted shared library", - 81: ".lib section in a.out corrupted", - 82: "attempting to link in too many shared libraries", - 83: "cannot exec a shared library directly", - 84: "invalid or incomplete multibyte or wide character", - 85: "interrupted system call should be restarted", - 86: "streams pipe error", - 87: "too many users", - 88: "socket operation on non-socket", - 89: "destination address required", - 90: "message too long", - 91: "protocol wrong type for socket", - 92: "protocol not available", - 93: "protocol not supported", - 94: "socket type not supported", - 95: "operation not supported", - 96: "protocol family not supported", - 97: "address family not supported by protocol", - 98: "address already in use", - 99: "cannot assign requested address", - 100: "network is down", - 101: "network is unreachable", - 102: "network dropped connection on reset", - 103: "software caused connection abort", - 104: "connection reset by peer", - 105: "no buffer space available", - 106: "transport endpoint is already connected", - 107: "transport endpoint is not connected", - 108: "cannot send after transport endpoint shutdown", - 109: "too many references: cannot splice", - 110: "connection timed out", - 111: "connection refused", - 112: "host is down", - 113: "no route to host", - 114: "operation already in progress", - 115: "operation now in progress", - 116: "stale file handle", - 117: "structure needs cleaning", - 118: "not a XENIX named type file", - 119: "no XENIX semaphores available", - 120: "is a named type file", - 121: "remote I/O error", - 122: "disk quota exceeded", - 123: "no medium found", - 124: "wrong medium type", - 125: "operation canceled", - 126: "required key not available", - 127: "key has expired", - 128: "key has been revoked", - 129: "key was rejected by service", - 130: "owner died", - 131: "state not recoverable", - 132: "operation not possible due to RF-kill", - 133: "memory page has hardware error", -} - -// Signal table -var signals = [...]string{ - 1: "hangup", - 2: "interrupt", - 3: "quit", - 4: "illegal instruction", - 5: "trace/breakpoint trap", - 6: "aborted", - 7: "bus error", - 8: "floating point exception", - 9: "killed", - 10: "user defined signal 1", - 11: "segmentation fault", - 12: "user defined signal 2", - 13: "broken pipe", - 14: "alarm clock", - 15: "terminated", - 16: "stack fault", - 17: "child exited", - 18: "continued", - 19: "stopped (signal)", - 20: "stopped", - 21: "stopped (tty input)", - 22: "stopped (tty output)", - 23: "urgent I/O condition", - 24: "CPU time limit exceeded", - 25: "file size limit exceeded", - 26: "virtual timer expired", - 27: "profiling timer expired", - 28: "window changed", - 29: "I/O possible", - 30: "power failure", - 31: "bad system call", -} diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go index b4338d5f26..147bcd3df0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go @@ -1,8 +1,6 @@ // mkerrors.sh -m32 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build 386,netbsd - // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -m32 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go index 4994437b63..cae48d1e7e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go @@ -1,8 +1,6 @@ // mkerrors.sh -m64 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build amd64,netbsd - // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go index ac85ca6452..95a0a25163 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go @@ -1,8 +1,6 @@ // mkerrors.sh -marm // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build arm,netbsd - // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -marm _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go index 3322e998d3..8558737b84 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go @@ -1,8 +1,6 @@ // mkerrors.sh -m32 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build 386,openbsd - // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -m32 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go index 1758ecca93..c1d382a421 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go @@ -1,8 +1,6 @@ // mkerrors.sh -m64 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build amd64,openbsd - // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go index a08922b981..f60e1f8313 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go @@ -1,8 +1,6 @@ // mkerrors.sh -m64 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build amd64,solaris - // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -m64 _const.go @@ -161,14 +159,6 @@ const ( BRKINT = 0x2 CFLUSH = 0xf CLOCAL = 0x800 - CLOCK_HIGHRES = 0x4 - CLOCK_LEVEL = 0xa - CLOCK_MONOTONIC = 0x4 - CLOCK_PROCESS_CPUTIME_ID = 0x5 - CLOCK_PROF = 0x2 - CLOCK_REALTIME = 0x3 - CLOCK_THREAD_CPUTIME_ID = 0x2 - CLOCK_VIRTUAL = 0x1 CREAD = 0x80 CS5 = 0x0 CS6 = 0x10 @@ -176,7 +166,6 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTART = 0x11 - CSTATUS = 0x14 CSTOP = 0x13 CSTOPB = 0x40 CSUSP = 0x1a @@ -766,7 +755,9 @@ const ( SIOCDARP = -0x7fdb96e0 SIOCDELMULTI = -0x7fdf96ce SIOCDELRT = -0x7fcf8df5 + SIOCDIPSECONFIG = -0x7ffb9669 SIOCDXARP = -0x7fff9658 + SIOCFIPSECONFIG = -0x7ffb966b SIOCGARP = -0x3fdb96e1 SIOCGDSTINFO = -0x3fff965c SIOCGENADDR = -0x3fdf96ab @@ -828,6 +819,7 @@ const ( SIOCLIFGETND = -0x3f879672 SIOCLIFREMOVEIF = -0x7f879692 SIOCLIFSETND = -0x7f879671 + SIOCLIPSECONFIG = -0x7ffb9668 SIOCLOWER = -0x7fdf96d7 SIOCSARP = -0x7fdb96e2 SIOCSCTPGOPT = -0x3fef9653 @@ -850,6 +842,7 @@ const ( SIOCSIFNETMASK = -0x7fdf96e6 SIOCSIP6ADDRPOLICY = -0x7fff965d SIOCSIPMSFILTER = -0x7ffb964b + SIOCSIPSECONFIG = -0x7ffb966a SIOCSLGETREQ = -0x3fdf96b9 SIOCSLIFADDR = -0x7f879690 SIOCSLIFBRDADDR = -0x7f879684 @@ -956,8 +949,6 @@ const ( SO_VRRP = 0x1017 SO_WROFF = 0x2 TCFLSH = 0x5407 - TCGETA = 0x5401 - TCGETS = 0x540d TCIFLUSH = 0x0 TCIOFLUSH = 0x2 TCOFLUSH = 0x1 @@ -984,14 +975,6 @@ const ( TCP_RTO_MAX = 0x1b TCP_RTO_MIN = 0x1a TCSAFLUSH = 0x5410 - TCSBRK = 0x5405 - TCSETA = 0x5402 - TCSETAF = 0x5404 - TCSETAW = 0x5403 - TCSETS = 0x540e - TCSETSF = 0x5410 - TCSETSW = 0x540f - TCXONC = 0x5406 TIOC = 0x5400 TIOCCBRK = 0x747a TIOCCDTR = 0x7478 @@ -1067,7 +1050,6 @@ const ( VQUIT = 0x1 VREPRINT = 0xc VSTART = 0x8 - VSTATUS = 0x10 VSTOP = 0x9 VSUSP = 0xa VSWTCH = 0x7 @@ -1231,7 +1213,6 @@ const ( SIGFREEZE = syscall.Signal(0x22) SIGHUP = syscall.Signal(0x1) SIGILL = syscall.Signal(0x4) - SIGINFO = syscall.Signal(0x29) SIGINT = syscall.Signal(0x2) SIGIO = syscall.Signal(0x16) SIGIOT = syscall.Signal(0x6) @@ -1432,5 +1413,4 @@ var signals = [...]string{ 38: "resource Control Exceeded", 39: "reserved for JVM 1", 40: "reserved for JVM 2", - 41: "information Request", } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go index a15aaf120a..83034c4f7d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go @@ -1,16 +1,9 @@ // mksyscall.pl -l32 syscall_bsd.go syscall_darwin.go syscall_darwin_386.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build 386,darwin - package unix -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno +import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -18,7 +11,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -28,7 +21,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -39,7 +32,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -50,7 +43,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -60,7 +53,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -70,7 +63,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -81,7 +74,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -91,7 +84,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -101,7 +94,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -111,7 +104,7 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -121,7 +114,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -131,7 +124,7 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func Shutdown(s int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -141,7 +134,7 @@ func Shutdown(s int, how int) (err error) { func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -158,7 +151,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -174,7 +167,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -185,7 +178,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -196,7 +189,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -207,7 +200,7 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -223,7 +216,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -239,7 +232,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -249,7 +242,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { func futimes(fd int, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -260,7 +253,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -270,7 +263,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -282,7 +275,7 @@ func pipe() (r int, w int, err error) { r = int(r0) w = int(r1) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -292,7 +285,7 @@ func pipe() (r int, w int, err error) { func kill(pid int, signum int, posix int) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -308,7 +301,7 @@ func Access(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -318,7 +311,7 @@ func Access(path string, mode uint32) (err error) { func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -334,7 +327,7 @@ func Chdir(path string) (err error) { _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -350,7 +343,7 @@ func Chflags(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -366,7 +359,7 @@ func Chmod(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -382,7 +375,7 @@ func Chown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -398,7 +391,7 @@ func Chroot(path string) (err error) { _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -408,7 +401,7 @@ func Chroot(path string) (err error) { func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -416,10 +409,10 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := RawSyscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -427,9 +420,9 @@ func Dup(fd int) (nfd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := RawSyscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -451,7 +444,7 @@ func Exchangedata(path1 string, path2 string, options int) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -468,7 +461,7 @@ func Exit(code int) { func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -478,7 +471,7 @@ func Fchdir(fd int) (err error) { func Fchflags(fd int, flags int) (err error) { _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -488,7 +481,7 @@ func Fchflags(fd int, flags int) (err error) { func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -498,7 +491,7 @@ func Fchmod(fd int, mode uint32) (err error) { func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -508,7 +501,7 @@ func Fchown(fd int, uid int, gid int) (err error) { func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -519,7 +512,7 @@ func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -529,7 +522,7 @@ func Fpathconf(fd int, name int) (val int, err error) { func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -539,7 +532,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -549,7 +542,7 @@ func Fstatfs(fd int, stat *Statfs_t) (err error) { func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -559,7 +552,7 @@ func Fsync(fd int) (err error) { func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), uintptr(length>>32)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -576,7 +569,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -619,7 +612,7 @@ func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -654,7 +647,7 @@ func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -664,7 +657,7 @@ func Getpriority(which int, who int) (prio int, err error) { func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -674,7 +667,7 @@ func Getrlimit(which int, lim *Rlimit) (err error) { func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -685,7 +678,7 @@ func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -712,7 +705,7 @@ func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -728,7 +721,7 @@ func Lchown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -750,7 +743,7 @@ func Link(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -760,7 +753,7 @@ func Link(path string, link string) (err error) { func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -776,7 +769,7 @@ func Lstat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -792,7 +785,7 @@ func Mkdir(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -808,7 +801,7 @@ func Mkfifo(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -824,7 +817,7 @@ func Mknod(path string, mode uint32, dev int) (err error) { _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -840,7 +833,7 @@ func Mlock(b []byte) (err error) { } _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -850,7 +843,7 @@ func Mlock(b []byte) (err error) { func Mlockall(flags int) (err error) { _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -866,7 +859,7 @@ func Mprotect(b []byte, prot int) (err error) { } _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -882,7 +875,7 @@ func Munlock(b []byte) (err error) { } _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -892,7 +885,7 @@ func Munlock(b []byte) (err error) { func Munlockall() (err error) { _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -909,7 +902,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -926,7 +919,7 @@ func Pathconf(path string, name int) (val int, err error) { use(unsafe.Pointer(_p0)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -943,7 +936,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -960,7 +953,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -977,7 +970,7 @@ func read(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1000,7 +993,7 @@ func Readlink(path string, buf []byte) (n int, err error) { use(unsafe.Pointer(_p0)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1022,7 +1015,7 @@ func Rename(from string, to string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1038,7 +1031,7 @@ func Revoke(path string) (err error) { _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1054,7 +1047,7 @@ func Rmdir(path string) (err error) { _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1065,7 +1058,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) newoffset = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1075,7 +1068,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1085,7 +1078,7 @@ func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { func Setegid(egid int) (err error) { _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1095,7 +1088,7 @@ func Setegid(egid int) (err error) { func Seteuid(euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1105,7 +1098,7 @@ func Seteuid(euid int) (err error) { func Setgid(gid int) (err error) { _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1121,7 +1114,7 @@ func Setlogin(name string) (err error) { _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1131,7 +1124,7 @@ func Setlogin(name string) (err error) { func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1141,7 +1134,7 @@ func Setpgid(pid int, pgid int) (err error) { func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1151,7 +1144,7 @@ func Setpriority(which int, who int, prio int) (err error) { func Setprivexec(flag int) (err error) { _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1161,7 +1154,7 @@ func Setprivexec(flag int) (err error) { func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1171,7 +1164,7 @@ func Setregid(rgid int, egid int) (err error) { func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1181,7 +1174,7 @@ func Setreuid(ruid int, euid int) (err error) { func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1192,7 +1185,7 @@ func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1202,7 +1195,7 @@ func Setsid() (pid int, err error) { func Settimeofday(tp *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1212,7 +1205,7 @@ func Settimeofday(tp *Timeval) (err error) { func Setuid(uid int) (err error) { _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1228,7 +1221,7 @@ func Stat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1244,7 +1237,7 @@ func Statfs(path string, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1266,7 +1259,7 @@ func Symlink(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1276,7 +1269,7 @@ func Symlink(path string, link string) (err error) { func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1292,7 +1285,7 @@ func Truncate(path string, length int64) (err error) { _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1316,7 +1309,7 @@ func Undelete(path string) (err error) { _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1332,7 +1325,7 @@ func Unlink(path string) (err error) { _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1348,7 +1341,7 @@ func Unmount(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1365,7 +1358,7 @@ func write(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1376,7 +1369,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) ret = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1386,7 +1379,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1397,7 +1390,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1408,7 +1401,7 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1420,7 +1413,7 @@ func gettimeofday(tp *Timeval) (sec int32, usec int32, err error) { sec = int32(r0) usec = int32(r1) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index 74606b2f49..23ce433eb5 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -1,16 +1,9 @@ // mksyscall.pl syscall_bsd.go syscall_darwin.go syscall_darwin_amd64.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build amd64,darwin - package unix -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno +import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -18,7 +11,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -28,7 +21,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -39,7 +32,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -50,7 +43,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -60,7 +53,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -70,7 +63,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -81,7 +74,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -91,7 +84,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -101,7 +94,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -111,7 +104,7 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -121,7 +114,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -131,7 +124,7 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func Shutdown(s int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -141,7 +134,7 @@ func Shutdown(s int, how int) (err error) { func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -158,7 +151,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -174,7 +167,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -185,7 +178,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -196,7 +189,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -207,7 +200,7 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -223,7 +216,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -239,7 +232,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -249,7 +242,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { func futimes(fd int, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -260,7 +253,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -270,7 +263,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -282,7 +275,7 @@ func pipe() (r int, w int, err error) { r = int(r0) w = int(r1) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -292,7 +285,7 @@ func pipe() (r int, w int, err error) { func kill(pid int, signum int, posix int) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -308,7 +301,7 @@ func Access(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -318,7 +311,7 @@ func Access(path string, mode uint32) (err error) { func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -334,7 +327,7 @@ func Chdir(path string) (err error) { _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -350,7 +343,7 @@ func Chflags(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -366,7 +359,7 @@ func Chmod(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -382,7 +375,7 @@ func Chown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -398,7 +391,7 @@ func Chroot(path string) (err error) { _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -408,7 +401,7 @@ func Chroot(path string) (err error) { func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -416,10 +409,10 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := RawSyscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -427,9 +420,9 @@ func Dup(fd int) (nfd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := RawSyscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -451,7 +444,7 @@ func Exchangedata(path1 string, path2 string, options int) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -468,7 +461,7 @@ func Exit(code int) { func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -478,7 +471,7 @@ func Fchdir(fd int) (err error) { func Fchflags(fd int, flags int) (err error) { _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -488,7 +481,7 @@ func Fchflags(fd int, flags int) (err error) { func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -498,7 +491,7 @@ func Fchmod(fd int, mode uint32) (err error) { func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -508,7 +501,7 @@ func Fchown(fd int, uid int, gid int) (err error) { func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -519,7 +512,7 @@ func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -529,7 +522,7 @@ func Fpathconf(fd int, name int) (val int, err error) { func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -539,7 +532,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -549,7 +542,7 @@ func Fstatfs(fd int, stat *Statfs_t) (err error) { func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -559,7 +552,7 @@ func Fsync(fd int) (err error) { func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -576,7 +569,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -619,7 +612,7 @@ func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -654,7 +647,7 @@ func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -664,7 +657,7 @@ func Getpriority(which int, who int) (prio int, err error) { func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -674,7 +667,7 @@ func Getrlimit(which int, lim *Rlimit) (err error) { func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -685,7 +678,7 @@ func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -712,7 +705,7 @@ func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -728,7 +721,7 @@ func Lchown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -750,7 +743,7 @@ func Link(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -760,7 +753,7 @@ func Link(path string, link string) (err error) { func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -776,7 +769,7 @@ func Lstat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -792,7 +785,7 @@ func Mkdir(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -808,7 +801,7 @@ func Mkfifo(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -824,7 +817,7 @@ func Mknod(path string, mode uint32, dev int) (err error) { _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -840,7 +833,7 @@ func Mlock(b []byte) (err error) { } _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -850,7 +843,7 @@ func Mlock(b []byte) (err error) { func Mlockall(flags int) (err error) { _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -866,7 +859,7 @@ func Mprotect(b []byte, prot int) (err error) { } _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -882,7 +875,7 @@ func Munlock(b []byte) (err error) { } _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -892,7 +885,7 @@ func Munlock(b []byte) (err error) { func Munlockall() (err error) { _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -909,7 +902,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -926,7 +919,7 @@ func Pathconf(path string, name int) (val int, err error) { use(unsafe.Pointer(_p0)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -943,7 +936,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -960,7 +953,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -977,7 +970,7 @@ func read(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1000,7 +993,7 @@ func Readlink(path string, buf []byte) (n int, err error) { use(unsafe.Pointer(_p0)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1022,7 +1015,7 @@ func Rename(from string, to string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1038,7 +1031,7 @@ func Revoke(path string) (err error) { _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1054,7 +1047,7 @@ func Rmdir(path string) (err error) { _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1065,7 +1058,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) newoffset = int64(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1075,7 +1068,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1085,7 +1078,7 @@ func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { func Setegid(egid int) (err error) { _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1095,7 +1088,7 @@ func Setegid(egid int) (err error) { func Seteuid(euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1105,7 +1098,7 @@ func Seteuid(euid int) (err error) { func Setgid(gid int) (err error) { _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1121,7 +1114,7 @@ func Setlogin(name string) (err error) { _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1131,7 +1124,7 @@ func Setlogin(name string) (err error) { func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1141,7 +1134,7 @@ func Setpgid(pid int, pgid int) (err error) { func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1151,7 +1144,7 @@ func Setpriority(which int, who int, prio int) (err error) { func Setprivexec(flag int) (err error) { _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1161,7 +1154,7 @@ func Setprivexec(flag int) (err error) { func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1171,7 +1164,7 @@ func Setregid(rgid int, egid int) (err error) { func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1181,7 +1174,7 @@ func Setreuid(ruid int, euid int) (err error) { func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1192,7 +1185,7 @@ func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1202,7 +1195,7 @@ func Setsid() (pid int, err error) { func Settimeofday(tp *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1212,7 +1205,7 @@ func Settimeofday(tp *Timeval) (err error) { func Setuid(uid int) (err error) { _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1228,7 +1221,7 @@ func Stat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1244,7 +1237,7 @@ func Statfs(path string, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1266,7 +1259,7 @@ func Symlink(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1276,7 +1269,7 @@ func Symlink(path string, link string) (err error) { func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1292,7 +1285,7 @@ func Truncate(path string, length int64) (err error) { _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1316,7 +1309,7 @@ func Undelete(path string) (err error) { _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1332,7 +1325,7 @@ func Unlink(path string) (err error) { _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1348,7 +1341,7 @@ func Unmount(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1365,7 +1358,7 @@ func write(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1376,7 +1369,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1386,7 +1379,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1397,7 +1390,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1408,23 +1401,7 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1436,7 +1413,7 @@ func gettimeofday(tp *Timeval) (sec int64, usec int32, err error) { sec = int64(r0) usec = int32(r1) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go deleted file mode 100644 index 640e854269..0000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go +++ /dev/null @@ -1,1426 +0,0 @@ -// mksyscall.pl syscall_bsd.go syscall_darwin.go syscall_darwin_arm.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -// +build arm,darwin - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (r int, w int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) - size = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pgrp = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - use(unsafe.Pointer(_p0)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - use(unsafe.Pointer(_p0)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - use(unsafe.Pointer(_p0)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) - newoffset = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { - _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setprivexec(flag int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func gettimeofday(tp *Timeval) (sec int32, usec int32, err error) { - r0, r1, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - sec = int32(r0) - usec = int32(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go deleted file mode 100644 index 933f67bbf1..0000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ /dev/null @@ -1,1426 +0,0 @@ -// mksyscall.pl syscall_bsd.go syscall_darwin.go syscall_darwin_arm64.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -// +build arm64,darwin - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (r int, w int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) - size = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pgrp = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - use(unsafe.Pointer(_p0)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - use(unsafe.Pointer(_p0)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - use(unsafe.Pointer(_p0)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) - newoffset = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { - _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setprivexec(flag int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func gettimeofday(tp *Timeval) (sec int64, usec int32, err error) { - r0, r1, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - sec = int64(r0) - usec = int32(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_386.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_386.go index 32e46af601..58d2a9ab1e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_386.go @@ -1,16 +1,9 @@ // mksyscall.pl -l32 -dragonfly syscall_bsd.go syscall_dragonfly.go syscall_dragonfly_386.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build 386,dragonfly - package unix -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno +import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -18,7 +11,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -28,7 +21,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -39,7 +32,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -50,7 +43,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -60,7 +53,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -70,7 +63,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -81,7 +74,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -91,7 +84,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -101,7 +94,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -111,7 +104,7 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -121,7 +114,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -131,7 +124,7 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func Shutdown(s int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -141,7 +134,7 @@ func Shutdown(s int, how int) (err error) { func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -158,7 +151,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -174,7 +167,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -185,7 +178,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -196,7 +189,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -207,7 +200,7 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -223,7 +216,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -239,7 +232,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -249,7 +242,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { func futimes(fd int, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -260,7 +253,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -272,7 +265,7 @@ func pipe() (r int, w int, err error) { r = int(r0) w = int(r1) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -289,7 +282,7 @@ func extpread(fd int, p []byte, flags int, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_EXTPREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(offset), uintptr(offset>>32)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -306,7 +299,7 @@ func extpwrite(fd int, p []byte, flags int, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_EXTPWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(offset), uintptr(offset>>32)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -322,7 +315,7 @@ func Access(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -332,7 +325,7 @@ func Access(path string, mode uint32) (err error) { func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -348,7 +341,7 @@ func Chdir(path string) (err error) { _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -364,7 +357,7 @@ func Chflags(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -380,7 +373,7 @@ func Chmod(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -396,7 +389,7 @@ func Chown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -412,7 +405,7 @@ func Chroot(path string) (err error) { _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -422,7 +415,7 @@ func Chroot(path string) (err error) { func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -430,10 +423,10 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := RawSyscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -441,9 +434,9 @@ func Dup(fd int) (nfd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := RawSyscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -460,7 +453,7 @@ func Exit(code int) { func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -470,7 +463,7 @@ func Fchdir(fd int) (err error) { func Fchflags(fd int, flags int) (err error) { _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -480,7 +473,7 @@ func Fchflags(fd int, flags int) (err error) { func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -490,7 +483,7 @@ func Fchmod(fd int, mode uint32) (err error) { func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -500,7 +493,7 @@ func Fchown(fd int, uid int, gid int) (err error) { func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -511,7 +504,7 @@ func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -521,7 +514,7 @@ func Fpathconf(fd int, name int) (val int, err error) { func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -531,7 +524,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -541,7 +534,7 @@ func Fstatfs(fd int, stat *Statfs_t) (err error) { func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -551,7 +544,7 @@ func Fsync(fd int) (err error) { func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall6(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length), uintptr(length>>32), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -568,7 +561,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -611,7 +604,7 @@ func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -646,7 +639,7 @@ func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -656,7 +649,7 @@ func Getpriority(which int, who int) (prio int, err error) { func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -666,7 +659,7 @@ func Getrlimit(which int, lim *Rlimit) (err error) { func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -677,7 +670,7 @@ func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -687,7 +680,7 @@ func Getsid(pid int) (sid int, err error) { func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -713,7 +706,7 @@ func Issetugid() (tainted bool) { func Kill(pid int, signum syscall.Signal) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -724,7 +717,7 @@ func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -740,7 +733,7 @@ func Lchown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -762,7 +755,7 @@ func Link(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -772,7 +765,7 @@ func Link(path string, link string) (err error) { func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -788,7 +781,7 @@ func Lstat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -804,7 +797,7 @@ func Mkdir(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -820,7 +813,7 @@ func Mkfifo(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -836,75 +829,7 @@ func Mknod(path string, mode uint32, dev int) (err error) { _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -914,7 +839,7 @@ func Munlockall() (err error) { func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -931,7 +856,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -948,7 +873,7 @@ func Pathconf(path string, name int) (val int, err error) { use(unsafe.Pointer(_p0)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -965,7 +890,7 @@ func read(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -988,7 +913,7 @@ func Readlink(path string, buf []byte) (n int, err error) { use(unsafe.Pointer(_p0)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1010,7 +935,7 @@ func Rename(from string, to string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1026,7 +951,7 @@ func Revoke(path string) (err error) { _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1042,7 +967,7 @@ func Rmdir(path string) (err error) { _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1053,7 +978,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), uintptr(whence), 0) newoffset = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1063,7 +988,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1073,7 +998,7 @@ func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { func Setegid(egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1083,7 +1008,7 @@ func Setegid(egid int) (err error) { func Seteuid(euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1093,7 +1018,7 @@ func Seteuid(euid int) (err error) { func Setgid(gid int) (err error) { _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1109,7 +1034,7 @@ func Setlogin(name string) (err error) { _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1119,7 +1044,7 @@ func Setlogin(name string) (err error) { func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1129,7 +1054,7 @@ func Setpgid(pid int, pgid int) (err error) { func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1139,7 +1064,7 @@ func Setpriority(which int, who int, prio int) (err error) { func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1149,7 +1074,7 @@ func Setregid(rgid int, egid int) (err error) { func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1159,7 +1084,7 @@ func Setreuid(ruid int, euid int) (err error) { func Setresgid(rgid int, egid int, sgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1169,7 +1094,7 @@ func Setresgid(rgid int, egid int, sgid int) (err error) { func Setresuid(ruid int, euid int, suid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1179,7 +1104,7 @@ func Setresuid(ruid int, euid int, suid int) (err error) { func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1190,7 +1115,7 @@ func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1200,7 +1125,7 @@ func Setsid() (pid int, err error) { func Settimeofday(tp *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1210,7 +1135,7 @@ func Settimeofday(tp *Timeval) (err error) { func Setuid(uid int) (err error) { _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1226,7 +1151,7 @@ func Stat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1242,7 +1167,7 @@ func Statfs(path string, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1264,7 +1189,7 @@ func Symlink(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1274,7 +1199,7 @@ func Symlink(path string, link string) (err error) { func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1290,7 +1215,7 @@ func Truncate(path string, length int64) (err error) { _, _, e1 := Syscall6(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1314,7 +1239,7 @@ func Undelete(path string) (err error) { _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1330,7 +1255,7 @@ func Unlink(path string) (err error) { _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1346,7 +1271,7 @@ func Unmount(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1363,7 +1288,7 @@ func write(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1374,7 +1299,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), uintptr(pos>>32), 0) ret = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1384,7 +1309,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1395,7 +1320,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1406,7 +1331,7 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go index 3fa6ff796d..3a226aecf9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go @@ -1,16 +1,9 @@ // mksyscall.pl -dragonfly syscall_bsd.go syscall_dragonfly.go syscall_dragonfly_amd64.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build amd64,dragonfly - package unix -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno +import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -18,7 +11,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -28,7 +21,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -39,7 +32,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -50,7 +43,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -60,7 +53,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -70,7 +63,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -81,7 +74,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -91,7 +84,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -101,7 +94,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -111,7 +104,7 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -121,7 +114,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -131,7 +124,7 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func Shutdown(s int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -141,7 +134,7 @@ func Shutdown(s int, how int) (err error) { func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -158,7 +151,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -174,7 +167,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -185,7 +178,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -196,7 +189,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -207,7 +200,7 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -223,7 +216,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -239,7 +232,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -249,7 +242,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { func futimes(fd int, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -260,7 +253,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -272,7 +265,7 @@ func pipe() (r int, w int, err error) { r = int(r0) w = int(r1) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -289,7 +282,7 @@ func extpread(fd int, p []byte, flags int, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_EXTPREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(offset), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -306,7 +299,7 @@ func extpwrite(fd int, p []byte, flags int, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_EXTPWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(offset), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -322,7 +315,7 @@ func Access(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -332,7 +325,7 @@ func Access(path string, mode uint32) (err error) { func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -348,7 +341,7 @@ func Chdir(path string) (err error) { _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -364,7 +357,7 @@ func Chflags(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -380,7 +373,7 @@ func Chmod(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -396,7 +389,7 @@ func Chown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -412,7 +405,7 @@ func Chroot(path string) (err error) { _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -422,7 +415,7 @@ func Chroot(path string) (err error) { func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -430,10 +423,10 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := RawSyscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -441,9 +434,9 @@ func Dup(fd int) (nfd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := RawSyscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -460,7 +453,7 @@ func Exit(code int) { func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -470,7 +463,7 @@ func Fchdir(fd int) (err error) { func Fchflags(fd int, flags int) (err error) { _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -480,7 +473,7 @@ func Fchflags(fd int, flags int) (err error) { func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -490,7 +483,7 @@ func Fchmod(fd int, mode uint32) (err error) { func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -500,7 +493,7 @@ func Fchown(fd int, uid int, gid int) (err error) { func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -511,7 +504,7 @@ func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -521,7 +514,7 @@ func Fpathconf(fd int, name int) (val int, err error) { func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -531,7 +524,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -541,7 +534,7 @@ func Fstatfs(fd int, stat *Statfs_t) (err error) { func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -551,7 +544,7 @@ func Fsync(fd int) (err error) { func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -568,7 +561,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -611,7 +604,7 @@ func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -646,7 +639,7 @@ func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -656,7 +649,7 @@ func Getpriority(which int, who int) (prio int, err error) { func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -666,7 +659,7 @@ func Getrlimit(which int, lim *Rlimit) (err error) { func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -677,7 +670,7 @@ func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -687,7 +680,7 @@ func Getsid(pid int) (sid int, err error) { func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -713,7 +706,7 @@ func Issetugid() (tainted bool) { func Kill(pid int, signum syscall.Signal) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -724,7 +717,7 @@ func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -740,7 +733,7 @@ func Lchown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -762,7 +755,7 @@ func Link(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -772,7 +765,7 @@ func Link(path string, link string) (err error) { func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -788,7 +781,7 @@ func Lstat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -804,7 +797,7 @@ func Mkdir(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -820,7 +813,7 @@ func Mkfifo(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -836,75 +829,7 @@ func Mknod(path string, mode uint32, dev int) (err error) { _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -914,7 +839,7 @@ func Munlockall() (err error) { func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -931,7 +856,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -948,7 +873,7 @@ func Pathconf(path string, name int) (val int, err error) { use(unsafe.Pointer(_p0)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -965,7 +890,7 @@ func read(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -988,7 +913,7 @@ func Readlink(path string, buf []byte) (n int, err error) { use(unsafe.Pointer(_p0)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1010,7 +935,7 @@ func Rename(from string, to string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1026,7 +951,7 @@ func Revoke(path string) (err error) { _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1042,7 +967,7 @@ func Rmdir(path string) (err error) { _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1053,7 +978,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0) newoffset = int64(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1063,7 +988,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1073,7 +998,7 @@ func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { func Setegid(egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1083,7 +1008,7 @@ func Setegid(egid int) (err error) { func Seteuid(euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1093,7 +1018,7 @@ func Seteuid(euid int) (err error) { func Setgid(gid int) (err error) { _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1109,7 +1034,7 @@ func Setlogin(name string) (err error) { _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1119,7 +1044,7 @@ func Setlogin(name string) (err error) { func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1129,7 +1054,7 @@ func Setpgid(pid int, pgid int) (err error) { func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1139,7 +1064,7 @@ func Setpriority(which int, who int, prio int) (err error) { func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1149,7 +1074,7 @@ func Setregid(rgid int, egid int) (err error) { func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1159,7 +1084,7 @@ func Setreuid(ruid int, euid int) (err error) { func Setresgid(rgid int, egid int, sgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1169,7 +1094,7 @@ func Setresgid(rgid int, egid int, sgid int) (err error) { func Setresuid(ruid int, euid int, suid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1179,7 +1104,7 @@ func Setresuid(ruid int, euid int, suid int) (err error) { func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1190,7 +1115,7 @@ func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1200,7 +1125,7 @@ func Setsid() (pid int, err error) { func Settimeofday(tp *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1210,7 +1135,7 @@ func Settimeofday(tp *Timeval) (err error) { func Setuid(uid int) (err error) { _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1226,7 +1151,7 @@ func Stat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1242,7 +1167,7 @@ func Statfs(path string, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1264,7 +1189,7 @@ func Symlink(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1274,7 +1199,7 @@ func Symlink(path string, link string) (err error) { func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1290,7 +1215,7 @@ func Truncate(path string, length int64) (err error) { _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1314,7 +1239,7 @@ func Undelete(path string) (err error) { _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1330,7 +1255,7 @@ func Unlink(path string) (err error) { _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1346,7 +1271,7 @@ func Unmount(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1363,7 +1288,7 @@ func write(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1374,7 +1299,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0) ret = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1384,7 +1309,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1395,7 +1320,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1406,7 +1331,7 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go index 1a0e528cda..66046d3dbc 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go @@ -1,16 +1,9 @@ // mksyscall.pl -l32 syscall_bsd.go syscall_freebsd.go syscall_freebsd_386.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build 386,freebsd - package unix -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno +import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -18,7 +11,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -28,7 +21,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -39,7 +32,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -50,7 +43,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -60,7 +53,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -70,7 +63,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -81,7 +74,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -91,7 +84,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -101,7 +94,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -111,7 +104,7 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -121,7 +114,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -131,7 +124,7 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func Shutdown(s int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -141,7 +134,7 @@ func Shutdown(s int, how int) (err error) { func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -158,7 +151,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -174,7 +167,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -185,7 +178,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -196,7 +189,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -207,7 +200,7 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -223,7 +216,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -239,7 +232,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -249,7 +242,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { func futimes(fd int, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -260,7 +253,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -272,7 +265,7 @@ func pipe() (r int, w int, err error) { r = int(r0) w = int(r1) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -288,7 +281,7 @@ func Access(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -298,7 +291,7 @@ func Access(path string, mode uint32) (err error) { func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -314,7 +307,7 @@ func Chdir(path string) (err error) { _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -330,7 +323,7 @@ func Chflags(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -346,7 +339,7 @@ func Chmod(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -362,7 +355,7 @@ func Chown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -378,7 +371,7 @@ func Chroot(path string) (err error) { _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -388,7 +381,7 @@ func Chroot(path string) (err error) { func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -396,10 +389,10 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := RawSyscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -407,9 +400,9 @@ func Dup(fd int) (nfd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := RawSyscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -423,251 +416,10 @@ func Exit(code int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attrname) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXTATTR_DELETE_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0))) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrListFd(fd int, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { - r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrGetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrSetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXTATTR_DELETE_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1))) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) - use(unsafe.Pointer(_p0)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrGetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrSetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXTATTR_DELETE_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1))) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) - use(unsafe.Pointer(_p0)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fadvise(fd int, offset int64, length int64, advice int) (err error) { - _, _, e1 := Syscall6(SYS_POSIX_FADVISE, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(length), uintptr(length>>32), uintptr(advice)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -677,7 +429,7 @@ func Fchdir(fd int) (err error) { func Fchflags(fd int, flags int) (err error) { _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -687,7 +439,7 @@ func Fchflags(fd int, flags int) (err error) { func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -697,7 +449,7 @@ func Fchmod(fd int, mode uint32) (err error) { func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -707,7 +459,7 @@ func Fchown(fd int, uid int, gid int) (err error) { func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -718,7 +470,7 @@ func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -728,7 +480,7 @@ func Fpathconf(fd int, name int) (val int, err error) { func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -738,7 +490,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -748,7 +500,7 @@ func Fstatfs(fd int, stat *Statfs_t) (err error) { func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -758,7 +510,7 @@ func Fsync(fd int) (err error) { func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), uintptr(length>>32)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -775,7 +527,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -818,7 +570,7 @@ func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -853,7 +605,7 @@ func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -863,7 +615,7 @@ func Getpriority(which int, who int) (prio int, err error) { func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -873,7 +625,7 @@ func Getrlimit(which int, lim *Rlimit) (err error) { func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -884,7 +636,7 @@ func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -894,7 +646,7 @@ func Getsid(pid int) (sid int, err error) { func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -920,7 +672,7 @@ func Issetugid() (tainted bool) { func Kill(pid int, signum syscall.Signal) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -931,7 +683,7 @@ func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -947,7 +699,7 @@ func Lchown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -969,7 +721,7 @@ func Link(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -979,7 +731,7 @@ func Link(path string, link string) (err error) { func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -995,7 +747,7 @@ func Lstat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1011,7 +763,7 @@ func Mkdir(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1027,7 +779,7 @@ func Mkfifo(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1043,75 +795,7 @@ func Mknod(path string, mode uint32, dev int) (err error) { _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1121,7 +805,7 @@ func Munlockall() (err error) { func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1138,7 +822,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1155,7 +839,7 @@ func Pathconf(path string, name int) (val int, err error) { use(unsafe.Pointer(_p0)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1172,7 +856,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1189,7 +873,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1206,7 +890,7 @@ func read(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1229,7 +913,7 @@ func Readlink(path string, buf []byte) (n int, err error) { use(unsafe.Pointer(_p0)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1251,7 +935,7 @@ func Rename(from string, to string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1267,7 +951,7 @@ func Revoke(path string) (err error) { _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1283,7 +967,7 @@ func Rmdir(path string) (err error) { _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1294,7 +978,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) newoffset = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1304,7 +988,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1314,7 +998,7 @@ func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { func Setegid(egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1324,7 +1008,7 @@ func Setegid(egid int) (err error) { func Seteuid(euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1334,7 +1018,7 @@ func Seteuid(euid int) (err error) { func Setgid(gid int) (err error) { _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1350,7 +1034,7 @@ func Setlogin(name string) (err error) { _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1360,7 +1044,7 @@ func Setlogin(name string) (err error) { func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1370,7 +1054,7 @@ func Setpgid(pid int, pgid int) (err error) { func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1380,7 +1064,7 @@ func Setpriority(which int, who int, prio int) (err error) { func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1390,7 +1074,7 @@ func Setregid(rgid int, egid int) (err error) { func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1400,7 +1084,7 @@ func Setreuid(ruid int, euid int) (err error) { func Setresgid(rgid int, egid int, sgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1410,7 +1094,7 @@ func Setresgid(rgid int, egid int, sgid int) (err error) { func Setresuid(ruid int, euid int, suid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1420,7 +1104,7 @@ func Setresuid(ruid int, euid int, suid int) (err error) { func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1431,7 +1115,7 @@ func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1441,7 +1125,7 @@ func Setsid() (pid int, err error) { func Settimeofday(tp *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1451,7 +1135,7 @@ func Settimeofday(tp *Timeval) (err error) { func Setuid(uid int) (err error) { _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1467,7 +1151,7 @@ func Stat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1483,7 +1167,7 @@ func Statfs(path string, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1505,7 +1189,7 @@ func Symlink(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1515,7 +1199,7 @@ func Symlink(path string, link string) (err error) { func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1531,7 +1215,7 @@ func Truncate(path string, length int64) (err error) { _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1555,7 +1239,7 @@ func Undelete(path string) (err error) { _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1571,7 +1255,7 @@ func Unlink(path string) (err error) { _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1587,7 +1271,7 @@ func Unmount(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1604,7 +1288,7 @@ func write(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1615,7 +1299,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) ret = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1625,7 +1309,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1636,7 +1320,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1647,7 +1331,7 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1658,7 +1342,7 @@ func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) nfd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go index 6e4cf1455c..a7c40020d2 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go @@ -1,16 +1,9 @@ // mksyscall.pl syscall_bsd.go syscall_freebsd.go syscall_freebsd_amd64.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build amd64,freebsd - package unix -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno +import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -18,7 +11,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -28,7 +21,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -39,7 +32,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -50,7 +43,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -60,7 +53,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -70,7 +63,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -81,7 +74,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -91,7 +84,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -101,7 +94,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -111,7 +104,7 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -121,7 +114,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -131,7 +124,7 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func Shutdown(s int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -141,7 +134,7 @@ func Shutdown(s int, how int) (err error) { func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -158,7 +151,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -174,7 +167,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -185,7 +178,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -196,7 +189,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -207,7 +200,7 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -223,7 +216,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -239,7 +232,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -249,7 +242,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { func futimes(fd int, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -260,7 +253,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -272,7 +265,7 @@ func pipe() (r int, w int, err error) { r = int(r0) w = int(r1) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -288,7 +281,7 @@ func Access(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -298,7 +291,7 @@ func Access(path string, mode uint32) (err error) { func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -314,7 +307,7 @@ func Chdir(path string) (err error) { _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -330,7 +323,7 @@ func Chflags(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -346,7 +339,7 @@ func Chmod(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -362,7 +355,7 @@ func Chown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -378,7 +371,7 @@ func Chroot(path string) (err error) { _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -388,7 +381,7 @@ func Chroot(path string) (err error) { func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -396,10 +389,10 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := RawSyscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -407,9 +400,9 @@ func Dup(fd int) (nfd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := RawSyscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -423,251 +416,10 @@ func Exit(code int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attrname) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXTATTR_DELETE_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0))) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrListFd(fd int, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { - r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrGetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrSetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXTATTR_DELETE_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1))) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) - use(unsafe.Pointer(_p0)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrGetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrSetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXTATTR_DELETE_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1))) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) - use(unsafe.Pointer(_p0)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fadvise(fd int, offset int64, length int64, advice int) (err error) { - _, _, e1 := Syscall6(SYS_POSIX_FADVISE, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -677,7 +429,7 @@ func Fchdir(fd int) (err error) { func Fchflags(fd int, flags int) (err error) { _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -687,7 +439,7 @@ func Fchflags(fd int, flags int) (err error) { func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -697,7 +449,7 @@ func Fchmod(fd int, mode uint32) (err error) { func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -707,7 +459,7 @@ func Fchown(fd int, uid int, gid int) (err error) { func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -718,7 +470,7 @@ func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -728,7 +480,7 @@ func Fpathconf(fd int, name int) (val int, err error) { func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -738,7 +490,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -748,7 +500,7 @@ func Fstatfs(fd int, stat *Statfs_t) (err error) { func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -758,7 +510,7 @@ func Fsync(fd int) (err error) { func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -775,7 +527,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -818,7 +570,7 @@ func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -853,7 +605,7 @@ func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -863,7 +615,7 @@ func Getpriority(which int, who int) (prio int, err error) { func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -873,7 +625,7 @@ func Getrlimit(which int, lim *Rlimit) (err error) { func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -884,7 +636,7 @@ func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -894,7 +646,7 @@ func Getsid(pid int) (sid int, err error) { func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -920,7 +672,7 @@ func Issetugid() (tainted bool) { func Kill(pid int, signum syscall.Signal) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -931,7 +683,7 @@ func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -947,7 +699,7 @@ func Lchown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -969,7 +721,7 @@ func Link(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -979,7 +731,7 @@ func Link(path string, link string) (err error) { func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -995,7 +747,7 @@ func Lstat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1011,7 +763,7 @@ func Mkdir(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1027,7 +779,7 @@ func Mkfifo(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1043,75 +795,7 @@ func Mknod(path string, mode uint32, dev int) (err error) { _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1121,7 +805,7 @@ func Munlockall() (err error) { func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1138,7 +822,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1155,7 +839,7 @@ func Pathconf(path string, name int) (val int, err error) { use(unsafe.Pointer(_p0)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1172,7 +856,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1189,7 +873,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1206,7 +890,7 @@ func read(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1229,7 +913,7 @@ func Readlink(path string, buf []byte) (n int, err error) { use(unsafe.Pointer(_p0)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1251,7 +935,7 @@ func Rename(from string, to string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1267,7 +951,7 @@ func Revoke(path string) (err error) { _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1283,7 +967,7 @@ func Rmdir(path string) (err error) { _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1294,7 +978,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) newoffset = int64(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1304,7 +988,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1314,7 +998,7 @@ func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { func Setegid(egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1324,7 +1008,7 @@ func Setegid(egid int) (err error) { func Seteuid(euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1334,7 +1018,7 @@ func Seteuid(euid int) (err error) { func Setgid(gid int) (err error) { _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1350,7 +1034,7 @@ func Setlogin(name string) (err error) { _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1360,7 +1044,7 @@ func Setlogin(name string) (err error) { func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1370,7 +1054,7 @@ func Setpgid(pid int, pgid int) (err error) { func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1380,7 +1064,7 @@ func Setpriority(which int, who int, prio int) (err error) { func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1390,7 +1074,7 @@ func Setregid(rgid int, egid int) (err error) { func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1400,7 +1084,7 @@ func Setreuid(ruid int, euid int) (err error) { func Setresgid(rgid int, egid int, sgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1410,7 +1094,7 @@ func Setresgid(rgid int, egid int, sgid int) (err error) { func Setresuid(ruid int, euid int, suid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1420,7 +1104,7 @@ func Setresuid(ruid int, euid int, suid int) (err error) { func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1431,7 +1115,7 @@ func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1441,7 +1125,7 @@ func Setsid() (pid int, err error) { func Settimeofday(tp *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1451,7 +1135,7 @@ func Settimeofday(tp *Timeval) (err error) { func Setuid(uid int) (err error) { _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1467,7 +1151,7 @@ func Stat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1483,7 +1167,7 @@ func Statfs(path string, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1505,7 +1189,7 @@ func Symlink(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1515,7 +1199,7 @@ func Symlink(path string, link string) (err error) { func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1531,7 +1215,7 @@ func Truncate(path string, length int64) (err error) { _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1555,7 +1239,7 @@ func Undelete(path string) (err error) { _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1571,7 +1255,7 @@ func Unlink(path string) (err error) { _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1587,7 +1271,7 @@ func Unmount(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1604,7 +1288,7 @@ func write(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1615,7 +1299,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1625,7 +1309,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1636,7 +1320,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1647,7 +1331,7 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1658,7 +1342,7 @@ func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) nfd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go index 1872d32308..da394b03dc 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go @@ -1,16 +1,9 @@ // mksyscall.pl -l32 -arm syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build arm,freebsd - package unix -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno +import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -18,7 +11,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -28,7 +21,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -39,7 +32,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -50,7 +43,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -60,7 +53,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -70,7 +63,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -81,7 +74,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -91,7 +84,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -101,7 +94,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -111,7 +104,7 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -121,7 +114,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -131,7 +124,7 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func Shutdown(s int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -141,7 +134,7 @@ func Shutdown(s int, how int) (err error) { func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -158,7 +151,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -174,7 +167,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -185,7 +178,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -196,7 +189,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -207,7 +200,7 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -223,7 +216,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -239,7 +232,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -249,7 +242,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { func futimes(fd int, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -260,7 +253,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -272,7 +265,7 @@ func pipe() (r int, w int, err error) { r = int(r0) w = int(r1) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -288,7 +281,7 @@ func Access(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -298,7 +291,7 @@ func Access(path string, mode uint32) (err error) { func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -314,7 +307,7 @@ func Chdir(path string) (err error) { _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -330,7 +323,7 @@ func Chflags(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -346,7 +339,7 @@ func Chmod(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -362,7 +355,7 @@ func Chown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -378,7 +371,7 @@ func Chroot(path string) (err error) { _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -388,7 +381,7 @@ func Chroot(path string) (err error) { func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -396,10 +389,10 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := RawSyscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -407,9 +400,9 @@ func Dup(fd int) (nfd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := RawSyscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -423,251 +416,10 @@ func Exit(code int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attrname) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXTATTR_DELETE_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0))) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrListFd(fd int, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { - r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrGetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrSetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXTATTR_DELETE_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1))) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) - use(unsafe.Pointer(_p0)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrGetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrSetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXTATTR_DELETE_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1))) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) - use(unsafe.Pointer(_p0)) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fadvise(fd int, offset int64, length int64, advice int) (err error) { - _, _, e1 := Syscall9(SYS_POSIX_FADVISE, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), uintptr(length), uintptr(length>>32), uintptr(advice), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -677,7 +429,7 @@ func Fchdir(fd int) (err error) { func Fchflags(fd int, flags int) (err error) { _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -687,7 +439,7 @@ func Fchflags(fd int, flags int) (err error) { func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -697,7 +449,7 @@ func Fchmod(fd int, mode uint32) (err error) { func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -707,7 +459,7 @@ func Fchown(fd int, uid int, gid int) (err error) { func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -718,7 +470,7 @@ func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -728,7 +480,7 @@ func Fpathconf(fd int, name int) (val int, err error) { func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -738,7 +490,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -748,7 +500,7 @@ func Fstatfs(fd int, stat *Statfs_t) (err error) { func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -758,7 +510,7 @@ func Fsync(fd int) (err error) { func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall6(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length), uintptr(length>>32), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -775,7 +527,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -818,7 +570,7 @@ func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -853,7 +605,7 @@ func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -863,7 +615,7 @@ func Getpriority(which int, who int) (prio int, err error) { func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -873,7 +625,7 @@ func Getrlimit(which int, lim *Rlimit) (err error) { func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -884,7 +636,7 @@ func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -894,7 +646,7 @@ func Getsid(pid int) (sid int, err error) { func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -920,7 +672,7 @@ func Issetugid() (tainted bool) { func Kill(pid int, signum syscall.Signal) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -931,7 +683,7 @@ func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -947,7 +699,7 @@ func Lchown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -969,7 +721,7 @@ func Link(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -979,7 +731,7 @@ func Link(path string, link string) (err error) { func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -995,7 +747,7 @@ func Lstat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1011,7 +763,7 @@ func Mkdir(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1027,7 +779,7 @@ func Mkfifo(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1043,75 +795,7 @@ func Mknod(path string, mode uint32, dev int) (err error) { _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1121,7 +805,7 @@ func Munlockall() (err error) { func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1138,7 +822,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1155,7 +839,7 @@ func Pathconf(path string, name int) (val int, err error) { use(unsafe.Pointer(_p0)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1172,7 +856,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1189,7 +873,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1206,7 +890,7 @@ func read(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1229,7 +913,7 @@ func Readlink(path string, buf []byte) (n int, err error) { use(unsafe.Pointer(_p0)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1251,7 +935,7 @@ func Rename(from string, to string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1267,7 +951,7 @@ func Revoke(path string) (err error) { _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1283,7 +967,7 @@ func Rmdir(path string) (err error) { _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1294,7 +978,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), uintptr(whence), 0) newoffset = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1304,7 +988,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1314,7 +998,7 @@ func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { func Setegid(egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1324,7 +1008,7 @@ func Setegid(egid int) (err error) { func Seteuid(euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1334,7 +1018,7 @@ func Seteuid(euid int) (err error) { func Setgid(gid int) (err error) { _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1350,7 +1034,7 @@ func Setlogin(name string) (err error) { _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1360,7 +1044,7 @@ func Setlogin(name string) (err error) { func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1370,7 +1054,7 @@ func Setpgid(pid int, pgid int) (err error) { func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1380,7 +1064,7 @@ func Setpriority(which int, who int, prio int) (err error) { func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1390,7 +1074,7 @@ func Setregid(rgid int, egid int) (err error) { func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1400,7 +1084,7 @@ func Setreuid(ruid int, euid int) (err error) { func Setresgid(rgid int, egid int, sgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1410,7 +1094,7 @@ func Setresgid(rgid int, egid int, sgid int) (err error) { func Setresuid(ruid int, euid int, suid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1420,7 +1104,7 @@ func Setresuid(ruid int, euid int, suid int) (err error) { func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1431,7 +1115,7 @@ func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1441,7 +1125,7 @@ func Setsid() (pid int, err error) { func Settimeofday(tp *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1451,7 +1135,7 @@ func Settimeofday(tp *Timeval) (err error) { func Setuid(uid int) (err error) { _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1467,7 +1151,7 @@ func Stat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1483,7 +1167,7 @@ func Statfs(path string, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1505,7 +1189,7 @@ func Symlink(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1515,7 +1199,7 @@ func Symlink(path string, link string) (err error) { func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1531,7 +1215,7 @@ func Truncate(path string, length int64) (err error) { _, _, e1 := Syscall6(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1555,7 +1239,7 @@ func Undelete(path string) (err error) { _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1571,7 +1255,7 @@ func Unlink(path string) (err error) { _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1587,7 +1271,7 @@ func Unmount(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1604,7 +1288,7 @@ func write(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1615,7 +1299,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), uintptr(pos>>32), 0) ret = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1625,7 +1309,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1636,7 +1320,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1647,7 +1331,7 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1658,7 +1342,7 @@ func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) nfd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go index ff6c39dc24..fc1dc0f34e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go @@ -1,35 +1,23 @@ // mksyscall.pl -l32 syscall_linux.go syscall_linux_386.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build 386,linux - package unix -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno +import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) { +func open(path string, mode int, perm uint32) (fd int, err error) { var _p0 *byte - _p0, err = BytePtrFromString(oldpath) + _p0, err = BytePtrFromString(path) if err != nil { return } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) + fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -46,68 +34,27 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - use(unsafe.Pointer(_p0)) - n = int(r0) +func pipe(p *[2]_C_int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -123,23 +70,23 @@ func utimes(path string, times *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { +func utimensat(dirfd int, path string, times *[2]Timespec) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) + _, _, e1 := Syscall(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -149,7 +96,7 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -166,7 +113,7 @@ func Getcwd(buf []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_GETCWD, uintptr(_p0), uintptr(len(buf)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -177,7 +124,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -187,7 +134,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -203,7 +150,7 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) { _, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -231,7 +178,23 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt use(unsafe.Pointer(_p1)) use(unsafe.Pointer(_p2)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Access(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -247,7 +210,7 @@ func Acct(path string) (err error) { _, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -258,7 +221,7 @@ func Adjtimex(buf *Timex) (state int, err error) { r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0) state = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -274,7 +237,23 @@ func Chdir(path string) (err error) { _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chmod(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -290,17 +269,7 @@ func Chroot(path string) (err error) { _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ClockGettime(clockid int32, time *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -310,7 +279,24 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Creat(path string, mode uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall(SYS_CREAT, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + use(unsafe.Pointer(_p0)) + fd = int(r0) + if e1 != 0 { + err = e1 } return } @@ -318,10 +304,20 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(oldfd int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) + r0, _, e1 := RawSyscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup2(oldfd int, newfd int) (err error) { + _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) + if e1 != 0 { + err = e1 } return } @@ -329,9 +325,9 @@ func Dup(oldfd int) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup3(oldfd int, newfd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags)) + _, _, e1 := RawSyscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -342,7 +338,7 @@ func EpollCreate(size int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -353,7 +349,7 @@ func EpollCreate1(flag int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -363,7 +359,7 @@ func EpollCreate1(flag int) (fd int, err error) { func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { _, _, e1 := RawSyscall6(SYS_EPOLL_CTL, uintptr(epfd), uintptr(op), uintptr(fd), uintptr(unsafe.Pointer(event)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -380,7 +376,7 @@ func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -403,7 +399,7 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -413,7 +409,7 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(off>>32), uintptr(len), uintptr(len>>32)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -423,7 +419,7 @@ func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -433,7 +429,7 @@ func Fchdir(fd int) (err error) { func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -449,7 +445,7 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -465,7 +461,7 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -476,7 +472,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -486,7 +482,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { func Fdatasync(fd int) (err error) { _, _, e1 := Syscall(SYS_FDATASYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -496,7 +492,7 @@ func Fdatasync(fd int) (err error) { func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -506,7 +502,7 @@ func Flock(fd int, how int) (err error) { func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -523,7 +519,7 @@ func Getdents(fd int, buf []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -534,13 +530,21 @@ func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Getpgrp() (pid int) { + r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) + pid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getpid() (pid int) { r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) @@ -561,7 +565,7 @@ func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -571,7 +575,7 @@ func Getpriority(which int, who int) (prio int, err error) { func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -608,7 +612,7 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) { use(unsafe.Pointer(_p1)) sz = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -625,7 +629,18 @@ func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err e use(unsafe.Pointer(_p0)) watchdesc = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func InotifyInit() (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) + fd = int(r0) + if e1 != 0 { + err = e1 } return } @@ -636,7 +651,7 @@ func InotifyInit1(flags int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT1, uintptr(flags), 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -647,7 +662,7 @@ func InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) { r0, _, e1 := RawSyscall(SYS_INOTIFY_RM_WATCH, uintptr(fd), uintptr(watchdesc), 0) success = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -657,7 +672,7 @@ func InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) { func Kill(pid int, sig syscall.Signal) (err error) { _, _, e1 := RawSyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -674,7 +689,29 @@ func Klogctl(typ int, buf []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Link(oldpath string, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = e1 } return } @@ -697,7 +734,23 @@ func Listxattr(path string, dest []byte) (sz int, err error) { use(unsafe.Pointer(_p0)) sz = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdir(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -713,7 +766,23 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mknod(path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -729,7 +798,7 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -739,7 +808,7 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -749,7 +818,7 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { func Pause() (err error) { _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -771,7 +840,7 @@ func PivotRoot(newroot string, putold string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -781,17 +850,7 @@ func PivotRoot(newroot string, putold string) (err error) { func prlimit(pid int, resource int, old *Rlimit, newlimit *Rlimit) (err error) { _, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(newlimit)), 0, 0) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -808,7 +867,30 @@ func read(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlink(path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + use(unsafe.Pointer(_p0)) + n = int(r0) + if e1 != 0 { + err = e1 } return } @@ -830,7 +912,29 @@ func Removexattr(path string, attr string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rename(oldpath string, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = e1 } return } @@ -852,7 +956,23 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rmdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -868,7 +988,7 @@ func Setdomainname(p []byte) (err error) { } _, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(_p0), uintptr(len(p)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -884,7 +1004,7 @@ func Sethostname(p []byte) (err error) { } _, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(_p0), uintptr(len(p)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -894,7 +1014,7 @@ func Sethostname(p []byte) (err error) { func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -905,7 +1025,7 @@ func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -915,7 +1035,7 @@ func Setsid() (pid int, err error) { func Settimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -925,7 +1045,7 @@ func Settimeofday(tv *Timeval) (err error) { func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -953,7 +1073,29 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlink(oldpath string, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = e1 } return } @@ -970,7 +1112,7 @@ func Sync() { func Sysinfo(info *Sysinfo_t) (err error) { _, _, e1 := RawSyscall(SYS_SYSINFO, uintptr(unsafe.Pointer(info)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -981,7 +1123,7 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { r0, r1, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0) n = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -991,7 +1133,7 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) { _, _, e1 := RawSyscall(SYS_TGKILL, uintptr(tgid), uintptr(tid), uintptr(sig)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1002,7 +1144,7 @@ func Times(tms *Tms) (ticks uintptr, err error) { r0, _, e1 := RawSyscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0) ticks = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1020,7 +1162,39 @@ func Umask(mask int) (oldmask int) { func Uname(buf *Utsname) (err error) { _, _, e1 := RawSyscall(SYS_UNAME, uintptr(unsafe.Pointer(buf)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlink(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlinkat(dirfd int, path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -1036,7 +1210,7 @@ func Unmount(target string, flags int) (err error) { _, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1046,7 +1220,7 @@ func Unmount(target string, flags int) (err error) { func Unshare(flags int) (err error) { _, _, e1 := Syscall(SYS_UNSHARE, uintptr(flags), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1056,7 +1230,7 @@ func Unshare(flags int) (err error) { func Ustat(dev int, ubuf *Ustat_t) (err error) { _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1072,7 +1246,7 @@ func Utime(path string, buf *Utimbuf) (err error) { _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1089,7 +1263,7 @@ func write(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1099,7 +1273,7 @@ func write(fd int, p []byte) (n int, err error) { func exitThread(code int) (err error) { _, _, e1 := Syscall(SYS_EXIT, uintptr(code), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1110,7 +1284,7 @@ func readlen(fd int, p *byte, np int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1121,7 +1295,7 @@ func writelen(fd int, p *byte, np int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1131,7 +1305,7 @@ func writelen(fd int, p *byte, np int) (n int, err error) { func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1147,7 +1321,7 @@ func Madvise(b []byte, advice int) (err error) { } _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(advice)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1163,7 +1337,7 @@ func Mprotect(b []byte, prot int) (err error) { } _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1179,7 +1353,7 @@ func Mlock(b []byte) (err error) { } _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1195,7 +1369,7 @@ func Munlock(b []byte) (err error) { } _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1205,7 +1379,7 @@ func Munlock(b []byte) (err error) { func Mlockall(flags int) (err error) { _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1215,47 +1389,23 @@ func Mlockall(flags int) (err error) { func Munlockall() (err error) { _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) +func Chown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + _, _, e1 := Syscall(SYS_CHOWN32, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fadvise(fd int, offset int64, length int64, advice int) (err error) { - _, _, e1 := Syscall6(SYS_FADVISE64_64, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(length), uintptr(length>>32), uintptr(advice)) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1265,7 +1415,7 @@ func Fadvise(fd int, offset int64, length int64, advice int) (err error) { func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN32, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1275,7 +1425,7 @@ func Fchown(fd int, uid int, gid int) (err error) { func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1285,7 +1435,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall(SYS_FTRUNCATE64, uintptr(fd), uintptr(length), uintptr(length>>32)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1324,21 +1474,10 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1348,7 +1487,7 @@ func Ioperm(from int, num int, on int) (err error) { func Iopl(level int) (err error) { _, _, e1 := Syscall(SYS_IOPL, uintptr(level), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1364,7 +1503,7 @@ func Lchown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_LCHOWN32, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1380,7 +1519,7 @@ func Lstat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1397,7 +1536,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1414,7 +1553,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1425,7 +1564,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e r0, _, e1 := Syscall6(SYS_SENDFILE64, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) written = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1435,7 +1574,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e func Setfsgid(gid int) (err error) { _, _, e1 := Syscall(SYS_SETFSGID32, uintptr(gid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1445,7 +1584,7 @@ func Setfsgid(gid int) (err error) { func Setfsuid(uid int) (err error) { _, _, e1 := Syscall(SYS_SETFSUID32, uintptr(uid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1455,7 +1594,7 @@ func Setfsuid(uid int) (err error) { func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID32, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1465,7 +1604,7 @@ func Setregid(rgid int, egid int) (err error) { func Setresgid(rgid int, egid int, sgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESGID32, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1475,7 +1614,7 @@ func Setresgid(rgid int, egid int, sgid int) (err error) { func Setresuid(ruid int, euid int, suid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESUID32, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1485,7 +1624,7 @@ func Setresuid(ruid int, euid int, suid int) (err error) { func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID32, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1496,7 +1635,7 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1512,7 +1651,7 @@ func Stat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1522,7 +1661,7 @@ func Stat(path string, stat *Stat_t) (err error) { func SyncFileRange(fd int, off int64, n int64, flags int) (err error) { _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE, uintptr(fd), uintptr(off), uintptr(off>>32), uintptr(n), uintptr(n>>32), uintptr(flags)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1538,7 +1677,7 @@ func Truncate(path string, length int64) (err error) { _, _, e1 := Syscall(SYS_TRUNCATE64, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1549,7 +1688,7 @@ func getgroups(n int, list *_Gid_t) (nn int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS32, uintptr(n), uintptr(unsafe.Pointer(list)), 0) nn = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1559,7 +1698,7 @@ func getgroups(n int, list *_Gid_t) (nn int, err error) { func setgroups(n int, list *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS32, uintptr(n), uintptr(unsafe.Pointer(list)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1570,7 +1709,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err r0, _, e1 := Syscall6(SYS__NEWSELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1581,7 +1720,7 @@ func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset)) xaddr = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1591,7 +1730,7 @@ func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset func getrlimit(resource int, rlim *rlimit32) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1601,7 +1740,7 @@ func getrlimit(resource int, rlim *rlimit32) (err error) { func setrlimit(resource int, rlim *rlimit32) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1611,7 +1750,7 @@ func setrlimit(resource int, rlim *rlimit32) (err error) { func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1622,7 +1761,7 @@ func Time(t *Time_t) (tt Time_t, err error) { r0, _, e1 := RawSyscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0) tt = Time_t(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index c2438522d3..6c08e1c87d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -1,35 +1,23 @@ // mksyscall.pl syscall_linux.go syscall_linux_amd64.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build amd64,linux - package unix -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno +import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) { +func open(path string, mode int, perm uint32) (fd int, err error) { var _p0 *byte - _p0, err = BytePtrFromString(oldpath) + _p0, err = BytePtrFromString(path) if err != nil { return } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) + fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -46,68 +34,27 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - use(unsafe.Pointer(_p0)) - n = int(r0) +func pipe(p *[2]_C_int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -123,23 +70,23 @@ func utimes(path string, times *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { +func utimensat(dirfd int, path string, times *[2]Timespec) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) + _, _, e1 := Syscall(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -149,7 +96,7 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -166,7 +113,7 @@ func Getcwd(buf []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_GETCWD, uintptr(_p0), uintptr(len(buf)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -177,7 +124,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -187,7 +134,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -203,7 +150,7 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) { _, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -231,7 +178,23 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt use(unsafe.Pointer(_p1)) use(unsafe.Pointer(_p2)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Access(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -247,7 +210,7 @@ func Acct(path string) (err error) { _, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -258,7 +221,7 @@ func Adjtimex(buf *Timex) (state int, err error) { r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0) state = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -274,7 +237,23 @@ func Chdir(path string) (err error) { _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chmod(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -290,17 +269,7 @@ func Chroot(path string) (err error) { _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ClockGettime(clockid int32, time *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -310,7 +279,24 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Creat(path string, mode uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall(SYS_CREAT, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + use(unsafe.Pointer(_p0)) + fd = int(r0) + if e1 != 0 { + err = e1 } return } @@ -318,10 +304,20 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(oldfd int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) + r0, _, e1 := RawSyscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup2(oldfd int, newfd int) (err error) { + _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) + if e1 != 0 { + err = e1 } return } @@ -329,9 +325,9 @@ func Dup(oldfd int) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup3(oldfd int, newfd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags)) + _, _, e1 := RawSyscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -342,7 +338,7 @@ func EpollCreate(size int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -353,7 +349,7 @@ func EpollCreate1(flag int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -363,7 +359,7 @@ func EpollCreate1(flag int) (fd int, err error) { func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { _, _, e1 := RawSyscall6(SYS_EPOLL_CTL, uintptr(epfd), uintptr(op), uintptr(fd), uintptr(unsafe.Pointer(event)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -380,7 +376,7 @@ func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -403,7 +399,7 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -413,7 +409,7 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(len), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -423,7 +419,7 @@ func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -433,7 +429,7 @@ func Fchdir(fd int) (err error) { func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -449,7 +445,7 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -465,7 +461,7 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -476,7 +472,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -486,7 +482,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { func Fdatasync(fd int) (err error) { _, _, e1 := Syscall(SYS_FDATASYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -496,7 +492,7 @@ func Fdatasync(fd int) (err error) { func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -506,7 +502,7 @@ func Flock(fd int, how int) (err error) { func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -523,7 +519,7 @@ func Getdents(fd int, buf []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -534,13 +530,21 @@ func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Getpgrp() (pid int) { + r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) + pid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getpid() (pid int) { r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) @@ -561,7 +565,7 @@ func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -571,7 +575,7 @@ func Getpriority(which int, who int) (prio int, err error) { func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -608,7 +612,7 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) { use(unsafe.Pointer(_p1)) sz = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -625,7 +629,18 @@ func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err e use(unsafe.Pointer(_p0)) watchdesc = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func InotifyInit() (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) + fd = int(r0) + if e1 != 0 { + err = e1 } return } @@ -636,7 +651,7 @@ func InotifyInit1(flags int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT1, uintptr(flags), 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -647,7 +662,7 @@ func InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) { r0, _, e1 := RawSyscall(SYS_INOTIFY_RM_WATCH, uintptr(fd), uintptr(watchdesc), 0) success = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -657,7 +672,7 @@ func InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) { func Kill(pid int, sig syscall.Signal) (err error) { _, _, e1 := RawSyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -674,7 +689,29 @@ func Klogctl(typ int, buf []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Link(oldpath string, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = e1 } return } @@ -697,7 +734,23 @@ func Listxattr(path string, dest []byte) (sz int, err error) { use(unsafe.Pointer(_p0)) sz = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdir(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -713,7 +766,23 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mknod(path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -729,7 +798,7 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -739,7 +808,7 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -749,7 +818,7 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { func Pause() (err error) { _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -771,7 +840,7 @@ func PivotRoot(newroot string, putold string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -781,17 +850,7 @@ func PivotRoot(newroot string, putold string) (err error) { func prlimit(pid int, resource int, old *Rlimit, newlimit *Rlimit) (err error) { _, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(newlimit)), 0, 0) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -808,7 +867,30 @@ func read(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlink(path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + use(unsafe.Pointer(_p0)) + n = int(r0) + if e1 != 0 { + err = e1 } return } @@ -830,7 +912,29 @@ func Removexattr(path string, attr string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rename(oldpath string, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = e1 } return } @@ -852,7 +956,23 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rmdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -868,7 +988,7 @@ func Setdomainname(p []byte) (err error) { } _, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(_p0), uintptr(len(p)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -884,7 +1004,7 @@ func Sethostname(p []byte) (err error) { } _, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(_p0), uintptr(len(p)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -894,7 +1014,7 @@ func Sethostname(p []byte) (err error) { func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -905,7 +1025,7 @@ func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -915,7 +1035,7 @@ func Setsid() (pid int, err error) { func Settimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -925,7 +1045,7 @@ func Settimeofday(tv *Timeval) (err error) { func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -953,7 +1073,29 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlink(oldpath string, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = e1 } return } @@ -970,7 +1112,7 @@ func Sync() { func Sysinfo(info *Sysinfo_t) (err error) { _, _, e1 := RawSyscall(SYS_SYSINFO, uintptr(unsafe.Pointer(info)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -981,7 +1123,7 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { r0, _, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0) n = int64(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -991,7 +1133,7 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) { _, _, e1 := RawSyscall(SYS_TGKILL, uintptr(tgid), uintptr(tid), uintptr(sig)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1002,7 +1144,7 @@ func Times(tms *Tms) (ticks uintptr, err error) { r0, _, e1 := RawSyscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0) ticks = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1020,7 +1162,39 @@ func Umask(mask int) (oldmask int) { func Uname(buf *Utsname) (err error) { _, _, e1 := RawSyscall(SYS_UNAME, uintptr(unsafe.Pointer(buf)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlink(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlinkat(dirfd int, path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -1036,7 +1210,7 @@ func Unmount(target string, flags int) (err error) { _, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1046,7 +1220,7 @@ func Unmount(target string, flags int) (err error) { func Unshare(flags int) (err error) { _, _, e1 := Syscall(SYS_UNSHARE, uintptr(flags), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1056,7 +1230,7 @@ func Unshare(flags int) (err error) { func Ustat(dev int, ubuf *Ustat_t) (err error) { _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1072,7 +1246,7 @@ func Utime(path string, buf *Utimbuf) (err error) { _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1089,7 +1263,7 @@ func write(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1099,7 +1273,7 @@ func write(fd int, p []byte) (n int, err error) { func exitThread(code int) (err error) { _, _, e1 := Syscall(SYS_EXIT, uintptr(code), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1110,7 +1284,7 @@ func readlen(fd int, p *byte, np int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1121,7 +1295,7 @@ func writelen(fd int, p *byte, np int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1131,7 +1305,7 @@ func writelen(fd int, p *byte, np int) (n int, err error) { func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1147,7 +1321,7 @@ func Madvise(b []byte, advice int) (err error) { } _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(advice)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1163,7 +1337,7 @@ func Mprotect(b []byte, prot int) (err error) { } _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1179,7 +1353,7 @@ func Mlock(b []byte) (err error) { } _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1195,7 +1369,7 @@ func Munlock(b []byte) (err error) { } _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1205,7 +1379,7 @@ func Munlock(b []byte) (err error) { func Mlockall(flags int) (err error) { _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1215,27 +1389,23 @@ func Mlockall(flags int) (err error) { func Munlockall() (err error) { _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) +func Chown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fadvise(fd int, offset int64, length int64, advice int) (err error) { - _, _, e1 := Syscall6(SYS_FADVISE64, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0) + _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1245,7 +1415,7 @@ func Fadvise(fd int, offset int64, length int64, advice int) (err error) { func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1255,7 +1425,7 @@ func Fchown(fd int, uid int, gid int) (err error) { func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1265,7 +1435,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { func Fstatfs(fd int, buf *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(buf)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1275,7 +1445,7 @@ func Fstatfs(fd int, buf *Statfs_t) (err error) { func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1309,7 +1479,7 @@ func Getgid() (gid int) { func Getrlimit(resource int, rlim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1324,21 +1494,10 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1348,7 +1507,7 @@ func Ioperm(from int, num int, on int) (err error) { func Iopl(level int) (err error) { _, _, e1 := Syscall(SYS_IOPL, uintptr(level), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1364,7 +1523,7 @@ func Lchown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1374,7 +1533,7 @@ func Lchown(path string, uid int, gid int) (err error) { func Listen(s int, n int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1390,7 +1549,7 @@ func Lstat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1407,7 +1566,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1424,7 +1583,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1435,7 +1594,7 @@ func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1446,7 +1605,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1457,7 +1616,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e r0, _, e1 := Syscall6(SYS_SENDFILE, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) written = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1467,7 +1626,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e func Setfsgid(gid int) (err error) { _, _, e1 := Syscall(SYS_SETFSGID, uintptr(gid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1477,7 +1636,7 @@ func Setfsgid(gid int) (err error) { func Setfsuid(uid int) (err error) { _, _, e1 := Syscall(SYS_SETFSUID, uintptr(uid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1487,7 +1646,7 @@ func Setfsuid(uid int) (err error) { func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1497,7 +1656,7 @@ func Setregid(rgid int, egid int) (err error) { func Setresgid(rgid int, egid int, sgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1507,7 +1666,7 @@ func Setresgid(rgid int, egid int, sgid int) (err error) { func Setresuid(ruid int, euid int, suid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1517,7 +1676,7 @@ func Setresuid(ruid int, euid int, suid int) (err error) { func Setrlimit(resource int, rlim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1527,7 +1686,7 @@ func Setrlimit(resource int, rlim *Rlimit) (err error) { func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1537,7 +1696,7 @@ func Setreuid(ruid int, euid int) (err error) { func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1548,7 +1707,7 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) n = int64(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1564,7 +1723,7 @@ func Stat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1580,7 +1739,7 @@ func Statfs(path string, buf *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1590,7 +1749,7 @@ func Statfs(path string, buf *Statfs_t) (err error) { func SyncFileRange(fd int, off int64, n int64, flags int) (err error) { _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE, uintptr(fd), uintptr(off), uintptr(n), uintptr(flags), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1606,7 +1765,7 @@ func Truncate(path string, length int64) (err error) { _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1617,7 +1776,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1628,7 +1787,7 @@ func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1638,7 +1797,7 @@ func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1648,7 +1807,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1659,7 +1818,7 @@ func getgroups(n int, list *_Gid_t) (nn int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) nn = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1669,7 +1828,7 @@ func getgroups(n int, list *_Gid_t) (nn int, err error) { func setgroups(n int, list *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1679,7 +1838,7 @@ func setgroups(n int, list *_Gid_t) (err error) { func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1689,7 +1848,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1700,7 +1859,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1710,7 +1869,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1720,7 +1879,7 @@ func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1730,7 +1889,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1747,7 +1906,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1763,7 +1922,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1774,7 +1933,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1785,7 +1944,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1796,27 +1955,7 @@ func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int6 r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)) xaddr = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go index dd66c97587..60d8b4ba1c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go @@ -1,35 +1,23 @@ // mksyscall.pl -l32 -arm syscall_linux.go syscall_linux_arm.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build arm,linux - package unix -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno +import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) { +func open(path string, mode int, perm uint32) (fd int, err error) { var _p0 *byte - _p0, err = BytePtrFromString(oldpath) + _p0, err = BytePtrFromString(path) if err != nil { return } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) + fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -46,68 +34,27 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - use(unsafe.Pointer(_p0)) - n = int(r0) +func pipe(p *[2]_C_int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -123,23 +70,23 @@ func utimes(path string, times *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { +func utimensat(dirfd int, path string, times *[2]Timespec) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) + _, _, e1 := Syscall(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -149,7 +96,7 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -166,7 +113,7 @@ func Getcwd(buf []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_GETCWD, uintptr(_p0), uintptr(len(buf)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -177,7 +124,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -187,7 +134,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -203,7 +150,7 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) { _, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -231,7 +178,23 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt use(unsafe.Pointer(_p1)) use(unsafe.Pointer(_p2)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Access(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -247,7 +210,7 @@ func Acct(path string) (err error) { _, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -258,7 +221,7 @@ func Adjtimex(buf *Timex) (state int, err error) { r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0) state = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -274,7 +237,23 @@ func Chdir(path string) (err error) { _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chmod(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -290,17 +269,7 @@ func Chroot(path string) (err error) { _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ClockGettime(clockid int32, time *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -310,7 +279,24 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Creat(path string, mode uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall(SYS_CREAT, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + use(unsafe.Pointer(_p0)) + fd = int(r0) + if e1 != 0 { + err = e1 } return } @@ -318,10 +304,20 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(oldfd int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) + r0, _, e1 := RawSyscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup2(oldfd int, newfd int) (err error) { + _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) + if e1 != 0 { + err = e1 } return } @@ -329,9 +325,9 @@ func Dup(oldfd int) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup3(oldfd int, newfd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags)) + _, _, e1 := RawSyscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -342,7 +338,7 @@ func EpollCreate(size int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -353,7 +349,7 @@ func EpollCreate1(flag int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -363,7 +359,7 @@ func EpollCreate1(flag int) (fd int, err error) { func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { _, _, e1 := RawSyscall6(SYS_EPOLL_CTL, uintptr(epfd), uintptr(op), uintptr(fd), uintptr(unsafe.Pointer(event)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -380,7 +376,7 @@ func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -403,7 +399,7 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -413,7 +409,7 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(off>>32), uintptr(len), uintptr(len>>32)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -423,7 +419,7 @@ func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -433,7 +429,7 @@ func Fchdir(fd int) (err error) { func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -449,7 +445,7 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -465,7 +461,7 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -476,7 +472,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -486,7 +482,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { func Fdatasync(fd int) (err error) { _, _, e1 := Syscall(SYS_FDATASYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -496,7 +492,7 @@ func Fdatasync(fd int) (err error) { func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -506,7 +502,7 @@ func Flock(fd int, how int) (err error) { func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -523,7 +519,7 @@ func Getdents(fd int, buf []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -534,13 +530,21 @@ func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Getpgrp() (pid int) { + r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) + pid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getpid() (pid int) { r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) @@ -561,7 +565,7 @@ func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -571,7 +575,7 @@ func Getpriority(which int, who int) (prio int, err error) { func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -608,7 +612,7 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) { use(unsafe.Pointer(_p1)) sz = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -625,7 +629,18 @@ func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err e use(unsafe.Pointer(_p0)) watchdesc = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func InotifyInit() (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) + fd = int(r0) + if e1 != 0 { + err = e1 } return } @@ -636,7 +651,7 @@ func InotifyInit1(flags int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT1, uintptr(flags), 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -647,7 +662,7 @@ func InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) { r0, _, e1 := RawSyscall(SYS_INOTIFY_RM_WATCH, uintptr(fd), uintptr(watchdesc), 0) success = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -657,7 +672,7 @@ func InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) { func Kill(pid int, sig syscall.Signal) (err error) { _, _, e1 := RawSyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -674,7 +689,29 @@ func Klogctl(typ int, buf []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Link(oldpath string, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = e1 } return } @@ -697,7 +734,23 @@ func Listxattr(path string, dest []byte) (sz int, err error) { use(unsafe.Pointer(_p0)) sz = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdir(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -713,7 +766,23 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mknod(path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -729,7 +798,7 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -739,7 +808,7 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -749,7 +818,7 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { func Pause() (err error) { _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -771,7 +840,7 @@ func PivotRoot(newroot string, putold string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -781,17 +850,7 @@ func PivotRoot(newroot string, putold string) (err error) { func prlimit(pid int, resource int, old *Rlimit, newlimit *Rlimit) (err error) { _, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(newlimit)), 0, 0) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -808,7 +867,30 @@ func read(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlink(path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + use(unsafe.Pointer(_p0)) + n = int(r0) + if e1 != 0 { + err = e1 } return } @@ -830,7 +912,29 @@ func Removexattr(path string, attr string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rename(oldpath string, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = e1 } return } @@ -852,7 +956,23 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rmdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -868,7 +988,7 @@ func Setdomainname(p []byte) (err error) { } _, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(_p0), uintptr(len(p)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -884,7 +1004,7 @@ func Sethostname(p []byte) (err error) { } _, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(_p0), uintptr(len(p)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -894,7 +1014,7 @@ func Sethostname(p []byte) (err error) { func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -905,7 +1025,7 @@ func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -915,7 +1035,7 @@ func Setsid() (pid int, err error) { func Settimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -925,7 +1045,7 @@ func Settimeofday(tv *Timeval) (err error) { func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -953,7 +1073,29 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlink(oldpath string, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = e1 } return } @@ -970,7 +1112,7 @@ func Sync() { func Sysinfo(info *Sysinfo_t) (err error) { _, _, e1 := RawSyscall(SYS_SYSINFO, uintptr(unsafe.Pointer(info)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -981,7 +1123,7 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { r0, r1, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0) n = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -991,7 +1133,7 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) { _, _, e1 := RawSyscall(SYS_TGKILL, uintptr(tgid), uintptr(tid), uintptr(sig)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1002,7 +1144,7 @@ func Times(tms *Tms) (ticks uintptr, err error) { r0, _, e1 := RawSyscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0) ticks = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1020,7 +1162,39 @@ func Umask(mask int) (oldmask int) { func Uname(buf *Utsname) (err error) { _, _, e1 := RawSyscall(SYS_UNAME, uintptr(unsafe.Pointer(buf)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlink(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlinkat(dirfd int, path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = e1 } return } @@ -1036,7 +1210,7 @@ func Unmount(target string, flags int) (err error) { _, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1046,7 +1220,7 @@ func Unmount(target string, flags int) (err error) { func Unshare(flags int) (err error) { _, _, e1 := Syscall(SYS_UNSHARE, uintptr(flags), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1056,7 +1230,7 @@ func Unshare(flags int) (err error) { func Ustat(dev int, ubuf *Ustat_t) (err error) { _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1072,7 +1246,7 @@ func Utime(path string, buf *Utimbuf) (err error) { _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1089,7 +1263,7 @@ func write(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1099,7 +1273,7 @@ func write(fd int, p []byte) (n int, err error) { func exitThread(code int) (err error) { _, _, e1 := Syscall(SYS_EXIT, uintptr(code), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1110,7 +1284,7 @@ func readlen(fd int, p *byte, np int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1121,7 +1295,7 @@ func writelen(fd int, p *byte, np int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1131,7 +1305,7 @@ func writelen(fd int, p *byte, np int) (n int, err error) { func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1147,7 +1321,7 @@ func Madvise(b []byte, advice int) (err error) { } _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(advice)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1163,7 +1337,7 @@ func Mprotect(b []byte, prot int) (err error) { } _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1179,7 +1353,7 @@ func Mlock(b []byte) (err error) { } _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1195,7 +1369,7 @@ func Munlock(b []byte) (err error) { } _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1205,7 +1379,7 @@ func Munlock(b []byte) (err error) { func Mlockall(flags int) (err error) { _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1215,17 +1389,7 @@ func Mlockall(flags int) (err error) { func Munlockall() (err error) { _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1236,7 +1400,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1247,7 +1411,7 @@ func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1257,7 +1421,7 @@ func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1267,7 +1431,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1278,7 +1442,7 @@ func getgroups(n int, list *_Gid_t) (nn int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS32, uintptr(n), uintptr(unsafe.Pointer(list)), 0) nn = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1288,7 +1452,7 @@ func getgroups(n int, list *_Gid_t) (nn int, err error) { func setgroups(n int, list *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS32, uintptr(n), uintptr(unsafe.Pointer(list)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1298,7 +1462,7 @@ func setgroups(n int, list *_Gid_t) (err error) { func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1308,7 +1472,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1319,7 +1483,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1329,7 +1493,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1339,7 +1503,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1356,7 +1520,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1372,7 +1536,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1382,7 +1546,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( func socketpair(domain int, typ int, flags int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1393,7 +1557,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1404,17 +1568,23 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) +func Chown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHOWN32, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1424,7 +1594,7 @@ func Dup2(oldfd int, newfd int) (err error) { func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN32, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1434,7 +1604,7 @@ func Fchown(fd int, uid int, gid int) (err error) { func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1473,17 +1643,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1493,7 +1652,7 @@ func Lchown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_LCHOWN32, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1503,7 +1662,7 @@ func Lchown(path string, uid int, gid int) (err error) { func Listen(s int, n int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1519,7 +1678,7 @@ func Lstat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1530,7 +1689,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e r0, _, e1 := Syscall6(SYS_SENDFILE64, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) written = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1541,7 +1700,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err r0, _, e1 := Syscall6(SYS__NEWSELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1551,7 +1710,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err func Setfsgid(gid int) (err error) { _, _, e1 := Syscall(SYS_SETFSGID32, uintptr(gid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1561,7 +1720,7 @@ func Setfsgid(gid int) (err error) { func Setfsuid(uid int) (err error) { _, _, e1 := Syscall(SYS_SETFSUID32, uintptr(uid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1571,7 +1730,7 @@ func Setfsuid(uid int) (err error) { func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID32, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1581,7 +1740,7 @@ func Setregid(rgid int, egid int) (err error) { func Setresgid(rgid int, egid int, sgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESGID32, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1591,7 +1750,7 @@ func Setresgid(rgid int, egid int, sgid int) (err error) { func Setresuid(ruid int, euid int, suid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESUID32, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1601,7 +1760,7 @@ func Setresuid(ruid int, euid int, suid int) (err error) { func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID32, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1611,7 +1770,7 @@ func Setreuid(ruid int, euid int) (err error) { func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1622,7 +1781,7 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1638,7 +1797,7 @@ func Stat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1648,7 +1807,7 @@ func Stat(path string, stat *Stat_t) (err error) { func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1659,7 +1818,7 @@ func Time(t *Time_t) (tt Time_t, err error) { r0, _, e1 := RawSyscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0) tt = Time_t(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1676,7 +1835,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1693,7 +1852,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1709,7 +1868,7 @@ func Truncate(path string, length int64) (err error) { _, _, e1 := Syscall6(SYS_TRUNCATE64, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1719,7 +1878,7 @@ func Truncate(path string, length int64) (err error) { func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall6(SYS_FTRUNCATE64, uintptr(fd), 0, uintptr(length), uintptr(length>>32), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1730,7 +1889,7 @@ func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset)) xaddr = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1740,7 +1899,7 @@ func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset func getrlimit(resource int, rlim *rlimit32) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1750,7 +1909,7 @@ func getrlimit(resource int, rlim *rlimit32) (err error) { func setrlimit(resource int, rlim *rlimit32) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go deleted file mode 100644 index d0a6ed8292..0000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go +++ /dev/null @@ -1,1750 +0,0 @@ -// mksyscall.pl syscall_linux.go syscall_linux_arm64.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -// +build arm64,linux - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0) - use(unsafe.Pointer(_p0)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - use(unsafe.Pointer(_p0)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, times *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getcwd(buf []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_GETCWD, uintptr(_p0), uintptr(len(buf)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(arg) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mount(source string, target string, fstype string, flags uintptr, data *byte) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(source) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(target) - if err != nil { - return - } - var _p2 *byte - _p2, err = BytePtrFromString(fstype) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - use(unsafe.Pointer(_p2)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Acct(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtimex(buf *Timex) (state int, err error) { - r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0) - state = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ClockGettime(clockid int32, time *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(oldfd int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup3(oldfd int, newfd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate1(flag int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { - _, _, e1 := RawSyscall6(SYS_EPOLL_CTL, uintptr(epfd), uintptr(op), uintptr(fd), uintptr(unsafe.Pointer(event)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { - var _p0 unsafe.Pointer - if len(events) > 0 { - _p0 = unsafe.Pointer(&events[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT_GROUP, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { - _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(len), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fdatasync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FDATASYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdents(fd int, buf []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(_p0), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettid() (tid int) { - r0, _, _ := RawSyscall(SYS_GETTID, 0, 0, 0) - tid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(pathname) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask)) - use(unsafe.Pointer(_p0)) - watchdesc = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func InotifyInit1(flags int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT1, uintptr(flags), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_RM_WATCH, uintptr(fd), uintptr(watchdesc), 0) - success = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kill(pid int, sig syscall.Signal) (err error) { - _, _, e1 := RawSyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Klogctl(typ int, buf []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(_p0), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Nanosleep(time *Timespec, leftover *Timespec) (err error) { - _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pause() (err error) { - _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func PivotRoot(newroot string, putold string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(newroot) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(putold) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func prlimit(pid int, resource int, old *Rlimit, newlimit *Rlimit) (err error) { - _, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(newlimit)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Removexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setdomainname(p []byte) (err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(_p0), uintptr(len(p)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sethostname(p []byte) (err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(_p0), uintptr(len(p)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() { - Syscall(SYS_SYNC, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sysinfo(info *Sysinfo_t) (err error) { - _, _, e1 := RawSyscall(SYS_SYSINFO, uintptr(unsafe.Pointer(info)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { - r0, _, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0) - n = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) { - _, _, e1 := RawSyscall(SYS_TGKILL, uintptr(tgid), uintptr(tid), uintptr(sig)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Times(tms *Tms) (ticks uintptr, err error) { - r0, _, e1 := RawSyscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0) - ticks = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(mask int) (oldmask int) { - r0, _, _ := RawSyscall(SYS_UMASK, uintptr(mask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Uname(buf *Utsname) (err error) { - _, _, e1 := RawSyscall(SYS_UNAME, uintptr(unsafe.Pointer(buf)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(target string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(target) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unshare(flags int) (err error) { - _, _, e1 := Syscall(SYS_UNSHARE, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ustat(dev int, ubuf *Ustat_t) (err error) { - _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Utime(path string, buf *Utimbuf) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func exitThread(code int) (err error) { - _, _, e1 := Syscall(SYS_EXIT, uintptr(code), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, p *byte, np int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, p *byte, np int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, advice int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(advice)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, buf *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(buf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (euid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - euid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, n int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (off int64, err error) { - r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) - off = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - r0, _, e1 := Syscall6(SYS_SENDFILE, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) - written = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setfsgid(gid int) (err error) { - _, _, e1 := Syscall(SYS_SETFSGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setfsuid(uid int) (err error) { - _, _, e1 := Syscall(SYS_SETFSUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) { - r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) - n = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, buf *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func SyncFileRange(fd int, off int64, n int64, flags int) (err error) { - _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE, uintptr(fd), uintptr(off), uintptr(n), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) { - r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(n int, list *_Gid_t) (nn int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) - nn = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(n int, list *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { - r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)) - xaddr = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Time(t *Time_t) (tt Time_t, err error) { - r0, _, e1 := RawSyscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0) - tt = Time_t(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go deleted file mode 100644 index f58a3ff2f9..0000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ /dev/null @@ -1,1792 +0,0 @@ -// mksyscall.pl syscall_linux.go syscall_linux_ppc64x.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -// +build ppc64,linux - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0) - use(unsafe.Pointer(_p0)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - use(unsafe.Pointer(_p0)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, times *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getcwd(buf []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_GETCWD, uintptr(_p0), uintptr(len(buf)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(arg) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mount(source string, target string, fstype string, flags uintptr, data *byte) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(source) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(target) - if err != nil { - return - } - var _p2 *byte - _p2, err = BytePtrFromString(fstype) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - use(unsafe.Pointer(_p2)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Acct(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtimex(buf *Timex) (state int, err error) { - r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0) - state = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ClockGettime(clockid int32, time *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(oldfd int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup3(oldfd int, newfd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate1(flag int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { - _, _, e1 := RawSyscall6(SYS_EPOLL_CTL, uintptr(epfd), uintptr(op), uintptr(fd), uintptr(unsafe.Pointer(event)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { - var _p0 unsafe.Pointer - if len(events) > 0 { - _p0 = unsafe.Pointer(&events[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT_GROUP, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { - _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(len), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fdatasync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FDATASYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdents(fd int, buf []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(_p0), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettid() (tid int) { - r0, _, _ := RawSyscall(SYS_GETTID, 0, 0, 0) - tid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(pathname) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask)) - use(unsafe.Pointer(_p0)) - watchdesc = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func InotifyInit1(flags int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT1, uintptr(flags), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_RM_WATCH, uintptr(fd), uintptr(watchdesc), 0) - success = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kill(pid int, sig syscall.Signal) (err error) { - _, _, e1 := RawSyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Klogctl(typ int, buf []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(_p0), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Nanosleep(time *Timespec, leftover *Timespec) (err error) { - _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pause() (err error) { - _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func PivotRoot(newroot string, putold string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(newroot) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(putold) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func prlimit(pid int, resource int, old *Rlimit, newlimit *Rlimit) (err error) { - _, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(newlimit)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Removexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setdomainname(p []byte) (err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(_p0), uintptr(len(p)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sethostname(p []byte) (err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(_p0), uintptr(len(p)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() { - Syscall(SYS_SYNC, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sysinfo(info *Sysinfo_t) (err error) { - _, _, e1 := RawSyscall(SYS_SYSINFO, uintptr(unsafe.Pointer(info)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { - r0, _, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0) - n = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) { - _, _, e1 := RawSyscall(SYS_TGKILL, uintptr(tgid), uintptr(tid), uintptr(sig)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Times(tms *Tms) (ticks uintptr, err error) { - r0, _, e1 := RawSyscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0) - ticks = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(mask int) (oldmask int) { - r0, _, _ := RawSyscall(SYS_UMASK, uintptr(mask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Uname(buf *Utsname) (err error) { - _, _, e1 := RawSyscall(SYS_UNAME, uintptr(unsafe.Pointer(buf)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(target string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(target) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unshare(flags int) (err error) { - _, _, e1 := Syscall(SYS_UNSHARE, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ustat(dev int, ubuf *Ustat_t) (err error) { - _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Utime(path string, buf *Utimbuf) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func exitThread(code int) (err error) { - _, _, e1 := Syscall(SYS_EXIT, uintptr(code), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, p *byte, np int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, p *byte, np int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, advice int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(advice)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, buf *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(buf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (euid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - euid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_UGETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ioperm(from int, num int, on int) (err error) { - _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Iopl(level int) (err error) { - _, _, e1 := Syscall(SYS_IOPL, uintptr(level), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, n int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (off int64, err error) { - r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) - off = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - r0, _, e1 := Syscall6(SYS_SENDFILE, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) - written = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setfsgid(gid int) (err error) { - _, _, e1 := Syscall(SYS_SETFSGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setfsuid(uid int) (err error) { - _, _, e1 := Syscall(SYS_SETFSUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) { - r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) - n = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, buf *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func SyncFileRange(fd int, off int64, n int64, flags int) (err error) { - _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(off), uintptr(n), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) { - r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(n int, list *_Gid_t) (nn int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) - nn = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(n int, list *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { - r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)) - xaddr = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Time(t *Time_t) (tt Time_t, err error) { - r0, _, e1 := RawSyscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0) - tt = Time_t(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go deleted file mode 100644 index 22fc7a4572..0000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ /dev/null @@ -1,1792 +0,0 @@ -// mksyscall.pl syscall_linux.go syscall_linux_ppc64x.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -// +build ppc64le,linux - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0) - use(unsafe.Pointer(_p0)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - use(unsafe.Pointer(_p0)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, times *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getcwd(buf []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_GETCWD, uintptr(_p0), uintptr(len(buf)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(arg) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mount(source string, target string, fstype string, flags uintptr, data *byte) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(source) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(target) - if err != nil { - return - } - var _p2 *byte - _p2, err = BytePtrFromString(fstype) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - use(unsafe.Pointer(_p2)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Acct(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtimex(buf *Timex) (state int, err error) { - r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0) - state = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ClockGettime(clockid int32, time *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(oldfd int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup3(oldfd int, newfd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate1(flag int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { - _, _, e1 := RawSyscall6(SYS_EPOLL_CTL, uintptr(epfd), uintptr(op), uintptr(fd), uintptr(unsafe.Pointer(event)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { - var _p0 unsafe.Pointer - if len(events) > 0 { - _p0 = unsafe.Pointer(&events[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT_GROUP, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { - _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(len), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fdatasync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FDATASYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdents(fd int, buf []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(_p0), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettid() (tid int) { - r0, _, _ := RawSyscall(SYS_GETTID, 0, 0, 0) - tid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(pathname) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask)) - use(unsafe.Pointer(_p0)) - watchdesc = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func InotifyInit1(flags int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT1, uintptr(flags), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_RM_WATCH, uintptr(fd), uintptr(watchdesc), 0) - success = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kill(pid int, sig syscall.Signal) (err error) { - _, _, e1 := RawSyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Klogctl(typ int, buf []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(_p0), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Nanosleep(time *Timespec, leftover *Timespec) (err error) { - _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pause() (err error) { - _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func PivotRoot(newroot string, putold string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(newroot) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(putold) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func prlimit(pid int, resource int, old *Rlimit, newlimit *Rlimit) (err error) { - _, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(newlimit)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Removexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setdomainname(p []byte) (err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(_p0), uintptr(len(p)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sethostname(p []byte) (err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(_p0), uintptr(len(p)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() { - Syscall(SYS_SYNC, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sysinfo(info *Sysinfo_t) (err error) { - _, _, e1 := RawSyscall(SYS_SYSINFO, uintptr(unsafe.Pointer(info)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { - r0, _, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0) - n = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) { - _, _, e1 := RawSyscall(SYS_TGKILL, uintptr(tgid), uintptr(tid), uintptr(sig)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Times(tms *Tms) (ticks uintptr, err error) { - r0, _, e1 := RawSyscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0) - ticks = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(mask int) (oldmask int) { - r0, _, _ := RawSyscall(SYS_UMASK, uintptr(mask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Uname(buf *Utsname) (err error) { - _, _, e1 := RawSyscall(SYS_UNAME, uintptr(unsafe.Pointer(buf)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(target string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(target) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unshare(flags int) (err error) { - _, _, e1 := Syscall(SYS_UNSHARE, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ustat(dev int, ubuf *Ustat_t) (err error) { - _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Utime(path string, buf *Utimbuf) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func exitThread(code int) (err error) { - _, _, e1 := Syscall(SYS_EXIT, uintptr(code), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, p *byte, np int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, p *byte, np int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, advice int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(advice)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, buf *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(buf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (euid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - euid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_UGETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ioperm(from int, num int, on int) (err error) { - _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Iopl(level int) (err error) { - _, _, e1 := Syscall(SYS_IOPL, uintptr(level), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, n int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (off int64, err error) { - r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) - off = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - r0, _, e1 := Syscall6(SYS_SENDFILE, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) - written = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setfsgid(gid int) (err error) { - _, _, e1 := Syscall(SYS_SETFSGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setfsuid(uid int) (err error) { - _, _, e1 := Syscall(SYS_SETFSUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) { - r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) - n = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, buf *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func SyncFileRange(fd int, off int64, n int64, flags int) (err error) { - _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(off), uintptr(n), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) { - r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(n int, list *_Gid_t) (nn int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) - nn = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(n int, list *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { - r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)) - xaddr = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Time(t *Time_t) (tt Time_t, err error) { - r0, _, e1 := RawSyscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0) - tt = Time_t(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go index 00ca1f9c11..6ea1412e48 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go @@ -1,16 +1,9 @@ // mksyscall.pl -l32 -netbsd syscall_bsd.go syscall_netbsd.go syscall_netbsd_386.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build 386,netbsd - package unix -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno +import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -18,7 +11,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -28,7 +21,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -39,7 +32,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -50,7 +43,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -60,7 +53,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -70,7 +63,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -81,7 +74,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -91,7 +84,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -101,7 +94,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -111,7 +104,7 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -121,7 +114,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -131,7 +124,7 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func Shutdown(s int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -141,7 +134,7 @@ func Shutdown(s int, how int) (err error) { func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -158,7 +151,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -174,7 +167,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -185,7 +178,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -196,7 +189,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -207,7 +200,7 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -223,7 +216,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -239,7 +232,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -249,7 +242,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { func futimes(fd int, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -260,7 +253,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -272,7 +265,7 @@ func pipe() (fd1 int, fd2 int, err error) { fd1 = int(r0) fd2 = int(r1) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -289,7 +282,7 @@ func getdents(fd int, buf []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -305,7 +298,7 @@ func Access(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -315,7 +308,7 @@ func Access(path string, mode uint32) (err error) { func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -331,7 +324,7 @@ func Chdir(path string) (err error) { _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -347,7 +340,7 @@ func Chflags(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -363,7 +356,7 @@ func Chmod(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -379,7 +372,7 @@ func Chown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -395,7 +388,7 @@ func Chroot(path string) (err error) { _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -405,7 +398,7 @@ func Chroot(path string) (err error) { func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -413,10 +406,10 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := RawSyscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -424,9 +417,9 @@ func Dup(fd int) (nfd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := RawSyscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -443,7 +436,7 @@ func Exit(code int) { func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -453,7 +446,7 @@ func Fchdir(fd int) (err error) { func Fchflags(fd int, flags int) (err error) { _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -463,7 +456,7 @@ func Fchflags(fd int, flags int) (err error) { func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -473,7 +466,7 @@ func Fchmod(fd int, mode uint32) (err error) { func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -483,7 +476,7 @@ func Fchown(fd int, uid int, gid int) (err error) { func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -494,7 +487,7 @@ func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -504,7 +497,7 @@ func Fpathconf(fd int, name int) (val int, err error) { func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -514,7 +507,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -524,7 +517,7 @@ func Fsync(fd int) (err error) { func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall6(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length), uintptr(length>>32), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -559,7 +552,7 @@ func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -594,7 +587,7 @@ func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -604,7 +597,7 @@ func Getpriority(which int, who int) (prio int, err error) { func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -614,7 +607,7 @@ func Getrlimit(which int, lim *Rlimit) (err error) { func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -625,7 +618,7 @@ func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -635,7 +628,7 @@ func Getsid(pid int) (sid int, err error) { func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -661,7 +654,7 @@ func Issetugid() (tainted bool) { func Kill(pid int, signum syscall.Signal) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -672,7 +665,7 @@ func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -688,7 +681,7 @@ func Lchown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -710,7 +703,7 @@ func Link(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -720,7 +713,7 @@ func Link(path string, link string) (err error) { func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -736,7 +729,7 @@ func Lstat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -752,7 +745,7 @@ func Mkdir(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -768,7 +761,7 @@ func Mkfifo(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -784,75 +777,7 @@ func Mknod(path string, mode uint32, dev int) (err error) { _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -862,7 +787,7 @@ func Munlockall() (err error) { func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -879,7 +804,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -896,7 +821,7 @@ func Pathconf(path string, name int) (val int, err error) { use(unsafe.Pointer(_p0)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -913,7 +838,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -930,7 +855,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -947,7 +872,7 @@ func read(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -970,7 +895,7 @@ func Readlink(path string, buf []byte) (n int, err error) { use(unsafe.Pointer(_p0)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -992,7 +917,7 @@ func Rename(from string, to string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1008,7 +933,7 @@ func Revoke(path string) (err error) { _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1024,7 +949,7 @@ func Rmdir(path string) (err error) { _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1035,7 +960,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), uintptr(whence), 0) newoffset = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1045,7 +970,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1055,7 +980,7 @@ func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { func Setegid(egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1065,7 +990,7 @@ func Setegid(egid int) (err error) { func Seteuid(euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1075,7 +1000,7 @@ func Seteuid(euid int) (err error) { func Setgid(gid int) (err error) { _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1085,7 +1010,7 @@ func Setgid(gid int) (err error) { func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1095,7 +1020,7 @@ func Setpgid(pid int, pgid int) (err error) { func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1105,7 +1030,7 @@ func Setpriority(which int, who int, prio int) (err error) { func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1115,7 +1040,7 @@ func Setregid(rgid int, egid int) (err error) { func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1125,7 +1050,7 @@ func Setreuid(ruid int, euid int) (err error) { func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1136,7 +1061,7 @@ func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1146,7 +1071,7 @@ func Setsid() (pid int, err error) { func Settimeofday(tp *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1156,7 +1081,7 @@ func Settimeofday(tp *Timeval) (err error) { func Setuid(uid int) (err error) { _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1172,7 +1097,7 @@ func Stat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1194,7 +1119,7 @@ func Symlink(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1204,7 +1129,7 @@ func Symlink(path string, link string) (err error) { func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1220,7 +1145,7 @@ func Truncate(path string, length int64) (err error) { _, _, e1 := Syscall6(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1244,7 +1169,7 @@ func Unlink(path string) (err error) { _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1260,7 +1185,7 @@ func Unmount(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1277,7 +1202,7 @@ func write(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1288,7 +1213,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), uintptr(pos>>32), 0) ret = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1298,7 +1223,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1309,7 +1234,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1320,7 +1245,7 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go index 03f31b973d..320d76e33b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go @@ -1,16 +1,9 @@ // mksyscall.pl -netbsd syscall_bsd.go syscall_netbsd.go syscall_netbsd_amd64.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build amd64,netbsd - package unix -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno +import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -18,7 +11,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -28,7 +21,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -39,7 +32,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -50,7 +43,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -60,7 +53,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -70,7 +63,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -81,7 +74,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -91,7 +84,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -101,7 +94,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -111,7 +104,7 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -121,7 +114,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -131,7 +124,7 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func Shutdown(s int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -141,7 +134,7 @@ func Shutdown(s int, how int) (err error) { func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -158,7 +151,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -174,7 +167,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -185,7 +178,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -196,7 +189,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -207,7 +200,7 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -223,7 +216,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -239,7 +232,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -249,7 +242,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { func futimes(fd int, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -260,7 +253,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -272,7 +265,7 @@ func pipe() (fd1 int, fd2 int, err error) { fd1 = int(r0) fd2 = int(r1) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -289,7 +282,7 @@ func getdents(fd int, buf []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -305,7 +298,7 @@ func Access(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -315,7 +308,7 @@ func Access(path string, mode uint32) (err error) { func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -331,7 +324,7 @@ func Chdir(path string) (err error) { _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -347,7 +340,7 @@ func Chflags(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -363,7 +356,7 @@ func Chmod(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -379,7 +372,7 @@ func Chown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -395,7 +388,7 @@ func Chroot(path string) (err error) { _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -405,7 +398,7 @@ func Chroot(path string) (err error) { func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -413,10 +406,10 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := RawSyscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -424,9 +417,9 @@ func Dup(fd int) (nfd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := RawSyscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -443,7 +436,7 @@ func Exit(code int) { func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -453,7 +446,7 @@ func Fchdir(fd int) (err error) { func Fchflags(fd int, flags int) (err error) { _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -463,7 +456,7 @@ func Fchflags(fd int, flags int) (err error) { func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -473,7 +466,7 @@ func Fchmod(fd int, mode uint32) (err error) { func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -483,7 +476,7 @@ func Fchown(fd int, uid int, gid int) (err error) { func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -494,7 +487,7 @@ func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -504,7 +497,7 @@ func Fpathconf(fd int, name int) (val int, err error) { func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -514,7 +507,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -524,7 +517,7 @@ func Fsync(fd int) (err error) { func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -559,7 +552,7 @@ func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -594,7 +587,7 @@ func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -604,7 +597,7 @@ func Getpriority(which int, who int) (prio int, err error) { func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -614,7 +607,7 @@ func Getrlimit(which int, lim *Rlimit) (err error) { func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -625,7 +618,7 @@ func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -635,7 +628,7 @@ func Getsid(pid int) (sid int, err error) { func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -661,7 +654,7 @@ func Issetugid() (tainted bool) { func Kill(pid int, signum syscall.Signal) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -672,7 +665,7 @@ func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -688,7 +681,7 @@ func Lchown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -710,7 +703,7 @@ func Link(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -720,7 +713,7 @@ func Link(path string, link string) (err error) { func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -736,7 +729,7 @@ func Lstat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -752,7 +745,7 @@ func Mkdir(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -768,7 +761,7 @@ func Mkfifo(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -784,75 +777,7 @@ func Mknod(path string, mode uint32, dev int) (err error) { _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -862,7 +787,7 @@ func Munlockall() (err error) { func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -879,7 +804,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -896,7 +821,7 @@ func Pathconf(path string, name int) (val int, err error) { use(unsafe.Pointer(_p0)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -913,7 +838,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -930,7 +855,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -947,7 +872,7 @@ func read(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -970,7 +895,7 @@ func Readlink(path string, buf []byte) (n int, err error) { use(unsafe.Pointer(_p0)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -992,7 +917,7 @@ func Rename(from string, to string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1008,7 +933,7 @@ func Revoke(path string) (err error) { _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1024,7 +949,7 @@ func Rmdir(path string) (err error) { _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1035,7 +960,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0) newoffset = int64(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1045,7 +970,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1055,7 +980,7 @@ func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { func Setegid(egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1065,7 +990,7 @@ func Setegid(egid int) (err error) { func Seteuid(euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1075,7 +1000,7 @@ func Seteuid(euid int) (err error) { func Setgid(gid int) (err error) { _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1085,7 +1010,7 @@ func Setgid(gid int) (err error) { func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1095,7 +1020,7 @@ func Setpgid(pid int, pgid int) (err error) { func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1105,7 +1030,7 @@ func Setpriority(which int, who int, prio int) (err error) { func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1115,7 +1040,7 @@ func Setregid(rgid int, egid int) (err error) { func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1125,7 +1050,7 @@ func Setreuid(ruid int, euid int) (err error) { func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1136,7 +1061,7 @@ func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1146,7 +1071,7 @@ func Setsid() (pid int, err error) { func Settimeofday(tp *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1156,7 +1081,7 @@ func Settimeofday(tp *Timeval) (err error) { func Setuid(uid int) (err error) { _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1172,7 +1097,7 @@ func Stat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1194,7 +1119,7 @@ func Symlink(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1204,7 +1129,7 @@ func Symlink(path string, link string) (err error) { func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1220,7 +1145,7 @@ func Truncate(path string, length int64) (err error) { _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1244,7 +1169,7 @@ func Unlink(path string) (err error) { _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1260,7 +1185,7 @@ func Unmount(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1277,7 +1202,7 @@ func write(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1288,7 +1213,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0) ret = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1298,7 +1223,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1309,7 +1234,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1320,7 +1245,7 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go index 84dc61cfa9..e333ba3e7c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go @@ -1,16 +1,9 @@ // mksyscall.pl -l32 -arm syscall_bsd.go syscall_netbsd.go syscall_netbsd_arm.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build arm,netbsd - package unix -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno +import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -18,7 +11,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -28,7 +21,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -39,7 +32,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -50,7 +43,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -60,7 +53,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -70,7 +63,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -81,7 +74,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -91,7 +84,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -101,7 +94,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -111,7 +104,7 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -121,7 +114,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -131,7 +124,7 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func Shutdown(s int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -141,7 +134,7 @@ func Shutdown(s int, how int) (err error) { func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -158,7 +151,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -174,7 +167,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -185,7 +178,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -196,7 +189,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -207,7 +200,7 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -223,7 +216,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -239,7 +232,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -249,7 +242,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { func futimes(fd int, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -260,7 +253,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -272,7 +265,7 @@ func pipe() (fd1 int, fd2 int, err error) { fd1 = int(r0) fd2 = int(r1) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -289,7 +282,7 @@ func getdents(fd int, buf []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -305,7 +298,7 @@ func Access(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -315,7 +308,7 @@ func Access(path string, mode uint32) (err error) { func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -331,7 +324,7 @@ func Chdir(path string) (err error) { _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -347,7 +340,7 @@ func Chflags(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -363,7 +356,7 @@ func Chmod(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -379,7 +372,7 @@ func Chown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -395,7 +388,7 @@ func Chroot(path string) (err error) { _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -405,7 +398,7 @@ func Chroot(path string) (err error) { func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -413,10 +406,10 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := RawSyscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -424,9 +417,9 @@ func Dup(fd int) (nfd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := RawSyscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -443,7 +436,7 @@ func Exit(code int) { func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -453,7 +446,7 @@ func Fchdir(fd int) (err error) { func Fchflags(fd int, flags int) (err error) { _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -463,7 +456,7 @@ func Fchflags(fd int, flags int) (err error) { func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -473,7 +466,7 @@ func Fchmod(fd int, mode uint32) (err error) { func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -483,7 +476,7 @@ func Fchown(fd int, uid int, gid int) (err error) { func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -494,7 +487,7 @@ func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -504,7 +497,7 @@ func Fpathconf(fd int, name int) (val int, err error) { func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -514,7 +507,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -524,7 +517,7 @@ func Fsync(fd int) (err error) { func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall6(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length), uintptr(length>>32), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -559,7 +552,7 @@ func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -594,7 +587,7 @@ func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -604,7 +597,7 @@ func Getpriority(which int, who int) (prio int, err error) { func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -614,7 +607,7 @@ func Getrlimit(which int, lim *Rlimit) (err error) { func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -625,7 +618,7 @@ func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -635,7 +628,7 @@ func Getsid(pid int) (sid int, err error) { func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -661,7 +654,7 @@ func Issetugid() (tainted bool) { func Kill(pid int, signum syscall.Signal) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -672,7 +665,7 @@ func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -688,7 +681,7 @@ func Lchown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -710,7 +703,7 @@ func Link(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -720,7 +713,7 @@ func Link(path string, link string) (err error) { func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -736,7 +729,7 @@ func Lstat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -752,7 +745,7 @@ func Mkdir(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -768,7 +761,7 @@ func Mkfifo(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -784,75 +777,7 @@ func Mknod(path string, mode uint32, dev int) (err error) { _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -862,7 +787,7 @@ func Munlockall() (err error) { func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -879,7 +804,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -896,7 +821,7 @@ func Pathconf(path string, name int) (val int, err error) { use(unsafe.Pointer(_p0)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -913,7 +838,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -930,7 +855,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -947,7 +872,7 @@ func read(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -970,7 +895,7 @@ func Readlink(path string, buf []byte) (n int, err error) { use(unsafe.Pointer(_p0)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -992,7 +917,7 @@ func Rename(from string, to string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1008,7 +933,7 @@ func Revoke(path string) (err error) { _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1024,7 +949,7 @@ func Rmdir(path string) (err error) { _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1035,7 +960,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), uintptr(whence), 0) newoffset = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1045,7 +970,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1055,7 +980,7 @@ func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { func Setegid(egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1065,7 +990,7 @@ func Setegid(egid int) (err error) { func Seteuid(euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1075,7 +1000,7 @@ func Seteuid(euid int) (err error) { func Setgid(gid int) (err error) { _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1085,7 +1010,7 @@ func Setgid(gid int) (err error) { func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1095,7 +1020,7 @@ func Setpgid(pid int, pgid int) (err error) { func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1105,7 +1030,7 @@ func Setpriority(which int, who int, prio int) (err error) { func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1115,7 +1040,7 @@ func Setregid(rgid int, egid int) (err error) { func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1125,7 +1050,7 @@ func Setreuid(ruid int, euid int) (err error) { func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1136,7 +1061,7 @@ func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1146,7 +1071,7 @@ func Setsid() (pid int, err error) { func Settimeofday(tp *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1156,7 +1081,7 @@ func Settimeofday(tp *Timeval) (err error) { func Setuid(uid int) (err error) { _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1172,7 +1097,7 @@ func Stat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1194,7 +1119,7 @@ func Symlink(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1204,7 +1129,7 @@ func Symlink(path string, link string) (err error) { func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1220,7 +1145,7 @@ func Truncate(path string, length int64) (err error) { _, _, e1 := Syscall6(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1244,7 +1169,7 @@ func Unlink(path string) (err error) { _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1260,7 +1185,7 @@ func Unmount(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1277,7 +1202,7 @@ func write(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1288,7 +1213,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), uintptr(pos>>32), 0) ret = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1298,7 +1223,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1309,7 +1234,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1320,7 +1245,7 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go index 02b3528a69..2d5704f7d5 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go @@ -1,16 +1,9 @@ // mksyscall.pl -l32 -openbsd syscall_bsd.go syscall_openbsd.go syscall_openbsd_386.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build 386,openbsd - package unix -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno +import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -18,7 +11,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -28,7 +21,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -39,7 +32,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -50,7 +43,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -60,7 +53,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -70,7 +63,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -81,7 +74,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -91,7 +84,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -101,7 +94,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -111,7 +104,7 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -121,7 +114,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -131,7 +124,7 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func Shutdown(s int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -141,7 +134,7 @@ func Shutdown(s int, how int) (err error) { func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -158,7 +151,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -174,7 +167,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -185,7 +178,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -196,7 +189,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -207,7 +200,7 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -223,7 +216,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -239,7 +232,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -249,7 +242,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { func futimes(fd int, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -260,7 +253,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -270,7 +263,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { func pipe(p *[2]_C_int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -287,7 +280,7 @@ func getdents(fd int, buf []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -303,7 +296,7 @@ func Access(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -313,7 +306,7 @@ func Access(path string, mode uint32) (err error) { func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -329,7 +322,7 @@ func Chdir(path string) (err error) { _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -345,7 +338,7 @@ func Chflags(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -361,7 +354,7 @@ func Chmod(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -377,7 +370,7 @@ func Chown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -393,7 +386,7 @@ func Chroot(path string) (err error) { _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -403,7 +396,7 @@ func Chroot(path string) (err error) { func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -411,10 +404,10 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := RawSyscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -422,9 +415,9 @@ func Dup(fd int) (nfd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := RawSyscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -441,7 +434,7 @@ func Exit(code int) { func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -451,7 +444,7 @@ func Fchdir(fd int) (err error) { func Fchflags(fd int, flags int) (err error) { _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -461,7 +454,7 @@ func Fchflags(fd int, flags int) (err error) { func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -471,7 +464,7 @@ func Fchmod(fd int, mode uint32) (err error) { func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -481,7 +474,7 @@ func Fchown(fd int, uid int, gid int) (err error) { func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -492,7 +485,7 @@ func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -502,7 +495,7 @@ func Fpathconf(fd int, name int) (val int, err error) { func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -512,7 +505,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -522,7 +515,7 @@ func Fstatfs(fd int, stat *Statfs_t) (err error) { func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -532,7 +525,7 @@ func Fsync(fd int) (err error) { func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall6(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length), uintptr(length>>32), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -567,7 +560,7 @@ func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -602,7 +595,7 @@ func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -612,7 +605,7 @@ func Getpriority(which int, who int) (prio int, err error) { func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -622,7 +615,7 @@ func Getrlimit(which int, lim *Rlimit) (err error) { func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -633,7 +626,7 @@ func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -643,7 +636,7 @@ func Getsid(pid int) (sid int, err error) { func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -669,7 +662,7 @@ func Issetugid() (tainted bool) { func Kill(pid int, signum syscall.Signal) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -680,7 +673,7 @@ func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -696,7 +689,7 @@ func Lchown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -718,7 +711,7 @@ func Link(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -728,7 +721,7 @@ func Link(path string, link string) (err error) { func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -744,7 +737,7 @@ func Lstat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -760,7 +753,7 @@ func Mkdir(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -776,7 +769,7 @@ func Mkfifo(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -792,75 +785,7 @@ func Mknod(path string, mode uint32, dev int) (err error) { _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -870,7 +795,7 @@ func Munlockall() (err error) { func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -887,7 +812,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -904,7 +829,7 @@ func Pathconf(path string, name int) (val int, err error) { use(unsafe.Pointer(_p0)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -921,7 +846,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -938,7 +863,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -955,7 +880,7 @@ func read(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -978,7 +903,7 @@ func Readlink(path string, buf []byte) (n int, err error) { use(unsafe.Pointer(_p0)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1000,7 +925,7 @@ func Rename(from string, to string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1016,7 +941,7 @@ func Revoke(path string) (err error) { _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1032,7 +957,7 @@ func Rmdir(path string) (err error) { _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1043,7 +968,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), uintptr(whence), 0) newoffset = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1053,7 +978,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1063,7 +988,7 @@ func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { func Setegid(egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1073,7 +998,7 @@ func Setegid(egid int) (err error) { func Seteuid(euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1083,7 +1008,7 @@ func Seteuid(euid int) (err error) { func Setgid(gid int) (err error) { _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1099,7 +1024,7 @@ func Setlogin(name string) (err error) { _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1109,7 +1034,7 @@ func Setlogin(name string) (err error) { func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1119,7 +1044,7 @@ func Setpgid(pid int, pgid int) (err error) { func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1129,7 +1054,7 @@ func Setpriority(which int, who int, prio int) (err error) { func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1139,7 +1064,7 @@ func Setregid(rgid int, egid int) (err error) { func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1149,7 +1074,7 @@ func Setreuid(ruid int, euid int) (err error) { func Setresgid(rgid int, egid int, sgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1159,7 +1084,7 @@ func Setresgid(rgid int, egid int, sgid int) (err error) { func Setresuid(ruid int, euid int, suid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1169,7 +1094,7 @@ func Setresuid(ruid int, euid int, suid int) (err error) { func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1180,7 +1105,7 @@ func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1190,7 +1115,7 @@ func Setsid() (pid int, err error) { func Settimeofday(tp *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1200,7 +1125,7 @@ func Settimeofday(tp *Timeval) (err error) { func Setuid(uid int) (err error) { _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1216,7 +1141,7 @@ func Stat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1232,7 +1157,7 @@ func Statfs(path string, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1254,7 +1179,7 @@ func Symlink(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1264,7 +1189,7 @@ func Symlink(path string, link string) (err error) { func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1280,7 +1205,7 @@ func Truncate(path string, length int64) (err error) { _, _, e1 := Syscall6(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1304,7 +1229,7 @@ func Unlink(path string) (err error) { _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1320,7 +1245,7 @@ func Unmount(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1337,7 +1262,7 @@ func write(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1348,7 +1273,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), uintptr(pos>>32), 0) ret = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1358,7 +1283,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1369,7 +1294,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1380,7 +1305,7 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go index 7dc2b7eaf7..1f81328ead 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go @@ -1,16 +1,9 @@ // mksyscall.pl -openbsd syscall_bsd.go syscall_openbsd.go syscall_openbsd_amd64.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build amd64,openbsd - package unix -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno +import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -18,7 +11,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -28,7 +21,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -39,7 +32,7 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -50,7 +43,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -60,7 +53,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -70,7 +63,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -81,7 +74,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -91,7 +84,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -101,7 +94,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -111,7 +104,7 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -121,7 +114,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -131,7 +124,7 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func Shutdown(s int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -141,7 +134,7 @@ func Shutdown(s int, how int) (err error) { func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -158,7 +151,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -174,7 +167,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -185,7 +178,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -196,7 +189,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -207,7 +200,7 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -223,7 +216,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -239,7 +232,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -249,7 +242,7 @@ func utimes(path string, timeval *[2]Timeval) (err error) { func futimes(fd int, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -260,7 +253,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -270,7 +263,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { func pipe(p *[2]_C_int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -287,7 +280,7 @@ func getdents(fd int, buf []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -303,7 +296,7 @@ func Access(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -313,7 +306,7 @@ func Access(path string, mode uint32) (err error) { func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -329,7 +322,7 @@ func Chdir(path string) (err error) { _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -345,7 +338,7 @@ func Chflags(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -361,7 +354,7 @@ func Chmod(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -377,7 +370,7 @@ func Chown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -393,7 +386,7 @@ func Chroot(path string) (err error) { _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -403,7 +396,7 @@ func Chroot(path string) (err error) { func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -411,10 +404,10 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := RawSyscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -422,9 +415,9 @@ func Dup(fd int) (nfd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := RawSyscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -441,7 +434,7 @@ func Exit(code int) { func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -451,7 +444,7 @@ func Fchdir(fd int) (err error) { func Fchflags(fd int, flags int) (err error) { _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -461,7 +454,7 @@ func Fchflags(fd int, flags int) (err error) { func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -471,7 +464,7 @@ func Fchmod(fd int, mode uint32) (err error) { func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -481,7 +474,7 @@ func Fchown(fd int, uid int, gid int) (err error) { func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -492,7 +485,7 @@ func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -502,7 +495,7 @@ func Fpathconf(fd int, name int) (val int, err error) { func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -512,7 +505,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -522,7 +515,7 @@ func Fstatfs(fd int, stat *Statfs_t) (err error) { func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -532,7 +525,7 @@ func Fsync(fd int) (err error) { func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -567,7 +560,7 @@ func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -602,7 +595,7 @@ func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -612,7 +605,7 @@ func Getpriority(which int, who int) (prio int, err error) { func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -622,7 +615,7 @@ func Getrlimit(which int, lim *Rlimit) (err error) { func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -633,7 +626,7 @@ func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -643,7 +636,7 @@ func Getsid(pid int) (sid int, err error) { func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -669,7 +662,7 @@ func Issetugid() (tainted bool) { func Kill(pid int, signum syscall.Signal) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -680,7 +673,7 @@ func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -696,7 +689,7 @@ func Lchown(path string, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -718,7 +711,7 @@ func Link(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -728,7 +721,7 @@ func Link(path string, link string) (err error) { func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -744,7 +737,7 @@ func Lstat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -760,7 +753,7 @@ func Mkdir(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -776,7 +769,7 @@ func Mkfifo(path string, mode uint32) (err error) { _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -792,75 +785,7 @@ func Mknod(path string, mode uint32, dev int) (err error) { _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -870,7 +795,7 @@ func Munlockall() (err error) { func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -887,7 +812,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -904,7 +829,7 @@ func Pathconf(path string, name int) (val int, err error) { use(unsafe.Pointer(_p0)) val = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -921,7 +846,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -938,7 +863,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -955,7 +880,7 @@ func read(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -978,7 +903,7 @@ func Readlink(path string, buf []byte) (n int, err error) { use(unsafe.Pointer(_p0)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1000,7 +925,7 @@ func Rename(from string, to string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1016,7 +941,7 @@ func Revoke(path string) (err error) { _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1032,7 +957,7 @@ func Rmdir(path string) (err error) { _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1043,7 +968,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0) newoffset = int64(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1053,7 +978,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1063,7 +988,7 @@ func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { func Setegid(egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1073,7 +998,7 @@ func Setegid(egid int) (err error) { func Seteuid(euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1083,7 +1008,7 @@ func Seteuid(euid int) (err error) { func Setgid(gid int) (err error) { _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1099,7 +1024,7 @@ func Setlogin(name string) (err error) { _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1109,7 +1034,7 @@ func Setlogin(name string) (err error) { func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1119,7 +1044,7 @@ func Setpgid(pid int, pgid int) (err error) { func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1129,7 +1054,7 @@ func Setpriority(which int, who int, prio int) (err error) { func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1139,7 +1064,7 @@ func Setregid(rgid int, egid int) (err error) { func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1149,7 +1074,7 @@ func Setreuid(ruid int, euid int) (err error) { func Setresgid(rgid int, egid int, sgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1159,7 +1084,7 @@ func Setresgid(rgid int, egid int, sgid int) (err error) { func Setresuid(ruid int, euid int, suid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1169,7 +1094,7 @@ func Setresuid(ruid int, euid int, suid int) (err error) { func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1180,7 +1105,7 @@ func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1190,7 +1115,7 @@ func Setsid() (pid int, err error) { func Settimeofday(tp *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1200,7 +1125,7 @@ func Settimeofday(tp *Timeval) (err error) { func Setuid(uid int) (err error) { _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1216,7 +1141,7 @@ func Stat(path string, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1232,7 +1157,7 @@ func Statfs(path string, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1254,7 +1179,7 @@ func Symlink(path string, link string) (err error) { use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1264,7 +1189,7 @@ func Symlink(path string, link string) (err error) { func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1280,7 +1205,7 @@ func Truncate(path string, length int64) (err error) { _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length)) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1304,7 +1229,7 @@ func Unlink(path string) (err error) { _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1320,7 +1245,7 @@ func Unmount(path string, flags int) (err error) { _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) use(unsafe.Pointer(_p0)) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1337,7 +1262,7 @@ func write(fd int, p []byte) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1348,7 +1273,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0) ret = uintptr(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1358,7 +1283,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1369,7 +1294,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } @@ -1380,7 +1305,7 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { - err = errnoErr(e1) + err = e1 } return } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index 4326427817..9ee51e3e3a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -1,385 +1,98 @@ // mksyscall_solaris.pl syscall_solaris.go syscall_solaris_amd64.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// +build amd64,solaris - package unix -import ( - "syscall" - "unsafe" -) - -//go:cgo_import_dynamic libc_getsockname getsockname "libsocket.so" -//go:cgo_import_dynamic libc_getcwd getcwd "libc.so" -//go:cgo_import_dynamic libc_getgroups getgroups "libc.so" -//go:cgo_import_dynamic libc_setgroups setgroups "libc.so" -//go:cgo_import_dynamic libc_utimes utimes "libc.so" -//go:cgo_import_dynamic libc_utimensat utimensat "libc.so" -//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" -//go:cgo_import_dynamic libc_futimesat futimesat "libc.so" -//go:cgo_import_dynamic libc_accept accept "libsocket.so" -//go:cgo_import_dynamic libc_recvmsg recvmsg "libsocket.so" -//go:cgo_import_dynamic libc_sendmsg sendmsg "libsocket.so" -//go:cgo_import_dynamic libc_acct acct "libc.so" -//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" -//go:cgo_import_dynamic libc_access access "libc.so" -//go:cgo_import_dynamic libc_adjtime adjtime "libc.so" -//go:cgo_import_dynamic libc_chdir chdir "libc.so" -//go:cgo_import_dynamic libc_chmod chmod "libc.so" -//go:cgo_import_dynamic libc_chown chown "libc.so" -//go:cgo_import_dynamic libc_chroot chroot "libc.so" -//go:cgo_import_dynamic libc_close close "libc.so" -//go:cgo_import_dynamic libc_creat creat "libc.so" -//go:cgo_import_dynamic libc_dup dup "libc.so" -//go:cgo_import_dynamic libc_dup2 dup2 "libc.so" -//go:cgo_import_dynamic libc_exit exit "libc.so" -//go:cgo_import_dynamic libc_fchdir fchdir "libc.so" -//go:cgo_import_dynamic libc_fchmod fchmod "libc.so" -//go:cgo_import_dynamic libc_fchmodat fchmodat "libc.so" -//go:cgo_import_dynamic libc_fchown fchown "libc.so" -//go:cgo_import_dynamic libc_fchownat fchownat "libc.so" -//go:cgo_import_dynamic libc_fdatasync fdatasync "libc.so" -//go:cgo_import_dynamic libc_fpathconf fpathconf "libc.so" -//go:cgo_import_dynamic libc_fstat fstat "libc.so" -//go:cgo_import_dynamic libc_getdents getdents "libc.so" -//go:cgo_import_dynamic libc_getgid getgid "libc.so" -//go:cgo_import_dynamic libc_getpid getpid "libc.so" -//go:cgo_import_dynamic libc_getpgid getpgid "libc.so" -//go:cgo_import_dynamic libc_getpgrp getpgrp "libc.so" -//go:cgo_import_dynamic libc_geteuid geteuid "libc.so" -//go:cgo_import_dynamic libc_getegid getegid "libc.so" -//go:cgo_import_dynamic libc_getppid getppid "libc.so" -//go:cgo_import_dynamic libc_getpriority getpriority "libc.so" -//go:cgo_import_dynamic libc_getrlimit getrlimit "libc.so" -//go:cgo_import_dynamic libc_getrusage getrusage "libc.so" -//go:cgo_import_dynamic libc_gettimeofday gettimeofday "libc.so" -//go:cgo_import_dynamic libc_getuid getuid "libc.so" -//go:cgo_import_dynamic libc_kill kill "libc.so" -//go:cgo_import_dynamic libc_lchown lchown "libc.so" -//go:cgo_import_dynamic libc_link link "libc.so" -//go:cgo_import_dynamic libc_listen listen "libsocket.so" -//go:cgo_import_dynamic libc_lstat lstat "libc.so" -//go:cgo_import_dynamic libc_madvise madvise "libc.so" -//go:cgo_import_dynamic libc_mkdir mkdir "libc.so" -//go:cgo_import_dynamic libc_mkdirat mkdirat "libc.so" -//go:cgo_import_dynamic libc_mkfifo mkfifo "libc.so" -//go:cgo_import_dynamic libc_mkfifoat mkfifoat "libc.so" -//go:cgo_import_dynamic libc_mknod mknod "libc.so" -//go:cgo_import_dynamic libc_mknodat mknodat "libc.so" -//go:cgo_import_dynamic libc_mlock mlock "libc.so" -//go:cgo_import_dynamic libc_mlockall mlockall "libc.so" -//go:cgo_import_dynamic libc_mprotect mprotect "libc.so" -//go:cgo_import_dynamic libc_munlock munlock "libc.so" -//go:cgo_import_dynamic libc_munlockall munlockall "libc.so" -//go:cgo_import_dynamic libc_nanosleep nanosleep "libc.so" -//go:cgo_import_dynamic libc_open open "libc.so" -//go:cgo_import_dynamic libc_openat openat "libc.so" -//go:cgo_import_dynamic libc_pathconf pathconf "libc.so" -//go:cgo_import_dynamic libc_pause pause "libc.so" -//go:cgo_import_dynamic libc_pread pread "libc.so" -//go:cgo_import_dynamic libc_pwrite pwrite "libc.so" -//go:cgo_import_dynamic libc_read read "libc.so" -//go:cgo_import_dynamic libc_readlink readlink "libc.so" -//go:cgo_import_dynamic libc_rename rename "libc.so" -//go:cgo_import_dynamic libc_renameat renameat "libc.so" -//go:cgo_import_dynamic libc_rmdir rmdir "libc.so" -//go:cgo_import_dynamic libc_lseek lseek "libc.so" -//go:cgo_import_dynamic libc_setegid setegid "libc.so" -//go:cgo_import_dynamic libc_seteuid seteuid "libc.so" -//go:cgo_import_dynamic libc_setgid setgid "libc.so" -//go:cgo_import_dynamic libc_sethostname sethostname "libc.so" -//go:cgo_import_dynamic libc_setpgid setpgid "libc.so" -//go:cgo_import_dynamic libc_setpriority setpriority "libc.so" -//go:cgo_import_dynamic libc_setregid setregid "libc.so" -//go:cgo_import_dynamic libc_setreuid setreuid "libc.so" -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" -//go:cgo_import_dynamic libc_setsid setsid "libc.so" -//go:cgo_import_dynamic libc_setuid setuid "libc.so" -//go:cgo_import_dynamic libc_shutdown shutdown "libsocket.so" -//go:cgo_import_dynamic libc_stat stat "libc.so" -//go:cgo_import_dynamic libc_symlink symlink "libc.so" -//go:cgo_import_dynamic libc_sync sync "libc.so" -//go:cgo_import_dynamic libc_times times "libc.so" -//go:cgo_import_dynamic libc_truncate truncate "libc.so" -//go:cgo_import_dynamic libc_fsync fsync "libc.so" -//go:cgo_import_dynamic libc_ftruncate ftruncate "libc.so" -//go:cgo_import_dynamic libc_umask umask "libc.so" -//go:cgo_import_dynamic libc_uname uname "libc.so" -//go:cgo_import_dynamic libc_umount umount "libc.so" -//go:cgo_import_dynamic libc_unlink unlink "libc.so" -//go:cgo_import_dynamic libc_unlinkat unlinkat "libc.so" -//go:cgo_import_dynamic libc_ustat ustat "libc.so" -//go:cgo_import_dynamic libc_utime utime "libc.so" -//go:cgo_import_dynamic libc_bind bind "libsocket.so" -//go:cgo_import_dynamic libc_connect connect "libsocket.so" -//go:cgo_import_dynamic libc_mmap mmap "libc.so" -//go:cgo_import_dynamic libc_munmap munmap "libc.so" -//go:cgo_import_dynamic libc_sendto sendto "libsocket.so" -//go:cgo_import_dynamic libc_socket socket "libsocket.so" -//go:cgo_import_dynamic libc_socketpair socketpair "libsocket.so" -//go:cgo_import_dynamic libc_write write "libc.so" -//go:cgo_import_dynamic libc_getsockopt getsockopt "libsocket.so" -//go:cgo_import_dynamic libc_getpeername getpeername "libsocket.so" -//go:cgo_import_dynamic libc_setsockopt setsockopt "libsocket.so" -//go:cgo_import_dynamic libc_recvfrom recvfrom "libsocket.so" -//go:cgo_import_dynamic libc_sysconf sysconf "libc.so" - -//go:linkname procgetsockname libc_getsockname -//go:linkname procGetcwd libc_getcwd -//go:linkname procgetgroups libc_getgroups -//go:linkname procsetgroups libc_setgroups -//go:linkname procutimes libc_utimes -//go:linkname procutimensat libc_utimensat -//go:linkname procfcntl libc_fcntl -//go:linkname procfutimesat libc_futimesat -//go:linkname procaccept libc_accept -//go:linkname procrecvmsg libc_recvmsg -//go:linkname procsendmsg libc_sendmsg -//go:linkname procacct libc_acct -//go:linkname procioctl libc_ioctl -//go:linkname procAccess libc_access -//go:linkname procAdjtime libc_adjtime -//go:linkname procChdir libc_chdir -//go:linkname procChmod libc_chmod -//go:linkname procChown libc_chown -//go:linkname procChroot libc_chroot -//go:linkname procClose libc_close -//go:linkname procCreat libc_creat -//go:linkname procDup libc_dup -//go:linkname procDup2 libc_dup2 -//go:linkname procExit libc_exit -//go:linkname procFchdir libc_fchdir -//go:linkname procFchmod libc_fchmod -//go:linkname procFchmodat libc_fchmodat -//go:linkname procFchown libc_fchown -//go:linkname procFchownat libc_fchownat -//go:linkname procFdatasync libc_fdatasync -//go:linkname procFpathconf libc_fpathconf -//go:linkname procFstat libc_fstat -//go:linkname procGetdents libc_getdents -//go:linkname procGetgid libc_getgid -//go:linkname procGetpid libc_getpid -//go:linkname procGetpgid libc_getpgid -//go:linkname procGetpgrp libc_getpgrp -//go:linkname procGeteuid libc_geteuid -//go:linkname procGetegid libc_getegid -//go:linkname procGetppid libc_getppid -//go:linkname procGetpriority libc_getpriority -//go:linkname procGetrlimit libc_getrlimit -//go:linkname procGetrusage libc_getrusage -//go:linkname procGettimeofday libc_gettimeofday -//go:linkname procGetuid libc_getuid -//go:linkname procKill libc_kill -//go:linkname procLchown libc_lchown -//go:linkname procLink libc_link -//go:linkname proclisten libc_listen -//go:linkname procLstat libc_lstat -//go:linkname procMadvise libc_madvise -//go:linkname procMkdir libc_mkdir -//go:linkname procMkdirat libc_mkdirat -//go:linkname procMkfifo libc_mkfifo -//go:linkname procMkfifoat libc_mkfifoat -//go:linkname procMknod libc_mknod -//go:linkname procMknodat libc_mknodat -//go:linkname procMlock libc_mlock -//go:linkname procMlockall libc_mlockall -//go:linkname procMprotect libc_mprotect -//go:linkname procMunlock libc_munlock -//go:linkname procMunlockall libc_munlockall -//go:linkname procNanosleep libc_nanosleep -//go:linkname procOpen libc_open -//go:linkname procOpenat libc_openat -//go:linkname procPathconf libc_pathconf -//go:linkname procPause libc_pause -//go:linkname procPread libc_pread -//go:linkname procPwrite libc_pwrite -//go:linkname procread libc_read -//go:linkname procReadlink libc_readlink -//go:linkname procRename libc_rename -//go:linkname procRenameat libc_renameat -//go:linkname procRmdir libc_rmdir -//go:linkname proclseek libc_lseek -//go:linkname procSetegid libc_setegid -//go:linkname procSeteuid libc_seteuid -//go:linkname procSetgid libc_setgid -//go:linkname procSethostname libc_sethostname -//go:linkname procSetpgid libc_setpgid -//go:linkname procSetpriority libc_setpriority -//go:linkname procSetregid libc_setregid -//go:linkname procSetreuid libc_setreuid -//go:linkname procSetrlimit libc_setrlimit -//go:linkname procSetsid libc_setsid -//go:linkname procSetuid libc_setuid -//go:linkname procshutdown libc_shutdown -//go:linkname procStat libc_stat -//go:linkname procSymlink libc_symlink -//go:linkname procSync libc_sync -//go:linkname procTimes libc_times -//go:linkname procTruncate libc_truncate -//go:linkname procFsync libc_fsync -//go:linkname procFtruncate libc_ftruncate -//go:linkname procUmask libc_umask -//go:linkname procUname libc_uname -//go:linkname procumount libc_umount -//go:linkname procUnlink libc_unlink -//go:linkname procUnlinkat libc_unlinkat -//go:linkname procUstat libc_ustat -//go:linkname procUtime libc_utime -//go:linkname procbind libc_bind -//go:linkname procconnect libc_connect -//go:linkname procmmap libc_mmap -//go:linkname procmunmap libc_munmap -//go:linkname procsendto libc_sendto -//go:linkname procsocket libc_socket -//go:linkname procsocketpair libc_socketpair -//go:linkname procwrite libc_write -//go:linkname procgetsockopt libc_getsockopt -//go:linkname procgetpeername libc_getpeername -//go:linkname procsetsockopt libc_setsockopt -//go:linkname procrecvfrom libc_recvfrom -//go:linkname procsysconf libc_sysconf +import "unsafe" var ( - procgetsockname, - procGetcwd, - procgetgroups, - procsetgroups, - procutimes, - procutimensat, - procfcntl, - procfutimesat, - procaccept, - procrecvmsg, - procsendmsg, - procacct, - procioctl, - procAccess, - procAdjtime, - procChdir, - procChmod, - procChown, - procChroot, - procClose, - procCreat, - procDup, - procDup2, - procExit, - procFchdir, - procFchmod, - procFchmodat, - procFchown, - procFchownat, - procFdatasync, - procFpathconf, - procFstat, - procGetdents, - procGetgid, - procGetpid, - procGetpgid, - procGetpgrp, - procGeteuid, - procGetegid, - procGetppid, - procGetpriority, - procGetrlimit, - procGetrusage, - procGettimeofday, - procGetuid, - procKill, - procLchown, - procLink, - proclisten, - procLstat, - procMadvise, - procMkdir, - procMkdirat, - procMkfifo, - procMkfifoat, - procMknod, - procMknodat, - procMlock, - procMlockall, - procMprotect, - procMunlock, - procMunlockall, - procNanosleep, - procOpen, - procOpenat, - procPathconf, - procPause, - procPread, - procPwrite, - procread, - procReadlink, - procRename, - procRenameat, - procRmdir, - proclseek, - procSetegid, - procSeteuid, - procSetgid, - procSethostname, - procSetpgid, - procSetpriority, - procSetregid, - procSetreuid, - procSetrlimit, - procSetsid, - procSetuid, - procshutdown, - procStat, - procSymlink, - procSync, - procTimes, - procTruncate, - procFsync, - procFtruncate, - procUmask, - procUname, - procumount, - procUnlink, - procUnlinkat, - procUstat, - procUtime, - procbind, - procconnect, - procmmap, - procmunmap, - procsendto, - procsocket, - procsocketpair, - procwrite, - procgetsockopt, - procgetpeername, - procsetsockopt, - procrecvfrom, - procsysconf syscallFunc + modlibc = syscall.newLazySO("libc.so") + modlibsocket = syscall.newLazySO("libsocket.so") + + procgetgroups = modlibc.NewProc("getgroups") + procsetgroups = modlibc.NewProc("setgroups") + procfcntl = modlibc.NewProc("fcntl") + procaccept = modlibsocket.NewProc("accept") + procsendmsg = modlibsocket.NewProc("sendmsg") + procAccess = modlibc.NewProc("access") + procAdjtime = modlibc.NewProc("adjtime") + procChdir = modlibc.NewProc("chdir") + procChmod = modlibc.NewProc("chmod") + procChown = modlibc.NewProc("chown") + procChroot = modlibc.NewProc("chroot") + procClose = modlibc.NewProc("close") + procDup = modlibc.NewProc("dup") + procExit = modlibc.NewProc("exit") + procFchdir = modlibc.NewProc("fchdir") + procFchmod = modlibc.NewProc("fchmod") + procFchown = modlibc.NewProc("fchown") + procFpathconf = modlibc.NewProc("fpathconf") + procFstat = modlibc.NewProc("fstat") + procGetdents = modlibc.NewProc("getdents") + procGetgid = modlibc.NewProc("getgid") + procGetpid = modlibc.NewProc("getpid") + procGeteuid = modlibc.NewProc("geteuid") + procGetegid = modlibc.NewProc("getegid") + procGetppid = modlibc.NewProc("getppid") + procGetpriority = modlibc.NewProc("getpriority") + procGetrlimit = modlibc.NewProc("getrlimit") + procGettimeofday = modlibc.NewProc("gettimeofday") + procGetuid = modlibc.NewProc("getuid") + procKill = modlibc.NewProc("kill") + procLchown = modlibc.NewProc("lchown") + procLink = modlibc.NewProc("link") + proclisten = modlibsocket.NewProc("listen") + procLstat = modlibc.NewProc("lstat") + procMkdir = modlibc.NewProc("mkdir") + procMknod = modlibc.NewProc("mknod") + procNanosleep = modlibc.NewProc("nanosleep") + procOpen = modlibc.NewProc("open") + procPathconf = modlibc.NewProc("pathconf") + procPread = modlibc.NewProc("pread") + procPwrite = modlibc.NewProc("pwrite") + procread = modlibc.NewProc("read") + procReadlink = modlibc.NewProc("readlink") + procRename = modlibc.NewProc("rename") + procRmdir = modlibc.NewProc("rmdir") + proclseek = modlibc.NewProc("lseek") + procSetegid = modlibc.NewProc("setegid") + procSeteuid = modlibc.NewProc("seteuid") + procSetgid = modlibc.NewProc("setgid") + procSetpgid = modlibc.NewProc("setpgid") + procSetpriority = modlibc.NewProc("setpriority") + procSetregid = modlibc.NewProc("setregid") + procSetreuid = modlibc.NewProc("setreuid") + procSetrlimit = modlibc.NewProc("setrlimit") + procSetsid = modlibc.NewProc("setsid") + procSetuid = modlibc.NewProc("setuid") + procshutdown = modlibsocket.NewProc("shutdown") + procStat = modlibc.NewProc("stat") + procSymlink = modlibc.NewProc("symlink") + procSync = modlibc.NewProc("sync") + procTruncate = modlibc.NewProc("truncate") + procFsync = modlibc.NewProc("fsync") + procFtruncate = modlibc.NewProc("ftruncate") + procUmask = modlibc.NewProc("umask") + procUnlink = modlibc.NewProc("unlink") + procUtimes = modlibc.NewProc("utimes") + procbind = modlibsocket.NewProc("bind") + procconnect = modlibsocket.NewProc("connect") + procmmap = modlibc.NewProc("mmap") + procmunmap = modlibc.NewProc("munmap") + procsendto = modlibsocket.NewProc("sendto") + procsocket = modlibsocket.NewProc("socket") + procsocketpair = modlibsocket.NewProc("socketpair") + procwrite = modlibc.NewProc("write") + procgetsockopt = modlibsocket.NewProc("getsockopt") + procgetpeername = modlibsocket.NewProc("getpeername") + procgetsockname = modlibsocket.NewProc("getsockname") + procsetsockopt = modlibsocket.NewProc("setsockopt") + procrecvfrom = modlibsocket.NewProc("recvfrom") + procrecvmsg = modlibsocket.NewProc("recvmsg") ) -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetsockname)), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -func Getcwd(buf []byte) (n int, err error) { - var _p0 *byte - if len(buf) > 0 { - _p0 = &buf[0] - } - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procGetcwd)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), 0, 0, 0, 0) - n = int(r0) - if e1 != 0 { - err = e1 - } - return -} - func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procgetgroups)), 2, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0, 0, 0, 0) + r0, _, e1 := rawSysvicall6(procgetgroups.Addr(), 2, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0, 0, 0, 0) n = int(r0) if e1 != 0 { err = e1 @@ -388,35 +101,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { } func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procsetgroups)), 2, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -func utimes(path string, times *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procutimes)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0, 0, 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = e1 - } - return -} - -func utimensat(fd int, path string, times *[2]Timespec, flag int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procutimensat)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flag), 0, 0) - use(unsafe.Pointer(_p0)) + _, _, e1 := rawSysvicall6(procsetgroups.Addr(), 2, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -424,7 +109,7 @@ func utimensat(fd int, path string, times *[2]Timespec, flag int) (err error) { } func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procfcntl)), 3, uintptr(fd), uintptr(cmd), uintptr(arg), 0, 0, 0) + r0, _, e1 := sysvicall6(procfcntl.Addr(), 3, uintptr(fd), uintptr(cmd), uintptr(arg), 0, 0, 0) val = int(r0) if e1 != 0 { err = e1 @@ -432,16 +117,8 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { return } -func futimesat(fildes int, path *byte, times *[2]Timeval) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procfutimesat)), 3, uintptr(fildes), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times)), 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procaccept)), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) + r0, _, e1 := sysvicall6(procaccept.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) fd = int(r0) if e1 != 0 { err = e1 @@ -449,17 +126,8 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procrecvmsg)), 3, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0) - n = int(r0) - if e1 != 0 { - err = e1 - } - return -} - func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procsendmsg)), 3, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0) + r0, _, e1 := sysvicall6(procsendmsg.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0) n = int(r0) if e1 != 0 { err = e1 @@ -467,29 +135,13 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func acct(path *byte) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procacct)), 1, uintptr(unsafe.Pointer(path)), 0, 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -func ioctl(fd int, req int, arg uintptr) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procAccess)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0) + _, _, e1 := sysvicall6(procAccess.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = e1 @@ -498,7 +150,7 @@ func Access(path string, mode uint32) (err error) { } func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procAdjtime)), 2, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0, 0, 0, 0) + _, _, e1 := sysvicall6(procAdjtime.Addr(), 2, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -511,7 +163,7 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procChdir)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0) + _, _, e1 := sysvicall6(procChdir.Addr(), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = e1 @@ -525,7 +177,7 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procChmod)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0) + _, _, e1 := sysvicall6(procChmod.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = e1 @@ -539,7 +191,7 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procChown)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), 0, 0, 0) + _, _, e1 := sysvicall6(procChown.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), 0, 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = e1 @@ -553,7 +205,7 @@ func Chroot(path string) (err error) { if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procChroot)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0) + _, _, e1 := sysvicall6(procChroot.Addr(), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = e1 @@ -562,22 +214,7 @@ func Chroot(path string) (err error) { } func Close(fd int) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procClose)), 1, uintptr(fd), 0, 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -func Creat(path string, mode uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procCreat)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0) - use(unsafe.Pointer(_p0)) - fd = int(r0) + _, _, e1 := sysvicall6(procClose.Addr(), 1, uintptr(fd), 0, 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -585,7 +222,7 @@ func Creat(path string, mode uint32) (fd int, err error) { } func Dup(fd int) (nfd int, err error) { - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procDup)), 1, uintptr(fd), 0, 0, 0, 0, 0) + r0, _, e1 := sysvicall6(procDup.Addr(), 1, uintptr(fd), 0, 0, 0, 0, 0) nfd = int(r0) if e1 != 0 { err = e1 @@ -593,21 +230,13 @@ func Dup(fd int) (nfd int, err error) { return } -func Dup2(oldfd int, newfd int) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procDup2)), 2, uintptr(oldfd), uintptr(newfd), 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - func Exit(code int) { - sysvicall6(uintptr(unsafe.Pointer(&procExit)), 1, uintptr(code), 0, 0, 0, 0, 0) + sysvicall6(procExit.Addr(), 1, uintptr(code), 0, 0, 0, 0, 0) return } func Fchdir(fd int) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchdir)), 1, uintptr(fd), 0, 0, 0, 0, 0) + _, _, e1 := sysvicall6(procFchdir.Addr(), 1, uintptr(fd), 0, 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -615,21 +244,7 @@ func Fchdir(fd int) (err error) { } func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchmod)), 2, uintptr(fd), uintptr(mode), 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchmodat)), 4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - use(unsafe.Pointer(_p0)) + _, _, e1 := sysvicall6(procFchmod.Addr(), 2, uintptr(fd), uintptr(mode), 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -637,29 +252,7 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { } func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchown)), 3, uintptr(fd), uintptr(uid), uintptr(gid), 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchownat)), 5, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = e1 - } - return -} - -func Fdatasync(fd int) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFdatasync)), 1, uintptr(fd), 0, 0, 0, 0, 0) + _, _, e1 := sysvicall6(procFchown.Addr(), 3, uintptr(fd), uintptr(uid), uintptr(gid), 0, 0, 0) if e1 != 0 { err = e1 } @@ -667,7 +260,7 @@ func Fdatasync(fd int) (err error) { } func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFpathconf)), 2, uintptr(fd), uintptr(name), 0, 0, 0, 0) + r0, _, e1 := sysvicall6(procFpathconf.Addr(), 2, uintptr(fd), uintptr(name), 0, 0, 0, 0) val = int(r0) if e1 != 0 { err = e1 @@ -676,7 +269,7 @@ func Fpathconf(fd int, name int) (val int, err error) { } func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFstat)), 2, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0) + _, _, e1 := sysvicall6(procFstat.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -688,7 +281,7 @@ func Getdents(fd int, buf []byte, basep *uintptr) (n int, err error) { if len(buf) > 0 { _p0 = &buf[0] } - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procGetdents)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + r0, _, e1 := sysvicall6(procGetdents.Addr(), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { err = e1 @@ -697,55 +290,37 @@ func Getdents(fd int, buf []byte, basep *uintptr) (n int, err error) { } func Getgid() (gid int) { - r0, _, _ := rawSysvicall6(uintptr(unsafe.Pointer(&procGetgid)), 0, 0, 0, 0, 0, 0, 0) + r0, _, _ := rawSysvicall6(procGetgid.Addr(), 0, 0, 0, 0, 0, 0, 0) gid = int(r0) return } func Getpid() (pid int) { - r0, _, _ := rawSysvicall6(uintptr(unsafe.Pointer(&procGetpid)), 0, 0, 0, 0, 0, 0, 0) + r0, _, _ := rawSysvicall6(procGetpid.Addr(), 0, 0, 0, 0, 0, 0, 0) pid = int(r0) return } -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetpgid)), 1, uintptr(pid), 0, 0, 0, 0, 0) - pgid = int(r0) - if e1 != 0 { - err = e1 - } - return -} - -func Getpgrp() (pgid int, err error) { - r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetpgrp)), 0, 0, 0, 0, 0, 0, 0) - pgid = int(r0) - if e1 != 0 { - err = e1 - } - return -} - func Geteuid() (euid int) { - r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procGeteuid)), 0, 0, 0, 0, 0, 0, 0) + r0, _, _ := sysvicall6(procGeteuid.Addr(), 0, 0, 0, 0, 0, 0, 0) euid = int(r0) return } func Getegid() (egid int) { - r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procGetegid)), 0, 0, 0, 0, 0, 0, 0) + r0, _, _ := sysvicall6(procGetegid.Addr(), 0, 0, 0, 0, 0, 0, 0) egid = int(r0) return } func Getppid() (ppid int) { - r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procGetppid)), 0, 0, 0, 0, 0, 0, 0) + r0, _, _ := sysvicall6(procGetppid.Addr(), 0, 0, 0, 0, 0, 0, 0) ppid = int(r0) return } func Getpriority(which int, who int) (n int, err error) { - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procGetpriority)), 2, uintptr(which), uintptr(who), 0, 0, 0, 0) + r0, _, e1 := sysvicall6(procGetpriority.Addr(), 2, uintptr(which), uintptr(who), 0, 0, 0, 0) n = int(r0) if e1 != 0 { err = e1 @@ -754,15 +329,7 @@ func Getpriority(which int, who int) (n int, err error) { } func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetrlimit)), 2, uintptr(which), uintptr(unsafe.Pointer(lim)), 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetrusage)), 2, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0, 0, 0, 0) + _, _, e1 := rawSysvicall6(procGetrlimit.Addr(), 2, uintptr(which), uintptr(unsafe.Pointer(lim)), 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -770,7 +337,7 @@ func Getrusage(who int, rusage *Rusage) (err error) { } func Gettimeofday(tv *Timeval) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGettimeofday)), 1, uintptr(unsafe.Pointer(tv)), 0, 0, 0, 0, 0) + _, _, e1 := rawSysvicall6(procGettimeofday.Addr(), 1, uintptr(unsafe.Pointer(tv)), 0, 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -778,13 +345,13 @@ func Gettimeofday(tv *Timeval) (err error) { } func Getuid() (uid int) { - r0, _, _ := rawSysvicall6(uintptr(unsafe.Pointer(&procGetuid)), 0, 0, 0, 0, 0, 0, 0) + r0, _, _ := rawSysvicall6(procGetuid.Addr(), 0, 0, 0, 0, 0, 0, 0) uid = int(r0) return } func Kill(pid int, signum syscall.Signal) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procKill)), 2, uintptr(pid), uintptr(signum), 0, 0, 0, 0) + _, _, e1 := sysvicall6(procKill.Addr(), 2, uintptr(pid), uintptr(signum), 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -797,7 +364,7 @@ func Lchown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procLchown)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), 0, 0, 0) + _, _, e1 := sysvicall6(procLchown.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), 0, 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = e1 @@ -816,7 +383,7 @@ func Link(path string, link string) (err error) { if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procLink)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0) + _, _, e1 := sysvicall6(procLink.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0) use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { @@ -826,7 +393,7 @@ func Link(path string, link string) (err error) { } func Listen(s int, backlog int) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proclisten)), 2, uintptr(s), uintptr(backlog), 0, 0, 0, 0) + _, _, e1 := sysvicall6(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -839,7 +406,7 @@ func Lstat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procLstat)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0) + _, _, e1 := sysvicall6(procLstat.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = e1 @@ -847,67 +414,13 @@ func Lstat(path string, stat *Stat_t) (err error) { return } -func Madvise(b []byte, advice int) (err error) { - var _p0 *byte - if len(b) > 0 { - _p0 = &b[0] - } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMadvise)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(advice), 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - func Mkdir(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMkdir)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = e1 - } - return -} - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMkdirat)), 3, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = e1 - } - return -} - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMkfifo)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = e1 - } - return -} - -func Mkfifoat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMkfifoat)), 3, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0) + _, _, e1 := sysvicall6(procMkdir.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = e1 @@ -921,7 +434,7 @@ func Mknod(path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMknod)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0, 0) + _, _, e1 := sysvicall6(procMknod.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = e1 @@ -929,74 +442,8 @@ func Mknod(path string, mode uint32, dev int) (err error) { return } -func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMknodat)), 4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = e1 - } - return -} - -func Mlock(b []byte) (err error) { - var _p0 *byte - if len(b) > 0 { - _p0 = &b[0] - } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMlock)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -func Mlockall(flags int) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMlockall)), 1, uintptr(flags), 0, 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -func Mprotect(b []byte, prot int) (err error) { - var _p0 *byte - if len(b) > 0 { - _p0 = &b[0] - } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMprotect)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(prot), 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -func Munlock(b []byte) (err error) { - var _p0 *byte - if len(b) > 0 { - _p0 = &b[0] - } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMunlock)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -func Munlockall() (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMunlockall)), 0, 0, 0, 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - func Nanosleep(time *Timespec, leftover *Timespec) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procNanosleep)), 2, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0, 0, 0, 0) + _, _, e1 := sysvicall6(procNanosleep.Addr(), 2, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -1009,22 +456,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procOpen)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0, 0) - use(unsafe.Pointer(_p0)) - fd = int(r0) - if e1 != 0 { - err = e1 - } - return -} - -func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procOpenat)), 4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0) + r0, _, e1 := sysvicall6(procOpen.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0, 0) use(unsafe.Pointer(_p0)) fd = int(r0) if e1 != 0 { @@ -1039,7 +471,7 @@ func Pathconf(path string, name int) (val int, err error) { if err != nil { return } - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procPathconf)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0, 0, 0, 0) + r0, _, e1 := sysvicall6(procPathconf.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0, 0, 0, 0) use(unsafe.Pointer(_p0)) val = int(r0) if e1 != 0 { @@ -1048,20 +480,12 @@ func Pathconf(path string, name int) (val int, err error) { return } -func Pause() (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procPause)), 0, 0, 0, 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 *byte if len(p) > 0 { _p0 = &p[0] } - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procPread)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := sysvicall6(procPread.Addr(), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = e1 @@ -1074,7 +498,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { if len(p) > 0 { _p0 = &p[0] } - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procPwrite)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := sysvicall6(procPwrite.Addr(), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = e1 @@ -1087,7 +511,7 @@ func read(fd int, p []byte) (n int, err error) { if len(p) > 0 { _p0 = &p[0] } - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procread)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0, 0, 0) + r0, _, e1 := sysvicall6(procread.Addr(), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0, 0, 0) n = int(r0) if e1 != 0 { err = e1 @@ -1105,7 +529,7 @@ func Readlink(path string, buf []byte) (n int, err error) { if len(buf) > 0 { _p1 = &buf[0] } - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procReadlink)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(len(buf)), 0, 0, 0) + r0, _, e1 := sysvicall6(procReadlink.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(len(buf)), 0, 0, 0) use(unsafe.Pointer(_p0)) n = int(r0) if e1 != 0 { @@ -1125,27 +549,7 @@ func Rename(from string, to string) (err error) { if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procRename)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = e1 - } - return -} - -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procRenameat)), 4, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + _, _, e1 := sysvicall6(procRename.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0) use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { @@ -1160,7 +564,7 @@ func Rmdir(path string) (err error) { if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procRmdir)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0) + _, _, e1 := sysvicall6(procRmdir.Addr(), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = e1 @@ -1169,7 +573,7 @@ func Rmdir(path string) (err error) { } func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proclseek)), 3, uintptr(fd), uintptr(offset), uintptr(whence), 0, 0, 0) + r0, _, e1 := sysvicall6(proclseek.Addr(), 3, uintptr(fd), uintptr(offset), uintptr(whence), 0, 0, 0) newoffset = int64(r0) if e1 != 0 { err = e1 @@ -1178,7 +582,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { } func Setegid(egid int) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetegid)), 1, uintptr(egid), 0, 0, 0, 0, 0) + _, _, e1 := rawSysvicall6(procSetegid.Addr(), 1, uintptr(egid), 0, 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -1186,7 +590,7 @@ func Setegid(egid int) (err error) { } func Seteuid(euid int) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSeteuid)), 1, uintptr(euid), 0, 0, 0, 0, 0) + _, _, e1 := rawSysvicall6(procSeteuid.Addr(), 1, uintptr(euid), 0, 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -1194,19 +598,7 @@ func Seteuid(euid int) (err error) { } func Setgid(gid int) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetgid)), 1, uintptr(gid), 0, 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -func Sethostname(p []byte) (err error) { - var _p0 *byte - if len(p) > 0 { - _p0 = &p[0] - } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSethostname)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0, 0, 0, 0) + _, _, e1 := rawSysvicall6(procSetgid.Addr(), 1, uintptr(gid), 0, 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -1214,7 +606,7 @@ func Sethostname(p []byte) (err error) { } func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetpgid)), 2, uintptr(pid), uintptr(pgid), 0, 0, 0, 0) + _, _, e1 := rawSysvicall6(procSetpgid.Addr(), 2, uintptr(pid), uintptr(pgid), 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -1222,7 +614,7 @@ func Setpgid(pid int, pgid int) (err error) { } func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSetpriority)), 3, uintptr(which), uintptr(who), uintptr(prio), 0, 0, 0) + _, _, e1 := sysvicall6(procSetpriority.Addr(), 3, uintptr(which), uintptr(who), uintptr(prio), 0, 0, 0) if e1 != 0 { err = e1 } @@ -1230,7 +622,7 @@ func Setpriority(which int, who int, prio int) (err error) { } func Setregid(rgid int, egid int) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetregid)), 2, uintptr(rgid), uintptr(egid), 0, 0, 0, 0) + _, _, e1 := rawSysvicall6(procSetregid.Addr(), 2, uintptr(rgid), uintptr(egid), 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -1238,7 +630,7 @@ func Setregid(rgid int, egid int) (err error) { } func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetreuid)), 2, uintptr(ruid), uintptr(euid), 0, 0, 0, 0) + _, _, e1 := rawSysvicall6(procSetreuid.Addr(), 2, uintptr(ruid), uintptr(euid), 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -1246,7 +638,7 @@ func Setreuid(ruid int, euid int) (err error) { } func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetrlimit)), 2, uintptr(which), uintptr(unsafe.Pointer(lim)), 0, 0, 0, 0) + _, _, e1 := rawSysvicall6(procSetrlimit.Addr(), 2, uintptr(which), uintptr(unsafe.Pointer(lim)), 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -1254,7 +646,7 @@ func Setrlimit(which int, lim *Rlimit) (err error) { } func Setsid() (pid int, err error) { - r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetsid)), 0, 0, 0, 0, 0, 0, 0) + r0, _, e1 := rawSysvicall6(procSetsid.Addr(), 0, 0, 0, 0, 0, 0, 0) pid = int(r0) if e1 != 0 { err = e1 @@ -1263,7 +655,7 @@ func Setsid() (pid int, err error) { } func Setuid(uid int) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetuid)), 1, uintptr(uid), 0, 0, 0, 0, 0) + _, _, e1 := rawSysvicall6(procSetuid.Addr(), 1, uintptr(uid), 0, 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -1271,7 +663,7 @@ func Setuid(uid int) (err error) { } func Shutdown(s int, how int) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procshutdown)), 2, uintptr(s), uintptr(how), 0, 0, 0, 0) + _, _, e1 := sysvicall6(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -1284,7 +676,7 @@ func Stat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procStat)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0) + _, _, e1 := sysvicall6(procStat.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = e1 @@ -1303,7 +695,7 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSymlink)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0) + _, _, e1 := sysvicall6(procSymlink.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0) use(unsafe.Pointer(_p0)) use(unsafe.Pointer(_p1)) if e1 != 0 { @@ -1313,16 +705,7 @@ func Symlink(path string, link string) (err error) { } func Sync() (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSync)), 0, 0, 0, 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -func Times(tms *Tms) (ticks uintptr, err error) { - r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procTimes)), 1, uintptr(unsafe.Pointer(tms)), 0, 0, 0, 0, 0) - ticks = uintptr(r0) + _, _, e1 := sysvicall6(procSync.Addr(), 0, 0, 0, 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -1335,7 +718,7 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procTruncate)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0, 0, 0, 0) + _, _, e1 := sysvicall6(procTruncate.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0, 0, 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = e1 @@ -1344,7 +727,7 @@ func Truncate(path string, length int64) (err error) { } func Fsync(fd int) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFsync)), 1, uintptr(fd), 0, 0, 0, 0, 0) + _, _, e1 := sysvicall6(procFsync.Addr(), 1, uintptr(fd), 0, 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -1352,48 +735,26 @@ func Fsync(fd int) (err error) { } func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFtruncate)), 2, uintptr(fd), uintptr(length), 0, 0, 0, 0) + _, _, e1 := sysvicall6(procFtruncate.Addr(), 2, uintptr(fd), uintptr(length), 0, 0, 0, 0) if e1 != 0 { err = e1 } return } -func Umask(mask int) (oldmask int) { - r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procUmask)), 1, uintptr(mask), 0, 0, 0, 0, 0) +func Umask(newmask int) (oldmask int) { + r0, _, _ := sysvicall6(procUmask.Addr(), 1, uintptr(newmask), 0, 0, 0, 0, 0) oldmask = int(r0) return } -func Uname(buf *Utsname) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procUname)), 1, uintptr(unsafe.Pointer(buf)), 0, 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -func Unmount(target string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(target) - if err != nil { - return - } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procumount)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0, 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = e1 - } - return -} - func Unlink(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUnlink)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0) + _, _, e1 := sysvicall6(procUnlink.Addr(), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = e1 @@ -1401,35 +762,13 @@ func Unlink(path string) (err error) { return } -func Unlinkat(dirfd int, path string, flags int) (err error) { +func Utimes(path string, times *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUnlinkat)), 3, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = e1 - } - return -} - -func Ustat(dev int, ubuf *Ustat_t) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUstat)), 2, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -func Utime(path string, buf *Utimbuf) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUtime)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0, 0, 0, 0) + _, _, e1 := sysvicall6(procUtimes.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0, 0, 0, 0) use(unsafe.Pointer(_p0)) if e1 != 0 { err = e1 @@ -1438,7 +777,7 @@ func Utime(path string, buf *Utimbuf) (err error) { } func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procbind)), 3, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0) + _, _, e1 := sysvicall6(procbind.Addr(), 3, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0) if e1 != 0 { err = e1 } @@ -1446,7 +785,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { } func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procconnect)), 3, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0) + _, _, e1 := sysvicall6(procconnect.Addr(), 3, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0) if e1 != 0 { err = e1 } @@ -1454,7 +793,7 @@ func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { } func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procmmap)), 6, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + r0, _, e1 := sysvicall6(procmmap.Addr(), 6, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) if e1 != 0 { err = e1 @@ -1463,7 +802,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( } func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procmunmap)), 2, uintptr(addr), uintptr(length), 0, 0, 0, 0) + _, _, e1 := sysvicall6(procmunmap.Addr(), 2, uintptr(addr), uintptr(length), 0, 0, 0, 0) if e1 != 0 { err = e1 } @@ -1475,7 +814,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( if len(buf) > 0 { _p0 = &buf[0] } - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procsendto)), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + _, _, e1 := sysvicall6(procsendto.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = e1 } @@ -1483,7 +822,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procsocket)), 3, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0) + r0, _, e1 := sysvicall6(procsocket.Addr(), 3, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0) fd = int(r0) if e1 != 0 { err = e1 @@ -1492,7 +831,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { } func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procsocketpair)), 4, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + _, _, e1 := rawSysvicall6(procsocketpair.Addr(), 4, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = e1 } @@ -1504,7 +843,7 @@ func write(fd int, p []byte) (n int, err error) { if len(p) > 0 { _p0 = &p[0] } - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwrite)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0, 0, 0) + r0, _, e1 := sysvicall6(procwrite.Addr(), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0, 0, 0) n = int(r0) if e1 != 0 { err = e1 @@ -1513,7 +852,7 @@ func write(fd int, p []byte) (n int, err error) { } func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetsockopt)), 5, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + _, _, e1 := sysvicall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = e1 } @@ -1521,7 +860,15 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen } func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procgetpeername)), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) + _, _, e1 := rawSysvicall6(procgetpeername.Addr(), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) + if e1 != 0 { + err = e1 + } + return +} + +func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := sysvicall6(procgetsockname.Addr(), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) if e1 != 0 { err = e1 } @@ -1529,7 +876,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { } func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procsetsockopt)), 5, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + _, _, e1 := sysvicall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = e1 } @@ -1541,7 +888,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl if len(p) > 0 { _p0 = &p[0] } - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procrecvfrom)), 6, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := sysvicall6(procrecvfrom.Addr(), 6, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = e1 @@ -1549,9 +896,9 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl return } -func sysconf(name int) (n int64, err error) { - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procsysconf)), 1, uintptr(name), 0, 0, 0, 0, 0) - n = int64(r0) +func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := sysvicall6(procrecvmsg.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0) + n = int(r0) if e1 != 0 { err = e1 } diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go index 2786773ba3..645426a8d5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go @@ -1,8 +1,6 @@ -// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/sys/syscall.h +// mksysnum_darwin.pl /usr/include/sys/unix.h // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT -// +build 386,darwin - package unix const ( @@ -42,6 +40,7 @@ const ( SYS_DUP = 41 SYS_PIPE = 42 SYS_GETEGID = 43 + SYS_PROFIL = 44 SYS_SIGACTION = 46 SYS_GETGID = 47 SYS_SIGPROCMASK = 48 @@ -119,9 +118,8 @@ const ( SYS_QUOTACTL = 165 SYS_MOUNT = 167 SYS_CSOPS = 169 - SYS_CSOPS_AUDITTOKEN = 170 SYS_WAITID = 173 - SYS_KDEBUG_TRACE64 = 179 + SYS_ADD_PROFIL = 176 SYS_KDEBUG_TRACE = 180 SYS_SETGID = 181 SYS_SETEGID = 182 @@ -141,11 +139,21 @@ const ( SYS_LSEEK = 199 SYS_TRUNCATE = 200 SYS_FTRUNCATE = 201 - SYS_SYSCTL = 202 + SYS___SYSCTL = 202 SYS_MLOCK = 203 SYS_MUNLOCK = 204 SYS_UNDELETE = 205 - SYS_OPEN_DPROTECTED_NP = 216 + SYS_ATSOCKET = 206 + SYS_ATGETMSG = 207 + SYS_ATPUTMSG = 208 + SYS_ATPSNDREQ = 209 + SYS_ATPSNDRSP = 210 + SYS_ATPGETREQ = 211 + SYS_ATPGETRSP = 212 + SYS_MKCOMPLEX = 216 + SYS_STATV = 217 + SYS_LSTATV = 218 + SYS_FSTATV = 219 SYS_GETATTRLIST = 220 SYS_SETATTRLIST = 221 SYS_GETDIRENTRIESATTR = 222 @@ -196,7 +204,9 @@ const ( SYS_SEM_WAIT = 271 SYS_SEM_TRYWAIT = 272 SYS_SEM_POST = 273 - SYS_SYSCTLBYNAME = 274 + SYS_SEM_GETVALUE = 274 + SYS_SEM_INIT = 275 + SYS_SEM_DESTROY = 276 SYS_OPEN_EXTENDED = 277 SYS_UMASK_EXTENDED = 278 SYS_STAT_EXTENDED = 279 @@ -270,6 +280,8 @@ const ( SYS_AUDITON = 351 SYS_GETAUID = 353 SYS_SETAUID = 354 + SYS_GETAUDIT = 355 + SYS_SETAUDIT = 356 SYS_GETAUDIT_ADDR = 357 SYS_SETAUDIT_ADDR = 358 SYS_AUDITCTL = 359 @@ -286,7 +298,6 @@ const ( SYS___OLD_SEMWAIT_SIGNAL = 370 SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 SYS_THREAD_SELFID = 372 - SYS_LEDGER = 373 SYS___MAC_EXECVE = 380 SYS___MAC_SYSCALL = 381 SYS___MAC_GET_FILE = 382 @@ -345,54 +356,5 @@ const ( SYS_PID_HIBERNATE = 435 SYS_PID_SHUTDOWN_SOCKETS = 436 SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438 - SYS_KAS_INFO = 439 - SYS_MEMORYSTATUS_CONTROL = 440 - SYS_GUARDED_OPEN_NP = 441 - SYS_GUARDED_CLOSE_NP = 442 - SYS_GUARDED_KQUEUE_NP = 443 - SYS_CHANGE_FDGUARD_NP = 444 - SYS_PROC_RLIMIT_CONTROL = 446 - SYS_CONNECTX = 447 - SYS_DISCONNECTX = 448 - SYS_PEELOFF = 449 - SYS_SOCKET_DELEGATE = 450 - SYS_TELEMETRY = 451 - SYS_PROC_UUID_POLICY = 452 - SYS_MEMORYSTATUS_GET_LEVEL = 453 - SYS_SYSTEM_OVERRIDE = 454 - SYS_VFS_PURGE = 455 - SYS_SFI_CTL = 456 - SYS_SFI_PIDCTL = 457 - SYS_COALITION = 458 - SYS_COALITION_INFO = 459 - SYS_NECP_MATCH_POLICY = 460 - SYS_GETATTRLISTBULK = 461 - SYS_OPENAT = 463 - SYS_OPENAT_NOCANCEL = 464 - SYS_RENAMEAT = 465 - SYS_FACCESSAT = 466 - SYS_FCHMODAT = 467 - SYS_FCHOWNAT = 468 - SYS_FSTATAT = 469 - SYS_FSTATAT64 = 470 - SYS_LINKAT = 471 - SYS_UNLINKAT = 472 - SYS_READLINKAT = 473 - SYS_SYMLINKAT = 474 - SYS_MKDIRAT = 475 - SYS_GETATTRLISTAT = 476 - SYS_PROC_TRACE_LOG = 477 - SYS_BSDTHREAD_CTL = 478 - SYS_OPENBYID_NP = 479 - SYS_RECVMSG_X = 480 - SYS_SENDMSG_X = 481 - SYS_THREAD_SELFUSAGE = 482 - SYS_CSRCTL = 483 - SYS_GUARDED_OPEN_DPROTECTED_NP = 484 - SYS_GUARDED_WRITE_NP = 485 - SYS_GUARDED_PWRITE_NP = 486 - SYS_GUARDED_WRITEV_NP = 487 - SYS_RENAME_EXT = 488 - SYS_MREMAP_ENCRYPTED = 489 - SYS_MAXSYSCALL = 490 + SYS_MAXSYSCALL = 439 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go index 09de240c8f..645426a8d5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go @@ -1,8 +1,6 @@ -// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/sys/syscall.h +// mksysnum_darwin.pl /usr/include/sys/unix.h // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT -// +build amd64,darwin - package unix const ( @@ -42,6 +40,7 @@ const ( SYS_DUP = 41 SYS_PIPE = 42 SYS_GETEGID = 43 + SYS_PROFIL = 44 SYS_SIGACTION = 46 SYS_GETGID = 47 SYS_SIGPROCMASK = 48 @@ -119,9 +118,8 @@ const ( SYS_QUOTACTL = 165 SYS_MOUNT = 167 SYS_CSOPS = 169 - SYS_CSOPS_AUDITTOKEN = 170 SYS_WAITID = 173 - SYS_KDEBUG_TRACE64 = 179 + SYS_ADD_PROFIL = 176 SYS_KDEBUG_TRACE = 180 SYS_SETGID = 181 SYS_SETEGID = 182 @@ -141,11 +139,21 @@ const ( SYS_LSEEK = 199 SYS_TRUNCATE = 200 SYS_FTRUNCATE = 201 - SYS_SYSCTL = 202 + SYS___SYSCTL = 202 SYS_MLOCK = 203 SYS_MUNLOCK = 204 SYS_UNDELETE = 205 - SYS_OPEN_DPROTECTED_NP = 216 + SYS_ATSOCKET = 206 + SYS_ATGETMSG = 207 + SYS_ATPUTMSG = 208 + SYS_ATPSNDREQ = 209 + SYS_ATPSNDRSP = 210 + SYS_ATPGETREQ = 211 + SYS_ATPGETRSP = 212 + SYS_MKCOMPLEX = 216 + SYS_STATV = 217 + SYS_LSTATV = 218 + SYS_FSTATV = 219 SYS_GETATTRLIST = 220 SYS_SETATTRLIST = 221 SYS_GETDIRENTRIESATTR = 222 @@ -196,7 +204,9 @@ const ( SYS_SEM_WAIT = 271 SYS_SEM_TRYWAIT = 272 SYS_SEM_POST = 273 - SYS_SYSCTLBYNAME = 274 + SYS_SEM_GETVALUE = 274 + SYS_SEM_INIT = 275 + SYS_SEM_DESTROY = 276 SYS_OPEN_EXTENDED = 277 SYS_UMASK_EXTENDED = 278 SYS_STAT_EXTENDED = 279 @@ -270,6 +280,8 @@ const ( SYS_AUDITON = 351 SYS_GETAUID = 353 SYS_SETAUID = 354 + SYS_GETAUDIT = 355 + SYS_SETAUDIT = 356 SYS_GETAUDIT_ADDR = 357 SYS_SETAUDIT_ADDR = 358 SYS_AUDITCTL = 359 @@ -286,7 +298,6 @@ const ( SYS___OLD_SEMWAIT_SIGNAL = 370 SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 SYS_THREAD_SELFID = 372 - SYS_LEDGER = 373 SYS___MAC_EXECVE = 380 SYS___MAC_SYSCALL = 381 SYS___MAC_GET_FILE = 382 @@ -345,54 +356,5 @@ const ( SYS_PID_HIBERNATE = 435 SYS_PID_SHUTDOWN_SOCKETS = 436 SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438 - SYS_KAS_INFO = 439 - SYS_MEMORYSTATUS_CONTROL = 440 - SYS_GUARDED_OPEN_NP = 441 - SYS_GUARDED_CLOSE_NP = 442 - SYS_GUARDED_KQUEUE_NP = 443 - SYS_CHANGE_FDGUARD_NP = 444 - SYS_PROC_RLIMIT_CONTROL = 446 - SYS_CONNECTX = 447 - SYS_DISCONNECTX = 448 - SYS_PEELOFF = 449 - SYS_SOCKET_DELEGATE = 450 - SYS_TELEMETRY = 451 - SYS_PROC_UUID_POLICY = 452 - SYS_MEMORYSTATUS_GET_LEVEL = 453 - SYS_SYSTEM_OVERRIDE = 454 - SYS_VFS_PURGE = 455 - SYS_SFI_CTL = 456 - SYS_SFI_PIDCTL = 457 - SYS_COALITION = 458 - SYS_COALITION_INFO = 459 - SYS_NECP_MATCH_POLICY = 460 - SYS_GETATTRLISTBULK = 461 - SYS_OPENAT = 463 - SYS_OPENAT_NOCANCEL = 464 - SYS_RENAMEAT = 465 - SYS_FACCESSAT = 466 - SYS_FCHMODAT = 467 - SYS_FCHOWNAT = 468 - SYS_FSTATAT = 469 - SYS_FSTATAT64 = 470 - SYS_LINKAT = 471 - SYS_UNLINKAT = 472 - SYS_READLINKAT = 473 - SYS_SYMLINKAT = 474 - SYS_MKDIRAT = 475 - SYS_GETATTRLISTAT = 476 - SYS_PROC_TRACE_LOG = 477 - SYS_BSDTHREAD_CTL = 478 - SYS_OPENBYID_NP = 479 - SYS_RECVMSG_X = 480 - SYS_SENDMSG_X = 481 - SYS_THREAD_SELFUSAGE = 482 - SYS_CSRCTL = 483 - SYS_GUARDED_OPEN_DPROTECTED_NP = 484 - SYS_GUARDED_WRITE_NP = 485 - SYS_GUARDED_PWRITE_NP = 486 - SYS_GUARDED_WRITEV_NP = 487 - SYS_RENAME_EXT = 488 - SYS_MREMAP_ENCRYPTED = 489 - SYS_MAXSYSCALL = 490 + SYS_MAXSYSCALL = 439 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go deleted file mode 100644 index b8c9aea852..0000000000 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go +++ /dev/null @@ -1,358 +0,0 @@ -// mksysnum_darwin.pl /usr/include/sys/syscall.h -// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT - -// +build arm,darwin - -package unix - -const ( - SYS_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAIT4 = 7 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_CHDIR = 12 - SYS_FCHDIR = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_CHOWN = 16 - SYS_GETFSSTAT = 18 - SYS_GETPID = 20 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_GETEUID = 25 - SYS_PTRACE = 26 - SYS_RECVMSG = 27 - SYS_SENDMSG = 28 - SYS_RECVFROM = 29 - SYS_ACCEPT = 30 - SYS_GETPEERNAME = 31 - SYS_GETSOCKNAME = 32 - SYS_ACCESS = 33 - SYS_CHFLAGS = 34 - SYS_FCHFLAGS = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_GETPPID = 39 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_GETEGID = 43 - SYS_SIGACTION = 46 - SYS_GETGID = 47 - SYS_SIGPROCMASK = 48 - SYS_GETLOGIN = 49 - SYS_SETLOGIN = 50 - SYS_ACCT = 51 - SYS_SIGPENDING = 52 - SYS_SIGALTSTACK = 53 - SYS_IOCTL = 54 - SYS_REBOOT = 55 - SYS_REVOKE = 56 - SYS_SYMLINK = 57 - SYS_READLINK = 58 - SYS_EXECVE = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_MSYNC = 65 - SYS_VFORK = 66 - SYS_MUNMAP = 73 - SYS_MPROTECT = 74 - SYS_MADVISE = 75 - SYS_MINCORE = 78 - SYS_GETGROUPS = 79 - SYS_SETGROUPS = 80 - SYS_GETPGRP = 81 - SYS_SETPGID = 82 - SYS_SETITIMER = 83 - SYS_SWAPON = 85 - SYS_GETITIMER = 86 - SYS_GETDTABLESIZE = 89 - SYS_DUP2 = 90 - SYS_FCNTL = 92 - SYS_SELECT = 93 - SYS_FSYNC = 95 - SYS_SETPRIORITY = 96 - SYS_SOCKET = 97 - SYS_CONNECT = 98 - SYS_GETPRIORITY = 100 - SYS_BIND = 104 - SYS_SETSOCKOPT = 105 - SYS_LISTEN = 106 - SYS_SIGSUSPEND = 111 - SYS_GETTIMEOFDAY = 116 - SYS_GETRUSAGE = 117 - SYS_GETSOCKOPT = 118 - SYS_READV = 120 - SYS_WRITEV = 121 - SYS_SETTIMEOFDAY = 122 - SYS_FCHOWN = 123 - SYS_FCHMOD = 124 - SYS_SETREUID = 126 - SYS_SETREGID = 127 - SYS_RENAME = 128 - SYS_FLOCK = 131 - SYS_MKFIFO = 132 - SYS_SENDTO = 133 - SYS_SHUTDOWN = 134 - SYS_SOCKETPAIR = 135 - SYS_MKDIR = 136 - SYS_RMDIR = 137 - SYS_UTIMES = 138 - SYS_FUTIMES = 139 - SYS_ADJTIME = 140 - SYS_GETHOSTUUID = 142 - SYS_SETSID = 147 - SYS_GETPGID = 151 - SYS_SETPRIVEXEC = 152 - SYS_PREAD = 153 - SYS_PWRITE = 154 - SYS_NFSSVC = 155 - SYS_STATFS = 157 - SYS_FSTATFS = 158 - SYS_UNMOUNT = 159 - SYS_GETFH = 161 - SYS_QUOTACTL = 165 - SYS_MOUNT = 167 - SYS_CSOPS = 169 - SYS_CSOPS_AUDITTOKEN = 170 - SYS_WAITID = 173 - SYS_KDEBUG_TRACE = 180 - SYS_SETGID = 181 - SYS_SETEGID = 182 - SYS_SETEUID = 183 - SYS_SIGRETURN = 184 - SYS_CHUD = 185 - SYS_FDATASYNC = 187 - SYS_STAT = 188 - SYS_FSTAT = 189 - SYS_LSTAT = 190 - SYS_PATHCONF = 191 - SYS_FPATHCONF = 192 - SYS_GETRLIMIT = 194 - SYS_SETRLIMIT = 195 - SYS_GETDIRENTRIES = 196 - SYS_MMAP = 197 - SYS_LSEEK = 199 - SYS_TRUNCATE = 200 - SYS_FTRUNCATE = 201 - SYS___SYSCTL = 202 - SYS_MLOCK = 203 - SYS_MUNLOCK = 204 - SYS_UNDELETE = 205 - SYS_ATSOCKET = 206 - SYS_ATGETMSG = 207 - SYS_ATPUTMSG = 208 - SYS_ATPSNDREQ = 209 - SYS_ATPSNDRSP = 210 - SYS_ATPGETREQ = 211 - SYS_ATPGETRSP = 212 - SYS_OPEN_DPROTECTED_NP = 216 - SYS_GETATTRLIST = 220 - SYS_SETATTRLIST = 221 - SYS_GETDIRENTRIESATTR = 222 - SYS_EXCHANGEDATA = 223 - SYS_SEARCHFS = 225 - SYS_DELETE = 226 - SYS_COPYFILE = 227 - SYS_FGETATTRLIST = 228 - SYS_FSETATTRLIST = 229 - SYS_POLL = 230 - SYS_WATCHEVENT = 231 - SYS_WAITEVENT = 232 - SYS_MODWATCH = 233 - SYS_GETXATTR = 234 - SYS_FGETXATTR = 235 - SYS_SETXATTR = 236 - SYS_FSETXATTR = 237 - SYS_REMOVEXATTR = 238 - SYS_FREMOVEXATTR = 239 - SYS_LISTXATTR = 240 - SYS_FLISTXATTR = 241 - SYS_FSCTL = 242 - SYS_INITGROUPS = 243 - SYS_POSIX_SPAWN = 244 - SYS_FFSCTL = 245 - SYS_NFSCLNT = 247 - SYS_FHOPEN = 248 - SYS_MINHERIT = 250 - SYS_SEMSYS = 251 - SYS_MSGSYS = 252 - SYS_SHMSYS = 253 - SYS_SEMCTL = 254 - SYS_SEMGET = 255 - SYS_SEMOP = 256 - SYS_MSGCTL = 258 - SYS_MSGGET = 259 - SYS_MSGSND = 260 - SYS_MSGRCV = 261 - SYS_SHMAT = 262 - SYS_SHMCTL = 263 - SYS_SHMDT = 264 - SYS_SHMGET = 265 - SYS_SHM_OPEN = 266 - SYS_SHM_UNLINK = 267 - SYS_SEM_OPEN = 268 - SYS_SEM_CLOSE = 269 - SYS_SEM_UNLINK = 270 - SYS_SEM_WAIT = 271 - SYS_SEM_TRYWAIT = 272 - SYS_SEM_POST = 273 - SYS_SEM_GETVALUE = 274 - SYS_SEM_INIT = 275 - SYS_SEM_DESTROY = 276 - SYS_OPEN_EXTENDED = 277 - SYS_UMASK_EXTENDED = 278 - SYS_STAT_EXTENDED = 279 - SYS_LSTAT_EXTENDED = 280 - SYS_FSTAT_EXTENDED = 281 - SYS_CHMOD_EXTENDED = 282 - SYS_FCHMOD_EXTENDED = 283 - SYS_ACCESS_EXTENDED = 284 - SYS_SETTID = 285 - SYS_GETTID = 286 - SYS_SETSGROUPS = 287 - SYS_GETSGROUPS = 288 - SYS_SETWGROUPS = 289 - SYS_GETWGROUPS = 290 - SYS_MKFIFO_EXTENDED = 291 - SYS_MKDIR_EXTENDED = 292 - SYS_IDENTITYSVC = 293 - SYS_SHARED_REGION_CHECK_NP = 294 - SYS_VM_PRESSURE_MONITOR = 296 - SYS_PSYNCH_RW_LONGRDLOCK = 297 - SYS_PSYNCH_RW_YIELDWRLOCK = 298 - SYS_PSYNCH_RW_DOWNGRADE = 299 - SYS_PSYNCH_RW_UPGRADE = 300 - SYS_PSYNCH_MUTEXWAIT = 301 - SYS_PSYNCH_MUTEXDROP = 302 - SYS_PSYNCH_CVBROAD = 303 - SYS_PSYNCH_CVSIGNAL = 304 - SYS_PSYNCH_CVWAIT = 305 - SYS_PSYNCH_RW_RDLOCK = 306 - SYS_PSYNCH_RW_WRLOCK = 307 - SYS_PSYNCH_RW_UNLOCK = 308 - SYS_PSYNCH_RW_UNLOCK2 = 309 - SYS_GETSID = 310 - SYS_SETTID_WITH_PID = 311 - SYS_PSYNCH_CVCLRPREPOST = 312 - SYS_AIO_FSYNC = 313 - SYS_AIO_RETURN = 314 - SYS_AIO_SUSPEND = 315 - SYS_AIO_CANCEL = 316 - SYS_AIO_ERROR = 317 - SYS_AIO_READ = 318 - SYS_AIO_WRITE = 319 - SYS_LIO_LISTIO = 320 - SYS_IOPOLICYSYS = 322 - SYS_PROCESS_POLICY = 323 - SYS_MLOCKALL = 324 - SYS_MUNLOCKALL = 325 - SYS_ISSETUGID = 327 - SYS___PTHREAD_KILL = 328 - SYS___PTHREAD_SIGMASK = 329 - SYS___SIGWAIT = 330 - SYS___DISABLE_THREADSIGNAL = 331 - SYS___PTHREAD_MARKCANCEL = 332 - SYS___PTHREAD_CANCELED = 333 - SYS___SEMWAIT_SIGNAL = 334 - SYS_PROC_INFO = 336 - SYS_SENDFILE = 337 - SYS_STAT64 = 338 - SYS_FSTAT64 = 339 - SYS_LSTAT64 = 340 - SYS_STAT64_EXTENDED = 341 - SYS_LSTAT64_EXTENDED = 342 - SYS_FSTAT64_EXTENDED = 343 - SYS_GETDIRENTRIES64 = 344 - SYS_STATFS64 = 345 - SYS_FSTATFS64 = 346 - SYS_GETFSSTAT64 = 347 - SYS___PTHREAD_CHDIR = 348 - SYS___PTHREAD_FCHDIR = 349 - SYS_AUDIT = 350 - SYS_AUDITON = 351 - SYS_GETAUID = 353 - SYS_SETAUID = 354 - SYS_GETAUDIT_ADDR = 357 - SYS_SETAUDIT_ADDR = 358 - SYS_AUDITCTL = 359 - SYS_BSDTHREAD_CREATE = 360 - SYS_BSDTHREAD_TERMINATE = 361 - SYS_KQUEUE = 362 - SYS_KEVENT = 363 - SYS_LCHOWN = 364 - SYS_STACK_SNAPSHOT = 365 - SYS_BSDTHREAD_REGISTER = 366 - SYS_WORKQ_OPEN = 367 - SYS_WORKQ_KERNRETURN = 368 - SYS_KEVENT64 = 369 - SYS___OLD_SEMWAIT_SIGNAL = 370 - SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 - SYS_THREAD_SELFID = 372 - SYS_LEDGER = 373 - SYS___MAC_EXECVE = 380 - SYS___MAC_SYSCALL = 381 - SYS___MAC_GET_FILE = 382 - SYS___MAC_SET_FILE = 383 - SYS___MAC_GET_LINK = 384 - SYS___MAC_SET_LINK = 385 - SYS___MAC_GET_PROC = 386 - SYS___MAC_SET_PROC = 387 - SYS___MAC_GET_FD = 388 - SYS___MAC_SET_FD = 389 - SYS___MAC_GET_PID = 390 - SYS___MAC_GET_LCID = 391 - SYS___MAC_GET_LCTX = 392 - SYS___MAC_SET_LCTX = 393 - SYS_SETLCID = 394 - SYS_GETLCID = 395 - SYS_READ_NOCANCEL = 396 - SYS_WRITE_NOCANCEL = 397 - SYS_OPEN_NOCANCEL = 398 - SYS_CLOSE_NOCANCEL = 399 - SYS_WAIT4_NOCANCEL = 400 - SYS_RECVMSG_NOCANCEL = 401 - SYS_SENDMSG_NOCANCEL = 402 - SYS_RECVFROM_NOCANCEL = 403 - SYS_ACCEPT_NOCANCEL = 404 - SYS_MSYNC_NOCANCEL = 405 - SYS_FCNTL_NOCANCEL = 406 - SYS_SELECT_NOCANCEL = 407 - SYS_FSYNC_NOCANCEL = 408 - SYS_CONNECT_NOCANCEL = 409 - SYS_SIGSUSPEND_NOCANCEL = 410 - SYS_READV_NOCANCEL = 411 - SYS_WRITEV_NOCANCEL = 412 - SYS_SENDTO_NOCANCEL = 413 - SYS_PREAD_NOCANCEL = 414 - SYS_PWRITE_NOCANCEL = 415 - SYS_WAITID_NOCANCEL = 416 - SYS_POLL_NOCANCEL = 417 - SYS_MSGSND_NOCANCEL = 418 - SYS_MSGRCV_NOCANCEL = 419 - SYS_SEM_WAIT_NOCANCEL = 420 - SYS_AIO_SUSPEND_NOCANCEL = 421 - SYS___SIGWAIT_NOCANCEL = 422 - SYS___SEMWAIT_SIGNAL_NOCANCEL = 423 - SYS___MAC_MOUNT = 424 - SYS___MAC_GET_MOUNT = 425 - SYS___MAC_GETFSSTAT = 426 - SYS_FSGETPATH = 427 - SYS_AUDIT_SESSION_SELF = 428 - SYS_AUDIT_SESSION_JOIN = 429 - SYS_FILEPORT_MAKEPORT = 430 - SYS_FILEPORT_MAKEFD = 431 - SYS_AUDIT_SESSION_PORT = 432 - SYS_PID_SUSPEND = 433 - SYS_PID_RESUME = 434 - SYS_PID_HIBERNATE = 435 - SYS_PID_SHUTDOWN_SOCKETS = 436 - SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438 - SYS_KAS_INFO = 439 - SYS_MAXSYSCALL = 440 -) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go deleted file mode 100644 index 26677ebbf5..0000000000 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go +++ /dev/null @@ -1,398 +0,0 @@ -// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/usr/include/sys/syscall.h -// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT - -// +build arm64,darwin - -package unix - -const ( - SYS_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAIT4 = 7 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_CHDIR = 12 - SYS_FCHDIR = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_CHOWN = 16 - SYS_GETFSSTAT = 18 - SYS_GETPID = 20 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_GETEUID = 25 - SYS_PTRACE = 26 - SYS_RECVMSG = 27 - SYS_SENDMSG = 28 - SYS_RECVFROM = 29 - SYS_ACCEPT = 30 - SYS_GETPEERNAME = 31 - SYS_GETSOCKNAME = 32 - SYS_ACCESS = 33 - SYS_CHFLAGS = 34 - SYS_FCHFLAGS = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_GETPPID = 39 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_GETEGID = 43 - SYS_SIGACTION = 46 - SYS_GETGID = 47 - SYS_SIGPROCMASK = 48 - SYS_GETLOGIN = 49 - SYS_SETLOGIN = 50 - SYS_ACCT = 51 - SYS_SIGPENDING = 52 - SYS_SIGALTSTACK = 53 - SYS_IOCTL = 54 - SYS_REBOOT = 55 - SYS_REVOKE = 56 - SYS_SYMLINK = 57 - SYS_READLINK = 58 - SYS_EXECVE = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_MSYNC = 65 - SYS_VFORK = 66 - SYS_MUNMAP = 73 - SYS_MPROTECT = 74 - SYS_MADVISE = 75 - SYS_MINCORE = 78 - SYS_GETGROUPS = 79 - SYS_SETGROUPS = 80 - SYS_GETPGRP = 81 - SYS_SETPGID = 82 - SYS_SETITIMER = 83 - SYS_SWAPON = 85 - SYS_GETITIMER = 86 - SYS_GETDTABLESIZE = 89 - SYS_DUP2 = 90 - SYS_FCNTL = 92 - SYS_SELECT = 93 - SYS_FSYNC = 95 - SYS_SETPRIORITY = 96 - SYS_SOCKET = 97 - SYS_CONNECT = 98 - SYS_GETPRIORITY = 100 - SYS_BIND = 104 - SYS_SETSOCKOPT = 105 - SYS_LISTEN = 106 - SYS_SIGSUSPEND = 111 - SYS_GETTIMEOFDAY = 116 - SYS_GETRUSAGE = 117 - SYS_GETSOCKOPT = 118 - SYS_READV = 120 - SYS_WRITEV = 121 - SYS_SETTIMEOFDAY = 122 - SYS_FCHOWN = 123 - SYS_FCHMOD = 124 - SYS_SETREUID = 126 - SYS_SETREGID = 127 - SYS_RENAME = 128 - SYS_FLOCK = 131 - SYS_MKFIFO = 132 - SYS_SENDTO = 133 - SYS_SHUTDOWN = 134 - SYS_SOCKETPAIR = 135 - SYS_MKDIR = 136 - SYS_RMDIR = 137 - SYS_UTIMES = 138 - SYS_FUTIMES = 139 - SYS_ADJTIME = 140 - SYS_GETHOSTUUID = 142 - SYS_SETSID = 147 - SYS_GETPGID = 151 - SYS_SETPRIVEXEC = 152 - SYS_PREAD = 153 - SYS_PWRITE = 154 - SYS_NFSSVC = 155 - SYS_STATFS = 157 - SYS_FSTATFS = 158 - SYS_UNMOUNT = 159 - SYS_GETFH = 161 - SYS_QUOTACTL = 165 - SYS_MOUNT = 167 - SYS_CSOPS = 169 - SYS_CSOPS_AUDITTOKEN = 170 - SYS_WAITID = 173 - SYS_KDEBUG_TRACE64 = 179 - SYS_KDEBUG_TRACE = 180 - SYS_SETGID = 181 - SYS_SETEGID = 182 - SYS_SETEUID = 183 - SYS_SIGRETURN = 184 - SYS_CHUD = 185 - SYS_FDATASYNC = 187 - SYS_STAT = 188 - SYS_FSTAT = 189 - SYS_LSTAT = 190 - SYS_PATHCONF = 191 - SYS_FPATHCONF = 192 - SYS_GETRLIMIT = 194 - SYS_SETRLIMIT = 195 - SYS_GETDIRENTRIES = 196 - SYS_MMAP = 197 - SYS_LSEEK = 199 - SYS_TRUNCATE = 200 - SYS_FTRUNCATE = 201 - SYS_SYSCTL = 202 - SYS_MLOCK = 203 - SYS_MUNLOCK = 204 - SYS_UNDELETE = 205 - SYS_OPEN_DPROTECTED_NP = 216 - SYS_GETATTRLIST = 220 - SYS_SETATTRLIST = 221 - SYS_GETDIRENTRIESATTR = 222 - SYS_EXCHANGEDATA = 223 - SYS_SEARCHFS = 225 - SYS_DELETE = 226 - SYS_COPYFILE = 227 - SYS_FGETATTRLIST = 228 - SYS_FSETATTRLIST = 229 - SYS_POLL = 230 - SYS_WATCHEVENT = 231 - SYS_WAITEVENT = 232 - SYS_MODWATCH = 233 - SYS_GETXATTR = 234 - SYS_FGETXATTR = 235 - SYS_SETXATTR = 236 - SYS_FSETXATTR = 237 - SYS_REMOVEXATTR = 238 - SYS_FREMOVEXATTR = 239 - SYS_LISTXATTR = 240 - SYS_FLISTXATTR = 241 - SYS_FSCTL = 242 - SYS_INITGROUPS = 243 - SYS_POSIX_SPAWN = 244 - SYS_FFSCTL = 245 - SYS_NFSCLNT = 247 - SYS_FHOPEN = 248 - SYS_MINHERIT = 250 - SYS_SEMSYS = 251 - SYS_MSGSYS = 252 - SYS_SHMSYS = 253 - SYS_SEMCTL = 254 - SYS_SEMGET = 255 - SYS_SEMOP = 256 - SYS_MSGCTL = 258 - SYS_MSGGET = 259 - SYS_MSGSND = 260 - SYS_MSGRCV = 261 - SYS_SHMAT = 262 - SYS_SHMCTL = 263 - SYS_SHMDT = 264 - SYS_SHMGET = 265 - SYS_SHM_OPEN = 266 - SYS_SHM_UNLINK = 267 - SYS_SEM_OPEN = 268 - SYS_SEM_CLOSE = 269 - SYS_SEM_UNLINK = 270 - SYS_SEM_WAIT = 271 - SYS_SEM_TRYWAIT = 272 - SYS_SEM_POST = 273 - SYS_SYSCTLBYNAME = 274 - SYS_OPEN_EXTENDED = 277 - SYS_UMASK_EXTENDED = 278 - SYS_STAT_EXTENDED = 279 - SYS_LSTAT_EXTENDED = 280 - SYS_FSTAT_EXTENDED = 281 - SYS_CHMOD_EXTENDED = 282 - SYS_FCHMOD_EXTENDED = 283 - SYS_ACCESS_EXTENDED = 284 - SYS_SETTID = 285 - SYS_GETTID = 286 - SYS_SETSGROUPS = 287 - SYS_GETSGROUPS = 288 - SYS_SETWGROUPS = 289 - SYS_GETWGROUPS = 290 - SYS_MKFIFO_EXTENDED = 291 - SYS_MKDIR_EXTENDED = 292 - SYS_IDENTITYSVC = 293 - SYS_SHARED_REGION_CHECK_NP = 294 - SYS_VM_PRESSURE_MONITOR = 296 - SYS_PSYNCH_RW_LONGRDLOCK = 297 - SYS_PSYNCH_RW_YIELDWRLOCK = 298 - SYS_PSYNCH_RW_DOWNGRADE = 299 - SYS_PSYNCH_RW_UPGRADE = 300 - SYS_PSYNCH_MUTEXWAIT = 301 - SYS_PSYNCH_MUTEXDROP = 302 - SYS_PSYNCH_CVBROAD = 303 - SYS_PSYNCH_CVSIGNAL = 304 - SYS_PSYNCH_CVWAIT = 305 - SYS_PSYNCH_RW_RDLOCK = 306 - SYS_PSYNCH_RW_WRLOCK = 307 - SYS_PSYNCH_RW_UNLOCK = 308 - SYS_PSYNCH_RW_UNLOCK2 = 309 - SYS_GETSID = 310 - SYS_SETTID_WITH_PID = 311 - SYS_PSYNCH_CVCLRPREPOST = 312 - SYS_AIO_FSYNC = 313 - SYS_AIO_RETURN = 314 - SYS_AIO_SUSPEND = 315 - SYS_AIO_CANCEL = 316 - SYS_AIO_ERROR = 317 - SYS_AIO_READ = 318 - SYS_AIO_WRITE = 319 - SYS_LIO_LISTIO = 320 - SYS_IOPOLICYSYS = 322 - SYS_PROCESS_POLICY = 323 - SYS_MLOCKALL = 324 - SYS_MUNLOCKALL = 325 - SYS_ISSETUGID = 327 - SYS___PTHREAD_KILL = 328 - SYS___PTHREAD_SIGMASK = 329 - SYS___SIGWAIT = 330 - SYS___DISABLE_THREADSIGNAL = 331 - SYS___PTHREAD_MARKCANCEL = 332 - SYS___PTHREAD_CANCELED = 333 - SYS___SEMWAIT_SIGNAL = 334 - SYS_PROC_INFO = 336 - SYS_SENDFILE = 337 - SYS_STAT64 = 338 - SYS_FSTAT64 = 339 - SYS_LSTAT64 = 340 - SYS_STAT64_EXTENDED = 341 - SYS_LSTAT64_EXTENDED = 342 - SYS_FSTAT64_EXTENDED = 343 - SYS_GETDIRENTRIES64 = 344 - SYS_STATFS64 = 345 - SYS_FSTATFS64 = 346 - SYS_GETFSSTAT64 = 347 - SYS___PTHREAD_CHDIR = 348 - SYS___PTHREAD_FCHDIR = 349 - SYS_AUDIT = 350 - SYS_AUDITON = 351 - SYS_GETAUID = 353 - SYS_SETAUID = 354 - SYS_GETAUDIT_ADDR = 357 - SYS_SETAUDIT_ADDR = 358 - SYS_AUDITCTL = 359 - SYS_BSDTHREAD_CREATE = 360 - SYS_BSDTHREAD_TERMINATE = 361 - SYS_KQUEUE = 362 - SYS_KEVENT = 363 - SYS_LCHOWN = 364 - SYS_STACK_SNAPSHOT = 365 - SYS_BSDTHREAD_REGISTER = 366 - SYS_WORKQ_OPEN = 367 - SYS_WORKQ_KERNRETURN = 368 - SYS_KEVENT64 = 369 - SYS___OLD_SEMWAIT_SIGNAL = 370 - SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 - SYS_THREAD_SELFID = 372 - SYS_LEDGER = 373 - SYS___MAC_EXECVE = 380 - SYS___MAC_SYSCALL = 381 - SYS___MAC_GET_FILE = 382 - SYS___MAC_SET_FILE = 383 - SYS___MAC_GET_LINK = 384 - SYS___MAC_SET_LINK = 385 - SYS___MAC_GET_PROC = 386 - SYS___MAC_SET_PROC = 387 - SYS___MAC_GET_FD = 388 - SYS___MAC_SET_FD = 389 - SYS___MAC_GET_PID = 390 - SYS___MAC_GET_LCID = 391 - SYS___MAC_GET_LCTX = 392 - SYS___MAC_SET_LCTX = 393 - SYS_SETLCID = 394 - SYS_GETLCID = 395 - SYS_READ_NOCANCEL = 396 - SYS_WRITE_NOCANCEL = 397 - SYS_OPEN_NOCANCEL = 398 - SYS_CLOSE_NOCANCEL = 399 - SYS_WAIT4_NOCANCEL = 400 - SYS_RECVMSG_NOCANCEL = 401 - SYS_SENDMSG_NOCANCEL = 402 - SYS_RECVFROM_NOCANCEL = 403 - SYS_ACCEPT_NOCANCEL = 404 - SYS_MSYNC_NOCANCEL = 405 - SYS_FCNTL_NOCANCEL = 406 - SYS_SELECT_NOCANCEL = 407 - SYS_FSYNC_NOCANCEL = 408 - SYS_CONNECT_NOCANCEL = 409 - SYS_SIGSUSPEND_NOCANCEL = 410 - SYS_READV_NOCANCEL = 411 - SYS_WRITEV_NOCANCEL = 412 - SYS_SENDTO_NOCANCEL = 413 - SYS_PREAD_NOCANCEL = 414 - SYS_PWRITE_NOCANCEL = 415 - SYS_WAITID_NOCANCEL = 416 - SYS_POLL_NOCANCEL = 417 - SYS_MSGSND_NOCANCEL = 418 - SYS_MSGRCV_NOCANCEL = 419 - SYS_SEM_WAIT_NOCANCEL = 420 - SYS_AIO_SUSPEND_NOCANCEL = 421 - SYS___SIGWAIT_NOCANCEL = 422 - SYS___SEMWAIT_SIGNAL_NOCANCEL = 423 - SYS___MAC_MOUNT = 424 - SYS___MAC_GET_MOUNT = 425 - SYS___MAC_GETFSSTAT = 426 - SYS_FSGETPATH = 427 - SYS_AUDIT_SESSION_SELF = 428 - SYS_AUDIT_SESSION_JOIN = 429 - SYS_FILEPORT_MAKEPORT = 430 - SYS_FILEPORT_MAKEFD = 431 - SYS_AUDIT_SESSION_PORT = 432 - SYS_PID_SUSPEND = 433 - SYS_PID_RESUME = 434 - SYS_PID_HIBERNATE = 435 - SYS_PID_SHUTDOWN_SOCKETS = 436 - SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438 - SYS_KAS_INFO = 439 - SYS_MEMORYSTATUS_CONTROL = 440 - SYS_GUARDED_OPEN_NP = 441 - SYS_GUARDED_CLOSE_NP = 442 - SYS_GUARDED_KQUEUE_NP = 443 - SYS_CHANGE_FDGUARD_NP = 444 - SYS_PROC_RLIMIT_CONTROL = 446 - SYS_CONNECTX = 447 - SYS_DISCONNECTX = 448 - SYS_PEELOFF = 449 - SYS_SOCKET_DELEGATE = 450 - SYS_TELEMETRY = 451 - SYS_PROC_UUID_POLICY = 452 - SYS_MEMORYSTATUS_GET_LEVEL = 453 - SYS_SYSTEM_OVERRIDE = 454 - SYS_VFS_PURGE = 455 - SYS_SFI_CTL = 456 - SYS_SFI_PIDCTL = 457 - SYS_COALITION = 458 - SYS_COALITION_INFO = 459 - SYS_NECP_MATCH_POLICY = 460 - SYS_GETATTRLISTBULK = 461 - SYS_OPENAT = 463 - SYS_OPENAT_NOCANCEL = 464 - SYS_RENAMEAT = 465 - SYS_FACCESSAT = 466 - SYS_FCHMODAT = 467 - SYS_FCHOWNAT = 468 - SYS_FSTATAT = 469 - SYS_FSTATAT64 = 470 - SYS_LINKAT = 471 - SYS_UNLINKAT = 472 - SYS_READLINKAT = 473 - SYS_SYMLINKAT = 474 - SYS_MKDIRAT = 475 - SYS_GETATTRLISTAT = 476 - SYS_PROC_TRACE_LOG = 477 - SYS_BSDTHREAD_CTL = 478 - SYS_OPENBYID_NP = 479 - SYS_RECVMSG_X = 480 - SYS_SENDMSG_X = 481 - SYS_THREAD_SELFUSAGE = 482 - SYS_CSRCTL = 483 - SYS_GUARDED_OPEN_DPROTECTED_NP = 484 - SYS_GUARDED_WRITE_NP = 485 - SYS_GUARDED_PWRITE_NP = 486 - SYS_GUARDED_WRITEV_NP = 487 - SYS_RENAME_EXT = 488 - SYS_MREMAP_ENCRYPTED = 489 - SYS_MAXSYSCALL = 490 -) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_386.go b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_386.go index 785240a75b..09c3515804 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_386.go @@ -1,8 +1,6 @@ // mksysnum_dragonfly.pl // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT -// +build 386,dragonfly - package unix const ( diff --git a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go index d6038fa9b0..09c3515804 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go @@ -1,8 +1,6 @@ // mksysnum_dragonfly.pl // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT -// +build amd64,dragonfly - package unix const ( diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go index 262a84536a..3359ced071 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go @@ -1,8 +1,6 @@ // mksysnum_freebsd.pl // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT -// +build 386,freebsd - package unix const ( @@ -184,7 +182,7 @@ const ( SYS_YIELD = 321 // { int yield(void); } SYS_MLOCKALL = 324 // { int mlockall(int how); } SYS_MUNLOCKALL = 325 // { int munlockall(void); } - SYS___GETCWD = 326 // { int __getcwd(char *buf, u_int buflen); } + SYS___GETCWD = 326 // { int __getcwd(u_char *buf, u_int buflen); } SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, \ SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct \ SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int \ @@ -347,5 +345,4 @@ const ( SYS_ACCEPT4 = 541 // { int accept4(int s, \ SYS_PIPE2 = 542 // { int pipe2(int *fildes, int flags); } SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, \ - SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, \ ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go index 57a60ea126..3359ced071 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go @@ -1,8 +1,6 @@ // mksysnum_freebsd.pl // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT -// +build amd64,freebsd - package unix const ( @@ -184,7 +182,7 @@ const ( SYS_YIELD = 321 // { int yield(void); } SYS_MLOCKALL = 324 // { int mlockall(int how); } SYS_MUNLOCKALL = 325 // { int munlockall(void); } - SYS___GETCWD = 326 // { int __getcwd(char *buf, u_int buflen); } + SYS___GETCWD = 326 // { int __getcwd(u_char *buf, u_int buflen); } SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, \ SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct \ SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int \ @@ -347,5 +345,4 @@ const ( SYS_ACCEPT4 = 541 // { int accept4(int s, \ SYS_PIPE2 = 542 // { int pipe2(int *fildes, int flags); } SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, \ - SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, \ ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go index 206b9f612d..3359ced071 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go @@ -1,8 +1,6 @@ // mksysnum_freebsd.pl // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT -// +build arm,freebsd - package unix const ( @@ -184,7 +182,7 @@ const ( SYS_YIELD = 321 // { int yield(void); } SYS_MLOCKALL = 324 // { int mlockall(int how); } SYS_MUNLOCKALL = 325 // { int munlockall(void); } - SYS___GETCWD = 326 // { int __getcwd(char *buf, u_int buflen); } + SYS___GETCWD = 326 // { int __getcwd(u_char *buf, u_int buflen); } SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, \ SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct \ SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int \ @@ -347,5 +345,4 @@ const ( SYS_ACCEPT4 = 541 // { int accept4(int s, \ SYS_PIPE2 = 542 // { int pipe2(int *fildes, int flags); } SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, \ - SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, \ ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index ba952c6754..9a7d8b0479 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -1,8 +1,6 @@ // mksysnum_linux.pl /usr/include/asm/unistd_32.h // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT -// +build 386,linux - package unix const ( @@ -344,12 +342,4 @@ const ( SYS_FANOTIFY_INIT = 338 SYS_FANOTIFY_MARK = 339 SYS_PRLIMIT64 = 340 - SYS_NAME_TO_HANDLE_AT = 341 - SYS_OPEN_BY_HANDLE_AT = 342 - SYS_CLOCK_ADJTIME = 343 - SYS_SYNCFS = 344 - SYS_SENDMMSG = 345 - SYS_SETNS = 346 - SYS_PROCESS_VM_READV = 347 - SYS_PROCESS_VM_WRITEV = 348 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index ddac31f58a..fa7d754562 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -1,8 +1,6 @@ // mksysnum_linux.pl /usr/include/asm/unistd_64.h // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT -// +build amd64,linux - package unix const ( @@ -309,13 +307,4 @@ const ( SYS_FANOTIFY_INIT = 300 SYS_FANOTIFY_MARK = 301 SYS_PRLIMIT64 = 302 - SYS_NAME_TO_HANDLE_AT = 303 - SYS_OPEN_BY_HANDLE_AT = 304 - SYS_CLOCK_ADJTIME = 305 - SYS_SYNCFS = 306 - SYS_SENDMMSG = 307 - SYS_SETNS = 308 - SYS_GETCPU = 309 - SYS_PROCESS_VM_READV = 310 - SYS_PROCESS_VM_WRITEV = 311 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index 45ced17fc4..e2b7d19d79 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -1,8 +1,6 @@ // mksysnum_linux.pl // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT -// +build arm,linux - package unix const ( diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go deleted file mode 100644 index 2e9514f280..0000000000 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ /dev/null @@ -1,272 +0,0 @@ -// mksysnum_linux.pl /usr/include/asm-generic/unistd.h -// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT - -// +build arm64,linux - -package unix - -const ( - SYS_IO_SETUP = 0 - SYS_IO_DESTROY = 1 - SYS_IO_SUBMIT = 2 - SYS_IO_CANCEL = 3 - SYS_IO_GETEVENTS = 4 - SYS_SETXATTR = 5 - SYS_LSETXATTR = 6 - SYS_FSETXATTR = 7 - SYS_GETXATTR = 8 - SYS_LGETXATTR = 9 - SYS_FGETXATTR = 10 - SYS_LISTXATTR = 11 - SYS_LLISTXATTR = 12 - SYS_FLISTXATTR = 13 - SYS_REMOVEXATTR = 14 - SYS_LREMOVEXATTR = 15 - SYS_FREMOVEXATTR = 16 - SYS_GETCWD = 17 - SYS_LOOKUP_DCOOKIE = 18 - SYS_EVENTFD2 = 19 - SYS_EPOLL_CREATE1 = 20 - SYS_EPOLL_CTL = 21 - SYS_EPOLL_PWAIT = 22 - SYS_DUP = 23 - SYS_DUP3 = 24 - SYS_FCNTL = 25 - SYS_INOTIFY_INIT1 = 26 - SYS_INOTIFY_ADD_WATCH = 27 - SYS_INOTIFY_RM_WATCH = 28 - SYS_IOCTL = 29 - SYS_IOPRIO_SET = 30 - SYS_IOPRIO_GET = 31 - SYS_FLOCK = 32 - SYS_MKNODAT = 33 - SYS_MKDIRAT = 34 - SYS_UNLINKAT = 35 - SYS_SYMLINKAT = 36 - SYS_LINKAT = 37 - SYS_RENAMEAT = 38 - SYS_UMOUNT2 = 39 - SYS_MOUNT = 40 - SYS_PIVOT_ROOT = 41 - SYS_NFSSERVCTL = 42 - SYS_STATFS = 43 - SYS_FSTATFS = 44 - SYS_TRUNCATE = 45 - SYS_FTRUNCATE = 46 - SYS_FALLOCATE = 47 - SYS_FACCESSAT = 48 - SYS_CHDIR = 49 - SYS_FCHDIR = 50 - SYS_CHROOT = 51 - SYS_FCHMOD = 52 - SYS_FCHMODAT = 53 - SYS_FCHOWNAT = 54 - SYS_FCHOWN = 55 - SYS_OPENAT = 56 - SYS_CLOSE = 57 - SYS_VHANGUP = 58 - SYS_PIPE2 = 59 - SYS_QUOTACTL = 60 - SYS_GETDENTS64 = 61 - SYS_LSEEK = 62 - SYS_READ = 63 - SYS_WRITE = 64 - SYS_READV = 65 - SYS_WRITEV = 66 - SYS_PREAD64 = 67 - SYS_PWRITE64 = 68 - SYS_PREADV = 69 - SYS_PWRITEV = 70 - SYS_SENDFILE = 71 - SYS_PSELECT6 = 72 - SYS_PPOLL = 73 - SYS_SIGNALFD4 = 74 - SYS_VMSPLICE = 75 - SYS_SPLICE = 76 - SYS_TEE = 77 - SYS_READLINKAT = 78 - SYS_FSTATAT = 79 - SYS_FSTAT = 80 - SYS_SYNC = 81 - SYS_FSYNC = 82 - SYS_FDATASYNC = 83 - SYS_SYNC_FILE_RANGE = 84 - SYS_TIMERFD_CREATE = 85 - SYS_TIMERFD_SETTIME = 86 - SYS_TIMERFD_GETTIME = 87 - SYS_UTIMENSAT = 88 - SYS_ACCT = 89 - SYS_CAPGET = 90 - SYS_CAPSET = 91 - SYS_PERSONALITY = 92 - SYS_EXIT = 93 - SYS_EXIT_GROUP = 94 - SYS_WAITID = 95 - SYS_SET_TID_ADDRESS = 96 - SYS_UNSHARE = 97 - SYS_FUTEX = 98 - SYS_SET_ROBUST_LIST = 99 - SYS_GET_ROBUST_LIST = 100 - SYS_NANOSLEEP = 101 - SYS_GETITIMER = 102 - SYS_SETITIMER = 103 - SYS_KEXEC_LOAD = 104 - SYS_INIT_MODULE = 105 - SYS_DELETE_MODULE = 106 - SYS_TIMER_CREATE = 107 - SYS_TIMER_GETTIME = 108 - SYS_TIMER_GETOVERRUN = 109 - SYS_TIMER_SETTIME = 110 - SYS_TIMER_DELETE = 111 - SYS_CLOCK_SETTIME = 112 - SYS_CLOCK_GETTIME = 113 - SYS_CLOCK_GETRES = 114 - SYS_CLOCK_NANOSLEEP = 115 - SYS_SYSLOG = 116 - SYS_PTRACE = 117 - SYS_SCHED_SETPARAM = 118 - SYS_SCHED_SETSCHEDULER = 119 - SYS_SCHED_GETSCHEDULER = 120 - SYS_SCHED_GETPARAM = 121 - SYS_SCHED_SETAFFINITY = 122 - SYS_SCHED_GETAFFINITY = 123 - SYS_SCHED_YIELD = 124 - SYS_SCHED_GET_PRIORITY_MAX = 125 - SYS_SCHED_GET_PRIORITY_MIN = 126 - SYS_SCHED_RR_GET_INTERVAL = 127 - SYS_RESTART_SYSCALL = 128 - SYS_KILL = 129 - SYS_TKILL = 130 - SYS_TGKILL = 131 - SYS_SIGALTSTACK = 132 - SYS_RT_SIGSUSPEND = 133 - SYS_RT_SIGACTION = 134 - SYS_RT_SIGPROCMASK = 135 - SYS_RT_SIGPENDING = 136 - SYS_RT_SIGTIMEDWAIT = 137 - SYS_RT_SIGQUEUEINFO = 138 - SYS_RT_SIGRETURN = 139 - SYS_SETPRIORITY = 140 - SYS_GETPRIORITY = 141 - SYS_REBOOT = 142 - SYS_SETREGID = 143 - SYS_SETGID = 144 - SYS_SETREUID = 145 - SYS_SETUID = 146 - SYS_SETRESUID = 147 - SYS_GETRESUID = 148 - SYS_SETRESGID = 149 - SYS_GETRESGID = 150 - SYS_SETFSUID = 151 - SYS_SETFSGID = 152 - SYS_TIMES = 153 - SYS_SETPGID = 154 - SYS_GETPGID = 155 - SYS_GETSID = 156 - SYS_SETSID = 157 - SYS_GETGROUPS = 158 - SYS_SETGROUPS = 159 - SYS_UNAME = 160 - SYS_SETHOSTNAME = 161 - SYS_SETDOMAINNAME = 162 - SYS_GETRLIMIT = 163 - SYS_SETRLIMIT = 164 - SYS_GETRUSAGE = 165 - SYS_UMASK = 166 - SYS_PRCTL = 167 - SYS_GETCPU = 168 - SYS_GETTIMEOFDAY = 169 - SYS_SETTIMEOFDAY = 170 - SYS_ADJTIMEX = 171 - SYS_GETPID = 172 - SYS_GETPPID = 173 - SYS_GETUID = 174 - SYS_GETEUID = 175 - SYS_GETGID = 176 - SYS_GETEGID = 177 - SYS_GETTID = 178 - SYS_SYSINFO = 179 - SYS_MQ_OPEN = 180 - SYS_MQ_UNLINK = 181 - SYS_MQ_TIMEDSEND = 182 - SYS_MQ_TIMEDRECEIVE = 183 - SYS_MQ_NOTIFY = 184 - SYS_MQ_GETSETATTR = 185 - SYS_MSGGET = 186 - SYS_MSGCTL = 187 - SYS_MSGRCV = 188 - SYS_MSGSND = 189 - SYS_SEMGET = 190 - SYS_SEMCTL = 191 - SYS_SEMTIMEDOP = 192 - SYS_SEMOP = 193 - SYS_SHMGET = 194 - SYS_SHMCTL = 195 - SYS_SHMAT = 196 - SYS_SHMDT = 197 - SYS_SOCKET = 198 - SYS_SOCKETPAIR = 199 - SYS_BIND = 200 - SYS_LISTEN = 201 - SYS_ACCEPT = 202 - SYS_CONNECT = 203 - SYS_GETSOCKNAME = 204 - SYS_GETPEERNAME = 205 - SYS_SENDTO = 206 - SYS_RECVFROM = 207 - SYS_SETSOCKOPT = 208 - SYS_GETSOCKOPT = 209 - SYS_SHUTDOWN = 210 - SYS_SENDMSG = 211 - SYS_RECVMSG = 212 - SYS_READAHEAD = 213 - SYS_BRK = 214 - SYS_MUNMAP = 215 - SYS_MREMAP = 216 - SYS_ADD_KEY = 217 - SYS_REQUEST_KEY = 218 - SYS_KEYCTL = 219 - SYS_CLONE = 220 - SYS_EXECVE = 221 - SYS_MMAP = 222 - SYS_FADVISE64 = 223 - SYS_SWAPON = 224 - SYS_SWAPOFF = 225 - SYS_MPROTECT = 226 - SYS_MSYNC = 227 - SYS_MLOCK = 228 - SYS_MUNLOCK = 229 - SYS_MLOCKALL = 230 - SYS_MUNLOCKALL = 231 - SYS_MINCORE = 232 - SYS_MADVISE = 233 - SYS_REMAP_FILE_PAGES = 234 - SYS_MBIND = 235 - SYS_GET_MEMPOLICY = 236 - SYS_SET_MEMPOLICY = 237 - SYS_MIGRATE_PAGES = 238 - SYS_MOVE_PAGES = 239 - SYS_RT_TGSIGQUEUEINFO = 240 - SYS_PERF_EVENT_OPEN = 241 - SYS_ACCEPT4 = 242 - SYS_RECVMMSG = 243 - SYS_ARCH_SPECIFIC_SYSCALL = 244 - SYS_WAIT4 = 260 - SYS_PRLIMIT64 = 261 - SYS_FANOTIFY_INIT = 262 - SYS_FANOTIFY_MARK = 263 - SYS_NAME_TO_HANDLE_AT = 264 - SYS_OPEN_BY_HANDLE_AT = 265 - SYS_CLOCK_ADJTIME = 266 - SYS_SYNCFS = 267 - SYS_SETNS = 268 - SYS_SENDMMSG = 269 - SYS_PROCESS_VM_READV = 270 - SYS_PROCESS_VM_WRITEV = 271 - SYS_KCMP = 272 - SYS_FINIT_MODULE = 273 - SYS_SCHED_SETATTR = 274 - SYS_SCHED_GETATTR = 275 - SYS_RENAMEAT2 = 276 - SYS_SECCOMP = 277 -) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go deleted file mode 100644 index e1b08f00d3..0000000000 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ /dev/null @@ -1,360 +0,0 @@ -// mksysnum_linux.pl /usr/include/asm/unistd.h -// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT - -// +build ppc64,linux - -package unix - -const ( - SYS_RESTART_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAITPID = 7 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECVE = 11 - SYS_CHDIR = 12 - SYS_TIME = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LCHOWN = 16 - SYS_BREAK = 17 - SYS_OLDSTAT = 18 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_MOUNT = 21 - SYS_UMOUNT = 22 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_STIME = 25 - SYS_PTRACE = 26 - SYS_ALARM = 27 - SYS_OLDFSTAT = 28 - SYS_PAUSE = 29 - SYS_UTIME = 30 - SYS_STTY = 31 - SYS_GTTY = 32 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_FTIME = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_RENAME = 38 - SYS_MKDIR = 39 - SYS_RMDIR = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_PROF = 44 - SYS_BRK = 45 - SYS_SETGID = 46 - SYS_GETGID = 47 - SYS_SIGNAL = 48 - SYS_GETEUID = 49 - SYS_GETEGID = 50 - SYS_ACCT = 51 - SYS_UMOUNT2 = 52 - SYS_LOCK = 53 - SYS_IOCTL = 54 - SYS_FCNTL = 55 - SYS_MPX = 56 - SYS_SETPGID = 57 - SYS_ULIMIT = 58 - SYS_OLDOLDUNAME = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_USTAT = 62 - SYS_DUP2 = 63 - SYS_GETPPID = 64 - SYS_GETPGRP = 65 - SYS_SETSID = 66 - SYS_SIGACTION = 67 - SYS_SGETMASK = 68 - SYS_SSETMASK = 69 - SYS_SETREUID = 70 - SYS_SETREGID = 71 - SYS_SIGSUSPEND = 72 - SYS_SIGPENDING = 73 - SYS_SETHOSTNAME = 74 - SYS_SETRLIMIT = 75 - SYS_GETRLIMIT = 76 - SYS_GETRUSAGE = 77 - SYS_GETTIMEOFDAY = 78 - SYS_SETTIMEOFDAY = 79 - SYS_GETGROUPS = 80 - SYS_SETGROUPS = 81 - SYS_SELECT = 82 - SYS_SYMLINK = 83 - SYS_OLDLSTAT = 84 - SYS_READLINK = 85 - SYS_USELIB = 86 - SYS_SWAPON = 87 - SYS_REBOOT = 88 - SYS_READDIR = 89 - SYS_MMAP = 90 - SYS_MUNMAP = 91 - SYS_TRUNCATE = 92 - SYS_FTRUNCATE = 93 - SYS_FCHMOD = 94 - SYS_FCHOWN = 95 - SYS_GETPRIORITY = 96 - SYS_SETPRIORITY = 97 - SYS_PROFIL = 98 - SYS_STATFS = 99 - SYS_FSTATFS = 100 - SYS_IOPERM = 101 - SYS_SOCKETCALL = 102 - SYS_SYSLOG = 103 - SYS_SETITIMER = 104 - SYS_GETITIMER = 105 - SYS_STAT = 106 - SYS_LSTAT = 107 - SYS_FSTAT = 108 - SYS_OLDUNAME = 109 - SYS_IOPL = 110 - SYS_VHANGUP = 111 - SYS_IDLE = 112 - SYS_VM86 = 113 - SYS_WAIT4 = 114 - SYS_SWAPOFF = 115 - SYS_SYSINFO = 116 - SYS_IPC = 117 - SYS_FSYNC = 118 - SYS_SIGRETURN = 119 - SYS_CLONE = 120 - SYS_SETDOMAINNAME = 121 - SYS_UNAME = 122 - SYS_MODIFY_LDT = 123 - SYS_ADJTIMEX = 124 - SYS_MPROTECT = 125 - SYS_SIGPROCMASK = 126 - SYS_CREATE_MODULE = 127 - SYS_INIT_MODULE = 128 - SYS_DELETE_MODULE = 129 - SYS_GET_KERNEL_SYMS = 130 - SYS_QUOTACTL = 131 - SYS_GETPGID = 132 - SYS_FCHDIR = 133 - SYS_BDFLUSH = 134 - SYS_SYSFS = 135 - SYS_PERSONALITY = 136 - SYS_AFS_SYSCALL = 137 - SYS_SETFSUID = 138 - SYS_SETFSGID = 139 - SYS__LLSEEK = 140 - SYS_GETDENTS = 141 - SYS__NEWSELECT = 142 - SYS_FLOCK = 143 - SYS_MSYNC = 144 - SYS_READV = 145 - SYS_WRITEV = 146 - SYS_GETSID = 147 - SYS_FDATASYNC = 148 - SYS__SYSCTL = 149 - SYS_MLOCK = 150 - SYS_MUNLOCK = 151 - SYS_MLOCKALL = 152 - SYS_MUNLOCKALL = 153 - SYS_SCHED_SETPARAM = 154 - SYS_SCHED_GETPARAM = 155 - SYS_SCHED_SETSCHEDULER = 156 - SYS_SCHED_GETSCHEDULER = 157 - SYS_SCHED_YIELD = 158 - SYS_SCHED_GET_PRIORITY_MAX = 159 - SYS_SCHED_GET_PRIORITY_MIN = 160 - SYS_SCHED_RR_GET_INTERVAL = 161 - SYS_NANOSLEEP = 162 - SYS_MREMAP = 163 - SYS_SETRESUID = 164 - SYS_GETRESUID = 165 - SYS_QUERY_MODULE = 166 - SYS_POLL = 167 - SYS_NFSSERVCTL = 168 - SYS_SETRESGID = 169 - SYS_GETRESGID = 170 - SYS_PRCTL = 171 - SYS_RT_SIGRETURN = 172 - SYS_RT_SIGACTION = 173 - SYS_RT_SIGPROCMASK = 174 - SYS_RT_SIGPENDING = 175 - SYS_RT_SIGTIMEDWAIT = 176 - SYS_RT_SIGQUEUEINFO = 177 - SYS_RT_SIGSUSPEND = 178 - SYS_PREAD64 = 179 - SYS_PWRITE64 = 180 - SYS_CHOWN = 181 - SYS_GETCWD = 182 - SYS_CAPGET = 183 - SYS_CAPSET = 184 - SYS_SIGALTSTACK = 185 - SYS_SENDFILE = 186 - SYS_GETPMSG = 187 - SYS_PUTPMSG = 188 - SYS_VFORK = 189 - SYS_UGETRLIMIT = 190 - SYS_READAHEAD = 191 - SYS_PCICONFIG_READ = 198 - SYS_PCICONFIG_WRITE = 199 - SYS_PCICONFIG_IOBASE = 200 - SYS_MULTIPLEXER = 201 - SYS_GETDENTS64 = 202 - SYS_PIVOT_ROOT = 203 - SYS_MADVISE = 205 - SYS_MINCORE = 206 - SYS_GETTID = 207 - SYS_TKILL = 208 - SYS_SETXATTR = 209 - SYS_LSETXATTR = 210 - SYS_FSETXATTR = 211 - SYS_GETXATTR = 212 - SYS_LGETXATTR = 213 - SYS_FGETXATTR = 214 - SYS_LISTXATTR = 215 - SYS_LLISTXATTR = 216 - SYS_FLISTXATTR = 217 - SYS_REMOVEXATTR = 218 - SYS_LREMOVEXATTR = 219 - SYS_FREMOVEXATTR = 220 - SYS_FUTEX = 221 - SYS_SCHED_SETAFFINITY = 222 - SYS_SCHED_GETAFFINITY = 223 - SYS_TUXCALL = 225 - SYS_IO_SETUP = 227 - SYS_IO_DESTROY = 228 - SYS_IO_GETEVENTS = 229 - SYS_IO_SUBMIT = 230 - SYS_IO_CANCEL = 231 - SYS_SET_TID_ADDRESS = 232 - SYS_FADVISE64 = 233 - SYS_EXIT_GROUP = 234 - SYS_LOOKUP_DCOOKIE = 235 - SYS_EPOLL_CREATE = 236 - SYS_EPOLL_CTL = 237 - SYS_EPOLL_WAIT = 238 - SYS_REMAP_FILE_PAGES = 239 - SYS_TIMER_CREATE = 240 - SYS_TIMER_SETTIME = 241 - SYS_TIMER_GETTIME = 242 - SYS_TIMER_GETOVERRUN = 243 - SYS_TIMER_DELETE = 244 - SYS_CLOCK_SETTIME = 245 - SYS_CLOCK_GETTIME = 246 - SYS_CLOCK_GETRES = 247 - SYS_CLOCK_NANOSLEEP = 248 - SYS_SWAPCONTEXT = 249 - SYS_TGKILL = 250 - SYS_UTIMES = 251 - SYS_STATFS64 = 252 - SYS_FSTATFS64 = 253 - SYS_RTAS = 255 - SYS_SYS_DEBUG_SETCONTEXT = 256 - SYS_MIGRATE_PAGES = 258 - SYS_MBIND = 259 - SYS_GET_MEMPOLICY = 260 - SYS_SET_MEMPOLICY = 261 - SYS_MQ_OPEN = 262 - SYS_MQ_UNLINK = 263 - SYS_MQ_TIMEDSEND = 264 - SYS_MQ_TIMEDRECEIVE = 265 - SYS_MQ_NOTIFY = 266 - SYS_MQ_GETSETATTR = 267 - SYS_KEXEC_LOAD = 268 - SYS_ADD_KEY = 269 - SYS_REQUEST_KEY = 270 - SYS_KEYCTL = 271 - SYS_WAITID = 272 - SYS_IOPRIO_SET = 273 - SYS_IOPRIO_GET = 274 - SYS_INOTIFY_INIT = 275 - SYS_INOTIFY_ADD_WATCH = 276 - SYS_INOTIFY_RM_WATCH = 277 - SYS_SPU_RUN = 278 - SYS_SPU_CREATE = 279 - SYS_PSELECT6 = 280 - SYS_PPOLL = 281 - SYS_UNSHARE = 282 - SYS_SPLICE = 283 - SYS_TEE = 284 - SYS_VMSPLICE = 285 - SYS_OPENAT = 286 - SYS_MKDIRAT = 287 - SYS_MKNODAT = 288 - SYS_FCHOWNAT = 289 - SYS_FUTIMESAT = 290 - SYS_NEWFSTATAT = 291 - SYS_UNLINKAT = 292 - SYS_RENAMEAT = 293 - SYS_LINKAT = 294 - SYS_SYMLINKAT = 295 - SYS_READLINKAT = 296 - SYS_FCHMODAT = 297 - SYS_FACCESSAT = 298 - SYS_GET_ROBUST_LIST = 299 - SYS_SET_ROBUST_LIST = 300 - SYS_MOVE_PAGES = 301 - SYS_GETCPU = 302 - SYS_EPOLL_PWAIT = 303 - SYS_UTIMENSAT = 304 - SYS_SIGNALFD = 305 - SYS_TIMERFD_CREATE = 306 - SYS_EVENTFD = 307 - SYS_SYNC_FILE_RANGE2 = 308 - SYS_FALLOCATE = 309 - SYS_SUBPAGE_PROT = 310 - SYS_TIMERFD_SETTIME = 311 - SYS_TIMERFD_GETTIME = 312 - SYS_SIGNALFD4 = 313 - SYS_EVENTFD2 = 314 - SYS_EPOLL_CREATE1 = 315 - SYS_DUP3 = 316 - SYS_PIPE2 = 317 - SYS_INOTIFY_INIT1 = 318 - SYS_PERF_EVENT_OPEN = 319 - SYS_PREADV = 320 - SYS_PWRITEV = 321 - SYS_RT_TGSIGQUEUEINFO = 322 - SYS_FANOTIFY_INIT = 323 - SYS_FANOTIFY_MARK = 324 - SYS_PRLIMIT64 = 325 - SYS_SOCKET = 326 - SYS_BIND = 327 - SYS_CONNECT = 328 - SYS_LISTEN = 329 - SYS_ACCEPT = 330 - SYS_GETSOCKNAME = 331 - SYS_GETPEERNAME = 332 - SYS_SOCKETPAIR = 333 - SYS_SEND = 334 - SYS_SENDTO = 335 - SYS_RECV = 336 - SYS_RECVFROM = 337 - SYS_SHUTDOWN = 338 - SYS_SETSOCKOPT = 339 - SYS_GETSOCKOPT = 340 - SYS_SENDMSG = 341 - SYS_RECVMSG = 342 - SYS_RECVMMSG = 343 - SYS_ACCEPT4 = 344 - SYS_NAME_TO_HANDLE_AT = 345 - SYS_OPEN_BY_HANDLE_AT = 346 - SYS_CLOCK_ADJTIME = 347 - SYS_SYNCFS = 348 - SYS_SENDMMSG = 349 - SYS_SETNS = 350 - SYS_PROCESS_VM_READV = 351 - SYS_PROCESS_VM_WRITEV = 352 - SYS_FINIT_MODULE = 353 - SYS_KCMP = 354 - SYS_SCHED_SETATTR = 355 - SYS_SCHED_GETATTR = 356 - SYS_RENAMEAT2 = 357 - SYS_SECCOMP = 358 - SYS_GETRANDOM = 359 - SYS_MEMFD_CREATE = 360 - SYS_BPF = 361 -) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go deleted file mode 100644 index 45e63f51a4..0000000000 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ /dev/null @@ -1,353 +0,0 @@ -// mksysnum_linux.pl /usr/include/powerpc64le-linux-gnu/asm/unistd.h -// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT - -// +build ppc64le,linux - -package unix - -const ( - SYS_RESTART_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAITPID = 7 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECVE = 11 - SYS_CHDIR = 12 - SYS_TIME = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LCHOWN = 16 - SYS_BREAK = 17 - SYS_OLDSTAT = 18 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_MOUNT = 21 - SYS_UMOUNT = 22 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_STIME = 25 - SYS_PTRACE = 26 - SYS_ALARM = 27 - SYS_OLDFSTAT = 28 - SYS_PAUSE = 29 - SYS_UTIME = 30 - SYS_STTY = 31 - SYS_GTTY = 32 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_FTIME = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_RENAME = 38 - SYS_MKDIR = 39 - SYS_RMDIR = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_PROF = 44 - SYS_BRK = 45 - SYS_SETGID = 46 - SYS_GETGID = 47 - SYS_SIGNAL = 48 - SYS_GETEUID = 49 - SYS_GETEGID = 50 - SYS_ACCT = 51 - SYS_UMOUNT2 = 52 - SYS_LOCK = 53 - SYS_IOCTL = 54 - SYS_FCNTL = 55 - SYS_MPX = 56 - SYS_SETPGID = 57 - SYS_ULIMIT = 58 - SYS_OLDOLDUNAME = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_USTAT = 62 - SYS_DUP2 = 63 - SYS_GETPPID = 64 - SYS_GETPGRP = 65 - SYS_SETSID = 66 - SYS_SIGACTION = 67 - SYS_SGETMASK = 68 - SYS_SSETMASK = 69 - SYS_SETREUID = 70 - SYS_SETREGID = 71 - SYS_SIGSUSPEND = 72 - SYS_SIGPENDING = 73 - SYS_SETHOSTNAME = 74 - SYS_SETRLIMIT = 75 - SYS_GETRLIMIT = 76 - SYS_GETRUSAGE = 77 - SYS_GETTIMEOFDAY = 78 - SYS_SETTIMEOFDAY = 79 - SYS_GETGROUPS = 80 - SYS_SETGROUPS = 81 - SYS_SELECT = 82 - SYS_SYMLINK = 83 - SYS_OLDLSTAT = 84 - SYS_READLINK = 85 - SYS_USELIB = 86 - SYS_SWAPON = 87 - SYS_REBOOT = 88 - SYS_READDIR = 89 - SYS_MMAP = 90 - SYS_MUNMAP = 91 - SYS_TRUNCATE = 92 - SYS_FTRUNCATE = 93 - SYS_FCHMOD = 94 - SYS_FCHOWN = 95 - SYS_GETPRIORITY = 96 - SYS_SETPRIORITY = 97 - SYS_PROFIL = 98 - SYS_STATFS = 99 - SYS_FSTATFS = 100 - SYS_IOPERM = 101 - SYS_SOCKETCALL = 102 - SYS_SYSLOG = 103 - SYS_SETITIMER = 104 - SYS_GETITIMER = 105 - SYS_STAT = 106 - SYS_LSTAT = 107 - SYS_FSTAT = 108 - SYS_OLDUNAME = 109 - SYS_IOPL = 110 - SYS_VHANGUP = 111 - SYS_IDLE = 112 - SYS_VM86 = 113 - SYS_WAIT4 = 114 - SYS_SWAPOFF = 115 - SYS_SYSINFO = 116 - SYS_IPC = 117 - SYS_FSYNC = 118 - SYS_SIGRETURN = 119 - SYS_CLONE = 120 - SYS_SETDOMAINNAME = 121 - SYS_UNAME = 122 - SYS_MODIFY_LDT = 123 - SYS_ADJTIMEX = 124 - SYS_MPROTECT = 125 - SYS_SIGPROCMASK = 126 - SYS_CREATE_MODULE = 127 - SYS_INIT_MODULE = 128 - SYS_DELETE_MODULE = 129 - SYS_GET_KERNEL_SYMS = 130 - SYS_QUOTACTL = 131 - SYS_GETPGID = 132 - SYS_FCHDIR = 133 - SYS_BDFLUSH = 134 - SYS_SYSFS = 135 - SYS_PERSONALITY = 136 - SYS_AFS_SYSCALL = 137 - SYS_SETFSUID = 138 - SYS_SETFSGID = 139 - SYS__LLSEEK = 140 - SYS_GETDENTS = 141 - SYS__NEWSELECT = 142 - SYS_FLOCK = 143 - SYS_MSYNC = 144 - SYS_READV = 145 - SYS_WRITEV = 146 - SYS_GETSID = 147 - SYS_FDATASYNC = 148 - SYS__SYSCTL = 149 - SYS_MLOCK = 150 - SYS_MUNLOCK = 151 - SYS_MLOCKALL = 152 - SYS_MUNLOCKALL = 153 - SYS_SCHED_SETPARAM = 154 - SYS_SCHED_GETPARAM = 155 - SYS_SCHED_SETSCHEDULER = 156 - SYS_SCHED_GETSCHEDULER = 157 - SYS_SCHED_YIELD = 158 - SYS_SCHED_GET_PRIORITY_MAX = 159 - SYS_SCHED_GET_PRIORITY_MIN = 160 - SYS_SCHED_RR_GET_INTERVAL = 161 - SYS_NANOSLEEP = 162 - SYS_MREMAP = 163 - SYS_SETRESUID = 164 - SYS_GETRESUID = 165 - SYS_QUERY_MODULE = 166 - SYS_POLL = 167 - SYS_NFSSERVCTL = 168 - SYS_SETRESGID = 169 - SYS_GETRESGID = 170 - SYS_PRCTL = 171 - SYS_RT_SIGRETURN = 172 - SYS_RT_SIGACTION = 173 - SYS_RT_SIGPROCMASK = 174 - SYS_RT_SIGPENDING = 175 - SYS_RT_SIGTIMEDWAIT = 176 - SYS_RT_SIGQUEUEINFO = 177 - SYS_RT_SIGSUSPEND = 178 - SYS_PREAD64 = 179 - SYS_PWRITE64 = 180 - SYS_CHOWN = 181 - SYS_GETCWD = 182 - SYS_CAPGET = 183 - SYS_CAPSET = 184 - SYS_SIGALTSTACK = 185 - SYS_SENDFILE = 186 - SYS_GETPMSG = 187 - SYS_PUTPMSG = 188 - SYS_VFORK = 189 - SYS_UGETRLIMIT = 190 - SYS_READAHEAD = 191 - SYS_PCICONFIG_READ = 198 - SYS_PCICONFIG_WRITE = 199 - SYS_PCICONFIG_IOBASE = 200 - SYS_MULTIPLEXER = 201 - SYS_GETDENTS64 = 202 - SYS_PIVOT_ROOT = 203 - SYS_MADVISE = 205 - SYS_MINCORE = 206 - SYS_GETTID = 207 - SYS_TKILL = 208 - SYS_SETXATTR = 209 - SYS_LSETXATTR = 210 - SYS_FSETXATTR = 211 - SYS_GETXATTR = 212 - SYS_LGETXATTR = 213 - SYS_FGETXATTR = 214 - SYS_LISTXATTR = 215 - SYS_LLISTXATTR = 216 - SYS_FLISTXATTR = 217 - SYS_REMOVEXATTR = 218 - SYS_LREMOVEXATTR = 219 - SYS_FREMOVEXATTR = 220 - SYS_FUTEX = 221 - SYS_SCHED_SETAFFINITY = 222 - SYS_SCHED_GETAFFINITY = 223 - SYS_TUXCALL = 225 - SYS_IO_SETUP = 227 - SYS_IO_DESTROY = 228 - SYS_IO_GETEVENTS = 229 - SYS_IO_SUBMIT = 230 - SYS_IO_CANCEL = 231 - SYS_SET_TID_ADDRESS = 232 - SYS_FADVISE64 = 233 - SYS_EXIT_GROUP = 234 - SYS_LOOKUP_DCOOKIE = 235 - SYS_EPOLL_CREATE = 236 - SYS_EPOLL_CTL = 237 - SYS_EPOLL_WAIT = 238 - SYS_REMAP_FILE_PAGES = 239 - SYS_TIMER_CREATE = 240 - SYS_TIMER_SETTIME = 241 - SYS_TIMER_GETTIME = 242 - SYS_TIMER_GETOVERRUN = 243 - SYS_TIMER_DELETE = 244 - SYS_CLOCK_SETTIME = 245 - SYS_CLOCK_GETTIME = 246 - SYS_CLOCK_GETRES = 247 - SYS_CLOCK_NANOSLEEP = 248 - SYS_SWAPCONTEXT = 249 - SYS_TGKILL = 250 - SYS_UTIMES = 251 - SYS_STATFS64 = 252 - SYS_FSTATFS64 = 253 - SYS_RTAS = 255 - SYS_SYS_DEBUG_SETCONTEXT = 256 - SYS_MIGRATE_PAGES = 258 - SYS_MBIND = 259 - SYS_GET_MEMPOLICY = 260 - SYS_SET_MEMPOLICY = 261 - SYS_MQ_OPEN = 262 - SYS_MQ_UNLINK = 263 - SYS_MQ_TIMEDSEND = 264 - SYS_MQ_TIMEDRECEIVE = 265 - SYS_MQ_NOTIFY = 266 - SYS_MQ_GETSETATTR = 267 - SYS_KEXEC_LOAD = 268 - SYS_ADD_KEY = 269 - SYS_REQUEST_KEY = 270 - SYS_KEYCTL = 271 - SYS_WAITID = 272 - SYS_IOPRIO_SET = 273 - SYS_IOPRIO_GET = 274 - SYS_INOTIFY_INIT = 275 - SYS_INOTIFY_ADD_WATCH = 276 - SYS_INOTIFY_RM_WATCH = 277 - SYS_SPU_RUN = 278 - SYS_SPU_CREATE = 279 - SYS_PSELECT6 = 280 - SYS_PPOLL = 281 - SYS_UNSHARE = 282 - SYS_SPLICE = 283 - SYS_TEE = 284 - SYS_VMSPLICE = 285 - SYS_OPENAT = 286 - SYS_MKDIRAT = 287 - SYS_MKNODAT = 288 - SYS_FCHOWNAT = 289 - SYS_FUTIMESAT = 290 - SYS_NEWFSTATAT = 291 - SYS_UNLINKAT = 292 - SYS_RENAMEAT = 293 - SYS_LINKAT = 294 - SYS_SYMLINKAT = 295 - SYS_READLINKAT = 296 - SYS_FCHMODAT = 297 - SYS_FACCESSAT = 298 - SYS_GET_ROBUST_LIST = 299 - SYS_SET_ROBUST_LIST = 300 - SYS_MOVE_PAGES = 301 - SYS_GETCPU = 302 - SYS_EPOLL_PWAIT = 303 - SYS_UTIMENSAT = 304 - SYS_SIGNALFD = 305 - SYS_TIMERFD_CREATE = 306 - SYS_EVENTFD = 307 - SYS_SYNC_FILE_RANGE2 = 308 - SYS_FALLOCATE = 309 - SYS_SUBPAGE_PROT = 310 - SYS_TIMERFD_SETTIME = 311 - SYS_TIMERFD_GETTIME = 312 - SYS_SIGNALFD4 = 313 - SYS_EVENTFD2 = 314 - SYS_EPOLL_CREATE1 = 315 - SYS_DUP3 = 316 - SYS_PIPE2 = 317 - SYS_INOTIFY_INIT1 = 318 - SYS_PERF_EVENT_OPEN = 319 - SYS_PREADV = 320 - SYS_PWRITEV = 321 - SYS_RT_TGSIGQUEUEINFO = 322 - SYS_FANOTIFY_INIT = 323 - SYS_FANOTIFY_MARK = 324 - SYS_PRLIMIT64 = 325 - SYS_SOCKET = 326 - SYS_BIND = 327 - SYS_CONNECT = 328 - SYS_LISTEN = 329 - SYS_ACCEPT = 330 - SYS_GETSOCKNAME = 331 - SYS_GETPEERNAME = 332 - SYS_SOCKETPAIR = 333 - SYS_SEND = 334 - SYS_SENDTO = 335 - SYS_RECV = 336 - SYS_RECVFROM = 337 - SYS_SHUTDOWN = 338 - SYS_SETSOCKOPT = 339 - SYS_GETSOCKOPT = 340 - SYS_SENDMSG = 341 - SYS_RECVMSG = 342 - SYS_RECVMMSG = 343 - SYS_ACCEPT4 = 344 - SYS_NAME_TO_HANDLE_AT = 345 - SYS_OPEN_BY_HANDLE_AT = 346 - SYS_CLOCK_ADJTIME = 347 - SYS_SYNCFS = 348 - SYS_SENDMMSG = 349 - SYS_SETNS = 350 - SYS_PROCESS_VM_READV = 351 - SYS_PROCESS_VM_WRITEV = 352 - SYS_FINIT_MODULE = 353 - SYS_KCMP = 354 -) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go index f60d8f9882..bf00385b85 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go @@ -1,8 +1,6 @@ // mksysnum_netbsd.pl // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT -// +build 386,netbsd - package unix const ( diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go index 48a91d4646..bf00385b85 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go @@ -1,8 +1,6 @@ // mksysnum_netbsd.pl // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT -// +build amd64,netbsd - package unix const ( diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go index 612ba662cb..bf00385b85 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go @@ -1,8 +1,6 @@ // mksysnum_netbsd.pl // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT -// +build arm,netbsd - package unix const ( diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go index 3e8ce2a1dd..a3cae50590 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go @@ -1,8 +1,6 @@ // mksysnum_openbsd.pl // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT -// +build 386,openbsd - package unix const ( diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go index bd28146ddd..a3cae50590 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go @@ -1,8 +1,6 @@ // mksysnum_openbsd.pl // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT -// +build amd64,openbsd - package unix const ( diff --git a/vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go index c708659859..da00f9ee13 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64,solaris - package unix // TODO(aram): remove these before Go 1.3. diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go index 2de1d44e28..75dc532c5d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go @@ -1,4 +1,3 @@ -// +build 386,darwin // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_darwin.go @@ -29,7 +28,7 @@ type Timeval struct { Usec int32 } -type Timeval32 struct{} +type Timeval32 [0]byte type Rusage struct { Utime Timeval diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index 044657878c..93d6d28626 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -1,4 +1,3 @@ -// +build amd64,darwin // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_darwin.go @@ -131,9 +130,9 @@ type Fbootstraptransfer_t struct { } type Log2phys_t struct { - Flags uint32 - Pad_cgo_0 [8]byte - Pad_cgo_1 [8]byte + Flags uint32 + Contigbytes int64 + Devoffset int64 } type Fsid struct { @@ -455,8 +454,3 @@ type Termios struct { Ispeed uint64 Ospeed uint64 } - -const ( - AT_FDCWD = -0x2 - AT_SYMLINK_NOFOLLOW = 0x20 -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go deleted file mode 100644 index 66df363ce5..0000000000 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go +++ /dev/null @@ -1,449 +0,0 @@ -// NOTE: cgo can't generate struct Stat_t and struct Statfs_t yet -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types_darwin.go - -// +build arm,darwin - -package unix - -const ( - sizeofPtr = 0x4 - sizeofShort = 0x2 - sizeofInt = 0x4 - sizeofLong = 0x4 - sizeofLongLong = 0x8 -) - -type ( - _C_short int16 - _C_int int32 - _C_long int32 - _C_long_long int64 -) - -type Timespec struct { - Sec int32 - Nsec int32 -} - -type Timeval struct { - Sec int32 - Usec int32 -} - -type Timeval32 [0]byte - -type Rusage struct { - Utime Timeval - Stime Timeval - Maxrss int32 - Ixrss int32 - Idrss int32 - Isrss int32 - Minflt int32 - Majflt int32 - Nswap int32 - Inblock int32 - Oublock int32 - Msgsnd int32 - Msgrcv int32 - Nsignals int32 - Nvcsw int32 - Nivcsw int32 -} - -type Rlimit struct { - Cur uint64 - Max uint64 -} - -type _Gid_t uint32 - -type Stat_t struct { - Dev int32 - Mode uint16 - Nlink uint16 - Ino uint64 - Uid uint32 - Gid uint32 - Rdev int32 - Atimespec Timespec - Mtimespec Timespec - Ctimespec Timespec - Birthtimespec Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Qspare [2]int64 -} - -type Statfs_t struct { - Bsize uint32 - Iosize int32 - Blocks uint64 - Bfree uint64 - Bavail uint64 - Files uint64 - Ffree uint64 - Fsid Fsid - Owner uint32 - Type uint32 - Flags uint32 - Fssubtype uint32 - Fstypename [16]int8 - Mntonname [1024]int8 - Mntfromname [1024]int8 - Reserved [8]uint32 -} - -type Flock_t struct { - Start int64 - Len int64 - Pid int32 - Type int16 - Whence int16 -} - -type Fstore_t struct { - Flags uint32 - Posmode int32 - Offset int64 - Length int64 - Bytesalloc int64 -} - -type Radvisory_t struct { - Offset int64 - Count int32 -} - -type Fbootstraptransfer_t struct { - Offset int64 - Length uint32 - Buffer *byte -} - -type Log2phys_t struct { - Flags uint32 - Contigbytes int64 - Devoffset int64 -} - -type Fsid struct { - Val [2]int32 -} - -type Dirent struct { - Ino uint64 - Seekoff uint64 - Reclen uint16 - Namlen uint16 - Type uint8 - Name [1024]int8 - Pad_cgo_0 [3]byte -} - -type RawSockaddrInet4 struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type RawSockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -type RawSockaddrUnix struct { - Len uint8 - Family uint8 - Path [104]int8 -} - -type RawSockaddrDatalink struct { - Len uint8 - Family uint8 - Index uint16 - Type uint8 - Nlen uint8 - Alen uint8 - Slen uint8 - Data [12]int8 -} - -type RawSockaddr struct { - Len uint8 - Family uint8 - Data [14]int8 -} - -type RawSockaddrAny struct { - Addr RawSockaddr - Pad [92]int8 -} - -type _Socklen uint32 - -type Linger struct { - Onoff int32 - Linger int32 -} - -type Iovec struct { - Base *byte - Len uint32 -} - -type IPMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type IPv6Mreq struct { - Multiaddr [16]byte /* in6_addr */ - Interface uint32 -} - -type Msghdr struct { - Name *byte - Namelen uint32 - Iov *Iovec - Iovlen int32 - Control *byte - Controllen uint32 - Flags int32 -} - -type Cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type Inet4Pktinfo struct { - Ifindex uint32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type Inet6Pktinfo struct { - Addr [16]byte /* in6_addr */ - Ifindex uint32 -} - -type IPv6MTUInfo struct { - Addr RawSockaddrInet6 - Mtu uint32 -} - -type ICMPv6Filter struct { - Filt [8]uint32 -} - -const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x6c - SizeofSockaddrUnix = 0x6a - SizeofSockaddrDatalink = 0x14 - SizeofLinger = 0x8 - SizeofIPMreq = 0x8 - SizeofIPv6Mreq = 0x14 - SizeofMsghdr = 0x1c - SizeofCmsghdr = 0xc - SizeofInet4Pktinfo = 0xc - SizeofInet6Pktinfo = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofICMPv6Filter = 0x20 -) - -const ( - PTRACE_TRACEME = 0x0 - PTRACE_CONT = 0x7 - PTRACE_KILL = 0x8 -) - -type Kevent_t struct { - Ident uint32 - Filter int16 - Flags uint16 - Fflags uint32 - Data int32 - Udata *byte -} - -type FdSet struct { - Bits [32]int32 -} - -const ( - SizeofIfMsghdr = 0x70 - SizeofIfData = 0x60 - SizeofIfaMsghdr = 0x14 - SizeofIfmaMsghdr = 0x10 - SizeofIfmaMsghdr2 = 0x14 - SizeofRtMsghdr = 0x5c - SizeofRtMetrics = 0x38 -) - -type IfMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - Pad_cgo_0 [2]byte - Data IfData -} - -type IfData struct { - Type uint8 - Typelen uint8 - Physical uint8 - Addrlen uint8 - Hdrlen uint8 - Recvquota uint8 - Xmitquota uint8 - Unused1 uint8 - Mtu uint32 - Metric uint32 - Baudrate uint32 - Ipackets uint32 - Ierrors uint32 - Opackets uint32 - Oerrors uint32 - Collisions uint32 - Ibytes uint32 - Obytes uint32 - Imcasts uint32 - Omcasts uint32 - Iqdrops uint32 - Noproto uint32 - Recvtiming uint32 - Xmittiming uint32 - Lastchange Timeval - Unused2 uint32 - Hwassist uint32 - Reserved1 uint32 - Reserved2 uint32 -} - -type IfaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - Pad_cgo_0 [2]byte - Metric int32 -} - -type IfmaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - Pad_cgo_0 [2]byte -} - -type IfmaMsghdr2 struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - Pad_cgo_0 [2]byte - Refcount int32 -} - -type RtMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Index uint16 - Pad_cgo_0 [2]byte - Flags int32 - Addrs int32 - Pid int32 - Seq int32 - Errno int32 - Use int32 - Inits uint32 - Rmx RtMetrics -} - -type RtMetrics struct { - Locks uint32 - Mtu uint32 - Hopcount uint32 - Expire int32 - Recvpipe uint32 - Sendpipe uint32 - Ssthresh uint32 - Rtt uint32 - Rttvar uint32 - Pksent uint32 - Filler [4]uint32 -} - -const ( - SizeofBpfVersion = 0x4 - SizeofBpfStat = 0x8 - SizeofBpfProgram = 0x8 - SizeofBpfInsn = 0x8 - SizeofBpfHdr = 0x14 -) - -type BpfVersion struct { - Major uint16 - Minor uint16 -} - -type BpfStat struct { - Recv uint32 - Drop uint32 -} - -type BpfProgram struct { - Len uint32 - Insns *BpfInsn -} - -type BpfInsn struct { - Code uint16 - Jt uint8 - Jf uint8 - K uint32 -} - -type BpfHdr struct { - Tstamp Timeval - Caplen uint32 - Datalen uint32 - Hdrlen uint16 - Pad_cgo_0 [2]byte -} - -type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [20]uint8 - Ispeed uint32 - Ospeed uint32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go deleted file mode 100644 index 85d56eabd3..0000000000 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ /dev/null @@ -1,457 +0,0 @@ -// +build arm64,darwin -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types_darwin.go - -package unix - -const ( - sizeofPtr = 0x8 - sizeofShort = 0x2 - sizeofInt = 0x4 - sizeofLong = 0x8 - sizeofLongLong = 0x8 -) - -type ( - _C_short int16 - _C_int int32 - _C_long int64 - _C_long_long int64 -) - -type Timespec struct { - Sec int64 - Nsec int64 -} - -type Timeval struct { - Sec int64 - Usec int32 - Pad_cgo_0 [4]byte -} - -type Timeval32 struct { - Sec int32 - Usec int32 -} - -type Rusage struct { - Utime Timeval - Stime Timeval - Maxrss int64 - Ixrss int64 - Idrss int64 - Isrss int64 - Minflt int64 - Majflt int64 - Nswap int64 - Inblock int64 - Oublock int64 - Msgsnd int64 - Msgrcv int64 - Nsignals int64 - Nvcsw int64 - Nivcsw int64 -} - -type Rlimit struct { - Cur uint64 - Max uint64 -} - -type _Gid_t uint32 - -type Stat_t struct { - Dev int32 - Mode uint16 - Nlink uint16 - Ino uint64 - Uid uint32 - Gid uint32 - Rdev int32 - Pad_cgo_0 [4]byte - Atimespec Timespec - Mtimespec Timespec - Ctimespec Timespec - Birthtimespec Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Qspare [2]int64 -} - -type Statfs_t struct { - Bsize uint32 - Iosize int32 - Blocks uint64 - Bfree uint64 - Bavail uint64 - Files uint64 - Ffree uint64 - Fsid Fsid - Owner uint32 - Type uint32 - Flags uint32 - Fssubtype uint32 - Fstypename [16]int8 - Mntonname [1024]int8 - Mntfromname [1024]int8 - Reserved [8]uint32 -} - -type Flock_t struct { - Start int64 - Len int64 - Pid int32 - Type int16 - Whence int16 -} - -type Fstore_t struct { - Flags uint32 - Posmode int32 - Offset int64 - Length int64 - Bytesalloc int64 -} - -type Radvisory_t struct { - Offset int64 - Count int32 - Pad_cgo_0 [4]byte -} - -type Fbootstraptransfer_t struct { - Offset int64 - Length uint64 - Buffer *byte -} - -type Log2phys_t struct { - Flags uint32 - Pad_cgo_0 [8]byte - Pad_cgo_1 [8]byte -} - -type Fsid struct { - Val [2]int32 -} - -type Dirent struct { - Ino uint64 - Seekoff uint64 - Reclen uint16 - Namlen uint16 - Type uint8 - Name [1024]int8 - Pad_cgo_0 [3]byte -} - -type RawSockaddrInet4 struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type RawSockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -type RawSockaddrUnix struct { - Len uint8 - Family uint8 - Path [104]int8 -} - -type RawSockaddrDatalink struct { - Len uint8 - Family uint8 - Index uint16 - Type uint8 - Nlen uint8 - Alen uint8 - Slen uint8 - Data [12]int8 -} - -type RawSockaddr struct { - Len uint8 - Family uint8 - Data [14]int8 -} - -type RawSockaddrAny struct { - Addr RawSockaddr - Pad [92]int8 -} - -type _Socklen uint32 - -type Linger struct { - Onoff int32 - Linger int32 -} - -type Iovec struct { - Base *byte - Len uint64 -} - -type IPMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type IPv6Mreq struct { - Multiaddr [16]byte /* in6_addr */ - Interface uint32 -} - -type Msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *Iovec - Iovlen int32 - Pad_cgo_1 [4]byte - Control *byte - Controllen uint32 - Flags int32 -} - -type Cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type Inet4Pktinfo struct { - Ifindex uint32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type Inet6Pktinfo struct { - Addr [16]byte /* in6_addr */ - Ifindex uint32 -} - -type IPv6MTUInfo struct { - Addr RawSockaddrInet6 - Mtu uint32 -} - -type ICMPv6Filter struct { - Filt [8]uint32 -} - -const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x6c - SizeofSockaddrUnix = 0x6a - SizeofSockaddrDatalink = 0x14 - SizeofLinger = 0x8 - SizeofIPMreq = 0x8 - SizeofIPv6Mreq = 0x14 - SizeofMsghdr = 0x30 - SizeofCmsghdr = 0xc - SizeofInet4Pktinfo = 0xc - SizeofInet6Pktinfo = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofICMPv6Filter = 0x20 -) - -const ( - PTRACE_TRACEME = 0x0 - PTRACE_CONT = 0x7 - PTRACE_KILL = 0x8 -) - -type Kevent_t struct { - Ident uint64 - Filter int16 - Flags uint16 - Fflags uint32 - Data int64 - Udata *byte -} - -type FdSet struct { - Bits [32]int32 -} - -const ( - SizeofIfMsghdr = 0x70 - SizeofIfData = 0x60 - SizeofIfaMsghdr = 0x14 - SizeofIfmaMsghdr = 0x10 - SizeofIfmaMsghdr2 = 0x14 - SizeofRtMsghdr = 0x5c - SizeofRtMetrics = 0x38 -) - -type IfMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - Pad_cgo_0 [2]byte - Data IfData -} - -type IfData struct { - Type uint8 - Typelen uint8 - Physical uint8 - Addrlen uint8 - Hdrlen uint8 - Recvquota uint8 - Xmitquota uint8 - Unused1 uint8 - Mtu uint32 - Metric uint32 - Baudrate uint32 - Ipackets uint32 - Ierrors uint32 - Opackets uint32 - Oerrors uint32 - Collisions uint32 - Ibytes uint32 - Obytes uint32 - Imcasts uint32 - Omcasts uint32 - Iqdrops uint32 - Noproto uint32 - Recvtiming uint32 - Xmittiming uint32 - Lastchange Timeval32 - Unused2 uint32 - Hwassist uint32 - Reserved1 uint32 - Reserved2 uint32 -} - -type IfaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - Pad_cgo_0 [2]byte - Metric int32 -} - -type IfmaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - Pad_cgo_0 [2]byte -} - -type IfmaMsghdr2 struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - Pad_cgo_0 [2]byte - Refcount int32 -} - -type RtMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Index uint16 - Pad_cgo_0 [2]byte - Flags int32 - Addrs int32 - Pid int32 - Seq int32 - Errno int32 - Use int32 - Inits uint32 - Rmx RtMetrics -} - -type RtMetrics struct { - Locks uint32 - Mtu uint32 - Hopcount uint32 - Expire int32 - Recvpipe uint32 - Sendpipe uint32 - Ssthresh uint32 - Rtt uint32 - Rttvar uint32 - Pksent uint32 - Filler [4]uint32 -} - -const ( - SizeofBpfVersion = 0x4 - SizeofBpfStat = 0x8 - SizeofBpfProgram = 0x10 - SizeofBpfInsn = 0x8 - SizeofBpfHdr = 0x14 -) - -type BpfVersion struct { - Major uint16 - Minor uint16 -} - -type BpfStat struct { - Recv uint32 - Drop uint32 -} - -type BpfProgram struct { - Len uint32 - Pad_cgo_0 [4]byte - Insns *BpfInsn -} - -type BpfInsn struct { - Code uint16 - Jt uint8 - Jf uint8 - K uint32 -} - -type BpfHdr struct { - Tstamp Timeval32 - Caplen uint32 - Datalen uint32 - Hdrlen uint16 - Pad_cgo_0 [2]byte -} - -type Termios struct { - Iflag uint64 - Oflag uint64 - Cflag uint64 - Lflag uint64 - Cc [20]uint8 - Pad_cgo_0 [4]byte - Ispeed uint64 - Ospeed uint64 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_386.go b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_386.go index b7e7ff0886..e1b97ffd12 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_386.go @@ -1,8 +1,6 @@ // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_dragonfly.go -// +build 386,dragonfly - package unix const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go index 8a6f4e1ce3..b94a4ff02a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go @@ -1,8 +1,6 @@ // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_dragonfly.go -// +build amd64,dragonfly - package unix const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go index 8cf30947b4..d9d5ce46ff 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go @@ -1,4 +1,3 @@ -// +build 386,freebsd // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_freebsd.go @@ -139,15 +138,6 @@ type Fsid struct { Val [2]int32 } -const ( - FADV_NORMAL = 0x0 - FADV_RANDOM = 0x1 - FADV_SEQUENTIAL = 0x2 - FADV_WILLNEED = 0x3 - FADV_DONTNEED = 0x4 - FADV_NOREUSE = 0x5 -) - type RawSockaddrInet4 struct { Len uint8 Family uint8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go index e5feb207be..80c6b81254 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go @@ -1,4 +1,3 @@ -// +build amd64,freebsd // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_freebsd.go @@ -139,15 +138,6 @@ type Fsid struct { Val [2]int32 } -const ( - FADV_NORMAL = 0x0 - FADV_RANDOM = 0x1 - FADV_SEQUENTIAL = 0x2 - FADV_WILLNEED = 0x3 - FADV_DONTNEED = 0x4 - FADV_NOREUSE = 0x5 -) - type RawSockaddrInet4 struct { Len uint8 Family uint8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go index 5472b54284..bd971b5647 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go @@ -1,8 +1,6 @@ // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -fsigned-char types_freebsd.go -// +build arm,freebsd - package unix const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index cf5db0e1b6..f1ce93e1ff 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -1,4 +1,3 @@ -// +build 386,linux // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_linux.go @@ -504,7 +503,7 @@ type InotifyEvent struct { Mask uint32 Cookie uint32 Len uint32 - Name [0]int8 + Name [0]uint8 } const SizeofInotifyEvent = 0x10 @@ -573,18 +572,119 @@ type EpollEvent struct { } const ( - AT_FDCWD = -0x64 - AT_SYMLINK_NOFOLLOW = 0x100 - AT_REMOVEDIR = 0x200 + _AT_FDCWD = -0x64 ) type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Line uint8 - Cc [19]uint8 - Ispeed uint32 - Ospeed uint32 + Iflag uint32 + Oflag uint32 + Cflag uint32 + Lflag uint32 + Line uint8 + Cc [32]uint8 + Pad_cgo_0 [3]byte + Ispeed uint32 + Ospeed uint32 } + +const ( + VINTR = 0x0 + VQUIT = 0x1 + VERASE = 0x2 + VKILL = 0x3 + VEOF = 0x4 + VTIME = 0x5 + VMIN = 0x6 + VSWTC = 0x7 + VSTART = 0x8 + VSTOP = 0x9 + VSUSP = 0xa + VEOL = 0xb + VREPRINT = 0xc + VDISCARD = 0xd + VWERASE = 0xe + VLNEXT = 0xf + VEOL2 = 0x10 + IGNBRK = 0x1 + BRKINT = 0x2 + IGNPAR = 0x4 + PARMRK = 0x8 + INPCK = 0x10 + ISTRIP = 0x20 + INLCR = 0x40 + IGNCR = 0x80 + ICRNL = 0x100 + IUCLC = 0x200 + IXON = 0x400 + IXANY = 0x800 + IXOFF = 0x1000 + IMAXBEL = 0x2000 + IUTF8 = 0x4000 + OPOST = 0x1 + OLCUC = 0x2 + ONLCR = 0x4 + OCRNL = 0x8 + ONOCR = 0x10 + ONLRET = 0x20 + OFILL = 0x40 + OFDEL = 0x80 + B0 = 0x0 + B50 = 0x1 + B75 = 0x2 + B110 = 0x3 + B134 = 0x4 + B150 = 0x5 + B200 = 0x6 + B300 = 0x7 + B600 = 0x8 + B1200 = 0x9 + B1800 = 0xa + B2400 = 0xb + B4800 = 0xc + B9600 = 0xd + B19200 = 0xe + B38400 = 0xf + CSIZE = 0x30 + CS5 = 0x0 + CS6 = 0x10 + CS7 = 0x20 + CS8 = 0x30 + CSTOPB = 0x40 + CREAD = 0x80 + PARENB = 0x100 + PARODD = 0x200 + HUPCL = 0x400 + CLOCAL = 0x800 + B57600 = 0x1001 + B115200 = 0x1002 + B230400 = 0x1003 + B460800 = 0x1004 + B500000 = 0x1005 + B576000 = 0x1006 + B921600 = 0x1007 + B1000000 = 0x1008 + B1152000 = 0x1009 + B1500000 = 0x100a + B2000000 = 0x100b + B2500000 = 0x100c + B3000000 = 0x100d + B3500000 = 0x100e + B4000000 = 0x100f + ISIG = 0x1 + ICANON = 0x2 + XCASE = 0x4 + ECHO = 0x8 + ECHOE = 0x10 + ECHOK = 0x20 + ECHONL = 0x40 + NOFLSH = 0x80 + TOSTOP = 0x100 + ECHOCTL = 0x200 + ECHOPRT = 0x400 + ECHOKE = 0x800 + FLUSHO = 0x1000 + PENDIN = 0x4000 + IEXTEN = 0x8000 + TCGETS = 0x5401 + TCSETS = 0x5402 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index ac27784ab2..f84745ae6d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -1,4 +1,3 @@ -// +build amd64,linux // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_linux.go @@ -508,7 +507,7 @@ type InotifyEvent struct { Mask uint32 Cookie uint32 Len uint32 - Name [0]int8 + Name [0]uint8 } const SizeofInotifyEvent = 0x10 @@ -562,7 +561,7 @@ type Sysinfo_t struct { Totalhigh uint64 Freehigh uint64 Unit uint32 - X_f [0]int8 + X_f [0]byte Pad_cgo_1 [4]byte } @@ -591,18 +590,119 @@ type EpollEvent struct { } const ( - AT_FDCWD = -0x64 - AT_SYMLINK_NOFOLLOW = 0x100 - AT_REMOVEDIR = 0x200 + _AT_FDCWD = -0x64 ) type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Line uint8 - Cc [19]uint8 - Ispeed uint32 - Ospeed uint32 + Iflag uint32 + Oflag uint32 + Cflag uint32 + Lflag uint32 + Line uint8 + Cc [32]uint8 + Pad_cgo_0 [3]byte + Ispeed uint32 + Ospeed uint32 } + +const ( + VINTR = 0x0 + VQUIT = 0x1 + VERASE = 0x2 + VKILL = 0x3 + VEOF = 0x4 + VTIME = 0x5 + VMIN = 0x6 + VSWTC = 0x7 + VSTART = 0x8 + VSTOP = 0x9 + VSUSP = 0xa + VEOL = 0xb + VREPRINT = 0xc + VDISCARD = 0xd + VWERASE = 0xe + VLNEXT = 0xf + VEOL2 = 0x10 + IGNBRK = 0x1 + BRKINT = 0x2 + IGNPAR = 0x4 + PARMRK = 0x8 + INPCK = 0x10 + ISTRIP = 0x20 + INLCR = 0x40 + IGNCR = 0x80 + ICRNL = 0x100 + IUCLC = 0x200 + IXON = 0x400 + IXANY = 0x800 + IXOFF = 0x1000 + IMAXBEL = 0x2000 + IUTF8 = 0x4000 + OPOST = 0x1 + OLCUC = 0x2 + ONLCR = 0x4 + OCRNL = 0x8 + ONOCR = 0x10 + ONLRET = 0x20 + OFILL = 0x40 + OFDEL = 0x80 + B0 = 0x0 + B50 = 0x1 + B75 = 0x2 + B110 = 0x3 + B134 = 0x4 + B150 = 0x5 + B200 = 0x6 + B300 = 0x7 + B600 = 0x8 + B1200 = 0x9 + B1800 = 0xa + B2400 = 0xb + B4800 = 0xc + B9600 = 0xd + B19200 = 0xe + B38400 = 0xf + CSIZE = 0x30 + CS5 = 0x0 + CS6 = 0x10 + CS7 = 0x20 + CS8 = 0x30 + CSTOPB = 0x40 + CREAD = 0x80 + PARENB = 0x100 + PARODD = 0x200 + HUPCL = 0x400 + CLOCAL = 0x800 + B57600 = 0x1001 + B115200 = 0x1002 + B230400 = 0x1003 + B460800 = 0x1004 + B500000 = 0x1005 + B576000 = 0x1006 + B921600 = 0x1007 + B1000000 = 0x1008 + B1152000 = 0x1009 + B1500000 = 0x100a + B2000000 = 0x100b + B2500000 = 0x100c + B3000000 = 0x100d + B3500000 = 0x100e + B4000000 = 0x100f + ISIG = 0x1 + ICANON = 0x2 + XCASE = 0x4 + ECHO = 0x8 + ECHOE = 0x10 + ECHOK = 0x20 + ECHONL = 0x40 + NOFLSH = 0x80 + TOSTOP = 0x100 + ECHOCTL = 0x200 + ECHOPRT = 0x400 + ECHOKE = 0x800 + FLUSHO = 0x1000 + PENDIN = 0x4000 + IEXTEN = 0x8000 + TCGETS = 0x5401 + TCSETS = 0x5402 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index b318bb851c..e820995af0 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -1,4 +1,3 @@ -// +build arm,linux // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_linux.go @@ -562,18 +561,119 @@ type EpollEvent struct { } const ( - AT_FDCWD = -0x64 - AT_SYMLINK_NOFOLLOW = 0x100 - AT_REMOVEDIR = 0x200 + _AT_FDCWD = -0x64 ) type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Line uint8 - Cc [19]uint8 - Ispeed uint32 - Ospeed uint32 + Iflag uint32 + Oflag uint32 + Cflag uint32 + Lflag uint32 + Line uint8 + Cc [32]uint8 + Pad_cgo_0 [3]byte + Ispeed uint32 + Ospeed uint32 } + +const ( + VINTR = 0x0 + VQUIT = 0x1 + VERASE = 0x2 + VKILL = 0x3 + VEOF = 0x4 + VTIME = 0x5 + VMIN = 0x6 + VSWTC = 0x7 + VSTART = 0x8 + VSTOP = 0x9 + VSUSP = 0xa + VEOL = 0xb + VREPRINT = 0xc + VDISCARD = 0xd + VWERASE = 0xe + VLNEXT = 0xf + VEOL2 = 0x10 + IGNBRK = 0x1 + BRKINT = 0x2 + IGNPAR = 0x4 + PARMRK = 0x8 + INPCK = 0x10 + ISTRIP = 0x20 + INLCR = 0x40 + IGNCR = 0x80 + ICRNL = 0x100 + IUCLC = 0x200 + IXON = 0x400 + IXANY = 0x800 + IXOFF = 0x1000 + IMAXBEL = 0x2000 + IUTF8 = 0x4000 + OPOST = 0x1 + OLCUC = 0x2 + ONLCR = 0x4 + OCRNL = 0x8 + ONOCR = 0x10 + ONLRET = 0x20 + OFILL = 0x40 + OFDEL = 0x80 + B0 = 0x0 + B50 = 0x1 + B75 = 0x2 + B110 = 0x3 + B134 = 0x4 + B150 = 0x5 + B200 = 0x6 + B300 = 0x7 + B600 = 0x8 + B1200 = 0x9 + B1800 = 0xa + B2400 = 0xb + B4800 = 0xc + B9600 = 0xd + B19200 = 0xe + B38400 = 0xf + CSIZE = 0x30 + CS5 = 0x0 + CS6 = 0x10 + CS7 = 0x20 + CS8 = 0x30 + CSTOPB = 0x40 + CREAD = 0x80 + PARENB = 0x100 + PARODD = 0x200 + HUPCL = 0x400 + CLOCAL = 0x800 + B57600 = 0x1001 + B115200 = 0x1002 + B230400 = 0x1003 + B460800 = 0x1004 + B500000 = 0x1005 + B576000 = 0x1006 + B921600 = 0x1007 + B1000000 = 0x1008 + B1152000 = 0x1009 + B1500000 = 0x100a + B2000000 = 0x100b + B2500000 = 0x100c + B3000000 = 0x100d + B3500000 = 0x100e + B4000000 = 0x100f + ISIG = 0x1 + ICANON = 0x2 + XCASE = 0x4 + ECHO = 0x8 + ECHOE = 0x10 + ECHOK = 0x20 + ECHONL = 0x40 + NOFLSH = 0x80 + TOSTOP = 0x100 + ECHOCTL = 0x200 + ECHOPRT = 0x400 + ECHOKE = 0x800 + FLUSHO = 0x1000 + PENDIN = 0x4000 + IEXTEN = 0x8000 + TCGETS = 0x5401 + TCSETS = 0x5402 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go deleted file mode 100644 index a159aadab6..0000000000 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ /dev/null @@ -1,595 +0,0 @@ -// +build arm64,linux -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs -- -fsigned-char types_linux.go - -package unix - -const ( - sizeofPtr = 0x8 - sizeofShort = 0x2 - sizeofInt = 0x4 - sizeofLong = 0x8 - sizeofLongLong = 0x8 - PathMax = 0x1000 -) - -type ( - _C_short int16 - _C_int int32 - _C_long int64 - _C_long_long int64 -) - -type Timespec struct { - Sec int64 - Nsec int64 -} - -type Timeval struct { - Sec int64 - Usec int64 -} - -type Timex struct { - Modes uint32 - Pad_cgo_0 [4]byte - Offset int64 - Freq int64 - Maxerror int64 - Esterror int64 - Status int32 - Pad_cgo_1 [4]byte - Constant int64 - Precision int64 - Tolerance int64 - Time Timeval - Tick int64 - Ppsfreq int64 - Jitter int64 - Shift int32 - Pad_cgo_2 [4]byte - Stabil int64 - Jitcnt int64 - Calcnt int64 - Errcnt int64 - Stbcnt int64 - Tai int32 - Pad_cgo_3 [44]byte -} - -type Time_t int64 - -type Tms struct { - Utime int64 - Stime int64 - Cutime int64 - Cstime int64 -} - -type Utimbuf struct { - Actime int64 - Modtime int64 -} - -type Rusage struct { - Utime Timeval - Stime Timeval - Maxrss int64 - Ixrss int64 - Idrss int64 - Isrss int64 - Minflt int64 - Majflt int64 - Nswap int64 - Inblock int64 - Oublock int64 - Msgsnd int64 - Msgrcv int64 - Nsignals int64 - Nvcsw int64 - Nivcsw int64 -} - -type Rlimit struct { - Cur uint64 - Max uint64 -} - -type _Gid_t uint32 - -type Stat_t struct { - Dev uint64 - Ino uint64 - Mode uint32 - Nlink uint32 - Uid uint32 - Gid uint32 - Rdev uint64 - X__pad1 uint64 - Size int64 - Blksize int32 - X__pad2 int32 - Blocks int64 - Atim Timespec - Mtim Timespec - Ctim Timespec - X__glibc_reserved [2]int32 -} - -type Statfs_t struct { - Type int64 - Bsize int64 - Blocks uint64 - Bfree uint64 - Bavail uint64 - Files uint64 - Ffree uint64 - Fsid Fsid - Namelen int64 - Frsize int64 - Flags int64 - Spare [4]int64 -} - -type Dirent struct { - Ino uint64 - Off int64 - Reclen uint16 - Type uint8 - Name [256]int8 - Pad_cgo_0 [5]byte -} - -type Fsid struct { - X__val [2]int32 -} - -type Flock_t struct { - Type int16 - Whence int16 - Pad_cgo_0 [4]byte - Start int64 - Len int64 - Pid int32 - Pad_cgo_1 [4]byte -} - -const ( - FADV_NORMAL = 0x0 - FADV_RANDOM = 0x1 - FADV_SEQUENTIAL = 0x2 - FADV_WILLNEED = 0x3 - FADV_DONTNEED = 0x4 - FADV_NOREUSE = 0x5 -) - -type RawSockaddrInet4 struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]uint8 -} - -type RawSockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -type RawSockaddrUnix struct { - Family uint16 - Path [108]int8 -} - -type RawSockaddrLinklayer struct { - Family uint16 - Protocol uint16 - Ifindex int32 - Hatype uint16 - Pkttype uint8 - Halen uint8 - Addr [8]uint8 -} - -type RawSockaddrNetlink struct { - Family uint16 - Pad uint16 - Pid uint32 - Groups uint32 -} - -type RawSockaddr struct { - Family uint16 - Data [14]int8 -} - -type RawSockaddrAny struct { - Addr RawSockaddr - Pad [96]int8 -} - -type _Socklen uint32 - -type Linger struct { - Onoff int32 - Linger int32 -} - -type Iovec struct { - Base *byte - Len uint64 -} - -type IPMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type IPMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type IPv6Mreq struct { - Multiaddr [16]byte /* in6_addr */ - Interface uint32 -} - -type Msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *Iovec - Iovlen uint64 - Control *byte - Controllen uint64 - Flags int32 - Pad_cgo_1 [4]byte -} - -type Cmsghdr struct { - Len uint64 - Level int32 - Type int32 - X__cmsg_data [0]uint8 -} - -type Inet4Pktinfo struct { - Ifindex int32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type Inet6Pktinfo struct { - Addr [16]byte /* in6_addr */ - Ifindex uint32 -} - -type IPv6MTUInfo struct { - Addr RawSockaddrInet6 - Mtu uint32 -} - -type ICMPv6Filter struct { - Data [8]uint32 -} - -type Ucred struct { - Pid int32 - Uid uint32 - Gid uint32 -} - -type TCPInfo struct { - State uint8 - Ca_state uint8 - Retransmits uint8 - Probes uint8 - Backoff uint8 - Options uint8 - Pad_cgo_0 [2]byte - Rto uint32 - Ato uint32 - Snd_mss uint32 - Rcv_mss uint32 - Unacked uint32 - Sacked uint32 - Lost uint32 - Retrans uint32 - Fackets uint32 - Last_data_sent uint32 - Last_ack_sent uint32 - Last_data_recv uint32 - Last_ack_recv uint32 - Pmtu uint32 - Rcv_ssthresh uint32 - Rtt uint32 - Rttvar uint32 - Snd_ssthresh uint32 - Snd_cwnd uint32 - Advmss uint32 - Reordering uint32 - Rcv_rtt uint32 - Rcv_space uint32 - Total_retrans uint32 -} - -const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x70 - SizeofSockaddrUnix = 0x6e - SizeofSockaddrLinklayer = 0x14 - SizeofSockaddrNetlink = 0xc - SizeofLinger = 0x8 - SizeofIPMreq = 0x8 - SizeofIPMreqn = 0xc - SizeofIPv6Mreq = 0x14 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 - SizeofInet4Pktinfo = 0xc - SizeofInet6Pktinfo = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofICMPv6Filter = 0x20 - SizeofUcred = 0xc - SizeofTCPInfo = 0x68 -) - -const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x22 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 -) - -type NlMsghdr struct { - Len uint32 - Type uint16 - Flags uint16 - Seq uint32 - Pid uint32 -} - -type NlMsgerr struct { - Error int32 - Msg NlMsghdr -} - -type RtGenmsg struct { - Family uint8 -} - -type NlAttr struct { - Len uint16 - Type uint16 -} - -type RtAttr struct { - Len uint16 - Type uint16 -} - -type IfInfomsg struct { - Family uint8 - X__ifi_pad uint8 - Type uint16 - Index int32 - Flags uint32 - Change uint32 -} - -type IfAddrmsg struct { - Family uint8 - Prefixlen uint8 - Flags uint8 - Scope uint8 - Index uint32 -} - -type RtMsg struct { - Family uint8 - Dst_len uint8 - Src_len uint8 - Tos uint8 - Table uint8 - Protocol uint8 - Scope uint8 - Type uint8 - Flags uint32 -} - -type RtNexthop struct { - Len uint16 - Flags uint8 - Hops uint8 - Ifindex int32 -} - -const ( - SizeofSockFilter = 0x8 - SizeofSockFprog = 0x10 -) - -type SockFilter struct { - Code uint16 - Jt uint8 - Jf uint8 - K uint32 -} - -type SockFprog struct { - Len uint16 - Pad_cgo_0 [6]byte - Filter *SockFilter -} - -type InotifyEvent struct { - Wd int32 - Mask uint32 - Cookie uint32 - Len uint32 - Name [0]int8 -} - -const SizeofInotifyEvent = 0x10 - -type PtraceRegs struct { - Regs [31]uint64 - Sp uint64 - Pc uint64 - Pstate uint64 -} - -type FdSet struct { - Bits [16]int64 -} - -type Sysinfo_t struct { - Uptime int64 - Loads [3]uint64 - Totalram uint64 - Freeram uint64 - Sharedram uint64 - Bufferram uint64 - Totalswap uint64 - Freeswap uint64 - Procs uint16 - Pad uint16 - Pad_cgo_0 [4]byte - Totalhigh uint64 - Freehigh uint64 - Unit uint32 - X_f [0]int8 - Pad_cgo_1 [4]byte -} - -type Utsname struct { - Sysname [65]int8 - Nodename [65]int8 - Release [65]int8 - Version [65]int8 - Machine [65]int8 - Domainname [65]int8 -} - -type Ustat_t struct { - Tfree int32 - Pad_cgo_0 [4]byte - Tinode uint64 - Fname [6]int8 - Fpack [6]int8 - Pad_cgo_1 [4]byte -} - -type EpollEvent struct { - Events uint32 - Fd int32 - Pad int32 -} - -const ( - AT_FDCWD = -0x64 - AT_REMOVEDIR = 0x200 - AT_SYMLINK_NOFOLLOW = 0x100 -) - -type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Line uint8 - Cc [19]uint8 - Ispeed uint32 - Ospeed uint32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go deleted file mode 100644 index b14cbfef0d..0000000000 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ /dev/null @@ -1,605 +0,0 @@ -// +build ppc64,linux -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types_linux.go - -package unix - -const ( - sizeofPtr = 0x8 - sizeofShort = 0x2 - sizeofInt = 0x4 - sizeofLong = 0x8 - sizeofLongLong = 0x8 - PathMax = 0x1000 -) - -type ( - _C_short int16 - _C_int int32 - _C_long int64 - _C_long_long int64 -) - -type Timespec struct { - Sec int64 - Nsec int64 -} - -type Timeval struct { - Sec int64 - Usec int64 -} - -type Timex struct { - Modes uint32 - Pad_cgo_0 [4]byte - Offset int64 - Freq int64 - Maxerror int64 - Esterror int64 - Status int32 - Pad_cgo_1 [4]byte - Constant int64 - Precision int64 - Tolerance int64 - Time Timeval - Tick int64 - Ppsfreq int64 - Jitter int64 - Shift int32 - Pad_cgo_2 [4]byte - Stabil int64 - Jitcnt int64 - Calcnt int64 - Errcnt int64 - Stbcnt int64 - Tai int32 - Pad_cgo_3 [44]byte -} - -type Time_t int64 - -type Tms struct { - Utime int64 - Stime int64 - Cutime int64 - Cstime int64 -} - -type Utimbuf struct { - Actime int64 - Modtime int64 -} - -type Rusage struct { - Utime Timeval - Stime Timeval - Maxrss int64 - Ixrss int64 - Idrss int64 - Isrss int64 - Minflt int64 - Majflt int64 - Nswap int64 - Inblock int64 - Oublock int64 - Msgsnd int64 - Msgrcv int64 - Nsignals int64 - Nvcsw int64 - Nivcsw int64 -} - -type Rlimit struct { - Cur uint64 - Max uint64 -} - -type _Gid_t uint32 - -type Stat_t struct { - Dev uint64 - Ino uint64 - Nlink uint64 - Mode uint32 - Uid uint32 - Gid uint32 - X__pad2 int32 - Rdev uint64 - Size int64 - Blksize int64 - Blocks int64 - Atim Timespec - Mtim Timespec - Ctim Timespec - X__glibc_reserved4 uint64 - X__glibc_reserved5 uint64 - X__glibc_reserved6 uint64 -} - -type Statfs_t struct { - Type int64 - Bsize int64 - Blocks uint64 - Bfree uint64 - Bavail uint64 - Files uint64 - Ffree uint64 - Fsid Fsid - Namelen int64 - Frsize int64 - Flags int64 - Spare [4]int64 -} - -type Dirent struct { - Ino uint64 - Off int64 - Reclen uint16 - Type uint8 - Name [256]uint8 - Pad_cgo_0 [5]byte -} - -type Fsid struct { - X__val [2]int32 -} - -type Flock_t struct { - Type int16 - Whence int16 - Pad_cgo_0 [4]byte - Start int64 - Len int64 - Pid int32 - Pad_cgo_1 [4]byte -} - -const ( - FADV_NORMAL = 0x0 - FADV_RANDOM = 0x1 - FADV_SEQUENTIAL = 0x2 - FADV_WILLNEED = 0x3 - FADV_DONTNEED = 0x4 - FADV_NOREUSE = 0x5 -) - -type RawSockaddrInet4 struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]uint8 -} - -type RawSockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -type RawSockaddrUnix struct { - Family uint16 - Path [108]int8 -} - -type RawSockaddrLinklayer struct { - Family uint16 - Protocol uint16 - Ifindex int32 - Hatype uint16 - Pkttype uint8 - Halen uint8 - Addr [8]uint8 -} - -type RawSockaddrNetlink struct { - Family uint16 - Pad uint16 - Pid uint32 - Groups uint32 -} - -type RawSockaddr struct { - Family uint16 - Data [14]uint8 -} - -type RawSockaddrAny struct { - Addr RawSockaddr - Pad [96]uint8 -} - -type _Socklen uint32 - -type Linger struct { - Onoff int32 - Linger int32 -} - -type Iovec struct { - Base *byte - Len uint64 -} - -type IPMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type IPMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type IPv6Mreq struct { - Multiaddr [16]byte /* in6_addr */ - Interface uint32 -} - -type Msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *Iovec - Iovlen uint64 - Control *byte - Controllen uint64 - Flags int32 - Pad_cgo_1 [4]byte -} - -type Cmsghdr struct { - Len uint64 - Level int32 - Type int32 - X__cmsg_data [0]uint8 -} - -type Inet4Pktinfo struct { - Ifindex int32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type Inet6Pktinfo struct { - Addr [16]byte /* in6_addr */ - Ifindex uint32 -} - -type IPv6MTUInfo struct { - Addr RawSockaddrInet6 - Mtu uint32 -} - -type ICMPv6Filter struct { - Data [8]uint32 -} - -type Ucred struct { - Pid int32 - Uid uint32 - Gid uint32 -} - -type TCPInfo struct { - State uint8 - Ca_state uint8 - Retransmits uint8 - Probes uint8 - Backoff uint8 - Options uint8 - Pad_cgo_0 [2]byte - Rto uint32 - Ato uint32 - Snd_mss uint32 - Rcv_mss uint32 - Unacked uint32 - Sacked uint32 - Lost uint32 - Retrans uint32 - Fackets uint32 - Last_data_sent uint32 - Last_ack_sent uint32 - Last_data_recv uint32 - Last_ack_recv uint32 - Pmtu uint32 - Rcv_ssthresh uint32 - Rtt uint32 - Rttvar uint32 - Snd_ssthresh uint32 - Snd_cwnd uint32 - Advmss uint32 - Reordering uint32 - Rcv_rtt uint32 - Rcv_space uint32 - Total_retrans uint32 -} - -const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x70 - SizeofSockaddrUnix = 0x6e - SizeofSockaddrLinklayer = 0x14 - SizeofSockaddrNetlink = 0xc - SizeofLinger = 0x8 - SizeofIPMreq = 0x8 - SizeofIPMreqn = 0xc - SizeofIPv6Mreq = 0x14 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 - SizeofInet4Pktinfo = 0xc - SizeofInet6Pktinfo = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofICMPv6Filter = 0x20 - SizeofUcred = 0xc - SizeofTCPInfo = 0x68 -) - -const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x23 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 -) - -type NlMsghdr struct { - Len uint32 - Type uint16 - Flags uint16 - Seq uint32 - Pid uint32 -} - -type NlMsgerr struct { - Error int32 - Msg NlMsghdr -} - -type RtGenmsg struct { - Family uint8 -} - -type NlAttr struct { - Len uint16 - Type uint16 -} - -type RtAttr struct { - Len uint16 - Type uint16 -} - -type IfInfomsg struct { - Family uint8 - X__ifi_pad uint8 - Type uint16 - Index int32 - Flags uint32 - Change uint32 -} - -type IfAddrmsg struct { - Family uint8 - Prefixlen uint8 - Flags uint8 - Scope uint8 - Index uint32 -} - -type RtMsg struct { - Family uint8 - Dst_len uint8 - Src_len uint8 - Tos uint8 - Table uint8 - Protocol uint8 - Scope uint8 - Type uint8 - Flags uint32 -} - -type RtNexthop struct { - Len uint16 - Flags uint8 - Hops uint8 - Ifindex int32 -} - -const ( - SizeofSockFilter = 0x8 - SizeofSockFprog = 0x10 -) - -type SockFilter struct { - Code uint16 - Jt uint8 - Jf uint8 - K uint32 -} - -type SockFprog struct { - Len uint16 - Pad_cgo_0 [6]byte - Filter *SockFilter -} - -type InotifyEvent struct { - Wd int32 - Mask uint32 - Cookie uint32 - Len uint32 - Name [0]uint8 -} - -const SizeofInotifyEvent = 0x10 - -type PtraceRegs struct { - Gpr [32]uint64 - Nip uint64 - Msr uint64 - Orig_gpr3 uint64 - Ctr uint64 - Link uint64 - Xer uint64 - Ccr uint64 - Softe uint64 - Trap uint64 - Dar uint64 - Dsisr uint64 - Result uint64 -} - -type FdSet struct { - Bits [16]int64 -} - -type Sysinfo_t struct { - Uptime int64 - Loads [3]uint64 - Totalram uint64 - Freeram uint64 - Sharedram uint64 - Bufferram uint64 - Totalswap uint64 - Freeswap uint64 - Procs uint16 - Pad uint16 - Pad_cgo_0 [4]byte - Totalhigh uint64 - Freehigh uint64 - Unit uint32 - X_f [0]uint8 - Pad_cgo_1 [4]byte -} - -type Utsname struct { - Sysname [65]uint8 - Nodename [65]uint8 - Release [65]uint8 - Version [65]uint8 - Machine [65]uint8 - Domainname [65]uint8 -} - -type Ustat_t struct { - Tfree int32 - Pad_cgo_0 [4]byte - Tinode uint64 - Fname [6]uint8 - Fpack [6]uint8 - Pad_cgo_1 [4]byte -} - -type EpollEvent struct { - Events uint32 - Fd int32 - Pad int32 -} - -const ( - AT_FDCWD = -0x64 - AT_REMOVEDIR = 0x200 - AT_SYMLINK_NOFOLLOW = 0x100 -) - -type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [19]uint8 - Line uint8 - Ispeed uint32 - Ospeed uint32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go deleted file mode 100644 index 22c96a2f0a..0000000000 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ /dev/null @@ -1,605 +0,0 @@ -// +build ppc64le,linux -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types_linux.go - -package unix - -const ( - sizeofPtr = 0x8 - sizeofShort = 0x2 - sizeofInt = 0x4 - sizeofLong = 0x8 - sizeofLongLong = 0x8 - PathMax = 0x1000 -) - -type ( - _C_short int16 - _C_int int32 - _C_long int64 - _C_long_long int64 -) - -type Timespec struct { - Sec int64 - Nsec int64 -} - -type Timeval struct { - Sec int64 - Usec int64 -} - -type Timex struct { - Modes uint32 - Pad_cgo_0 [4]byte - Offset int64 - Freq int64 - Maxerror int64 - Esterror int64 - Status int32 - Pad_cgo_1 [4]byte - Constant int64 - Precision int64 - Tolerance int64 - Time Timeval - Tick int64 - Ppsfreq int64 - Jitter int64 - Shift int32 - Pad_cgo_2 [4]byte - Stabil int64 - Jitcnt int64 - Calcnt int64 - Errcnt int64 - Stbcnt int64 - Tai int32 - Pad_cgo_3 [44]byte -} - -type Time_t int64 - -type Tms struct { - Utime int64 - Stime int64 - Cutime int64 - Cstime int64 -} - -type Utimbuf struct { - Actime int64 - Modtime int64 -} - -type Rusage struct { - Utime Timeval - Stime Timeval - Maxrss int64 - Ixrss int64 - Idrss int64 - Isrss int64 - Minflt int64 - Majflt int64 - Nswap int64 - Inblock int64 - Oublock int64 - Msgsnd int64 - Msgrcv int64 - Nsignals int64 - Nvcsw int64 - Nivcsw int64 -} - -type Rlimit struct { - Cur uint64 - Max uint64 -} - -type _Gid_t uint32 - -type Stat_t struct { - Dev uint64 - Ino uint64 - Nlink uint64 - Mode uint32 - Uid uint32 - Gid uint32 - X__pad2 int32 - Rdev uint64 - Size int64 - Blksize int64 - Blocks int64 - Atim Timespec - Mtim Timespec - Ctim Timespec - X__glibc_reserved4 uint64 - X__glibc_reserved5 uint64 - X__glibc_reserved6 uint64 -} - -type Statfs_t struct { - Type int64 - Bsize int64 - Blocks uint64 - Bfree uint64 - Bavail uint64 - Files uint64 - Ffree uint64 - Fsid Fsid - Namelen int64 - Frsize int64 - Flags int64 - Spare [4]int64 -} - -type Dirent struct { - Ino uint64 - Off int64 - Reclen uint16 - Type uint8 - Name [256]uint8 - Pad_cgo_0 [5]byte -} - -type Fsid struct { - X__val [2]int32 -} - -type Flock_t struct { - Type int16 - Whence int16 - Pad_cgo_0 [4]byte - Start int64 - Len int64 - Pid int32 - Pad_cgo_1 [4]byte -} - -const ( - FADV_NORMAL = 0x0 - FADV_RANDOM = 0x1 - FADV_SEQUENTIAL = 0x2 - FADV_WILLNEED = 0x3 - FADV_DONTNEED = 0x4 - FADV_NOREUSE = 0x5 -) - -type RawSockaddrInet4 struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]uint8 -} - -type RawSockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -type RawSockaddrUnix struct { - Family uint16 - Path [108]int8 -} - -type RawSockaddrLinklayer struct { - Family uint16 - Protocol uint16 - Ifindex int32 - Hatype uint16 - Pkttype uint8 - Halen uint8 - Addr [8]uint8 -} - -type RawSockaddrNetlink struct { - Family uint16 - Pad uint16 - Pid uint32 - Groups uint32 -} - -type RawSockaddr struct { - Family uint16 - Data [14]uint8 -} - -type RawSockaddrAny struct { - Addr RawSockaddr - Pad [96]uint8 -} - -type _Socklen uint32 - -type Linger struct { - Onoff int32 - Linger int32 -} - -type Iovec struct { - Base *byte - Len uint64 -} - -type IPMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type IPMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type IPv6Mreq struct { - Multiaddr [16]byte /* in6_addr */ - Interface uint32 -} - -type Msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *Iovec - Iovlen uint64 - Control *byte - Controllen uint64 - Flags int32 - Pad_cgo_1 [4]byte -} - -type Cmsghdr struct { - Len uint64 - Level int32 - Type int32 - X__cmsg_data [0]uint8 -} - -type Inet4Pktinfo struct { - Ifindex int32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type Inet6Pktinfo struct { - Addr [16]byte /* in6_addr */ - Ifindex uint32 -} - -type IPv6MTUInfo struct { - Addr RawSockaddrInet6 - Mtu uint32 -} - -type ICMPv6Filter struct { - Data [8]uint32 -} - -type Ucred struct { - Pid int32 - Uid uint32 - Gid uint32 -} - -type TCPInfo struct { - State uint8 - Ca_state uint8 - Retransmits uint8 - Probes uint8 - Backoff uint8 - Options uint8 - Pad_cgo_0 [2]byte - Rto uint32 - Ato uint32 - Snd_mss uint32 - Rcv_mss uint32 - Unacked uint32 - Sacked uint32 - Lost uint32 - Retrans uint32 - Fackets uint32 - Last_data_sent uint32 - Last_ack_sent uint32 - Last_data_recv uint32 - Last_ack_recv uint32 - Pmtu uint32 - Rcv_ssthresh uint32 - Rtt uint32 - Rttvar uint32 - Snd_ssthresh uint32 - Snd_cwnd uint32 - Advmss uint32 - Reordering uint32 - Rcv_rtt uint32 - Rcv_space uint32 - Total_retrans uint32 -} - -const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x70 - SizeofSockaddrUnix = 0x6e - SizeofSockaddrLinklayer = 0x14 - SizeofSockaddrNetlink = 0xc - SizeofLinger = 0x8 - SizeofIPMreq = 0x8 - SizeofIPMreqn = 0xc - SizeofIPv6Mreq = 0x14 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 - SizeofInet4Pktinfo = 0xc - SizeofInet6Pktinfo = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofICMPv6Filter = 0x20 - SizeofUcred = 0xc - SizeofTCPInfo = 0x68 -) - -const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x22 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 -) - -type NlMsghdr struct { - Len uint32 - Type uint16 - Flags uint16 - Seq uint32 - Pid uint32 -} - -type NlMsgerr struct { - Error int32 - Msg NlMsghdr -} - -type RtGenmsg struct { - Family uint8 -} - -type NlAttr struct { - Len uint16 - Type uint16 -} - -type RtAttr struct { - Len uint16 - Type uint16 -} - -type IfInfomsg struct { - Family uint8 - X__ifi_pad uint8 - Type uint16 - Index int32 - Flags uint32 - Change uint32 -} - -type IfAddrmsg struct { - Family uint8 - Prefixlen uint8 - Flags uint8 - Scope uint8 - Index uint32 -} - -type RtMsg struct { - Family uint8 - Dst_len uint8 - Src_len uint8 - Tos uint8 - Table uint8 - Protocol uint8 - Scope uint8 - Type uint8 - Flags uint32 -} - -type RtNexthop struct { - Len uint16 - Flags uint8 - Hops uint8 - Ifindex int32 -} - -const ( - SizeofSockFilter = 0x8 - SizeofSockFprog = 0x10 -) - -type SockFilter struct { - Code uint16 - Jt uint8 - Jf uint8 - K uint32 -} - -type SockFprog struct { - Len uint16 - Pad_cgo_0 [6]byte - Filter *SockFilter -} - -type InotifyEvent struct { - Wd int32 - Mask uint32 - Cookie uint32 - Len uint32 - Name [0]uint8 -} - -const SizeofInotifyEvent = 0x10 - -type PtraceRegs struct { - Gpr [32]uint64 - Nip uint64 - Msr uint64 - Orig_gpr3 uint64 - Ctr uint64 - Link uint64 - Xer uint64 - Ccr uint64 - Softe uint64 - Trap uint64 - Dar uint64 - Dsisr uint64 - Result uint64 -} - -type FdSet struct { - Bits [16]int64 -} - -type Sysinfo_t struct { - Uptime int64 - Loads [3]uint64 - Totalram uint64 - Freeram uint64 - Sharedram uint64 - Bufferram uint64 - Totalswap uint64 - Freeswap uint64 - Procs uint16 - Pad uint16 - Pad_cgo_0 [4]byte - Totalhigh uint64 - Freehigh uint64 - Unit uint32 - X_f [0]uint8 - Pad_cgo_1 [4]byte -} - -type Utsname struct { - Sysname [65]uint8 - Nodename [65]uint8 - Release [65]uint8 - Version [65]uint8 - Machine [65]uint8 - Domainname [65]uint8 -} - -type Ustat_t struct { - Tfree int32 - Pad_cgo_0 [4]byte - Tinode uint64 - Fname [6]uint8 - Fpack [6]uint8 - Pad_cgo_1 [4]byte -} - -type EpollEvent struct { - Events uint32 - Fd int32 - Pad int32 -} - -const ( - AT_FDCWD = -0x64 - AT_REMOVEDIR = 0x200 - AT_SYMLINK_NOFOLLOW = 0x100 -) - -type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [19]uint8 - Line uint8 - Ispeed uint32 - Ospeed uint32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go index caf755fb86..345bf23b35 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go @@ -1,8 +1,6 @@ // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_netbsd.go -// +build 386,netbsd - package unix const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go index 91b4a5305a..5559f022ab 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go @@ -1,8 +1,6 @@ // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_netbsd.go -// +build amd64,netbsd - package unix const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go index c0758f9d3f..5618909c77 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go @@ -1,8 +1,6 @@ // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_netbsd.go -// +build arm,netbsd - package unix const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go index 860a469796..be07f6e547 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go @@ -1,8 +1,6 @@ // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_openbsd.go -// +build 386,openbsd - package unix const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go index 23c52727f7..d553c2f084 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go @@ -1,8 +1,6 @@ // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_openbsd.go -// +build amd64,openbsd - package unix const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go index b3b928a51e..9d8d0e5f41 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go @@ -1,4 +1,3 @@ -// +build amd64,solaris // Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_solaris.go @@ -10,7 +9,6 @@ const ( sizeofInt = 0x4 sizeofLong = 0x8 sizeofLongLong = 0x8 - PathMax = 0x400 ) type ( @@ -35,18 +33,6 @@ type Timeval32 struct { Usec int32 } -type Tms struct { - Utime int64 - Stime int64 - Cutime int64 - Cstime int64 -} - -type Utimbuf struct { - Actime int64 - Modtime int64 -} - type Rusage struct { Utime Timeval Stime Timeval @@ -242,30 +228,6 @@ type FdSet struct { Bits [1024]int64 } -type Utsname struct { - Sysname [257]int8 - Nodename [257]int8 - Release [257]int8 - Version [257]int8 - Machine [257]int8 -} - -type Ustat_t struct { - Tfree int64 - Tinode uint64 - Fname [6]int8 - Fpack [6]int8 - Pad_cgo_0 [4]byte -} - -const ( - AT_FDCWD = 0xffd19553 - AT_SYMLINK_NOFOLLOW = 0x1000 - AT_SYMLINK_FOLLOW = 0x2000 - AT_REMOVEDIR = 0x1 - AT_EACCESS = 0x4 -) - const ( SizeofIfMsghdr = 0x54 SizeofIfData = 0x44 @@ -393,8 +355,6 @@ type BpfHdr struct { Pad_cgo_0 [2]byte } -const _SC_PAGESIZE = 0xb - type Termios struct { Iflag uint32 Oflag uint32 @@ -403,20 +363,3 @@ type Termios struct { Cc [19]uint8 Pad_cgo_0 [1]byte } - -type Termio struct { - Iflag uint16 - Oflag uint16 - Cflag uint16 - Lflag uint16 - Line int8 - Cc [8]uint8 - Pad_cgo_0 [1]byte -} - -type Winsize struct { - Row uint16 - Col uint16 - Xpixel uint16 - Ypixel uint16 -} diff --git a/vendor/google.golang.org/api/LICENSE b/vendor/google.golang.org/api/LICENSE new file mode 100644 index 0000000000..263aa7a0c1 --- /dev/null +++ b/vendor/google.golang.org/api/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2011 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/google.golang.org/api/gensupport/buffer_test.go b/vendor/google.golang.org/api/gensupport/buffer_test.go deleted file mode 100644 index 253fa791bd..0000000000 --- a/vendor/google.golang.org/api/gensupport/buffer_test.go +++ /dev/null @@ -1,296 +0,0 @@ -// Copyright 2015 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gensupport - -import ( - "bytes" - "io" - "io/ioutil" - "reflect" - "testing" - "testing/iotest" - - "google.golang.org/api/googleapi" -) - -// getChunkAsString reads a chunk from rb, but does not call Next. -func getChunkAsString(t *testing.T, rb *ResumableBuffer) (string, error) { - chunk, _, size, err := rb.Chunk() - - buf, e := ioutil.ReadAll(chunk) - if e != nil { - t.Fatalf("Failed reading chunk: %v", e) - } - if size != len(buf) { - t.Fatalf("reported chunk size doesn't match actual chunk size: got: %v; want: %v", size, len(buf)) - } - return string(buf), err -} - -func TestChunking(t *testing.T) { - type testCase struct { - data string // the data to read from the Reader - finalErr error // error to return after data has been read - chunkSize int - wantChunks []string - } - - for _, singleByteReads := range []bool{true, false} { - for _, tc := range []testCase{ - { - data: "abcdefg", - finalErr: nil, - chunkSize: 3, - wantChunks: []string{"abc", "def", "g"}, - }, - { - data: "abcdefg", - finalErr: nil, - chunkSize: 1, - wantChunks: []string{"a", "b", "c", "d", "e", "f", "g"}, - }, - { - data: "abcdefg", - finalErr: nil, - chunkSize: 7, - wantChunks: []string{"abcdefg"}, - }, - { - data: "abcdefg", - finalErr: nil, - chunkSize: 8, - wantChunks: []string{"abcdefg"}, - }, - { - data: "abcdefg", - finalErr: io.ErrUnexpectedEOF, - chunkSize: 3, - wantChunks: []string{"abc", "def", "g"}, - }, - { - data: "abcdefg", - finalErr: io.ErrUnexpectedEOF, - chunkSize: 8, - wantChunks: []string{"abcdefg"}, - }, - } { - var r io.Reader = &errReader{buf: []byte(tc.data), err: tc.finalErr} - - if singleByteReads { - r = iotest.OneByteReader(r) - } - - rb := NewResumableBuffer(r, tc.chunkSize) - var gotErr error - got := []string{} - for { - chunk, err := getChunkAsString(t, rb) - if len(chunk) != 0 { - got = append(got, string(chunk)) - } - if err != nil { - gotErr = err - break - } - rb.Next() - } - - if !reflect.DeepEqual(got, tc.wantChunks) { - t.Errorf("Failed reading buffer: got: %v; want:%v", got, tc.wantChunks) - } - - expectedErr := tc.finalErr - if expectedErr == nil { - expectedErr = io.EOF - } - if gotErr != expectedErr { - t.Errorf("Reading buffer error: got: %v; want: %v", gotErr, expectedErr) - } - } - } -} - -func TestChunkCanBeReused(t *testing.T) { - er := &errReader{buf: []byte("abcdefg")} - rb := NewResumableBuffer(er, 3) - - // expectChunk reads a chunk and checks that it got what was wanted. - expectChunk := func(want string, wantErr error) { - got, err := getChunkAsString(t, rb) - if err != wantErr { - t.Errorf("error reading buffer: got: %v; want: %v", err, wantErr) - } - if !reflect.DeepEqual(got, want) { - t.Errorf("Failed reading buffer: got: %q; want:%q", got, want) - } - } - expectChunk("abc", nil) - // On second call, should get same chunk again. - expectChunk("abc", nil) - rb.Next() - expectChunk("def", nil) - expectChunk("def", nil) - rb.Next() - expectChunk("g", io.EOF) - expectChunk("g", io.EOF) - rb.Next() - expectChunk("", io.EOF) -} - -func TestPos(t *testing.T) { - er := &errReader{buf: []byte("abcdefg")} - rb := NewResumableBuffer(er, 3) - - expectChunkAtOffset := func(want int64, wantErr error) { - _, off, _, err := rb.Chunk() - if err != wantErr { - t.Errorf("error reading buffer: got: %v; want: %v", err, wantErr) - } - if got := off; got != want { - t.Errorf("resumable buffer Pos: got: %v; want: %v", got, want) - } - } - - // We expect the first chunk to be at offset 0. - expectChunkAtOffset(0, nil) - // Fetching the same chunk should return the same offset. - expectChunkAtOffset(0, nil) - - // Calling Next multiple times should only cause off to advance by 3, since off is not advanced until - // the chunk is actually read. - rb.Next() - rb.Next() - expectChunkAtOffset(3, nil) - - rb.Next() - - // Load the final 1-byte chunk. - expectChunkAtOffset(6, io.EOF) - - // Next will advance 1 byte. But there are no more chunks, so off will not increase beyond 7. - rb.Next() - expectChunkAtOffset(7, io.EOF) - rb.Next() - expectChunkAtOffset(7, io.EOF) -} - -// bytes.Reader implements both Reader and ReaderAt. The following types -// implement various combinations of Reader, ReaderAt and ContentTyper, by -// wrapping bytes.Reader. All implement at least ReaderAt, so they can be -// passed to ReaderAtToReader. The following table summarizes which types -// implement which interfaces: -// -// ReaderAt Reader ContentTyper -// reader x x -// typerReader x x x -// readerAt x -// typerReaderAt x x - -// reader implements Reader, in addition to ReaderAt. -type reader struct { - r *bytes.Reader -} - -func (r *reader) ReadAt(b []byte, off int64) (n int, err error) { - return r.r.ReadAt(b, off) -} - -func (r *reader) Read(b []byte) (n int, err error) { - return r.r.Read(b) -} - -// typerReader implements Reader and ContentTyper, in addition to ReaderAt. -type typerReader struct { - r *bytes.Reader -} - -func (tr *typerReader) ReadAt(b []byte, off int64) (n int, err error) { - return tr.r.ReadAt(b, off) -} - -func (tr *typerReader) Read(b []byte) (n int, err error) { - return tr.r.Read(b) -} - -func (tr *typerReader) ContentType() string { - return "ctype" -} - -// readerAt implements only ReaderAt. -type readerAt struct { - r *bytes.Reader -} - -func (ra *readerAt) ReadAt(b []byte, off int64) (n int, err error) { - return ra.r.ReadAt(b, off) -} - -// typerReaderAt implements ContentTyper, in addition to ReaderAt. -type typerReaderAt struct { - r *bytes.Reader -} - -func (tra *typerReaderAt) ReadAt(b []byte, off int64) (n int, err error) { - return tra.r.ReadAt(b, off) -} - -func (tra *typerReaderAt) ContentType() string { - return "ctype" -} - -func TestAdapter(t *testing.T) { - data := "abc" - - checkConversion := func(to io.Reader, wantTyper bool) { - if _, ok := to.(googleapi.ContentTyper); ok != wantTyper { - t.Errorf("reader implements typer? got: %v; want: %v", ok, wantTyper) - } - if typer, ok := to.(googleapi.ContentTyper); ok && typer.ContentType() != "ctype" { - t.Errorf("content type: got: %s; want: ctype", typer.ContentType()) - } - buf, err := ioutil.ReadAll(to) - if err != nil { - t.Errorf("error reading data: %v", err) - return - } - if !bytes.Equal(buf, []byte(data)) { - t.Errorf("failed reading data: got: %s; want: %s", buf, data) - } - } - - type testCase struct { - from io.ReaderAt - wantTyper bool - } - for _, tc := range []testCase{ - { - from: &reader{bytes.NewReader([]byte(data))}, - wantTyper: false, - }, - { - // Reader and ContentTyper - from: &typerReader{bytes.NewReader([]byte(data))}, - wantTyper: true, - }, - { - // ReaderAt - from: &readerAt{bytes.NewReader([]byte(data))}, - wantTyper: false, - }, - { - // ReaderAt and ContentTyper - from: &typerReaderAt{bytes.NewReader([]byte(data))}, - wantTyper: true, - }, - } { - to := ReaderAtToReader(tc.from, int64(len(data))) - checkConversion(to, tc.wantTyper) - // tc.from is a ReaderAt, and should be treated like one, even - // if it also implements Reader. Specifically, it can be - // reused and read from the beginning. - to = ReaderAtToReader(tc.from, int64(len(data))) - checkConversion(to, tc.wantTyper) - } -} diff --git a/vendor/google.golang.org/api/gensupport/json_test.go b/vendor/google.golang.org/api/gensupport/json_test.go deleted file mode 100644 index b2f921913a..0000000000 --- a/vendor/google.golang.org/api/gensupport/json_test.go +++ /dev/null @@ -1,367 +0,0 @@ -// Copyright 2015 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gensupport - -import ( - "encoding/json" - "reflect" - "testing" - - "google.golang.org/api/googleapi" -) - -type schema struct { - // Basic types - B bool `json:"b,omitempty"` - F float64 `json:"f,omitempty"` - I int64 `json:"i,omitempty"` - Istr int64 `json:"istr,omitempty,string"` - Str string `json:"str,omitempty"` - - // Pointers to basic types - PB *bool `json:"pb,omitempty"` - PF *float64 `json:"pf,omitempty"` - PI *int64 `json:"pi,omitempty"` - PIStr *int64 `json:"pistr,omitempty,string"` - PStr *string `json:"pstr,omitempty"` - - // Other types - Int64s googleapi.Int64s `json:"i64s,omitempty"` - S []int `json:"s,omitempty"` - M map[string]string `json:"m,omitempty"` - Any interface{} `json:"any,omitempty"` - Child *child `json:"child,omitempty"` - - ForceSendFields []string `json:"-"` -} - -type child struct { - B bool `json:"childbool,omitempty"` -} - -type testCase struct { - s schema - want string -} - -func TestBasics(t *testing.T) { - for _, tc := range []testCase{ - { - s: schema{}, - want: `{}`, - }, - { - s: schema{ - ForceSendFields: []string{"B", "F", "I", "Istr", "Str", "PB", "PF", "PI", "PIStr", "PStr"}, - }, - want: `{"b":false,"f":0.0,"i":0,"istr":"0","str":""}`, - }, - { - s: schema{ - B: true, - F: 1.2, - I: 1, - Istr: 2, - Str: "a", - PB: googleapi.Bool(true), - PF: googleapi.Float64(1.2), - PI: googleapi.Int64(int64(1)), - PIStr: googleapi.Int64(int64(2)), - PStr: googleapi.String("a"), - }, - want: `{"b":true,"f":1.2,"i":1,"istr":"2","str":"a","pb":true,"pf":1.2,"pi":1,"pistr":"2","pstr":"a"}`, - }, - { - s: schema{ - B: false, - F: 0.0, - I: 0, - Istr: 0, - Str: "", - PB: googleapi.Bool(false), - PF: googleapi.Float64(0.0), - PI: googleapi.Int64(int64(0)), - PIStr: googleapi.Int64(int64(0)), - PStr: googleapi.String(""), - }, - want: `{"pb":false,"pf":0.0,"pi":0,"pistr":"0","pstr":""}`, - }, - { - s: schema{ - B: false, - F: 0.0, - I: 0, - Istr: 0, - Str: "", - PB: googleapi.Bool(false), - PF: googleapi.Float64(0.0), - PI: googleapi.Int64(int64(0)), - PIStr: googleapi.Int64(int64(0)), - PStr: googleapi.String(""), - ForceSendFields: []string{"B", "F", "I", "Istr", "Str", "PB", "PF", "PI", "PIStr", "PStr"}, - }, - want: `{"b":false,"f":0.0,"i":0,"istr":"0","str":"","pb":false,"pf":0.0,"pi":0,"pistr":"0","pstr":""}`, - }, - } { - checkMarshalJSON(t, tc) - } -} - -func TestSliceFields(t *testing.T) { - for _, tc := range []testCase{ - { - s: schema{}, - want: `{}`, - }, - { - s: schema{S: []int{}, Int64s: googleapi.Int64s{}}, - want: `{}`, - }, - { - s: schema{S: []int{1}, Int64s: googleapi.Int64s{1}}, - want: `{"s":[1],"i64s":["1"]}`, - }, - { - s: schema{ - ForceSendFields: []string{"S", "Int64s"}, - }, - want: `{"s":[],"i64s":[]}`, - }, - { - s: schema{ - S: []int{}, - Int64s: googleapi.Int64s{}, - ForceSendFields: []string{"S", "Int64s"}, - }, - want: `{"s":[],"i64s":[]}`, - }, - { - s: schema{ - S: []int{1}, - Int64s: googleapi.Int64s{1}, - ForceSendFields: []string{"S", "Int64s"}, - }, - want: `{"s":[1],"i64s":["1"]}`, - }, - } { - checkMarshalJSON(t, tc) - } -} - -func TestMapField(t *testing.T) { - for _, tc := range []testCase{ - { - s: schema{}, - want: `{}`, - }, - { - s: schema{M: make(map[string]string)}, - want: `{}`, - }, - { - s: schema{M: map[string]string{"a": "b"}}, - want: `{"m":{"a":"b"}}`, - }, - { - s: schema{ - ForceSendFields: []string{"M"}, - }, - want: `{"m":{}}`, - }, - { - s: schema{ - M: make(map[string]string), - ForceSendFields: []string{"M"}, - }, - want: `{"m":{}}`, - }, - { - s: schema{ - M: map[string]string{"a": "b"}, - ForceSendFields: []string{"M"}, - }, - want: `{"m":{"a":"b"}}`, - }, - } { - checkMarshalJSON(t, tc) - } -} - -type anyType struct { - Field int -} - -func (a anyType) MarshalJSON() ([]byte, error) { - return []byte(`"anyType value"`), nil -} - -func TestAnyField(t *testing.T) { - // ForceSendFields has no effect on nil interfaces and interfaces that contain nil pointers. - var nilAny *anyType - for _, tc := range []testCase{ - { - s: schema{}, - want: `{}`, - }, - { - s: schema{Any: nilAny}, - want: `{"any": null}`, - }, - { - s: schema{Any: &anyType{}}, - want: `{"any":"anyType value"}`, - }, - { - s: schema{Any: anyType{}}, - want: `{"any":"anyType value"}`, - }, - { - s: schema{ - ForceSendFields: []string{"Any"}, - }, - want: `{}`, - }, - { - s: schema{ - Any: nilAny, - ForceSendFields: []string{"Any"}, - }, - want: `{"any": null}`, - }, - { - s: schema{ - Any: &anyType{}, - ForceSendFields: []string{"Any"}, - }, - want: `{"any":"anyType value"}`, - }, - { - s: schema{ - Any: anyType{}, - ForceSendFields: []string{"Any"}, - }, - want: `{"any":"anyType value"}`, - }, - } { - checkMarshalJSON(t, tc) - } -} - -func TestSubschema(t *testing.T) { - // Subschemas are always stored as pointers, so ForceSendFields has no effect on them. - for _, tc := range []testCase{ - { - s: schema{}, - want: `{}`, - }, - { - s: schema{ - ForceSendFields: []string{"Child"}, - }, - want: `{}`, - }, - { - s: schema{Child: &child{}}, - want: `{"child":{}}`, - }, - { - s: schema{ - Child: &child{}, - ForceSendFields: []string{"Child"}, - }, - want: `{"child":{}}`, - }, - { - s: schema{Child: &child{B: true}}, - want: `{"child":{"childbool":true}}`, - }, - - { - s: schema{ - Child: &child{B: true}, - ForceSendFields: []string{"Child"}, - }, - want: `{"child":{"childbool":true}}`, - }, - } { - checkMarshalJSON(t, tc) - } -} - -// checkMarshalJSON verifies that calling schemaToMap on tc.s yields a result which is equivalent to tc.want. -func checkMarshalJSON(t *testing.T, tc testCase) { - doCheckMarshalJSON(t, tc.s, tc.s.ForceSendFields, tc.want) - if len(tc.s.ForceSendFields) == 0 { - // verify that the code path used when ForceSendFields - // is non-empty produces the same output as the fast - // path that is used when it is empty. - doCheckMarshalJSON(t, tc.s, []string{"dummy"}, tc.want) - } -} - -func doCheckMarshalJSON(t *testing.T, s schema, forceSendFields []string, wantJSON string) { - encoded, err := MarshalJSON(s, forceSendFields) - if err != nil { - t.Fatalf("encoding json:\n got err: %v", err) - } - - // The expected and obtained JSON can differ in field ordering, so unmarshal before comparing. - var got interface{} - var want interface{} - err = json.Unmarshal(encoded, &got) - if err != nil { - t.Fatalf("decoding json:\n got err: %v", err) - } - err = json.Unmarshal([]byte(wantJSON), &want) - if err != nil { - t.Fatalf("decoding json:\n got err: %v", err) - } - if !reflect.DeepEqual(got, want) { - t.Errorf("schemaToMap:\ngot :%s\nwant:%s", got, want) - } -} - -func TestParseJSONTag(t *testing.T) { - for _, tc := range []struct { - tag string - want jsonTag - }{ - { - tag: "-", - want: jsonTag{ignore: true}, - }, { - tag: "name,omitempty", - want: jsonTag{apiName: "name"}, - }, { - tag: "name,omitempty,string", - want: jsonTag{apiName: "name", stringFormat: true}, - }, - } { - got, err := parseJSONTag(tc.tag) - if err != nil { - t.Fatalf("parsing json:\n got err: %v\ntag: %q", err, tc.tag) - } - if !reflect.DeepEqual(got, tc.want) { - t.Errorf("parseJSONTage:\ngot :%s\nwant:%s", got, tc.want) - } - } -} -func TestParseMalformedJSONTag(t *testing.T) { - for _, tag := range []string{ - "", - "name", - "name,", - "name,blah", - "name,blah,string", - ",omitempty", - ",omitempty,string", - "name,omitempty,string,blah", - } { - _, err := parseJSONTag(tag) - if err == nil { - t.Fatalf("parsing json: expected err, got nil for tag: %v", tag) - } - } -} diff --git a/vendor/google.golang.org/api/gensupport/media_test.go b/vendor/google.golang.org/api/gensupport/media_test.go deleted file mode 100644 index f0dd364990..0000000000 --- a/vendor/google.golang.org/api/gensupport/media_test.go +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright 2015 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gensupport - -import ( - "bytes" - "io" - "io/ioutil" - "reflect" - "testing" -) - -func TestContentSniffing(t *testing.T) { - type testCase struct { - data []byte // the data to read from the Reader - finalErr error // error to return after data has been read - - wantContentType string - wantContentTypeResult bool - } - - for _, tc := range []testCase{ - { - data: []byte{0, 0, 0, 0}, - finalErr: nil, - wantContentType: "application/octet-stream", - wantContentTypeResult: true, - }, - { - data: []byte(""), - finalErr: nil, - wantContentType: "text/plain; charset=utf-8", - wantContentTypeResult: true, - }, - { - data: []byte(""), - finalErr: io.ErrUnexpectedEOF, - wantContentType: "text/plain; charset=utf-8", - wantContentTypeResult: false, - }, - { - data: []byte("abc"), - finalErr: nil, - wantContentType: "text/plain; charset=utf-8", - wantContentTypeResult: true, - }, - { - data: []byte("abc"), - finalErr: io.ErrUnexpectedEOF, - wantContentType: "text/plain; charset=utf-8", - wantContentTypeResult: false, - }, - // The following examples contain more bytes than are buffered for sniffing. - { - data: bytes.Repeat([]byte("a"), 513), - finalErr: nil, - wantContentType: "text/plain; charset=utf-8", - wantContentTypeResult: true, - }, - { - data: bytes.Repeat([]byte("a"), 513), - finalErr: io.ErrUnexpectedEOF, - wantContentType: "text/plain; charset=utf-8", - wantContentTypeResult: true, // true because error is after first 512 bytes. - }, - } { - er := &errReader{buf: tc.data, err: tc.finalErr} - - sct := newContentSniffer(er) - - // Even if was an error during the first 512 bytes, we should still be able to read those bytes. - buf, err := ioutil.ReadAll(sct) - - if !reflect.DeepEqual(buf, tc.data) { - t.Fatalf("Failed reading buffer: got: %q; want:%q", buf, tc.data) - } - - if err != tc.finalErr { - t.Fatalf("Reading buffer error: got: %v; want: %v", err, tc.finalErr) - } - - ct, ok := sct.ContentType() - if ok != tc.wantContentTypeResult { - t.Fatalf("Content type result got: %v; want: %v", ok, tc.wantContentTypeResult) - } - if ok && ct != tc.wantContentType { - t.Fatalf("Content type got: %q; want: %q", ct, tc.wantContentType) - } - } -} - -type staticContentTyper struct { - io.Reader -} - -func (sct staticContentTyper) ContentType() string { - return "static content type" -} - -func TestDetermineContentType(t *testing.T) { - data := []byte("abc") - rdr := func() io.Reader { - return bytes.NewBuffer(data) - } - - type testCase struct { - r io.Reader - explicitConentType string - wantContentType string - } - - for _, tc := range []testCase{ - { - r: rdr(), - wantContentType: "text/plain; charset=utf-8", - }, - { - r: staticContentTyper{rdr()}, - wantContentType: "static content type", - }, - { - r: staticContentTyper{rdr()}, - explicitConentType: "explicit", - wantContentType: "explicit", - }, - } { - r, ctype := DetermineContentType(tc.r, tc.explicitConentType) - got, err := ioutil.ReadAll(r) - if err != nil { - t.Fatalf("Failed reading buffer: %v", err) - } - if !reflect.DeepEqual(got, data) { - t.Fatalf("Failed reading buffer: got: %q; want:%q", got, data) - } - - if ctype != tc.wantContentType { - t.Fatalf("Content type got: %q; want: %q", ctype, tc.wantContentType) - } - } -} diff --git a/vendor/google.golang.org/api/gensupport/resumable_test.go b/vendor/google.golang.org/api/gensupport/resumable_test.go deleted file mode 100644 index c45bb31f00..0000000000 --- a/vendor/google.golang.org/api/gensupport/resumable_test.go +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gensupport - -import ( - "fmt" - "io" - "io/ioutil" - "net/http" - "reflect" - "strings" - "testing" - "time" - - "golang.org/x/net/context" -) - -type unexpectedReader struct{} - -func (unexpectedReader) Read([]byte) (int, error) { - return 0, fmt.Errorf("unexpected read in test") -} - -// event is an expected request/response pair -type event struct { - // the byte range header that should be present in a request. - byteRange string - // the http status code to send in response. - responseStatus int -} - -// interruptibleTransport is configured with a canned set of requests/responses. -// It records the incoming data, unless the corresponding event is configured to return -// http.StatusServiceUnavailable. -type interruptibleTransport struct { - events []event - buf []byte - bodies bodyTracker -} - -// bodyTracker keeps track of response bodies that have not been closed. -type bodyTracker map[io.ReadCloser]struct{} - -func (bt bodyTracker) Add(body io.ReadCloser) { - bt[body] = struct{}{} -} - -func (bt bodyTracker) Close(body io.ReadCloser) { - delete(bt, body) -} - -type trackingCloser struct { - io.Reader - tracker bodyTracker -} - -func (tc *trackingCloser) Close() error { - tc.tracker.Close(tc) - return nil -} - -func (tc *trackingCloser) Open() { - tc.tracker.Add(tc) -} - -func (t *interruptibleTransport) RoundTrip(req *http.Request) (*http.Response, error) { - ev := t.events[0] - t.events = t.events[1:] - if got, want := req.Header.Get("Content-Range"), ev.byteRange; got != want { - return nil, fmt.Errorf("byte range: got %s; want %s", got, want) - } - - if ev.responseStatus != http.StatusServiceUnavailable { - buf, err := ioutil.ReadAll(req.Body) - if err != nil { - return nil, fmt.Errorf("error reading from request data: %v", err) - } - t.buf = append(t.buf, buf...) - } - - tc := &trackingCloser{unexpectedReader{}, t.bodies} - tc.Open() - - res := &http.Response{ - StatusCode: ev.responseStatus, - Header: http.Header{}, - Body: tc, - } - return res, nil -} - -type progressRecorder struct { - updates []int64 -} - -func (pr *progressRecorder) ProgressUpdate(current int64) { - pr.updates = append(pr.updates, current) -} - -func TestInterruptedTransferChunks(t *testing.T) { - type testCase struct { - data string - chunkSize int - events []event - wantProgress []int64 - } - - for _, tc := range []testCase{ - { - data: strings.Repeat("a", 300), - chunkSize: 90, - events: []event{ - {"bytes 0-89/*", http.StatusServiceUnavailable}, - {"bytes 0-89/*", 308}, - {"bytes 90-179/*", 308}, - {"bytes 180-269/*", http.StatusServiceUnavailable}, - {"bytes 180-269/*", 308}, - {"bytes 270-299/300", 200}, - }, - - wantProgress: []int64{90, 180, 270, 300}, - }, - { - data: strings.Repeat("a", 20), - chunkSize: 10, - events: []event{ - {"bytes 0-9/*", http.StatusServiceUnavailable}, - {"bytes 0-9/*", 308}, - {"bytes 10-19/*", http.StatusServiceUnavailable}, - {"bytes 10-19/*", 308}, - // 0 byte final request demands a byte range with leading asterix. - {"bytes */20", http.StatusServiceUnavailable}, - {"bytes */20", 200}, - }, - - wantProgress: []int64{10, 20}, - }, - } { - media := strings.NewReader(tc.data) - - tr := &interruptibleTransport{ - buf: make([]byte, 0, len(tc.data)), - events: tc.events, - bodies: bodyTracker{}, - } - - // TODO(mcgreevy): replace this sleep with something cleaner. - uploadPause = time.Duration(0) // skip sleep in tests. - pr := progressRecorder{} - rx := &ResumableUpload{ - Client: &http.Client{Transport: tr}, - Media: NewResumableBuffer(media, tc.chunkSize), - MediaType: "text/plain", - Callback: pr.ProgressUpdate, - } - res, err := rx.Upload(context.Background()) - if err == nil { - res.Body.Close() - } - if err != nil || res == nil || res.StatusCode != http.StatusOK { - if res == nil { - t.Errorf("Upload not successful, res=nil: %v", err) - } else { - t.Errorf("Upload not successful, statusCode=%v: %v", res.StatusCode, err) - } - } - if !reflect.DeepEqual(tr.buf, []byte(tc.data)) { - t.Errorf("transferred contents:\ngot %s\nwant %s", tr.buf, tc.data) - } - - if !reflect.DeepEqual(pr.updates, tc.wantProgress) { - t.Errorf("progress updates: got %v, want %v", pr.updates, tc.wantProgress) - } - - if len(tr.events) > 0 { - t.Errorf("did not observe all expected events. leftover events: %v", tr.events) - } - if len(tr.bodies) > 0 { - t.Errorf("unclosed request bodies: %v", tr.bodies) - } - } -} - -func TestCancelUpload(t *testing.T) { - const ( - chunkSize = 90 - mediaSize = 300 - ) - media := strings.NewReader(strings.Repeat("a", mediaSize)) - - tr := &interruptibleTransport{ - buf: make([]byte, 0, mediaSize), - } - - // TODO(mcgreevy): replace this sleep with something cleaner. - // At that time, test cancelling upload at some point other than before it starts. - uploadPause = time.Duration(0) // skip sleep in tests. - pr := progressRecorder{} - rx := &ResumableUpload{ - Client: &http.Client{Transport: tr}, - Media: NewResumableBuffer(media, chunkSize), - MediaType: "text/plain", - Callback: pr.ProgressUpdate, - } - ctx, cancelFunc := context.WithCancel(context.Background()) - cancelFunc() // stop the upload that hasn't started yet - res, err := rx.Upload(ctx) - if err != context.Canceled { - t.Errorf("Upload err: got: %v; want: context cancelled", err) - } - if res != nil { - t.Errorf("Upload result: got: %v; want: nil", res) - } - if pr.updates != nil { - t.Errorf("progress updates: got %v; want: nil", pr.updates) - } -} diff --git a/vendor/google.golang.org/api/gensupport/util_test.go b/vendor/google.golang.org/api/gensupport/util_test.go deleted file mode 100644 index 6da208737f..0000000000 --- a/vendor/google.golang.org/api/gensupport/util_test.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gensupport - -import "io" - -// errReader reads out of a buffer until it is empty, then returns the specified error. -type errReader struct { - buf []byte - err error -} - -func (er *errReader) Read(p []byte) (int, error) { - if len(er.buf) == 0 { - if er.err == nil { - return 0, io.EOF - } - return 0, er.err - } - n := copy(p, er.buf) - er.buf = er.buf[n:] - return n, nil -} diff --git a/vendor/google.golang.org/api/googleapi/googleapi_test.go b/vendor/google.golang.org/api/googleapi/googleapi_test.go deleted file mode 100644 index 4fa051a5db..0000000000 --- a/vendor/google.golang.org/api/googleapi/googleapi_test.go +++ /dev/null @@ -1,380 +0,0 @@ -// Copyright 2011 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package googleapi - -import ( - "bytes" - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "net/url" - "reflect" - "strings" - "testing" -) - -type SetOpaqueTest struct { - in *url.URL - wantRequestURI string -} - -var setOpaqueTests = []SetOpaqueTest{ - // no path - { - &url.URL{ - Scheme: "http", - Host: "www.golang.org", - }, - "http://www.golang.org", - }, - // path - { - &url.URL{ - Scheme: "http", - Host: "www.golang.org", - Path: "/", - }, - "http://www.golang.org/", - }, - // file with hex escaping - { - &url.URL{ - Scheme: "https", - Host: "www.golang.org", - Path: "/file%20one&two", - }, - "https://www.golang.org/file%20one&two", - }, - // query - { - &url.URL{ - Scheme: "http", - Host: "www.golang.org", - Path: "/", - RawQuery: "q=go+language", - }, - "http://www.golang.org/?q=go+language", - }, - // file with hex escaping in path plus query - { - &url.URL{ - Scheme: "https", - Host: "www.golang.org", - Path: "/file%20one&two", - RawQuery: "q=go+language", - }, - "https://www.golang.org/file%20one&two?q=go+language", - }, - // query with hex escaping - { - &url.URL{ - Scheme: "http", - Host: "www.golang.org", - Path: "/", - RawQuery: "q=go%20language", - }, - "http://www.golang.org/?q=go%20language", - }, -} - -// prefixTmpl is a template for the expected prefix of the output of writing -// an HTTP request. -const prefixTmpl = "GET %v HTTP/1.1\r\nHost: %v\r\n" - -func TestSetOpaque(t *testing.T) { - for _, test := range setOpaqueTests { - u := *test.in - SetOpaque(&u) - - w := &bytes.Buffer{} - r := &http.Request{URL: &u} - if err := r.Write(w); err != nil { - t.Errorf("write request: %v", err) - continue - } - - prefix := fmt.Sprintf(prefixTmpl, test.wantRequestURI, test.in.Host) - if got := string(w.Bytes()); !strings.HasPrefix(got, prefix) { - t.Errorf("got %q expected prefix %q", got, prefix) - } - } -} - -type ExpandTest struct { - in string - expansions map[string]string - want string -} - -var expandTests = []ExpandTest{ - // no expansions - { - "http://www.golang.org/", - map[string]string{}, - "http://www.golang.org/", - }, - // one expansion, no escaping - { - "http://www.golang.org/{bucket}/delete", - map[string]string{ - "bucket": "red", - }, - "http://www.golang.org/red/delete", - }, - // one expansion, with hex escapes - { - "http://www.golang.org/{bucket}/delete", - map[string]string{ - "bucket": "red/blue", - }, - "http://www.golang.org/red%2Fblue/delete", - }, - // one expansion, with space - { - "http://www.golang.org/{bucket}/delete", - map[string]string{ - "bucket": "red or blue", - }, - "http://www.golang.org/red%20or%20blue/delete", - }, - // expansion not found - { - "http://www.golang.org/{object}/delete", - map[string]string{ - "bucket": "red or blue", - }, - "http://www.golang.org//delete", - }, - // multiple expansions - { - "http://www.golang.org/{one}/{two}/{three}/get", - map[string]string{ - "one": "ONE", - "two": "TWO", - "three": "THREE", - }, - "http://www.golang.org/ONE/TWO/THREE/get", - }, - // utf-8 characters - { - "http://www.golang.org/{bucket}/get", - map[string]string{ - "bucket": "£100", - }, - "http://www.golang.org/%C2%A3100/get", - }, - // punctuations - { - "http://www.golang.org/{bucket}/get", - map[string]string{ - "bucket": `/\@:,.`, - }, - "http://www.golang.org/%2F%5C%40%3A%2C./get", - }, - // mis-matched brackets - { - "http://www.golang.org/{bucket/get", - map[string]string{ - "bucket": "red", - }, - "http://www.golang.org/{bucket/get", - }, - // "+" prefix for suppressing escape - // See also: http://tools.ietf.org/html/rfc6570#section-3.2.3 - { - "http://www.golang.org/{+topic}", - map[string]string{ - "topic": "/topics/myproject/mytopic", - }, - // The double slashes here look weird, but it's intentional - "http://www.golang.org//topics/myproject/mytopic", - }, -} - -func TestExpand(t *testing.T) { - for i, test := range expandTests { - u := url.URL{ - Path: test.in, - } - Expand(&u, test.expansions) - got := u.Path - if got != test.want { - t.Errorf("got %q expected %q in test %d", got, test.want, i+1) - } - } -} - -type CheckResponseTest struct { - in *http.Response - bodyText string - want error - errText string -} - -var checkResponseTests = []CheckResponseTest{ - { - &http.Response{ - StatusCode: http.StatusOK, - }, - "", - nil, - "", - }, - { - &http.Response{ - StatusCode: http.StatusInternalServerError, - }, - `{"error":{}}`, - &Error{ - Code: http.StatusInternalServerError, - Body: `{"error":{}}`, - }, - `googleapi: got HTTP response code 500 with body: {"error":{}}`, - }, - { - &http.Response{ - StatusCode: http.StatusNotFound, - }, - `{"error":{"message":"Error message for StatusNotFound."}}`, - &Error{ - Code: http.StatusNotFound, - Message: "Error message for StatusNotFound.", - Body: `{"error":{"message":"Error message for StatusNotFound."}}`, - }, - "googleapi: Error 404: Error message for StatusNotFound.", - }, - { - &http.Response{ - StatusCode: http.StatusBadRequest, - }, - `{"error":"invalid_token","error_description":"Invalid Value"}`, - &Error{ - Code: http.StatusBadRequest, - Body: `{"error":"invalid_token","error_description":"Invalid Value"}`, - }, - `googleapi: got HTTP response code 400 with body: {"error":"invalid_token","error_description":"Invalid Value"}`, - }, - { - &http.Response{ - StatusCode: http.StatusBadRequest, - }, - `{"error":{"errors":[{"domain":"usageLimits","reason":"keyInvalid","message":"Bad Request"}],"code":400,"message":"Bad Request"}}`, - &Error{ - Code: http.StatusBadRequest, - Errors: []ErrorItem{ - { - Reason: "keyInvalid", - Message: "Bad Request", - }, - }, - Body: `{"error":{"errors":[{"domain":"usageLimits","reason":"keyInvalid","message":"Bad Request"}],"code":400,"message":"Bad Request"}}`, - Message: "Bad Request", - }, - "googleapi: Error 400: Bad Request, keyInvalid", - }, -} - -func TestCheckResponse(t *testing.T) { - for _, test := range checkResponseTests { - res := test.in - if test.bodyText != "" { - res.Body = ioutil.NopCloser(strings.NewReader(test.bodyText)) - } - g := CheckResponse(res) - if !reflect.DeepEqual(g, test.want) { - t.Errorf("CheckResponse: got %v, want %v", g, test.want) - gotJson, err := json.Marshal(g) - if err != nil { - t.Error(err) - } - wantJson, err := json.Marshal(test.want) - if err != nil { - t.Error(err) - } - t.Errorf("json(got): %q\njson(want): %q", string(gotJson), string(wantJson)) - } - if g != nil && g.Error() != test.errText { - t.Errorf("CheckResponse: unexpected error message.\nGot: %q\nwant: %q", g, test.errText) - } - } -} - -type VariantPoint struct { - Type string - Coordinates []float64 -} - -type VariantTest struct { - in map[string]interface{} - result bool - want VariantPoint -} - -var coords = []interface{}{1.0, 2.0} - -var variantTests = []VariantTest{ - { - in: map[string]interface{}{ - "type": "Point", - "coordinates": coords, - }, - result: true, - want: VariantPoint{ - Type: "Point", - Coordinates: []float64{1.0, 2.0}, - }, - }, - { - in: map[string]interface{}{ - "type": "Point", - "bogus": coords, - }, - result: true, - want: VariantPoint{ - Type: "Point", - }, - }, -} - -func TestVariantType(t *testing.T) { - for _, test := range variantTests { - if g := VariantType(test.in); g != test.want.Type { - t.Errorf("VariantType(%v): got %v, want %v", test.in, g, test.want.Type) - } - } -} - -func TestConvertVariant(t *testing.T) { - for _, test := range variantTests { - g := VariantPoint{} - r := ConvertVariant(test.in, &g) - if r != test.result { - t.Errorf("ConvertVariant(%v): got %v, want %v", test.in, r, test.result) - } - if !reflect.DeepEqual(g, test.want) { - t.Errorf("ConvertVariant(%v): got %v, want %v", test.in, g, test.want) - } - } -} - -func TestRoundChunkSize(t *testing.T) { - type testCase struct { - in int - want int - } - for _, tc := range []testCase{ - {0, 0}, - {256*1024 - 1, 256 * 1024}, - {256 * 1024, 256 * 1024}, - {256*1024 + 1, 2 * 256 * 1024}, - } { - mo := &MediaOptions{} - ChunkSize(tc.in).setOptions(mo) - if got := mo.ChunkSize; got != tc.want { - t.Errorf("rounding chunk size: got: %v; want %v", got, tc.want) - } - } -} diff --git a/vendor/google.golang.org/api/googleapi/types_test.go b/vendor/google.golang.org/api/googleapi/types_test.go deleted file mode 100644 index a6b2045156..0000000000 --- a/vendor/google.golang.org/api/googleapi/types_test.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2013 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package googleapi - -import ( - "encoding/json" - "reflect" - "testing" -) - -func TestTypes(t *testing.T) { - type T struct { - I32 Int32s - I64 Int64s - U32 Uint32s - U64 Uint64s - F64 Float64s - } - v := &T{ - I32: Int32s{-1, 2, 3}, - I64: Int64s{-1, 2, 1 << 33}, - U32: Uint32s{1, 2}, - U64: Uint64s{1, 2, 1 << 33}, - F64: Float64s{1.5, 3.33}, - } - got, err := json.Marshal(v) - if err != nil { - t.Fatal(err) - } - want := `{"I32":["-1","2","3"],"I64":["-1","2","8589934592"],"U32":["1","2"],"U64":["1","2","8589934592"],"F64":["1.5","3.33"]}` - if string(got) != want { - t.Fatalf("Marshal mismatch.\n got: %s\nwant: %s\n", got, want) - } - - v2 := new(T) - if err := json.Unmarshal(got, v2); err != nil { - t.Fatalf("Unmarshal: %v", err) - } - if !reflect.DeepEqual(v, v2) { - t.Fatalf("Unmarshal didn't produce same results.\n got: %#v\nwant: %#v\n", v, v2) - } -} diff --git a/vendor/google.golang.org/cloud/LICENSE b/vendor/google.golang.org/cloud/LICENSE new file mode 100644 index 0000000000..a4c5efd822 --- /dev/null +++ b/vendor/google.golang.org/cloud/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2014 Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From 4a10530b0773d589af7b69f761c5c2a984244ff1 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Steenis Date: Wed, 10 Feb 2016 20:21:17 +0100 Subject: [PATCH 08/15] Change default DOCKER_HOST value, fixes #4923 --- builtin/providers/docker/provider.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/providers/docker/provider.go b/builtin/providers/docker/provider.go index b842d6b62f..cc25e1430f 100644 --- a/builtin/providers/docker/provider.go +++ b/builtin/providers/docker/provider.go @@ -13,7 +13,7 @@ func Provider() terraform.ResourceProvider { "host": &schema.Schema{ Type: schema.TypeString, Required: true, - DefaultFunc: schema.EnvDefaultFunc("DOCKER_HOST", "unix:/run/docker.sock"), + DefaultFunc: schema.EnvDefaultFunc("DOCKER_HOST", "unix:///var/run/docker.sock"), Description: "The Docker daemon address", }, From 706162fb3a28f850723b30f91ce94e0701697c38 Mon Sep 17 00:00:00 2001 From: Alex Clifford Date: Thu, 11 Feb 2016 10:06:43 +1100 Subject: [PATCH 09/15] Grammar inconsistencies --- .../aws/r/elasticache_cluster.html.markdown | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/website/source/docs/providers/aws/r/elasticache_cluster.html.markdown b/website/source/docs/providers/aws/r/elasticache_cluster.html.markdown index 5578f19e8d..1c0740e7a5 100644 --- a/website/source/docs/providers/aws/r/elasticache_cluster.html.markdown +++ b/website/source/docs/providers/aws/r/elasticache_cluster.html.markdown @@ -12,7 +12,7 @@ Provides an ElastiCache Cluster resource. Changes to a Cache Cluster can occur when you manually change a parameter, such as `node_type`, and are reflected in the next maintenance -window. Because of this, Terraform may report a difference in it's planning +window. Because of this, Terraform may report a difference in its planning phase because a modification has not yet taken place. You can use the `apply_immediately` flag to instruct the service to apply the change immediately (see documentation below). @@ -38,7 +38,7 @@ resource "aws_elasticache_cluster" "bar" { The following arguments are supported: -* `cluster_id` – (Required) Group identifier. Elasticache converts +* `cluster_id` – (Required) Group identifier. ElastiCache converts this name to lowercase * `engine` – (Required) Name of the cache engine to be used for this cache cluster. @@ -48,7 +48,7 @@ The following arguments are supported: See [Selecting a Cache Engine and Version](https://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/SelectEngine.html) in the AWS Documentation center for supported versions -* `maintenance_window` – (Optional) Specifies the weekly time range which maintenance +* `maintenance_window` – (Optional) Specifies the weekly time range for when maintenance on the cache cluster is performed. The format is `ddd:hh24:mi-ddd:hh24:mi` (24H Clock UTC). The minimum maintenance window is a 60 minute period. Example: `sun:05:00-sun:09:00` @@ -85,26 +85,25 @@ names to associate with this cache cluster Amazon Resource Name (ARN) of a Redis RDB snapshot file stored in Amazon S3. Example: `arn:aws:s3:::my_bucket/snapshot1.rdb` -* `snapshot_window` - (Optional) The daily time range (in UTC) during which ElastiCache will -begin taking a daily snapshot of your cache cluster. Can only be used for the Redis engine. Example: 05:00-09:00 +* `snapshot_window` - (Optional, Redis only) The daily time range (in UTC) during which ElastiCache will +begin taking a daily snapshot of your cache cluster. Example: 05:00-09:00 -* `snapshot_retention_limit` - (Optional) The number of days for which ElastiCache will +* `snapshot_retention_limit` - (Optional, Redis only) The number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, then a snapshot that was taken today will be retained for 5 days -before being deleted. If the value of SnapshotRetentionLimit is set to zero (0), backups are turned off. -Can only be used for the Redis engine. +before being deleted. If the value of SnapshotRetentionLimit is set to zero (0), backups are turned off * `notification_topic_arn` – (Optional) An Amazon Resource Name (ARN) of an SNS topic to send ElastiCache notifications to. Example: `arn:aws:sns:us-east-1:012345678999:my_sns_topic` -* `az_mode` - (Optional, Memcached only) Specifies whether the nodes in this Memcached node group are created in a single Availability Zone or created across multiple Availability Zones in the cluster's region. Valid values for this parameter are `single-az` or `cross-az`, default is `single-az`. If you want to choose `cross-az`, `num_cache_nodes` must be greater than `1`. +* `az_mode` - (Optional, Memcached only) Specifies whether the nodes in this Memcached node group are created in a single Availability Zone or created across multiple Availability Zones in the cluster's region. Valid values for this parameter are `single-az` or `cross-az`, default is `single-az`. If you want to choose `cross-az`, `num_cache_nodes` must be greater than `1` -* `availability_zone` - (Optional) The AZ for the cache cluster. If you want to create cache nodes in multi-az, use `availability_zones`. +* `availability_zone` - (Optional) The Availability Zone for the cache cluster. If you want to create cache nodes in multi-az, use `availability_zones` -* `availability_zones` - (Optional, Memcached only) List of AZ in which the cache nodes will be created. If you want to create cache nodes in single-az, use `availability_zone`. +* `availability_zones` - (Optional, Memcached only) List of Availability Zones in which the cache nodes will be created. If you want to create cache nodes in single-az, use `availability_zone` -* `tags` - (Optional) A mapping of tags to assign to the resource. +* `tags` - (Optional) A mapping of tags to assign to the resource ~> **NOTE:** Snapshotting functionality is not compatible with t2 instance types. From 455ea87061aefe77307acd66bf783a50e6f4ecfa Mon Sep 17 00:00:00 2001 From: Paul Stack Date: Thu, 11 Feb 2016 05:42:42 +0000 Subject: [PATCH 10/15] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eadab0778..d0a3302f31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ BUG FIXES: * provider/cloudflare: `ttl` no longer shows a change on each plan on `cloudflare_record` resources [GH-5042] * provider/aws: Fix reading auto scaling group load balancers [GH-5045] * provider/aws: Fix reading auto scaling group availability zones [GH-5044] + * provider/docker: Fix the default docker_host value [GH-5088] ## 0.6.11 (February 1, 2016) From 57a9048510702474372613246a2f9a67a21be9c6 Mon Sep 17 00:00:00 2001 From: Trevor Pounds Date: Thu, 11 Feb 2016 00:38:50 -0800 Subject: [PATCH 11/15] Consolidate duplicate list/set type conversions. --- builtin/providers/aws/conversions.go | 34 ------------------------ builtin/providers/aws/opsworks_layers.go | 32 +++++++++++----------- builtin/providers/aws/structure.go | 5 ++++ 3 files changed, 21 insertions(+), 50 deletions(-) delete mode 100644 builtin/providers/aws/conversions.go diff --git a/builtin/providers/aws/conversions.go b/builtin/providers/aws/conversions.go deleted file mode 100644 index 9b215db6c0..0000000000 --- a/builtin/providers/aws/conversions.go +++ /dev/null @@ -1,34 +0,0 @@ -package aws - -import ( - "github.com/hashicorp/terraform/helper/schema" - - "github.com/aws/aws-sdk-go/aws" -) - -func makeAwsStringList(in []interface{}) []*string { - ret := make([]*string, len(in), len(in)) - for i := 0; i < len(in); i++ { - ret[i] = aws.String(in[i].(string)) - } - return ret -} - -func makeAwsStringSet(in *schema.Set) []*string { - inList := in.List() - ret := make([]*string, len(inList), len(inList)) - for i := 0; i < len(ret); i++ { - ret[i] = aws.String(inList[i].(string)) - } - return ret -} - -func unwrapAwsStringList(in []*string) []string { - ret := make([]string, len(in), len(in)) - for i := 0; i < len(in); i++ { - if in[i] != nil { - ret[i] = *in[i] - } - } - return ret -} diff --git a/builtin/providers/aws/opsworks_layers.go b/builtin/providers/aws/opsworks_layers.go index 4ad9382eb0..d9b6269335 100644 --- a/builtin/providers/aws/opsworks_layers.go +++ b/builtin/providers/aws/opsworks_layers.go @@ -271,11 +271,11 @@ func (lt *opsworksLayerType) Read(d *schema.ResourceData, client *opsworks.OpsWo d.Set("auto_assign_elastic_ips", layer.AutoAssignElasticIps) d.Set("auto_assign_public_ips", layer.AutoAssignPublicIps) d.Set("custom_instance_profile_arn", layer.CustomInstanceProfileArn) - d.Set("custom_security_group_ids", unwrapAwsStringList(layer.CustomSecurityGroupIds)) + d.Set("custom_security_group_ids", flattenStringList(layer.CustomSecurityGroupIds)) d.Set("auto_healing", layer.EnableAutoHealing) d.Set("install_updates_on_boot", layer.InstallUpdatesOnBoot) d.Set("name", layer.Name) - d.Set("system_packages", unwrapAwsStringList(layer.Packages)) + d.Set("system_packages", flattenStringList(layer.Packages)) d.Set("stack_id", layer.StackId) d.Set("use_ebs_optimized_instances", layer.UseEbsOptimizedInstances) @@ -298,12 +298,12 @@ func (lt *opsworksLayerType) Create(d *schema.ResourceData, client *opsworks.Ops AutoAssignPublicIps: aws.Bool(d.Get("auto_assign_public_ips").(bool)), CustomInstanceProfileArn: aws.String(d.Get("custom_instance_profile_arn").(string)), CustomRecipes: lt.CustomRecipes(d), - CustomSecurityGroupIds: makeAwsStringSet(d.Get("custom_security_group_ids").(*schema.Set)), + CustomSecurityGroupIds: expandStringSet(d.Get("custom_security_group_ids").(*schema.Set)), EnableAutoHealing: aws.Bool(d.Get("auto_healing").(bool)), InstallUpdatesOnBoot: aws.Bool(d.Get("install_updates_on_boot").(bool)), LifecycleEventConfiguration: lt.LifecycleEventConfiguration(d), Name: aws.String(d.Get("name").(string)), - Packages: makeAwsStringSet(d.Get("system_packages").(*schema.Set)), + Packages: expandStringSet(d.Get("system_packages").(*schema.Set)), Type: aws.String(lt.TypeName), StackId: aws.String(d.Get("stack_id").(string)), UseEbsOptimizedInstances: aws.Bool(d.Get("use_ebs_optimized_instances").(bool)), @@ -339,12 +339,12 @@ func (lt *opsworksLayerType) Update(d *schema.ResourceData, client *opsworks.Ops AutoAssignPublicIps: aws.Bool(d.Get("auto_assign_public_ips").(bool)), CustomInstanceProfileArn: aws.String(d.Get("custom_instance_profile_arn").(string)), CustomRecipes: lt.CustomRecipes(d), - CustomSecurityGroupIds: makeAwsStringSet(d.Get("custom_security_group_ids").(*schema.Set)), + CustomSecurityGroupIds: expandStringSet(d.Get("custom_security_group_ids").(*schema.Set)), EnableAutoHealing: aws.Bool(d.Get("auto_healing").(bool)), InstallUpdatesOnBoot: aws.Bool(d.Get("install_updates_on_boot").(bool)), LifecycleEventConfiguration: lt.LifecycleEventConfiguration(d), Name: aws.String(d.Get("name").(string)), - Packages: makeAwsStringSet(d.Get("system_packages").(*schema.Set)), + Packages: expandStringSet(d.Get("system_packages").(*schema.Set)), UseEbsOptimizedInstances: aws.Bool(d.Get("use_ebs_optimized_instances").(bool)), Attributes: lt.AttributeMap(d), VolumeConfigurations: lt.VolumeConfigurations(d), @@ -467,11 +467,11 @@ func (lt *opsworksLayerType) SetLifecycleEventConfiguration(d *schema.ResourceDa func (lt *opsworksLayerType) CustomRecipes(d *schema.ResourceData) *opsworks.Recipes { return &opsworks.Recipes{ - Configure: makeAwsStringList(d.Get("custom_configure_recipes").([]interface{})), - Deploy: makeAwsStringList(d.Get("custom_deploy_recipes").([]interface{})), - Setup: makeAwsStringList(d.Get("custom_setup_recipes").([]interface{})), - Shutdown: makeAwsStringList(d.Get("custom_shutdown_recipes").([]interface{})), - Undeploy: makeAwsStringList(d.Get("custom_undeploy_recipes").([]interface{})), + Configure: expandStringList(d.Get("custom_configure_recipes").([]interface{})), + Deploy: expandStringList(d.Get("custom_deploy_recipes").([]interface{})), + Setup: expandStringList(d.Get("custom_setup_recipes").([]interface{})), + Shutdown: expandStringList(d.Get("custom_shutdown_recipes").([]interface{})), + Undeploy: expandStringList(d.Get("custom_undeploy_recipes").([]interface{})), } } @@ -487,11 +487,11 @@ func (lt *opsworksLayerType) SetCustomRecipes(d *schema.ResourceData, v *opswork return } - d.Set("custom_configure_recipes", unwrapAwsStringList(v.Configure)) - d.Set("custom_deploy_recipes", unwrapAwsStringList(v.Deploy)) - d.Set("custom_setup_recipes", unwrapAwsStringList(v.Setup)) - d.Set("custom_shutdown_recipes", unwrapAwsStringList(v.Shutdown)) - d.Set("custom_undeploy_recipes", unwrapAwsStringList(v.Undeploy)) + d.Set("custom_configure_recipes", flattenStringList(v.Configure)) + d.Set("custom_deploy_recipes", flattenStringList(v.Deploy)) + d.Set("custom_setup_recipes", flattenStringList(v.Setup)) + d.Set("custom_shutdown_recipes", flattenStringList(v.Shutdown)) + d.Set("custom_undeploy_recipes", flattenStringList(v.Undeploy)) } func (lt *opsworksLayerType) VolumeConfigurations(d *schema.ResourceData) []*opsworks.VolumeConfiguration { diff --git a/builtin/providers/aws/structure.go b/builtin/providers/aws/structure.go index 5bc684433b..e4946fff7e 100644 --- a/builtin/providers/aws/structure.go +++ b/builtin/providers/aws/structure.go @@ -470,6 +470,11 @@ func expandStringList(configured []interface{}) []*string { return vs } +// Takes the result of schema.Set of strings and returns a []*string +func expandStringSet(configured *schema.Set) []*string { + return expandStringList(configured.List()) +} + // Takes list of pointers to strings. Expand to an array // of raw strings and returns a []interface{} // to keep compatibility w/ schema.NewSetschema.NewSet From c000b96f87fd8fb2c281fd7f2a5fabf199e24f14 Mon Sep 17 00:00:00 2001 From: Michael Mell Date: Thu, 11 Feb 2016 10:54:40 -0800 Subject: [PATCH 12/15] add link to CHANGELOG --- website/source/downloads.html.erb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website/source/downloads.html.erb b/website/source/downloads.html.erb index 7849b7e376..5becbd6125 100644 --- a/website/source/downloads.html.erb +++ b/website/source/downloads.html.erb @@ -28,6 +28,9 @@ description: |- which has been signed using HashiCorp's GPG key. You can also download older versions of Terraform from the releases service.

+

+ CHANGELOG +

From ac17be7bf0b916b75fd94bf42a499f60ad88413b Mon Sep 17 00:00:00 2001 From: clint shryock Date: Thu, 11 Feb 2016 13:27:59 -0600 Subject: [PATCH 13/15] Update changelog link with link to latest release --- website/source/downloads.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/source/downloads.html.erb b/website/source/downloads.html.erb index 5becbd6125..4331d081e1 100644 --- a/website/source/downloads.html.erb +++ b/website/source/downloads.html.erb @@ -29,7 +29,7 @@ description: |- You can also download older versions of Terraform from the releases service.

- CHANGELOG + Checkout the v<%= latest_version %> CHANGELOG for information on the latest release.

From 5ba221014e3fb52251ffd5d792697e9eee68d450 Mon Sep 17 00:00:00 2001 From: Clint Date: Thu, 11 Feb 2016 16:12:47 -0600 Subject: [PATCH 14/15] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0a3302f31..ffb1c02eed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ BUG FIXES: * core: Fix race condition when handling tainted resource destroys [GH-5026] * provider/openstack: Fix crash when `access_network` was not defined in instances [GH-4966] * provider/aws: Fix DynamoDB Table Refresh to ensure deleted tables are removed from state [GH-4943] + * provider/aws: Fix issue applying security group changes in EC2 Classic RDS for aws_db_instance [GH-4969] * provider/cloudflare: `ttl` no longer shows a change on each plan on `cloudflare_record` resources [GH-5042] * provider/aws: Fix reading auto scaling group load balancers [GH-5045] * provider/aws: Fix reading auto scaling group availability zones [GH-5044] From 21a59fc708d7cc2c602269b8408efb2bc5afbcd9 Mon Sep 17 00:00:00 2001 From: clint shryock Date: Thu, 11 Feb 2016 16:39:53 -0600 Subject: [PATCH 15/15] provider/aws: All security group mods on first run when restoring from snapshot --- builtin/providers/aws/resource_aws_db_instance.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builtin/providers/aws/resource_aws_db_instance.go b/builtin/providers/aws/resource_aws_db_instance.go index e0cb1776a1..c7fe72868d 100644 --- a/builtin/providers/aws/resource_aws_db_instance.go +++ b/builtin/providers/aws/resource_aws_db_instance.go @@ -369,12 +369,20 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error opts.StorageType = aws.String(attr.(string)) } + log.Printf("[DEBUG] DB Instance restore from snapshot configuration: %s", opts) _, err := conn.RestoreDBInstanceFromDBSnapshot(&opts) if err != nil { return fmt.Errorf("Error creating DB Instance: %s", err) } + var sgUpdate bool if attr := d.Get("vpc_security_group_ids").(*schema.Set); attr.Len() > 0 { + sgUpdate = true + } + if attr := d.Get("security_group_names").(*schema.Set); attr.Len() > 0 { + sgUpdate = true + } + if sgUpdate { log.Printf("[INFO] DB is restoring from snapshot with default security, but custom security should be set, will now update after snapshot is restored!") // wait for instance to get up and then modify security